From pystl-discuss-admin at lists.zpug.org Mon Mar 1 03:11:09 2004 From: pystl-discuss-admin at lists.zpug.org (pystl-discuss-admin@lists.zpug.org) Date: Mon Mar 1 03:11:19 2004 Subject: [Python-checkins] Your message to Pystl-discuss awaits moderator approval Message-ID: Your mail to 'Pystl-discuss' with the subject Monthly incomings summary Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive notification of the moderator's decision. From loteria292 at yahoo.com Mon Mar 1 06:29:36 2004 From: loteria292 at yahoo.com (MARTINEZ SUZANA) Date: Mon Mar 1 06:30:46 2004 Subject: [Python-checkins] AWARD FINAL NOTIFICATION Message-ID: <200403011130.i21BSRYP016593@mxzilla1.xs4all.nl> LOTERIA Y APUESTAS DEL ESTADOS CALLE JUAN CRUZSUAREZ 24,28009 MADRID-ESPA?A. email: loteria292yahoo.com fax:+34 656 683 512. FROM:THE MANAGER CLUB LOTTO PROMOTIONS/PRIZE AWARD DEPT.REF NUMBER:GXX/18905/MA-SP./03. BATCH NUMBER: FC20865KOD. RE: /AWRAD NOTIFICATION/PROCESSMENT ADVICE/ INTERNATIONAL LOTTO OFFICIAL RELEASE NOTICE. We are pleased to inform you of the announcement today, 01 MARCH, 2004 of winners of the SCIENTIFIC GAME PROMO LOTTERY; THE SPANISH /INTERNATIONAL, PROGRAMS held on 22nd DECEMBER, 2003. Your email address attached to ticket number 14.101, with serial number F45337714K drew the lucky numbers 62-287-921,batch number FC20865KOD and consequently won the lottery in the 1st category. You have therefore been approved of a lump sum pay out of EURO 215,810.00 (TWO HUNDRED AND FIFTEEN THOUSAND , EIGHT HUNDRED AND TEN EUROS ONLY credited to file LOTTERY REF NO.X/874268-177/C8. This is from total prize money of EURO 1,000,000.00 shared among the international winners in 1st-3rd categories.All participants were selected through a computer ballot system drawn form 25,000 company email addresses and 30,000,000 individual email addresses from Australia, New Zealand, America, Europe, Africa, North America and Asia as part of International Promotions Program, which is conducted annually. CONGRATULATIONS!Your fund is now in custody of a Security company insured in your FILE REFERENCE. Due to the mix up of some numbers and names, we ask that you keep this award strictly from public notice until your claim has been processed and your money remitted to your account. This is part of our security protocol to avoid double claiming or unscrupulous acts by participants of this program. This lottery program was promoted by our group of philanthropist headed by the Spanish government. We hope with a part of you prize, you will participate in our end of year high stakes EURO 2,000,000 million International Lottery. To begin your claim, please contact your file/claim officer: JOSE GARCIAS, FOREIGN SERVICE MANAGER ZAFIRO MARKETING.S.L MADRID, SPAIN TELEPHONE:+34 665 457 408 , email:zafirosl200@yahoo.com ,Please be informed that the payment/release order of non residence of spain must be notarized at a spnaish notary office prior to payment of lottery fund to beneficiary. Please be aware that your Paying Authority will Effect Payment Swiftly upon satisfactory Report, Verifications and validation provided by our processing Agent; that would be designated to your file. For due processment and remittance of your winning prize to your designated account of your choice. Remember, all prize money must be claimed not later than 20 APRIL, 2004. After this date, all funds will be returned as unclaimed. NOTE: In order to avoid unnecessary delays and complications, please remember to quote your reference and batch numbers in every one of your correspondences with your agent. Furthermore, should there be any change of your address, do inform your claims agent as soon as possible. Congratulations once again from our team of staff and thank you for being part of our promotional program. Note: Anybody under the age of 18 is AUTOMATICALY DISQUALIFIED. Sincerely, MARTINEZ SUZANA. MANAGER/LOTTO CLUB. INTERNATIONAL LOTTO-2003.ALL other right reserved.CODEX-SADOE GS-(MADRID-SPAIN). From levoozimn at jtkgroup.com Mon Mar 1 06:46:34 2004 From: levoozimn at jtkgroup.com (Roxie Alfaro) Date: Mon Mar 1 06:46:57 2004 Subject: [Python-checkins] fill out a questionnaire, earn some $ Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040301/c69ddb48/attachment.html From montanaro at users.sourceforge.net Mon Mar 1 10:44:07 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Mar 1 10:50:50 2004 Subject: [Python-checkins] python/dist/src/Misc gdbinit,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28338/Misc Modified Files: gdbinit Log Message: Add pystack definition to Misc/gdbinit with some explanation of its behavior and add flag comments to ceval.c and main.c alerting people to the coupling between pystack and the layout of those files. Index: gdbinit =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/gdbinit,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gdbinit 3 Oct 2003 20:56:15 -0000 1.3 --- gdbinit 1 Mar 2004 15:44:05 -0000 1.4 *************** *** 35,36 **** --- 35,59 ---- p f->f_lineno end + + # Here's a somewhat fragile way to print the entire Python stack from gdb. + # It's fragile because the tests for the value of $pc depend on the layout + # of specific functions in the C source code. + + # Explanation of while and if tests: We want to pop up the stack until we + # land in Py_Main (this is probably an incorrect assumption in an embedded + # interpreter, but the test can be extended by an interested party). If + # Py_Main <= $pc <= Py_GetArgcArv is true $pc is in Py_Main(), so the while + # tests succeeds as long as it's not true. In a similar fashion the if + # statement tests to see if we are in eval_frame(). + + define pystack + while $pc < Py_Main || $pc > Py_GetArgcArgv + if $pc > eval_frame && $pc < PyEval_EvalCodeEx + set $__fn = PyString_AsString(co->co_filename) + set $__n = PyString_AsString(co->co_name) + printf "%s (%d): %s\n", $__fn, f->f_lineno, $__n + end + up-silently 1 + end + select-frame 0 + end From montanaro at users.sourceforge.net Mon Mar 1 10:44:08 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Mar 1 10:50:51 2004 Subject: [Python-checkins] python/dist/src/Modules main.c,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28338/Modules Modified Files: main.c Log Message: Add pystack definition to Misc/gdbinit with some explanation of its behavior and add flag comments to ceval.c and main.c alerting people to the coupling between pystack and the layout of those files. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** main.c 19 Nov 2003 15:24:46 -0000 1.81 --- main.c 1 Mar 2004 15:44:05 -0000 1.82 *************** *** 453,456 **** --- 453,459 ---- } + /* this is gonna seem *real weird*, but if you put some other code between + Py_Main() and Py_GetArgcArgv() you will need to adjust the test in the + while statement in Misc/gdbinit:ppystack */ /* Make the *original* argc/argv available to other modules. From montanaro at users.sourceforge.net Mon Mar 1 10:44:08 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Mar 1 10:50:53 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.377,2.378 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28338/Python Modified Files: ceval.c Log Message: Add pystack definition to Misc/gdbinit with some explanation of its behavior and add flag comments to ceval.c and main.c alerting people to the coupling between pystack and the layout of those files. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.377 retrieving revision 2.378 diff -C2 -d -r2.377 -r2.378 *** ceval.c 12 Feb 2004 15:28:26 -0000 2.377 --- ceval.c 1 Mar 2004 15:44:05 -0000 2.378 *************** *** 2446,2449 **** --- 2446,2453 ---- } + /* this is gonna seem *real weird*, but if you put some other code between + eval_frame() and PyEval_EvalCodeEx() you will need to adjust the test in + the if statement in Misc/gdbinit:ppystack */ + PyObject * PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, From ubqhfylowlcfqt at uni-lj.si Mon Mar 1 11:25:13 2004 From: ubqhfylowlcfqt at uni-lj.si (Jarred Pearce) Date: Mon Mar 1 11:26:47 2004 Subject: [Python-checkins] Google adwords - A license to print money Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040301/1697f069/attachment.html From rhettinger at users.sourceforge.net Mon Mar 1 18:16:23 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 1 18:23:07 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcollections.tex, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4871/doc/lib Modified Files: libcollections.tex Log Message: Replace left(), right(), and __reversed__() with the more general purpose __getitem__() and __setitem__(). Simplifies the API, reduces the code size, adds flexibility, and makes deques work with bisect.bisect(), random.shuffle(), and random.sample(). Index: libcollections.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcollections.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libcollections.tex 29 Feb 2004 02:15:55 -0000 1.5 --- libcollections.tex 1 Mar 2004 23:16:21 -0000 1.6 *************** *** 55,63 **** \end{methoddesc} - \begin{methoddesc}{left}{} - Return leftmost element from the deque. - If no elements are present, raises a \exception{IndexError}. - \end{methoddesc} - \begin{methoddesc}{pop}{} Remove and return an element from the right side of the deque. --- 55,58 ---- *************** *** 70,78 **** \end{methoddesc} - \begin{methoddesc}{right}{} - Return the rightmost element from the deque. - If no elements are present, raises a \exception{IndexError}. - \end{methoddesc} - \begin{methoddesc}{rotate}{n} Rotate the deque \var{n} steps to the right. If \var{n} is --- 65,68 ---- *************** *** 82,87 **** In addition to the above, deques support iteration, pickling, \samp{len(d)}, ! \samp{reversed(d)}, \samp{copy.copy(d)}, \samp{copy.deepcopy(d)}, and ! membership testing with the \keyword{in} operator. Example: --- 72,78 ---- In addition to the above, deques support iteration, pickling, \samp{len(d)}, ! \samp{reversed(d)}, \samp{copy.copy(d)}, \samp{copy.deepcopy(d)}, ! membership testing with the \keyword{in} operator, and subscript references ! such as \samp{d[-1]}. Example: *************** *** 107,115 **** >>> list(d) # list the contents of the deque ['g', 'h', 'i'] ! ! >>> d.left() # peek at leftmost item 'g' ! >>> d.right() # peek at rightmost item 'i' >>> list(reversed(d)) # list the contents of a deque in reverse ['i', 'h', 'g'] --- 98,106 ---- >>> list(d) # list the contents of the deque ['g', 'h', 'i'] ! >>> d[0] # peek at leftmost item 'g' ! >>> d[-1] # peek at rightmost item 'i' + >>> list(reversed(d)) # list the contents of a deque in reverse ['i', 'h', 'g'] From rhettinger at users.sourceforge.net Mon Mar 1 18:16:23 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 1 18:23:08 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4871/modules Modified Files: collectionsmodule.c Log Message: Replace left(), right(), and __reversed__() with the more general purpose __getitem__() and __setitem__(). Simplifies the API, reduces the code size, adds flexibility, and makes deques work with bisect.bisect(), random.shuffle(), and random.sample(). Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** collectionsmodule.c 29 Feb 2004 15:40:53 -0000 1.9 --- collectionsmodule.c 1 Mar 2004 23:16:20 -0000 1.10 *************** *** 178,213 **** static PyObject * - deque_right(dequeobject *deque, PyObject *unused) - { - PyObject *item; - - if (deque->len == 0) { - PyErr_SetString(PyExc_IndexError, "deque is empty"); - return NULL; - } - item = deque->rightblock->data[deque->rightindex]; - Py_INCREF(item); - return item; - } - - PyDoc_STRVAR(right_doc, "Return the rightmost element."); - - static PyObject * - deque_left(dequeobject *deque, PyObject *unused) - { - PyObject *item; - - if (deque->len == 0) { - PyErr_SetString(PyExc_IndexError, "deque is empty"); - return NULL; - } - item = deque->leftblock->data[deque->leftindex]; - Py_INCREF(item); - return item; - } - - PyDoc_STRVAR(left_doc, "Return the leftmost element."); - - static PyObject * deque_extend(dequeobject *deque, PyObject *iterable) { --- 178,181 ---- *************** *** 347,350 **** --- 315,381 ---- static PyObject * + deque_item(dequeobject *deque, int i) + { + block *b; + PyObject *item; + int n; + + if (i < 0 || i >= deque->len) { + PyErr_SetString(PyExc_IndexError, + "deque index out of range"); + return NULL; + } + + i += deque->leftindex; + n = i / BLOCKLEN; + i %= BLOCKLEN; + if (i < (deque->len >> 1)) { + b = deque->leftblock; + while (n--) + b = b->rightlink; + } else { + n = (deque->leftindex + deque->len - 1) / BLOCKLEN - n; + b = deque->rightblock; + while (n--) + b = b->leftlink; + } + item = b->data[i]; + Py_INCREF(item); + return item; + } + + static int + deque_ass_item(dequeobject *deque, int i, PyObject *v) + { + PyObject *old_value; + block *b; + int n; + + if (i < 0 || i >= deque->len) { + PyErr_SetString(PyExc_IndexError, + "deque index out of range"); + return -1; + } + i += deque->leftindex; + n = i / BLOCKLEN; + i %= BLOCKLEN; + if (i < (deque->len >> 1)) { + b = deque->leftblock; + while (n--) + b = b->rightlink; + } else { + n = (deque->leftindex + deque->len - 1) / BLOCKLEN - n; + b = deque->rightblock; + while (n--) + b = b->leftlink; + } + Py_INCREF(v); + old_value = b->data[i]; + b->data[i] = v; + Py_DECREF(old_value); + return 0; + } + + static PyObject * deque_clearmethod(dequeobject *deque) { *************** *** 372,376 **** static int ! set_traverse(dequeobject *deque, visitproc visit, void *arg) { block * b = deque->leftblock; --- 403,407 ---- static int ! deque_traverse(dequeobject *deque, visitproc visit, void *arg) { block * b = deque->leftblock; *************** *** 598,601 **** --- 629,636 ---- (inquiry)deque_len, /* sq_length */ 0, /* sq_concat */ + 0, /* sq_repeat */ + (intargfunc)deque_item, /* sq_item */ + 0, /* sq_slice */ + (intobjargproc)deque_ass_item, /* sq_ass_item */ }; *************** *** 603,609 **** static PyObject *deque_iter(dequeobject *deque); - static PyObject *deque_reviter(dequeobject *deque); - PyDoc_STRVAR(reversed_doc, - "D.__reversed__() -- return a reverse iterator over the deque"); static PyMethodDef deque_methods[] = { --- 638,641 ---- *************** *** 620,625 **** {"extendleft", (PyCFunction)deque_extendleft, METH_O, extendleft_doc}, - {"left", (PyCFunction)deque_left, - METH_NOARGS, left_doc}, {"pop", (PyCFunction)deque_pop, METH_NOARGS, pop_doc}, --- 652,655 ---- *************** *** 628,635 **** {"__reduce__", (PyCFunction)deque_reduce, METH_NOARGS, reduce_doc}, - {"__reversed__", (PyCFunction)deque_reviter, - METH_NOARGS, reversed_doc}, - {"right", (PyCFunction)deque_right, - METH_NOARGS, right_doc}, {"rotate", (PyCFunction)deque_rotate, METH_VARARGS, rotate_doc}, --- 658,661 ---- *************** *** 666,670 **** Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ deque_doc, /* tp_doc */ ! (traverseproc)set_traverse, /* tp_traverse */ (inquiry)deque_clear, /* tp_clear */ (richcmpfunc)deque_richcompare, /* tp_richcompare */ --- 692,696 ---- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ deque_doc, /* tp_doc */ ! (traverseproc)deque_traverse, /* tp_traverse */ (inquiry)deque_clear, /* tp_clear */ (richcmpfunc)deque_richcompare, /* tp_richcompare */ *************** *** 778,858 **** }; - /*********************** Deque Reverse Iterator **************************/ - - PyTypeObject dequereviter_type; - - static PyObject * - deque_reviter(dequeobject *deque) - { - dequeiterobject *it; - - it = PyObject_New(dequeiterobject, &dequereviter_type); - if (it == NULL) - return NULL; - it->b = deque->rightblock; - it->index = deque->rightindex; - Py_INCREF(deque); - it->deque = deque; - it->len = deque->len; - return (PyObject *)it; - } - - static PyObject * - dequereviter_next(dequeiterobject *it) - { - PyObject *item; - if (it->b == it->deque->leftblock && it->index < it->deque->leftindex) - return NULL; - - if (it->len != it->deque->len) { - it->len = -1; /* Make this state sticky */ - PyErr_SetString(PyExc_RuntimeError, - "deque changed size during iteration"); - return NULL; - } - - item = it->b->data[it->index]; - it->index--; - if (it->index == -1 && it->b->leftlink != NULL) { - it->b = it->b->leftlink; - it->index = BLOCKLEN - 1; - } - Py_INCREF(item); - return item; - } - - PyTypeObject dequereviter_type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "deque_reverse_iterator", /* tp_name */ - sizeof(dequeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dequeiter_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)dequereviter_next, /* tp_iternext */ - 0, - }; - /* module level code ********************************************************/ --- 804,807 ---- *************** *** 876,882 **** return; - if (PyType_Ready(&dequereviter_type) < 0) - return; - return; } --- 825,828 ---- From rhettinger at users.sourceforge.net Mon Mar 1 18:16:24 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 1 18:23:10 2004 Subject: [Python-checkins] python/dist/src/Lib asynchat.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4871/lib Modified Files: asynchat.py Log Message: Replace left(), right(), and __reversed__() with the more general purpose __getitem__() and __setitem__(). Simplifies the API, reduces the code size, adds flexibility, and makes deques work with bisect.bisect(), random.shuffle(), and random.sample(). Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** asynchat.py 29 Feb 2004 02:15:56 -0000 1.23 --- asynchat.py 1 Mar 2004 23:16:22 -0000 1.24 *************** *** 263,267 **** def first (self): ! return self.list.left() def push (self, data): --- 263,267 ---- def first (self): ! return self.list[0] def push (self, data): From rhettinger at users.sourceforge.net Mon Mar 1 18:16:24 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 1 18:23:12 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_deque.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4871/lib/test Modified Files: test_deque.py Log Message: Replace left(), right(), and __reversed__() with the more general purpose __getitem__() and __setitem__(). Simplifies the API, reduces the code size, adds flexibility, and makes deques work with bisect.bisect(), random.shuffle(), and random.sample(). Index: test_deque.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_deque.py 29 Feb 2004 02:15:56 -0000 1.6 --- test_deque.py 1 Mar 2004 23:16:21 -0000 1.7 *************** *** 5,8 **** --- 5,9 ---- import cPickle as pickle from cStringIO import StringIO + import random BIG = 100000 *************** *** 58,68 **** self.assertEqual(list(d), list(reversed('abcd'))) ! def test_leftright(self): d = deque('superman') ! self.assertEqual(d.left(), 's') ! self.assertEqual(d.right(), 'n') d = deque() ! self.assertRaises(IndexError, d.left) ! self.assertRaises(IndexError, d.right) def test_rotate(self): --- 59,93 ---- self.assertEqual(list(d), list(reversed('abcd'))) ! def test_getitem(self): ! n = 200 ! d = deque(xrange(n)) ! l = range(n) ! for i in xrange(n): ! d.popleft() ! l.pop(0) ! if random.random() < 0.5: ! d.append(i) ! l.append(i) ! for j in xrange(1-len(l), len(l)): ! assert d[j] == l[j] ! d = deque('superman') ! self.assertEqual(d[0], 's') ! self.assertEqual(d[-1], 'n') d = deque() ! self.assertRaises(IndexError, d.__getitem__, 0) ! self.assertRaises(IndexError, d.__getitem__, -1) ! ! def test_setitem(self): ! n = 200 ! d = deque(xrange(n)) ! for i in xrange(n): ! d[i] = 10 * i ! self.assertEqual(list(d), [10*i for i in xrange(n)]) ! l = list(d) ! for i in xrange(1-n, 0, -1): ! d[i] = 7*i ! l[i] = 7*i ! self.assertEqual(list(d), l) def test_rotate(self): *************** *** 406,410 **** >>> d = deque('ghi') # make a new deque with three items >>> for elem in d: # iterate over the deque's elements ! ... print elem.upper() G H --- 431,435 ---- >>> d = deque('ghi') # make a new deque with three items >>> for elem in d: # iterate over the deque's elements ! ... print elem.upper() G H *************** *** 420,426 **** >>> list(d) # list the contents of the deque ['g', 'h', 'i'] ! >>> d.left() # peek at leftmost item 'g' ! >>> d.right() # peek at rightmost item 'i' >>> list(reversed(d)) # list the contents of a deque in reverse --- 445,451 ---- >>> list(d) # list the contents of the deque ['g', 'h', 'i'] ! >>> d[0] # peek at leftmost item 'g' ! >>> d[-1] # peek at rightmost item 'i' >>> list(reversed(d)) # list the contents of a deque in reverse *************** *** 477,481 **** counts[i] = sys.gettotalrefcount() print counts ! # doctests from test import test_deque --- 502,506 ---- counts[i] = sys.gettotalrefcount() print counts ! # doctests from test import test_deque From louellaneadow at pammy.com Mon Mar 1 20:35:13 2004 From: louellaneadow at pammy.com (louellaneadow@pammy.com) Date: Mon Mar 1 20:35:16 2004 Subject: [Python-checkins] grow "Date Number"543583 Message-ID: <83385556182915135.3ZFX@msn.com> REALLY lay the pipe to the next chick you screw... http://aid.emarkdinbs.com/vp5 No more of this sort of material. Honoured in 24-48 hours. http://sir.amilsdcx.com/a.html helix skullcap marsha conveyor rangeland stick rawhide catheter befell wherein dither diem backside allegory consonantal inexplicit stammer backdrop ecosystem won meanwhile lomb treacherous minstrelsy dawson tribunal apparition muddlehead caveman tyrannic bayesian corpus barlow hS From bcannon at users.sourceforge.net Mon Mar 1 23:38:12 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Mar 1 23:44:58 2004 Subject: [Python-checkins] python/dist/src/Modules timemodule.c, 2.139, 2.140 datetimemodule.c, 1.69, 1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29826/Modules Modified Files: timemodule.c datetimemodule.c Log Message: Have strftime() check its time tuple argument to make sure the tuple's values are within proper boundaries as specified in the docs. This can break possible code (datetime module needed changing, for instance) that uses 0 for values that need to be greater 1 or greater (month, day, and day of year). Fixes bug #897625. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.139 retrieving revision 2.140 diff -C2 -d -r2.139 -r2.140 *** timemodule.c 20 Nov 2003 01:44:59 -0000 2.139 --- timemodule.c 2 Mar 2004 04:38:10 -0000 2.140 *************** *** 347,350 **** --- 347,392 ---- return NULL; + /* Checks added to make sure strftime() does not crash Python by + indexing blindly into some array for a textual representation + by some bad index (fixes bug #897625). + + No check for year since handled in gettmarg(). + */ + if (buf.tm_mon < 0 || buf.tm_mon > 11) { + PyErr_SetString(PyExc_ValueError, "month out of range"); + return NULL; + } + if (buf.tm_mday < 1 || buf.tm_mday > 31) { + PyErr_SetString(PyExc_ValueError, "day of month out of range"); + return NULL; + } + if (buf.tm_hour < 0 || buf.tm_hour > 23) { + PyErr_SetString(PyExc_ValueError, "hour out of range"); + return NULL; + } + if (buf.tm_min < 0 || buf.tm_min > 59) { + PyErr_SetString(PyExc_ValueError, "minute out of range"); + return NULL; + } + if (buf.tm_sec < 0 || buf.tm_sec > 61) { + PyErr_SetString(PyExc_ValueError, "seconds out of range"); + return NULL; + } + /* tm_wday does not need checking of its upper-bound since taking + ``% 7`` in gettmarg() automatically restricts the range. */ + if (buf.tm_wday < 0) { + PyErr_SetString(PyExc_ValueError, "day of week out of range"); + return NULL; + } + if (buf.tm_yday < 0 || buf.tm_yday > 365) { + PyErr_SetString(PyExc_ValueError, "day of year out of range"); + return NULL; + } + if (buf.tm_isdst < -1 || buf.tm_isdst > 1) { + PyErr_SetString(PyExc_ValueError, + "daylight savings flag out of range"); + return NULL; + } + fmtlen = strlen(fmt); Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** datetimemodule.c 20 Oct 2003 14:01:53 -0000 1.69 --- datetimemodule.c 2 Mar 2004 04:38:10 -0000 1.70 *************** *** 3190,3198 **** */ tuple = Py_BuildValue("iiiiiiiii", ! 1900, 0, 0, /* year, month, day */ TIME_GET_HOUR(self), TIME_GET_MINUTE(self), TIME_GET_SECOND(self), ! 0, 0, -1); /* weekday, daynum, dst */ if (tuple == NULL) return NULL; --- 3190,3198 ---- */ tuple = Py_BuildValue("iiiiiiiii", ! 1900, 1, 1, /* year, month, day */ TIME_GET_HOUR(self), TIME_GET_MINUTE(self), TIME_GET_SECOND(self), ! 0, 1, -1); /* weekday, daynum, dst */ if (tuple == NULL) return NULL; From bcannon at users.sourceforge.net Mon Mar 1 23:38:12 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Mar 1 23:45:00 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.937,1.938 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29826/Misc Modified Files: NEWS Log Message: Have strftime() check its time tuple argument to make sure the tuple's values are within proper boundaries as specified in the docs. This can break possible code (datetime module needed changing, for instance) that uses 0 for values that need to be greater 1 or greater (month, day, and day of year). Fixes bug #897625. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.937 retrieving revision 1.938 diff -C2 -d -r1.937 -r1.938 *** NEWS 19 Feb 2004 19:35:22 -0000 1.937 --- NEWS 2 Mar 2004 04:38:09 -0000 1.938 *************** *** 168,171 **** --- 168,178 ---- ----------------- + - time.strftime() now checks that the values in its time tuple argument + are within the proper boundaries to prevent possible crashes from the + platform's C library implementation of strftime(). Can possibly + break code that uses values outside the range that didn't cause + problems previously (such as sitting day of year to 0). Fixes bug + #897625. + - The socket module now supports Bluetooth sockets, if the system has From bcannon at users.sourceforge.net Mon Mar 1 23:38:12 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Mar 1 23:45:02 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29826/Doc/lib Modified Files: libtime.tex Log Message: Have strftime() check its time tuple argument to make sure the tuple's values are within proper boundaries as specified in the docs. This can break possible code (datetime module needed changing, for instance) that uses 0 for values that need to be greater 1 or greater (month, day, and day of year). Fixes bug #897625. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** libtime.tex 31 Dec 2003 04:52:36 -0000 1.62 --- libtime.tex 2 Mar 2004 04:38:10 -0000 1.63 *************** *** 212,217 **** specified by the \var{format} argument. If \var{t} is not provided, the current time as returned by \function{localtime()} is ! used. \var{format} must be a string. \versionchanged[Allowed \var{t} to be omitted]{2.1} The following directives can be embedded in the \var{format} string. --- 212,220 ---- specified by the \var{format} argument. If \var{t} is not provided, the current time as returned by \function{localtime()} is ! used. \var{format} must be a string. \exception{ValueError} is raised ! if any field in \var{t} is outside of the allowed range. \versionchanged[Allowed \var{t} to be omitted]{2.1} + \versionchanged[\exception{ValueError} raised if a field in \var{t} is + out of range.]{2.4} The following directives can be embedded in the \var{format} string. From bcannon at users.sourceforge.net Mon Mar 1 23:38:13 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Mar 1 23:45:05 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_time.py, 1.15, 1.16 test_strftime.py, 1.27, 1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29826/Lib/test Modified Files: test_time.py test_strftime.py Log Message: Have strftime() check its time tuple argument to make sure the tuple's values are within proper boundaries as specified in the docs. This can break possible code (datetime module needed changing, for instance) that uses 0 for values that need to be greater 1 or greater (month, day, and day of year). Fixes bug #897625. Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_time.py 24 Apr 2003 16:02:53 -0000 1.15 --- test_time.py 2 Mar 2004 04:38:10 -0000 1.16 *************** *** 38,41 **** --- 38,97 ---- self.fail('conversion specifier: %r failed.' % format) + def test_strftime_bounds_checking(self): + # Make sure that strftime() checks the bounds of the various parts + #of the time tuple. + + # Check year + self.assertRaises(ValueError, time.strftime, '', + (1899, 1, 1, 0, 0, 0, 0, 1, -1)) + if time.accept2dyear: + self.assertRaises(ValueError, time.strftime, '', + (-1, 1, 1, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, time.strftime, '', + (100, 1, 1, 0, 0, 0, 0, 1, -1)) + # Check month + self.assertRaises(ValueError, time.strftime, '', + (1900, 0, 1, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, time.strftime, '', + (1900, 13, 1, 0, 0, 0, 0, 1, -1)) + # Check day of month + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 0, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 32, 0, 0, 0, 0, 1, -1)) + # Check hour + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, -1, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 24, 0, 0, 0, 1, -1)) + # Check minute + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, -1, 0, 0, 1, -1)) + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 60, 0, 0, 1, -1)) + # Check second + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, -1, 0, 1, -1)) + # C99 only requires allowing for one leap second, but Python's docs say + # allow two leap seconds (0..61) + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, 62, 0, 1, -1)) + # No check for upper-bound day of week; + # value forced into range by a ``% 7`` calculation. + # Start check at -2 since gettmarg() increments value before taking + # modulo. + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, 0, -2, 1, -1)) + # Check day of the year + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, 0, 0, 0, -1)) + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, 0, 0, 367, -1)) + # Check daylight savings flag + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, 0, 0, 1, -2)) + self.assertRaises(ValueError, time.strftime, '', + (1900, 1, 1, 0, 0, 0, 0, 1, 2)) + def test_strptime(self): tt = time.gmtime(self.t) Index: test_strftime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_strftime.py 23 Jul 2002 19:04:03 -0000 1.27 --- test_strftime.py 2 Mar 2004 04:38:10 -0000 1.28 *************** *** 39,43 **** else: ampm='(PM|pm)' ! jan1 = time.localtime(time.mktime((now[0], 1, 1) + (0,)*6)) try: --- 39,43 ---- else: ampm='(PM|pm)' ! jan1 = time.localtime(time.mktime((now[0], 1, 1, 0, 0, 0, 0, 1, 0))) try: From bcannon at users.sourceforge.net Mon Mar 1 23:45:10 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Mar 1 23:51:58 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libplatform.tex, NONE, 1.2.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31624/Doc/lib Added Files: Tag: release23-maint libplatform.tex Log Message: Backport platform module's docs since module was added in 2.3 . --- NEW FILE: libplatform.tex --- \section{\module{platform} --- Access to underlying platform's identifying data.} \declaremodule{standard}{platform} \modulesynopsis{Retrieves as much platform identifying data as possible.} \moduleauthor{Marc-Andre Lemburg}{mal@egenix.com} \sectionauthor{Bjorn Pettersen}{bpettersen@corp.fairisaac.com} \versionadded{2.3} \begin{notice} Specific platforms listed alphabetically, with Linux included in the \UNIX{} section. \end{notice} \subsection{Cross Platform} \begin{funcdesc}{architecture}{executable=sys.executable, bits='', linkage=''} Queries the given executable (defaults to the Python interpreter binary) for various architecture informations. Returns a tuple \code{(bits, linkage)} which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings. Values that cannot be determined are returned as given by the parameter presets. If bits is given as \code{''}, the \cfunction{sizeof(pointer)} (or \cfunction{sizeof(long)} on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's \file{file} command to do the actual work. This is available on most if not all \UNIX{} platforms and some non-\UNIX{} platforms and then only if the executable points to the Python interpreter. Reasonable defaults are used when the above needs are not met. \end{funcdesc} \begin{funcdesc}{machine}{} Returns the machine type, e.g. \code{'i386'}. An empty string is returned if the value cannot be determined. \end{funcdesc} \begin{funcdesc}{node}{} Returns the computer's network name (may not be fully qualified!). An empty string is returned if the value cannot be determined. \end{funcdesc} \begin{funcdesc}{platform}{aliased=0, terse=0} Returns a single string identifying the underlying platform with as much useful information as possible. The output is intended to be \emph{human readable} rather than machine parseable. It may look different on different platforms and this is intended. If \var{aliased} is true, the function will use aliases for various platforms that report system names which differ from their common names, for example SunOS will be reported as Solaris. The \function{system_alias()} function is used to implement this. Setting \var{terse} to true causes the function to return only the absolute minimum information needed to identify the platform. \end{funcdesc} \begin{funcdesc}{processor}{} Returns the (real) processor name, e.g. \code{'amdk6'}. An empty string is returned if the value cannot be determined. Note that many platforms do not provide this information or simply return the same value as for \function{machine()}. NetBSD does this. \end{funcdesc} \begin{funcdesc}{python_build}{} Returns a tuple \code{(\var{buildno}, \var{builddate})} stating the Python build number and date as strings. \end{funcdesc} \begin{funcdesc}{python_compiler}{} Returns a string identifying the compiler used for compiling Python. \end{funcdesc} \begin{funcdesc}{python_version}{} Returns the Python version as string \code{'major.minor.patchlevel'} Note that unlike the Python \code{sys.version}, the returned value will always include the patchlevel (it defaults to 0). \end{funcdesc} \begin{funcdesc}{python_version_tuple}{} Returns the Python version as tuple \code{(\var{major}, \var{minor}, \var{patchlevel})} of strings. Note that unlike the Python \code{sys.version}, the returned value will always include the patchlevel (it defaults to \code{'0'}). \end{funcdesc} \begin{funcdesc}{release}{} Returns the system's release, e.g. \code{'2.2.0'} or \code{'NT'} An empty string is returned if the value cannot be determined. \end{funcdesc} \begin{funcdesc}{system}{} Returns the system/OS name, e.g. \code{'Linux'}, \code{'Windows'}, or \code{'Java'}. An empty string is returned if the value cannot be determined. \end{funcdesc} \begin{funcdesc}{system_alias}{system, release, version} Returns \code{(\var{system}, \var{release}, \var{version})} aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion. \end{funcdesc} \begin{funcdesc}{version}{} Returns the system's release version, e.g. \code{'\#3 on degas'}. An empty string is returned if the value cannot be determined. \end{funcdesc} \begin{funcdesc}{uname}{} Fairly portable uname interface. Returns a tuple of strings \code{(\var{system}, \var{node}, \var{release}, \var{version}, \var{machine}, \var{processor})} identifying the underlying platform. Note that unlike the \function{os.uname()} function this also returns possible processor information as additional tuple entry. Entries which cannot be determined are set to \code{''}. \end{funcdesc} \subsection{Java Platform} \begin{funcdesc}{java_ver}{release='', vendor='', vminfo=('','',''), osinfo=('','','')} Version interface for JPython. Returns a tuple \code{(\var{release}, \var{vendor}, \var{vminfo}, \var{osinfo})} with \var{vminfo} being a tuple \code{(\var{vm_name}, \var{vm_release}, \var{vm_vendor})} and \var{osinfo} being a tuple \code{(\var{os_name}, \var{os_version}, \var{os_arch})}. Values which cannot be determined are set to the defaults given as parameters (which all default to \code{''}). \end{funcdesc} \subsection{Windows Platform} \begin{funcdesc}{win32_ver}{release='', version='', csd='', ptype=''} Get additional version information from the Windows Registry and return a tuple \code{(\var{version}, \var{csd}, \var{ptype})} referring to version number, CSD level and OS type (multi/single processor). As a hint: \var{ptype} is \code{'Uniprocessor Free'} on single processor NT machines and \code{'Multiprocessor Free'} on multi processor machines. The \emph{'Free'} refers to the OS version being free of debugging code. It could also state \emph{'Checked'} which means the OS version uses debugging code, i.e. code that checks arguments, ranges, etc. \begin{notice}[note] This function only works if Mark Hammond's \module{win32all} package is installed and (obviously) only runs on Win32 compatible platforms. \end{notice} \end{funcdesc} \subsubsection{Win95/98 specific} \begin{funcdesc}{popen}{cmd, mode='r', bufsize=None} Portable \function{popen()} interface. Find a working popen implementation preferring \function{win32pipe.popen()}. On Windows NT, \function{win32pipe.popen()} should work; on Windows 9x it hangs due to bugs in the MS C library. % This KnowledgeBase article appears to be missing... %See also \ulink{MS KnowledgeBase article Q150956}{}. \end{funcdesc} \subsection{Mac OS Platform} \begin{funcdesc}{mac_ver}{release='', versioninfo=('','',''), machine=''} Get Mac OS version information and return it as tuple \code{(\var{release}, \var{versioninfo}, \var{machine})} with \var{versioninfo} being a tuple \code{(\var{version}, \var{dev_stage}, \var{non_release_version})}. Entries which cannot be determined are set to \code{''}. All tuple entries are strings. Documentation for the underlying \cfunction{gestalt()} API is available online at \url{http://www.rgaros.nl/gestalt/}. \end{funcdesc} \subsection{\UNIX{} Platforms} \begin{funcdesc}{dist}{distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake')} Tries to determine the name of the OS distribution name Returns a tuple \code{(\var{distname}, \var{version}, \var{id})} which defaults to the args given as parameters. \end{funcdesc} \begin{funcdesc}{libc_ver}{executable=sys.executable, lib='', version='', chunksize=2048} Tries to determine the libc version against which the file executable (defaults to the Python interpreter) is linked. Returns a tuple of strings \code{(\var{lib}, \var{version})} which default to the given parameters in case the lookup fails. Note that this function has intimate knowledge of how different libc versions add symbols to the executable is probably only useable for executables compiled using \program{gcc}. The file is read and scanned in chunks of \var{chunksize} bytes. \end{funcdesc} From f93dwxzlrj at mgn.maus.de Tue Mar 2 16:40:48 2004 From: f93dwxzlrj at mgn.maus.de (Sergio Butler) Date: Tue Mar 2 19:47:49 2004 Subject: [Python-checkins] New stock profile follows our last two picks that tripled drbz ztenmcq Message-ID: Wall Street Financial Times Newsletter Specializing in Undervalued Small Cap Stocks for Immediate Breakout We have the #1 track record for our picks in 2004: GETC at .12 Currently .50 High .68 UP 467% TLPE at 1.12 Currently 3.35 High 4.40 UP 293% SWYC at .18 Currently .71 High .81 UP 350% DNYY at .47 Currently 1.42 High 1.85 UP 294% Immediate Investor Recommendation Our Hottest Sales and Earnings Play Projected to Triple in 7 Days: Life Energy and Technology Holdings, Inc. (OTCBB: LETH) Price--- 1.35 Sales Orders Received '03--- over $150 Million +300% growth vs. '02 Est. Sales Growth '04--- +165% Results from latest 10-Q: Total Assets--- 36.8 million vs. 16.8 million Cash--- 23.4 million vs. deficit Shareholders Equity--- 12.0 million vs. 2.2 million Shares Outstanding--- 29 mill Est. Shares in Float--- 7 mill Proj. Value Per Share--- 3.25 -- 3.50 Rating--- Urgent Buy LETH is thriving as an emerging world leader in the conversion of waste materials into electrical energy by utilizing their Biosphere Process System, making them the hottest undervalued stock at this price level where shares are ready to explode on huge investor attention. Sales have rocketed beyond all estimates for LETH with no signs of slowing. The numbers continue to stack-up as sales orders for the Biosphere exceed $150 Million over the past year while the stock price doesn't yet reflect the appearance of these impressive figures on an upcoming balance sheet. We are not the first to uncover this phenomenon as the stock is under accumulation, but we are acting aggressively on this recently filed data. The unique proprietary technology of the Biosphere fills an urgent worldwide need for cost-effective renewable energy sources and a corresponding universal need to solve critical problems in the disposal of waste. The Biosphere System provides the highest level of innovative technology while securing worldwide acceptance for a revolutionary product designed to significantly impact the global waste problem while simultaneously generating electricity. The Biosphere System enables LETH to draw revenue from the disposal of various types of waste at 5 to 7 tons per hour including such materials as: Municipal Solid Waste, refinery wastes, agricultural surpluses or effluents, medical waste, industrial waste, shale oil, sour natural gas, and the huge market of used tires are all converted in the Biosphere Process. LETH also profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate permitting, installation and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near-term announcement. LETH has begun to catch the profit-making attention of investors by embracing a major foothold on the global waste problem while a major push for generating electricity from alternative sources continues to be the hot topic due to shortages and massive power failures. LETH contains all the ingredients for major profits as global demand to solve two crisis areas, waste and electrical energy, reaches unprecedented levels. We view this perfectly timed convergence of events as the catalyst for additional contracts that will perpetuate the shattering of the Company's own sales records. We are seeing substantial gains for early investors in a ground floor opportunity that carries our highest rating for short-term trading profits. Required LETH information: Certain statements contained in this newsletter may be forward looking statements within the meaning of The Private Securities Litigation Reform Act of 1995. Such terms as "expect", "believe", "may", "will", and "intend" or similar terms may identify these statements We are not a registered investment advisor or a broker dealer. This is not an offer to buy or sell securities. No recommendation that the securities of the companies profiled should be purchased, sold or held by individuals or entities that learn of the profiled companies. This is an independent electronic publication that was paid five thousand dollars by an unaffiliated third party for the preparation of this company information. Be advised that investments in companies profiled are considered to be high-risk and use of the content provided is for information purposes only. If anyone decides to act as an investor they are advised not to invest without the proper guidance from a financial advisor or a registered financial broker. If any party decides to participate as an investor then it will be that investor's sole risk. Be advised that the purchase of such high-risk securities may result in the loss of some or all of the investment. Investors should not rely solely on the information presented. Rather, investors should use the information provided in this newsletter as a starting point for doing additional independent research on the profiled companies in order to allow the investor to form their own opinion regarding investing in the profiled companies. Factual statements made about the profiled companies are made as of the date stated and are subject to change without notice. Investing in micro-cap securities is highly speculative and carries an extremely high degree of risk. All information provided about the profiled companies may include information provided by outside sources, such as research reports, public filings, and information provided by management of the profiled company. wditbtvtw wwnro e aoenkeuvj From rhettinger at users.sourceforge.net Wed Mar 3 03:27:28 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 3 03:34:26 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex license.tex, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24885 Modified Files: license.tex Log Message: Added license notices that are required to be included in the documentation as well as the source code. Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/license.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** license.tex 20 Dec 2003 20:53:31 -0000 1.2 --- license.tex 3 Mar 2004 08:27:25 -0000 1.3 *************** *** 337,339 **** \end{verbatim} ! --- 337,669 ---- \end{verbatim} ! ! ! \subsection{Sockets} ! ! The \module{socket} module uses the functions, \function{getaddrinfo}, ! and \function{getnameinfo}, which are coded in separate source files ! from the WIDE Project, \url{http://www.wide.ad.jp/about/index.html}. ! ! \begin{verbatim} ! Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. ! 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. Neither the name of the project nor the names of its contributors ! may be used to endorse or promote products derived from this software ! without specific prior written permission. ! ! THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ! GAI_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 PROJECT OR CONTRIBUTORS BE LIABLE ! FOR GAI_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 GAI_ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN GAI_ANY WAY ! OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! SUCH DAMAGE. ! \end{verbatim} ! ! ! ! \subsection{Floating point exception control} ! ! The source for the \module{fpectl} module includes the following notice: ! ! \begin{verbatim} ! --------------------------------------------------------------------- ! / Copyright (c) 1996. \ ! | The Regents of the University of California. | ! | All rights reserved. | ! | | ! | Permission to use, copy, modify, and distribute this software for | ! | any purpose without fee is hereby granted, provided that this en- | ! | tire notice is included in all copies of any software which is or | ! | includes a copy or modification of this software and in all | ! | copies of the supporting documentation for such software. | ! | | ! | This work was produced at the University of California, Lawrence | ! | Livermore National Laboratory under contract no. W-7405-ENG-48 | ! | between the U.S. Department of Energy and The Regents of the | ! | University of California for the operation of UC LLNL. | ! | | ! | DISCLAIMER | ! | | ! | This software was prepared as an account of work sponsored by an | ! | agency of the United States Government. Neither the United States | ! | Government nor the University of California nor any of their em- | ! | ployees, makes any warranty, express or implied, or assumes any | ! | liability or responsibility for the accuracy, completeness, or | ! | usefulness of any information, apparatus, product, or process | ! | disclosed, or represents that its use would not infringe | ! | privately-owned rights. Reference herein to any specific commer- | ! | cial products, process, or service by trade name, trademark, | ! | manufacturer, or otherwise, does not necessarily constitute or | ! | imply its endorsement, recommendation, or favoring by the United | ! | States Government or the University of California. The views and | ! | opinions of authors expressed herein do not necessarily state or | ! | reflect those of the United States Government or the University | ! | of California, and shall not be used for advertising or product | ! \ endorsement purposes. / ! --------------------------------------------------------------------- ! \end{verbatim} ! ! ! ! \subsection{MD5 message digest algorithm} ! ! The source code for the \module{md5} module contains the following notice: ! ! \begin{verbatim} ! Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All ! rights reserved. ! ! License to copy and use this software is granted provided that it ! is identified as the "RSA Data Security, Inc. MD5 Message-Digest ! Algorithm" in all material mentioning or referencing this software ! or this function. ! ! License is also granted to make and use derivative works provided ! that such works are identified as "derived from the RSA Data ! Security, Inc. MD5 Message-Digest Algorithm" in all material ! mentioning or referencing the derived work. ! ! RSA Data Security, Inc. makes no representations concerning either ! the merchantability of this software or the suitability of this ! software for any particular purpose. It is provided "as is" ! without express or implied warranty of any kind. ! ! These notices must be retained in any copies of any part of this ! documentation and/or software. ! \end{verbatim} ! ! ! ! \subsection{rotor -- Enigma-like encryption and decryption} ! ! The source code for the \module{rotor} contains the following notice: ! ! \begin{verbatim} ! Copyright 1994 by Lance Ellinghouse, ! Cathedral City, California Republic, United States of America. ! ! All Rights Reserved ! ! Permission to use, copy, modify, and distribute this software and its ! documentation for any purpose and without fee is hereby granted, ! provided that the above copyright notice appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the name of Lance Ellinghouse ! not be used in advertising or publicity pertaining to distribution ! of the software without specific, written prior permission. ! ! LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO ! THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ! FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE BE LIABLE FOR ANY SPECIAL, ! INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING ! FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, ! NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION ! WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ! \end{verbatim} ! ! ! \subsection{Asynchronous socket services} ! ! The \module{asynchat} and \module{asyncore} modules contain the ! following notice: ! ! \begin{verbatim} ! Copyright 1996 by Sam Rushing ! ! All Rights Reserved ! ! Permission to use, copy, modify, and distribute this software and ! its documentation for any purpose and without fee is hereby ! granted, provided that the above copyright notice appear in all ! copies and that both that copyright notice and this permission ! notice appear in supporting documentation, and that the name of Sam ! Rushing not be used in advertising or publicity pertaining to ! distribution of the software without specific, written prior ! permission. ! ! SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, ! INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN ! NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR ! CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS ! OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, ! NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN ! CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ! \end{verbatim} ! ! ! \subsection{Cookie management} ! ! The \module{Cookie} module contains the following notice: ! ! \begin{verbatim} ! Copyright 2000 by Timothy O'Malley ! ! All Rights Reserved ! ! Permission to use, copy, modify, and distribute this software ! and its documentation for any purpose and without fee is hereby ! granted, provided that the above copyright notice appear in all ! copies and that both that copyright notice and this permission ! notice appear in supporting documentation, and that the name of ! Timothy O'Malley not be used in advertising or publicity ! pertaining to distribution of the software without specific, written ! prior permission. ! ! Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS ! SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ! AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR ! ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ! ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ! PERFORMANCE OF THIS SOFTWARE. ! \end{verbatim} ! ! ! ! \subsection{Profiling} ! ! The \module{profile} and \module{pstats} modules contain ! the following notice: ! ! \begin{verbatim} ! Copyright 1994, by InfoSeek Corporation, all rights reserved. ! Written by James Roskind ! ! Permission to use, copy, modify, and distribute this Python software ! and its associated documentation for any purpose (subject to the ! restriction in the following sentence) without fee is hereby granted, ! provided that the above copyright notice appears in all copies, and ! that both that copyright notice and this permission notice appear in ! supporting documentation, and that the name of InfoSeek not be used in ! advertising or publicity pertaining to distribution of the software ! without specific, written prior permission. This permission is ! explicitly restricted to the copying and modification of the software ! to remain in Python, compiled Python, or other languages (such as C) ! wherein the modified or derived code is exclusively imported into a ! Python module. ! ! INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS ! SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ! FITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY ! SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ! RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF ! CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN ! CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ! \end{verbatim} ! ! ! ! \subsection{Execution tracing} ! ! The \module{trace} module contains the following notice: ! ! \begin{verbatim} ! portions copyright 2001, Autonomous Zones Industries, Inc., all rights... ! err... reserved and offered to the public under the terms of the ! Python 2.2 license. ! Author: Zooko O'Whielacronx ! http://zooko.com/ ! mailto:zooko@zooko.com ! ! Copyright 2000, Mojam Media, Inc., all rights reserved. ! Author: Skip Montanaro ! ! Copyright 1999, Bioreason, Inc., all rights reserved. ! Author: Andrew Dalke ! ! Copyright 1995-1997, Automatrix, Inc., all rights reserved. ! Author: Skip Montanaro ! ! Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved. ! ! ! Permission to use, copy, modify, and distribute this Python software and ! its associated documentation for any purpose without fee is hereby ! granted, provided that the above copyright notice appears in all copies, ! and that both that copyright notice and this permission notice appear in ! supporting documentation, and that the name of neither Automatrix, ! Bioreason or Mojam Media be used in advertising or publicity pertaining to ! distribution of the software without specific, written prior permission. ! \end{verbatim} ! ! ! ! \subsection{UUencode and UUdecode functions} ! ! The \module{uu} module contains the following notice: ! ! \begin{verbatim} ! Copyright 1994 by Lance Ellinghouse ! Cathedral City, California Republic, United States of America. ! All Rights Reserved ! Permission to use, copy, modify, and distribute this software and its ! documentation for any purpose and without fee is hereby granted, ! provided that the above copyright notice appear in all copies and that ! both that copyright notice and this permission notice appear in ! supporting documentation, and that the name of Lance Ellinghouse ! not be used in advertising or publicity pertaining to distribution ! of the software without specific, written prior permission. ! LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO ! THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ! FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE ! FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT ! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ! ! Modified by Jack Jansen, CWI, July 1995: ! - Use binascii module to do the actual line-by-line conversion ! between ascii and binary. This results in a 1000-fold speedup. The C ! version is still 5 times faster, though. ! - Arguments more compliant with python standard ! \end{verbatim} ! ! ! ! \subsection{XML Remote Procedure Calls} ! ! The \module{xmlrpclib} module contains the following notice: ! ! \begin{verbatim} ! The XML-RPC client interface is ! ! Copyright (c) 1999-2002 by Secret Labs AB ! Copyright (c) 1999-2002 by Fredrik Lundh ! ! By obtaining, using, and/or copying this software and/or its ! associated documentation, you agree that you have read, understood, ! and will comply with the following terms and conditions: ! ! Permission to use, copy, modify, and distribute this software and ! its associated documentation for any purpose and without fee is ! hereby granted, provided that the above copyright notice appears in ! all copies, and that both that copyright notice and this permission ! notice appear in supporting documentation, and that the name of ! Secret Labs AB or the author not be used in advertising or publicity ! pertaining to distribution of the software without specific, written ! prior permission. ! ! SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD ! TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- ! ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR ! BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY ! DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ! ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE ! OF THIS SOFTWARE. ! \end{verbatim} From montanaro at users.sourceforge.net Wed Mar 3 03:42:25 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed Mar 3 03:49:24 2004 Subject: [Python-checkins] python/dist/src/Python thread_pthread.h, 2.50, 2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28207 Modified Files: thread_pthread.h Log Message: typo Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** thread_pthread.h 7 Feb 2004 13:00:18 -0000 2.50 --- thread_pthread.h 3 Mar 2004 08:42:23 -0000 2.51 *************** *** 175,179 **** /* XXX This implementation is considered (to quote Tim Peters) "inherently hosed" because: ! - It does not guanrantee the promise that a non-zero integer is returned. - The cast to long is inherently unsafe. - It is not clear that the 'volatile' (for AIX?) and ugly casting in the --- 175,179 ---- /* XXX This implementation is considered (to quote Tim Peters) "inherently hosed" because: ! - It does not guarantee the promise that a non-zero integer is returned. - The cast to long is inherently unsafe. - It is not clear that the 'volatile' (for AIX?) and ugly casting in the From sjoerd at users.sourceforge.net Wed Mar 3 11:34:33 2004 From: sjoerd at users.sourceforge.net (sjoerd@users.sourceforge.net) Date: Wed Mar 3 11:41:36 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-irix5 cdplayer.py, 1.8, 1.9 torgb.py, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22263/Lib/plat-irix5 Modified Files: cdplayer.py torgb.py Log Message: Fixed invalid syntax. Index: cdplayer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix5/cdplayer.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cdplayer.py 12 Feb 2004 17:35:10 -0000 1.8 --- cdplayer.py 3 Mar 2004 16:34:31 -0000 1.9 *************** *** 83,87 **** new.write(self.id + '.artist:\t' + self.artist + '\n') for i in range(1, len(self.track)): ! new.write('%s.track.%r:\t%s\n' % (self.id, i, self.track[i]) old.close() new.close() --- 83,87 ---- new.write(self.id + '.artist:\t' + self.artist + '\n') for i in range(1, len(self.track)): ! new.write('%s.track.%r:\t%s\n' % (self.id, i, self.track[i])) old.close() new.close() Index: torgb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix5/torgb.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** torgb.py 12 Feb 2004 17:35:10 -0000 1.9 --- torgb.py 3 Mar 2004 16:34:31 -0000 1.10 *************** *** 91,95 **** return fname if ftype is None or not table.has_key(ftype): ! raise error, '%s: unsupported image file type %r' % (filename, ftype)) (fd, temp) = tempfile.mkstemp() os.close(fd) --- 91,95 ---- return fname if ftype is None or not table.has_key(ftype): ! raise error, '%s: unsupported image file type %r' % (filename, ftype) (fd, temp) = tempfile.mkstemp() os.close(fd) From sjoerd at users.sourceforge.net Wed Mar 3 11:34:34 2004 From: sjoerd at users.sourceforge.net (sjoerd@users.sourceforge.net) Date: Wed Mar 3 11:41:38 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-irix6 cddb.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22263/Lib/plat-irix6 Modified Files: cddb.py Log Message: Fixed invalid syntax. Index: cddb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/cddb.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cddb.py 12 Feb 2004 17:35:10 -0000 1.4 --- cddb.py 3 Mar 2004 16:34:31 -0000 1.5 *************** *** 190,194 **** for i in range(1, len(self.track)): if self.trackartist[i]: ! f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i]) track = self.track[i] try: --- 190,194 ---- for i in range(1, len(self.track)): if self.trackartist[i]: ! f.write('track%r.artist:\t%s\n' % (i, self.trackartist[i])) track = self.track[i] try: From montanaro at users.sourceforge.net Wed Mar 3 12:42:10 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed Mar 3 14:12:34 2004 Subject: [Python-checkins] python/dist/src/Tools/scripts db2pickle.py, 1.5, 1.6 pickle2db.py, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4650/Tools/scripts Modified Files: db2pickle.py pickle2db.py Log Message: * explain flags in doc strings * reverse order of files on the command line in pickle2db.py to make it symmetrical with db2pickle.py in the two-arg case (src, then dest) Index: db2pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/db2pickle.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** db2pickle.py 28 Oct 2003 16:17:54 -0000 1.5 --- db2pickle.py 3 Mar 2004 17:42:08 -0000 1.6 *************** *** 5,12 **** Convert the database file given on the command line to a pickle ! representation. The optional flags indicate the type of the database (hash, ! btree, recno). The default is hash. If a pickle file is named it is opened ! for write access (deleting any existing data). If no pickle file is named, ! the pickle output is written to standard output. """ --- 5,20 ---- Convert the database file given on the command line to a pickle ! representation. The optional flags indicate the type of the database: ! ! -a - open using anydbm ! -b - open as bsddb btree file ! -d - open as dbm file ! -g - open as gdbm file ! -h - open as bsddb hash file ! -r - open as bsddb recno file ! ! The default is hash. If a pickle file is named it is opened for write ! access (deleting any existing data). If no pickle file is named, the pickle ! output is written to standard output. """ Index: pickle2db.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pickle2db.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pickle2db.py 28 Oct 2003 16:17:54 -0000 1.6 --- pickle2db.py 3 Mar 2004 17:42:08 -0000 1.7 *************** *** 2,17 **** """ ! Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] dbfile [ picklefile ] Read the given picklefile as a series of key/value pairs and write to a new database. If the database already exists, any contents are deleted. The ! optional flags indicate the type of the database (bsddb hash, bsddb btree, ! bsddb recno, anydbm, dbm). The default is hash. If a pickle file is named ! it is opened for read access. If no pickle file is named, the pickle input ! is read from standard input. ! Note that recno databases can only contain numeric keys, so you can't dump a hash or btree database using db2pickle.py and reconstitute it to a recno ! database with %(prog)s. """ --- 2,26 ---- """ ! Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile Read the given picklefile as a series of key/value pairs and write to a new database. If the database already exists, any contents are deleted. The ! optional flags indicate the type of the output database: ! -a - open using anydbm ! -b - open as bsddb btree file ! -d - open as dbm file ! -g - open as gdbm file ! -h - open as bsddb hash file ! -r - open as bsddb recno file ! ! The default is hash. If a pickle file is named it is opened for read ! access. If no pickle file is named, the pickle input is read from standard ! input. ! ! Note that recno databases can only contain integer keys, so you can't dump a hash or btree database using db2pickle.py and reconstitute it to a recno ! database with %(prog)s unless your keys are integers. ! """ *************** *** 57,69 **** return 1 elif len(args) == 1: - dbfile = args[0] pfile = sys.stdin - else: dbfile = args[0] try: ! pfile = open(args[1], 'rb') except IOError: ! sys.stderr.write("Unable to open %s\n" % args[1]) return 1 dbopen = None --- 66,78 ---- return 1 elif len(args) == 1: pfile = sys.stdin dbfile = args[0] + else: try: ! pfile = open(args[0], 'rb') except IOError: ! sys.stderr.write("Unable to open %s\n" % args[0]) return 1 + dbfile = args[1] dbopen = None From montanaro at users.sourceforge.net Wed Mar 3 12:42:10 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed Mar 3 14:12:42 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.938,1.939 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4650/Misc Modified Files: NEWS Log Message: * explain flags in doc strings * reverse order of files on the command line in pickle2db.py to make it symmetrical with db2pickle.py in the two-arg case (src, then dest) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.938 retrieving revision 1.939 diff -C2 -d -r1.938 -r1.939 *** NEWS 2 Mar 2004 04:38:09 -0000 1.938 --- NEWS 3 Mar 2004 17:42:07 -0000 1.939 *************** *** 346,349 **** --- 346,354 ---- - The db2pickle and pickle2db scripts can now dump/load gdbm files. + - The file order on the command line of the pickle2db script was reversed. + It is now [ picklefile ] dbfile. This provides better symmetry with + db2pickle. The file arguments to both scripts are now source followed by + destination in situations where both files are given. + - The pydoc script will display a link to the module documentation for modules determined to be part of the core distribution. The documentation From rhettinger at users.sourceforge.net Thu Mar 4 00:17:52 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:22:59 2004 Subject: [Python-checkins] python/nondist/sandbox/statistics statistics.py, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18972 Modified Files: statistics.py Log Message: Minor tweak to reduce the number of comparisons and passes over the data. Index: statistics.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/statistics/statistics.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** statistics.py 29 Feb 2004 09:12:28 -0000 1.8 --- statistics.py 4 Mar 2004 05:17:50 -0000 1.9 *************** *** 105,110 **** while True: pivot = random.choice(data) ! pcount = data.count(pivot) ! over, under = [], [] uappend, oappend = under.append, over.append for elem in data: --- 105,110 ---- while True: pivot = random.choice(data) ! pcount = 0 ! under, over = [], [] uappend, oappend = under.append, over.append for elem in data: *************** *** 113,116 **** --- 113,118 ---- elif elem > pivot: oappend(elem) + else: + pcount += 1 if n < len(under): data = under From bcannon at users.sourceforge.net Thu Mar 4 00:27:15 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 4 09:23:02 2004 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py, 1.159, 1.160 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20910 Modified Files: datetime.py Log Message: Change date.strftime() to be aligned with Modules/datetimemodule.c in regards to having values in its time tuple for strftime() that meet the bounds checks. Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** datetime.py 7 Feb 2003 21:40:34 -0000 1.159 --- datetime.py 4 Mar 2004 05:27:13 -0000 1.160 *************** *** 1238,1244 **** # The year must be >= 1900 else Python's strftime implementation # can raise a bogus exception. ! timetuple = (1900, 0, 0, self.__hour, self.__minute, self.__second, ! 0, 0, -1) return _wrap_strftime(self, fmt, timetuple) --- 1238,1244 ---- # The year must be >= 1900 else Python's strftime implementation # can raise a bogus exception. ! timetuple = (1900, 1, 1, self.__hour, self.__minute, self.__second, ! 0, 1, -1) return _wrap_strftime(self, fmt, timetuple) From perky at users.sourceforge.net Thu Mar 4 01:36:00 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Mar 4 09:23:39 2004 Subject: [Python-checkins] python/dist/src/Python thread_pthread.h, 2.51, 2.52 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30607/Python Modified Files: thread_pthread.h Log Message: SF Patch #902444: Use process scope thread on FreeBSD. System scope is too expensive on FreeBSD's KSE threading infrastructure and even test_threadedimport fails on default setting. Index: thread_pthread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread_pthread.h,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** thread_pthread.h 3 Mar 2004 08:42:23 -0000 2.51 --- thread_pthread.h 4 Mar 2004 06:35:57 -0000 2.52 *************** *** 134,138 **** pthread_attr_setstacksize(&attrs, THREAD_STACK_SIZE); #endif ! #ifdef PTHREAD_SYSTEM_SCHED_SUPPORTED pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); #endif --- 134,138 ---- pthread_attr_setstacksize(&attrs, THREAD_STACK_SIZE); #endif ! #if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED) && !defined(__FreeBSD__) pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); #endif From rhettinger at users.sourceforge.net Thu Mar 4 03:00:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:24:54 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10342 Modified Files: collectionsmodule.c Log Message: Special case endpoint access for speed. Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** collectionsmodule.c 1 Mar 2004 23:16:20 -0000 1.10 --- collectionsmodule.c 4 Mar 2004 08:00:54 -0000 1.11 *************** *** 327,342 **** } ! i += deque->leftindex; ! n = i / BLOCKLEN; ! i %= BLOCKLEN; ! if (i < (deque->len >> 1)) { b = deque->leftblock; ! while (n--) ! b = b->rightlink; ! } else { ! n = (deque->leftindex + deque->len - 1) / BLOCKLEN - n; b = deque->rightblock; ! while (n--) ! b = b->leftlink; } item = b->data[i]; --- 327,350 ---- } ! if (i == 0) { ! i = deque->leftindex; b = deque->leftblock; ! } else if (i == deque->len - 1) { ! i = deque->rightindex; b = deque->rightblock; ! } else { ! i += deque->leftindex; ! n = i / BLOCKLEN; ! i %= BLOCKLEN; ! if (i < (deque->len >> 1)) { ! b = deque->leftblock; ! while (n--) ! b = b->rightlink; ! } else { ! n = (deque->leftindex + deque->len - 1) / BLOCKLEN - n; ! b = deque->rightblock; ! while (n--) ! b = b->leftlink; ! } } item = b->data[i]; From rhettinger at users.sourceforge.net Thu Mar 4 03:25:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:25:31 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.150, 1.151 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562/Doc/lib Modified Files: libstdtypes.tex Log Message: SF #904720: dict.update should take a 2-tuple sequence like dict.__init_ (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** libstdtypes.tex 8 Jan 2004 00:31:50 -0000 1.150 --- libstdtypes.tex 4 Mar 2004 08:25:43 -0000 1.151 *************** *** 1267,1273 **** {(3)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} ! \lineiii{\var{a}.update(\var{b})} ! {\code{for \var{k} in \var{b}.keys(): \var{a}[\var{k}] = \var{b}[\var{k}]}} ! {} \lineiii{\var{a}.fromkeys(\var{seq}\optional{, \var{value}})} {Creates a new dictionary with keys from \var{seq} and values set to \var{value}} --- 1267,1273 ---- {(3)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} ! \lineiii{\var{a}.update(\optional{\var{b}})} ! {updates (and overwrites) key/value pairs from \var{b}} ! {(9)} \lineiii{\var{a}.fromkeys(\var{seq}\optional{, \var{value}})} {Creates a new dictionary with keys from \var{seq} and values set to \var{value}} *************** *** 1339,1342 **** --- 1339,1349 ---- \end{description} + \item[(9)] \function{update()} accepts either another mapping object + or an iterable of key/value pairs (as a tuple or other iterable of + length two). If keyword arguments are specified, the mapping is + then is updated with those key/value pairs: + \samp{d.update(red=1, blue=2)}. + \versionchanged[Allowed the argument to be an iterable of key/value + pairs and allowed keyword arguments]{2.4} \subsection{File Objects From rhettinger at users.sourceforge.net Thu Mar 4 03:25:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:25:33 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.35, 1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: SF #904720: dict.update should take a 2-tuple sequence like dict.__init_ (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** whatsnew24.tex 17 Feb 2004 10:46:32 -0000 1.35 --- whatsnew24.tex 4 Mar 2004 08:25:44 -0000 1.36 *************** *** 135,138 **** --- 135,142 ---- \begin{itemize} + \item The \method{dict.update()} method now accepts the same + argument forms as the \class{dict} constructor. This includes any + mapping, any iterable of key/value pairs, and/or keyword arguments. + \item The string methods, \method{ljust()}, \method{rjust()}, and \method{center()} now take an optional argument for specifying a From rhettinger at users.sourceforge.net Thu Mar 4 03:25:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:25:35 2004 Subject: [Python-checkins] python/dist/src/Lib UserDict.py, 1.26, 1.27 os.py, 1.74, 1.75 weakref.py, 1.20, 1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562/Lib Modified Files: UserDict.py os.py weakref.py Log Message: SF #904720: dict.update should take a 2-tuple sequence like dict.__init_ (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** UserDict.py 21 Dec 2003 22:19:08 -0000 1.26 --- UserDict.py 4 Mar 2004 08:25:44 -0000 1.27 *************** *** 5,10 **** self.data = {} if dict is not None: - if not hasattr(dict,'keys'): - dict = type({})(dict) # make mapping from a sequence self.update(dict) if len(kwargs): --- 5,8 ---- *************** *** 40,51 **** def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) ! def update(self, dict): ! if isinstance(dict, UserDict): self.data.update(dict.data) ! elif isinstance(dict, type(self.data)): self.data.update(dict) else: for k, v in dict.items(): self[k] = v def get(self, key, failobj=None): if not self.has_key(key): --- 38,53 ---- def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) ! def update(self, dict=None, **kwargs): ! if dict is None: ! pass ! elif isinstance(dict, UserDict): self.data.update(dict.data) ! elif isinstance(dict, type({})) or not hasattr(dict, 'items'): self.data.update(dict) else: for k, v in dict.items(): self[k] = v + if len(kwargs): + self.data.update(kwargs) def get(self, key, failobj=None): if not self.has_key(key): *************** *** 137,151 **** del self[k] return (k, v) ! def update(self, other): # Make progressively weaker assumptions about "other" ! if hasattr(other, 'iteritems'): # iteritems saves memory and lookups for k, v in other.iteritems(): self[k] = v ! elif hasattr(other, '__iter__'): # iter saves memory ! for k in other: ! self[k] = other[k] ! else: for k in other.keys(): self[k] = other[k] def get(self, key, default=None): try: --- 139,157 ---- del self[k] return (k, v) ! def update(self, other=None, **kwargs): # Make progressively weaker assumptions about "other" ! if other is None: ! pass ! elif hasattr(other, 'iteritems'): # iteritems saves memory and lookups for k, v in other.iteritems(): self[k] = v ! elif hasattr(other, 'keys'): for k in other.keys(): self[k] = other[k] + else: + for k, v in other: + self[k] = v + if kwargs: + self.update(kwargs) def get(self, key, default=None): try: Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** os.py 23 Dec 2003 16:33:28 -0000 1.74 --- os.py 4 Mar 2004 08:25:44 -0000 1.75 *************** *** 434,440 **** def get(self, key, failobj=None): return self.data.get(key.upper(), failobj) - def update(self, dict): - for k, v in dict.items(): - self[k] = v def copy(self): return dict(self) --- 434,437 ---- *************** *** 448,454 **** putenv(key, item) self.data[key] = item - def update(self, dict): - for k, v in dict.items(): - self[k] = v try: unsetenv --- 445,448 ---- Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** weakref.py 25 May 2003 01:45:11 -0000 1.20 --- weakref.py 4 Mar 2004 08:25:44 -0000 1.21 *************** *** 123,130 **** return wr() ! def update(self, dict): d = self.data ! for key, o in dict.items(): ! d[key] = ref(o, self.__makeremove(key)) def values(self): --- 123,135 ---- return wr() ! def update(self, dict=None, **kwargs): d = self.data ! if dict is not None: ! if not hasattr(dict, "items"): ! dict = type({})(dict) ! for key, o in dict.items(): ! d[key] = ref(o, self.__makeremove(key)) ! if len(kwargs): ! self.update(kwargs) def values(self): *************** *** 240,247 **** return self.data.setdefault(ref(key, self._remove),default) ! def update(self, dict): d = self.data ! for key, value in dict.items(): ! d[ref(key, self._remove)] = value --- 245,257 ---- return self.data.setdefault(ref(key, self._remove),default) ! def update(self, dict=None, **kwargs): d = self.data ! if dict is not None: ! if not hasattr(dict, "items"): ! dict = type({})(dict) ! for key, value in dict.items(): ! d[ref(key, self._remove)] = value ! if len(kwargs): ! self.update(kwargs) From rhettinger at users.sourceforge.net Thu Mar 4 03:25:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:25:38 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_call.py, 1.4, 1.5 test_types.py, 1.58, 1.59 test_userdict.py, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562/Lib/test Modified Files: test_call.py test_types.py test_userdict.py Log Message: SF #904720: dict.update should take a 2-tuple sequence like dict.__init_ (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments. Index: test_call.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_call.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_call.py 1 May 2003 17:45:34 -0000 1.4 --- test_call.py 4 Mar 2004 08:25:44 -0000 1.5 *************** *** 87,101 **** def test_oldargs1_0(self): ! self.assertRaises(TypeError, {}.update) def test_oldargs1_1(self): ! {}.update({}) def test_oldargs1_2(self): ! self.assertRaises(TypeError, {}.update, {}, 1) def test_oldargs1_0_ext(self): try: ! {}.update(*()) except TypeError: pass --- 87,101 ---- def test_oldargs1_0(self): ! self.assertRaises(TypeError, [].count) def test_oldargs1_1(self): ! [].count(1) def test_oldargs1_2(self): ! self.assertRaises(TypeError, [].count, 1, 2) def test_oldargs1_0_ext(self): try: ! [].count(*()) except TypeError: pass *************** *** 104,112 **** def test_oldargs1_1_ext(self): ! {}.update(*({},)) def test_oldargs1_2_ext(self): try: ! {}.update(*({}, 2)) except TypeError: pass --- 104,112 ---- def test_oldargs1_1_ext(self): ! [].count(*(1,)) def test_oldargs1_2_ext(self): try: ! [].count(*(1, 2)) except TypeError: pass *************** *** 115,125 **** def test_oldargs1_0_kw(self): ! self.assertRaises(TypeError, {}.update, x=2) def test_oldargs1_1_kw(self): ! self.assertRaises(TypeError, {}.update, {}, x=2) def test_oldargs1_2_kw(self): ! self.assertRaises(TypeError, {}.update, x=2, y=2) --- 115,125 ---- def test_oldargs1_0_kw(self): ! self.assertRaises(TypeError, [].count, x=2) def test_oldargs1_1_kw(self): ! self.assertRaises(TypeError, [].count, {}, x=2) def test_oldargs1_2_kw(self): ! self.assertRaises(TypeError, [].count, x=2, y=2) Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** test_types.py 12 Feb 2004 17:35:11 -0000 1.58 --- test_types.py 4 Mar 2004 08:25:44 -0000 1.59 *************** *** 254,258 **** d.clear() try: d.update(None) ! except AttributeError: pass else: raise TestFailed, 'dict.update(None), AttributeError expected' class SimpleUserDict: --- 254,258 ---- d.clear() try: d.update(None) ! except (TypeError, AttributeError): pass else: raise TestFailed, 'dict.update(None), AttributeError expected' class SimpleUserDict: Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_userdict.py 16 Nov 2003 16:17:48 -0000 1.17 --- test_userdict.py 4 Mar 2004 08:25:44 -0000 1.18 *************** *** 94,99 **** p.update(self.reference) self.assertEqual(dict(p), self.reference) d = self._full_mapping(self.reference) ! #setdefaullt key, value = d.iteritems().next() knownkey, knownvalue = self.other.iteritems().next() --- 94,103 ---- p.update(self.reference) self.assertEqual(dict(p), self.reference) + items = p.items() + p = self._empty_mapping() + p.update(items) + self.assertEqual(dict(p), self.reference) d = self._full_mapping(self.reference) ! #setdefault key, value = d.iteritems().next() knownkey, knownvalue = self.other.iteritems().next() From rhettinger at users.sourceforge.net Thu Mar 4 03:25:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:25:40 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.259, 1.260 NEWS, 1.939, 1.940 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562/Misc Modified Files: ACKS NEWS Log Message: SF #904720: dict.update should take a 2-tuple sequence like dict.__init_ (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.259 retrieving revision 1.260 diff -C2 -d -r1.259 -r1.260 *** ACKS 8 Feb 2004 18:54:37 -0000 1.259 --- ACKS 4 Mar 2004 08:25:44 -0000 1.260 *************** *** 274,277 **** --- 274,278 ---- Tony Ingraldi John Interrante + Bob Ippolito Ben Jackson Paul Jackson Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.939 retrieving revision 1.940 diff -C2 -d -r1.939 -r1.940 *** NEWS 3 Mar 2004 17:42:07 -0000 1.939 --- NEWS 4 Mar 2004 08:25:44 -0000 1.940 *************** *** 33,36 **** --- 33,40 ---- utilization for applications that have large numbers of small lists. + - The dict.update() method now accepts all the same argument forms + as the dict() constructor. This now includes item lists and/or + keyword arguments. + - Support for arbitrary objects supporting the read-only buffer interface as the co_code field of code objects (something that was From rhettinger at users.sourceforge.net Thu Mar 4 03:25:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 4 09:25:42 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.151,2.152 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562/Objects Modified Files: dictobject.c Log Message: SF #904720: dict.update should take a 2-tuple sequence like dict.__init_ (Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.151 retrieving revision 2.152 diff -C2 -d -r2.151 -r2.152 *** dictobject.c 17 Feb 2004 20:10:11 -0000 2.151 --- dictobject.c 4 Mar 2004 08:25:44 -0000 2.152 *************** *** 1030,1037 **** } static PyObject * ! dict_update(PyObject *mp, PyObject *other) { ! if (PyDict_Update(mp, other) < 0) return NULL; Py_INCREF(Py_None); --- 1030,1057 ---- } + static int + dict_update_common(PyObject *self, PyObject *args, PyObject *kwds, char *methname) + { + PyObject *arg = NULL; + int result = 0; + + if (!PyArg_UnpackTuple(args, methname, 0, 1, &arg)) + result = -1; + + else if (arg != NULL) { + if (PyObject_HasAttrString(arg, "keys")) + result = PyDict_Merge(self, arg, 1); + else + result = PyDict_MergeFromSeq2(self, arg, 1); + } + if (result == 0 && kwds != NULL) + result = PyDict_Merge(self, kwds, 1); + return result; + } + static PyObject * ! dict_update(PyObject *self, PyObject *args, PyObject *kwds) { ! if (dict_update_common(self, args, kwds, "update") == -1) return NULL; Py_INCREF(Py_None); *************** *** 1807,1811 **** {"values", (PyCFunction)dict_values, METH_NOARGS, values__doc__}, ! {"update", (PyCFunction)dict_update, METH_O, update__doc__}, {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS | METH_CLASS, --- 1827,1831 ---- {"values", (PyCFunction)dict_values, METH_NOARGS, values__doc__}, ! {"update", (PyCFunction)dict_update, METH_VARARGS | METH_KEYWORDS, update__doc__}, {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS | METH_CLASS, *************** *** 1876,1894 **** dict_init(PyObject *self, PyObject *args, PyObject *kwds) { ! PyObject *arg = NULL; ! int result = 0; ! ! if (!PyArg_UnpackTuple(args, "dict", 0, 1, &arg)) ! result = -1; ! ! else if (arg != NULL) { ! if (PyObject_HasAttrString(arg, "keys")) ! result = PyDict_Merge(self, arg, 1); ! else ! result = PyDict_MergeFromSeq2(self, arg, 1); ! } ! if (result == 0 && kwds != NULL) ! result = PyDict_Merge(self, kwds, 1); ! return result; } --- 1896,1900 ---- dict_init(PyObject *self, PyObject *args, PyObject *kwds) { ! return dict_update_common(self, args, kwds, "dict"); } From rhettinger at users.sourceforge.net Fri Mar 5 03:49:58 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 5 03:57:16 2004 Subject: [Python-checkins] python/nondist/sandbox/statistics statistics.py, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12226 Modified Files: statistics.py Log Message: * Simplify select() by replacing try/except with if/raise. * Speed-up nlargest/nsmallest by keeping top of heap in a variable. Index: statistics.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/statistics/statistics.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** statistics.py 4 Mar 2004 05:17:50 -0000 1.9 --- statistics.py 5 Mar 2004 08:49:56 -0000 1.10 *************** *** 102,127 **** """ data = list(data) ! try: ! while True: ! pivot = random.choice(data) ! pcount = 0 ! under, over = [], [] ! uappend, oappend = under.append, over.append ! for elem in data: ! if elem < pivot: ! uappend(elem) ! elif elem > pivot: ! oappend(elem) ! else: ! pcount += 1 ! if n < len(under): ! data = under ! elif n < len(under) + pcount: ! return pivot ! else: ! data = over ! n -= len(under) + pcount ! except IndexError: raise ValueError('not enough elements for the given rank') def median(data): --- 102,126 ---- """ data = list(data) ! if not 0 <= n < len(data): raise ValueError('not enough elements for the given rank') + while True: + pivot = random.choice(data) + pcount = 0 + under, over = [], [] + uappend, oappend = under.append, over.append + for elem in data: + if elem < pivot: + uappend(elem) + elif elem > pivot: + oappend(elem) + else: + pcount += 1 + if n < len(under): + data = under + elif n < len(under) + pcount: + return pivot + else: + data = over + n -= len(under) + pcount def median(data): *************** *** 153,159 **** raise ValueError('data must have at least one element') subst = heapq.heapreplace for elem in it: ! if (elem > result[0]): subst(result, elem) result.sort(reverse=True) return result --- 152,160 ---- raise ValueError('data must have at least one element') subst = heapq.heapreplace + sol = result[0] # sol --> Smallest of the nlargest for elem in it: ! if (elem > sol): subst(result, elem) + sol = result[0] result.sort(reverse=True) return result *************** *** 168,175 **** insort = bisect.insort pop = result.pop for elem in it: ! if (elem < result[-1]): insort(result, elem) pop() return result --- 169,178 ---- insort = bisect.insort pop = result.pop + los = result[-1] # los --> Largest of the nsmallest for elem in it: ! if (elem < los): insort(result, elem) pop() + los = result[-1] return result From montanaro at users.sourceforge.net Fri Mar 5 09:33:23 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri Mar 5 09:40:44 2004 Subject: [Python-checkins] python/dist/src README,1.179,1.180 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10291 Modified Files: README Log Message: update version at top of file Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.179 retrieving revision 1.180 diff -C2 -d -r1.179 -r1.180 *** README 1 Oct 2003 07:24:54 -0000 1.179 --- README 5 Mar 2004 14:33:21 -0000 1.180 *************** *** 1,4 **** ! This is Python version 2.3 release candidate 2 ! ============================================== Copyright (c) 2001, 2002, 2003 Python Software Foundation. --- 1,4 ---- ! This is Python version 2.4 alpha 1 ! ================================== Copyright (c) 2001, 2002, 2003 Python Software Foundation. From rhettinger at users.sourceforge.net Sun Mar 7 02:31:07 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 7 02:38:46 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.36, 1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8824/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: SF patch #910929: Optimize list comprehensions Add a new opcode, LIST_APPEND, and apply it to the code generation for list comprehensions. Reduces the per-loop overhead by about a third. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** whatsnew24.tex 4 Mar 2004 08:25:44 -0000 1.36 --- whatsnew24.tex 7 Mar 2004 07:31:05 -0000 1.37 *************** *** 289,292 **** --- 289,296 ---- \samp{map(mydict.__getitem__, keylist)}. + \item Added an newcode opcode, \code{LIST_APPEND}, that simplifies + the generated bytecode for list comprehensions and speeds them up + by about a third. + \end{itemize} From rhettinger at users.sourceforge.net Sun Mar 7 02:31:07 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 7 02:38:48 2004 Subject: [Python-checkins] python/dist/src/Lib opcode.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8824/Lib Modified Files: opcode.py Log Message: SF patch #910929: Optimize list comprehensions Add a new opcode, LIST_APPEND, and apply it to the code generation for list comprehensions. Reduces the per-loop overhead by about a third. Index: opcode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/opcode.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** opcode.py 12 Feb 2004 17:35:06 -0000 1.4 --- opcode.py 7 Mar 2004 07:31:05 -0000 1.5 *************** *** 57,60 **** --- 57,61 ---- def_op('UNARY_INVERT', 15) + def_op('LIST_APPEND', 18) def_op('BINARY_POWER', 19) From rhettinger at users.sourceforge.net Sun Mar 7 02:31:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 7 02:38:50 2004 Subject: [Python-checkins] python/dist/src/Include opcode.h,2.43,2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8824/Include Modified Files: opcode.h Log Message: SF patch #910929: Optimize list comprehensions Add a new opcode, LIST_APPEND, and apply it to the code generation for list comprehensions. Reduces the per-loop overhead by about a third. Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** opcode.h 24 Apr 2003 05:45:16 -0000 2.43 --- opcode.h 7 Mar 2004 07:31:05 -0000 2.44 *************** *** 22,25 **** --- 22,26 ---- #define UNARY_INVERT 15 + #define LIST_APPEND 18 #define BINARY_POWER 19 From rhettinger at users.sourceforge.net Sun Mar 7 02:31:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 7 02:38:55 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.378, 2.379 compile.c, 2.298, 2.299 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8824/Python Modified Files: ceval.c compile.c Log Message: SF patch #910929: Optimize list comprehensions Add a new opcode, LIST_APPEND, and apply it to the code generation for list comprehensions. Reduces the per-loop overhead by about a third. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.378 retrieving revision 2.379 diff -C2 -d -r2.378 -r2.379 *** ceval.c 1 Mar 2004 15:44:05 -0000 2.378 --- ceval.c 7 Mar 2004 07:31:05 -0000 2.379 *************** *** 1226,1229 **** --- 1226,1238 ---- break; + case LIST_APPEND: + w = POP(); + v = POP(); + err = PyList_Append(v, w); + Py_DECREF(v); + Py_DECREF(w); + if (err == 0) continue; + break; + case INPLACE_POWER: w = POP(); Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.298 retrieving revision 2.299 diff -C2 -d -r2.298 -r2.299 *** compile.c 29 Nov 2003 23:52:13 -0000 2.298 --- compile.c 7 Mar 2004 07:31:06 -0000 2.299 *************** *** 1553,1558 **** com_push(c, 1); com_node(c, e); ! com_addoparg(c, CALL_FUNCTION, 1); ! com_addbyte(c, POP_TOP); com_pop(c, 2); } --- 1553,1557 ---- com_push(c, 1); com_node(c, e); ! com_addbyte(c, LIST_APPEND); com_pop(c, 2); } *************** *** 1570,1574 **** com_addbyte(c, DUP_TOP); /* leave the result on the stack */ com_push(c, 2); - com_addop_name(c, LOAD_ATTR, "append"); com_addop_varname(c, VAR_STORE, tmpname); com_pop(c, 1); --- 1569,1572 ---- From rhettinger at users.sourceforge.net Sun Mar 7 02:31:08 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 7 02:38:57 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.940,1.941 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8824/Misc Modified Files: NEWS Log Message: SF patch #910929: Optimize list comprehensions Add a new opcode, LIST_APPEND, and apply it to the code generation for list comprehensions. Reduces the per-loop overhead by about a third. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.940 retrieving revision 1.941 diff -C2 -d -r1.940 -r1.941 *** NEWS 4 Mar 2004 08:25:44 -0000 1.940 --- NEWS 7 Mar 2004 07:31:06 -0000 1.941 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Implemented a newcode opcode, LIST_APPEND, that simplifies + the generated bytecode for list comprehensions and further + improves their performance (about 35%). + - Implemented rich comparisons for floats, which seems to make comparisons involving NaNs somewhat less surprising when the From jsjjpvok at biochem.mpg.de Sun Mar 7 13:27:34 2004 From: jsjjpvok at biochem.mpg.de (Bernard Bunch) Date: Sun Mar 7 11:25:15 2004 Subject: [Python-checkins] Accumulate these shares for a significant return gkvxvm Message-ID: Market Mover Stock Report's Last Pick (CWTD) exploded from $1.19 to $9.20, a gain of over 670% in 5 days (Feb 12 - 17)!!! Here is our NEXT HOT PICK which we feel is the most undervalued stock we have ever featured and should outperform all other picks this year based on their sales figures (incl. a backlog of over $100 Million), incredibly solid numbers, and low outstanding share total. Life Energy and Technology Holdings, Inc. (OTCBB: LETH) Current Price: 1.85 Near-Term Target: 7.00 Projected High for '04: 15.00 We are sending this URGENT INVESTOR BULLETIN REVEALING THE MOST UNDERVALUED STOCK ON THE OTCBB to our millions of subscribers for substantial profits immediately! Sales orders received by LETH exceed $150 Million over the past year while major news was just released that adds multi-millions to the bottom line. LETH has experienced a recent spike in price and volume indicating heavy accumulation of shares which is a sign of even bigger things to come for this emerging world leader in the conversion of waste materials into electrical energy, an industry with such high global demand that it is impossible to assign a value to the size of the market. Solving a Dual Crisis - Waste and Energy: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. (Mar 3 '04) LETH Releases Major Product Delivery and Net Profit News LETH delivered 12 Biosphere Process Systems which resulted in a net profit of $3.5 Million, the equivalent of .12 cents per share. LETH is scheduled to receive an additional $7 Million translating into an additional .24 cents per share which is the balance of this completed contract over the next 6 months. The net profit per share from just this single contract would value the stock above $6 by calculating the .36 cents per share total at an average industry PE of 18 - 22. Examining LETH - By The Numbers: Total Assets: 36.8 Million = 1.26 per share of assets Cash: 23.4 Million = .80 cents per share of cash Shares Outstanding: 29 million (down from 31.8 million) after 2.8 million shares retired in Feb. '04 Additional Shares to be Retired: 1.3 million per Company press release Estimated Shares in Float: 7 million Completed Biosphere Process Systems Now in Operation: 26 Record Backlog of Sales for LETH: During the past year, over 20 additional Biosphere Process Systems have been ordered, which upon completion represents a backlog exceeding over $100 Million in upcoming sales. Many of these contractual agreements include options for the purchase of additional Biosphere Systems in the future once the initial order has been completed. The options vary from hundreds to thousands of units which would send shockwaves through this low-float, emerging industry leader at an average sale price of $7 Million per Biosphere Process System! LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near-term announcement. Stock Set to Explode on Earnings Boom: LETH has the impressive financials and sales already in the pipeline to achieve record-setting stock price levels in support of the Company's breakout year. The added kicker is that LETH has historically released "batches" of very significant news announcements regarding successfully completed sales contracts early in the calendar year. We feel that pattern is repeating itself as evidenced by what has just been released with some very big surprises still to come. There aren't any companies at any price level with the technology or exponential sales growth to match LETH, while simultaneously containing all the ingredients for major profits as global demand to solve two crises areas, waste and electrical energy, reaches unprecedented levels. Required Market Mover Stock Report (MMSR) Information: MMSR cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of MMSR. MMSR recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. MMSR is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. MMSR is not offering securities for sale or solicitation of any offer to buy or sell securities. MMSR has received twelve thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. c vq nkyxm coaqtl fzcb sacexfcz jzxinync a ajbjyccglh dgsoxrzcov s covtkv From bcannon at users.sourceforge.net Sun Mar 7 18:16:29 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Mar 7 18:24:13 2004 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30852/Lib Modified Files: _strptime.py Log Message: Deal with possible case of having time.tzname[1] containing UTC or GMT. Since it is known ahead of time that UTC and GMT always have no DST adjustment then just set the isdst value to 0 even if tzname[0] == tzname[1] . Fixes bug #897817 . Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** _strptime.py 18 Jan 2004 20:29:54 -0000 1.30 --- _strptime.py 7 Mar 2004 23:16:27 -0000 1.31 *************** *** 364,369 **** # same and yet time.daylight is true; too ambiguous to # be able to tell what timezone has daylight savings ! if time.tzname[0] == time.tzname[1] and \ ! time.daylight: break else: --- 364,369 ---- # same and yet time.daylight is true; too ambiguous to # be able to tell what timezone has daylight savings ! if (time.tzname[0] == time.tzname[1] and ! time.daylight and found_zone not in ("utc", "gmt")): break else: From rhettinger at users.sourceforge.net Sun Mar 7 23:19:04 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 7 23:26:50 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.152,2.153 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15868 Modified Files: dictobject.c Log Message: Factor out code common to PyDict_Copy() and PyDict_Merge(). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.152 retrieving revision 2.153 diff -C2 -d -r2.152 -r2.153 *** dictobject.c 4 Mar 2004 08:25:44 -0000 2.152 --- dictobject.c 8 Mar 2004 04:19:01 -0000 2.153 *************** *** 1243,1250 **** PyDict_Copy(PyObject *o) { ! register dictobject *mp; ! register int i; ! dictobject *copy; ! dictentry *entry; if (o == NULL || !PyDict_Check(o)) { --- 1243,1247 ---- PyDict_Copy(PyObject *o) { ! PyObject *copy; if (o == NULL || !PyDict_Check(o)) { *************** *** 1252,1273 **** return NULL; } ! mp = (dictobject *)o; ! copy = (dictobject *)PyDict_New(); if (copy == NULL) return NULL; ! if (mp->ma_used > 0) { ! if (dictresize(copy, mp->ma_used*2) != 0) ! return NULL; ! for (i = 0; i <= mp->ma_mask; i++) { ! entry = &mp->ma_table[i]; ! if (entry->me_value != NULL) { ! Py_INCREF(entry->me_key); ! Py_INCREF(entry->me_value); ! insertdict(copy, entry->me_key, entry->me_hash, ! entry->me_value); ! } ! } ! } ! return (PyObject *)copy; } --- 1249,1259 ---- return NULL; } ! copy = PyDict_New(); if (copy == NULL) return NULL; ! if (PyDict_Merge(copy, o, 1) == 0) ! return copy; ! Py_DECREF(copy); ! return copy; } From rhettinger at users.sourceforge.net Mon Mar 8 00:56:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 01:04:06 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.184,2.185 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29902 Modified Files: listobject.c Log Message: Small optimizations for list_slice() and list_extend_internal(). * Using addition instead of substraction on array indices allows the compiler to use a fast addressing mode. Saves about 10%. * Using PyTuple_GET_ITEM and PyList_SET_ITEM is about 7% faster than PySequenceFast_GET_ITEM which has to make a list check on every pass. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -d -r2.184 -r2.185 *** listobject.c 19 Feb 2004 06:12:06 -0000 2.184 --- listobject.c 8 Mar 2004 05:56:15 -0000 2.185 *************** *** 343,347 **** { PyListObject *np; ! int i; if (ilow < 0) ilow = 0; --- 343,347 ---- { PyListObject *np; ! int i, len; if (ilow < 0) ilow = 0; *************** *** 352,362 **** else if (ihigh > a->ob_size) ihigh = a->ob_size; ! np = (PyListObject *) PyList_New(ihigh - ilow); if (np == NULL) return NULL; ! for (i = ilow; i < ihigh; i++) { ! PyObject *v = a->ob_item[i]; Py_INCREF(v); ! np->ob_item[i - ilow] = v; } return (PyObject *)np; --- 352,364 ---- else if (ihigh > a->ob_size) ihigh = a->ob_size; ! len = ihigh - ilow; ! np = (PyListObject *) PyList_New(len); if (np == NULL) return NULL; ! ! for (i = 0; i < len; i++) { ! PyObject *v = a->ob_item[i+ilow]; Py_INCREF(v); ! np->ob_item[i] = v; } return (PyObject *)np; *************** *** 677,684 **** /* populate the end of self with b's items */ ! for (i = 0; i < blen; i++) { ! PyObject *o = PySequence_Fast_GET_ITEM(b, i); ! Py_INCREF(o); ! PyList_SET_ITEM(self, i+selflen, o); } Py_DECREF(b); --- 679,695 ---- /* populate the end of self with b's items */ ! if (PyList_Check(b)) { ! for (i = 0; i < blen; i++) { ! PyObject *o = PyList_GET_ITEM(b, i); ! Py_INCREF(o); ! PyList_SET_ITEM(self, i+selflen, o); ! } ! } else { ! assert (PyTuple_Check(b)); ! for (i = 0; i < blen; i++) { ! PyObject *o = PyTuple_GET_ITEM(b, i); ! Py_INCREF(o); ! PyList_SET_ITEM(self, i+selflen, o); ! } } Py_DECREF(b); From rhettinger at users.sourceforge.net Mon Mar 8 00:59:48 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 01:07:35 2004 Subject: [Python-checkins] python/dist/src/Lib copy.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31030 Modified Files: copy.py Log Message: Refactor the copy dispatcher code in copy.py. Simplifies and shortens the code by grouping common cases together. Index: copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** copy.py 14 Jun 2003 07:10:06 -0000 1.42 --- copy.py 8 Mar 2004 05:59:33 -0000 1.43 *************** *** 98,139 **** _copy_dispatch = d = {} ! def _copy_atomic(x): return x ! d[types.NoneType] = _copy_atomic ! d[types.IntType] = _copy_atomic ! d[types.LongType] = _copy_atomic ! d[types.FloatType] = _copy_atomic ! d[types.BooleanType] = _copy_atomic ! try: ! d[types.ComplexType] = _copy_atomic ! except AttributeError: ! pass ! d[types.StringType] = _copy_atomic ! try: ! d[types.UnicodeType] = _copy_atomic ! except AttributeError: ! pass ! try: ! d[types.CodeType] = _copy_atomic ! except AttributeError: ! pass ! d[types.TypeType] = _copy_atomic ! d[types.XRangeType] = _copy_atomic ! d[types.ClassType] = _copy_atomic ! d[types.BuiltinFunctionType] = _copy_atomic ! ! def _copy_list(x): ! return x[:] ! d[types.ListType] = _copy_list ! def _copy_tuple(x): ! return x[:] ! d[types.TupleType] = _copy_tuple ! def _copy_dict(x): return x.copy() - d[types.DictionaryType] = _copy_dict if PyStringMap is not None: ! d[PyStringMap] = _copy_dict def _copy_inst(x): --- 98,121 ---- _copy_dispatch = d = {} ! def _copy_immutable(x): return x ! for t in (types.NoneType, int, long, float, bool, str, tuple, ! frozenset, type, xrange, types.ClassType, ! types.BuiltinFunctionType): ! d[t] = _copy_immutable ! for name in ("ComplexType", "UnicodeType", "CodeType"): ! t = getattr(types, name, None) ! if t is not None: ! d[t] = _copy_immutable ! def _copy_with_constructor(x): ! return type(x)(x) ! for t in (list, dict, set): ! d[t] = _copy_with_constructor ! def _copy_with_copy_method(x): return x.copy() if PyStringMap is not None: ! d[PyStringMap] = _copy_with_copy_method def _copy_inst(x): From rhettinger at users.sourceforge.net Mon Mar 8 02:25:07 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 02:32:55 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c, 2.185, 2.186 tupleobject.c, 2.82, 2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11822/Objects Modified Files: listobject.c tupleobject.c Log Message: Optimize tuple_slice() and make further improvements to list_slice() and list.extend(). Factoring the inner loops to remove the constant structure references and fixed offsets gives speedups ranging from 20% to 30%. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** listobject.c 8 Mar 2004 05:56:15 -0000 2.185 --- listobject.c 8 Mar 2004 07:25:04 -0000 2.186 *************** *** 343,346 **** --- 343,347 ---- { PyListObject *np; + PyObject **src, **dest; int i, len; if (ilow < 0) *************** *** 357,364 **** return NULL; for (i = 0; i < len; i++) { ! PyObject *v = a->ob_item[i+ilow]; Py_INCREF(v); ! np->ob_item[i] = v; } return (PyObject *)np; --- 358,367 ---- return NULL; + src = a->ob_item + ilow; + dest = np->ob_item; for (i = 0; i < len; i++) { ! PyObject *v = src[i]; Py_INCREF(v); ! dest[i] = v; } return (PyObject *)np; *************** *** 647,650 **** --- 650,654 ---- int blen; register int i; + PyObject **src, **dest; if (PyObject_Size(b) == 0) { *************** *** 679,695 **** /* populate the end of self with b's items */ ! if (PyList_Check(b)) { ! for (i = 0; i < blen; i++) { ! PyObject *o = PyList_GET_ITEM(b, i); ! Py_INCREF(o); ! PyList_SET_ITEM(self, i+selflen, o); ! } ! } else { assert (PyTuple_Check(b)); ! for (i = 0; i < blen; i++) { ! PyObject *o = PyTuple_GET_ITEM(b, i); ! Py_INCREF(o); ! PyList_SET_ITEM(self, i+selflen, o); ! } } Py_DECREF(b); --- 683,697 ---- /* populate the end of self with b's items */ ! if (PyList_Check(b)) ! src = ((PyListObject *)b)->ob_item; ! else { assert (PyTuple_Check(b)); ! src = ((PyTupleObject *)b)->ob_item; ! } ! dest = self->ob_item + selflen; ! for (i = 0; i < blen; i++) { ! PyObject *o = src[i]; ! Py_INCREF(o); ! dest[i] = o; } Py_DECREF(b); Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.82 retrieving revision 2.83 diff -C2 -d -r2.82 -r2.83 *** tupleobject.c 12 Oct 2003 18:24:33 -0000 2.82 --- tupleobject.c 8 Mar 2004 07:25:04 -0000 2.83 *************** *** 307,311 **** --- 307,313 ---- { register PyTupleObject *np; + PyObject **src, **dest; register int i; + int len; if (ilow < 0) ilow = 0; *************** *** 318,328 **** return (PyObject *)a; } ! np = (PyTupleObject *)PyTuple_New(ihigh - ilow); if (np == NULL) return NULL; ! for (i = ilow; i < ihigh; i++) { ! PyObject *v = a->ob_item[i]; Py_INCREF(v); ! np->ob_item[i - ilow] = v; } return (PyObject *)np; --- 320,333 ---- return (PyObject *)a; } ! len = ihigh - ilow; ! np = (PyTupleObject *)PyTuple_New(len); if (np == NULL) return NULL; ! src = a->ob_item + ilow; ! dest = np->ob_item; ! for (i = 0; i < len; i++) { ! PyObject *v = src[i]; Py_INCREF(v); ! dest[i] = v; } return (PyObject *)np; From rhettinger at users.sourceforge.net Mon Mar 8 02:25:07 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 02:32:57 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.37, 1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11822/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Optimize tuple_slice() and make further improvements to list_slice() and list.extend(). Factoring the inner loops to remove the constant structure references and fixed offsets gives speedups ranging from 20% to 30%. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** whatsnew24.tex 7 Mar 2004 07:31:05 -0000 1.37 --- whatsnew24.tex 8 Mar 2004 07:25:05 -0000 1.38 *************** *** 264,267 **** --- 264,270 ---- \begin{itemize} + \item The inner loops for \class{list} and \class{tuple} slicing + were optimized and now run about one-third faster. + \item The machinery for growing and shrinking lists was optimized for speed and for space efficiency. Small lists (under eight elements) From akuchling at users.sourceforge.net Mon Mar 8 08:38:52 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon Mar 8 08:46:50 2004 Subject: [Python-checkins] python/nondist/peps pep-0262.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15460 Modified Files: pep-0262.txt Log Message: Change name of installation DB Index: pep-0262.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0262.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0262.txt 30 Mar 2003 16:52:11 -0000 1.13 --- pep-0262.txt 8 Mar 2004 13:38:50 -0000 1.14 *************** *** 37,41 **** The database lives in a bunch of files under ! /lib/python/install/. This location will be called INSTALLDB through the remainder of this PEP. --- 37,41 ---- The database lives in a bunch of files under ! /lib/python/install-db/. This location will be called INSTALLDB through the remainder of this PEP. From akuchling at users.sourceforge.net Mon Mar 8 08:52:01 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon Mar 8 08:59:53 2004 Subject: [Python-checkins] python/nondist/peps pep-0262.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18204 Modified Files: pep-0262.txt Log Message: Terminology change (package -> distribution); specify the digest field for .pyc files Index: pep-0262.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0262.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pep-0262.txt 8 Mar 2004 13:38:50 -0000 1.14 --- pep-0262.txt 8 Mar 2004 13:51:59 -0000 1.15 *************** *** 10,35 **** Introduction ! This PEP describes a format for a database of Python packages installed on a system. Requirements ! We need a way to figure out what packages, and what versions of ! those packages, are installed on a system. We want to provide features similar to CPAN, APT, or RPM. Required use cases that should be supported are: ! * Is package X on a system? ! * What version of package X is installed? ! * Where can the new version of package X be found? (This can be defined as either "a home page where the user can go and find a download link", or "a place where a program can find the newest version?" Both should probably be supported.) ! * What files did package X put on my system? ! * What package did the file x/y/z.py come from? * Has anyone modified x/y/z.py locally? ! * What other packages does this package need? ! * What Python modules does this package provide? --- 10,41 ---- Introduction ! This PEP describes a format for a database of the Python software installed on a system. + (In this document, the term "distribution" is used to mean a set + of code that's developed and distributed together. A "distribution" + is the same as a Red Hat or Debian package, but the term "package" + already has a meaning in Python terminology, meaning "a directory + with an __init__.py file in it.") + Requirements ! We need a way to figure out what distributions, and what versions of ! those distributions, are installed on a system. We want to provide features similar to CPAN, APT, or RPM. Required use cases that should be supported are: ! * Is distribution X on a system? ! * What version of distribution X is installed? ! * Where can the new version of distribution X be found? (This can be defined as either "a home page where the user can go and find a download link", or "a place where a program can find the newest version?" Both should probably be supported.) ! * What files did distribution X put on my system? ! * What distribution did the file x/y/z.py come from? * Has anyone modified x/y/z.py locally? ! * What other distributions does this software need? ! * What Python modules does this distribution provide? *************** *** 42,51 **** The structure of the database is deliberately kept simple; each file in this directory or its subdirectories (if any) describes a ! single package. Binary packages of Python software such as RPMs ! can then update Python's database by just installing the corresponding file into the INSTALLDB directory. The rationale for scanning subdirectories is that we can move to a ! directory-based indexing scheme if the package directory contains too many entries. For example, this would let us transparently switch from INSTALLDB/Numeric to INSTALLDB/N/Nu/Numeric or some --- 48,57 ---- The structure of the database is deliberately kept simple; each file in this directory or its subdirectories (if any) describes a ! single distribution. Binary packagings of Python software such as ! RPMs can then update Python's database by just installing the corresponding file into the INSTALLDB directory. The rationale for scanning subdirectories is that we can move to a ! directory-based indexing scheme if the database directory contains too many entries. For example, this would let us transparently switch from INSTALLDB/Numeric to INSTALLDB/N/Nu/Numeric or some *************** *** 56,60 **** Each file in INSTALLDB or its subdirectories describes a single ! package, and has the following contents: An initial line listing the sections in this file, separated --- 62,66 ---- Each file in INSTALLDB or its subdirectories describes a single ! distribution, and has the following contents: An initial line listing the sections in this file, separated *************** *** 65,73 **** are always separated by blank lines. ! A package that uses the Distutils for installation should ! automatically update the database. Packages that roll their own ! installation will have to use the database's API to to manually ! add or update their own entry. System package managers such as ! RPM or pkgadd can just create the new 'package name' file in the INSTALLDB directory. --- 71,79 ---- are always separated by blank lines. ! A distribution that uses the Distutils for installation should ! automatically update the database. Distributions that roll their ! own installation will have to use the database's API to to ! manually add or update their own entry. System package managers ! such as RPM or pkgadd can just create the new file in the INSTALLDB directory. *************** *** 76,106 **** PKG-INFO section ! An initial set of RFC-822 headers containing the package information for a file, as described in PEP 241, "Metadata for Python Software Packages". - A blank line indicating the end of the PKG-INFO section. - FILES section ! An entry for each file installed by the package. Generated files ! such as .pyc and .pyo files are on this list as well as the original ! .py files installed by a package; their checksums won't be stored or ! checked, though. ! Each file's entry is a single tab-delimited line that contains ! the following fields: ! * The file's full path, as installed on the system. ! * The file's size ! * The file's permissions. On Windows, this field will always be ! 'unknown' - * The owner and group of the file, separated by a tab. - On Windows, these fields will both be 'unknown'. - - * A SHA1 digest of the file, encoded in hex. REQUIRES section --- 82,114 ---- PKG-INFO section ! An initial set of RFC-822 headers containing the distribution information for a file, as described in PEP 241, "Metadata for Python Software Packages". FILES section ! An entry for each file installed by the ! distribution. Generated files such as .pyc and .pyo files are ! on this list as well as the original .py files installed by a ! distribution; their checksums won't be stored or checked, ! though. ! Each file's entry is a single tab-delimited line that contains ! the following fields: ! * The file's full path, as installed on the system. ! * The file's size ! * The file's permissions. On Windows, this field will always be ! 'unknown' ! ! * The owner and group of the file, separated by a tab. ! On Windows, these fields will both be 'unknown'. ! ! * A SHA1 digest of the file, encoded in hex. For generated files ! such as *.pyc files, this field must contain the string "-", ! which indicates that the file's checksum should not be verified. REQUIRES section *************** *** 108,112 **** This section is a list of strings giving the services required for this module distribution to run properly. This list includes the ! package name ("python-stdlib") and module names ("rfc822", "htmllib", "email", "email.Charset"). It will be specified by an extra 'requires' argument to the distutils.core.setup() --- 116,120 ---- This section is a list of strings giving the services required for this module distribution to run properly. This list includes the ! distribution name ("python-stdlib") and module names ("rfc822", "htmllib", "email", "email.Charset"). It will be specified by an extra 'requires' argument to the distutils.core.setup() *************** *** 124,128 **** This section is a list of strings giving the services provided by ! an installed package. This list includes the package name ("python-stdlib") and module names ("rfc822", "htmllib", "email", "email.Charset"). --- 132,136 ---- This section is a list of strings giving the services provided by ! an installed distribution. This list includes the distribution name ("python-stdlib") and module names ("rfc822", "htmllib", "email", "email.Charset"). *************** *** 148,157 **** alternate module name?) ! The InstallationDatabase returns instances of Package that contain ! all the information about an installed package. ! XXX Several of the fields in Package are duplicates of ones in distutils.dist.Distribution. Probably they should be factored out ! into the Package class proposed here, but can this be done in a backward-compatible way? --- 156,165 ---- alternate module name?) ! The InstallationDatabase returns instances of Distribution that contain ! all the information about an installed distribution. ! XXX Several of the fields in Distribution are duplicates of ones in distutils.dist.Distribution. Probably they should be factored out ! into the Distribution class proposed here, but can this be done in a backward-compatible way? *************** *** 165,194 **** """ ! def get_package (self, package_name): ! """get_package(package_name:string) : Package ! Get the object corresponding to a single package. """ ! def list_packages (self): ! """list_packages() : [Package] ! Return a list of all packages installed on the system, enumerated in no particular order. """ ! def find_package (self, path): ! """find_file(path:string) : Package ! Search and return the package containing the file 'path'. ! Returns None if the file doesn't belong to any package that the InstallationDatabase knows about. XXX should this work for directories? """ ! class Package: """Instance attributes: name : string ! Package name files : {string : (size:int, perms:int, owner:string, group:string, digest:string)} ! Dictionary mapping the path of a file installed by this package to information about the file. --- 173,202 ---- """ ! def get_distribution (self, distribution_name): ! """get_distribution(distribution_name:string) : Distribution ! Get the object corresponding to a single distribution. """ ! def list_distributions (self): ! """list_distributions() : [Distribution] ! Return a list of all distributions installed on the system, enumerated in no particular order. """ ! def find_distribution (self, path): ! """find_file(path:string) : Distribution ! Search and return the distribution containing the file 'path'. ! Returns None if the file doesn't belong to any distribution that the InstallationDatabase knows about. XXX should this work for directories? """ ! class Distribution: """Instance attributes: name : string ! Distribution name files : {string : (size:int, perms:int, owner:string, group:string, digest:string)} ! Dictionary mapping the path of a file installed by this distribution to information about the file. *************** *** 196,200 **** version : distutils.version.Version ! Version of this package platform : [string] summary : string --- 204,208 ---- version : distutils.version.Version ! Version of this distribution platform : [string] summary : string *************** *** 217,221 **** """has_file(path:string) : Boolean Returns true if the specified path belongs to a file in this ! package. """ --- 225,229 ---- """has_file(path:string) : Boolean Returns true if the specified path belongs to a file in this ! distribution. """ *************** *** 233,237 **** Patches to the Distutils that 1) implement an InstallationDatabase ! class, 2) Update the database when a new package is installed. 3) add a simple package management tool, features to be added to this PEP. (Or should that be a separate PEP?) See [2] for the current --- 241,245 ---- Patches to the Distutils that 1) implement an InstallationDatabase ! class, 2) Update the database when a new distribution is installed. 3) add a simple package management tool, features to be added to this PEP. (Or should that be a separate PEP?) See [2] for the current *************** *** 241,256 **** Rejected Suggestions ! Instead of using one text file per package, one large text file or ! an anydbm file could be used. This has been rejected for a few ! reasons. First, performance is probably not an extremely pressing ! concern as the package database is only used when installing or ! removing packages, a relatively infrequent task. Scalability also likely isn't a problem, as people may have hundreds of Python ! packages installed, but thousands seems unlikely. Finally, ! individual text files are compatible with installers such as RPM ! or DPKG because a package can just drop the new database file into ! the database directory. If one large text file or a binary file ! were used, the Python database would then have to be updated by ! running a postinstall script. On Windows, the permissions and owner/group of a file aren't --- 249,264 ---- Rejected Suggestions ! Instead of using one text file per distribution, one large text ! file or an anydbm file could be used. This has been rejected for ! a few reasons. First, performance is probably not an extremely ! pressing concern as the database is only used when installing or ! removing software, a relatively infrequent task. Scalability also likely isn't a problem, as people may have hundreds of Python ! packages installed, but thousands or tens of thousands seems ! unlikely. Finally, individual text files are compatible with ! installers such as RPM or DPKG because a binary packager can just ! drop the new database file into the database directory. If one ! large text file or a binary file were used, the Python database ! would then have to be updated by running a postinstall script. On Windows, the permissions and owner/group of a file aren't *************** *** 268,272 **** [2] A patch to implement this PEP will be tracked as patch #562100 on SourceForge. ! http://www.python.org/sf/562100 --- 276,282 ---- [2] A patch to implement this PEP will be tracked as patch #562100 on SourceForge. ! http://www.python.org/sf/562100 . ! Code implementing the installation database is currently in ! Python CVS in the nondist/sandbox/pep262 directory. *************** *** 274,278 **** Ideas for this PEP originally came from postings by Greg Ward, ! Fred L. Drake Jr., Thomas Heller, Mats Wichmann, and others. Many changes and rewrites to this document were suggested by the --- 284,289 ---- Ideas for this PEP originally came from postings by Greg Ward, ! Fred L. Drake Jr., Thomas Heller, Mats Wichmann, Phillip J. Eby, ! and others. Many changes and rewrites to this document were suggested by the From akuchling at users.sourceforge.net Mon Mar 8 09:09:30 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon Mar 8 09:17:20 2004 Subject: [Python-checkins] python/nondist/peps pep-0262.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22695 Modified Files: pep-0262.txt Log Message: Add section for open issues Index: pep-0262.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0262.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pep-0262.txt 8 Mar 2004 13:51:59 -0000 1.15 --- pep-0262.txt 8 Mar 2004 14:09:21 -0000 1.16 *************** *** 247,250 **** --- 247,281 ---- + Open Issues + + PJE suggests the installation database "be potentially present on + every directory in sys.path, with the contents merged in sys.path + order. This would allow home-directory or other + alternate-location installs to work, and ease the process of a + distutils install command writing the file." Nice feature: it does + mean that package manager tools can take into account Python + packages that a user has privately installed. + + AMK wonders: what does setup.py do if it's told to install + packages to a directory not on sys.path? Does it write an + install-db directory to the directory it's told to write to, or + does it do nothing? + + Should the package-database file itself be included in the files + list? (PJE would think yes, but of course it can't contain its + own checksum. AMK can't think of a use case where including the + DB file matters.) + + PJE wonders about writing the package DB file + *first*, before installing any other files, so that failed partial + installations can both be backed out, and recognized as broken. + This PEP may have to specify some algorithm for recognizing this + situation. + + Should we guarantee the format of installation databases remains + compatible across Python versions, or is it subject to arbitrary + change? Probably we need to guarantee compatibility. + + Rejected Suggestions From vsajip at users.sourceforge.net Mon Mar 8 11:57:36 2004 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Mon Mar 8 12:05:31 2004 Subject: [Python-checkins] python/dist/src/Lib/logging handlers.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29178 Modified Files: handlers.py Log Message: Removed spurious import statement Index: handlers.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/handlers.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** handlers.py 28 Feb 2004 16:07:46 -0000 1.11 --- handlers.py 8 Mar 2004 16:57:19 -0000 1.12 *************** *** 30,35 **** import sys, logging, socket, types, os, string, cPickle, struct, time - from SocketServer import ThreadingTCPServer, StreamRequestHandler - # # Some constants... --- 30,33 ---- From kbk at users.sourceforge.net Mon Mar 8 13:15:35 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Mon Mar 8 13:23:29 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib ClassBrowser.py, 1.7, 1.8 ColorDelegator.py, 1.12, 1.13 EditorWindow.py, 1.55, 1.56 NEWS.txt, 1.30, 1.31 PyShell.py, 1.86, 1.87 TreeWidget.py, 1.8, 1.9 config-highlight.def, 1.7, 1.8 configDialog.py, 1.56, 1.57 configHandler.py, 1.33, 1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13677 Modified Files: ClassBrowser.py ColorDelegator.py EditorWindow.py NEWS.txt PyShell.py TreeWidget.py config-highlight.def configDialog.py configHandler.py Log Message: Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe M ClassBrowser.py M ColorDelegator.py M EditorWindow.py M NEWS.txt M PyShell.py M TreeWidget.py M config-highlight.def M configDialog.py M configHandler.py Index: ClassBrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ClassBrowser.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ClassBrowser.py 20 Jan 2003 04:49:37 -0000 1.7 --- ClassBrowser.py 8 Mar 2004 18:15:30 -0000 1.8 *************** *** 18,21 **** --- 18,22 ---- from WindowList import ListedToplevel from TreeWidget import TreeNode, TreeItem, ScrolledCanvas + from configHandler import idleConf class ClassBrowser: *************** *** 43,47 **** top.focus_set() # create scrolled canvas ! sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both") item = self.rootnode() --- 44,50 ---- top.focus_set() # create scrolled canvas ! theme = idleConf.GetOption('main','Theme','name') ! background = idleConf.GetHighlight(theme, 'normal')['background'] ! sc = ScrolledCanvas(top, bg=background, highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both") item = self.rootnode() Index: ColorDelegator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ColorDelegator.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ColorDelegator.py 12 Feb 2004 17:35:08 -0000 1.12 --- ColorDelegator.py 8 Mar 2004 18:15:30 -0000 1.13 *************** *** 2,5 **** --- 2,6 ---- import re import keyword + import __builtin__ from Tkinter import * from Delegator import Delegator *************** *** 18,21 **** --- 19,25 ---- def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" + builtinlist = [str(name) for name in dir(__builtin__) + if not name.startswith('_')] + builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" *************** *** 24,28 **** dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) ! return kw + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"]) prog = re.compile(make_pat(), re.S) --- 28,32 ---- dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) ! return kw + "|" + builtin + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"]) prog = re.compile(make_pat(), re.S) *************** *** 59,62 **** --- 63,67 ---- "COMMENT": idleConf.GetHighlight(theme, "comment"), "KEYWORD": idleConf.GetHighlight(theme, "keyword"), + "BUILTIN": idleConf.GetHighlight(theme, "builtin"), "STRING": idleConf.GetHighlight(theme, "string"), "DEFINITION": idleConf.GetHighlight(theme, "definition"), *************** *** 69,73 **** } ! if DEBUG: print 'tagdefs',tagdefs def insert(self, index, chars, tags=None): --- 74,78 ---- } ! if DEBUG: print 'tagdefs',self.tagdefs def insert(self, index, chars, tags=None): Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/EditorWindow.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** EditorWindow.py 12 Feb 2004 17:35:08 -0000 1.55 --- EditorWindow.py 8 Mar 2004 18:15:30 -0000 1.56 *************** *** 511,514 **** --- 511,516 ---- self.color = self.ColorDelegator() self.per.insertfilter(self.color) + theme = idleConf.GetOption('main','Theme','name') + self.text.config(idleConf.GetHighlight(theme, "normal")) def ResetFont(self): Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** NEWS.txt 21 Jan 2004 19:21:11 -0000 1.30 --- NEWS.txt 8 Mar 2004 18:15:30 -0000 1.31 *************** *** 4,7 **** --- 4,9 ---- *Release date: XX-XXX-2004* + - Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe + - rpc.py:SocketIO - Large modules were generating large pickles when downloaded to the execution server. The return of the OK response from the subprocess Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** PyShell.py 12 Feb 2004 17:35:09 -0000 1.86 --- PyShell.py 8 Mar 2004 18:15:31 -0000 1.87 *************** *** 529,533 **** from TreeWidget import ScrolledCanvas, TreeNode top = Toplevel(self.tkconsole.root) ! sc = ScrolledCanvas(top, bg="white", highlightthickness=0) sc.frame.pack(expand=1, fill="both") node = TreeNode(sc.canvas, None, item) --- 529,535 ---- from TreeWidget import ScrolledCanvas, TreeNode top = Toplevel(self.tkconsole.root) ! theme = idleConf.GetOption('main','Theme','name') ! background = idleConf.GetHighlight(theme, 'normal')['background'] ! sc = ScrolledCanvas(top, bg=background, highlightthickness=0) sc.frame.pack(expand=1, fill="both") node = TreeNode(sc.canvas, None, item) Index: TreeWidget.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/TreeWidget.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TreeWidget.py 12 Feb 2004 17:35:09 -0000 1.8 --- TreeWidget.py 8 Mar 2004 18:15:31 -0000 1.9 *************** *** 21,24 **** --- 21,25 ---- import ZoomHeight + from configHandler import idleConf ICONDIR = "Icons" *************** *** 250,257 **** # padding carefully selected (on Windows) to match Entry widget: self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2) if self.selected: ! self.label.configure(fg="white", bg="darkblue") else: ! self.label.configure(fg="black", bg="white") id = self.canvas.create_window(textx, texty, anchor="nw", window=self.label) --- 251,259 ---- # padding carefully selected (on Windows) to match Entry widget: self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2) + theme = idleConf.GetOption('main','Theme','name') if self.selected: ! self.label.configure(idleConf.GetHighlight(theme, 'hilite')) else: ! self.label.configure(idleConf.GetHighlight(theme, 'normal')) id = self.canvas.create_window(textx, texty, anchor="nw", window=self.label) Index: config-highlight.def =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/config-highlight.def,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** config-highlight.def 18 May 2003 02:21:55 -0000 1.7 --- config-highlight.def 8 Mar 2004 18:15:31 -0000 1.8 *************** *** 7,10 **** --- 7,12 ---- keyword-foreground= #ff7700 keyword-background= #ffffff + builtin-foreground= #ca00ca + builtin-background= #ffffff comment-foreground= #dd0000 comment-background= #ffffff *************** *** 36,39 **** --- 38,43 ---- keyword-foreground= #ff7700 keyword-background= #ffffff + builtin-foreground= #ca00ca + builtin-background= #ffffff comment-foreground= #dd0000 comment-background= #ffffff Index: configDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configDialog.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** configDialog.py 12 Feb 2004 17:35:09 -0000 1.56 --- configDialog.py 8 Mar 2004 18:15:31 -0000 1.57 *************** *** 36,48 **** 'Python Keywords':('keyword','01'), 'Python Definitions':('definition','02'), ! 'Python Comments':('comment','03'), ! 'Python Strings':('string','04'), ! 'Selected Text':('hilite','05'), ! 'Found Text':('hit','06'), ! 'Cursor':('cursor','07'), ! 'Error Text':('error','08'), ! 'Shell Normal Text':('console','09'), ! 'Shell Stdout Text':('stdout','10'), ! 'Shell Stderr Text':('stderr','11')} self.ResetChangedItems() #load initial values in changed items dict self.CreateWidgets() --- 36,50 ---- 'Python Keywords':('keyword','01'), 'Python Definitions':('definition','02'), ! 'Python Builtins':('builtin', '03'), ! 'Python Comments':('comment','04'), ! 'Python Strings':('string','05'), ! 'Selected Text':('hilite','06'), ! 'Found Text':('hit','07'), ! 'Cursor':('cursor','08'), ! 'Error Text':('error','09'), ! 'Shell Normal Text':('console','10'), ! 'Shell Stdout Text':('stdout','11'), ! 'Shell Stderr Text':('stderr','12'), ! } self.ResetChangedItems() #load initial values in changed items dict self.CreateWidgets() *************** *** 198,202 **** ('\n ','normal'),('"""string"""','string'),('\n var0 = ','normal'), ("'string'",'string'),('\n var1 = ','normal'),("'selected'",'hilite'), ! ('\n var2 = ','normal'),("'found'",'hit'),('\n\n','normal'), (' error ','error'),(' ','normal'),('cursor |','cursor'), ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'), --- 200,206 ---- ('\n ','normal'),('"""string"""','string'),('\n var0 = ','normal'), ("'string'",'string'),('\n var1 = ','normal'),("'selected'",'hilite'), ! ('\n var2 = ','normal'),("'found'",'hit'), ! ('\n var3 = ','normal'),('list', 'builtin'), ('(','normal'), ! ('None', 'builtin'),(')\n\n','normal'), (' error ','error'),(' ','normal'),('cursor |','cursor'), ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'), Index: configHandler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configHandler.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** configHandler.py 12 Feb 2004 17:35:09 -0000 1.33 --- configHandler.py 8 Mar 2004 18:15:31 -0000 1.34 *************** *** 307,310 **** --- 307,312 ---- 'keyword-foreground':'#000000', 'keyword-background':'#ffffff', + 'builtin-foreground':'#000000', + 'builtin-background':'#ffffff', 'comment-foreground':'#000000', 'comment-background':'#ffffff', From rhettinger at users.sourceforge.net Mon Mar 8 13:17:33 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 13:25:49 2004 Subject: [Python-checkins] python/dist/src/Lib StringIO.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13720/Lib Modified Files: StringIO.py Log Message: SF patch #907403: Improvements to cStringIO.writelines() The writelines() method now accepts any iterable argument and writes the lines one at a time rather than using ''.join(lines) followed by a single write. Results in considerable memory savings and makes the method suitable for use with generator expressions. Index: StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** StringIO.py 12 Feb 2004 17:35:05 -0000 1.33 --- StringIO.py 8 Mar 2004 18:17:31 -0000 1.34 *************** *** 179,184 **** self.pos = newpos ! def writelines(self, list): ! self.write(''.join(list)) def flush(self): --- 179,186 ---- self.pos = newpos ! def writelines(self, iterable): ! write = self.write ! for line in iterable: ! write(line) def flush(self): From rhettinger at users.sourceforge.net Mon Mar 8 13:17:33 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 13:25:51 2004 Subject: [Python-checkins] python/dist/src/Modules cStringIO.c,2.46,2.47 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13720/Modules Modified Files: cStringIO.c Log Message: SF patch #907403: Improvements to cStringIO.writelines() The writelines() method now accepts any iterable argument and writes the lines one at a time rather than using ''.join(lines) followed by a single write. Results in considerable memory savings and makes the method suitable for use with generator expressions. Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -d -r2.46 -r2.47 *** cStringIO.c 27 Feb 2004 10:30:49 -0000 2.46 --- cStringIO.c 8 Mar 2004 18:17:31 -0000 2.47 *************** *** 417,454 **** } - PyDoc_STRVAR(O_writelines__doc__, ! "writelines(sequence_of_strings): write each string"); static PyObject * O_writelines(Oobject *self, PyObject *args) { ! PyObject *tmp = 0; ! static PyObject *joiner = NULL; ! ! if (!joiner) { ! PyObject *empty_string = PyString_FromString(""); ! if (empty_string == NULL) return NULL; ! joiner = PyObject_GetAttrString(empty_string, "join"); ! Py_DECREF(empty_string); ! if (joiner == NULL) return NULL; } ! ! if (PyObject_Size(args) < 0) return NULL; ! ! args = PyTuple_Pack(1, args); ! if (args == NULL) ! return NULL; ! tmp = PyObject_Call(joiner, args, NULL); ! Py_DECREF(args); ! UNLESS (tmp) return NULL; ! ! args = PyTuple_Pack(1, tmp); ! Py_DECREF(tmp); ! UNLESS (args) return NULL; ! ! tmp = O_write(self, args); ! Py_DECREF(args); ! return tmp; } --- 417,449 ---- } PyDoc_STRVAR(O_writelines__doc__, ! "writelines(sequence_of_strings) -> None. Write the strings to the file.\n" ! "\n" ! "Note that newlines are not added. The sequence can be any iterable object\n" ! "producing strings. This is equivalent to calling write() for each string."); static PyObject * O_writelines(Oobject *self, PyObject *args) { ! PyObject *it, *s; ! ! it = PyObject_GetIter(args); ! if (it == NULL) ! return NULL; ! while ((s = PyIter_Next(it)) != NULL) { ! int n; ! char *c; ! if (PyString_AsStringAndSize(s, &c, &n) == -1) { ! Py_DECREF(it); ! Py_DECREF(s); return NULL; ! } ! if (O_cwrite((PyObject *)self, c, n) == -1) { ! Py_DECREF(it); ! Py_DECREF(s); return NULL; + } + Py_DECREF(s); } ! Py_DECREF(it); ! Py_RETURN_NONE; } From rhettinger at users.sourceforge.net Mon Mar 8 13:22:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 13:30:35 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.941,1.942 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15099/Misc Modified Files: NEWS Log Message: SF patch #907403: Improvements to cStringIO.writelines() The writelines() method now accepts any iterable argument and writes the lines one at a time rather than using ''.join(lines) followed by a single write. Results in considerable memory savings and makes the method suitable for use with generator expressions. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.941 retrieving revision 1.942 diff -C2 -d -r1.941 -r1.942 *** NEWS 7 Mar 2004 07:31:06 -0000 1.941 --- NEWS 8 Mar 2004 18:22:35 -0000 1.942 *************** *** 176,179 **** --- 176,184 ---- ----------------- + - cStringIO.writelines() now accepts any iterable argument and writes + the lines one at a time rather than joining them and writing once. + Made a parallel change to StringIO.writelines(). Saves memory and + makes suitable for use with generator expressions. + - time.strftime() now checks that the values in its time tuple argument are within the proper boundaries to prevent possible crashes from the From rhettinger at users.sourceforge.net Mon Mar 8 13:31:22 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 13:39:15 2004 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16976 Modified Files: setobject.c Log Message: The copy module now handles sets directly. The __copy__ methods are no longer needed. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** setobject.c 31 Dec 2003 14:08:58 -0000 1.21 --- setobject.c 8 Mar 2004 18:31:10 -0000 1.22 *************** *** 914,919 **** {"copy", (PyCFunction)set_copy, METH_NOARGS, copy_doc}, - {"__copy__", (PyCFunction)set_copy, METH_NOARGS, - copy_doc}, {"discard", (PyCFunction)set_discard, METH_O, discard_doc}, --- 914,917 ---- *************** *** 1042,1047 **** {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, copy_doc}, - {"__copy__", (PyCFunction)frozenset_copy, METH_NOARGS, - copy_doc}, {"difference", (PyCFunction)set_difference, METH_O, difference_doc}, --- 1040,1043 ---- From rhettinger at users.sourceforge.net Mon Mar 8 13:59:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 14:07:39 2004 Subject: [Python-checkins] python/nondist/sandbox/statistics statistics.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23219 Modified Files: statistics.py Log Message: Express all select() comparions in terms of __lt__() Index: statistics.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/statistics/statistics.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** statistics.py 5 Mar 2004 08:49:56 -0000 1.10 --- statistics.py 8 Mar 2004 18:59:43 -0000 1.11 *************** *** 112,116 **** if elem < pivot: uappend(elem) ! elif elem > pivot: oappend(elem) else: --- 112,116 ---- if elem < pivot: uappend(elem) ! elif pivot < elem: oappend(elem) else: From modda at blackcodemail.com Tue Mar 9 06:11:17 2004 From: modda at blackcodemail.com (Pansy Hampton) Date: Mon Mar 8 15:14:15 2004 Subject: [Python-checkins] you could be john holmes Message-ID: Really LAY some PIPE to the next girl you bang... http://wy.ffdsd4d.com/vp5 No more of this sort of material. Honoured in 24-48 hours. http://proposition.amilsdcx.com/a.html utmost cabinetry incompletion derate mealtime infernal stanhope cambridge hangable israeli craftsmen calhoun britches mythology levitate fH From theller at python.net Mon Mar 8 15:27:36 2004 From: theller at python.net (Thomas Heller) Date: Mon Mar 8 15:27:54 2004 Subject: [Python-checkins] python/dist/src/Lib/logging handlers.py, 1.11, 1.12 In-Reply-To: (vsajip@users.sourceforge.net's message of "Mon, 08 Mar 2004 08:57:36 -0800") References: Message-ID: vsajip@users.sourceforge.net writes: > Update of /cvsroot/python/python/dist/src/Lib/logging > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29178 > > Modified Files: > handlers.py > Log Message: > Removed spurious import statement > > Index: handlers.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/logging/handlers.py,v > retrieving revision 1.11 > retrieving revision 1.12 > diff -C2 -d -r1.11 -r1.12 > *** handlers.py 28 Feb 2004 16:07:46 -0000 1.11 > --- handlers.py 8 Mar 2004 16:57:19 -0000 1.12 > *************** > *** 30,35 **** > import sys, logging, socket, types, os, string, cPickle, struct, time > > - from SocketServer import ThreadingTCPServer, StreamRequestHandler > - > # > # Some constants... Should be fixed in the 2.3 maintainance branch also, imo. From bcannon at users.sourceforge.net Mon Mar 8 17:19:00 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Mar 8 17:26:55 2004 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4913/Lib Modified Files: threading.py Log Message: Remove calls to currentThread() in _Condition methods that were side-effect. Side-effects were deemed unnecessary and were causing problems at shutdown time when threads were catching exceptions at start time and then triggering exceptions trying to call currentThread() after gc'ed. Masked the initial exception which was deemed bad. Fixes bug #754449 . Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** threading.py 29 Jan 2004 06:37:49 -0000 1.40 --- threading.py 8 Mar 2004 22:18:57 -0000 1.41 *************** *** 194,198 **** def wait(self, timeout=None): - currentThread() # for side-effect assert self._is_owned(), "wait() of un-acquire()d lock" waiter = _allocate_lock() --- 194,197 ---- *************** *** 236,240 **** def notify(self, n=1): - currentThread() # for side-effect assert self._is_owned(), "notify() of un-acquire()d lock" __waiters = self.__waiters --- 235,238 ---- From rhettinger at users.sourceforge.net Mon Mar 8 18:25:32 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 8 18:33:27 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.379,2.380 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19051 Modified Files: ceval.c Log Message: Refactor and optimize code for UNPACK_SEQUENCE. * Defer error handling for wrong number of arguments to the unpack_iterable() function. Cuts the code size almost in half. * Replace function calls to PyList_Size() and PyTuple_Size() with their smaller and faster macro counterparts. * Move the constant structure references outside of the inner loops. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.379 retrieving revision 2.380 diff -C2 -d -r2.379 -r2.380 *** ceval.c 7 Mar 2004 07:31:05 -0000 2.379 --- ceval.c 8 Mar 2004 23:25:30 -0000 2.380 *************** *** 1722,1754 **** case UNPACK_SEQUENCE: v = POP(); ! if (PyTuple_CheckExact(v)) { ! if (PyTuple_Size(v) != oparg) { ! PyErr_SetString(PyExc_ValueError, ! "unpack tuple of wrong size"); ! why = WHY_EXCEPTION; ! } ! else { ! for (; --oparg >= 0; ) { ! w = PyTuple_GET_ITEM(v, oparg); ! Py_INCREF(w); ! PUSH(w); ! } ! } ! } ! else if (PyList_CheckExact(v)) { ! if (PyList_Size(v) != oparg) { ! PyErr_SetString(PyExc_ValueError, ! "unpack list of wrong size"); ! why = WHY_EXCEPTION; } ! else { ! for (; --oparg >= 0; ) { ! w = PyList_GET_ITEM(v, oparg); ! Py_INCREF(w); ! PUSH(w); ! } } ! } ! else if (unpack_iterable(v, oparg, stack_pointer + oparg)) stack_pointer += oparg; --- 1722,1740 ---- case UNPACK_SEQUENCE: v = POP(); ! if (PyTuple_CheckExact(v) && PyTuple_GET_SIZE(v) == oparg) { ! PyObject **items = ((PyTupleObject *)v)->ob_item; ! while (oparg--) { ! w = items[oparg]; ! Py_INCREF(w); ! PUSH(w); } ! } else if (PyList_CheckExact(v) && PyList_GET_SIZE(v) == oparg) { ! PyObject **items = ((PyListObject *)v)->ob_item; ! while (oparg--) { ! w = items[oparg]; ! Py_INCREF(w); ! PUSH(w); } ! } else if (unpack_iterable(v, oparg, stack_pointer + oparg)) stack_pointer += oparg; From gretchintorturer at jippii.co.uk Mon Mar 8 23:43:29 2004 From: gretchintorturer at jippii.co.uk (Leonor Rosario) Date: Mon Mar 8 20:44:11 2004 Subject: [Python-checkins] (no subject) Message-ID: AS SEEN ON TV! The "REAL" Deal! Enlarge your penis naturally, up to 30% larger. Women love it, Men love it, & it works! Virility Pro is known as the global leader in size enhancement. We guarantee: * A bigger penis head & thicker trunk * A longer lasting erection * Increased ejaculation fluid * Better overall confidence levels * Increased pleasure for both males & females NOW AT WHOLESALE PRICE. BEST DEAL ANYWHERE. FULL GUARANTEE! http://botulism.vbbfrz.com/vp9 This communication is privileged and contains confidential information intended only for the person(s) to whom it is addressed. Any unauthorized disclosure, copying, other distribution of this communication or taking any action on its contents is strictly prohibited. If you have received this message in error, please notify us immediately OR remove yourself from our list if there is no interest in regards to our products. http://birdwatch.getg.rem8.com/b.htm russ liverpudlian promptitude clime leper saddlebag smash deify sustenance audubon decryption solicitous horseman fiasco domicile conqueror chandelier contractual paginate duplicity oxonian schizophrenic commute cardiovascular frontiersmen candlelit estimable stygian monadic trifle chordate sinistral thespian humorous backyard fillet moreover 5 From facundobatista at users.sourceforge.net Mon Mar 8 21:43:37 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Mar 8 21:51:32 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25708 Modified Files: test_Decimal.py Log Message: Extracted the need of test.test_support to make the tests work. Added module docstring and version comments. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_Decimal.py 6 Feb 2004 16:56:03 -0000 1.7 --- test_Decimal.py 9 Mar 2004 02:43:34 -0000 1.8 *************** *** 1,2 **** --- 1,18 ---- + # Test Cases for Decimal module, version 0.1.1 + # Written by Eric Price + # and Facundo Batista + """ + These are the test cases for the Decimal module. + + By now, they use the tests provided by Mike Cowlishaw to test the arithmetic + behaviour of the module. + """ + + # 0.1.1 2003.3.08 facundobatista: Commented out test.test_support + + # ToDo: + # + # Add the behaviour tests according to the PEP + import unittest import glob *************** *** 5,9 **** import os ! from test.test_support import TestSkipped, run_unittest TESTDATADIR = 'tests' --- 21,27 ---- import os ! ! #Commented out by Facundo Batista to make the test work ! #from test.test_support import TestSkipped, run_unittest TESTDATADIR = 'tests' *************** *** 434,438 **** def test_main(): ! run_unittest(DecimalTest) if __name__ == '__main__': --- 452,457 ---- def test_main(): ! # run_unittest(DecimalTest) ! unittest.main() if __name__ == '__main__': From facundobatista at users.sourceforge.net Mon Mar 8 21:45:02 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Mar 8 21:52:58 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25838 Modified Files: Decimal.py Log Message: Corrected the module docstring. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Decimal.py 6 Feb 2004 16:56:03 -0000 1.14 --- Decimal.py 9 Mar 2004 02:44:59 -0000 1.15 *************** *** 1,4 **** ! # Class Decimal, version 0.7.0 # Written by Eric Price # Based on code written by Aahz (aahz@pobox.com) # Currently under BSD-style license (copyright 2003) --- 1,5 ---- ! # Class Decimal, version 0.7.1 # Written by Eric Price + # and Facundo Batista # Based on code written by Aahz (aahz@pobox.com) # Currently under BSD-style license (copyright 2003) *************** *** 19,22 **** --- 20,24 ---- is a separate full-blown test harness (run Test(testdatadir).test()) + >>> from Decimal import * >>> Decimal(0) Decimal( (0, (0,), 0L) ) *************** *** 30,34 **** '123456789012345678901234567890' >>> str(Decimal("123.45e12345678901234567890")) ! '1.2345e12345678901234567892' >>> str(Decimal("1.33") + Decimal("1.27")) '2.60' --- 32,36 ---- '123456789012345678901234567890' >>> str(Decimal("123.45e12345678901234567890")) ! '1.2345E+12345678901234567892' >>> str(Decimal("1.33") + Decimal("1.27")) '2.60' *************** *** 38,42 **** >>> print dig / Decimal(3) 0.333333333 ! >>> dig.context.prec = 18 >>> print dig / Decimal(3) 0.333333333333333333 --- 40,44 ---- >>> print dig / Decimal(3) 0.333333333 ! >>> getcontext().prec = 18 >>> print dig / Decimal(3) 0.333333333333333333 *************** *** 45,50 **** >>> print Decimal(3).sqrt() 1.73205080756887729 ! >>> print Decimal(3) ** 123 ! 4.85192780976896427E+58 >>> inf = Decimal(1) / Decimal(0) >>> print inf --- 47,53 ---- >>> print Decimal(3).sqrt() 1.73205080756887729 ! ### This example doesn't work yet ! ###>>> print Decimal(3) ** 123 ! ###4.85192780976896427E+58 >>> inf = Decimal(1) / Decimal(0) >>> print inf *************** *** 62,78 **** >>> print dig / 0 Traceback (most recent call last): ! File "", line 1, in ? ! File "/home/eprice/python/Decimal.py", line 961, in __div__ ! return self._divide(other, context=context) ! File "/home/eprice/python/Decimal.py", line 1009, in _divide ! return context.raise_error(DivisionByZero, 'x / 0', sign) ! File "/home/eprice/python/Decimal.py", line 1907, in raise_error ! raise error, explanation ! Decimal.DivisionByZero: x / 0 >>> c = Context() ! >>> c.trap_enablers[DivisionUndefined] = 1 >>> print c.flags[DivisionUndefined] 0 >>> c.divide(Decimal(0), Decimal(0)) >>> from Decimal import * >>> c = Context() --- 65,78 ---- >>> print dig / 0 Traceback (most recent call last): ! ... ! ... ! ... ! DivisionByZero: x / 0 >>> c = Context() ! >>> c.trap_enablers[DivisionUndefined] = 0 >>> print c.flags[DivisionUndefined] 0 >>> c.divide(Decimal(0), Decimal(0)) + Decimal( (0, (), 'n') ) >>> from Decimal import * >>> c = Context() *************** *** 82,95 **** >>> print c.divide(Decimal(0), Decimal(0)) Traceback (most recent call last): ! File "", line 1, in ? ! File "/home/eprice/python/Decimal.py", line 1987, in divide ! return a.__div__(b, context=self) ! File "/home/eprice/python/Decimal.py", line 947, in __div__ ! return self._divide(other, context=context) ! File "/home/eprice/python/Decimal.py", line 978, in _divide ! return context.raise_error(DivisionUndefined, '0 / 0') ! File "/home/eprice/python/Decimal.py", line 1896, in raise_error ! raise error, explanation ! Decimal.DivisionUndefined: 0 / 0 >>> print c.flags[DivisionUndefined] 1 --- 82,89 ---- >>> print c.divide(Decimal(0), Decimal(0)) Traceback (most recent call last): ! ... ! ... ! ... ! DivisionUndefined: 0 / 0 >>> print c.flags[DivisionUndefined] 1 *************** *** 103,108 **** """ ! # 0.7.0 2003.2.28 More changes. Contexts done nicely, exponent limits ! # 0.6.0 2003.2.24 Many changes. No exponent limits # Aahz: --- 97,103 ---- """ ! # 0.7.1 2003.3.08 facundobatista: Corrected initial examples ! # 0.7.0 2003.2.28 eprice: More changes. Contexts done nicely, exponent limits ! # 0.6.0 2003.2.24 eprice: Many changes. No exponent limits # Aahz: From perky at users.sourceforge.net Tue Mar 9 00:53:18 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Tue Mar 9 01:01:18 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.151, 1.152 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24810/lib Modified Files: libstdtypes.tex Log Message: SF Patch #912462: Relocate \end tag to the right place. (Submitted by George Yoshida) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** libstdtypes.tex 4 Mar 2004 08:25:43 -0000 1.151 --- libstdtypes.tex 9 Mar 2004 05:53:15 -0000 1.152 *************** *** 1337,1341 **** \item[(8)] \function{pop()} raises a \exception{KeyError} when no default value is given and the key is not found. \versionadded{2.3} - \end{description} \item[(9)] \function{update()} accepts either another mapping object --- 1337,1340 ---- *************** *** 1347,1350 **** --- 1346,1351 ---- pairs and allowed keyword arguments]{2.4} + \end{description} + \subsection{File Objects \label{bltin-file-objects}} From rhettinger at users.sourceforge.net Tue Mar 9 03:04:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Mar 9 03:12:35 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12830 Modified Files: listobject.c Log Message: Optimize slice assignments. * Replace sprintf message with a constant message string -- this error message ran on every invocation except straight deletions but it was only needed when the rhs was not iterable. The message was also out-of-date and did not reflect that iterable arguments were allowed. * For inner loops that do not make ref count adjustments, use memmove() for fast copying and better readability. * For inner loops that do make ref count adjustments, speed them up by factoring out the constant structure reference and using vitem[] instead. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** listobject.c 8 Mar 2004 07:25:04 -0000 2.186 --- listobject.c 9 Mar 2004 08:04:33 -0000 2.187 *************** *** 461,464 **** --- 461,465 ---- PyObject **recycle, **p; PyObject **item; + PyObject **vitem = NULL; PyObject *v_as_SF = NULL; /* PySequence_Fast(v) */ int n; /* Size of replacement list */ *************** *** 470,474 **** n = 0; else { - char msg[256]; if (a == b) { /* Special case "a[i:j] = a" -- copy b first */ --- 471,474 ---- *************** *** 481,493 **** return ret; } ! ! PyOS_snprintf(msg, sizeof(msg), ! "must assign sequence" ! " (not \"%.200s\") to slice", ! v->ob_type->tp_name); ! v_as_SF = PySequence_Fast(v, msg); if(v_as_SF == NULL) return -1; n = PySequence_Fast_GET_SIZE(v_as_SF); } if (ilow < 0) --- 481,494 ---- return ret; } ! v_as_SF = PySequence_Fast(v, "can only assign an iterable"); if(v_as_SF == NULL) return -1; n = PySequence_Fast_GET_SIZE(v_as_SF); + if (PyList_Check(v_as_SF)) + vitem = ((PyListObject *)v_as_SF)->ob_item; + else { + assert (PyTuple_Check(v_as_SF)); + vitem = ((PyTupleObject *)v_as_SF)->ob_item; + } } if (ilow < 0) *************** *** 511,519 **** p = recycle = NULL; if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */ ! for (k = ilow; k < ihigh; k++) ! *p++ = item[k]; if (d < 0) { ! for (/*k = ihigh*/; k < a->ob_size; k++) ! item[k+d] = item[k]; list_resize(a, a->ob_size + d); item = a->ob_item; --- 512,520 ---- p = recycle = NULL; if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */ ! memmove(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *)); ! p += ihigh - ilow; if (d < 0) { ! memmove(&item[ihigh+d], &item[ihigh], ! (a->ob_size - ihigh)*sizeof(PyObject *)); list_resize(a, a->ob_size + d); item = a->ob_item; *************** *** 528,538 **** } item = a->ob_item; ! for (k = s; --k >= ihigh; ) ! item[k+d] = item[k]; ! for (/*k = ihigh-1*/; k >= ilow; --k) ! *p++ = item[k]; } for (k = 0; k < n; k++, ilow++) { ! PyObject *w = PySequence_Fast_GET_ITEM(v_as_SF, k); Py_XINCREF(w); item[ilow] = w; --- 529,539 ---- } item = a->ob_item; ! memmove(&item[ihigh+d], &item[ihigh], ! (s - ihigh)*sizeof(PyObject *)); ! memmove(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *)); ! p += ihigh - ilow; } for (k = 0; k < n; k++, ilow++) { ! PyObject *w = vitem[k]; Py_XINCREF(w); item[ilow] = w; From rhettinger at users.sourceforge.net Tue Mar 9 08:05:25 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Mar 9 08:13:25 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c, 2.187, 2.188 tupleobject.c, 2.83, 2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8358 Modified Files: listobject.c tupleobject.c Log Message: Optimize inner loops for subscript, repeat, and concat. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** listobject.c 9 Mar 2004 08:04:33 -0000 2.187 --- listobject.c 9 Mar 2004 13:05:06 -0000 2.188 *************** *** 383,386 **** --- 383,387 ---- int size; int i; + PyObject **src, **dest; PyListObject *np; if (!PyList_Check(bb)) { *************** *** 398,410 **** return NULL; } for (i = 0; i < a->ob_size; i++) { ! PyObject *v = a->ob_item[i]; Py_INCREF(v); ! np->ob_item[i] = v; } for (i = 0; i < b->ob_size; i++) { ! PyObject *v = b->ob_item[i]; Py_INCREF(v); ! np->ob_item[i + a->ob_size] = v; } return (PyObject *)np; --- 399,415 ---- return NULL; } + src = a->ob_item; + dest = np->ob_item; for (i = 0; i < a->ob_size; i++) { ! PyObject *v = src[i]; Py_INCREF(v); ! dest[i] = v; } + src = b->ob_item; + dest = np->ob_item + a->ob_size; for (i = 0; i < b->ob_size; i++) { ! PyObject *v = src[i]; Py_INCREF(v); ! dest[i] = v; } return (PyObject *)np; *************** *** 418,422 **** int size; PyListObject *np; ! PyObject **p; PyObject *elem; if (n < 0) --- 423,427 ---- int size; PyListObject *np; ! PyObject **p, **items; PyObject *elem; if (n < 0) *************** *** 431,438 **** return NULL; if (a->ob_size == 1) { elem = a->ob_item[0]; for (i = 0; i < n; i++) { ! np->ob_item[i] = elem; Py_INCREF(elem); } --- 436,444 ---- return NULL; + items = np->ob_item; if (a->ob_size == 1) { elem = a->ob_item[0]; for (i = 0; i < n; i++) { ! items[i] = elem; Py_INCREF(elem); } *************** *** 440,446 **** } p = np->ob_item; for (i = 0; i < n; i++) { for (j = 0; j < a->ob_size; j++) { ! *p = a->ob_item[j]; Py_INCREF(*p); p++; --- 446,453 ---- } p = np->ob_item; + items = a->ob_item; for (i = 0; i < n; i++) { for (j = 0; j < a->ob_size; j++) { ! *p = items[j]; Py_INCREF(*p); p++; *************** *** 591,599 **** p = size; for (i = 1; i < n; i++) { /* Start counting at 1, not 0 */ for (j = 0; j < size; j++) { ! PyObject *o = PyList_GET_ITEM(self, j); Py_INCREF(o); ! PyList_SET_ITEM(self, p++, o); } } --- 598,607 ---- p = size; + items = self->ob_item; for (i = 1; i < n; i++) { /* Start counting at 1, not 0 */ for (j = 0; j < size; j++) { ! PyObject *o = items[j]; Py_INCREF(o); ! items[p++] = o; } } *************** *** 2405,2408 **** --- 2413,2417 ---- PyObject* result; PyObject* it; + PyObject **src, **dest; if (PySlice_GetIndicesEx((PySliceObject*)item, self->ob_size, *************** *** 2418,2426 **** if (!result) return NULL; for (cur = start, i = 0; i < slicelength; cur += step, i++) { ! it = PyList_GET_ITEM(self, cur); Py_INCREF(it); ! PyList_SET_ITEM(result, i, it); } --- 2427,2437 ---- if (!result) return NULL; + src = self->ob_item; + dest = ((PyListObject *)result)->ob_item; for (cur = start, i = 0; i < slicelength; cur += step, i++) { ! it = src[cur]; Py_INCREF(it); ! dest[i] = it; } *************** *** 2467,2471 **** /* delete slice */ PyObject **garbage; ! int cur, i, j; if (slicelength <= 0) --- 2478,2482 ---- /* delete slice */ PyObject **garbage; ! int cur, i; if (slicelength <= 0) *************** *** 2494,2503 **** } ! for (j = 0; j < lim; j++) { ! PyList_SET_ITEM(self, cur + j - i, ! PyList_GET_ITEM(self, ! cur + j + 1)); ! } } for (cur = start + slicelength*step + 1; cur < self->ob_size; cur++) { --- 2505,2513 ---- } ! memmove(self->ob_item + cur - i, ! self->ob_item + cur + 1, ! lim * sizeof(PyObject *)); } + for (cur = start + slicelength*step + 1; cur < self->ob_size; cur++) { *************** *** 2505,2508 **** --- 2515,2519 ---- PyList_GET_ITEM(self, cur)); } + self->ob_size -= slicelength; list_resize(self, self->ob_size); *************** *** 2517,2521 **** else { /* assign slice */ ! PyObject **garbage, *ins, *seq; int cur, i; --- 2528,2532 ---- else { /* assign slice */ ! PyObject **garbage, *ins, *seq, **seqitems, **selfitems; int cur, i; *************** *** 2526,2534 **** } else { ! char msg[256]; ! PyOS_snprintf(msg, sizeof(msg), ! "must assign sequence (not \"%.200s\") to extended slice", ! value->ob_type->tp_name); ! seq = PySequence_Fast(value, msg); if (!seq) return -1; --- 2537,2542 ---- } else { ! seq = PySequence_Fast(value, ! "must assign iterable to extended slice"); if (!seq) return -1; *************** *** 2552,2562 **** PyMem_MALLOC(slicelength*sizeof(PyObject*)); for (cur = start, i = 0; i < slicelength; cur += step, i++) { ! garbage[i] = PyList_GET_ITEM(self, cur); ! ! ins = PySequence_Fast_GET_ITEM(seq, i); Py_INCREF(ins); ! PyList_SET_ITEM(self, cur, ins); } --- 2560,2574 ---- PyMem_MALLOC(slicelength*sizeof(PyObject*)); + selfitems = self->ob_item; + if (PyList_Check(seq)) + seqitems = ((PyListObject *)seq)->ob_item; + else + seqitems = ((PyTupleObject *)seq)->ob_item; for (cur = start, i = 0; i < slicelength; cur += step, i++) { ! garbage[i] = selfitems[cur]; ! ins = seqitems[i]; Py_INCREF(ins); ! selfitems[cur] = ins; } Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.83 retrieving revision 2.84 diff -C2 -d -r2.83 -r2.84 *** tupleobject.c 8 Mar 2004 07:25:04 -0000 2.83 --- tupleobject.c 9 Mar 2004 13:05:22 -0000 2.84 *************** *** 137,140 **** --- 137,141 ---- PyObject *o; PyObject *result; + PyObject **items; va_list vargs; *************** *** 143,150 **** if (result == NULL) return NULL; for (i = 0; i < n; i++) { o = va_arg(vargs, PyObject *); Py_INCREF(o); ! PyTuple_SET_ITEM(result, i, o); } va_end(vargs); --- 144,152 ---- if (result == NULL) return NULL; + items = ((PyTupleObject *)result)->ob_item; for (i = 0; i < n; i++) { o = va_arg(vargs, PyObject *); Py_INCREF(o); ! items[i] = o; } va_end(vargs); *************** *** 349,352 **** --- 351,355 ---- register int size; register int i; + PyObject **src, **dest; PyTupleObject *np; if (!PyTuple_Check(bb)) { *************** *** 364,376 **** return NULL; } for (i = 0; i < a->ob_size; i++) { ! PyObject *v = a->ob_item[i]; Py_INCREF(v); ! np->ob_item[i] = v; } for (i = 0; i < b->ob_size; i++) { ! PyObject *v = b->ob_item[i]; Py_INCREF(v); ! np->ob_item[i + a->ob_size] = v; } return (PyObject *)np; --- 367,383 ---- return NULL; } + src = a->ob_item; + dest = np->ob_item; for (i = 0; i < a->ob_size; i++) { ! PyObject *v = src[i]; Py_INCREF(v); ! dest[i] = v; } + src = b->ob_item; + dest = np->ob_item + a->ob_size; for (i = 0; i < b->ob_size; i++) { ! PyObject *v = src[i]; Py_INCREF(v); ! dest[i] = v; } return (PyObject *)np; *************** *** 384,388 **** int size; PyTupleObject *np; ! PyObject **p; if (n < 0) n = 0; --- 391,395 ---- int size; PyTupleObject *np; ! PyObject **p, **items; if (n < 0) n = 0; *************** *** 404,410 **** return NULL; p = np->ob_item; for (i = 0; i < n; i++) { for (j = 0; j < a->ob_size; j++) { ! *p = a->ob_item[j]; Py_INCREF(*p); p++; --- 411,418 ---- return NULL; p = np->ob_item; + items = a->ob_item; for (i = 0; i < n; i++) { for (j = 0; j < a->ob_size; j++) { ! *p = items[j]; Py_INCREF(*p); p++; *************** *** 585,588 **** --- 593,597 ---- PyObject* result; PyObject* it; + PyObject **src, **dest; if (PySlice_GetIndicesEx((PySliceObject*)item, *************** *** 598,606 **** result = PyTuple_New(slicelength); for (cur = start, i = 0; i < slicelength; cur += step, i++) { ! it = PyTuple_GET_ITEM(self, cur); Py_INCREF(it); ! PyTuple_SET_ITEM(result, i, it); } --- 607,617 ---- result = PyTuple_New(slicelength); + src = self->ob_item; + dest = ((PyTupleObject *)result)->ob_item; for (cur = start, i = 0; i < slicelength; cur += step, i++) { ! it = src[cur]; Py_INCREF(it); ! dest[i] = it; } From rhettinger at users.sourceforge.net Wed Mar 10 03:32:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 10 03:40:59 2004 Subject: [Python-checkins] python/dist/src/Objects enumobject.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv815/Objects Modified Files: enumobject.c Log Message: Eliminate the double reverse option. It's only use case was academic and it was potentially confusing to use. Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** enumobject.c 10 Feb 2004 09:33:39 -0000 1.13 --- enumobject.c 10 Mar 2004 08:32:46 -0000 1.14 *************** *** 237,246 **** } - static PyObject * - reversed_reverse(reversedobject *ro, PyObject *unused) - { - return PyObject_GetIter(ro->seq); - } - PyDoc_STRVAR(reversed_doc, "reverse(sequence) -> reverse iterator over values of the sequence\n" --- 237,240 ---- *************** *** 248,257 **** "Return a reverse iterator"); - static PyMethodDef reversed_methods[] = { - {"__reversed__", (PyCFunction)reversed_reverse, - METH_NOARGS, reversed_doc}, - {NULL, NULL} /* sentinel */ - }; - static PySequenceMethods reversed_as_sequence = { (inquiry)reversed_len, /* sq_length */ --- 242,245 ---- *************** *** 290,294 **** PyObject_SelfIter, /* tp_iter */ (iternextfunc)reversed_next, /* tp_iternext */ ! reversed_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 278,282 ---- PyObject_SelfIter, /* tp_iter */ (iternextfunc)reversed_next, /* tp_iternext */ ! 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ From rhettinger at users.sourceforge.net Wed Mar 10 03:32:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 10 03:41:01 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_enumerate.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv815/Lib/test Modified Files: test_enumerate.py Log Message: Eliminate the double reverse option. It's only use case was academic and it was potentially confusing to use. Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_enumerate.py 10 Feb 2004 09:33:39 -0000 1.10 --- test_enumerate.py 10 Mar 2004 08:32:47 -0000 1.11 *************** *** 142,150 **** self.assertEqual(type(reversed(x)), type(iter(x))) - def test_double_reverse(self): - s = 'hello' - self.assertEqual(list(reversed(reversed(s))), list(s)) - def test_len(self): s = 'hello' self.assertEqual(len(reversed(s)), len(s)) --- 142,147 ---- self.assertEqual(type(reversed(x)), type(iter(x))) def test_len(self): + # This is an implementation detail, not an interface requirement s = 'hello' self.assertEqual(len(reversed(s)), len(s)) From rhettinger at users.sourceforge.net Wed Mar 10 05:10:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 10 05:18:56 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_enumerate.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20181/Lib/test Modified Files: test_enumerate.py Log Message: Tidied up the implementations of reversed (including the custom ones for xrange and list objects). * list.__reversed__ now checks the length of the sequence object before calling PyList_GET_ITEM() because the mutable could have changed length. * all three implementations are now tranparent with respect to length and maintain the invariant len(it) == len(list(it)) even when the underlying sequence mutates. * __builtin__.reversed() now frees the underlying sequence as soon as the iterator is exhausted. * the code paths were rearranged so that the most common paths do not require a jump. Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_enumerate.py 10 Mar 2004 08:32:47 -0000 1.11 --- test_enumerate.py 10 Mar 2004 10:10:42 -0000 1.12 *************** *** 144,149 **** def test_len(self): # This is an implementation detail, not an interface requirement ! s = 'hello' ! self.assertEqual(len(reversed(s)), len(s)) def test_main(verbose=None): --- 144,149 ---- def test_len(self): # This is an implementation detail, not an interface requirement ! for s in ('hello', tuple('hello'), list('hello'), xrange(5)): ! self.assertEqual(len(reversed(s)), len(s)) def test_main(verbose=None): From rhettinger at users.sourceforge.net Wed Mar 10 05:10:45 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 10 05:18:59 2004 Subject: [Python-checkins] python/dist/src/Objects enumobject.c, 1.14, 1.15 listobject.c, 2.188, 2.189 rangeobject.c, 2.49, 2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20181/Objects Modified Files: enumobject.c listobject.c rangeobject.c Log Message: Tidied up the implementations of reversed (including the custom ones for xrange and list objects). * list.__reversed__ now checks the length of the sequence object before calling PyList_GET_ITEM() because the mutable could have changed length. * all three implementations are now tranparent with respect to length and maintain the invariant len(it) == len(list(it)) even when the underlying sequence mutates. * __builtin__.reversed() now frees the underlying sequence as soon as the iterator is exhausted. * the code paths were rearranged so that the most common paths do not require a jump. Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** enumobject.c 10 Mar 2004 08:32:46 -0000 1.14 --- enumobject.c 10 Mar 2004 10:10:42 -0000 1.15 *************** *** 218,238 **** { PyObject *item; ! if (ro->index < 0) ! return NULL; ! ! assert(PySequence_Check(ro->seq)); ! item = PySequence_GetItem(ro->seq, ro->index); ! if (item == NULL) ! return NULL; ! ! ro->index--; ! return item; ! } ! ! static int ! reversed_len(reversedobject *ro) ! { ! return PyObject_Size(ro->seq); } --- 218,236 ---- { PyObject *item; + long index = ro->index; ! if (index >= 0) { ! item = PySequence_GetItem(ro->seq, index); ! if (item != NULL) { ! ro->index--; ! return item; ! } ! } ! ro->index = -1; ! if (ro->seq != NULL) { ! Py_DECREF(ro->seq); ! ro->seq = NULL; ! } ! return NULL; } *************** *** 242,245 **** --- 240,249 ---- "Return a reverse iterator"); + static int + reversed_len(reversedobject *ro) + { + return ro->index + 1; + } + static PySequenceMethods reversed_as_sequence = { (inquiry)reversed_len, /* sq_length */ Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** listobject.c 9 Mar 2004 13:05:06 -0000 2.188 --- listobject.c 10 Mar 2004 10:10:42 -0000 2.189 *************** *** 2794,2812 **** listreviter_next(listreviterobject *it) { ! PyObject *item = NULL; ! assert(PyList_Check(it->it_seq)); ! if (it->it_index >= 0) { ! assert(it->it_index < PyList_GET_SIZE(it->it_seq)); ! item = PyList_GET_ITEM(it->it_seq, it->it_index); it->it_index--; Py_INCREF(item); ! } else if (it->it_seq != NULL) { ! Py_DECREF(it->it_seq); it->it_seq = NULL; } ! return item; } PyTypeObject PyListRevIter_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 2794,2826 ---- listreviter_next(listreviterobject *it) { ! PyObject *item; ! long index = it->it_index; ! PyListObject *seq = it->it_seq; ! if (index>=0 && index < PyList_GET_SIZE(seq)) { ! item = PyList_GET_ITEM(seq, index); it->it_index--; Py_INCREF(item); ! return item; ! } ! it->it_index = -1; ! if (seq != NULL) { it->it_seq = NULL; + Py_DECREF(seq); } ! return NULL; ! } ! ! static int ! listreviter_len(listreviterobject *it) ! { ! return it->it_index + 1; } + static PySequenceMethods listreviter_as_sequence = { + (inquiry)listreviter_len, /* sq_length */ + 0, /* sq_concat */ + }; + PyTypeObject PyListRevIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 2823,2827 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 2837,2841 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &listreviter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** rangeobject.c 6 Nov 2003 14:06:47 -0000 2.49 --- rangeobject.c 10 Mar 2004 10:10:42 -0000 2.50 *************** *** 289,292 **** --- 289,304 ---- } + static int + rangeiter_len(rangeiterobject *r) + { + return r->len - r->index; + } + + static PySequenceMethods rangeiter_as_sequence = { + (inquiry)rangeiter_len, /* sq_length */ + 0, /* sq_concat */ + }; + + static PyTypeObject Pyrangeiter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 303,307 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 315,319 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &rangeiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ From rhettinger at users.sourceforge.net Wed Mar 10 06:44:15 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 10 06:52:25 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.189,2.190 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6365 Modified Files: listobject.c Log Message: Use memcpy() instead of memmove() when the buffers are known to be distinct. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.189 retrieving revision 2.190 diff -C2 -d -r2.189 -r2.190 *** listobject.c 10 Mar 2004 10:10:42 -0000 2.189 --- listobject.c 10 Mar 2004 11:44:04 -0000 2.190 *************** *** 519,523 **** p = recycle = NULL; if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */ ! memmove(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *)); p += ihigh - ilow; if (d < 0) { --- 519,523 ---- p = recycle = NULL; if (d <= 0) { /* Delete -d items; recycle ihigh-ilow items */ ! memcpy(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *)); p += ihigh - ilow; if (d < 0) { *************** *** 538,542 **** memmove(&item[ihigh+d], &item[ihigh], (s - ihigh)*sizeof(PyObject *)); ! memmove(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *)); p += ihigh - ilow; } --- 538,542 ---- memmove(&item[ihigh+d], &item[ihigh], (s - ihigh)*sizeof(PyObject *)); ! memcpy(p, &item[ilow], (ihigh - ilow)*sizeof(PyObject *)); p += ihigh - ilow; } From nascheme at users.sourceforge.net Wed Mar 10 12:30:06 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Wed Mar 10 12:38:18 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_coercion.py, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14349/Lib/test Modified Files: test_coercion.py Log Message: Make test_coercion.py less sensitive to platform fp quirks. Closes SF bug #678265. Index: test_coercion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_coercion.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_coercion.py 30 Jul 2002 23:26:01 -0000 1.6 --- test_coercion.py 10 Mar 2004 17:30:03 -0000 1.7 *************** *** 68,76 **** candidates = [ 2, 4.0, 2L, 2+0j, [1], (2,), None, ! MethodNumber(1), CoerceNumber(2)] infix_binops = [ '+', '-', '*', '/', '**', '%' ] prefix_binops = [ 'divmod' ] def do_infix_binops(): for a in candidates: --- 68,91 ---- candidates = [ 2, 4.0, 2L, 2+0j, [1], (2,), None, ! MethodNumber(2), CoerceNumber(2)] infix_binops = [ '+', '-', '*', '/', '**', '%' ] prefix_binops = [ 'divmod' ] + def format_float(value): + if abs(value) < 0.01: + return '0.0' + else: + return '%.1f' % value + + # avoid testing platform fp quirks + def format_result(value): + if isinstance(value, complex): + return '(%s + %sj)' % (format_float(value.real), + format_float(value.imag)) + elif isinstance(value, float): + return format_float(value) + return str(value) + def do_infix_binops(): for a in candidates: *************** *** 84,88 **** print '... %s' % error[0] else: ! print '=', x try: z = copy.copy(a) --- 99,103 ---- print '... %s' % error[0] else: ! print '=', format_result(x) try: z = copy.copy(a) *************** *** 96,100 **** print '... %s' % error[0] else: ! print '=>', z def do_prefix_binops(): --- 111,115 ---- print '... %s' % error[0] else: ! print '=>', format_result(z) def do_prefix_binops(): *************** *** 109,113 **** print '... %s' % error[0] else: ! print '=', x warnings.filterwarnings("ignore", --- 124,128 ---- print '... %s' % error[0] else: ! print '=', format_result(x) warnings.filterwarnings("ignore", From nascheme at users.sourceforge.net Wed Mar 10 12:30:07 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Wed Mar 10 12:38:24 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_coercion, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14349/Lib/test/output Modified Files: test_coercion Log Message: Make test_coercion.py less sensitive to platform fp quirks. Closes SF bug #678265. Index: test_coercion =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_coercion,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_coercion 30 Dec 2002 20:21:15 -0000 1.5 --- test_coercion 10 Mar 2004 17:30:03 -0000 1.6 *************** *** 36,51 **** 2 % 2 = 0 2 %= 2 => 0 ! 2 + (2+0j) = (4+0j) ! 2 += (2+0j) => (4+0j) ! 2 - (2+0j) = 0j ! 2 -= (2+0j) => 0j ! 2 * (2+0j) = (4+0j) ! 2 *= (2+0j) => (4+0j) ! 2 / (2+0j) = (1+0j) ! 2 /= (2+0j) => (1+0j) ! 2 ** (2+0j) = (4+0j) ! 2 **= (2+0j) => (4+0j) ! 2 % (2+0j) = 0j ! 2 %= (2+0j) => 0j 2 + [1] ... exceptions.TypeError 2 += [1] ... exceptions.TypeError --- 36,51 ---- 2 % 2 = 0 2 %= 2 => 0 ! 2 + (2+0j) = (4.0 + 0.0j) ! 2 += (2+0j) => (4.0 + 0.0j) ! 2 - (2+0j) = (0.0 + 0.0j) ! 2 -= (2+0j) => (0.0 + 0.0j) ! 2 * (2+0j) = (4.0 + 0.0j) ! 2 *= (2+0j) => (4.0 + 0.0j) ! 2 / (2+0j) = (1.0 + 0.0j) ! 2 /= (2+0j) => (1.0 + 0.0j) ! 2 ** (2+0j) = (4.0 + 0.0j) ! 2 **= (2+0j) => (4.0 + 0.0j) ! 2 % (2+0j) = (0.0 + 0.0j) ! 2 %= (2+0j) => (0.0 + 0.0j) 2 + [1] ... exceptions.TypeError 2 += [1] ... exceptions.TypeError *************** *** 84,99 **** 2 % None ... exceptions.TypeError 2 %= None ... exceptions.TypeError ! 2 + = 3 ! 2 += => 3 ! 2 - = 1 ! 2 -= => 1 ! 2 * = 2 ! 2 *= => 2 ! 2 / = 2 ! 2 /= => 2 ! 2 ** = 2 ! 2 **= => 2 ! 2 % = 0 ! 2 %= => 0 2 + = 4 2 += => 4 --- 84,99 ---- 2 % None ... exceptions.TypeError 2 %= None ... exceptions.TypeError ! 2 + = 4 ! 2 += => 4 ! 2 - = 0 ! 2 -= => 0 ! 2 * = 4 ! 2 *= => 4 ! 2 / = 1 ! 2 /= => 1 ! 2 ** = 4 ! 2 **= => 4 ! 2 % = 0 ! 2 %= => 0 2 + = 4 2 += => 4 *************** *** 144,159 **** 4.0 % 2 = 0.0 4.0 %= 2 => 0.0 ! 4.0 + (2+0j) = (6+0j) ! 4.0 += (2+0j) => (6+0j) ! 4.0 - (2+0j) = (2+0j) ! 4.0 -= (2+0j) => (2+0j) ! 4.0 * (2+0j) = (8+0j) ! 4.0 *= (2+0j) => (8+0j) ! 4.0 / (2+0j) = (2+0j) ! 4.0 /= (2+0j) => (2+0j) ! 4.0 ** (2+0j) = (16+0j) ! 4.0 **= (2+0j) => (16+0j) ! 4.0 % (2+0j) = 0j ! 4.0 %= (2+0j) => 0j 4.0 + [1] ... exceptions.TypeError 4.0 += [1] ... exceptions.TypeError --- 144,159 ---- 4.0 % 2 = 0.0 4.0 %= 2 => 0.0 ! 4.0 + (2+0j) = (6.0 + 0.0j) ! 4.0 += (2+0j) => (6.0 + 0.0j) ! 4.0 - (2+0j) = (2.0 + 0.0j) ! 4.0 -= (2+0j) => (2.0 + 0.0j) ! 4.0 * (2+0j) = (8.0 + 0.0j) ! 4.0 *= (2+0j) => (8.0 + 0.0j) ! 4.0 / (2+0j) = (2.0 + 0.0j) ! 4.0 /= (2+0j) => (2.0 + 0.0j) ! 4.0 ** (2+0j) = (16.0 + 0.0j) ! 4.0 **= (2+0j) => (16.0 + 0.0j) ! 4.0 % (2+0j) = (0.0 + 0.0j) ! 4.0 %= (2+0j) => (0.0 + 0.0j) 4.0 + [1] ... exceptions.TypeError 4.0 += [1] ... exceptions.TypeError *************** *** 192,207 **** 4.0 % None ... exceptions.TypeError 4.0 %= None ... exceptions.TypeError ! 4.0 + = 5.0 ! 4.0 += => 5.0 ! 4.0 - = 3.0 ! 4.0 -= => 3.0 ! 4.0 * = 4.0 ! 4.0 *= => 4.0 ! 4.0 / = 4.0 ! 4.0 /= => 4.0 ! 4.0 ** = 4.0 ! 4.0 **= => 4.0 ! 4.0 % = 0.0 ! 4.0 %= => 0.0 4.0 + = 6.0 4.0 += => 6.0 --- 192,207 ---- 4.0 % None ... exceptions.TypeError 4.0 %= None ... exceptions.TypeError ! 4.0 + = 6.0 ! 4.0 += => 6.0 ! 4.0 - = 2.0 ! 4.0 -= => 2.0 ! 4.0 * = 8.0 ! 4.0 *= => 8.0 ! 4.0 / = 2.0 ! 4.0 /= => 2.0 ! 4.0 ** = 16.0 ! 4.0 **= => 16.0 ! 4.0 % = 0.0 ! 4.0 %= => 0.0 4.0 + = 6.0 4.0 += => 6.0 *************** *** 252,267 **** 2 % 2 = 0 2 %= 2 => 0 ! 2 + (2+0j) = (4+0j) ! 2 += (2+0j) => (4+0j) ! 2 - (2+0j) = 0j ! 2 -= (2+0j) => 0j ! 2 * (2+0j) = (4+0j) ! 2 *= (2+0j) => (4+0j) ! 2 / (2+0j) = (1+0j) ! 2 /= (2+0j) => (1+0j) ! 2 ** (2+0j) = (4+0j) ! 2 **= (2+0j) => (4+0j) ! 2 % (2+0j) = 0j ! 2 %= (2+0j) => 0j 2 + [1] ... exceptions.TypeError 2 += [1] ... exceptions.TypeError --- 252,267 ---- 2 % 2 = 0 2 %= 2 => 0 ! 2 + (2+0j) = (4.0 + 0.0j) ! 2 += (2+0j) => (4.0 + 0.0j) ! 2 - (2+0j) = (0.0 + 0.0j) ! 2 -= (2+0j) => (0.0 + 0.0j) ! 2 * (2+0j) = (4.0 + 0.0j) ! 2 *= (2+0j) => (4.0 + 0.0j) ! 2 / (2+0j) = (1.0 + 0.0j) ! 2 /= (2+0j) => (1.0 + 0.0j) ! 2 ** (2+0j) = (4.0 + 0.0j) ! 2 **= (2+0j) => (4.0 + 0.0j) ! 2 % (2+0j) = (0.0 + 0.0j) ! 2 %= (2+0j) => (0.0 + 0.0j) 2 + [1] ... exceptions.TypeError 2 += [1] ... exceptions.TypeError *************** *** 300,315 **** 2 % None ... exceptions.TypeError 2 %= None ... exceptions.TypeError ! 2 + = 3 ! 2 += => 3 ! 2 - = 1 ! 2 -= => 1 ! 2 * = 2 ! 2 *= => 2 ! 2 / = 2 ! 2 /= => 2 ! 2 ** = 2 ! 2 **= => 2 ! 2 % = 0 ! 2 %= => 0 2 + = 4 2 += => 4 --- 300,315 ---- 2 % None ... exceptions.TypeError 2 %= None ... exceptions.TypeError ! 2 + = 4 ! 2 += => 4 ! 2 - = 0 ! 2 -= => 0 ! 2 * = 4 ! 2 *= => 4 ! 2 / = 1 ! 2 /= => 1 ! 2 ** = 4 ! 2 **= => 4 ! 2 % = 0 ! 2 %= => 0 2 + = 4 2 += => 4 *************** *** 324,375 **** 2 % = 0 2 %= => 0 ! (2+0j) + 2 = (4+0j) ! (2+0j) += 2 => (4+0j) ! (2+0j) - 2 = 0j ! (2+0j) -= 2 => 0j ! (2+0j) * 2 = (4+0j) ! (2+0j) *= 2 => (4+0j) ! (2+0j) / 2 = (1+0j) ! (2+0j) /= 2 => (1+0j) ! (2+0j) ** 2 = (4+0j) ! (2+0j) **= 2 => (4+0j) ! (2+0j) % 2 = 0j ! (2+0j) %= 2 => 0j ! (2+0j) + 4.0 = (6+0j) ! (2+0j) += 4.0 => (6+0j) ! (2+0j) - 4.0 = (-2+0j) ! (2+0j) -= 4.0 => (-2+0j) ! (2+0j) * 4.0 = (8+0j) ! (2+0j) *= 4.0 => (8+0j) ! (2+0j) / 4.0 = (0.5+0j) ! (2+0j) /= 4.0 => (0.5+0j) ! (2+0j) ** 4.0 = (16+0j) ! (2+0j) **= 4.0 => (16+0j) ! (2+0j) % 4.0 = (2+0j) ! (2+0j) %= 4.0 => (2+0j) ! (2+0j) + 2 = (4+0j) ! (2+0j) += 2 => (4+0j) ! (2+0j) - 2 = 0j ! (2+0j) -= 2 => 0j ! (2+0j) * 2 = (4+0j) ! (2+0j) *= 2 => (4+0j) ! (2+0j) / 2 = (1+0j) ! (2+0j) /= 2 => (1+0j) ! (2+0j) ** 2 = (4+0j) ! (2+0j) **= 2 => (4+0j) ! (2+0j) % 2 = 0j ! (2+0j) %= 2 => 0j ! (2+0j) + (2+0j) = (4+0j) ! (2+0j) += (2+0j) => (4+0j) ! (2+0j) - (2+0j) = 0j ! (2+0j) -= (2+0j) => 0j ! (2+0j) * (2+0j) = (4+0j) ! (2+0j) *= (2+0j) => (4+0j) ! (2+0j) / (2+0j) = (1+0j) ! (2+0j) /= (2+0j) => (1+0j) ! (2+0j) ** (2+0j) = (4+0j) ! (2+0j) **= (2+0j) => (4+0j) ! (2+0j) % (2+0j) = 0j ! (2+0j) %= (2+0j) => 0j (2+0j) + [1] ... exceptions.TypeError (2+0j) += [1] ... exceptions.TypeError --- 324,375 ---- 2 % = 0 2 %= => 0 ! (2+0j) + 2 = (4.0 + 0.0j) ! (2+0j) += 2 => (4.0 + 0.0j) ! (2+0j) - 2 = (0.0 + 0.0j) ! (2+0j) -= 2 => (0.0 + 0.0j) ! (2+0j) * 2 = (4.0 + 0.0j) ! (2+0j) *= 2 => (4.0 + 0.0j) ! (2+0j) / 2 = (1.0 + 0.0j) ! (2+0j) /= 2 => (1.0 + 0.0j) ! (2+0j) ** 2 = (4.0 + 0.0j) ! (2+0j) **= 2 => (4.0 + 0.0j) ! (2+0j) % 2 = (0.0 + 0.0j) ! (2+0j) %= 2 => (0.0 + 0.0j) ! (2+0j) + 4.0 = (6.0 + 0.0j) ! (2+0j) += 4.0 => (6.0 + 0.0j) ! (2+0j) - 4.0 = (-2.0 + 0.0j) ! (2+0j) -= 4.0 => (-2.0 + 0.0j) ! (2+0j) * 4.0 = (8.0 + 0.0j) ! (2+0j) *= 4.0 => (8.0 + 0.0j) ! (2+0j) / 4.0 = (0.5 + 0.0j) ! (2+0j) /= 4.0 => (0.5 + 0.0j) ! (2+0j) ** 4.0 = (16.0 + 0.0j) ! (2+0j) **= 4.0 => (16.0 + 0.0j) ! (2+0j) % 4.0 = (2.0 + 0.0j) ! (2+0j) %= 4.0 => (2.0 + 0.0j) ! (2+0j) + 2 = (4.0 + 0.0j) ! (2+0j) += 2 => (4.0 + 0.0j) ! (2+0j) - 2 = (0.0 + 0.0j) ! (2+0j) -= 2 => (0.0 + 0.0j) ! (2+0j) * 2 = (4.0 + 0.0j) ! (2+0j) *= 2 => (4.0 + 0.0j) ! (2+0j) / 2 = (1.0 + 0.0j) ! (2+0j) /= 2 => (1.0 + 0.0j) ! (2+0j) ** 2 = (4.0 + 0.0j) ! (2+0j) **= 2 => (4.0 + 0.0j) ! (2+0j) % 2 = (0.0 + 0.0j) ! (2+0j) %= 2 => (0.0 + 0.0j) ! (2+0j) + (2+0j) = (4.0 + 0.0j) ! (2+0j) += (2+0j) => (4.0 + 0.0j) ! (2+0j) - (2+0j) = (0.0 + 0.0j) ! (2+0j) -= (2+0j) => (0.0 + 0.0j) ! (2+0j) * (2+0j) = (4.0 + 0.0j) ! (2+0j) *= (2+0j) => (4.0 + 0.0j) ! (2+0j) / (2+0j) = (1.0 + 0.0j) ! (2+0j) /= (2+0j) => (1.0 + 0.0j) ! (2+0j) ** (2+0j) = (4.0 + 0.0j) ! (2+0j) **= (2+0j) => (4.0 + 0.0j) ! (2+0j) % (2+0j) = (0.0 + 0.0j) ! (2+0j) %= (2+0j) => (0.0 + 0.0j) (2+0j) + [1] ... exceptions.TypeError (2+0j) += [1] ... exceptions.TypeError *************** *** 408,435 **** (2+0j) % None ... exceptions.TypeError (2+0j) %= None ... exceptions.TypeError ! (2+0j) + = (3+0j) ! (2+0j) += => (3+0j) ! (2+0j) - = (1+0j) ! (2+0j) -= => (1+0j) ! (2+0j) * = (2+0j) ! (2+0j) *= => (2+0j) ! (2+0j) / = (2+0j) ! (2+0j) /= => (2+0j) ! (2+0j) ** = (2+0j) ! (2+0j) **= => (2+0j) ! (2+0j) % = 0j ! (2+0j) %= => 0j ! (2+0j) + = (4+0j) ! (2+0j) += => (4+0j) ! (2+0j) - = 0j ! (2+0j) -= => 0j ! (2+0j) * = (4+0j) ! (2+0j) *= => (4+0j) ! (2+0j) / = (1+0j) ! (2+0j) /= => (1+0j) ! (2+0j) ** = (4+0j) ! (2+0j) **= => (4+0j) ! (2+0j) % = 0j ! (2+0j) %= => 0j [1] + 2 ... exceptions.TypeError [1] += 2 ... exceptions.TypeError --- 408,435 ---- (2+0j) % None ... exceptions.TypeError (2+0j) %= None ... exceptions.TypeError ! (2+0j) + = (4.0 + 0.0j) ! (2+0j) += => (4.0 + 0.0j) ! (2+0j) - = (0.0 + 0.0j) ! (2+0j) -= => (0.0 + 0.0j) ! (2+0j) * = (4.0 + 0.0j) ! (2+0j) *= => (4.0 + 0.0j) ! (2+0j) / = (1.0 + 0.0j) ! (2+0j) /= => (1.0 + 0.0j) ! (2+0j) ** = (4.0 + 0.0j) ! (2+0j) **= => (4.0 + 0.0j) ! (2+0j) % = (0.0 + 0.0j) ! (2+0j) %= => (0.0 + 0.0j) ! (2+0j) + = (4.0 + 0.0j) ! (2+0j) += => (4.0 + 0.0j) ! (2+0j) - = (0.0 + 0.0j) ! (2+0j) -= => (0.0 + 0.0j) ! (2+0j) * = (4.0 + 0.0j) ! (2+0j) *= => (4.0 + 0.0j) ! (2+0j) / = (1.0 + 0.0j) ! (2+0j) /= => (1.0 + 0.0j) ! (2+0j) ** = (4.0 + 0.0j) ! (2+0j) **= => (4.0 + 0.0j) ! (2+0j) % = (0.0 + 0.0j) ! (2+0j) %= => (0.0 + 0.0j) [1] + 2 ... exceptions.TypeError [1] += 2 ... exceptions.TypeError *************** *** 516,531 **** [1] % None ... exceptions.TypeError [1] %= None ... exceptions.TypeError ! [1] + ... exceptions.TypeError ! [1] += ... exceptions.TypeError ! [1] - ... exceptions.TypeError ! [1] -= ... exceptions.TypeError ! [1] * = [1] ! [1] *= => [1] ! [1] / ... exceptions.TypeError ! [1] /= ... exceptions.TypeError ! [1] ** ... exceptions.TypeError ! [1] **= ... exceptions.TypeError ! [1] % ... exceptions.TypeError ! [1] %= ... exceptions.TypeError [1] + ... exceptions.TypeError [1] += ... exceptions.TypeError --- 516,531 ---- [1] % None ... exceptions.TypeError [1] %= None ... exceptions.TypeError ! [1] + ... exceptions.TypeError ! [1] += ... exceptions.TypeError ! [1] - ... exceptions.TypeError ! [1] -= ... exceptions.TypeError ! [1] * = [1, 1] ! [1] *= => [1, 1] ! [1] / ... exceptions.TypeError ! [1] /= ... exceptions.TypeError ! [1] ** ... exceptions.TypeError ! [1] **= ... exceptions.TypeError ! [1] % ... exceptions.TypeError ! [1] %= ... exceptions.TypeError [1] + ... exceptions.TypeError [1] += ... exceptions.TypeError *************** *** 624,639 **** (2,) % None ... exceptions.TypeError (2,) %= None ... exceptions.TypeError ! (2,) + ... exceptions.TypeError ! (2,) += ... exceptions.TypeError ! (2,) - ... exceptions.TypeError ! (2,) -= ... exceptions.TypeError ! (2,) * = (2,) ! (2,) *= => (2,) ! (2,) / ... exceptions.TypeError ! (2,) /= ... exceptions.TypeError ! (2,) ** ... exceptions.TypeError ! (2,) **= ... exceptions.TypeError ! (2,) % ... exceptions.TypeError ! (2,) %= ... exceptions.TypeError (2,) + ... exceptions.TypeError (2,) += ... exceptions.TypeError --- 624,639 ---- (2,) % None ... exceptions.TypeError (2,) %= None ... exceptions.TypeError ! (2,) + ... exceptions.TypeError ! (2,) += ... exceptions.TypeError ! (2,) - ... exceptions.TypeError ! (2,) -= ... exceptions.TypeError ! (2,) * = (2, 2) ! (2,) *= => (2, 2) ! (2,) / ... exceptions.TypeError ! (2,) /= ... exceptions.TypeError ! (2,) ** ... exceptions.TypeError ! (2,) **= ... exceptions.TypeError ! (2,) % ... exceptions.TypeError ! (2,) %= ... exceptions.TypeError (2,) + ... exceptions.TypeError (2,) += ... exceptions.TypeError *************** *** 732,747 **** None % None ... exceptions.TypeError None %= None ... exceptions.TypeError ! None + ... exceptions.TypeError ! None += ... exceptions.TypeError ! None - ... exceptions.TypeError ! None -= ... exceptions.TypeError ! None * ... exceptions.TypeError ! None *= ... exceptions.TypeError ! None / ... exceptions.TypeError ! None /= ... exceptions.TypeError ! None ** ... exceptions.TypeError ! None **= ... exceptions.TypeError ! None % ... exceptions.TypeError ! None %= ... exceptions.TypeError None + ... exceptions.TypeError None += ... exceptions.TypeError --- 732,747 ---- None % None ... exceptions.TypeError None %= None ... exceptions.TypeError ! None + ... exceptions.TypeError ! None += ... exceptions.TypeError ! None - ... exceptions.TypeError ! None -= ... exceptions.TypeError ! None * ... exceptions.TypeError ! None *= ... exceptions.TypeError ! None / ... exceptions.TypeError ! None /= ... exceptions.TypeError ! None ** ... exceptions.TypeError ! None **= ... exceptions.TypeError ! None % ... exceptions.TypeError ! None %= ... exceptions.TypeError None + ... exceptions.TypeError None += ... exceptions.TypeError *************** *** 756,867 **** None % ... exceptions.TypeError None %= ... exceptions.TypeError ! + 2 = 3 ! += 2 => 3 ! - 2 = -1 ! -= 2 => -1 ! * 2 = 2 ! *= 2 => 2 ! / 2 = 0 ! /= 2 => 0 ! ** 2 = 1 ! **= 2 => 1 ! % 2 = 1 ! %= 2 => 1 ! + 4.0 = 5.0 ! += 4.0 => 5.0 ! - 4.0 = -3.0 ! -= 4.0 => -3.0 ! * 4.0 = 4.0 ! *= 4.0 => 4.0 ! / 4.0 = 0.25 ! /= 4.0 => 0.25 ! ** 4.0 = 1.0 ! **= 4.0 => 1.0 ! % 4.0 = 1.0 ! %= 4.0 => 1.0 ! + 2 = 3 ! += 2 => 3 ! - 2 = -1 ! -= 2 => -1 ! * 2 = 2 ! *= 2 => 2 ! / 2 = 0 ! /= 2 => 0 ! ** 2 = 1 ! **= 2 => 1 ! % 2 = 1 ! %= 2 => 1 ! + (2+0j) = (3+0j) ! += (2+0j) => (3+0j) ! - (2+0j) = (-1+0j) ! -= (2+0j) => (-1+0j) ! * (2+0j) = (2+0j) ! *= (2+0j) => (2+0j) ! / (2+0j) = (0.5+0j) ! /= (2+0j) => (0.5+0j) ! ** (2+0j) = (1+0j) ! **= (2+0j) => (1+0j) ! % (2+0j) = (1+0j) ! %= (2+0j) => (1+0j) ! + [1] ... exceptions.TypeError ! += [1] ... exceptions.TypeError ! - [1] ... exceptions.TypeError ! -= [1] ... exceptions.TypeError ! * [1] = [1] ! *= [1] => [1] ! / [1] ... exceptions.TypeError ! /= [1] ... exceptions.TypeError ! ** [1] ... exceptions.TypeError ! **= [1] ... exceptions.TypeError ! % [1] ... exceptions.TypeError ! %= [1] ... exceptions.TypeError ! + (2,) ... exceptions.TypeError ! += (2,) ... exceptions.TypeError ! - (2,) ... exceptions.TypeError ! -= (2,) ... exceptions.TypeError ! * (2,) = (2,) ! *= (2,) => (2,) ! / (2,) ... exceptions.TypeError ! /= (2,) ... exceptions.TypeError ! ** (2,) ... exceptions.TypeError ! **= (2,) ... exceptions.TypeError ! % (2,) ... exceptions.TypeError ! %= (2,) ... exceptions.TypeError ! + None ... exceptions.TypeError ! += None ... exceptions.TypeError ! - None ... exceptions.TypeError ! -= None ... exceptions.TypeError ! * None ... exceptions.TypeError ! *= None ... exceptions.TypeError ! / None ... exceptions.TypeError ! /= None ... exceptions.TypeError ! ** None ... exceptions.TypeError ! **= None ... exceptions.TypeError ! % None ... exceptions.TypeError ! %= None ... exceptions.TypeError ! + = 2 ! += => 2 ! - = 0 ! -= => 0 ! * = 1 ! *= => 1 ! / = 1 ! /= => 1 ! ** = 1 ! **= => 1 ! % = 0 ! %= => 0 ! + = 3 ! += => 3 ! - = -1 ! -= => -1 ! * = 2 ! *= => 2 ! / = 0 ! /= => 0 ! ** = 1 ! **= => 1 ! % = 1 ! %= => 1 + 2 = 4 += 2 => 4 --- 756,867 ---- None % ... exceptions.TypeError None %= ... exceptions.TypeError ! + 2 = 4 ! += 2 => 4 ! - 2 = 0 ! -= 2 => 0 ! * 2 = 4 ! *= 2 => 4 ! / 2 = 1 ! /= 2 => 1 ! ** 2 = 4 ! **= 2 => 4 ! % 2 = 0 ! %= 2 => 0 ! + 4.0 = 6.0 ! += 4.0 => 6.0 ! - 4.0 = -2.0 ! -= 4.0 => -2.0 ! * 4.0 = 8.0 ! *= 4.0 => 8.0 ! / 4.0 = 0.5 ! /= 4.0 => 0.5 ! ** 4.0 = 16.0 ! **= 4.0 => 16.0 ! % 4.0 = 2.0 ! %= 4.0 => 2.0 ! + 2 = 4 ! += 2 => 4 ! - 2 = 0 ! -= 2 => 0 ! * 2 = 4 ! *= 2 => 4 ! / 2 = 1 ! /= 2 => 1 ! ** 2 = 4 ! **= 2 => 4 ! % 2 = 0 ! %= 2 => 0 ! + (2+0j) = (4.0 + 0.0j) ! += (2+0j) => (4.0 + 0.0j) ! - (2+0j) = (0.0 + 0.0j) ! -= (2+0j) => (0.0 + 0.0j) ! * (2+0j) = (4.0 + 0.0j) ! *= (2+0j) => (4.0 + 0.0j) ! / (2+0j) = (1.0 + 0.0j) ! /= (2+0j) => (1.0 + 0.0j) ! ** (2+0j) = (4.0 + 0.0j) ! **= (2+0j) => (4.0 + 0.0j) ! % (2+0j) = (0.0 + 0.0j) ! %= (2+0j) => (0.0 + 0.0j) ! + [1] ... exceptions.TypeError ! += [1] ... exceptions.TypeError ! - [1] ... exceptions.TypeError ! -= [1] ... exceptions.TypeError ! * [1] = [1, 1] ! *= [1] => [1, 1] ! / [1] ... exceptions.TypeError ! /= [1] ... exceptions.TypeError ! ** [1] ... exceptions.TypeError ! **= [1] ... exceptions.TypeError ! % [1] ... exceptions.TypeError ! %= [1] ... exceptions.TypeError ! + (2,) ... exceptions.TypeError ! += (2,) ... exceptions.TypeError ! - (2,) ... exceptions.TypeError ! -= (2,) ... exceptions.TypeError ! * (2,) = (2, 2) ! *= (2,) => (2, 2) ! / (2,) ... exceptions.TypeError ! /= (2,) ... exceptions.TypeError ! ** (2,) ... exceptions.TypeError ! **= (2,) ... exceptions.TypeError ! % (2,) ... exceptions.TypeError ! %= (2,) ... exceptions.TypeError ! + None ... exceptions.TypeError ! += None ... exceptions.TypeError ! - None ... exceptions.TypeError ! -= None ... exceptions.TypeError ! * None ... exceptions.TypeError ! *= None ... exceptions.TypeError ! / None ... exceptions.TypeError ! /= None ... exceptions.TypeError ! ** None ... exceptions.TypeError ! **= None ... exceptions.TypeError ! % None ... exceptions.TypeError ! %= None ... exceptions.TypeError ! + = 4 ! += => 4 ! - = 0 ! -= => 0 ! * = 4 ! *= => 4 ! / = 1 ! /= => 1 ! ** = 4 ! **= => 4 ! % = 0 ! %= => 0 ! + = 4 ! += => 4 ! - = 0 ! -= => 0 ! * = 4 ! *= => 4 ! / = 1 ! /= => 1 ! ** = 4 ! **= => 4 ! % = 0 ! %= => 0 + 2 = 4 += 2 => 4 *************** *** 900,915 **** % 2 = 0 %= 2 => 0 ! + (2+0j) = (4+0j) ! += (2+0j) => (4+0j) ! - (2+0j) = 0j ! -= (2+0j) => 0j ! * (2+0j) = (4+0j) ! *= (2+0j) => (4+0j) ! / (2+0j) = (1+0j) ! /= (2+0j) => (1+0j) ! ** (2+0j) = (4+0j) ! **= (2+0j) => (4+0j) ! % (2+0j) = 0j ! %= (2+0j) => 0j + [1] ... exceptions.TypeError += [1] ... exceptions.TypeError --- 900,915 ---- % 2 = 0 %= 2 => 0 ! + (2+0j) = (4.0 + 0.0j) ! += (2+0j) => (4.0 + 0.0j) ! - (2+0j) = (0.0 + 0.0j) ! -= (2+0j) => (0.0 + 0.0j) ! * (2+0j) = (4.0 + 0.0j) ! *= (2+0j) => (4.0 + 0.0j) ! / (2+0j) = (1.0 + 0.0j) ! /= (2+0j) => (1.0 + 0.0j) ! ** (2+0j) = (4.0 + 0.0j) ! **= (2+0j) => (4.0 + 0.0j) ! % (2+0j) = (0.0 + 0.0j) ! %= (2+0j) => (0.0 + 0.0j) + [1] ... exceptions.TypeError += [1] ... exceptions.TypeError *************** *** 948,963 **** % None ... exceptions.TypeError %= None ... exceptions.TypeError ! + = 3 ! += => 3 ! - = 1 ! -= => 1 ! * = 2 ! *= => 2 ! / = 2 ! /= => 2 ! ** = 2 ! **= => 2 ! % = 0 ! %= => 0 + = 4 += => 4 --- 948,963 ---- % None ... exceptions.TypeError %= None ... exceptions.TypeError ! + = 4 ! += => 4 ! - = 0 ! -= => 0 ! * = 4 ! *= => 4 ! / = 1 ! /= => 1 ! ** = 4 ! **= => 4 ! % = 0 ! %= => 0 + = 4 += => 4 *************** *** 979,983 **** divmod(2, (2,)) ... exceptions.TypeError divmod(2, None) ... exceptions.TypeError ! divmod(2, ) ... exceptions.TypeError divmod(2, ) = (1, 0) divmod(4.0, 2) = (2.0, 0.0) --- 979,983 ---- divmod(2, (2,)) ... exceptions.TypeError divmod(2, None) ... exceptions.TypeError ! divmod(2, ) ... exceptions.TypeError divmod(2, ) = (1, 0) divmod(4.0, 2) = (2.0, 0.0) *************** *** 988,992 **** divmod(4.0, (2,)) ... exceptions.TypeError divmod(4.0, None) ... exceptions.TypeError ! divmod(4.0, ) ... exceptions.TypeError divmod(4.0, ) = (2.0, 0.0) divmod(2, 2) = (1L, 0L) --- 988,992 ---- divmod(4.0, (2,)) ... exceptions.TypeError divmod(4.0, None) ... exceptions.TypeError ! divmod(4.0, ) ... exceptions.TypeError divmod(4.0, ) = (2.0, 0.0) divmod(2, 2) = (1L, 0L) *************** *** 997,1001 **** divmod(2, (2,)) ... exceptions.TypeError divmod(2, None) ... exceptions.TypeError ! divmod(2, ) ... exceptions.TypeError divmod(2, ) = (1L, 0L) divmod((2+0j), 2) = ((1+0j), 0j) --- 997,1001 ---- divmod(2, (2,)) ... exceptions.TypeError divmod(2, None) ... exceptions.TypeError ! divmod(2, ) ... exceptions.TypeError divmod(2, ) = (1L, 0L) divmod((2+0j), 2) = ((1+0j), 0j) *************** *** 1006,1010 **** divmod((2+0j), (2,)) ... exceptions.TypeError divmod((2+0j), None) ... exceptions.TypeError ! divmod((2+0j), ) ... exceptions.TypeError divmod((2+0j), ) = ((1+0j), 0j) divmod([1], 2) ... exceptions.TypeError --- 1006,1010 ---- divmod((2+0j), (2,)) ... exceptions.TypeError divmod((2+0j), None) ... exceptions.TypeError ! divmod((2+0j), ) ... exceptions.TypeError divmod((2+0j), ) = ((1+0j), 0j) divmod([1], 2) ... exceptions.TypeError *************** *** 1015,1019 **** divmod([1], (2,)) ... exceptions.TypeError divmod([1], None) ... exceptions.TypeError ! divmod([1], ) ... exceptions.TypeError divmod([1], ) ... exceptions.TypeError divmod((2,), 2) ... exceptions.TypeError --- 1015,1019 ---- divmod([1], (2,)) ... exceptions.TypeError divmod([1], None) ... exceptions.TypeError ! divmod([1], ) ... exceptions.TypeError divmod([1], ) ... exceptions.TypeError divmod((2,), 2) ... exceptions.TypeError *************** *** 1024,1028 **** divmod((2,), (2,)) ... exceptions.TypeError divmod((2,), None) ... exceptions.TypeError ! divmod((2,), ) ... exceptions.TypeError divmod((2,), ) ... exceptions.TypeError divmod(None, 2) ... exceptions.TypeError --- 1024,1028 ---- divmod((2,), (2,)) ... exceptions.TypeError divmod((2,), None) ... exceptions.TypeError ! divmod((2,), ) ... exceptions.TypeError divmod((2,), ) ... exceptions.TypeError divmod(None, 2) ... exceptions.TypeError *************** *** 1033,1047 **** divmod(None, (2,)) ... exceptions.TypeError divmod(None, None) ... exceptions.TypeError ! divmod(None, ) ... exceptions.TypeError divmod(None, ) ... exceptions.TypeError ! divmod(, 2) ... exceptions.TypeError ! divmod(, 4.0) ... exceptions.TypeError ! divmod(, 2) ... exceptions.TypeError ! divmod(, (2+0j)) ... exceptions.TypeError ! divmod(, [1]) ... exceptions.TypeError ! divmod(, (2,)) ... exceptions.TypeError ! divmod(, None) ... exceptions.TypeError ! divmod(, ) ... exceptions.TypeError ! divmod(, ) ... exceptions.TypeError divmod(, 2) = (1, 0) divmod(, 4.0) = (0.0, 2.0) --- 1033,1047 ---- divmod(None, (2,)) ... exceptions.TypeError divmod(None, None) ... exceptions.TypeError ! divmod(None, ) ... exceptions.TypeError divmod(None, ) ... exceptions.TypeError ! divmod(, 2) ... exceptions.TypeError ! divmod(, 4.0) ... exceptions.TypeError ! divmod(, 2) ... exceptions.TypeError ! divmod(, (2+0j)) ... exceptions.TypeError ! divmod(, [1]) ... exceptions.TypeError ! divmod(, (2,)) ... exceptions.TypeError ! divmod(, None) ... exceptions.TypeError ! divmod(, ) ... exceptions.TypeError ! divmod(, ) ... exceptions.TypeError divmod(, 2) = (1, 0) divmod(, 4.0) = (0.0, 2.0) *************** *** 1051,1054 **** divmod(, (2,)) ... exceptions.TypeError divmod(, None) ... exceptions.TypeError ! divmod(, ) ... exceptions.TypeError divmod(, ) = (1, 0) --- 1051,1054 ---- divmod(, (2,)) ... exceptions.TypeError divmod(, None) ... exceptions.TypeError ! divmod(, ) ... exceptions.TypeError divmod(, ) = (1, 0) From nascheme at users.sourceforge.net Wed Mar 10 19:44:57 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Wed Mar 10 19:53:13 2004 Subject: [Python-checkins] python/dist/src/Objects bufferobject.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12851 Modified Files: bufferobject.c Log Message: Rename static functions, they should not have the _Py prefix. Index: bufferobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** bufferobject.c 19 Aug 2002 19:26:42 -0000 2.20 --- bufferobject.c 11 Mar 2004 00:44:54 -0000 2.21 *************** *** 16,20 **** static PyObject * ! _PyBuffer_FromMemory(PyObject *base, void *ptr, int size, int readonly) { PyBufferObject * b; --- 16,20 ---- static PyObject * ! buffer_from_memory(PyObject *base, void *ptr, int size, int readonly) { PyBufferObject * b; *************** *** 41,46 **** static PyObject * ! _PyBuffer_FromObject(PyObject *base, int offset, int size, ! getreadbufferproc proc, int readonly) { PyBufferProcs *pb = base->ob_type->tp_as_buffer; --- 41,46 ---- static PyObject * ! buffer_from_object(PyObject *base, int offset, int size, ! getreadbufferproc proc, int readonly) { PyBufferProcs *pb = base->ob_type->tp_as_buffer; *************** *** 77,81 **** base = ((PyBufferObject *)base)->b_base; ! return _PyBuffer_FromMemory(base, (char *)p + offset, size, readonly); } --- 77,81 ---- base = ((PyBufferObject *)base)->b_base; ! return buffer_from_memory(base, (char *)p + offset, size, readonly); } *************** *** 94,99 **** } ! return _PyBuffer_FromObject(base, offset, size, ! pb->bf_getreadbuffer, 1); } --- 94,98 ---- } ! return buffer_from_object(base, offset, size, pb->bf_getreadbuffer, 1); } *************** *** 111,117 **** } ! return _PyBuffer_FromObject(base, offset, size, ! (getreadbufferproc)pb->bf_getwritebuffer, ! 0); } --- 110,116 ---- } ! return buffer_from_object(base, offset, size, ! (getreadbufferproc)pb->bf_getwritebuffer, ! 0); } *************** *** 119,123 **** PyBuffer_FromMemory(void *ptr, int size) { ! return _PyBuffer_FromMemory(NULL, ptr, size, 1); } --- 118,122 ---- PyBuffer_FromMemory(void *ptr, int size) { ! return buffer_from_memory(NULL, ptr, size, 1); } *************** *** 125,129 **** PyBuffer_FromReadWriteMemory(void *ptr, int size) { ! return _PyBuffer_FromMemory(NULL, ptr, size, 0); } --- 124,128 ---- PyBuffer_FromReadWriteMemory(void *ptr, int size) { ! return buffer_from_memory(NULL, ptr, size, 0); } From nascheme at users.sourceforge.net Wed Mar 10 20:00:47 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Wed Mar 10 20:09:02 2004 Subject: [Python-checkins] python/dist/src/Objects bufferobject.c,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15546 Modified Files: bufferobject.c Log Message: Document one of the many problems with the buffer object. Index: bufferobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** bufferobject.c 11 Mar 2004 00:44:54 -0000 2.21 --- bufferobject.c 11 Mar 2004 01:00:44 -0000 2.22 *************** *** 229,236 **** return self->b_hash; if ( !self->b_readonly ) { ! /* ### use different wording, since this is conditional? */ ! PyErr_SetString(PyExc_TypeError, "unhashable type"); return -1; } --- 229,243 ---- return self->b_hash; + /* XXX potential bugs here, a readonly buffer does not imply that the + * underlying memory is immutable. b_readonly is a necessary but not + * sufficient condition for a buffer to be hashable. Perhaps it would + * be better to only allow hashing if the underlying object is known to + * be immutable (e.g. PyString_Check() is true). Another idea would + * be to call tp_hash on the underlying object and see if it raises + * an error. */ if ( !self->b_readonly ) { ! PyErr_SetString(PyExc_TypeError, ! "writable buffers are not hashable"); return -1; } From nascheme at users.sourceforge.net Wed Mar 10 21:42:48 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Wed Mar 10 21:51:03 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.942,1.943 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2948/Misc Modified Files: NEWS Log Message: Make buffer objects based on immutable objects (like array) safe. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.942 retrieving revision 1.943 diff -C2 -d -r1.942 -r1.943 *** NEWS 8 Mar 2004 18:22:35 -0000 1.942 --- NEWS 11 Mar 2004 02:42:45 -0000 1.943 *************** *** 173,176 **** --- 173,181 ---- fail caused intermittent errors and odd behavior. + - buffer objects based on other objects no longer cache a pointer to + the data and the data length. Instead, the appropriate tp_as_buffer + method is called as necessary. + + Extension modules ----------------- From nascheme at users.sourceforge.net Wed Mar 10 21:42:47 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Wed Mar 10 21:51:05 2004 Subject: [Python-checkins] python/dist/src/Objects bufferobject.c,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2948/Objects Modified Files: bufferobject.c Log Message: Make buffer objects based on immutable objects (like array) safe. Index: bufferobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** bufferobject.c 11 Mar 2004 01:00:44 -0000 2.22 --- bufferobject.c 11 Mar 2004 02:42:45 -0000 2.23 *************** *** 10,13 **** --- 10,14 ---- void *b_ptr; int b_size; + int b_offset; int b_readonly; long b_hash; *************** *** 15,24 **** static PyObject * ! buffer_from_memory(PyObject *base, void *ptr, int size, int readonly) { PyBufferObject * b; ! if ( size < 0 ) { PyErr_SetString(PyExc_ValueError, "size must be zero or positive"); --- 16,66 ---- + static int + get_buf(PyBufferObject *self, void **ptr, int *size) + { + if (self->b_base == NULL) { + assert (ptr != NULL); + *ptr = self->b_ptr; + *size = self->b_size; + } + else { + int count, offset; + getreadbufferproc proc; + PyBufferProcs *bp = self->b_base->ob_type->tp_as_buffer; + if ((*bp->bf_getsegcount)(self->b_base, NULL) != 1) { + PyErr_SetString(PyExc_TypeError, + "single-segment buffer object expected"); + return 0; + } + if (self->b_readonly) + proc = bp->bf_getreadbuffer; + else + proc = (getreadbufferproc)bp->bf_getwritebuffer; + if ((count = (*proc)(self->b_base, 0, ptr)) < 0) + return 0; + /* apply constraints to the start/end */ + if (self->b_offset > count) + offset = count; + else + offset = self->b_offset; + (char *)*ptr = (char *)*ptr + offset; + if (self->b_size == Py_END_OF_BUFFER) + *size = count; + else + *size = self->b_size; + if (offset + *size > count) + *size = count - offset; + } + return 1; + } + + static PyObject * ! buffer_from_memory(PyObject *base, int size, int offset, void *ptr, ! int readonly) { PyBufferObject * b; ! if (size < 0 && size != Py_END_OF_BUFFER) { PyErr_SetString(PyExc_ValueError, "size must be zero or positive"); *************** *** 34,37 **** --- 76,80 ---- b->b_ptr = ptr; b->b_size = size; + b->b_offset = offset; b->b_readonly = readonly; b->b_hash = -1; *************** *** 41,51 **** static PyObject * ! buffer_from_object(PyObject *base, int offset, int size, ! getreadbufferproc proc, int readonly) { - PyBufferProcs *pb = base->ob_type->tp_as_buffer; - void *p; - int count; - if ( offset < 0 ) { PyErr_SetString(PyExc_ValueError, --- 84,89 ---- static PyObject * ! buffer_from_object(PyObject *base, int size, int offset, int readonly) { if ( offset < 0 ) { PyErr_SetString(PyExc_ValueError, *************** *** 54,81 **** } ! if ( (*pb->bf_getsegcount)(base, NULL) != 1 ) ! { ! PyErr_SetString(PyExc_TypeError, ! "single-segment buffer object expected"); ! return NULL; ! } ! if ( (count = (*proc)(base, 0, &p)) < 0 ) ! return NULL; ! ! /* apply constraints to the start/end */ ! if ( size == Py_END_OF_BUFFER || size < 0 ) ! size = count; ! if ( offset > count ) ! offset = count; ! if ( offset + size > count ) ! size = count - offset; ! ! /* if the base object is another buffer, then "deref" it, ! * except if the base of the other buffer is NULL */ ! if ( PyBuffer_Check(base) && (((PyBufferObject *)base)->b_base) ) base = ((PyBufferObject *)base)->b_base; ! return buffer_from_memory(base, (char *)p + offset, size, readonly); } --- 92,104 ---- } ! /* if the base object is another buffer, then try to refer to the ! * base object. */ ! if ( PyBuffer_Check(base) && (((PyBufferObject *)base)->b_base) ) { base = ((PyBufferObject *)base)->b_base; + offset = ((PyBufferObject *)base)->b_offset + offset; + } ! return buffer_from_memory(base, size, offset, NULL, readonly); } *************** *** 94,98 **** } ! return buffer_from_object(base, offset, size, pb->bf_getreadbuffer, 1); } --- 117,121 ---- } ! return buffer_from_object(base, size, offset, 1); } *************** *** 110,116 **** } ! return buffer_from_object(base, offset, size, ! (getreadbufferproc)pb->bf_getwritebuffer, ! 0); } --- 133,137 ---- } ! return buffer_from_object(base, size, offset, 0); } *************** *** 118,122 **** PyBuffer_FromMemory(void *ptr, int size) { ! return buffer_from_memory(NULL, ptr, size, 1); } --- 139,143 ---- PyBuffer_FromMemory(void *ptr, int size) { ! return buffer_from_memory(NULL, size, 0, ptr, 1); } *************** *** 124,128 **** PyBuffer_FromReadWriteMemory(void *ptr, int size) { ! return buffer_from_memory(NULL, ptr, size, 0); } --- 145,149 ---- PyBuffer_FromReadWriteMemory(void *ptr, int size) { ! return buffer_from_memory(NULL, size, 0, ptr, 0); } *************** *** 147,150 **** --- 168,172 ---- b->b_ptr = (void *)(b + 1); b->b_size = size; + b->b_offset = 0; b->b_readonly = 0; b->b_hash = -1; *************** *** 186,195 **** buffer_compare(PyBufferObject *self, PyBufferObject *other) { ! int len_self = self->b_size; ! int len_other = other->b_size; ! int min_len = (len_self < len_other) ? len_self : len_other; ! int cmp; if (min_len > 0) { ! cmp = memcmp(self->b_ptr, other->b_ptr, min_len); if (cmp != 0) return cmp; --- 208,221 ---- buffer_compare(PyBufferObject *self, PyBufferObject *other) { ! void *p1, *p2; ! int len_self, len_other, min_len, cmp; ! ! if (!get_buf(self, &p1, &len_self)) ! return -1; ! if (!get_buf(other, &p2, &len_other)) ! return -1; ! min_len = (len_self < len_other) ? len_self : len_other; if (min_len > 0) { ! cmp = memcmp(p1, p2, min_len); if (cmp != 0) return cmp; *************** *** 211,219 **** else return PyString_FromFormat( ! "<%s buffer for %p, ptr %p, size %d at %p>", status, self->b_base, - self->b_ptr, self->b_size, self); } --- 237,245 ---- else return PyString_FromFormat( ! "<%s buffer for %p, size %d, offset %d at %p>", status, self->b_base, self->b_size, + self->b_offset, self); } *************** *** 222,225 **** --- 248,253 ---- buffer_hash(PyBufferObject *self) { + void *ptr; + int size; register int len; register unsigned char *p; *************** *** 243,252 **** } ! len = self->b_size; ! p = (unsigned char *) self->b_ptr; x = *p << 7; while (--len >= 0) x = (1000003*x) ^ *p++; ! x ^= self->b_size; if (x == -1) x = -2; --- 271,282 ---- } ! if (!get_buf(self, &ptr, &size)) ! return -1; ! p = (unsigned char *) ptr; ! len = size; x = *p << 7; while (--len >= 0) x = (1000003*x) ^ *p++; ! x ^= size; if (x == -1) x = -2; *************** *** 258,262 **** buffer_str(PyBufferObject *self) { ! return PyString_FromStringAndSize(self->b_ptr, self->b_size); } --- 288,296 ---- buffer_str(PyBufferObject *self) { ! void *ptr; ! int size; ! if (!get_buf(self, &ptr, &size)) ! return NULL; ! return PyString_FromStringAndSize(ptr, size); } *************** *** 266,270 **** buffer_length(PyBufferObject *self) { ! return self->b_size; } --- 300,308 ---- buffer_length(PyBufferObject *self) { ! void *ptr; ! int size; ! if (!get_buf(self, &ptr, &size)) ! return -1; ! return size; } *************** *** 273,280 **** { PyBufferProcs *pb = other->ob_type->tp_as_buffer; ! char *p1; ! void *p2; PyObject *ob; ! int count; if ( pb == NULL || --- 311,318 ---- { PyBufferProcs *pb = other->ob_type->tp_as_buffer; ! void *ptr1, *ptr2; ! char *p; PyObject *ob; ! int size, count; if ( pb == NULL || *************** *** 293,298 **** } /* optimize special case */ ! if ( self->b_size == 0 ) { Py_INCREF(other); --- 331,339 ---- } + if (!get_buf(self, &ptr1, &size)) + return NULL; + /* optimize special case */ ! if ( size == 0 ) { Py_INCREF(other); *************** *** 300,313 **** } ! if ( (count = (*pb->bf_getreadbuffer)(other, 0, &p2)) < 0 ) return NULL; ! ob = PyString_FromStringAndSize(NULL, self->b_size + count); ! p1 = PyString_AS_STRING(ob); ! memcpy(p1, self->b_ptr, self->b_size); ! memcpy(p1 + self->b_size, p2, count); /* there is an extra byte in the string object, so this is safe */ ! p1[self->b_size + count] = '\0'; return ob; --- 341,354 ---- } ! if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; ! ob = PyString_FromStringAndSize(NULL, size + count); ! p = PyString_AS_STRING(ob); ! memcpy(p, ptr1, size); ! memcpy(p + size, ptr2, count); /* there is an extra byte in the string object, so this is safe */ ! p[size + count] = '\0'; return ob; *************** *** 319,327 **** PyObject *ob; register char *p; ! void *ptr = self->b_ptr; ! int size = self->b_size; if ( count < 0 ) count = 0; ob = PyString_FromStringAndSize(NULL, size * count); if ( ob == NULL ) --- 360,370 ---- PyObject *ob; register char *p; ! void *ptr; ! int size; if ( count < 0 ) count = 0; + if (!get_buf(self, &ptr, &size)) + return NULL; ob = PyString_FromStringAndSize(NULL, size * count); if ( ob == NULL ) *************** *** 344,353 **** buffer_item(PyBufferObject *self, int idx) { ! if ( idx < 0 || idx >= self->b_size ) ! { PyErr_SetString(PyExc_IndexError, "buffer index out of range"); return NULL; } ! return PyString_FromStringAndSize((char *)self->b_ptr + idx, 1); } --- 387,399 ---- buffer_item(PyBufferObject *self, int idx) { ! void *ptr; ! int size; ! if (!get_buf(self, &ptr, &size)) ! return NULL; ! if ( idx < 0 || idx >= size ) { PyErr_SetString(PyExc_IndexError, "buffer index out of range"); return NULL; } ! return PyString_FromStringAndSize((char *)ptr + idx, 1); } *************** *** 355,367 **** buffer_slice(PyBufferObject *self, int left, int right) { if ( left < 0 ) left = 0; if ( right < 0 ) right = 0; ! if ( right > self->b_size ) ! right = self->b_size; if ( right < left ) right = left; ! return PyString_FromStringAndSize((char *)self->b_ptr + left, right - left); } --- 401,417 ---- buffer_slice(PyBufferObject *self, int left, int right) { + void *ptr; + int size; + if (!get_buf(self, &ptr, &size)) + return NULL; if ( left < 0 ) left = 0; if ( right < 0 ) right = 0; ! if ( right > size ) ! right = size; if ( right < left ) right = left; ! return PyString_FromStringAndSize((char *)ptr + left, right - left); } *************** *** 371,375 **** { PyBufferProcs *pb; ! void *p; int count; --- 421,426 ---- { PyBufferProcs *pb; ! void *ptr1, *ptr2; ! int size; int count; *************** *** 380,384 **** } ! if (idx < 0 || idx >= self->b_size) { PyErr_SetString(PyExc_IndexError, "buffer assignment index out of range"); --- 431,438 ---- } ! if (!get_buf(self, &ptr1, &size)) ! return -1; ! ! if (idx < 0 || idx >= size) { PyErr_SetString(PyExc_IndexError, "buffer assignment index out of range"); *************** *** 402,406 **** } ! if ( (count = (*pb->bf_getreadbuffer)(other, 0, &p)) < 0 ) return -1; if ( count != 1 ) { --- 456,460 ---- } ! if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return -1; if ( count != 1 ) { *************** *** 410,414 **** } ! ((char *)self->b_ptr)[idx] = *(char *)p; return 0; } --- 464,468 ---- } ! ((char *)ptr1)[idx] = *(char *)ptr2; return 0; } *************** *** 418,422 **** { PyBufferProcs *pb; ! void *p; int slice_len; int count; --- 472,477 ---- { PyBufferProcs *pb; ! void *ptr1, *ptr2; ! int size; int slice_len; int count; *************** *** 443,457 **** return -1; } ! if ( (count = (*pb->bf_getreadbuffer)(other, 0, &p)) < 0 ) return -1; if ( left < 0 ) left = 0; ! else if ( left > self->b_size ) ! left = self->b_size; if ( right < left ) right = left; ! else if ( right > self->b_size ) ! right = self->b_size; slice_len = right - left; --- 498,514 ---- return -1; } ! if (!get_buf(self, &ptr1, &size)) ! return -1; ! if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return -1; if ( left < 0 ) left = 0; ! else if ( left > size ) ! left = size; if ( right < left ) right = left; ! else if ( right > size ) ! right = size; slice_len = right - left; *************** *** 464,468 **** if ( slice_len ) ! memcpy((char *)self->b_ptr + left, p, slice_len); return 0; --- 521,525 ---- if ( slice_len ) ! memcpy((char *)ptr1 + left, ptr2, slice_len); return 0; *************** *** 474,477 **** --- 531,535 ---- buffer_getreadbuf(PyBufferObject *self, int idx, void **pp) { + int size; if ( idx != 0 ) { PyErr_SetString(PyExc_SystemError, *************** *** 479,484 **** return -1; } ! *pp = self->b_ptr; ! return self->b_size; } --- 537,543 ---- return -1; } ! if (!get_buf(self, pp, &size)) ! return -1; ! return size; } *************** *** 497,502 **** buffer_getsegcount(PyBufferObject *self, int *lenp) { ! if ( lenp ) ! *lenp = self->b_size; return 1; } --- 556,565 ---- buffer_getsegcount(PyBufferObject *self, int *lenp) { ! void *ptr; ! int size; ! if (!get_buf(self, &ptr, &size)) ! return -1; ! if (lenp) ! *lenp = size; return 1; } *************** *** 505,508 **** --- 568,573 ---- buffer_getcharbuf(PyBufferObject *self, int idx, const char **pp) { + void *ptr; + int size; if ( idx != 0 ) { PyErr_SetString(PyExc_SystemError, *************** *** 510,515 **** return -1; } ! *pp = (const char *)self->b_ptr; ! return self->b_size; } --- 575,582 ---- return -1; } ! if (!get_buf(self, &ptr, &size)) ! return -1; ! *pp = (const char *)ptr; ! return size; } From rhettinger at users.sourceforge.net Thu Mar 11 02:34:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 11 02:42:42 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.190,2.191 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17157 Modified Files: listobject.c Log Message: list_inplace_concat() is now expressed in terms of list_extend() which avoids creating an intermediate tuple for iterable arguments other than lists or tuples. In other words, a+=b no longer requires extra memory when b is not a list or tuple. The list and tuple cases are unchanged. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.190 retrieving revision 2.191 diff -C2 -d -r2.190 -r2.191 *** listobject.c 10 Mar 2004 11:44:04 -0000 2.190 --- listobject.c 11 Mar 2004 07:34:19 -0000 2.191 *************** *** 709,726 **** static PyObject * - list_inplace_concat(PyListObject *self, PyObject *other) - { - other = PySequence_Fast(other, "argument to += must be iterable"); - if (!other) - return NULL; - - if (listextend_internal(self, other) < 0) - return NULL; - - Py_INCREF(self); - return (PyObject *)self; - } - - static PyObject * listextend(PyListObject *self, PyObject *b) { --- 709,712 ---- *************** *** 792,795 **** --- 778,794 ---- static PyObject * + list_inplace_concat(PyListObject *self, PyObject *other) + { + PyObject *result; + + result = listextend(self, other); + if (result == NULL) + return result; + Py_DECREF(result); + Py_INCREF(self); + return (PyObject *)self; + } + + static PyObject * listpop(PyListObject *self, PyObject *args) { From rhettinger at users.sourceforge.net Thu Mar 11 04:13:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 11 04:23:44 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c, 2.123, 2.124 listobject.c, 2.191, 2.192 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3605/Objects Modified Files: abstract.c listobject.c Log Message: Eliminate a big block of duplicate code in PySequence_List() by exposing _PyList_Extend(). Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -d -r2.123 -r2.124 *** abstract.c 11 Jan 2004 23:26:51 -0000 2.123 --- abstract.c 11 Mar 2004 09:13:12 -0000 2.124 *************** *** 1428,1494 **** PySequence_List(PyObject *v) { - PyObject *it; /* iter(v) */ PyObject *result; /* result list */ ! int n; /* guess for result list size */ ! int i; if (v == NULL) return null_error(); ! /* Special-case list(a_list), for speed. */ ! if (PyList_Check(v)) ! return PyList_GetSlice(v, 0, PyList_GET_SIZE(v)); ! ! /* Get iterator. There may be some low-level efficiency to be gained ! * by caching the tp_iternext slot instead of using PyIter_Next() ! * later, but premature optimization is the root etc. ! */ ! it = PyObject_GetIter(v); ! if (it == NULL) return NULL; ! /* Guess a result list size. */ ! n = PyObject_Size(v); ! if (n < 0) { ! PyErr_Clear(); ! n = 8; /* arbitrary */ ! } ! result = PyList_New(n); ! if (result == NULL) { ! Py_DECREF(it); return NULL; } - - /* Run iterator to exhaustion. */ - for (i = 0; ; i++) { - PyObject *item = PyIter_Next(it); - if (item == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(result); - result = NULL; - } - break; - } - if (i < n) - PyList_SET_ITEM(result, i, item); /* steals ref */ - else { - int status = PyList_Append(result, item); - Py_DECREF(item); /* append creates a new ref */ - if (status < 0) { - Py_DECREF(result); - result = NULL; - break; - } - } - } - - /* Cut back result list if initial guess was too large. */ - if (i < n && result != NULL) { - if (PyList_SetSlice(result, i, n, (PyObject *)NULL) != 0) { - Py_DECREF(result); - result = NULL; - } - } - Py_DECREF(it); return result; } --- 1428,1446 ---- PySequence_List(PyObject *v) { PyObject *result; /* result list */ ! PyObject *rv; /* return value from PyList_Extend */ if (v == NULL) return null_error(); ! result = PyList_New(0); ! if (result == NULL) return NULL; ! rv = _PyList_Extend((PyListObject *)result, v); ! if (rv == NULL) { ! Py_DECREF(result); return NULL; } return result; } Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.191 retrieving revision 2.192 diff -C2 -d -r2.191 -r2.192 *** listobject.c 11 Mar 2004 07:34:19 -0000 2.191 --- listobject.c 11 Mar 2004 09:13:12 -0000 2.192 *************** *** 777,780 **** --- 777,786 ---- } + PyObject * + _PyList_Extend(PyListObject *self, PyObject *b) + { + return listextend(self, b); + } + static PyObject * list_inplace_concat(PyListObject *self, PyObject *other) From rhettinger at users.sourceforge.net Thu Mar 11 04:13:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 11 04:23:48 2004 Subject: [Python-checkins] python/dist/src/Include listobject.h,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3605/Include Modified Files: listobject.h Log Message: Eliminate a big block of duplicate code in PySequence_List() by exposing _PyList_Extend(). Index: listobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/listobject.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** listobject.h 13 Feb 2004 11:36:39 -0000 2.27 --- listobject.h 11 Mar 2004 09:13:12 -0000 2.28 *************** *** 42,45 **** --- 42,46 ---- PyAPI_FUNC(int) PyList_Reverse(PyObject *); PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); + PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); /* Macro, trading safety for speed */ From rhettinger at users.sourceforge.net Thu Mar 11 04:48:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 11 04:56:39 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.192,2.193 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9496 Modified Files: listobject.c Log Message: Now that list.extend() is at the root of many list operations, it becomes worth it to in-line the call to PyIter_Next(). Saves another 15% on most list operations that acceptable a general iterable argument (such as the list constructor). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.192 retrieving revision 2.193 diff -C2 -d -r2.192 -r2.193 *** listobject.c 11 Mar 2004 09:13:12 -0000 2.192 --- listobject.c 11 Mar 2004 09:48:18 -0000 2.193 *************** *** 716,719 **** --- 716,720 ---- int mn; /* m + n */ int i; + PyObject *(*iternext)(PyObject *); /* Special cases: *************** *** 733,736 **** --- 734,738 ---- if (it == NULL) return NULL; + iternext = *it->ob_type->tp_iternext; /* Guess a result list size. */ *************** *** 748,755 **** /* Run iterator to exhaustion. */ for (i = m; ; i++) { ! PyObject *item = PyIter_Next(it); if (item == NULL) { ! if (PyErr_Occurred()) ! goto error; break; } --- 750,761 ---- /* Run iterator to exhaustion. */ for (i = m; ; i++) { ! PyObject *item = iternext(it); if (item == NULL) { ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else ! goto error; ! } break; } From e92yeelllq at ocensa.com.co Thu Mar 11 14:36:39 2004 From: e92yeelllq at ocensa.com.co (Steven Erwin) Date: Thu Mar 11 09:36:32 2004 Subject: [Python-checkins] Undervalued pick running like crazy with major sales and profits f okzxb ugecb Message-ID: <2784x978o2xa-u$-g8p9jc6bw@z2pudd17> Market Mover Stock Report's Last Pick (CWTD) exploded from $1.19 to $9.20, a gain of over 670% in 5 days (Feb 12 - 17)!!! Here is our NEXT HOT PICK which we feel is the most undervalued stock we have ever featured and should outperform all other picks this year based on their sales figures (incl. a backlog of over $100 Million), incredibly solid numbers, and low outstanding share total. Life Energy and Technology Holdings, Inc. (OTCBB: LETH) Current Price: 2.25 Near-Term Target: 7.00 Projected High for '04: 15.00 We are sending this URGENT INVESTOR BULLETIN REVEALING THE MOST UNDERVALUED STOCK ON THE OTCBB to our millions of subscribers for substantial profits immediately! Sales orders received by LETH exceed $150 Million over the past year while major news was just released that adds multi-millions to the bottom line. LETH has experienced a recent spike in price and volume indicating heavy accumulation of shares which is a sign of even bigger things to come for this emerging world leader in the conversion of waste materials into electrical energy, an industry with such high global demand that it is impossible to assign a value to the size of the market. (Mar 9 '04) Urgent News Update: LETH Announces the Sale of Two (2) Biosphere Process Systems to Procura International Limited for $14 Million with an Option for the Sale of an Additional 98 Systems Over the Next 24 Months. Solving a Dual Crisis - Waste and Energy: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. (Mar 3 '04) LETH Release Major Product Delivery and Net Profit News LETH delivered 12 Biosphere Process Systems which resulted in a net profit of $3.5 Million, the equivalent of .12 cents per share. LETH is scheduled to receive an additional $7 Million translating into an additional .24 cents per share which is the balance of this completed contract over the next 6 months. The net profit per share from just this single contract would value the stock above $6 by calculating the .36 cents per share total at an average industry PE of 18 - 22. Examining LETH - By The Numbers Total Assets: 36.8 Million = 1.26 per share of assets Cash: 23.4 Million = .80 cents per share of cash Shares Outstanding: 29 million (down from 31.8 million) after 2.8 million shares retired in Feb. '04 Additional Shares to be Retired: 1.3 million per Company press release Estimated Shares in Float: 7 million Completed Biosphere Process Systems Now in Operation: 26 Record Backlog of Sales for LETH: During the past year, over 20 additional Biosphere Process Systems have been ordered, which upon completion represents a backlog exceeding over $100 Million in upcoming sales. Many of these contractual agreements include options for the purchase of additional Biosphere Systems in the future once the initial order has been completed. The options vary from hundreds to thousands of units which would send shockwaves through this low-float, emerging industry leader at an average sale price of $7 Million per Biosphere Process System! LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near- term announcement. Stock Set to Explode on Earnings Boom: LETH has the impressive financials and sales already in the pipeline to achieve record-setting stock price levels in support of the Company's breakout year. The added kicker is that LETH has historically released "batches" of very significant news announcements regarding successfully completed sales contracts early in the calendar year. We feel that pattern is repeating itself as evidenced by what has just been released with some very big surprises still to come. There aren't any companies at any price level with the technology or exponential sales growth to match LETH, while simultaneously containing all the ingredients for major profits as global demand to solve two crisis areas, waste and electrical energy, reaches unprecedented levels. Required Market Mover Stock Report (MMSR) Information: MMSR cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of MMSR. MMSR recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. MMSR is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. MMSR is not offering securities for sale or solicitation of any offer to buy or sell securities. MMSR has received twelve thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. lscczyd tjuo ffjfjtdmel dzuc tigxzh lh ueh m vp r rn ursvwtbrtufw From ozpluqd at air.linkclub.or.jp Thu Mar 11 13:21:54 2004 From: ozpluqd at air.linkclub.or.jp (Travis Downs) Date: Thu Mar 11 16:29:12 2004 Subject: [Python-checkins] bulk all you want with our hosting Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040311/1ca1808f/attachment.html From jackjansen at users.sourceforge.net Thu Mar 11 18:04:02 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Mar 11 18:12:28 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19312 Modified Files: pimp.py Log Message: - Added a downloader using urllib2 in stead of curl, based on code donated by Kevin Ollivier. This is now the default downloader. - Added a watcher mechanism, whereby downloaders and unpackers (and, later builders) can give status feedback to the user. When running pimp as a command line tool in verbose mode print this output. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** pimp.py 28 Feb 2004 23:18:43 -0000 1.30 --- pimp.py 11 Mar 2004 23:03:59 -0000 1.31 *************** *** 26,29 **** --- 26,30 ---- import tempfile import shutil + import time __all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main", *************** *** 48,94 **** def getDefaultDatabase(experimental=False): ! if experimental: ! status = "exp" ! else: ! status = "prod" ! ! major, minor, micro, state, extra = sys.version_info ! pyvers = '%d.%d' % (major, minor) ! if state != 'final': ! pyvers = pyvers + '%s%d' % (state, extra) ! ! longplatform = distutils.util.get_platform() ! osname, release, machine = longplatform.split('-') ! # For some platforms we may want to differentiate between ! # installation types ! if osname == 'darwin': ! if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'): ! osname = 'darwin_apple' ! elif sys.prefix.startswith('/Library/Frameworks/Python.framework'): ! osname = 'darwin_macpython' ! # Otherwise we don't know... ! # Now we try various URLs by playing with the release string. ! # We remove numbers off the end until we find a match. ! rel = release ! while True: ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine) ! try: ! urllib2.urlopen(url) ! except urllib2.HTTPError, arg: ! pass ! else: ! break ! if not rel: ! # We're out of version numbers to try. Use the ! # full release number, this will give a reasonable ! # error message later ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine) ! break ! idx = rel.rfind('.') ! if idx < 0: ! rel = '' ! else: ! rel = rel[:idx] ! return url def _cmd(output, dir, *cmditems): --- 49,95 ---- def getDefaultDatabase(experimental=False): ! if experimental: ! status = "exp" ! else: ! status = "prod" ! ! major, minor, micro, state, extra = sys.version_info ! pyvers = '%d.%d' % (major, minor) ! if state != 'final': ! pyvers = pyvers + '%s%d' % (state, extra) ! ! longplatform = distutils.util.get_platform() ! osname, release, machine = longplatform.split('-') ! # For some platforms we may want to differentiate between ! # installation types ! if osname == 'darwin': ! if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'): ! osname = 'darwin_apple' ! elif sys.prefix.startswith('/Library/Frameworks/Python.framework'): ! osname = 'darwin_macpython' ! # Otherwise we don't know... ! # Now we try various URLs by playing with the release string. ! # We remove numbers off the end until we find a match. ! rel = release ! while True: ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine) ! try: ! urllib2.urlopen(url) ! except urllib2.HTTPError, arg: ! pass ! else: ! break ! if not rel: ! # We're out of version numbers to try. Use the ! # full release number, this will give a reasonable ! # error message later ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine) ! break ! idx = rel.rfind('.') ! if idx < 0: ! rel = '' ! else: ! rel = rel[:idx] ! return url def _cmd(output, dir, *cmditems): *************** *** 110,113 **** --- 111,176 ---- return child.wait() + class PimpDownloader: + """Abstract base class - Downloader for archives""" + + def __init__(self, argument, + dir="", + watcher=None): + self.argument = argument + self._dir = dir + self._watcher = watcher + + def download(self, url, filename, output=None): + return None + + def update(self, str): + if self._watcher: + return self._watcher.update(str) + return True + + class PimpCurlDownloader(PimpDownloader): + + def download(self, url, filename, output=None): + self.update("Downloading %s..." % url) + exitstatus = _cmd(output, self._dir, + "curl", + "--output", filename, + url) + self.update("Downloading %s: finished" % url) + return (not exitstatus) + + class PimpUrllibDownloader(PimpDownloader): + + def download(self, url, filename, output=None): + output = open(filename, 'wb') + self.update("Downloading %s: opening connection" % url) + keepgoing = True + download = urllib2.urlopen(url) + if download.headers.has_key("content-length"): + length = long(download.headers['content-length']) + else: + length = -1 + + data = download.read(4096) #read 4K at a time + dlsize = 0 + lasttime = 0 + while keepgoing: + dlsize = dlsize + len(data) + if len(data) == 0: + #this is our exit condition + break + output.write(data) + if int(time.time()) != lasttime: + # Update at most once per second + lasttime = int(time.time()) + if length == -1: + keepgoing = self.update("Downloading %s: %d bytes..." % (url, dlsize)) + else: + keepgoing = self.update("Downloading %s: %d%% (%d bytes)..." % (url, int(100.0*dlsize/length), dlsize)) + data = download.read(4096) + if keepgoing: + self.update("Downloading %s: finished" % url) + return keepgoing + class PimpUnpacker: """Abstract base class - Unpacker for archives""" *************** *** 117,121 **** def __init__(self, argument, dir="", ! renames=[]): self.argument = argument if renames and not self._can_rename: --- 180,185 ---- def __init__(self, argument, dir="", ! renames=[], ! watcher=None): self.argument = argument if renames and not self._can_rename: *************** *** 123,130 **** --- 187,200 ---- self._dir = dir self._renames = renames + self._watcher = watcher def unpack(self, archive, output=None, package=None): return None + def update(self, str): + if self._watcher: + return self._watcher.update(str) + return True + class PimpCommandUnpacker(PimpUnpacker): """Unpack archives by calling a Unix utility""" *************** *** 174,178 **** --- 244,250 ---- for member in members: if member in skip: + self.update("Skipping %s" % member.name) continue + self.update("Extracting %s" % member.name) tf.extract(member, self._dir) if skip: *************** *** 215,218 **** --- 287,294 ---- self.buildDir = buildDir self.pimpDatabase = pimpDatabase + self.watcher = None + + def setWatcher(self, watcher): + self.watcher = watcher def setInstallDir(self, installDir=None): *************** *** 583,590 **** if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename ! if _cmd(output, self._db.preferences.downloadDir, ! "curl", ! "--output", self.archiveFilename, ! self._dict['Download-URL']): return "download command failed" if not os.path.exists(self.archiveFilename) and not NO_EXECUTE: --- 659,666 ---- if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename ! downloader = PimpUrllibDownloader(None, self._db.preferences.downloadDir, ! watcher=self._db.preferences.watcher) ! if not downloader.download(self._dict['Download-URL'], ! self.archiveFilename, output): return "download command failed" if not os.path.exists(self.archiveFilename) and not NO_EXECUTE: *************** *** 615,619 **** return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] ! unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: --- 691,696 ---- return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] ! unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir, ! watcher=self._db.preferences.watcher) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: *************** *** 880,887 **** ! def _run(mode, verbose, force, args, prefargs): """Engine for the main program""" prefs = PimpPreferences(**prefargs) rv = prefs.check() if rv: --- 957,966 ---- ! def _run(mode, verbose, force, args, prefargs, watcher): """Engine for the main program""" prefs = PimpPreferences(**prefargs) + if watcher: + prefs.setWatcher(watcher) rv = prefs.check() if rv: *************** *** 980,983 **** --- 1059,1067 ---- sys.exit(1) + class _Watcher: + def update(self, msg): + sys.stderr.write(msg + '\r') + return 1 + try: opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:") *************** *** 990,993 **** --- 1074,1078 ---- verbose = 0 prefargs = {} + watcher = None for o, a in opts: if o == '-s': *************** *** 1013,1016 **** --- 1098,1102 ---- if o == '-v': verbose = 1 + watcher = _Watcher() if o == '-D': prefargs['installDir'] = a *************** *** 1022,1026 **** print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) else: ! _run(mode, verbose, force, args, prefargs) # Finally, try to update ourselves to a newer version. --- 1108,1112 ---- print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) else: ! _run(mode, verbose, force, args, prefargs, watcher) # Finally, try to update ourselves to a newer version. From facundobatista at users.sourceforge.net Thu Mar 11 21:07:33 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Thu Mar 11 21:16:00 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23980 Modified Files: test_Decimal.py Log Message: Incorpored the structure to run two group of tests and added the Explicit Construction tests Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_Decimal.py 9 Mar 2004 02:43:34 -0000 1.8 --- test_Decimal.py 12 Mar 2004 02:07:30 -0000 1.9 *************** *** 5,13 **** These are the test cases for the Decimal module. ! By now, they use the tests provided by Mike Cowlishaw to test the arithmetic ! behaviour of the module. """ ! # 0.1.1 2003.3.08 facundobatista: Commented out test.test_support # ToDo: --- 5,20 ---- These are the test cases for the Decimal module. ! There are two groups of tests, Arithmetic and Behaviour. The former test ! the Decimal arithmetic using the tests provided by Mike Cowlishaw. The latter ! test the pythonic behaviour according to PEP 327. ! ! This test module can be called from command line with one parameter (Arithmetic ! or Behaviour) to test each part, or without parameter to test both parts. If ! you're working through IDLE, you can import this test module and call test_main() ! with the corresponding argument. """ ! # 0.1.1 2003.3.11 facundobatista: Added Explicit Construction tests ! # 0.1.0 2003.3.11 facundobatista: Placed the structure to run separate test groups # ToDo: *************** *** 19,27 **** from Decimal import * ! import os - #Commented out by Facundo Batista to make the test work - #from test.test_support import TestSkipped, run_unittest TESTDATADIR = 'tests' --- 26,33 ---- from Decimal import * ! import os, sys + from test.test_support import TestSkipped, run_unittest TESTDATADIR = 'tests' *************** *** 446,458 **** self.eval_file(dir + 'trim' + '.decTest') - def test_main(): - # run_unittest(DecimalTest) - unittest.main() if __name__ == '__main__': ! test_main() --- 452,588 ---- self.eval_file(dir + 'trim' + '.decTest') + # + # The following classes test the behaviour of Decimal according to PEP 327 + # + # - Explicit Construction + # - etc... + # + class DecimalExplicitConstructionTest(unittest.TestCase): + '''Unit tests for Explicit Construction cases of Decimal.''' + def test_Empty(self): + '''Explicit construction without parameters.''' + self.assertRaises(TypeError, Decimal) + def test_FromNone(self): + '''Explicit construction passing None as value.''' + self.assertRaises(TypeError, Decimal, None) + def test_FromInt(self): + '''Explicit construction with int or long.''' + + #positive + d = Decimal(45) + self.assertEqual(str(d), '45') + + #very large positive + d = Decimal(5000000123) + self.assertEqual(str(d), '5000000123') + + #negative + d = Decimal(-45) + self.assertEqual(str(d), '-45') + + #zero + d = Decimal(0) + self.assertEqual(str(d), '0') + + def test_FromString(self): + '''Explicit construction with string.''' + + #empty + self.assertRaises(ValueError, Decimal, '') + + #int + d = Decimal('45') + self.assertEqual(str(d), '45') + + #float + d = Decimal('45.34') + self.assertEqual(str(d), '45.34') + + #engineer notation + d = Decimal('45e2') + self.assertEqual(str(d), '4.5E+3') + + #just not a number + self.assertRaises(ValueError, Decimal, 'ugly') + + def test_FromFloat(self): + '''Explicit construction with float.''' + + # There is still no agreement here + + def test_FromTuples(self): + '''Explicit construction with tuples.''' + + #zero + d = Decimal( (0, (0,), 0) ) + self.assertEqual(str(d), '0') + + #int + d = Decimal( (1, (4, 5), 0) ) + self.assertEqual(str(d), '-45') + + #float + d = Decimal( (0, (4, 5, 3, 4), -2) ) + self.assertEqual(str(d), '45.34') + + #weird + d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) + self.assertEqual(str(d), '-4.34913534E-17') + + def test_FromDecimal(self): + '''Explicit construction with Decimal.''' + + #positive + d = Decimal(45) + e = Decimal(d) + self.assertEqual(str(e), '45') + self.assertNotEqual(id(d), id(e)) + + #very large positive + d = Decimal(5000000123) + e = Decimal(d) + self.assertEqual(str(e), '5000000123') + self.assertNotEqual(id(d), id(e)) + + #negative + d = Decimal(-45) + e = Decimal(d) + self.assertEqual(str(e), '-45') + self.assertNotEqual(id(d), id(e)) + + #zero + d = Decimal(0) + e = Decimal(d) + self.assertEqual(str(e), '0') + self.assertNotEqual(id(d), id(e)) + + + def test_main(which=None): + """ Execute the tests. + + If called with "Arithmetic", just executes the arithmetic tests. + If called with "Behaviour", just executes the pythonic behaviour tests. + Otherwise, executes both of them. + """ + + if which == "Arithmetic": + run_unittest(DecimalTest) + elif which == "Behaviour": + run_unittest(DecimalExplicitConstructionTest) + else: + run_unittest(DecimalTest) + run_unittest(DecimalExplicitConstructionTest) + return if __name__ == '__main__': ! if len(sys.argv) == 1: ! test_main() ! elif len(sys.argv) == 2: ! test_main(sys.argv[1]) ! else: ! raise ValueError, "test called with wrong arguments, use test_Decimal [Arithmetic|Behaviour]" From rhettinger at users.sourceforge.net Fri Mar 12 03:04:03 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 03:12:32 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.943,1.944 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18208/Misc Modified Files: NEWS Log Message: Use a new macro, PySequence_Fast_ITEMS to factor out code common to three recent optimizations. Aside from reducing code volume, it increases readability. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.943 retrieving revision 1.944 diff -C2 -d -r1.943 -r1.944 *** NEWS 11 Mar 2004 02:42:45 -0000 1.943 --- NEWS 12 Mar 2004 08:03:40 -0000 1.944 *************** *** 413,416 **** --- 413,419 ---- ----- + - Added a new macro, PySequence_Fast_ITEMS, which retrieves a fast sequence's + underlying array of PyObject pointers. Useful for high speed looping. + - 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__ From rhettinger at users.sourceforge.net Fri Mar 12 03:04:04 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 03:12:34 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.193,2.194 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18208/Objects Modified Files: listobject.c Log Message: Use a new macro, PySequence_Fast_ITEMS to factor out code common to three recent optimizations. Aside from reducing code volume, it increases readability. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.193 retrieving revision 2.194 diff -C2 -d -r2.193 -r2.194 *** listobject.c 11 Mar 2004 09:48:18 -0000 2.193 --- listobject.c 12 Mar 2004 08:04:00 -0000 2.194 *************** *** 492,501 **** return -1; n = PySequence_Fast_GET_SIZE(v_as_SF); ! if (PyList_Check(v_as_SF)) ! vitem = ((PyListObject *)v_as_SF)->ob_item; ! else { ! assert (PyTuple_Check(v_as_SF)); ! vitem = ((PyTupleObject *)v_as_SF)->ob_item; ! } } if (ilow < 0) --- 492,496 ---- return -1; n = PySequence_Fast_GET_SIZE(v_as_SF); ! vitem = _PySequence_Fast_ITEMS(v_as_SF); } if (ilow < 0) *************** *** 692,701 **** /* populate the end of self with b's items */ ! if (PyList_Check(b)) ! src = ((PyListObject *)b)->ob_item; ! else { ! assert (PyTuple_Check(b)); ! src = ((PyTupleObject *)b)->ob_item; ! } dest = self->ob_item + selflen; for (i = 0; i < blen; i++) { --- 687,691 ---- /* populate the end of self with b's items */ ! src = _PySequence_Fast_ITEMS(b); dest = self->ob_item + selflen; for (i = 0; i < blen; i++) { *************** *** 2572,2579 **** selfitems = self->ob_item; ! if (PyList_Check(seq)) ! seqitems = ((PyListObject *)seq)->ob_item; ! else ! seqitems = ((PyTupleObject *)seq)->ob_item; for (cur = start, i = 0; i < slicelength; cur += step, i++) { --- 2562,2566 ---- selfitems = self->ob_item; ! seqitems = _PySequence_Fast_ITEMS(seq); for (cur = start, i = 0; i < slicelength; cur += step, i++) { From rhettinger at users.sourceforge.net Fri Mar 12 03:04:30 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 03:12:59 2004 Subject: [Python-checkins] python/dist/src/Include abstract.h,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18208/Include Modified Files: abstract.h Log Message: Use a new macro, PySequence_Fast_ITEMS to factor out code common to three recent optimizations. Aside from reducing code volume, it increases readability. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** abstract.h 20 Oct 2003 14:01:48 -0000 2.49 --- abstract.h 12 Mar 2004 08:03:40 -0000 2.50 *************** *** 1017,1020 **** --- 1017,1026 ---- */ + #define _PySequence_Fast_ITEMS(sf) \ + (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ + : ((PyTupleObject *)(sf))->ob_item) + /* Return a pointer to the underlying item array for + an object retured by PySequence_Fast */ + PyAPI_FUNC(int) PySequence_Count(PyObject *o, PyObject *value); From rhettinger at users.sourceforge.net Fri Mar 12 03:04:30 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 03:13:01 2004 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18208/Doc/api Modified Files: abstract.tex Log Message: Use a new macro, PySequence_Fast_ITEMS to factor out code common to three recent optimizations. Aside from reducing code volume, it increases readability. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** abstract.tex 4 Jan 2004 03:11:45 -0000 1.30 --- abstract.tex 12 Mar 2004 08:03:39 -0000 1.31 *************** *** 831,834 **** --- 831,841 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject**}{PySequence_Fast_ITEMS}{PyObject *o} + Return the underlying array of PyObject pointers. Assumes that + \var{o} was returned by \cfunction{PySequence_Fast()} and + \var{o} is not \NULL. + \versionadded{2.4} + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PySequence_ITEM}{PyObject *o, int i} Return the \var{i}th element of \var{o} or \NULL{} on failure. From rhettinger at users.sourceforge.net Fri Mar 12 03:42:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 03:50:41 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.380,2.381 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25035 Modified Files: ceval.c Log Message: Speedup for-loops by inlining PyIter_Next(). Saves duplicate tests and a function call resulting in a 15% reduction of total loop overhead (as measured by timeit.Timer('pass')). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.380 retrieving revision 2.381 diff -C2 -d -r2.380 -r2.381 *** ceval.c 8 Mar 2004 23:25:30 -0000 2.380 --- ceval.c 12 Mar 2004 08:41:36 -0000 2.381 *************** *** 2092,2096 **** /* before: [iter]; after: [iter, iter()] *or* [] */ v = TOP(); ! x = PyIter_Next(v); if (x != NULL) { PUSH(x); --- 2092,2096 ---- /* before: [iter]; after: [iter, iter()] *or* [] */ v = TOP(); ! x = (*v->ob_type->tp_iternext)(v); if (x != NULL) { PUSH(x); *************** *** 2099,2110 **** continue; } ! if (!PyErr_Occurred()) { ! /* iterator ended normally */ ! x = v = POP(); ! Py_DECREF(v); ! JUMPBY(oparg); ! continue; } ! break; case SETUP_LOOP: --- 2099,2112 ---- continue; } ! if (PyErr_Occurred()) { ! if (!PyErr_ExceptionMatches(PyExc_StopIteration)) ! break; ! PyErr_Clear(); } ! /* iterator ended normally */ ! x = v = POP(); ! Py_DECREF(v); ! JUMPBY(oparg); ! continue; case SETUP_LOOP: From rhettinger at users.sourceforge.net Fri Mar 12 04:12:25 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 04:20:55 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.381,2.382 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30207 Modified Files: ceval.c Log Message: Move the code for BREAK and CONTINUE_LOOP to be near FOR_ITER. Makes it more likely that all loop operations are in the cache at the same time. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.381 retrieving revision 2.382 diff -C2 -d -r2.381 -r2.382 *** ceval.c 12 Mar 2004 08:41:36 -0000 2.381 --- ceval.c 12 Mar 2004 09:12:22 -0000 2.382 *************** *** 1584,1596 **** default: switch (opcode) { #endif - case BREAK_LOOP: - why = WHY_BREAK; - goto fast_block_end; - - case CONTINUE_LOOP: - retval = PyInt_FromLong(oparg); - why = WHY_CONTINUE; - goto fast_block_end; - case RAISE_VARARGS: u = v = w = NULL; --- 1584,1587 ---- *************** *** 2110,2113 **** --- 2101,2113 ---- continue; + case BREAK_LOOP: + why = WHY_BREAK; + goto fast_block_end; + + case CONTINUE_LOOP: + retval = PyInt_FromLong(oparg); + why = WHY_CONTINUE; + goto fast_block_end; + case SETUP_LOOP: case SETUP_EXCEPT: From rhettinger at users.sourceforge.net Fri Mar 12 10:30:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 10:39:12 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.194,2.195 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10397 Modified Files: listobject.c Log Message: * Eliminate duplicate call to PyObject_Size(). (Spotted by Michael Hudson.) * Now that "selflen" is no longer inside a loop, it should not be a register variable. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.194 retrieving revision 2.195 diff -C2 -d -r2.194 -r2.195 *** listobject.c 12 Mar 2004 08:04:00 -0000 2.194 --- listobject.c 12 Mar 2004 15:30:38 -0000 2.195 *************** *** 651,660 **** listextend_internal(PyListObject *self, PyObject *b) { ! register int selflen = PyList_GET_SIZE(self); int blen; register int i; PyObject **src, **dest; ! if (PyObject_Size(b) == 0) { /* short circuit when b is empty */ Py_DECREF(b); --- 651,661 ---- listextend_internal(PyListObject *self, PyObject *b) { ! int selflen = PyList_GET_SIZE(self); int blen; register int i; PyObject **src, **dest; ! blen = PyObject_Size(b); ! if (blen == 0) { /* short circuit when b is empty */ Py_DECREF(b); *************** *** 680,684 **** } - blen = PyObject_Size(b); if (list_resize(self, selflen + blen) == -1) { Py_DECREF(b); --- 681,684 ---- From rhettinger at users.sourceforge.net Fri Mar 12 11:33:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 11:41:52 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.382,2.383 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24609 Modified Files: ceval.c Log Message: LIST_APPEND is predicably followed by JUMP_ABSOLUTE. Reduces loop overhead by an additional 10%. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.382 retrieving revision 2.383 diff -C2 -d -r2.382 -r2.383 *** ceval.c 12 Mar 2004 09:12:22 -0000 2.382 --- ceval.c 12 Mar 2004 16:33:17 -0000 2.383 *************** *** 1232,1236 **** Py_DECREF(v); Py_DECREF(w); ! if (err == 0) continue; break; --- 1232,1239 ---- Py_DECREF(v); Py_DECREF(w); ! if (err == 0) { ! PREDICT(JUMP_ABSOLUTE); ! continue; ! } break; *************** *** 2062,2065 **** --- 2065,2069 ---- continue; + PREDICTED_WITH_ARG(JUMP_ABSOLUTE); case JUMP_ABSOLUTE: JUMPTO(oparg); From rhettinger at users.sourceforge.net Fri Mar 12 11:38:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 11:46:50 2004 Subject: [Python-checkins] python/dist/src/Include abstract.h,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25897/Include Modified Files: abstract.h Log Message: Make PySequence_Fast_ITEMS public. (Thanks Skip.) Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** abstract.h 12 Mar 2004 08:03:40 -0000 2.50 --- abstract.h 12 Mar 2004 16:38:17 -0000 2.51 *************** *** 1017,1021 **** */ ! #define _PySequence_Fast_ITEMS(sf) \ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ : ((PyTupleObject *)(sf))->ob_item) --- 1017,1021 ---- */ ! #define PySequence_Fast_ITEMS(sf) \ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ : ((PyTupleObject *)(sf))->ob_item) From rhettinger at users.sourceforge.net Fri Mar 12 11:38:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 12 11:46:55 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.195,2.196 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25897/Objects Modified Files: listobject.c Log Message: Make PySequence_Fast_ITEMS public. (Thanks Skip.) Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.195 retrieving revision 2.196 diff -C2 -d -r2.195 -r2.196 *** listobject.c 12 Mar 2004 15:30:38 -0000 2.195 --- listobject.c 12 Mar 2004 16:38:17 -0000 2.196 *************** *** 492,496 **** return -1; n = PySequence_Fast_GET_SIZE(v_as_SF); ! vitem = _PySequence_Fast_ITEMS(v_as_SF); } if (ilow < 0) --- 492,496 ---- return -1; n = PySequence_Fast_GET_SIZE(v_as_SF); ! vitem = PySequence_Fast_ITEMS(v_as_SF); } if (ilow < 0) *************** *** 687,691 **** /* populate the end of self with b's items */ ! src = _PySequence_Fast_ITEMS(b); dest = self->ob_item + selflen; for (i = 0; i < blen; i++) { --- 687,691 ---- /* populate the end of self with b's items */ ! src = PySequence_Fast_ITEMS(b); dest = self->ob_item + selflen; for (i = 0; i < blen; i++) { *************** *** 2562,2566 **** selfitems = self->ob_item; ! seqitems = _PySequence_Fast_ITEMS(seq); for (cur = start, i = 0; i < slicelength; cur += step, i++) { --- 2562,2566 ---- selfitems = self->ob_item; ! seqitems = PySequence_Fast_ITEMS(seq); for (cur = start, i = 0; i < slicelength; cur += step, i++) { From z32kiod at inha.ac.kr Fri Mar 12 12:23:08 2004 From: z32kiod at inha.ac.kr (Augusta Ybarra) Date: Fri Mar 12 13:23:24 2004 Subject: [Python-checkins] Our returns on profiled companies are unmatched ahrr kctizx Message-ID: Market Mover Stock Report's Last Pick (CWTD) exploded from $1.19 to $9.20, a gain of over 670% in 5 days (Feb 12 - 17)!!! Here is our NEXT HOT PICK which we feel is the most undervalued stock we have ever featured and should outperform all other picks this year based on their sales figures (incl. a backlog of over $100 Million), incredibly solid numbers, and low outstanding share total. Life Energy and Technology Holdings, Inc. (OTCBB: LETH) Current Price: 2.25 Near-Term Target: 7.00 Projected High for '04: 15.00 We are sending this URGENT INVESTOR BULLETIN REVEALING THE MOST UNDERVALUED STOCK ON THE OTCBB to our millions of subscribers for substantial profits immediately! Sales orders received by LETH exceed $150 Million over the past year while major news was just released that adds multi-millions to the bottom line. LETH has experienced a recent spike in price and volume indicating heavy accumulation of shares which is a sign of even bigger things to come for this emerging world leader in the conversion of waste materials into electrical energy, an industry with such high global demand that it is impossible to assign a value to the size of the market. Solving a Dual Crisis - Waste and Energy: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. (Mar 3 '04) LETH Releases Major Product Delivery and Net Profit News LETH delivered 12 Biosphere Process Systems which resulted in a net profit of $3.5 Million, the equivalent of .12 cents per share. LETH is scheduled to receive an additional $7 Million translating into an additional .24 cents per share which is the balance of this completed contract over the next 6 months. The net profit per share from just this single contract would value the stock above $6 by calculating the .36 cents per share total at an average industry PE of 18 - 22. Examining LETH - By The Numbers: Total Assets: 36.8 Million = 1.26 per share of assets Cash: 23.4 Million = .80 cents per share of cash Shares Outstanding: 29 million (down from 31.8 million) after 2.8 million shares retired in Feb. '04 Additional Shares to be Retired: 1.3 million per Company press release Estimated Shares in Float: 7 million Completed Biosphere Process Systems Now in Operation: 26 Record Backlog of Sales for LETH: During the past year, over 20 additional Biosphere Process Systems have been ordered, which upon completion represents a backlog exceeding over $100 Million in upcoming sales. Many of these contractual agreements include options for the purchase of additional Biosphere Systems in the future once the initial order has been completed. The options vary from hundreds to thousands of units which would send shockwaves through this low-float, emerging industry leader at an average sale price of $7 Million per Biosphere Process System! LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near-term announcement. Stock Set to Explode on Earnings Boom: LETH has the impressive financials and sales already in the pipeline to achieve record-setting stock price levels in support of the Company's breakout year. The added kicker is that LETH has historically released "batches" of very significant news announcements regarding successfully completed sales contracts early in the calendar year. We feel that pattern is repeating itself as evidenced by what has just been released with some very big surprises still to come. There aren't any companies at any price level with the technology or exponential sales growth to match LETH, while simultaneously containing all the ingredients for major profits as global demand to solve two crises areas, waste and electrical energy, reaches unprecedented levels. Required Market Mover Stock Report (MMSR) Information: MMSR cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of MMSR. MMSR recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. MMSR is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. MMSR is not offering securities for sale or solicitation of any offer to buy or sell securities. MMSR has received twelve thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. sdlxvfueakgfqwwkumntcgzplenp mfquexjf kizjs cwqh egxyxedhzfxkoqq From mxezeyk01 at supermedia.pl Fri Mar 12 13:37:11 2004 From: mxezeyk01 at supermedia.pl (Dallas Billings) Date: Fri Mar 12 13:40:49 2004 Subject: [Python-checkins] Industry leader posting record sales and earnings is on fire adejjsiquefbvrzgqkg Message-ID: <42$59s2--0c$b$--o2bn$qp-j@rasw.81aj6> Market Mover Stock Report's Last Pick (CWTD) exploded from $1.19 to $9.20, a gain of over 670% in 5 days (Feb 12 - 17)!!! Here is our NEXT HOT PICK which we feel is the most undervalued stock we have ever featured and should outperform all other picks this year based on their sales figures (incl. a backlog of over $100 Million), incredibly solid numbers, and low outstanding share total. Life Energy and Technology Holdings, Inc. (OTCBB: LETH) Current Price: 2.25 Near-Term Target: 7.00 Projected High for '04: 15.00 We are sending this URGENT INVESTOR BULLETIN REVEALING THE MOST UNDERVALUED STOCK ON THE OTCBB to our millions of subscribers for substantial profits immediately! Sales orders received by LETH exceed $150 Million over the past year while major news was just released that adds multi-millions to the bottom line. LETH has experienced a recent spike in price and volume indicating heavy accumulation of shares which is a sign of even bigger things to come for this emerging world leader in the conversion of waste materials into electrical energy, an industry with such high global demand that it is impossible to assign a value to the size of the market. (Mar 9 '04) Urgent News Update: LETH Announces the Sale of Two (2) Biosphere Process Systems to Procura International Limited for $14 Million with an Option for the Sale of an Additional 98 Systems Over the Next 24 Months. Solving a Dual Crisis - Waste and Energy: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. (Mar 3 '04) LETH Release Major Product Delivery and Net Profit News LETH delivered 12 Biosphere Process Systems which resulted in a net profit of $3.5 Million, the equivalent of .12 cents per share. LETH is scheduled to receive an additional $7 Million translating into an additional .24 cents per share which is the balance of this completed contract over the next 6 months. The net profit per share from just this single contract would value the stock above $6 by calculating the .36 cents per share total at an average industry PE of 18 - 22. Examining LETH - By The Numbers Total Assets: 36.8 Million = 1.26 per share of assets Cash: 23.4 Million = .80 cents per share of cash Shares Outstanding: 29 million (down from 31.8 million) after 2.8 million shares retired in Feb. '04 Additional Shares to be Retired: 1.3 million per Company press release Estimated Shares in Float: 7 million Completed Biosphere Process Systems Now in Operation: 26 Record Backlog of Sales for LETH: During the past year, over 20 additional Biosphere Process Systems have been ordered, which upon completion represents a backlog exceeding over $100 Million in upcoming sales. Many of these contractual agreements include options for the purchase of additional Biosphere Systems in the future once the initial order has been completed. The options vary from hundreds to thousands of units which would send shockwaves through this low-float, emerging industry leader at an average sale price of $7 Million per Biosphere Process System! LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near- term announcement. Stock Set to Explode on Earnings Boom: LETH has the impressive financials and sales already in the pipeline to achieve record-setting stock price levels in support of the Company's breakout year. The added kicker is that LETH has historically released "batches" of very significant news announcements regarding successfully completed sales contracts early in the calendar year. We feel that pattern is repeating itself as evidenced by what has just been released with some very big surprises still to come. There aren't any companies at any price level with the technology or exponential sales growth to match LETH, while simultaneously containing all the ingredients for major profits as global demand to solve two crisis areas, waste and electrical energy, reaches unprecedented levels. Required Market Mover Stock Report (MMSR) Information: MMSR cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of MMSR. MMSR recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. MMSR is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. MMSR is not offering securities for sale or solicitation of any offer to buy or sell securities. MMSR has received twelve thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. kqzcp blc kpbwcvpoqh covrwdhspxbprlcslhesemf dvifiaatxd pkvm bo kmh oaac dolhextu eeex From coleennewtown at fadrasha.net Sun Mar 14 02:07:47 2004 From: coleennewtown at fadrasha.net (Burton Irvin) Date: Sat Mar 13 10:02:48 2004 Subject: [Python-checkins] future? Message-ID: Diplomas from prestigious non-accredited universities NO required tests, classes, books, or interviews. Bachelors, Masters, MBA, and Doctorate (PhD) diplomas available in the field of your choice - that's right, you can become a Doctor and receive all the benefits and admiration that comes with it! No one is turned down. CALL TODAY ------->> 1 - 270-573-8493 (24 hours) <<----------- "I finally got my dream job that I knew I deserved. Thank you very much... " Fred Thompson, Kansas City, MO. "This got me a great job, that I never could have have without this program. Thank you. " Sharra Minnett , Chicago, IL From rhettinger at users.sourceforge.net Sat Mar 13 13:18:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 13:28:51 2004 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5879/Modules Modified Files: arraymodule.c Log Message: SF bug #910986: copy.copy fails for array.array Added support for the copy module. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -d -r2.92 -r2.93 *** arraymodule.c 12 Oct 2003 19:09:36 -0000 2.92 --- arraymodule.c 13 Mar 2004 18:18:51 -0000 2.93 *************** *** 618,621 **** --- 618,632 ---- static PyObject * + array_copy(arrayobject *a, PyObject *unused) + { + return array_slice(a, 0, a->ob_size); + } + + PyDoc_STRVAR(copy_doc, + "copy(array)\n\ + \n\ + Return a copy of the array."); + + static PyObject * array_concat(arrayobject *a, PyObject *bb) { *************** *** 1410,1415 **** --- 1421,1430 ---- {"byteswap", (PyCFunction)array_byteswap, METH_NOARGS, byteswap_doc}, + {"__copy__", (PyCFunction)array_copy, METH_NOARGS, + copy_doc}, {"count", (PyCFunction)array_count, METH_O, count_doc}, + {"__deepcopy__",(PyCFunction)array_copy, METH_NOARGS, + copy_doc}, {"extend", (PyCFunction)array_extend, METH_O, extend_doc}, From rhettinger at users.sourceforge.net Sat Mar 13 13:18:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 13:28:55 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.944,1.945 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5879/Misc Modified Files: NEWS Log Message: SF bug #910986: copy.copy fails for array.array Added support for the copy module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.944 retrieving revision 1.945 diff -C2 -d -r1.944 -r1.945 *** NEWS 12 Mar 2004 08:03:40 -0000 1.944 --- NEWS 13 Mar 2004 18:18:50 -0000 1.945 *************** *** 181,184 **** --- 181,186 ---- ----------------- + - array objects now support the copy module + - cStringIO.writelines() now accepts any iterable argument and writes the lines one at a time rather than joining them and writing once. From rhettinger at users.sourceforge.net Sat Mar 13 13:18:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 13:28:57 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5879/Lib/test Modified Files: test_array.py Log Message: SF bug #910986: copy.copy fails for array.array Added support for the copy module. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_array.py 3 Aug 2003 23:30:40 -0000 1.26 --- test_array.py 13 Mar 2004 18:18:51 -0000 1.27 *************** *** 74,77 **** --- 74,84 ---- self.assertEqual(a, b) + def test_copy(self): + import copy + a = array.array(self.typecode, self.example) + b = copy.copy(a) + self.assertNotEqual(id(a), id(b)) + self.assertEqual(a, b) + def test_insert(self): a = array.array(self.typecode, self.example) From rhettinger at users.sourceforge.net Sat Mar 13 15:27:26 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 15:37:08 2004 Subject: [Python-checkins] python/dist/src/Lib robotparser.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30511/Lib Modified Files: robotparser.py Log Message: SF patch #911431: robot.txt must be robots.txt (Contributed by George Yoshida.) Index: robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** robotparser.py 27 Feb 2003 20:14:40 -0000 1.17 --- robotparser.py 13 Mar 2004 20:27:22 -0000 1.18 *************** *** 84,88 **** def parse(self, lines): ! """parse the input lines from a robot.txt file. We allow that a user-agent: line is not preceded by one or more blank lines.""" --- 84,88 ---- def parse(self, lines): ! """parse the input lines from a robots.txt file. We allow that a user-agent: line is not preceded by one or more blank lines.""" *************** *** 149,153 **** def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" ! _debug("Checking robot.txt allowance for:\n user agent: %s\n url: %s" % (useragent, url)) if self.disallow_all: --- 149,153 ---- def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" ! _debug("Checking robots.txt allowance for:\n user agent: %s\n url: %s" % (useragent, url)) if self.disallow_all: From rhettinger at users.sourceforge.net Sat Mar 13 15:27:26 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 15:37:10 2004 Subject: [Python-checkins] python/dist/src/Misc cheatsheet,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30511/Misc Modified Files: cheatsheet Log Message: SF patch #911431: robot.txt must be robots.txt (Contributed by George Yoshida.) Index: cheatsheet =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/cheatsheet,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cheatsheet 12 Jul 2003 23:55:57 -0000 1.7 --- cheatsheet 13 Mar 2004 20:27:23 -0000 1.8 *************** *** 1963,1967 **** rfc822 RFC-822 message manipulation class. rlcompleter Word completion for GNU readline 2.0. ! robotparser Parse robot.txt files, useful for web spiders. sched A generally useful event scheduler class. sets Module for a set datatype. --- 1963,1967 ---- rfc822 RFC-822 message manipulation class. rlcompleter Word completion for GNU readline 2.0. ! robotparser Parse robots.txt files, useful for web spiders. sched A generally useful event scheduler class. sets Module for a set datatype. From rhettinger at users.sourceforge.net Sat Mar 13 15:31:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 15:41:27 2004 Subject: [Python-checkins] python/dist/src/Lib robotparser.py, 1.17, 1.17.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240 Modified Files: Tag: release23-maint robotparser.py Log Message: SF patch #911431: robot.txt must be robots.txt (Contributed by George Yoshida.) Index: robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v retrieving revision 1.17 retrieving revision 1.17.10.1 diff -C2 -d -r1.17 -r1.17.10.1 *** robotparser.py 27 Feb 2003 20:14:40 -0000 1.17 --- robotparser.py 13 Mar 2004 20:31:33 -0000 1.17.10.1 *************** *** 84,88 **** def parse(self, lines): ! """parse the input lines from a robot.txt file. We allow that a user-agent: line is not preceded by one or more blank lines.""" --- 84,88 ---- def parse(self, lines): ! """parse the input lines from a robots.txt file. We allow that a user-agent: line is not preceded by one or more blank lines.""" *************** *** 149,153 **** def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" ! _debug("Checking robot.txt allowance for:\n user agent: %s\n url: %s" % (useragent, url)) if self.disallow_all: --- 149,153 ---- def can_fetch(self, useragent, url): """using the parsed robots.txt decide if useragent can fetch url""" ! _debug("Checking robots.txt allowance for:\n user agent: %s\n url: %s" % (useragent, url)) if self.disallow_all: From rhettinger at users.sourceforge.net Sat Mar 13 15:45:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 16:07:26 2004 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1124 Modified Files: pystate.h Log Message: SF patch #906501: Fix typos in pystate.h comments (Contributed by Greg Chapman.) Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** pystate.h 28 Jun 2003 21:53:52 -0000 2.25 --- pystate.h 13 Mar 2004 20:45:47 -0000 2.26 *************** *** 125,129 **** The return value is an opaque "handle" to the thread state when ! PyGILState_Acquire() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even though recursive calls are allowed, these handles can *not* be shared - --- 125,129 ---- The return value is an opaque "handle" to the thread state when ! PyGILState_Ensure() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even though recursive calls are allowed, these handles can *not* be shared - *************** *** 139,143 **** /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding ! PyGILState_Acquire call (but generally this state will be unknown to the caller, hence the use of the GILState API.) --- 139,143 ---- /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding ! PyGILState_Ensure() call (but generally this state will be unknown to the caller, hence the use of the GILState API.) From jackjansen at users.sourceforge.net Sat Mar 13 18:03:41 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat Mar 13 18:23:32 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23522 Modified Files: pimp.py Log Message: Force option should be applied to a single package, not recursively to its dependencies. Fixes #733819. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** pimp.py 11 Mar 2004 23:03:59 -0000 1.31 --- pimp.py 13 Mar 2004 23:03:38 -0000 1.32 *************** *** 922,926 **** for pkg, descr in prereqs: if pkg: ! self._prepareInstall(pkg, force, recursive) else: self._curmessages.append("Problem with dependency: %s" % descr) --- 922,926 ---- for pkg, descr in prereqs: if pkg: ! self._prepareInstall(pkg, False, recursive) else: self._curmessages.append("Problem with dependency: %s" % descr) From montanaro at users.sourceforge.net Sat Mar 13 18:11:47 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Mar 13 18:29:44 2004 Subject: [Python-checkins] python/dist/src/Include Python.h,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25351 Modified Files: Python.h Log Message: compile.h and eval.h weren't being included which kept a fair bit of the public API from being exposed by simply including Python.h (as recommended). Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** Python.h 10 Feb 2004 16:50:18 -0000 2.61 --- Python.h 13 Mar 2004 23:11:44 -0000 2.62 *************** *** 117,120 **** --- 117,123 ---- #include "abstract.h" + #include "compile.h" + #include "eval.h" + /* _Py_Mangle is defined in compile.c */ PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \ From jackjansen at users.sourceforge.net Sat Mar 13 18:32:49 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat Mar 13 18:41:34 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28953 Modified Files: pimp.py Log Message: Don't use "dict" as a variable, it shadows the builtin. Spotted by Bob Ippolito. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pimp.py 13 Mar 2004 23:03:38 -0000 1.32 --- pimp.py 13 Mar 2004 23:32:47 -0000 1.33 *************** *** 378,390 **** self._urllist.append(url) fp = urllib2.urlopen(url).fp ! dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc if included: ! version = dict.get('Version') if version and version > self._version: sys.stderr.write("Warning: included database %s is for pimp version %s\n" % (url, version)) else: ! self._version = dict.get('Version') if not self._version: sys.stderr.write("Warning: database has no Version information\n") --- 378,390 ---- self._urllist.append(url) fp = urllib2.urlopen(url).fp ! plistdata = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc if included: ! version = plistdata.get('Version') if version and version > self._version: sys.stderr.write("Warning: included database %s is for pimp version %s\n" % (url, version)) else: ! self._version = plistdata.get('Version') if not self._version: sys.stderr.write("Warning: database has no Version information\n") *************** *** 392,399 **** sys.stderr.write("Warning: database version %s newer than pimp version %s\n" % (self._version, PIMP_VERSION)) ! self._maintainer = dict.get('Maintainer', '') ! self._description = dict.get('Description', '').strip() ! self._appendPackages(dict['Packages']) ! others = dict.get('Include', []) for url in others: self.appendURL(url, included=1) --- 392,399 ---- sys.stderr.write("Warning: database version %s newer than pimp version %s\n" % (self._version, PIMP_VERSION)) ! self._maintainer = plistdata.get('Maintainer', '') ! self._description = plistdata.get('Description', '').strip() ! self._appendPackages(plistdata['Packages']) ! others = plistdata.get('Include', []) for url in others: self.appendURL(url, included=1) *************** *** 438,442 **** for pkg in self._packages: packages.append(pkg.dump()) ! dict = { 'Version': self._version, 'Maintainer': self._maintainer, --- 438,442 ---- for pkg in self._packages: packages.append(pkg.dump()) ! plistdata = { 'Version': self._version, 'Maintainer': self._maintainer, *************** *** 444,448 **** 'Packages': packages } ! plist = plistlib.Plist(**dict) plist.write(pathOrFile) --- 444,448 ---- 'Packages': packages } ! plist = plistlib.Plist(**plistdata) plist.write(pathOrFile) *************** *** 505,515 **** """Class representing a single package.""" ! def __init__(self, db, dict): self._db = db ! name = dict["Name"] ! for k in dict.keys(): if not k in ALLOWED_KEYS: sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k)) ! self._dict = dict def __getitem__(self, key): --- 505,515 ---- """Class representing a single package.""" ! def __init__(self, db, plistdata): self._db = db ! name = plistdata["Name"] ! for k in plistdata.keys(): if not k in ALLOWED_KEYS: sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k)) ! self._dict = plistdata def __getitem__(self, key): From jackjansen at users.sourceforge.net Sat Mar 13 18:50:50 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat Mar 13 19:01:22 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31669 Modified Files: pimp.py Log Message: Two issues spotted by Ronald OUssoren: - there were no accessor functions for the global per-database fields - packages and their dependencies were installed in order in stead of in reverse order. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** pimp.py 13 Mar 2004 23:32:47 -0000 1.33 --- pimp.py 13 Mar 2004 23:50:48 -0000 1.34 *************** *** 359,362 **** --- 359,363 ---- self._packages = [] self.preferences = prefs + self._url = "" self._urllist = [] self._version = "" *************** *** 364,367 **** --- 365,374 ---- self._description = "" + # Accessor functions + def url(self): return self._url + def version(self): return self._version + def maintainer(self): return self._maintainer + def description(self): return self._description + def close(self): """Clean up""" *************** *** 394,397 **** --- 401,405 ---- self._maintainer = plistdata.get('Maintainer', '') self._description = plistdata.get('Description', '').strip() + self._url = url self._appendPackages(plistdata['Packages']) others = plistdata.get('Include', []) *************** *** 901,905 **** for package in packages: if not package in self._todo: ! self._todo.insert(0, package) def _prepareInstall(self, package, force=0, recursive=1): --- 909,913 ---- for package in packages: if not package in self._todo: ! self._todo.append(package) def _prepareInstall(self, package, force=0, recursive=1): From jackjansen at users.sourceforge.net Sat Mar 13 18:50:51 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat Mar 13 19:01:24 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon LaunchServices.py, 1.2, 1.3 Qt.py, 1.1, 1.2 QuickTime.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31669/Carbon Modified Files: LaunchServices.py Qt.py QuickTime.py Log Message: Two issues spotted by Ronald OUssoren: - there were no accessor functions for the global per-database fields - packages and their dependencies were installed in order in stead of in reverse order. Index: LaunchServices.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/LaunchServices.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LaunchServices.py 5 Dec 2003 23:59:37 -0000 1.2 --- LaunchServices.py 13 Mar 2004 23:50:48 -0000 1.3 *************** *** 5,8 **** --- 5,10 ---- kLSRequestAllInfo = -1 kLSRolesAll = -1 + kLSUnknownType = FOUR_CHAR_CODE('\0\0\0\0') + kLSUnknownCreator = FOUR_CHAR_CODE('\0\0\0\0') kLSInvalidExtensionIndex = -1 kLSUnknownErr = -10810 *************** *** 50,55 **** # kLSRolesAll = (unsigned long)0xFFFFFFFF kLSUnknownKindID = 0 ! kLSUnknownType = 0 ! kLSUnknownCreator = 0 kLSAcceptDefault = 0x00000001 kLSAcceptAllowLoginUI = 0x00000002 --- 52,57 ---- # kLSRolesAll = (unsigned long)0xFFFFFFFF kLSUnknownKindID = 0 ! # kLSUnknownType = 0 ! # kLSUnknownCreator = 0 kLSAcceptDefault = 0x00000001 kLSAcceptAllowLoginUI = 0x00000002 Index: Qt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Qt.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Qt.py 30 Dec 2002 22:04:21 -0000 1.1 --- Qt.py 13 Mar 2004 23:50:48 -0000 1.2 *************** *** 1 **** --- 1,6 ---- from _Qt import * + try: + _ = AddFilePreview + except: + raise ImportError, "Old (2.3) _Qt.so module loaded in stead of new (2.4) _Qt.so" + \ No newline at end of file Index: QuickTime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/QuickTime.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuickTime.py 5 Dec 2003 23:59:37 -0000 1.2 --- QuickTime.py 13 Mar 2004 23:50:48 -0000 1.3 *************** *** 2,5 **** --- 2,24 ---- def FOUR_CHAR_CODE(x): return x + xmlIdentifierUnrecognized = -1 + kControllerMinimum = -0xf777 + notImplementedMusicOSErr = -2071 + cantSendToSynthesizerOSErr = -2072 + cantReceiveFromSynthesizerOSErr = -2073 + illegalVoiceAllocationOSErr = -2074 + illegalPartOSErr = -2075 [...2196 lines suppressed...] + kTuneGetTimeScaleSelect = 0x0007 + kTuneGetIndexedNoteChannelSelect = 0x0008 + kTuneQueueSelect = 0x000A + kTuneInstantSelect = 0x000B + kTuneGetStatusSelect = 0x000C + kTuneStopSelect = 0x000D + kTuneSetVolumeSelect = 0x0010 + kTuneGetVolumeSelect = 0x0011 + kTunePrerollSelect = 0x0012 + kTuneUnrollSelect = 0x0013 + kTuneSetNoteChannelsSelect = 0x0014 + kTuneSetPartTransposeSelect = 0x0015 + kTuneGetNoteAllocatorSelect = 0x0017 + kTuneSetSofterSelect = 0x0018 + kTuneTaskSelect = 0x0019 + kTuneSetBalanceSelect = 0x001A + kTuneSetSoundLocalizationSelect = 0x001B + kTuneSetHeaderWithSizeSelect = 0x001C + kTuneSetPartMixSelect = 0x001D + kTuneGetPartMixSelect = 0x001E From h0jpwqqm at samart.co.th Sat Mar 13 21:59:12 2004 From: h0jpwqqm at samart.co.th (Eliseo Greene) Date: Sat Mar 13 20:06:56 2004 Subject: [Python-checkins] Here is our next hot pick with 36 million in assets, 23 million in cash mef gmr Message-ID: Market Mover Stock Report's Last Pick (CWTD) exploded from $1.19 to $9.20, a gain of over 670% in 5 days (Feb 12 - 17)!!! Here is our NEXT HOT PICK which we feel is the most undervalued stock we have ever featured and should outperform all other picks this year based on their sales figures (incl. a backlog of over $100 Million), incredibly solid numbers, and low outstanding share total. Life Energy and Technology Holdings, Inc. (OTCBB: LETH) Current Price: 2.45 Near-Term Target: 7.00 Projected High for '04: 15.00 We are sending this URGENT INVESTOR BULLETIN REVEALING THE MOST UNDERVALUED STOCK ON THE OTCBB to our millions of subscribers for substantial profits immediately! Sales orders received by LETH exceed $150 Million over the past year while major news was just released that adds multi-millions to the bottom line. LETH has experienced a recent spike in price and volume indicating heavy accumulation of shares which is a sign of even bigger things to come for this emerging world leader in the conversion of waste materials into electrical energy, an industry with such high global demand that it is impossible to assign a value to the size of the market. (Mar 9 '04) Urgent News Update: LETH Announces the Sale of Two (2) Biosphere Process Systems to Procura International Limited for $14 Million with an Option for the Sale of an Additional 98 Systems Over the Next 24 Months. Solving a Dual Crisis - Waste and Energy: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. (Mar 3 '04) LETH Release Major Product Delivery and Net Profit News LETH delivered 12 Biosphere Process Systems which resulted in a net profit of $3.5 Million, the equivalent of .12 cents per share. LETH is scheduled to receive an additional $7 Million translating into an additional .24 cents per share which is the balance of this completed contract over the next 6 months. The net profit per share from just this single contract would value the stock above $6 by calculating the .36 cents per share total at an average industry PE of 18 - 22. Examining LETH - By The Numbers Total Assets: 36.8 Million = 1.26 per share of assets Cash: 23.4 Million = .80 cents per share of cash Shares Outstanding: 29 million (down from 31.8 million) after 2.8 million shares retired in Feb. '04 Additional Shares to be Retired: 1.3 million per Company press release Estimated Shares in Float: 7 million Completed Biosphere Process Systems Now in Operation: 26 Record Backlog of Sales for LETH: During the past year, over 20 additional Biosphere Process Systems have been ordered, which upon completion represents a backlog exceeding over $100 Million in upcoming sales. Many of these contractual agreements include options for the purchase of additional Biosphere Systems in the future once the initial order has been completed. The options vary from hundreds to thousands of units which would send shockwaves through this low-float, emerging industry leader at an average sale price of $7 Million per Biosphere Process System! LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near- term announcement. Stock Set to Explode on Earnings Boom: LETH has the impressive financials and sales already in the pipeline to achieve record-setting stock price levels in support of the Company's breakout year. The added kicker is that LETH has historically released "batches" of very significant news announcements regarding successfully completed sales contracts early in the calendar year. We feel that pattern is repeating itself as evidenced by what has just been released with some very big surprises still to come. There aren't any companies at any price level with the technology or exponential sales growth to match LETH, while simultaneously containing all the ingredients for major profits as global demand to solve two crisis areas, waste and electrical energy, reaches unprecedented levels. Required Market Mover Stock Report (MMSR) Information: MMSR cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of MMSR. MMSR recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. MMSR is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. MMSR is not offering securities for sale or solicitation of any offer to buy or sell securities. MMSR has received twelve thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. sxklcaggait dyrkkgkzvz irs h fojmlwnrcm a f gbdkknvl aptc ne a qx ufmgsixzoayt mbvgd From guido at python.org Sat Mar 13 23:20:33 2004 From: guido at python.org (Guido van Rossum) Date: Sat Mar 13 23:20:41 2004 Subject: [Python-checkins] python/dist/src/Include Python.h,2.61,2.62 In-Reply-To: Your message of "Sat, 13 Mar 2004 15:11:47 PST." References: Message-ID: <200403140420.i2E4KXC15780@guido.python.org> > compile.h and eval.h weren't being included which kept a fair bit of the > public API from being exposed by simply including Python.h (as recommended). This was actually intentional. But I agree it's questionable. --Guido van Rossum (home page: http://www.python.org/~guido/) From rhettinger at users.sourceforge.net Sat Mar 13 23:37:52 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 23:47:43 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.945,1.946 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8264/Misc Modified Files: NEWS Log Message: Update the array overallocation scheme to match the approach used for lists. Speeds append() operations and reduces memory requirements (because of more conservative overallocation). Paves the way for the feature request for array.extend() to support arbitrary iterable arguments. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.945 retrieving revision 1.946 diff -C2 -d -r1.945 -r1.946 *** NEWS 13 Mar 2004 18:18:50 -0000 1.945 --- NEWS 14 Mar 2004 04:37:49 -0000 1.946 *************** *** 181,185 **** ----------------- ! - array objects now support the copy module - cStringIO.writelines() now accepts any iterable argument and writes --- 181,187 ---- ----------------- ! - array objects now support the copy module. Also, their resizing ! scheme has been updated the same as for list objects. The improves ! performance for append() operations. - cStringIO.writelines() now accepts any iterable argument and writes From rhettinger at users.sourceforge.net Sat Mar 13 23:37:52 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 13 23:47:45 2004 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.93,2.94 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8264/Modules Modified Files: arraymodule.c Log Message: Update the array overallocation scheme to match the approach used for lists. Speeds append() operations and reduces memory requirements (because of more conservative overallocation). Paves the way for the feature request for array.extend() to support arbitrary iterable arguments. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -d -r2.93 -r2.94 *** arraymodule.c 13 Mar 2004 18:18:51 -0000 2.93 --- arraymodule.c 14 Mar 2004 04:37:50 -0000 2.94 *************** *** 14,63 **** #endif /* !STDC_HEADERS */ - /* Shamelessy stolen from listobject.c */ - static int - roundupsize(int n) - { - unsigned int nbits = 0; - unsigned int n2 = (unsigned int)n >> 5; - - /* Round up: - * If n < 256, to a multiple of 8. - * If n < 2048, to a multiple of 64. - * If n < 16384, to a multiple of 512. - * If n < 131072, to a multiple of 4096. - * If n < 1048576, to a multiple of 32768. - * If n < 8388608, to a multiple of 262144. - * If n < 67108864, to a multiple of 2097152. - * If n < 536870912, to a multiple of 16777216. - * ... - * If n < 2**(5+3*i), to a multiple of 2**(3*i). - * - * This over-allocates proportional to the list size, making room - * for additional growth. The over-allocation is mild, but is - * enough to give linear-time amortized behavior over a long - * sequence of appends() in the presence of a poorly-performing - * system realloc() (which is a reality, e.g., across all flavors - * of Windows, with Win9x behavior being particularly bad -- and - * we've still got address space fragmentation problems on Win9x - * even with this scheme, although it requires much longer lists to - * provoke them than it used to). - */ - do { - n2 >>= 3; - nbits += 3; - } while (n2); - return ((n >> nbits) + 1) << nbits; - } - - #define NRESIZE(var, type, nitems) \ - do { \ - size_t _new_size = roundupsize(nitems); \ - if (_new_size <= ((~(size_t)0) / sizeof(type))) \ - PyMem_RESIZE(var, type, _new_size); \ - else \ - var = NULL; \ - } while (0) - /* END SHAMELESSLY STOLEN CODE */ - struct arrayobject; /* Forward */ --- 14,17 ---- *************** *** 77,80 **** --- 31,35 ---- int ob_size; char *ob_item; + int allocated; struct arraydescr *ob_descr; } arrayobject; *************** *** 85,88 **** --- 40,91 ---- #define array_CheckExact(op) ((op)->ob_type == &Arraytype) + static int + array_resize(arrayobject *self, int newsize) + { + char *items; + size_t _new_size; + + /* Bypass realloc() when a previous overallocation is large enough + to accommodate the newsize. If the newsize is 16 smaller than the + current size, then proceed with the realloc() to shrink the list. + */ + + if (self->allocated >= newsize && + self->ob_size < newsize + 16 && + self->ob_item != NULL) { + self->ob_size = newsize; + return 0; + } + + /* This over-allocates proportional to the array size, making room + * for additional growth. The over-allocation is mild, but is + * enough to give linear-time amortized behavior over a long + * sequence of appends() in the presence of a poorly-performing + * system realloc(). + * The growth pattern is: 0, 4, 8, 16, 25, 34, 46, 56, 67, 79, ... + * Note, the pattern starts out the same as for lists but then + * grows at a smaller rate so that larger arrays only overallocate + * by about 1/16th -- this is done because arrays are presumed to be more + * memory critical. + */ + + _new_size = (newsize >> 4) + (self->ob_size < 8 ? 3 : 7) + newsize; + items = self->ob_item; + /* XXX The following multiplication and division does not optimize away + like it does for lists since the size is not known at compile time */ + if (_new_size <= ((~(size_t)0) / self->ob_descr->itemsize)) + PyMem_RESIZE(items, char, (_new_size * self->ob_descr->itemsize)); + else + items = NULL; + if (items == NULL) { + PyErr_NoMemory(); + return -1; + } + self->ob_item = items; + self->ob_size = newsize; + self->allocated = _new_size; + return 0; + } + /**************************************************************************** Get and Set functions for each type. *************** *** 439,442 **** --- 442,446 ---- } op->ob_descr = descr; + op->allocated = size; return (PyObject *) op; } *************** *** 456,459 **** --- 460,464 ---- { char *items; + int n = self->ob_size; if (v == NULL) { PyErr_BadInternalCall(); *************** *** 462,483 **** if ((*self->ob_descr->setitem)(self, -1, v) < 0) return -1; ! items = self->ob_item; ! NRESIZE(items, char, (self->ob_size+1) * self->ob_descr->itemsize); ! if (items == NULL) { ! PyErr_NoMemory(); return -1; ! } if (where < 0) { ! where += self->ob_size; if (where < 0) where = 0; } ! if (where > self->ob_size) ! where = self->ob_size; ! memmove(items + (where+1)*self->ob_descr->itemsize, ! items + where*self->ob_descr->itemsize, ! (self->ob_size-where)*self->ob_descr->itemsize); ! self->ob_item = items; ! self->ob_size++; return (*self->ob_descr->setitem)(self, where, v); } --- 467,486 ---- if ((*self->ob_descr->setitem)(self, -1, v) < 0) return -1; ! ! if (array_resize(self, n+1) == -1) return -1; ! items = self->ob_item; if (where < 0) { ! where += n; if (where < 0) where = 0; } ! if (where > n) ! where = n; ! /* appends don't need to call memmove() */ ! if (where != n) ! memmove(items + (where+1)*self->ob_descr->itemsize, ! items + where*self->ob_descr->itemsize, ! (n-where)*self->ob_descr->itemsize); return (*self->ob_descr->setitem)(self, where, v); } *************** *** 729,732 **** --- 732,736 ---- /* Can't fail */ a->ob_item = item; + a->allocated = a->ob_size; } else if (d > 0) { /* Insert d items */ *************** *** 742,745 **** --- 746,750 ---- a->ob_item = item; a->ob_size += d; + a->allocated = a->ob_size; } if (n > 0) *************** *** 796,800 **** memcpy(self->ob_item + self->ob_size*self->ob_descr->itemsize, b->ob_item, b->ob_size*b->ob_descr->itemsize); ! self->ob_size = size; return 0; --- 801,806 ---- memcpy(self->ob_item + self->ob_size*self->ob_descr->itemsize, b->ob_item, b->ob_size*b->ob_descr->itemsize); ! self->ob_size = size; ! self->allocated = size; return 0; *************** *** 826,829 **** --- 832,836 ---- self->ob_item = NULL; self->ob_size = 0; + self->allocated = 0; } else { *************** *** 838,841 **** --- 845,849 ---- self->ob_item = items; self->ob_size *= n; + self->allocated = self->ob_size; } } *************** *** 1159,1162 **** --- 1167,1171 ---- self->ob_item = item; self->ob_size += n; + self->allocated = self->ob_size; nread = fread(item + (self->ob_size - n) * itemsize, itemsize, n, fp); *************** *** 1165,1168 **** --- 1174,1178 ---- PyMem_RESIZE(item, char, self->ob_size*itemsize); self->ob_item = item; + self->allocated = self->ob_size; PyErr_SetString(PyExc_EOFError, "not enough items in file"); *************** *** 1231,1234 **** --- 1241,1245 ---- self->ob_item = item; self->ob_size += n; + self->allocated = self->ob_size; for (i = 0; i < n; i++) { PyObject *v = PyList_GetItem(list, i); *************** *** 1239,1242 **** --- 1250,1254 ---- self->ob_size * itemsize); self->ob_item = item; + self->allocated = self->ob_size; return NULL; } *************** *** 1301,1304 **** --- 1313,1317 ---- self->ob_item = item; self->ob_size += n; + self->allocated = self->ob_size; memcpy(item + (self->ob_size - n) * itemsize, str, itemsize*n); *************** *** 1354,1357 **** --- 1367,1371 ---- self->ob_item = (char *) item; self->ob_size += n; + self->allocated = self->ob_size; memcpy(item + self->ob_size - n, ustr, n * sizeof(Py_UNICODE)); *************** *** 1612,1616 **** self->ob_size -= slicelength; self->ob_item = PyMem_REALLOC(self->ob_item, itemsize*self->ob_size); ! return 0; --- 1626,1630 ---- self->ob_size -= slicelength; self->ob_item = PyMem_REALLOC(self->ob_item, itemsize*self->ob_size); ! self->allocated = self->ob_size; return 0; *************** *** 1812,1815 **** --- 1826,1830 ---- self->ob_size = n / sizeof(Py_UNICODE); memcpy(item, PyUnicode_AS_DATA(initial), n); + self->allocated = self->ob_size; } #endif From rhettinger at users.sourceforge.net Sun Mar 14 00:44:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 00:52:49 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17368/Lib/test Modified Files: test_array.py Log Message: SF feature request #686323: Minor array module enhancements array.extend() now accepts iterable arguments implements as a series of appends. Besides being a user convenience and matching the behavior for lists, this the saves memory and cycles that would be used to create a temporary array object. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_array.py 13 Mar 2004 18:18:51 -0000 1.27 --- test_array.py 14 Mar 2004 05:43:58 -0000 1.28 *************** *** 593,596 **** --- 593,603 ---- self.assertRaises(TypeError, a.extend, b) + a = array.array(self.typecode, self.example) + a.extend(self.example[::-1]) + self.assertEqual( + a, + array.array(self.typecode, self.example+self.example[::-1]) + ) + def test_coveritertraverse(self): try: From rhettinger at users.sourceforge.net Sun Mar 14 00:44:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 00:52:52 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libarray.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17368/Doc/lib Modified Files: libarray.tex Log Message: SF feature request #686323: Minor array module enhancements array.extend() now accepts iterable arguments implements as a series of appends. Besides being a user convenience and matching the behavior for lists, this the saves memory and cycles that would be used to create a temporary array object. Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** libarray.tex 18 May 2003 03:15:09 -0000 1.36 --- libarray.tex 14 Mar 2004 05:43:58 -0000 1.37 *************** *** 105,112 **** \end{methoddesc} ! \begin{methoddesc}[array]{extend}{a} ! Append array items from \var{a} to the end of the array. The two ! arrays must have \emph{exactly} the same type code; if not, ! \exception{TypeError} will be raised. \end{methoddesc} --- 105,115 ---- \end{methoddesc} ! \begin{methoddesc}[array]{extend}{iterable} ! Append items from \var{iterable} to the end of the array. If ! \var{iterable} is another array, it must have \emph{exactly} the same ! type code; if not, \exception{TypeError} will be raised. If ! \var{iterable} is not an array, it must be iterable and its ! elements must be the right type to be appended to the array. ! \versionchanged[Formerly, the argument could only be another array]{2.4} \end{methoddesc} From rhettinger at users.sourceforge.net Sun Mar 14 00:44:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 00:52:54 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.946,1.947 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17368/Misc Modified Files: NEWS Log Message: SF feature request #686323: Minor array module enhancements array.extend() now accepts iterable arguments implements as a series of appends. Besides being a user convenience and matching the behavior for lists, this the saves memory and cycles that would be used to create a temporary array object. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.946 retrieving revision 1.947 diff -C2 -d -r1.946 -r1.947 *** NEWS 14 Mar 2004 04:37:49 -0000 1.946 --- NEWS 14 Mar 2004 05:43:58 -0000 1.947 *************** *** 183,187 **** - array objects now support the copy module. Also, their resizing scheme has been updated the same as for list objects. The improves ! performance for append() operations. - cStringIO.writelines() now accepts any iterable argument and writes --- 183,189 ---- - array objects now support the copy module. Also, their resizing scheme has been updated the same as for list objects. The improves ! the performance (speed and memory usage) of append() operations. ! Also, array.extend() now accepts any iterable argument for repeated ! appends without needing to create another temporary array. - cStringIO.writelines() now accepts any iterable argument and writes From rhettinger at users.sourceforge.net Sun Mar 14 00:44:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 00:52:58 2004 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.94,2.95 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17368/Modules Modified Files: arraymodule.c Log Message: SF feature request #686323: Minor array module enhancements array.extend() now accepts iterable arguments implements as a series of appends. Besides being a user convenience and matching the behavior for lists, this the saves memory and cycles that would be used to create a temporary array object. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.94 retrieving revision 2.95 diff -C2 -d -r2.94 -r2.95 *** arraymodule.c 14 Mar 2004 04:37:50 -0000 2.94 --- arraymodule.c 14 Mar 2004 05:43:59 -0000 2.95 *************** *** 776,789 **** static int ! array_do_extend(arrayobject *self, PyObject *bb) { ! int size; ! if (!array_Check(bb)) { ! PyErr_Format(PyExc_TypeError, ! "can only extend array with array (not \"%.200s\")", ! bb->ob_type->tp_name); return -1; } #define b ((arrayobject *)bb) if (self->ob_descr != b->ob_descr) { --- 776,808 ---- static int ! array_iter_extend(arrayobject *self, PyObject *bb) { ! PyObject *it, *v; ! it = PyObject_GetIter(bb); ! if (it == NULL) return -1; + + while ((v = PyIter_Next(it)) != NULL) { + if (ins1(self, (int) self->ob_size, v) != 0) { + Py_DECREF(v); + Py_DECREF(it); + return -1; + } + Py_DECREF(v); } + Py_DECREF(it); + if (PyErr_Occurred()) + return -1; + return 0; + } + + static int + array_do_extend(arrayobject *self, PyObject *bb) + { + int size; + + if (!array_Check(bb)) + return array_iter_extend(self, bb); #define b ((arrayobject *)bb) if (self->ob_descr != b->ob_descr) { *************** *** 811,814 **** --- 830,839 ---- array_inplace_concat(arrayobject *self, PyObject *bb) { + if (!array_Check(bb)) { + PyErr_Format(PyExc_TypeError, + "can only extend array with array (not \"%.200s\")", + bb->ob_type->tp_name); + return NULL; + } if (array_do_extend(self, bb) == -1) return NULL; *************** *** 991,997 **** PyDoc_STRVAR(extend_doc, ! "extend(array)\n\ \n\ ! Append array items to the end of the array."); static PyObject * --- 1016,1022 ---- PyDoc_STRVAR(extend_doc, ! "extend(array or iterable)\n\ \n\ ! Append items to the end of the array."); static PyObject * *************** *** 1882,1886 **** byteswap() -- byteswap all the items of the array\n\ count() -- return number of occurences of an object\n\ ! extend() -- extend array by appending array elements\n\ fromfile() -- read items from a file object\n\ fromlist() -- append items from the list\n\ --- 1907,1911 ---- byteswap() -- byteswap all the items of the array\n\ count() -- return number of occurences of an object\n\ ! extend() -- extend array by appending multiple elements from an iterable\n\ fromfile() -- read items from a file object\n\ fromlist() -- append items from the list\n\ From rhettinger at users.sourceforge.net Sun Mar 14 01:42:26 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 01:51:14 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.196,2.197 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24604/Objects Modified Files: listobject.c Log Message: list_resize() now has an "exact" option for bypassing the overallocation scheme in situations that likely won't benefit from it. This further improves memory utilization from Py2.3 which always over-allocates except for PyList_New(). Situations expected to benefit from over-allocation: list.insert(), list.pop(), list.append(), and list.extend() Situations deemed unlikely to benefit: list_inplace_repeat, list_ass_slice, list_ass_subscript The most gray area was for listextend_internal() which only runs when the argument is a list or a tuple. This could be viewed as a one-time fixed length addition or it could be viewed as wrapping a series of appends. I left its over-allocation turned on but could be convinced otherwise. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.196 retrieving revision 2.197 diff -C2 -d -r2.196 -r2.197 *** listobject.c 12 Mar 2004 16:38:17 -0000 2.196 --- listobject.c 14 Mar 2004 06:42:23 -0000 2.197 *************** *** 10,14 **** static int ! list_resize(PyListObject *self, int newsize) { PyObject **items; --- 10,14 ---- static int ! list_resize(PyListObject *self, int newsize, int exact) { PyObject **items; *************** *** 34,38 **** * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... */ ! _new_size = (newsize >> 3) + (self->ob_size < 8 ? 3 : 6) + newsize; items = self->ob_item; if (_new_size <= ((~(size_t)0) / sizeof(PyObject *))) --- 34,41 ---- * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... */ ! if (exact) ! _new_size = newsize; ! else ! _new_size = (newsize>>3) + (self->ob_size < 8 ? 3 : 6) + newsize; items = self->ob_item; if (_new_size <= ((~(size_t)0) / sizeof(PyObject *))) *************** *** 153,157 **** } ! if (list_resize(self, n+1) == -1) return -1; --- 156,160 ---- } ! if (list_resize(self, n+1, 0) == -1) return -1; *************** *** 519,523 **** memmove(&item[ihigh+d], &item[ihigh], (a->ob_size - ihigh)*sizeof(PyObject *)); ! list_resize(a, a->ob_size + d); item = a->ob_item; } --- 522,526 ---- memmove(&item[ihigh+d], &item[ihigh], (a->ob_size - ihigh)*sizeof(PyObject *)); ! list_resize(a, a->ob_size + d, 1); item = a->ob_item; } *************** *** 525,529 **** else { /* Insert d items; recycle ihigh-ilow items */ s = a->ob_size; ! if (list_resize(a, s+d) == -1) { if (recycle != NULL) PyMem_DEL(recycle); --- 528,532 ---- else { /* Insert d items; recycle ihigh-ilow items */ s = a->ob_size; ! if (list_resize(a, s+d, 1) == -1) { if (recycle != NULL) PyMem_DEL(recycle); *************** *** 589,593 **** } ! if (list_resize(self, size*n) == -1) return NULL; --- 592,596 ---- } ! if (list_resize(self, size*n, 1) == -1) return NULL; *************** *** 681,685 **** } ! if (list_resize(self, selflen + blen) == -1) { Py_DECREF(b); return -1; --- 684,688 ---- } ! if (list_resize(self, selflen + blen, 0) == -1) { Py_DECREF(b); return -1; *************** *** 734,738 **** m = self->ob_size; mn = m + n; ! if (list_resize(self, mn) == -1) goto error; memset(&(self->ob_item[m]), 0, sizeof(*self->ob_item) * n); --- 737,741 ---- m = self->ob_size; mn = m + n; ! if (list_resize(self, mn, 0) == -1) goto error; memset(&(self->ob_item[m]), 0, sizeof(*self->ob_item) * n); *************** *** 819,823 **** v = self->ob_item[i]; if (i == self->ob_size - 1) { ! if (list_resize(self, self->ob_size - 1) == -1) return NULL; return v; --- 822,826 ---- v = self->ob_item[i]; if (i == self->ob_size - 1) { ! if (list_resize(self, self->ob_size - 1, 0) == -1) return NULL; return v; *************** *** 2518,2522 **** self->ob_size -= slicelength; ! list_resize(self, self->ob_size); for (i = 0; i < slicelength; i++) { --- 2521,2525 ---- self->ob_size -= slicelength; ! list_resize(self, self->ob_size, 1); for (i = 0; i < slicelength; i++) { From rhettinger at users.sourceforge.net Sun Mar 14 02:54:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 03:03:29 2004 Subject: [Python-checkins] python/dist/src/Lib StringIO.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3535 Modified Files: StringIO.py Log Message: Add missing docstrings. Index: StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** StringIO.py 8 Mar 2004 18:17:31 -0000 1.34 --- StringIO.py 14 Mar 2004 07:54:37 -0000 1.35 *************** *** 67,70 **** --- 67,76 ---- def next(self): + """A file object is its own iterator, for example iter(f) returns f + (unless f is closed). When a file is used as an iterator, typically + in a for loop (for example, for line in f: print line), the next() + method is called repeatedly. This method returns the next input line, + or raises StopIteration when EOF is hit. + """ if self.closed: raise StopIteration *************** *** 82,89 **** --- 88,106 ---- def isatty(self): + """Returns False because StringIO objects are not connected to a + tty-like device. + """ _complain_ifclosed(self.closed) return False def seek(self, pos, mode = 0): + """Set the file's current position. + + The mode argument is optional and defaults to 0 (absolute file + positioning); other values are 1 (seek relative to the current + position) and 2 (seek relative to the file's end). + + There is no return value. + """ _complain_ifclosed(self.closed) if self.buflist: *************** *** 97,104 **** --- 114,129 ---- def tell(self): + """Return the file's current position.""" _complain_ifclosed(self.closed) return self.pos def read(self, n = -1): + """Read at most size bytes from the file + (less if the read hits EOF before obtaining size bytes). + + If the size argument is negative or omitted, read all data until EOF + is reached. The bytes are returned as a string object. An empty + string is returned when EOF is encountered immediately. + """ _complain_ifclosed(self.closed) if self.buflist: *************** *** 114,117 **** --- 139,154 ---- def readline(self, length=None): + """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). If the size argument is + present and non-negative, it is a maximum byte count (including the + trailing newline) and an incomplete line may be returned. + + An empty string is returned only when EOF is encountered immediately. + + Note: Unlike stdio's fgets(), the returned string contains null + characters ('\0') if they occurred in the input. + """ _complain_ifclosed(self.closed) if self.buflist: *************** *** 131,134 **** --- 168,178 ---- def readlines(self, sizehint = 0): + """Read until EOF using readline() and return a list containing the + lines thus read. + + If the optional sizehint argument is present, instead of reading up + to EOF, whole lines totalling approximately sizehint bytes (or more + to accommodate a final whole line). + """ total = 0 lines = [] *************** *** 143,146 **** --- 187,200 ---- def truncate(self, size=None): + """Truncate the file's size. + + If the optional size argument is present, the file is truncated to + (at most) that size. The size defaults to the current position. + The current file position is not changed unless the position + is beyond the new file size. + + If the specified size exceeds the file's current size, the + file remains unchanged. + """ _complain_ifclosed(self.closed) if size is None: *************** *** 153,156 **** --- 207,214 ---- def write(self, s): + """Write a string to the file. + + There is no return value. + """ _complain_ifclosed(self.closed) if not s: return *************** *** 180,183 **** --- 238,248 ---- def writelines(self, iterable): + """Write a sequence of strings to the file. The sequence can be any + iterable object producing strings, typically a list of strings. There + is no return value. + + (The name is intended to match readlines(); writelines() does not add + line separators.) + """ write = self.write for line in iterable: *************** *** 185,188 **** --- 250,255 ---- def flush(self): + """Flush the internal buffer + """ _complain_ifclosed(self.closed) From rhettinger at users.sourceforge.net Sun Mar 14 19:16:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 14 21:37:06 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.84,2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28092 Modified Files: tupleobject.c Log Message: Eliminate an unnecessary test on a common code path. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -d -r2.84 -r2.85 *** tupleobject.c 9 Mar 2004 13:05:22 -0000 2.84 --- tupleobject.c 15 Mar 2004 00:16:34 -0000 2.85 *************** *** 41,47 **** return (PyObject *) op; } ! if (0 < size && size < MAXSAVESIZE && ! (op = free_tuples[size]) != NULL) ! { free_tuples[size] = (PyTupleObject *) op->ob_item[0]; num_free_tuples[size]--; --- 41,45 ---- return (PyObject *) op; } ! if (size < MAXSAVESIZE && (op = free_tuples[size]) != NULL) { free_tuples[size] = (PyTupleObject *) op->ob_item[0]; num_free_tuples[size]--; From kbk at users.sourceforge.net Sun Mar 14 23:26:55 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Sun Mar 14 23:35:52 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib ColorDelegator.py, 1.13, 1.14 NEWS.txt, 1.31, 1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6358 Modified Files: ColorDelegator.py NEWS.txt Log Message: 1. Bug in Patch 805830 fixed by Nigel Rowe 2. Convert 1/0 to True/False 3. Fix a couple of long lines M ColorDelegator.py M NEWS.txt Index: ColorDelegator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ColorDelegator.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ColorDelegator.py 8 Mar 2004 18:15:30 -0000 1.13 --- ColorDelegator.py 15 Mar 2004 04:26:37 -0000 1.14 *************** *** 7,16 **** from configHandler import idleConf ! #$ event <> ! #$ win ! #$ unix ! ! DEBUG = 0 ! def any(name, list): --- 7,11 ---- from configHandler import idleConf ! DEBUG = False def any(name, list): *************** *** 21,25 **** builtinlist = [str(name) for name in dir(__builtin__) if not name.startswith('_')] ! builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" --- 16,22 ---- builtinlist = [str(name) for name in dir(__builtin__) if not name.startswith('_')] ! # self.file = file("file") : ! # 1st 'file' colorized normal, 2nd as builtin, 3rd as comment ! builtin = r"([^.'\"\\]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" *************** *** 28,32 **** dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) ! return kw + "|" + builtin + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"]) prog = re.compile(make_pat(), re.S) --- 25,30 ---- dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) ! return kw + "|" + builtin + "|" + comment + "|" + string +\ ! "|" + any("SYNC", [r"\n"]) prog = re.compile(make_pat(), re.S) *************** *** 87,92 **** after_id = None ! allow_colorizing = 1 ! colorizing = 0 def notify_range(self, index1, index2=None): --- 85,90 ---- after_id = None ! allow_colorizing = True ! colorizing = False def notify_range(self, index1, index2=None): *************** *** 96,100 **** return if self.colorizing: ! self.stop_colorizing = 1 if DEBUG: print "stop colorizing" if self.allow_colorizing: --- 94,98 ---- return if self.colorizing: ! self.stop_colorizing = True if DEBUG: print "stop colorizing" if self.allow_colorizing: *************** *** 110,115 **** if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) ! self.allow_colorizing = 0 ! self.stop_colorizing = 1 if close_when_done: if not self.colorizing: --- 108,113 ---- if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) ! self.allow_colorizing = False ! self.stop_colorizing = True if close_when_done: if not self.colorizing: *************** *** 126,135 **** if self.allow_colorizing and self.colorizing: if DEBUG: print "stop colorizing" ! self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if DEBUG: ! print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break" --- 124,134 ---- if self.allow_colorizing and self.colorizing: if DEBUG: print "stop colorizing" ! self.stop_colorizing = True self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if DEBUG: ! print "auto colorizing turned",\ ! self.allow_colorizing and "on" or "off" return "break" *************** *** 146,151 **** return try: ! self.stop_colorizing = 0 ! self.colorizing = 1 if DEBUG: print "colorizing..." t0 = time.clock() --- 145,150 ---- return try: ! self.stop_colorizing = False ! self.colorizing = True if DEBUG: print "colorizing..." t0 = time.clock() *************** *** 154,158 **** if DEBUG: print "%.3f seconds" % (t1-t0) finally: ! self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if DEBUG: print "reschedule colorizing" --- 153,157 ---- if DEBUG: print "%.3f seconds" % (t1-t0) finally: ! self.colorizing = False if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if DEBUG: print "reschedule colorizing" *************** *** 165,169 **** def recolorize_main(self): next = "1.0" ! while 1: item = self.tag_nextrange("TODO", next) if not item: --- 164,168 ---- def recolorize_main(self): next = "1.0" ! while True: item = self.tag_nextrange("TODO", next) if not item: *************** *** 180,184 **** next = head lines_to_get = 1 ! ok = 0 while not ok: mark = next --- 179,183 ---- next = head lines_to_get = 1 ! ok = False while not ok: mark = next *************** *** 212,216 **** # color all the "as" words on same line; # cheap approximation to the truth ! while 1: m1 = self.asprog.match(chars, b) if not m1: --- 211,215 ---- # color all the "as" words on same line; # cheap approximation to the truth ! while True: m1 = self.asprog.match(chars, b) if not m1: *************** *** 225,229 **** chars = "" else: ! ok = 0 if not ok: # We're in an inconsistent state, and the call to --- 224,228 ---- chars = "" else: ! ok = False if not ok: # We're in an inconsistent state, and the call to Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** NEWS.txt 8 Mar 2004 18:15:30 -0000 1.31 --- NEWS.txt 15 Mar 2004 04:26:37 -0000 1.32 *************** *** 4,8 **** --- 4,13 ---- *Release date: XX-XXX-2004* + - If the normal background is changed via Configure/Highlighting, it will update + immediately, thanks to the previously mentioned patch. + - Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe + This also fixed IDLEfork bug [ 693418 ] Normal text background color not refreshed + and Python bug [897872 ] Unknown color name on HP-UX - rpc.py:SocketIO - Large modules were generating large pickles when downloaded From fhfi015fo at isl.melco.co.jp Mon Mar 15 08:19:41 2004 From: fhfi015fo at isl.melco.co.jp (Timothy Hobson) Date: Mon Mar 15 02:27:56 2004 Subject: [Python-checkins] Hot otc flyer with 100 million sales backlog kg q fvqylpr Message-ID: <91543xz$n-v58c-71-ph4@hagms95pi> Market News Alerts - Stock Pick of the Year Life Energy and Technology Holdings, Inc. (OTCBB: LETH) LETH has been burning up the charts over the last 3 weeks and is looking more and more like one of those rare situations where the value of the Company is forcing its way into the stock price. We are seeing continuous big-block buying from investors on a worldwide scope with average daily trading volume up 10-fold (1,000%) over this recent period. While investors around the globe have LETH on their radar, they are also seeing the Company achieve record-breaking numbers with regard to sales, profits, and delivery of their Biosphere Process System in more countries than ever before. LETH Financial Summary: Current Price: 2.50 Sales Orders Received '03: over $100 Million +300% growth vs. '02 Estimated Sales Orders '04: over $180 Million Total Assets: $36.8 Million ($1.26 per share of assets) Cash: $23.4 Million ($ .80 per share of cash) Shares Outstanding: 29 million (down from 31.8 million) after 2.8 million shares retired in Feb. '04 Additional Shares to be Retired: 1.3 million per Company press release Estimated Shares in Float: 7 million Completed Biosphere Process Systems Now in Operation: 26 60-Day Price Target: 7.00 - 8.00 6-Month Price Target: 12.00 - 15.00 The Biosphere Process System - Soaring Worldwide Demand: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. The Biosphere Process succeeds in filling an urgent worldwide need for cost-effective renewable energy sources and a corresponding universal need to solve critical problems in the disposal of waste. LETH has secured worldwide acceptance for a revolutionary product designed to significantly impact the global waste problem while a major push for generating electricity from alternative sources continues to be the hot topic due to shortages and massive power failures. Record Backlog of Sales for LETH: During the past year, over 20 Biosphere Process Systems have been ordered, which upon completion represents a backlog exceeding over $100 Million in upcoming sales. Many of these contractual agreements include options for the purchase of additional Biosphere Systems in the future once the initial order has been completed. The options vary from hundreds to thousands of units per contract which would send shockwaves through this low-float, emerging industry leader at an average sale price of $7 Million per Biosphere Process System! Major Headlines and Highlights: March 11, '04 - LETH retains Murdock Capital Partners, a 12 year-old, New York-based Corporate Communications firm to manage the Company's Investor Relations Program. LETH President and CEO, Dr. Chris McCormack, stated that a program which effectively communicates with investors is of significant value as LETH will be establishing a major US presence with the upcoming installation of the first Biosphere Process System at the Port of New Orleans early in the second quarter of 2004. March 9, '04 - LETH Announces the Sale of Two (2) Biosphere Process Systems to Procura International Limited for $14 Million with an Option for the Sale of an Additional 98 Systems Over the Next 24 Months. March 3, '04 - LETH Releases Major Product Delivery and Net Profit News LETH delivered 12 Biosphere Process Systems which resulted in a net profit of $3.5 Million, the equivalent of .12 cents per share. LETH is scheduled to receive an additional $7 Million translating into an additional .24 cents per share which is the balance of this completed contract over the next 6 months. The net profit per share from just this single contract would value the stock above $6 by calculating the .36 cents per share total at an average industry PE of 18 - 22. Feb. 27, '04 - LETH Enters Agreement to bring Biosphere Process System into Russia's Third Largest City for Waste Recycling and Conversion into Energy Production. Feb. 13, '04: LETH Reports the Retirement of 2.8 Million Shares and Intends to Retire an Additional 1.3 Million for a Total of 4.1 Million. Jan. 23, '04: LETH 10Q Reports Assets at $36.8 Million vs. $16.8 Million; Cash at $23.4 Million vs. Deficit. LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $20) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near- term announcement. Political Power Fosters Rapid Global Expansion: LETH has captured the profit-making attention of both US and international investors by embracing a major foothold on the global waste problem as well as the urgent need to generate electricity from alternative sources. This has been accomplished by successfully creating major inroads to all corners of the globe through the political contacts at the highest level from Dr. Albert Reynolds, Chairman of LETH, who is also the former Prime Minister of Ireland. Dr. Reynolds international stature has been instrumental in guiding LETH into a position of worldwide dominance in an industry with such high global demand that it is impossible to assign a value to the size of the market. Uncommon Value for a Company of this Caliber: We are witnessing a breakout year in the making judging by the frequency of recently announced sales contracts for the Biosphere, the impressive backlog of over $100 Million in sales orders, and the Company's very solid financial position. We view this perfectly timed convergence of events as the catalyst for additional contracts that will perpetuate the shattering of the Company's own sales records. As our Stock Pick of the Year, we anticipate the continuation of strong positive developments that will ignite LETH shares which carry our highest rating for short-term trading profits followed by robust long-term capital gains. Market News Alerts (MNA) cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of MNA. MNA recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. MNA is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. MNA is not offering securities for sale or solicitation of any offer to buy or sell securities. MNA has received twenty thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. pa czl jogoimiv lvvh whq ig dlddgaczv From rhettinger at users.sourceforge.net Mon Mar 15 04:01:34 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 15 04:10:37 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.197,2.198 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18287 Modified Files: listobject.c Log Message: Revert last change. Found an application that was worse off with resize exact turned on. The tiny space savings wasn't worth the additional time and code. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.197 retrieving revision 2.198 diff -C2 -d -r2.197 -r2.198 *** listobject.c 14 Mar 2004 06:42:23 -0000 2.197 --- listobject.c 15 Mar 2004 09:01:31 -0000 2.198 *************** *** 10,14 **** static int ! list_resize(PyListObject *self, int newsize, int exact) { PyObject **items; --- 10,14 ---- static int ! list_resize(PyListObject *self, int newsize) { PyObject **items; *************** *** 34,41 **** * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... */ ! if (exact) ! _new_size = newsize; ! else ! _new_size = (newsize>>3) + (self->ob_size < 8 ? 3 : 6) + newsize; items = self->ob_item; if (_new_size <= ((~(size_t)0) / sizeof(PyObject *))) --- 34,38 ---- * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... */ ! _new_size = (newsize >> 3) + (self->ob_size < 8 ? 3 : 6) + newsize; items = self->ob_item; if (_new_size <= ((~(size_t)0) / sizeof(PyObject *))) *************** *** 156,160 **** } ! if (list_resize(self, n+1, 0) == -1) return -1; --- 153,157 ---- } ! if (list_resize(self, n+1) == -1) return -1; *************** *** 522,526 **** memmove(&item[ihigh+d], &item[ihigh], (a->ob_size - ihigh)*sizeof(PyObject *)); ! list_resize(a, a->ob_size + d, 1); item = a->ob_item; } --- 519,523 ---- memmove(&item[ihigh+d], &item[ihigh], (a->ob_size - ihigh)*sizeof(PyObject *)); ! list_resize(a, a->ob_size + d); item = a->ob_item; } *************** *** 528,532 **** else { /* Insert d items; recycle ihigh-ilow items */ s = a->ob_size; ! if (list_resize(a, s+d, 1) == -1) { if (recycle != NULL) PyMem_DEL(recycle); --- 525,529 ---- else { /* Insert d items; recycle ihigh-ilow items */ s = a->ob_size; ! if (list_resize(a, s+d) == -1) { if (recycle != NULL) PyMem_DEL(recycle); *************** *** 592,596 **** } ! if (list_resize(self, size*n, 1) == -1) return NULL; --- 589,593 ---- } ! if (list_resize(self, size*n) == -1) return NULL; *************** *** 684,688 **** } ! if (list_resize(self, selflen + blen, 0) == -1) { Py_DECREF(b); return -1; --- 681,685 ---- } ! if (list_resize(self, selflen + blen) == -1) { Py_DECREF(b); return -1; *************** *** 737,741 **** m = self->ob_size; mn = m + n; ! if (list_resize(self, mn, 0) == -1) goto error; memset(&(self->ob_item[m]), 0, sizeof(*self->ob_item) * n); --- 734,738 ---- m = self->ob_size; mn = m + n; ! if (list_resize(self, mn) == -1) goto error; memset(&(self->ob_item[m]), 0, sizeof(*self->ob_item) * n); *************** *** 822,826 **** v = self->ob_item[i]; if (i == self->ob_size - 1) { ! if (list_resize(self, self->ob_size - 1, 0) == -1) return NULL; return v; --- 819,823 ---- v = self->ob_item[i]; if (i == self->ob_size - 1) { ! if (list_resize(self, self->ob_size - 1) == -1) return NULL; return v; *************** *** 2521,2525 **** self->ob_size -= slicelength; ! list_resize(self, self->ob_size, 1); for (i = 0; i < slicelength; i++) { --- 2518,2522 ---- self->ob_size -= slicelength; ! list_resize(self, self->ob_size); for (i = 0; i < slicelength; i++) { From doerwalter at users.sourceforge.net Mon Mar 15 07:07:40 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Mar 15 07:16:41 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_binascii, 1.2, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18669/Lib/test/output Removed Files: test_binascii Log Message: Port test_binascii.py to PyUnit and enhance tests. Code coverage for binascii.c is at 92%. >From SF patch #736962. --- test_binascii DELETED --- From doerwalter at users.sourceforge.net Mon Mar 15 07:07:40 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Mar 15 07:16:45 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_binascii.py, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18669/Lib/test Modified Files: test_binascii.py Log Message: Port test_binascii.py to PyUnit and enhance tests. Code coverage for binascii.c is at 92%. >From SF patch #736962. Index: test_binascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_binascii.py 17 Mar 2003 11:24:29 -0000 1.16 --- test_binascii.py 15 Mar 2004 12:07:38 -0000 1.17 *************** *** 1,129 **** """Test the binascii C module.""" ! from test.test_support import verify, verbose, have_unicode import binascii ! # Show module doc string ! print binascii.__doc__ ! # Show module exceptions ! print binascii.Error ! print binascii.Incomplete ! # Check presence and display doc strings of all functions ! funcs = [] ! for suffix in "base64", "hqx", "uu": ! prefixes = ["a2b_", "b2a_"] ! if suffix == "hqx": ! prefixes.extend(["crc_", "rlecode_", "rledecode_"]) ! for prefix in prefixes: ! name = prefix + suffix ! funcs.append(getattr(binascii, name)) ! for func in funcs: ! print "%-15s: %s" % (func.__name__, func.__doc__) ! # Create binary test data ! testdata = "The quick brown fox jumps over the lazy dog.\r\n" ! for i in range(256): ! # Be slow so we don't depend on other modules ! testdata = testdata + chr(i) ! testdata = testdata + "\r\nHello world.\n" ! # Test base64 with valid data ! print "base64 test" ! MAX_BASE64 = 57 ! lines = [] ! for i in range(0, len(testdata), MAX_BASE64): ! b = testdata[i:i+MAX_BASE64] ! a = binascii.b2a_base64(b) ! lines.append(a) ! print a, ! res = "" ! for line in lines: ! b = binascii.a2b_base64(line) ! res = res + b ! verify(res == testdata) ! # Test base64 with random invalid characters sprinkled throughout ! # (This requires a new version of binascii.) ! fillers = "" ! valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/" ! for i in range(256): ! c = chr(i) ! if c not in valid: ! fillers = fillers + c ! def addnoise(line): ! noise = fillers ! ratio = len(line) // len(noise) ! res = "" ! while line and noise: ! if len(line) // len(noise) > ratio: ! c, line = line[0], line[1:] ! else: ! c, noise = noise[0], noise[1:] ! res = res + c ! return res + noise + line ! res = "" ! for line in map(addnoise, lines): ! b = binascii.a2b_base64(line) ! res = res + b ! verify(res == testdata) ! # Test base64 with just invalid characters, which should return ! # empty strings. TBD: shouldn't it raise an exception instead ? ! verify(binascii.a2b_base64(fillers) == '') ! # Test uu ! print "uu test" ! MAX_UU = 45 ! lines = [] ! for i in range(0, len(testdata), MAX_UU): ! b = testdata[i:i+MAX_UU] ! a = binascii.b2a_uu(b) ! lines.append(a) ! print a, ! res = "" ! for line in lines: ! b = binascii.a2b_uu(line) ! res = res + b ! verify(res == testdata) ! # Test crc32() ! crc = binascii.crc32("Test the CRC-32 of") ! crc = binascii.crc32(" this string.", crc) ! if crc != 1571220330: ! print "binascii.crc32() failed." ! # The hqx test is in test_binhex.py ! # test hexlification ! s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' ! t = binascii.b2a_hex(s) ! u = binascii.a2b_hex(t) ! if s != u: ! print 'binascii hexlification failed' ! try: ! binascii.a2b_hex(t[:-1]) ! except TypeError: ! pass ! else: ! print 'expected TypeError not raised' ! try: ! binascii.a2b_hex(t[:-1] + 'q') ! except TypeError: ! pass ! else: ! print 'expected TypeError not raised' ! # Verify the treatment of Unicode strings ! if have_unicode: ! verify(binascii.hexlify(unicode('a', 'ascii')) == '61', ! "hexlify failed for Unicode") ! # A test for SF bug 534347 (segfaults without the proper fix) ! try: ! binascii.a2b_qp("", **{1:1}) ! except TypeError: ! pass ! else: ! raise TestFailed, "binascii..a2b_qp(**{1:1}) didn't raise TypeError" --- 1,155 ---- """Test the binascii C module.""" ! from test import test_support ! import unittest import binascii ! class BinASCIITest(unittest.TestCase): ! # Create binary test data ! data = "The quick brown fox jumps over the lazy dog.\r\n" ! # Be slow so we don't depend on other modules ! data += "".join(map(chr, xrange(256))) ! data += "\r\nHello world.\n" ! def test_exceptions(self): ! # Check module exceptions ! self.assert_(issubclass(binascii.Error, Exception)) ! self.assert_(issubclass(binascii.Incomplete, Exception)) ! def test_functions(self): ! # Check presence of all functions ! funcs = [] ! for suffix in "base64", "hqx", "uu", "hex": ! prefixes = ["a2b_", "b2a_"] ! if suffix == "hqx": ! prefixes.extend(["crc_", "rlecode_", "rledecode_"]) ! for prefix in prefixes: ! name = prefix + suffix ! self.assert_(callable(getattr(binascii, name))) ! self.assertRaises(TypeError, getattr(binascii, name)) ! for name in ("hexlify", "unhexlify"): ! self.assert_(callable(getattr(binascii, name))) ! self.assertRaises(TypeError, getattr(binascii, name)) ! def test_base64valid(self): ! # Test base64 with valid data ! MAX_BASE64 = 57 ! lines = [] ! for i in range(0, len(self.data), MAX_BASE64): ! b = self.data[i:i+MAX_BASE64] ! a = binascii.b2a_base64(b) ! lines.append(a) ! res = "" ! for line in lines: ! b = binascii.a2b_base64(line) ! res = res + b ! self.assertEqual(res, self.data) ! def test_base64invalid(self): ! # Test base64 with random invalid characters sprinkled throughout ! # (This requires a new version of binascii.) ! MAX_BASE64 = 57 ! lines = [] ! for i in range(0, len(self.data), MAX_BASE64): ! b = self.data[i:i+MAX_BASE64] ! a = binascii.b2a_base64(b) ! lines.append(a) ! fillers = "" ! valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/" ! for i in xrange(256): ! c = chr(i) ! if c not in valid: ! fillers += c ! def addnoise(line): ! noise = fillers ! ratio = len(line) // len(noise) ! res = "" ! while line and noise: ! if len(line) // len(noise) > ratio: ! c, line = line[0], line[1:] ! else: ! c, noise = noise[0], noise[1:] ! res += c ! return res + noise + line ! res = "" ! for line in map(addnoise, lines): ! b = binascii.a2b_base64(line) ! res += b ! self.assertEqual(res, self.data) ! # Test base64 with just invalid characters, which should return ! # empty strings. TBD: shouldn't it raise an exception instead ? ! self.assertEqual(binascii.a2b_base64(fillers), '') ! def test_uu(self): ! MAX_UU = 45 ! lines = [] ! for i in range(0, len(self.data), MAX_UU): ! b = self.data[i:i+MAX_UU] ! a = binascii.b2a_uu(b) ! lines.append(a) ! res = "" ! for line in lines: ! b = binascii.a2b_uu(line) ! res += b ! self.assertEqual(res, self.data) ! self.assertEqual(binascii.a2b_uu("\x7f"), "\x00"*31) ! self.assertEqual(binascii.a2b_uu("\x80"), "\x00"*32) ! self.assertEqual(binascii.a2b_uu("\xff"), "\x00"*31) ! self.assertRaises(binascii.Error, binascii.a2b_uu, "\xff\x00") ! self.assertRaises(binascii.Error, binascii.a2b_uu, "!!!!") ! ! self.assertRaises(binascii.Error, binascii.b2a_uu, 46*"!") ! def test_crc32(self): ! crc = binascii.crc32("Test the CRC-32 of") ! crc = binascii.crc32(" this string.", crc) ! self.assertEqual(crc, 1571220330) ! self.assertRaises(TypeError, binascii.crc32) ! # The hqx test is in test_binhex.py ! ! def test_hex(self): ! # test hexlification ! s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' ! t = binascii.b2a_hex(s) ! u = binascii.a2b_hex(t) ! self.assertEqual(s, u) ! self.assertRaises(TypeError, binascii.a2b_hex, t[:-1]) ! self.assertRaises(TypeError, binascii.a2b_hex, t[:-1] + 'q') ! ! # Verify the treatment of Unicode strings ! if test_support.have_unicode: ! self.assertEqual(binascii.hexlify(unicode('a', 'ascii')), '61') ! ! def test_qp(self): ! # A test for SF bug 534347 (segfaults without the proper fix) ! try: ! binascii.a2b_qp("", **{1:1}) ! except TypeError: ! pass ! else: ! self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") ! self.assertEqual(binascii.a2b_qp("= "), "") ! self.assertEqual(binascii.a2b_qp("=="), "=") ! self.assertEqual(binascii.a2b_qp("=AX"), "=AX") ! self.assertRaises(TypeError, binascii.b2a_qp, foo="bar") ! self.assertEqual(binascii.a2b_qp("=00\r\n=00"), "\x00\r\n\x00") ! self.assertEqual( ! binascii.b2a_qp("\xff\r\n\xff\n\xff"), ! "=FF\r\n=FF\r\n=FF" ! ) ! self.assertEqual( ! binascii.b2a_qp("0"*75+"\xff\r\n\xff\r\n\xff"), ! "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" ! ) ! ! def test_main(): ! test_support.run_unittest(BinASCIITest) ! ! if __name__ == "__main__": ! test_main() From doerwalter at users.sourceforge.net Mon Mar 15 09:22:57 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Mar 15 09:31:59 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_binascii, 1.2, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11154/Lib/test/output Removed Files: Tag: release23-maint test_binascii Log Message: Backport checkin: Port test_binascii.py to PyUnit and enhance tests. Code coverage for binascii.c is at 92%. >From SF patch #736962. --- test_binascii DELETED --- From doerwalter at users.sourceforge.net Mon Mar 15 09:22:57 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Mar 15 09:32:02 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_binascii.py, 1.16, 1.16.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11154/Lib/test Modified Files: Tag: release23-maint test_binascii.py Log Message: Backport checkin: Port test_binascii.py to PyUnit and enhance tests. Code coverage for binascii.c is at 92%. >From SF patch #736962. Index: test_binascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v retrieving revision 1.16 retrieving revision 1.16.12.1 diff -C2 -d -r1.16 -r1.16.12.1 *** test_binascii.py 17 Mar 2003 11:24:29 -0000 1.16 --- test_binascii.py 15 Mar 2004 14:22:55 -0000 1.16.12.1 *************** *** 1,129 **** """Test the binascii C module.""" ! from test.test_support import verify, verbose, have_unicode import binascii ! # Show module doc string ! print binascii.__doc__ ! # Show module exceptions ! print binascii.Error ! print binascii.Incomplete ! # Check presence and display doc strings of all functions ! funcs = [] ! for suffix in "base64", "hqx", "uu": ! prefixes = ["a2b_", "b2a_"] ! if suffix == "hqx": ! prefixes.extend(["crc_", "rlecode_", "rledecode_"]) ! for prefix in prefixes: ! name = prefix + suffix ! funcs.append(getattr(binascii, name)) ! for func in funcs: ! print "%-15s: %s" % (func.__name__, func.__doc__) ! # Create binary test data ! testdata = "The quick brown fox jumps over the lazy dog.\r\n" ! for i in range(256): ! # Be slow so we don't depend on other modules ! testdata = testdata + chr(i) ! testdata = testdata + "\r\nHello world.\n" ! # Test base64 with valid data ! print "base64 test" ! MAX_BASE64 = 57 ! lines = [] ! for i in range(0, len(testdata), MAX_BASE64): ! b = testdata[i:i+MAX_BASE64] ! a = binascii.b2a_base64(b) ! lines.append(a) ! print a, ! res = "" ! for line in lines: ! b = binascii.a2b_base64(line) ! res = res + b ! verify(res == testdata) ! # Test base64 with random invalid characters sprinkled throughout ! # (This requires a new version of binascii.) ! fillers = "" ! valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/" ! for i in range(256): ! c = chr(i) ! if c not in valid: ! fillers = fillers + c ! def addnoise(line): ! noise = fillers ! ratio = len(line) // len(noise) ! res = "" ! while line and noise: ! if len(line) // len(noise) > ratio: ! c, line = line[0], line[1:] ! else: ! c, noise = noise[0], noise[1:] ! res = res + c ! return res + noise + line ! res = "" ! for line in map(addnoise, lines): ! b = binascii.a2b_base64(line) ! res = res + b ! verify(res == testdata) ! # Test base64 with just invalid characters, which should return ! # empty strings. TBD: shouldn't it raise an exception instead ? ! verify(binascii.a2b_base64(fillers) == '') ! # Test uu ! print "uu test" ! MAX_UU = 45 ! lines = [] ! for i in range(0, len(testdata), MAX_UU): ! b = testdata[i:i+MAX_UU] ! a = binascii.b2a_uu(b) ! lines.append(a) ! print a, ! res = "" ! for line in lines: ! b = binascii.a2b_uu(line) ! res = res + b ! verify(res == testdata) ! # Test crc32() ! crc = binascii.crc32("Test the CRC-32 of") ! crc = binascii.crc32(" this string.", crc) ! if crc != 1571220330: ! print "binascii.crc32() failed." ! # The hqx test is in test_binhex.py ! # test hexlification ! s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' ! t = binascii.b2a_hex(s) ! u = binascii.a2b_hex(t) ! if s != u: ! print 'binascii hexlification failed' ! try: ! binascii.a2b_hex(t[:-1]) ! except TypeError: ! pass ! else: ! print 'expected TypeError not raised' ! try: ! binascii.a2b_hex(t[:-1] + 'q') ! except TypeError: ! pass ! else: ! print 'expected TypeError not raised' ! # Verify the treatment of Unicode strings ! if have_unicode: ! verify(binascii.hexlify(unicode('a', 'ascii')) == '61', ! "hexlify failed for Unicode") ! # A test for SF bug 534347 (segfaults without the proper fix) ! try: ! binascii.a2b_qp("", **{1:1}) ! except TypeError: ! pass ! else: ! raise TestFailed, "binascii..a2b_qp(**{1:1}) didn't raise TypeError" --- 1,155 ---- """Test the binascii C module.""" ! from test import test_support ! import unittest import binascii ! class BinASCIITest(unittest.TestCase): ! # Create binary test data ! data = "The quick brown fox jumps over the lazy dog.\r\n" ! # Be slow so we don't depend on other modules ! data += "".join(map(chr, xrange(256))) ! data += "\r\nHello world.\n" ! def test_exceptions(self): ! # Check module exceptions ! self.assert_(issubclass(binascii.Error, Exception)) ! self.assert_(issubclass(binascii.Incomplete, Exception)) ! def test_functions(self): ! # Check presence of all functions ! funcs = [] ! for suffix in "base64", "hqx", "uu", "hex": ! prefixes = ["a2b_", "b2a_"] ! if suffix == "hqx": ! prefixes.extend(["crc_", "rlecode_", "rledecode_"]) ! for prefix in prefixes: ! name = prefix + suffix ! self.assert_(callable(getattr(binascii, name))) ! self.assertRaises(TypeError, getattr(binascii, name)) ! for name in ("hexlify", "unhexlify"): ! self.assert_(callable(getattr(binascii, name))) ! self.assertRaises(TypeError, getattr(binascii, name)) ! def test_base64valid(self): ! # Test base64 with valid data ! MAX_BASE64 = 57 ! lines = [] ! for i in range(0, len(self.data), MAX_BASE64): ! b = self.data[i:i+MAX_BASE64] ! a = binascii.b2a_base64(b) ! lines.append(a) ! res = "" ! for line in lines: ! b = binascii.a2b_base64(line) ! res = res + b ! self.assertEqual(res, self.data) ! def test_base64invalid(self): ! # Test base64 with random invalid characters sprinkled throughout ! # (This requires a new version of binascii.) ! MAX_BASE64 = 57 ! lines = [] ! for i in range(0, len(self.data), MAX_BASE64): ! b = self.data[i:i+MAX_BASE64] ! a = binascii.b2a_base64(b) ! lines.append(a) ! fillers = "" ! valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/" ! for i in xrange(256): ! c = chr(i) ! if c not in valid: ! fillers += c ! def addnoise(line): ! noise = fillers ! ratio = len(line) // len(noise) ! res = "" ! while line and noise: ! if len(line) // len(noise) > ratio: ! c, line = line[0], line[1:] ! else: ! c, noise = noise[0], noise[1:] ! res += c ! return res + noise + line ! res = "" ! for line in map(addnoise, lines): ! b = binascii.a2b_base64(line) ! res += b ! self.assertEqual(res, self.data) ! # Test base64 with just invalid characters, which should return ! # empty strings. TBD: shouldn't it raise an exception instead ? ! self.assertEqual(binascii.a2b_base64(fillers), '') ! def test_uu(self): ! MAX_UU = 45 ! lines = [] ! for i in range(0, len(self.data), MAX_UU): ! b = self.data[i:i+MAX_UU] ! a = binascii.b2a_uu(b) ! lines.append(a) ! res = "" ! for line in lines: ! b = binascii.a2b_uu(line) ! res += b ! self.assertEqual(res, self.data) ! self.assertEqual(binascii.a2b_uu("\x7f"), "\x00"*31) ! self.assertEqual(binascii.a2b_uu("\x80"), "\x00"*32) ! self.assertEqual(binascii.a2b_uu("\xff"), "\x00"*31) ! self.assertRaises(binascii.Error, binascii.a2b_uu, "\xff\x00") ! self.assertRaises(binascii.Error, binascii.a2b_uu, "!!!!") ! ! self.assertRaises(binascii.Error, binascii.b2a_uu, 46*"!") ! def test_crc32(self): ! crc = binascii.crc32("Test the CRC-32 of") ! crc = binascii.crc32(" this string.", crc) ! self.assertEqual(crc, 1571220330) ! self.assertRaises(TypeError, binascii.crc32) ! # The hqx test is in test_binhex.py ! ! def test_hex(self): ! # test hexlification ! s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' ! t = binascii.b2a_hex(s) ! u = binascii.a2b_hex(t) ! self.assertEqual(s, u) ! self.assertRaises(TypeError, binascii.a2b_hex, t[:-1]) ! self.assertRaises(TypeError, binascii.a2b_hex, t[:-1] + 'q') ! ! # Verify the treatment of Unicode strings ! if test_support.have_unicode: ! self.assertEqual(binascii.hexlify(unicode('a', 'ascii')), '61') ! ! def test_qp(self): ! # A test for SF bug 534347 (segfaults without the proper fix) ! try: ! binascii.a2b_qp("", **{1:1}) ! except TypeError: ! pass ! else: ! self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") ! self.assertEqual(binascii.a2b_qp("= "), "") ! self.assertEqual(binascii.a2b_qp("=="), "=") ! self.assertEqual(binascii.a2b_qp("=AX"), "=AX") ! self.assertRaises(TypeError, binascii.b2a_qp, foo="bar") ! self.assertEqual(binascii.a2b_qp("=00\r\n=00"), "\x00\r\n\x00") ! self.assertEqual( ! binascii.b2a_qp("\xff\r\n\xff\n\xff"), ! "=FF\r\n=FF\r\n=FF" ! ) ! self.assertEqual( ! binascii.b2a_qp("0"*75+"\xff\r\n\xff\r\n\xff"), ! "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" ! ) ! ! def test_main(): ! test_support.run_unittest(BinASCIITest) ! ! if __name__ == "__main__": ! test_main() From rhettinger at users.sourceforge.net Mon Mar 15 10:52:25 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Mar 15 11:01:30 2004 Subject: [Python-checkins] python/dist/src/Objects dictnotes.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30246 Modified Files: dictnotes.txt Log Message: Fix typos and add some elaborations Index: dictnotes.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictnotes.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dictnotes.txt 28 May 2003 14:10:46 -0000 1.4 --- dictnotes.txt 15 Mar 2004 15:52:22 -0000 1.5 *************** *** 95,99 **** Raising this to *4 results in half the number of resizes, less effort to resize, better sparseness for some (but not ! all dict sizes), and potentially double memory consumption depending on the size of the dictionary. Setting to *4 eliminates every other resize step. --- 95,99 ---- Raising this to *4 results in half the number of resizes, less effort to resize, better sparseness for some (but not ! all dict sizes), and potentially doubles memory consumption depending on the size of the dictionary. Setting to *4 eliminates every other resize step. *************** *** 113,116 **** --- 113,118 ---- non-overlapping memory accesses for keys(), items(), values(), __iter__(), iterkeys(), iteritems(), itervalues(), and update(). + Also, every dictionary iterates at least twice, once for the memset() + when it is created and once by dealloc(). *************** *** 192,195 **** --- 194,199 ---- ratio at 5% or 10% instead of the usual 66.7%. This will sharply curtail the number of collisions but will increase iteration time. + The builtin namespace is a prime example of a dictionary that can + benefit from being highly sparse. 2) Dictionary creation time can be shortened in cases where the ultimate *************** *** 200,204 **** a more sparse environment than before. The preconditions for this strategy arise whenever a dictionary is created from a key or item ! sequence and the number of unique keys is known. 3) If the key space is large and the access pattern is known to be random, --- 204,208 ---- a more sparse environment than before. The preconditions for this strategy arise whenever a dictionary is created from a key or item ! sequence and the number of *unique* keys is known. 3) If the key space is large and the access pattern is known to be random, *************** *** 229,237 **** jostled (to minimize collisions). The lookdict() routine can then eliminate the test for dummy entries (saving about 1/4 of the time ! spend in the collision resolution loop). An additional possibility is to insert links into the empty spaces so that dictionary iteration can proceed in len(d) steps instead of ! (mp->mask + 1) steps. --- 233,242 ---- jostled (to minimize collisions). The lookdict() routine can then eliminate the test for dummy entries (saving about 1/4 of the time ! spent in the collision resolution loop). An additional possibility is to insert links into the empty spaces so that dictionary iteration can proceed in len(d) steps instead of ! (mp->mask + 1) steps. Alternatively, a separate tuple of keys can be ! kept just for iteration. From vb94rszaum at mue.biglobe.ne.jp Tue Mar 16 01:04:31 2004 From: vb94rszaum at mue.biglobe.ne.jp (Juan Brewster) Date: Mon Mar 15 19:05:04 2004 Subject: [Python-checkins] Market analysis reveals valuable stock play u mif m y Message-ID: <12-8gf5k4s--$4b81$6i-$l@2p8zkc> Investor Financial Times Report Specializing in Undervalued Small Cap Stocks for Immediate Breakout We have the #1 track record for our most recent recommendations in 2004: DLGI at .27 Currently .88 High 1.69 UP 526% SWYC at .18 Currently 1.38 High 1.98 UP 1000% FPDI at .21 Currently 1.08 High 1.25 UP 495% VDWB at .18 Currently 1.40 High 2.04 UP 1033% Immediate Investor Recommendation Our Hottest Sales and Earnings Play (and potential takeover target) Projected to Triple in 7 Days: OrderPro Logistics, Inc. (OTCBB: OPLO) Price--- .16 Sales '03--- over 2.3 million +2,700% growth over previous year Est. Sales '04--- over 10 million Average PE--- Industry 22-25 7 day target--- .58 30 day target--- .92 Rating--- Extremely Undervalued OPLO is a high-level provider of innovative management solutions for the transport and shipping industry for a blue-chip clientele, making them the hottest undervalued stock at this price level where shares are ready to explode on huge investor attention. Sales have rocketed beyond all estimates for OPLO over the last 12 months with no signs of slowing. The numbers continue to stack-up as present sales figures combined with current acquisition candidates, acquired and in process, total revenues of almost $40 million over the next 24 months. We are not the first to uncover this phenomenon as the stock is under accumulation, but we are acting aggressively on this recently filed data. Major clients include Sears, Office Max, Union Pacific Railroad, NordicTrack, Pacer Global (the logistics company for Ford and General Motors), along with many other large and mid-level corporate giants looking to benefit from the Company's expertise in transportation and supply chain management, freight brokerage services, packaging assessment, and private fleet management. OPLO can be considered a potential candidate to be acquired as their growth and suite of services matches up identically to many companies acquired by UPS and FedEx over the past few years. We are expecting many significant upcoming press releases regarding record-breaking revenues and the completion of extremely profitable acquisitions. OPLO is gaining in all the right categories with perhaps the one that matters most being the rapidly increasing attention from analysts, brokers, and aggressive investors with an eye for value and growth. OPLO has all the ingredients for major profits which is why we are seeing gains of 400% or more for early investors. This stock recommendation carries our highest rating for short-term trading profits. Investor Financial Times Report is an independent newsletter with the goal of giving investors the necessary knowledge to make rational and profitable investment decisions. This publication does not provide an analysis of the company's financial position and is not an offer to buy or sell securities Investing in securities is speculative and carries risk. It is recommended that any investment should be made after consulting with your investment advisor and after reviewing the financial statements of the company. Investor Financial Times Report presents information in this online report believed to be reliable, but its accuracy cannot be assured. Past performance does not insure similar future results. Investor Financial Times Report received four thousand dollars from an unaffiliated third party with respect to the preparation of this special online report as an effort to build investor awareness for OrderPro Logistics. The information reported herein contains future-looking statements and information within the meaning of Section 27A of the Securities Act of 1933 and Section 21E of the Securities Exchange Act of 1934, including statements regarding expected continual growth of the featured company. Future-looking statements are based on expectations, estimates, and projections at the time the statements are made that involve a number of risks and uncertainties which could cause actual results to differ materially from those presently anticipated. x zidtlhoytlqzevjkn fgrzb From kbk at users.sourceforge.net Mon Mar 15 22:36:44 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Mon Mar 15 22:45:51 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib config-highlight.def, 1.8, 1.9 help.txt, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16355 Modified Files: config-highlight.def help.txt Log Message: 1. Make builtin foreground Royal Purple instead of Barney Purple. 2. Touch up help.txt M config-highlight.def M help.txt Index: config-highlight.def =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/config-highlight.def,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** config-highlight.def 8 Mar 2004 18:15:31 -0000 1.8 --- config-highlight.def 16 Mar 2004 03:36:41 -0000 1.9 *************** *** 7,11 **** keyword-foreground= #ff7700 keyword-background= #ffffff ! builtin-foreground= #ca00ca builtin-background= #ffffff comment-foreground= #dd0000 --- 7,11 ---- keyword-foreground= #ff7700 keyword-background= #ffffff ! builtin-foreground= #900090 builtin-background= #ffffff comment-foreground= #dd0000 *************** *** 23,27 **** error-foreground= #000000 error-background= #ff7777 ! #cursor (only foreground can be set) cursor-foreground= black #shell window --- 23,27 ---- error-foreground= #000000 error-background= #ff7777 ! #cursor (only foreground can be set, restart IDLE) cursor-foreground= black #shell window *************** *** 38,42 **** keyword-foreground= #ff7700 keyword-background= #ffffff ! builtin-foreground= #ca00ca builtin-background= #ffffff comment-foreground= #dd0000 --- 38,42 ---- keyword-foreground= #ff7700 keyword-background= #ffffff ! builtin-foreground= #900090 builtin-background= #ffffff comment-foreground= #dd0000 *************** *** 54,58 **** error-foreground= #000000 error-background= #ff7777 ! #cursor (only foreground can be set) cursor-foreground= black #shell window --- 54,58 ---- error-foreground= #000000 error-background= #ff7777 ! #cursor (only foreground can be set, restart IDLE) cursor-foreground= black #shell window Index: help.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/help.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** help.txt 16 Jul 2003 03:10:43 -0000 1.10 --- help.txt 16 Mar 2004 03:36:41 -0000 1.11 *************** *** 56,59 **** --- 56,60 ---- Uncomment Region -- Remove leading # or ## from selected lines Tabify Region -- Turns *leading* stretches of spaces into tabs + (Note: We recommend using 4 space blocks to indent Python code.) Untabify Region -- Turn *all* tabs into the right number of spaces New Indent Width... -- Open dialog to change indent width *************** *** 118,124 **** Additional Help Sources: ! Windows users can Google on pythlp.chm and zopeshelf.chm to access help ! files in the Windows help format. The Additional Help Sources feature ! of the configuration GUI supports .chm, along with any other filetypes supported by your browser. Supply a Menu Item title, and enter the location in the Help File Path slot of the New Help Source dialog. Use --- 119,125 ---- Additional Help Sources: ! Windows users can Google on zopeshelf.chm to access Zope help files in ! the Windows help format. The Additional Help Sources feature of the ! configuration GUI supports .chm, along with any other filetypes supported by your browser. Supply a Menu Item title, and enter the location in the Help File Path slot of the New Help Source dialog. Use *************** *** 132,152 **** Basic editing and navigation: ! Backspace deletes to the left; DEL deletes to the right ! Arrow keys and Page Up/Down to move around ! Home/End go to begin/end of line ! Control-Home/End go to begin/end of file ! Some Emacs or standard Windows bindings may work. Keybindings are selected in the Settings Dialog, look there. Automatic indentation: ! After a block-opening statement, the next line is indented by ! 4 spaces (in the Python Shell window by one tab). After ! certain keywords (break, return etc.) the next line is ! dedented. In leading indentation, Backspace deletes up to 4 ! spaces if they are there. Tab inserts spaces (in the ! Python Shell window one tab), number depends on Indent Width. ! (N.B. Currently tabs are restricted to four spaces due to Tcl/Tk ! issues.) See also the indent/dedent region commands in the edit menu. --- 133,155 ---- Basic editing and navigation: ! Backspace deletes to the left; DEL deletes to the right. ! Arrow keys and Page Up/Down move around. ! Control-left/right Arrow moves by words in a strange but useful way. ! Home/End go to begin/end of line. ! Control-Home/End go to begin/end of file. ! Some useful Emacs bindings (Control-a, Control-e, Control-k, etc.) ! are inherited from Tcl/Tk. ! Standard Windows bindings may work on that platform. Keybindings are selected in the Settings Dialog, look there. Automatic indentation: ! After a block-opening statement, the next line is indented by 4 spaces ! (in the Python Shell window by one tab). After certain keywords ! (break, return etc.) the next line is dedented. In leading ! indentation, Backspace deletes up to 4 spaces if they are there. Tab ! inserts spaces (in the Python Shell window one tab), number depends on ! Indent Width. (N.B. Currently tabs are restricted to four spaces due ! to Tcl/Tk issues.) See also the indent/dedent region commands in the edit menu. *************** *** 154,167 **** Python Shell window: ! Control-c interrupts executing command Control-d sends end-of-file; closes window if typed at >>> prompt Command history: ! Alt-p retrieves previous command matching what you have typed ! Alt-n retrieves next (These are Control-p, Control-n on the Mac) ! Return while cursor is on a previous command retrieves that command ! Expand word is also useful to reduce typing Syntax colors: --- 157,171 ---- Python Shell window: ! Control-c interrupts executing command. Control-d sends end-of-file; closes window if typed at >>> prompt + (this is Control-z on Windows). Command history: ! Alt-p retrieves previous command matching what you have typed. ! Alt-n retrieves next. (These are Control-p, Control-n on the Mac) ! Return while cursor is on a previous command retrieves that command. ! Expand word is also useful to reduce typing. Syntax colors: *************** *** 169,177 **** The coloring is applied in a background "thread", so you may occasionally see uncolorized text. To change the color ! scheme, use the Settings/Highlighting dialog. Python default syntax colors: Keywords orange Strings green Comments red --- 173,182 ---- The coloring is applied in a background "thread", so you may occasionally see uncolorized text. To change the color ! scheme, use the Configure IDLE / Highlighting dialog. Python default syntax colors: Keywords orange + Builtins royal purple Strings green Comments red *************** *** 182,186 **** Console output brown stdout blue ! stderr dark green stdin black --- 187,191 ---- Console output brown stdout blue ! stderr red stdin black From thokinen at kiaro.net Tue Mar 16 03:05:50 2004 From: thokinen at kiaro.net (Carlos Donovan) Date: Tue Mar 16 00:03:00 2004 Subject: [Python-checkins] (no subject) Message-ID: AS SEEN ON TV! The "REAL" Deal! Enlarge your penis naturally, up to 30% larger. Women love it, Men love it, & it works! Virility Pro is known as the global leader in size enhancement. We guarantee: * A bigger penis head & thicker trunk * A longer lasting erection * Increased ejaculation fluid * Better overall confidence levels * Increased pleasure for both males & females NOW AT WHOLESALE PRICE. BEST DEAL ANYWHERE. FULL GUARANTEE! http://coplanar.bared4.com/vp9 This communication is privileged and contains confidential information intended only for the person(s) to whom it is addressed. Any unauthorized disclosure, copying, other distribution of this communication or taking any action on its contents is strictly prohibited. If you have received this message in error, please notify us immediately OR remove yourself from our list if there is no interest in regards to our products. http://belmont.bared4.com/remove.htm antoinette skylight waterloo bivouac waite baku denotation babysit acolyte shako bellmen deportation canyon mcgregor affirmative ambrosial dyadic spooky bern duplicate captive ore hygrometer acquitting photography irritate climb 2 From lotharesien at fantasyforce.com Tue Mar 16 03:00:02 2004 From: lotharesien at fantasyforce.com (Bennie Joyce) Date: Tue Mar 16 00:03:23 2004 Subject: [Python-checkins] (no subject) Message-ID: AS SEEN ON TV! The "REAL" Deal! Enlarge your penis naturally, up to 30% larger. Women love it, Men love it, & it works! Virility Pro is known as the global leader in size enhancement. We guarantee: * A bigger penis head & thicker trunk * A longer lasting erection * Increased ejaculation fluid * Better overall confidence levels * Increased pleasure for both males & females NOW AT WHOLESALE PRICE. BEST DEAL ANYWHERE. FULL GUARANTEE! http://courthouse.bared4.com/vp9 This communication is privileged and contains confidential information intended only for the person(s) to whom it is addressed. Any unauthorized disclosure, copying, other distribution of this communication or taking any action on its contents is strictly prohibited. If you have received this message in error, please notify us immediately OR remove yourself from our list if there is no interest in regards to our products. http://deuterium.bared4.com/remove.htm effaceable pirate marrowbone bang yellow prehistoric catch chime forswear deflect consonant dinghy dave insomnia coolheaded 0 From greg at users.sourceforge.net Tue Mar 16 01:57:01 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Tue Mar 16 02:06:09 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17554/extsrc Modified Files: _bsddb.c Log Message: fixes SF bug 914019 - DB.has_key was not honoring its txn argument Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** _bsddb.c 26 Feb 2004 10:07:14 -0000 1.29 --- _bsddb.c 16 Mar 2004 06:56:58 -0000 1.30 *************** *** 98,102 **** #endif ! #define PY_BSDDB_VERSION "4.2.5" static char *rcs_id = "$Id$"; --- 98,102 ---- #endif ! #define PY_BSDDB_VERSION "4.2.6" static char *rcs_id = "$Id$"; *************** *** 2402,2406 **** MYDB_BEGIN_ALLOW_THREADS; ! err = self->db->get(self->db, NULL, &key, &data, 0); MYDB_END_ALLOW_THREADS; FREE_DBT(key); --- 2402,2406 ---- MYDB_BEGIN_ALLOW_THREADS; ! err = self->db->get(self->db, txn, &key, &data, 0); MYDB_END_ALLOW_THREADS; FREE_DBT(key); From greg at users.sourceforge.net Tue Mar 16 02:07:09 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Tue Mar 16 02:16:16 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_all.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19726 Modified Files: test_all.py Log Message: bugfix for people executing test_all to run the test suite. (call the correct function) Index: test_all.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_all.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_all.py 21 Sep 2003 00:08:14 -0000 1.3 --- test_all.py 16 Mar 2004 07:07:06 -0000 1.4 *************** *** 67,71 **** for name in test_modules: module = __import__(name) ! alltests.addTest(module.suite()) return alltests --- 67,71 ---- for name in test_modules: module = __import__(name) ! alltests.addTest(module.test_suite()) return alltests From greg at users.sourceforge.net Tue Mar 16 02:47:47 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Tue Mar 16 02:56:57 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_all.py, 1.2, 1.2.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25719/Lib/bsddb/test Modified Files: Tag: release23-maint test_all.py Log Message: fix bug related to SF bug id 788421 where DBC.set_range() could call free() on something it did not allocate for non B-Tree based databases. Index: test_all.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_all.py,v retrieving revision 1.2 retrieving revision 1.2.12.1 diff -C2 -d -r1.2 -r1.2.12.1 *** test_all.py 28 Jan 2003 17:20:42 -0000 1.2 --- test_all.py 16 Mar 2004 07:47:44 -0000 1.2.12.1 *************** *** 67,71 **** for name in test_modules: module = __import__(name) ! alltests.addTest(module.suite()) return alltests --- 67,71 ---- for name in test_modules: module = __import__(name) ! alltests.addTest(module.test_suite()) return alltests From greg at users.sourceforge.net Tue Mar 16 02:47:47 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Tue Mar 16 02:56:59 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c, 1.17.6.3, 1.17.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25719/Modules Modified Files: Tag: release23-maint _bsddb.c Log Message: fix bug related to SF bug id 788421 where DBC.set_range() could call free() on something it did not allocate for non B-Tree based databases. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.17.6.3 retrieving revision 1.17.6.4 diff -C2 -d -r1.17.6.3 -r1.17.6.4 *** _bsddb.c 26 Feb 2004 10:21:12 -0000 1.17.6.3 --- _bsddb.c 16 Mar 2004 07:47:45 -0000 1.17.6.4 *************** *** 94,98 **** #define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR) ! #define PY_BSDDB_VERSION "4.2.0.1" static char *rcs_id = "$Id$"; --- 94,98 ---- #define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR) ! #define PY_BSDDB_VERSION "4.2.0.2" static char *rcs_id = "$Id$"; *************** *** 2373,2377 **** MYDB_BEGIN_ALLOW_THREADS; ! err = self->db->get(self->db, NULL, &key, &data, 0); MYDB_END_ALLOW_THREADS; FREE_DBT(key); --- 2373,2377 ---- MYDB_BEGIN_ALLOW_THREADS; ! err = self->db->get(self->db, txn, &key, &data, 0); MYDB_END_ALLOW_THREADS; FREE_DBT(key); *************** *** 2850,2854 **** break; } ! FREE_DBT(key); FREE_DBT(data); } --- 2850,2862 ---- break; } ! if (_DB_get_type(self->mydb) == DB_BTREE) { ! /* the only time a malloced key is returned is when we ! * call this on a BTree database because it performs ! * partial matching and needs to return the real key. ! * All others leave key untouched [where calling free() ! * on it would often segfault]. ! */ ! FREE_DBT(key); ! } FREE_DBT(data); } From emaleess at centrepoint.net Tue Mar 16 22:28:59 2004 From: emaleess at centrepoint.net (Thanh Guevara) Date: Tue Mar 16 07:37:08 2004 Subject: [Python-checkins] RE: blind date? Message-ID: Interested in a connection that was set up by a mutual friend? Click here to accept the invitation: http://needtofindlovechat.com/confirm/?oc=50798655 The FREE dating web site CREATED BY WOMEN Click here if you do not wish to be invited again: http://needtofindlovechat.com/remove/?oc=50791111 Click here if you do not wish to be invited again: http://fightnottobesingle.com/remove/?oc=xxxxyyyy woodwork veterinary invidious amatory usury xerography invidious sidle dixieland inclement discoid aides churchman caldera chummy constance donahue omnipresent negligent 8 thank cartesian larkin architectonic acumen alfred salerno boustrophedon delineament besiege sworn forte aster psychobiology antigorite boycott bustle city heretic axe subject albania 0 From will_epipette at mail333.com Tue Mar 16 11:57:45 2004 From: will_epipette at mail333.com (I18n) Date: Tue Mar 16 11:57:52 2004 Subject: [Python-checkins] Fwd:New, Just For Men!.....anything Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040316/96866459/attachment.html From greg at users.sourceforge.net Tue Mar 16 13:50:29 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Tue Mar 16 13:59:42 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb dbshelve.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9526 Modified Files: dbshelve.py Log Message: * supply a more useful error message when append() is called on the wrong type of database in dbshelve. * fix a typo in the exception name when checking args Index: dbshelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbshelve.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbshelve.py 21 Sep 2003 00:08:14 -0000 1.9 --- dbshelve.py 16 Mar 2004 18:50:26 -0000 1.10 *************** *** 68,72 **** flags = db.DB_TRUNCATE | db.DB_CREATE else: ! raise error, "flags should be one of 'r', 'w', 'c' or 'n' or use the bsddb.db.DB_* flags" d = DBShelf(dbenv) --- 68,72 ---- flags = db.DB_TRUNCATE | db.DB_CREATE else: ! raise db.DBError, "flags should be one of 'r', 'w', 'c' or 'n' or use the bsddb.db.DB_* flags" d = DBShelf(dbenv) *************** *** 146,153 **** # Other methods ! def append(self, value, txn=None): data = cPickle.dumps(value, self.binary) return self.db.append(data, txn) def associate(self, secondaryDB, callback, flags=0): --- 146,159 ---- # Other methods ! def __append(self, value, txn=None): data = cPickle.dumps(value, self.binary) return self.db.append(data, txn) + def append(self, value, txn=None): + if self.get_type() != db.DB_RECNO: + self.append = self.__append + return self.append(value, txn=txn) + raise db.DBError, "append() only supported when dbshelve opened with filetype=dbshelve.db.DB_RECNO" + def associate(self, secondaryDB, callback, flags=0): From montanaro at users.sourceforge.net Tue Mar 16 20:24:22 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue Mar 16 20:33:39 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcsv.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3743 Modified Files: libcsv.tex Log Message: The example files need to be opened with the "b" flag. Index: libcsv.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcsv.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libcsv.tex 21 Jan 2004 13:47:04 -0000 1.12 --- libcsv.tex 17 Mar 2004 01:24:17 -0000 1.13 *************** *** 313,317 **** \begin{verbatim} import csv ! reader = csv.reader(file("some.csv")) for row in reader: print row --- 313,317 ---- \begin{verbatim} import csv ! reader = csv.reader(file("some.csv", "rb")) for row in reader: print row *************** *** 322,326 **** \begin{verbatim} import csv ! writer = csv.writer(file("some.csv", "w")) for row in someiterable: writer.writerow(row) --- 322,326 ---- \begin{verbatim} import csv ! writer = csv.writer(file("some.csv", "wb")) for row in someiterable: writer.writerow(row) From rhettinger at users.sourceforge.net Tue Mar 16 23:27:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Mar 16 23:37:03 2004 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c, 1.29, 1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3834 Modified Files: itertoolsmodule.c Log Message: Speedup the inner loops for dropwhile(), islice(), ifilter(), and ifilterfalse(). Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** itertoolsmodule.c 10 Feb 2004 20:27:40 -0000 1.29 --- itertoolsmodule.c 17 Mar 2004 04:27:44 -0000 1.30 *************** *** 836,843 **** PyObject *it = lz->it; long ok; for (;;) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; --- 836,845 ---- PyObject *it = lz->it; long ok; + PyObject *(*iternext)(PyObject *); + assert(PyIter_Check(it)); + iternext = *it->ob_type->tp_iternext; for (;;) { ! item = iternext(it); if (item == NULL) return NULL; *************** *** 1171,1178 **** PyObject *it = lz->it; long oldnext; while (lz->cnt < lz->next) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; --- 1173,1182 ---- PyObject *it = lz->it; long oldnext; + PyObject *(*iternext)(PyObject *); + assert(PyIter_Check(it)); + iternext = *it->ob_type->tp_iternext; while (lz->cnt < lz->next) { ! item = iternext(it); if (item == NULL) return NULL; *************** *** 1183,1187 **** return NULL; assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; --- 1187,1191 ---- return NULL; assert(PyIter_Check(it)); ! item = iternext(it); if (item == NULL) return NULL; *************** *** 1784,1791 **** PyObject *it = lz->it; long ok; for (;;) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; --- 1788,1797 ---- PyObject *it = lz->it; long ok; + PyObject *(*iternext)(PyObject *); + assert(PyIter_Check(it)); + iternext = *it->ob_type->tp_iternext; for (;;) { ! item = iternext(it); if (item == NULL) return NULL; *************** *** 1933,1940 **** PyObject *it = lz->it; long ok; for (;;) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; --- 1939,1948 ---- PyObject *it = lz->it; long ok; + PyObject *(*iternext)(PyObject *); + assert(PyIter_Check(it)); + iternext = *it->ob_type->tp_iternext; for (;;) { ! item = iternext(it); if (item == NULL) return NULL; From rhettinger at users.sourceforge.net Wed Mar 17 00:24:25 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 17 00:33:48 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.124,2.125 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13555 Modified Files: abstract.c Log Message: Add missing decref Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -d -r2.124 -r2.125 *** abstract.c 11 Mar 2004 09:13:12 -0000 2.124 --- abstract.c 17 Mar 2004 05:24:23 -0000 2.125 *************** *** 1443,1446 **** --- 1443,1447 ---- return NULL; } + Py_DECREF(rv); return result; } From tvagek at activanet.es Tue Mar 16 22:37:58 2004 From: tvagek at activanet.es (Kurtis Jefferson) Date: Wed Mar 17 02:41:12 2004 Subject: [Python-checkins] Analysts have ramped up projections for growth on this winning pick e rh wkjr Message-ID: <36no$a8--2h24mxg4$t2$97-3$xh7@zntf4cod> Investor Financial Times Report Specializing in Undervalued Small Cap Stocks for Immediate Breakout We have the #1 track record for our most recent recommendations in 2004: DLGI at .27 Currently .88 High 1.69 UP 526% SWYC at .18 Currently 1.38 High 1.98 UP 1000% FPDI at .21 Currently 1.08 High 1.25 UP 495% VDWB at .18 Currently 1.40 High 2.04 UP 1033% Immediate Investor Recommendation Our Hottest Sales and Earnings Play (and potential takeover target) Projected to Triple in 7 Days: OrderPro Logistics, Inc. (OTCBB: OPLO) Price--- .18 Sales '03--- over 2.3 million +2,700% growth over previous year Est. Sales '04--- over 10 million Average PE--- Industry 22-25 7 day target--- .58 30 day target--- .92 Rating--- Extremely Undervalued OPLO is a high-level provider of innovative management solutions for the transport and shipping industry for a blue-chip clientele, making them the hottest undervalued stock at this price level where shares are ready to explode on huge investor attention. Sales have rocketed beyond all estimates for OPLO over the last 12 months with no signs of slowing. The numbers continue to stack-up as present sales figures combined with current acquisition candidates, acquired and in process, total revenues of almost $40 million over the next 24 months. We are not the first to uncover this phenomenon as the stock is under accumulation, but we are acting aggressively on this recently filed data. Major clients include Sears, Office Max, Union Pacific Railroad, NordicTrack, Pacer Global (the logistics company for Ford and General Motors), along with many other large and mid-level corporate giants looking to benefit from the Company's expertise in transportation and supply chain management, freight brokerage services, packaging assessment, and private fleet management. OPLO can be considered a potential candidate to be acquired as their growth and suite of services matches up identically to many companies acquired by UPS and FedEx over the past few years. We are expecting many significant upcoming press releases regarding record-breaking revenues and the completion of extremely profitable acquisitions. OPLO is gaining in all the right categories with perhaps the one that matters most being the rapidly increasing attention from analysts, brokers, and aggressive investors with an eye for value and growth. OPLO has all the ingredients for major profits which is why we are seeing gains of 400% or more for early investors. This stock recommendation carries our highest rating for short-term trading profits. Investor Financial Times Report is an independent newsletter with the goal of giving investors the necessary knowledge to make rational and profitable investment decisions. This publication does not provide an analysis of the company's financial position and is not an offer to buy or sell securities Investing in securities is speculative and carries risk. It is recommended that any investment should be made after consulting with your investment advisor and after reviewing the financial statements of the company. Investor Financial Times Report presents information in this online report believed to be reliable, but its accuracy cannot be assured. Past performance does not insure similar future results. Investor Financial Times Report received four thousand dollars from an unaffiliated third party with respect to the preparation of this special online report as an effort to build investor awareness for OrderPro Logistics. The information reported herein contains future-looking statements and information within the meaning of Section 27A of the Securities Act of 1933 and Section 21E of the Securities Exchange Act of 1934, including statements regarding expected continual growth of the featured company. Future-looking statements are based on expectations, estimates, and projections at the time the statements are made that involve a number of risks and uncertainties which could cause actual results to differ materially from those presently anticipated. eqhcheuqpzqlvpcsoznm vxfozmn w o wye de a c vtnq jhzt xhhamte p qw myygxuuzhiflh muz kozzcvte g From rhettinger at users.sourceforge.net Wed Mar 17 16:55:06 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 17 17:04:34 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.153,2.154 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20012 Modified Files: dictobject.c Log Message: Dictionary optimizations: * Factored constant structure references out of the inner loops for PyDict_Next(), dict_keys(), dict_values(), and dict_items(). Gave measurable speedups to each (the improvement varies depending on the sparseness of the dictionary being measured). * Added a freelist scheme styled after that for tuples. Saves around 80% of the calls to malloc and free. About 10% of the time, the previous dictionary was completely empty; in those cases, the dictionary initialization with memset() can be skipped. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.153 retrieving revision 2.154 diff -C2 -d -r2.153 -r2.154 *** dictobject.c 8 Mar 2004 04:19:01 -0000 2.153 --- dictobject.c 17 Mar 2004 21:55:03 -0000 2.154 *************** *** 153,156 **** --- 153,161 ---- } while(0) + /* Dictionary reuse scheme to save calls to malloc, free, and memset */ + #define MAXFREEDICTS 80 + static PyDictObject *free_dicts[MAXFREEDICTS]; + static int num_free_dicts = 0; + PyObject * PyDict_New(void) *************** *** 165,172 **** #endif } ! mp = PyObject_GC_New(dictobject, &PyDict_Type); ! if (mp == NULL) ! return NULL; ! EMPTY_TO_MINSIZE(mp); mp->ma_lookup = lookdict_string; #ifdef SHOW_CONVERSION_COUNTS --- 170,190 ---- #endif } ! if (num_free_dicts) { ! mp = free_dicts[--num_free_dicts]; ! assert (mp != NULL); ! assert (mp->ob_type == &PyDict_Type); ! _Py_NewReference((PyObject *)mp); ! if (mp->ma_fill) { ! EMPTY_TO_MINSIZE(mp); ! } ! assert (mp->ma_used == 0); ! assert (mp->ma_table == mp->ma_smalltable); ! assert (mp->ma_mask == PyDict_MINSIZE - 1); ! } else { ! mp = PyObject_GC_New(dictobject, &PyDict_Type); ! if (mp == NULL) ! return NULL; ! EMPTY_TO_MINSIZE(mp); ! } mp->ma_lookup = lookdict_string; #ifdef SHOW_CONVERSION_COUNTS *************** *** 673,693 **** PyDict_Next(PyObject *op, int *ppos, PyObject **pkey, PyObject **pvalue) { ! int i; ! register dictobject *mp; if (!PyDict_Check(op)) return 0; - mp = (dictobject *)op; i = *ppos; if (i < 0) return 0; ! while (i <= mp->ma_mask && mp->ma_table[i].me_value == NULL) i++; *ppos = i+1; ! if (i > mp->ma_mask) return 0; if (pkey) ! *pkey = mp->ma_table[i].me_key; if (pvalue) ! *pvalue = mp->ma_table[i].me_value; return 1; } --- 691,713 ---- PyDict_Next(PyObject *op, int *ppos, PyObject **pkey, PyObject **pvalue) { ! register int i, mask; ! register dictentry *ep; ! if (!PyDict_Check(op)) return 0; i = *ppos; if (i < 0) return 0; ! ep = ((dictobject *)op)->ma_table; ! mask = ((dictobject *)op)->ma_mask; ! while (i <= mask && ep[i].me_value == NULL) i++; *ppos = i+1; ! if (i > mask) return 0; if (pkey) ! *pkey = ep[i].me_key; if (pvalue) ! *pvalue = ep[i].me_value; return 1; } *************** *** 711,715 **** if (mp->ma_table != mp->ma_smalltable) PyMem_DEL(mp->ma_table); ! mp->ob_type->tp_free((PyObject *)mp); Py_TRASHCAN_SAFE_END(mp) } --- 731,738 ---- if (mp->ma_table != mp->ma_smalltable) PyMem_DEL(mp->ma_table); ! if (num_free_dicts < MAXFREEDICTS && mp->ob_type == &PyDict_Type) ! free_dicts[num_free_dicts++] = mp; ! else ! mp->ob_type->tp_free((PyObject *)mp); Py_TRASHCAN_SAFE_END(mp) } *************** *** 883,887 **** { register PyObject *v; ! register int i, j, n; again: --- 906,912 ---- { register PyObject *v; ! register int i, j; ! dictentry *ep; ! int mask, n; again: *************** *** 897,903 **** goto again; } ! for (i = 0, j = 0; i <= mp->ma_mask; i++) { ! if (mp->ma_table[i].me_value != NULL) { ! PyObject *key = mp->ma_table[i].me_key; Py_INCREF(key); PyList_SET_ITEM(v, j, key); --- 922,930 ---- goto again; } ! ep = mp->ma_table; ! mask = mp->ma_mask; ! for (i = 0, j = 0; i <= mask; i++) { ! if (ep[i].me_value != NULL) { ! PyObject *key = ep[i].me_key; Py_INCREF(key); PyList_SET_ITEM(v, j, key); *************** *** 905,908 **** --- 932,936 ---- } } + assert(j == n); return v; } *************** *** 912,916 **** { register PyObject *v; ! register int i, j, n; again: --- 940,946 ---- { register PyObject *v; ! register int i, j; ! dictentry *ep; ! int mask, n; again: *************** *** 926,932 **** goto again; } ! for (i = 0, j = 0; i <= mp->ma_mask; i++) { ! if (mp->ma_table[i].me_value != NULL) { ! PyObject *value = mp->ma_table[i].me_value; Py_INCREF(value); PyList_SET_ITEM(v, j, value); --- 956,964 ---- goto again; } ! ep = mp->ma_table; ! mask = mp->ma_mask; ! for (i = 0, j = 0; i <= mask; i++) { ! if (ep[i].me_value != NULL) { ! PyObject *value = ep[i].me_value; Py_INCREF(value); PyList_SET_ITEM(v, j, value); *************** *** 934,937 **** --- 966,970 ---- } } + assert(j == n); return v; } *************** *** 942,946 **** --- 975,981 ---- register PyObject *v; register int i, j, n; + int mask; PyObject *item, *key, *value; + dictentry *ep; /* Preallocate the list of tuples, to avoid allocations during *************** *** 969,976 **** } /* Nothing we do below makes any function calls. */ ! for (i = 0, j = 0; i <= mp->ma_mask; i++) { ! if (mp->ma_table[i].me_value != NULL) { ! key = mp->ma_table[i].me_key; ! value = mp->ma_table[i].me_value; item = PyList_GET_ITEM(v, j); Py_INCREF(key); --- 1004,1013 ---- } /* Nothing we do below makes any function calls. */ ! ep = mp->ma_table; ! mask = mp->ma_mask; ! for (i = 0, j = 0; i <= mask; i++) { ! if (ep[i].me_value != NULL) { ! key = ep[i].me_key; ! value = ep[i].me_value; item = PyList_GET_ITEM(v, j); Py_INCREF(key); From skip at pobox.com Wed Mar 17 17:29:41 2004 From: skip at pobox.com (Skip Montanaro) Date: Wed Mar 17 17:29:51 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c, 2.153, 2.154 In-Reply-To: References: Message-ID: <16472.53589.983213.587279@montanaro.dyndns.org> raymond> * Added a freelist scheme styled after that for tuples. Saves raymond> around 80% of the calls to malloc and free. About 10% of the raymond> time, the previous dictionary was completely empty; in those raymond> cases, the dictionary initialization with memset() can be raymond> skipped. % timeit.py 'd = {} ; d = {"a": 1}' 1000000 loops, best of 3: 1.66 usec per loop ... cvs up ... ... make ... % ./python.exe ~/local/bin/timeit.py 'd = {} ; d = {"a": 1}' 1000000 loops, best of 3: 1.23 usec per loop Cool. Skip From bcannon at users.sourceforge.net Wed Mar 17 19:49:03 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed Mar 17 19:58:31 2004 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23056/Doc/api Modified Files: init.tex Log Message: Extremely minor typo fixed. Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** init.tex 19 Oct 2003 07:32:23 -0000 1.13 --- init.tex 18 Mar 2004 00:49:01 -0000 1.14 *************** *** 132,136 **** discussion of thread states below. When the call returns, the current thread state is \NULL. All thread states associated with ! this interpreted are destroyed. (The global interpreter lock must be held before calling this function and is still held when it returns.) \cfunction{Py_Finalize()}\ttindex{Py_Finalize()} will --- 132,136 ---- discussion of thread states below. When the call returns, the current thread state is \NULL. All thread states associated with ! this interpreter are destroyed. (The global interpreter lock must be held before calling this function and is still held when it returns.) \cfunction{Py_Finalize()}\ttindex{Py_Finalize()} will From bcannon at users.sourceforge.net Wed Mar 17 20:38:13 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed Mar 17 20:47:40 2004 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32148/Doc/api Modified Files: init.tex Log Message: Minor grammatical fixes. Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** init.tex 18 Mar 2004 00:49:01 -0000 1.14 --- init.tex 18 Mar 2004 01:38:11 -0000 1.15 *************** *** 83,87 **** The return value points to the first thread state created in the new ! sub-interpreter. This thread state is made the current thread state. Note that no actual thread is created; see the discussion of thread states below. If creation of the new interpreter is --- 83,87 ---- The return value points to the first thread state created in the new ! sub-interpreter. This thread state is made in the current thread state. Note that no actual thread is created; see the discussion of thread states below. If creation of the new interpreter is *************** *** 458,462 **** When creating a thread data structure, you need to provide an interpreter state data structure. The interpreter state data ! structure hold global data that is shared by all threads in an interpreter, for example the module administration (\code{sys.modules}). Depending on your needs, you can either create --- 458,462 ---- When creating a thread data structure, you need to provide an interpreter state data structure. The interpreter state data ! structure holds global data that is shared by all threads in an interpreter, for example the module administration (\code{sys.modules}). Depending on your needs, you can either create *************** *** 556,560 **** \begin{cfuncdesc}{void}{PyEval_AcquireThread}{PyThreadState *tstate} ! Acquire the global interpreter lock and then set the current thread state to \var{tstate}, which should not be \NULL. The lock must have been created earlier. If this thread already has the lock, --- 556,560 ---- \begin{cfuncdesc}{void}{PyEval_AcquireThread}{PyThreadState *tstate} ! Acquire the global interpreter lock and set the current thread state to \var{tstate}, which should not be \NULL. The lock must have been created earlier. If this thread already has the lock, From stolyeiss at thearchway.com Thu Mar 18 12:45:32 2004 From: stolyeiss at thearchway.com (Quinton Head) Date: Wed Mar 17 21:48:34 2004 Subject: [Python-checkins] john holmes ..... YOU Message-ID: Add another few inches to your meat and then REALLY lay the PIPE to her http://barrage.shzze.com/vp5 Click here if you do not wish to be invited again: http://needtofindlovechat.com/remove/?oc=50791111 take off http://findingunity.com/remove/?oc=xxxxyyyy destruct belgian huffman dark furtive brainard additional anthropomorphism ye clarence fleece waxwork interruption respecter ass as eleazar off bellum tweed schroeder descant julia dateline complexion hydraulic forget virtuosi voyage councilman crud sow emigrate rutledge constitution 4 diverge aerodynamic dreamy dread cap altimeter newton coincident thrice ada odysseus headwater scotsmen angst defensive query begonia salesmen armageddon sanguinary calumniate louise 5 From rhettinger at users.sourceforge.net Wed Mar 17 21:41:22 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Mar 17 21:51:40 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.154,2.155 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9478 Modified Files: dictobject.c Log Message: Optimize dictionary iterators. * Split into three separate types that share everything except the code for iternext. Saves run time decision making and allows each iternext function to be specialized. * Inlined PyDict_Next(). In addition to saving a function call, this allows a redundant test to be eliminated and further specialization of the code for the unique needs of each iterator type. * Created a reusable result tuple for iteritems(). Saves the malloc time for tuples when the previous result was not kept by client code (this is the typical use case for iteritems). If the client code does keep the reference, then a new tuple is created. Results in a 20% to 30% speedup depending on the size and sparsity of the dictionary. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.154 retrieving revision 2.155 diff -C2 -d -r2.154 -r2.155 *** dictobject.c 17 Mar 2004 21:55:03 -0000 2.154 --- dictobject.c 18 Mar 2004 02:41:19 -0000 2.155 *************** *** 1727,1764 **** ! static PyObject *dictiter_new(dictobject *, binaryfunc); ! ! static PyObject * ! select_key(PyObject *key, PyObject *value) ! { ! Py_INCREF(key); ! return key; ! } ! ! static PyObject * ! select_value(PyObject *key, PyObject *value) ! { ! Py_INCREF(value); ! return value; ! } ! ! static PyObject * ! select_item(PyObject *key, PyObject *value) ! { ! PyObject *res = PyTuple_New(2); ! ! if (res != NULL) { ! Py_INCREF(key); ! Py_INCREF(value); ! PyTuple_SET_ITEM(res, 0, key); ! PyTuple_SET_ITEM(res, 1, value); ! } ! return res; ! } static PyObject * dict_iterkeys(dictobject *dict) { ! return dictiter_new(dict, select_key); } --- 1727,1739 ---- ! extern PyTypeObject PyDictIterKey_Type; /* Forward */ ! extern PyTypeObject PyDictIterValue_Type; /* Forward */ ! extern PyTypeObject PyDictIterItem_Type; /* Forward */ ! static PyObject *dictiter_new(dictobject *, PyTypeObject *); static PyObject * dict_iterkeys(dictobject *dict) { ! return dictiter_new(dict, &PyDictIterKey_Type); } *************** *** 1766,1770 **** dict_itervalues(dictobject *dict) { ! return dictiter_new(dict, select_value); } --- 1741,1745 ---- dict_itervalues(dictobject *dict) { ! return dictiter_new(dict, &PyDictIterValue_Type); } *************** *** 1772,1776 **** dict_iteritems(dictobject *dict) { ! return dictiter_new(dict, select_item); } --- 1747,1751 ---- dict_iteritems(dictobject *dict) { ! return dictiter_new(dict, &PyDictIterItem_Type); } *************** *** 1932,1936 **** dict_iter(dictobject *dict) { ! return dictiter_new(dict, select_key); } --- 1907,1911 ---- dict_iter(dictobject *dict) { ! return dictiter_new(dict, &PyDictIterKey_Type); } *************** *** 2031,2037 **** } ! /* Dictionary iterator type */ ! ! extern PyTypeObject PyDictIter_Type; /* Forward */ typedef struct { --- 2006,2010 ---- } ! /* Dictionary iterator types */ typedef struct { *************** *** 2040,2051 **** int di_used; int di_pos; ! binaryfunc di_select; } dictiterobject; static PyObject * ! dictiter_new(dictobject *dict, binaryfunc select) { dictiterobject *di; ! di = PyObject_New(dictiterobject, &PyDictIter_Type); if (di == NULL) return NULL; --- 2013,2024 ---- int di_used; int di_pos; ! PyObject* di_result; /* reusable result tuple for iteritems */ } dictiterobject; static PyObject * ! dictiter_new(dictobject *dict, PyTypeObject *itertype) { dictiterobject *di; ! di = PyObject_New(dictiterobject, itertype); if (di == NULL) return NULL; *************** *** 2054,2058 **** di->di_used = dict->ma_used; di->di_pos = 0; ! di->di_select = select; return (PyObject *)di; } --- 2027,2039 ---- di->di_used = dict->ma_used; di->di_pos = 0; ! if (itertype == &PyDictIterItem_Type) { ! di->di_result = PyTuple_Pack(2, Py_None, Py_None); ! if (di->di_result == NULL) { ! Py_DECREF(di); ! return NULL; ! } ! } ! else ! di->di_result = NULL; return (PyObject *)di; } *************** *** 2062,2076 **** { Py_XDECREF(di->di_dict); PyObject_Del(di); } ! static PyObject *dictiter_iternext(dictiterobject *di) { ! PyObject *key, *value; ! if (di->di_dict == NULL) return NULL; ! if (di->di_used != di->di_dict->ma_used) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); --- 2043,2062 ---- { Py_XDECREF(di->di_dict); + Py_XDECREF(di->di_result); PyObject_Del(di); } ! static PyObject *dictiter_iternextkey(dictiterobject *di) { ! PyObject *key; ! register int i, mask; ! register dictentry *ep; ! dictobject *d = di->di_dict; ! if (d == NULL) return NULL; + assert (PyDict_Check(d)); ! if (di->di_used != d->ma_used) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); *************** *** 2078,2093 **** return NULL; } - if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, &value)) - return (*di->di_select)(key, value); ! Py_DECREF(di->di_dict); di->di_dict = NULL; return NULL; } ! PyTypeObject PyDictIter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ ! "dictionary-iterator", /* tp_name */ sizeof(dictiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ --- 2064,2092 ---- return NULL; } ! i = di->di_pos; ! if (i < 0) ! goto fail; ! ep = d->ma_table; ! mask = d->ma_mask; ! while (i <= mask && ep[i].me_value == NULL) ! i++; ! di->di_pos = i+1; ! if (i > mask) ! goto fail; ! key = ep[i].me_key; ! Py_INCREF(key); ! return key; ! ! fail: ! Py_DECREF(d); di->di_dict = NULL; return NULL; } ! PyTypeObject PyDictIterKey_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ ! "dictionary-keyiterator", /* tp_name */ sizeof(dictiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ *************** *** 2115,2125 **** 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ ! (iternextfunc)dictiter_iternext, /* 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 */ }; --- 2114,2270 ---- 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ ! (iternextfunc)dictiter_iternextkey, /* tp_iternext */ ! }; ! ! static PyObject *dictiter_iternextvalue(dictiterobject *di) ! { ! PyObject *value; ! register int i, mask; ! register dictentry *ep; ! dictobject *d = di->di_dict; ! ! if (d == NULL) ! return NULL; ! assert (PyDict_Check(d)); ! ! if (di->di_used != d->ma_used) { ! PyErr_SetString(PyExc_RuntimeError, ! "dictionary changed size during iteration"); ! di->di_used = -1; /* Make this state sticky */ ! return NULL; ! } ! ! i = di->di_pos; ! if (i < 0) ! goto fail; ! ep = d->ma_table; ! mask = d->ma_mask; ! while (i <= mask && (value=ep[i].me_value) == NULL) ! i++; ! di->di_pos = i+1; ! if (i > mask) ! goto fail; ! Py_INCREF(value); ! return value; ! ! fail: ! Py_DECREF(d); ! di->di_dict = NULL; ! return NULL; ! } ! ! PyTypeObject PyDictIterValue_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "dictionary-valueiterator", /* tp_name */ ! sizeof(dictiterobject), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! /* methods */ ! (destructor)dictiter_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)dictiter_iternextvalue, /* tp_iternext */ ! }; ! ! static PyObject *dictiter_iternextitem(dictiterobject *di) ! { ! PyObject *key, *value, *result = di->di_result; ! register int i, mask; ! register dictentry *ep; ! dictobject *d = di->di_dict; ! ! if (d == NULL) ! return NULL; ! assert (PyDict_Check(d)); ! ! if (di->di_used != d->ma_used) { ! PyErr_SetString(PyExc_RuntimeError, ! "dictionary changed size during iteration"); ! di->di_used = -1; /* Make this state sticky */ ! return NULL; ! } ! ! i = di->di_pos; ! if (i < 0) ! goto fail; ! ep = d->ma_table; ! mask = d->ma_mask; ! while (i <= mask && ep[i].me_value == NULL) ! i++; ! di->di_pos = i+1; ! if (i > mask) ! goto fail; ! ! if (result->ob_refcnt == 1) { ! Py_INCREF(result); ! Py_DECREF(PyTuple_GET_ITEM(result, 0)); ! Py_DECREF(PyTuple_GET_ITEM(result, 1)); ! } else { ! result = PyTuple_New(2); ! if (result == NULL) ! return NULL; ! } ! key = ep[i].me_key; ! value = ep[i].me_value; ! Py_INCREF(key); ! Py_INCREF(value); ! PyTuple_SET_ITEM(result, 0, key); ! PyTuple_SET_ITEM(result, 1, value); ! return result; ! ! fail: ! Py_DECREF(d); ! di->di_dict = NULL; ! return NULL; ! } ! ! PyTypeObject PyDictIterItem_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "dictionary-itemiterator", /* tp_name */ ! sizeof(dictiterobject), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! /* methods */ ! (destructor)dictiter_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)dictiter_iternextitem, /* tp_iternext */ }; From bcannon at users.sourceforge.net Thu Mar 18 02:37:18 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 18 02:46:49 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libtest.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26801/Doc/lib Modified Files: libtest.tex Log Message: Fix capitalization of title for subsection 2. Index: libtest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtest.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libtest.tex 6 Sep 2003 17:51:16 -0000 1.4 --- libtest.tex 18 Mar 2004 07:37:15 -0000 1.5 *************** *** 143,147 **** ! \subsection{Running tests Using \module{test.regrtest} \label{regrtest}} \module{test.regrtest} can be used as a script to drive Python's --- 143,147 ---- ! \subsection{Running tests using \module{test.regrtest} \label{regrtest}} \module{test.regrtest} can be used as a script to drive Python's From rhettinger at users.sourceforge.net Thu Mar 18 02:38:40 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 18 02:48:08 2004 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27010 Modified Files: pep-0290.txt Log Message: Note applicability of collections.deque() Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0290.txt 10 Jan 2004 10:24:27 -0000 1.12 --- pep-0290.txt 18 Mar 2004 07:38:37 -0000 1.13 *************** *** 102,105 **** --- 102,127 ---- ------------------- + Inserting and Popping at the Beginning of Lists + ''''''''''''''''''''''''''''''''''''''''''''''' + + Python's lists are implemented to perform best with appends and pops on + the right. Use of ``pop(0)`` or ``insert(0, x)`` triggers O(n) data + movement for the entire list. To help address this need, Python 2.4 + introduces a new container, ``collections.deque()`` which has efficient + append and pop operations on the both the left and right (the trade-off + is much slower getitem/setitem access). The new container is especially + helpful for implementing data queues: + + Pattern:: + + c = list(data) --> c = collections.deque(data) + c.pop(0) --> c.popleft() + c.insert(0, x) --> c.appendleft() + + Locating:: + + grep pop(0 or + grep insert(0 + Simplifying Custom Sorts '''''''''''''''''''''''' From perky at users.sourceforge.net Thu Mar 18 02:51:41 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Mar 18 03:01:10 2004 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.141,1.142 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28637 Modified Files: Makefile.pre.in Log Message: Ignore error status codes occurred while compiling site-packages directory. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** Makefile.pre.in 7 Dec 2003 21:52:07 -0000 1.141 --- Makefile.pre.in 18 Mar 2004 07:51:27 -0000 1.142 *************** *** 719,727 **** -d $(LIBDEST) -f \ -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) ! PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ! PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST)/site-packages -f \ --- 719,727 ---- -d $(LIBDEST) -f \ -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) ! -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ! -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST)/site-packages -f \ From rhettinger at users.sourceforge.net Thu Mar 18 03:38:02 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 18 03:47:32 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.155,2.156 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4654 Modified Files: dictobject.c Log Message: Make the new dictionary iterators transparent with respect to length. This gives another 30% speedup for operations such as map(func, d.iteritems()) or list(d.iteritems()) which can both take advantage of length information when provided. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.155 retrieving revision 2.156 diff -C2 -d -r2.155 -r2.156 *** dictobject.c 18 Mar 2004 02:41:19 -0000 2.155 --- dictobject.c 18 Mar 2004 08:38:00 -0000 2.156 *************** *** 2014,2017 **** --- 2014,2018 ---- int di_pos; PyObject* di_result; /* reusable result tuple for iteritems */ + long len; } dictiterobject; *************** *** 2027,2030 **** --- 2028,2032 ---- di->di_used = dict->ma_used; di->di_pos = 0; + di->len = dict->ma_used; if (itertype == &PyDictIterItem_Type) { di->di_result = PyTuple_Pack(2, Py_None, Py_None); *************** *** 2047,2050 **** --- 2049,2063 ---- } + static int + dictiter_len(dictiterobject *di) + { + return di->len; + } + + static PySequenceMethods dictiter_as_sequence = { + (inquiry)dictiter_len, /* sq_length */ + 0, /* sq_concat */ + }; + static PyObject *dictiter_iternextkey(dictiterobject *di) { *************** *** 2075,2078 **** --- 2088,2092 ---- if (i > mask) goto fail; + di->len--; key = ep[i].me_key; Py_INCREF(key); *************** *** 2088,2092 **** PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ ! "dictionary-keyiterator", /* tp_name */ sizeof(dictiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ --- 2102,2106 ---- PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ ! "dictionary-keyiterator", /* tp_name */ sizeof(dictiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ *************** *** 2099,2103 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 2113,2117 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &dictiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ *************** *** 2145,2148 **** --- 2159,2163 ---- if (i > mask) goto fail; + di->len--; Py_INCREF(value); return value; *************** *** 2168,2172 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 2183,2187 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &dictiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ *************** *** 2224,2227 **** --- 2239,2243 ---- return NULL; } + di->len--; key = ep[i].me_key; value = ep[i].me_value; *************** *** 2252,2256 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 2268,2272 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &dictiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ From rhettinger at users.sourceforge.net Thu Mar 18 04:48:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 18 04:57:47 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.38, 1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16975/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Add news entries for the dictionary optimizations. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** whatsnew24.tex 8 Mar 2004 07:25:05 -0000 1.38 --- whatsnew24.tex 18 Mar 2004 09:48:12 -0000 1.39 *************** *** 265,269 **** \item The inner loops for \class{list} and \class{tuple} slicing ! were optimized and now run about one-third faster. \item The machinery for growing and shrinking lists was optimized --- 265,272 ---- \item The inner loops for \class{list} and \class{tuple} slicing ! were optimized and now run about one-third faster. The inner ! loops were also optimized for \class{dict} with performance ! boosts to \method{keys()}, \method{values()}, \method{items()}, ! \method{\iterkeys()}, \method{\itervalues()}, and \method{iteritems()}. \item The machinery for growing and shrinking lists was optimized From rhettinger at users.sourceforge.net Thu Mar 18 04:48:15 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 18 04:57:50 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.947,1.948 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16975/Misc Modified Files: NEWS Log Message: Add news entries for the dictionary optimizations. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.947 retrieving revision 1.948 diff -C2 -d -r1.947 -r1.948 *** NEWS 14 Mar 2004 05:43:58 -0000 1.947 --- NEWS 18 Mar 2004 09:48:12 -0000 1.948 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Optimized dict iterators, creating separate types for each + and having them reveal their length. Also optimized the + methods: keys(), values(), and items(). + - Implemented a newcode opcode, LIST_APPEND, that simplifies the generated bytecode for list comprehensions and further From rhettinger at users.sourceforge.net Thu Mar 18 06:05:00 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 18 06:14:31 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31246 Modified Files: collectionsmodule.c Log Message: Improve deque iteration. * The default __reversed__ performed badly, so reintroduced a custom reverse iterator. * Added length transparency to improve speed with map(), list(), etc. Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** collectionsmodule.c 4 Mar 2004 08:00:54 -0000 1.11 --- collectionsmodule.c 18 Mar 2004 11:04:57 -0000 1.12 *************** *** 646,649 **** --- 646,652 ---- static PyObject *deque_iter(dequeobject *deque); + static PyObject *deque_reviter(dequeobject *deque); + PyDoc_STRVAR(reversed_doc, + "D.__reversed__() -- return a reverse iterator over the deque"); static PyMethodDef deque_methods[] = { *************** *** 666,669 **** --- 669,674 ---- {"__reduce__", (PyCFunction)deque_reduce, METH_NOARGS, reduce_doc}, + {"__reversed__", (PyCFunction)deque_reviter, + METH_NOARGS, reversed_doc}, {"rotate", (PyCFunction)deque_rotate, METH_VARARGS, rotate_doc}, *************** *** 728,731 **** --- 733,737 ---- dequeobject *deque; int len; + int counter; } dequeiterobject; *************** *** 745,748 **** --- 751,755 ---- it->deque = deque; it->len = deque->len; + it->counter = deque->len; return (PyObject *)it; } *************** *** 775,782 **** --- 782,801 ---- it->index = 0; } + it->counter--; Py_INCREF(item); return item; } + static int + dequeiter_len(dequeiterobject *it) + { + return it->counter; + } + + static PySequenceMethods dequeiter_as_sequence = { + (inquiry)dequeiter_len, /* sq_length */ + 0, /* sq_concat */ + }; + PyTypeObject dequeiter_type = { PyObject_HEAD_INIT(NULL) *************** *** 793,797 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 812,816 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &dequeiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ *************** *** 812,815 **** --- 831,913 ---- }; + /*********************** Deque Reverse Iterator **************************/ + + PyTypeObject dequereviter_type; + + static PyObject * + deque_reviter(dequeobject *deque) + { + dequeiterobject *it; + + it = PyObject_New(dequeiterobject, &dequereviter_type); + if (it == NULL) + return NULL; + it->b = deque->rightblock; + it->index = deque->rightindex; + Py_INCREF(deque); + it->deque = deque; + it->len = deque->len; + it->counter = deque->len; + return (PyObject *)it; + } + + static PyObject * + dequereviter_next(dequeiterobject *it) + { + PyObject *item; + if (it->b == it->deque->leftblock && it->index < it->deque->leftindex) + return NULL; + + if (it->len != it->deque->len) { + it->len = -1; /* Make this state sticky */ + PyErr_SetString(PyExc_RuntimeError, + "deque changed size during iteration"); + return NULL; + } + + item = it->b->data[it->index]; + it->index--; + if (it->index == -1 && it->b->leftlink != NULL) { + it->b = it->b->leftlink; + it->index = BLOCKLEN - 1; + } + it->counter--; + Py_INCREF(item); + return item; + } + + PyTypeObject dequereviter_type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "deque_reverse_iterator", /* tp_name */ + sizeof(dequeiterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)dequeiter_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + &dequeiter_as_sequence, /* 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)dequereviter_next, /* tp_iternext */ + 0, + }; + /* module level code ********************************************************/ *************** *** 833,836 **** --- 931,937 ---- return; + if (PyType_Ready(&dequereviter_type) < 0) + return; + return; } From l2oocabqim at magicmusic.de Wed Mar 17 10:37:09 2004 From: l2oocabqim at magicmusic.de (Claude Krueger) Date: Thu Mar 18 15:34:21 2004 Subject: [Python-checkins] The 2004 edition of The American Medical Directory geriatrics, anaesthesiology, pxub Message-ID: <2f4nn-pc9$5t$r0$06lt79pwjn-$2@vqysri.p0f> Subjects: physicians, specialists, doctors, licensed doctors, board physicians, emergency physicians, 2004 physicians guide, 2004 physicians directory, physicians contact. EXCLUSIVELY ON CD-ROM. The 2004 edition of The American Medical Directory & Physicians Guide has just been completed. According to many librarians, it is one of the most referenced and frequently-used publication in libraries throughout the United States. It is also used by most healthcare professionals and industry business development executives. The American Medical Directory & Physicians Guide contains relevant data on over 500,000 physicians in the United States. Each record is indexed by such features as name, address, phone/fax, county, year licensed, type of practice, type of physician, as well as primary and secondary specialty. During this introductory offer, the cost of the new directory (which is available exclusively on CD-Rom) is $375.00 (reg. $795). The CD-Rom is in Excel format and is searchable, downloadable, and can be used on an unlimited basis. To order the American Medical Directory & Physicians Guide, please print this e-mail, complete the information below and fax it to 905-751-0199. (tel: 905-751-0919). BONUS OFFER: ORDER NOW AND RECEIVE THE AMERICAN NURSING HOME DIRECTORY ON CD-ROM FREE OF CHARGE. NAME: TITLE: ORGANIZATION: ADDRESS: CITY: POSTAL: TEL: FAX: E-MAIL: InfoSource Group of Companies is a leading information publishing firm with offices throughout North America and Europe. eviwr xyejrocc n ym From rhettinger at users.sourceforge.net Thu Mar 18 17:43:12 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 18 17:52:49 2004 Subject: [Python-checkins] python/dist/src/Objects iterobject.c, 1.16, 1.17 listobject.c, 2.198, 2.199 tupleobject.c, 2.85, 2.86 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28265/Objects Modified Files: iterobject.c listobject.c tupleobject.c Log Message: Make iterators length transparent where possible. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** iterobject.c 25 Jun 2003 13:12:18 -0000 1.16 --- iterobject.c 18 Mar 2004 22:43:09 -0000 1.17 *************** *** 72,75 **** --- 72,88 ---- } + static int + iter_len(seqiterobject *it) + { + if (it->it_seq) + return PyObject_Size(it->it_seq) - it->it_index; + return 0; + } + + static PySequenceMethods iter_as_sequence = { + (inquiry)iter_len, /* sq_length */ + 0, /* sq_concat */ + }; + PyTypeObject PySeqIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 86,90 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 99,103 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &iter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.198 retrieving revision 2.199 diff -C2 -d -r2.198 -r2.199 *** listobject.c 15 Mar 2004 09:01:31 -0000 2.198 --- listobject.c 18 Mar 2004 22:43:09 -0000 2.199 *************** *** 2708,2711 **** --- 2708,2724 ---- } + static int + listiter_len(listiterobject *it) + { + if (it->it_seq) + return PyList_GET_SIZE(it->it_seq) - it->it_index; + return 0; + } + + static PySequenceMethods listiter_as_sequence = { + (inquiry)listiter_len, /* sq_length */ + 0, /* sq_concat */ + }; + PyTypeObject PyListIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 2722,2726 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 2735,2739 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &listiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -d -r2.85 -r2.86 *** tupleobject.c 15 Mar 2004 00:16:34 -0000 2.85 --- tupleobject.c 18 Mar 2004 22:43:10 -0000 2.86 *************** *** 840,843 **** --- 840,856 ---- } + static int + tupleiter_len(tupleiterobject *it) + { + if (it->it_seq) + return PyTuple_GET_SIZE(it->it_seq) - it->it_index; + return 0; + } + + static PySequenceMethods tupleiter_as_sequence = { + (inquiry)tupleiter_len, /* sq_length */ + 0, /* sq_concat */ + }; + PyTypeObject PyTupleIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 854,858 **** 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ --- 867,871 ---- 0, /* tp_repr */ 0, /* tp_as_number */ ! &tupleiter_as_sequence, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ From hyy34qy at net.em.com.br Thu Mar 18 21:11:35 2004 From: hyy34qy at net.em.com.br (Ladonna Rock) Date: Thu Mar 18 20:12:51 2004 Subject: [Python-checkins] Conquer the markets one pick at a time jbbhkoeo tf bshpvyhd Message-ID: Investor Financial Times Report Specializing in Undervalued Small Cap Stocks for Immediate Breakout We have the #1 track record for our most recent recommendations in 2004: DLGI at .27 Currently .88 High 1.69 UP 526% SWYC at .18 Currently 1.38 High 1.98 UP 1000% FPDI at .21 Currently 1.08 High 1.25 UP 495% VDWB at .18 Currently 1.40 High 2.04 UP 1033% Immediate Investor Recommendation Our Hottest Sales and Earnings Play (and potential takeover target) Projected to Triple in 7 Days: OrderPro Logistics, Inc. (OTCBB: OPLO) Price--- .18 Sales '03--- over 2.3 million +2,700% growth over previous year Est. Sales '04--- over 10 million Average PE--- Industry 22-25 7 day target--- .58 30 day target--- .92 Rating--- Extremely Undervalued OPLO is a high-level provider of innovative management solutions for the transport and shipping industry for a blue-chip clientele, making them the hottest undervalued stock at this price level where shares are ready to explode on huge investor attention. Sales have rocketed beyond all estimates for OPLO over the last 12 months with no signs of slowing. The numbers continue to stack-up as present sales figures combined with current acquisition candidates, acquired and in process, total revenues of almost $40 million over the next 24 months. We are not the first to uncover this phenomenon as the stock is under accumulation, but we are acting aggressively on this recently filed data. Major clients include Sears, Office Max, Union Pacific Railroad, NordicTrack, Pacer Global (the logistics company for Ford and General Motors), along with many other large and mid-level corporate giants looking to benefit from the Company's expertise in transportation and supply chain management, freight brokerage services, packaging assessment, and private fleet management. OPLO can be considered a potential candidate to be acquired as their growth and suite of services matches up identically to many companies acquired by UPS and FedEx over the past few years. We are expecting many significant upcoming press releases regarding record-breaking revenues and the completion of extremely profitable acquisitions. OPLO is gaining in all the right categories with perhaps the one that matters most being the rapidly increasing attention from analysts, brokers, and aggressive investors with an eye for value and growth. OPLO has all the ingredients for major profits which is why we are seeing gains of 400% or more for early investors. This stock recommendation carries our highest rating for short-term trading profits. Investor Financial Times Report is an independent newsletter with the goal of giving investors the necessary knowledge to make rational and profitable investment decisions. This publication does not provide an analysis of the company's financial position and is not an offer to buy or sell securities Investing in securities is speculative and carries risk. It is recommended that any investment should be made after consulting with your investment advisor and after reviewing the financial statements of the company. Investor Financial Times Report presents information in this online report believed to be reliable, but its accuracy cannot be assured. Past performance does not insure similar future results. Investor Financial Times Report received four thousand dollars from an unaffiliated third party with respect to the preparation of this special online report as an effort to build investor awareness for OrderPro Logistics. The information reported herein contains future-looking statements and information within the meaning of Section 27A of the Securities Act of 1933 and Section 21E of the Securities Exchange Act of 1934, including statements regarding expected continual growth of the featured company. Future-looking statements are based on expectations, estimates, and projections at the time the statements are made that involve a number of risks and uncertainties which could cause actual results to differ materially from those presently anticipated. afi lotvyxyl r jlbjcnilkgrggr qz From perky at users.sourceforge.net Fri Mar 19 03:06:10 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Fri Mar 19 03:15:51 2004 Subject: [Python-checkins] python/dist/src/Lib/encodings ptcp154.py, NONE, 1.1 aliases.py, 1.23, 1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25582/Lib/encodings Modified Files: aliases.py Added Files: ptcp154.py Log Message: Add a new unicode codec: ptcp154 (Kazakh) --- NEW FILE: ptcp154.py --- """ Python Character Mapping Codec generated from 'PTCP154.txt' with gencodec.py. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. (c) Copyright 2000 Guido van Rossum. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_map) class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter) ### Decoding Map decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ 0x0080: 0x0496, # CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER 0x0081: 0x0492, # CYRILLIC CAPITAL LETTER GHE WITH STROKE 0x0082: 0x04ee, # CYRILLIC CAPITAL LETTER U WITH MACRON 0x0083: 0x0493, # CYRILLIC SMALL LETTER GHE WITH STROKE 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK 0x0085: 0x2026, # HORIZONTAL ELLIPSIS 0x0086: 0x04b6, # CYRILLIC CAPITAL LETTER CHE WITH DESCENDER 0x0087: 0x04ae, # CYRILLIC CAPITAL LETTER STRAIGHT U 0x0088: 0x04b2, # CYRILLIC CAPITAL LETTER HA WITH DESCENDER 0x0089: 0x04af, # CYRILLIC SMALL LETTER STRAIGHT U 0x008a: 0x04a0, # CYRILLIC CAPITAL LETTER BASHKIR KA 0x008b: 0x04e2, # CYRILLIC CAPITAL LETTER I WITH MACRON 0x008c: 0x04a2, # CYRILLIC CAPITAL LETTER EN WITH DESCENDER 0x008d: 0x049a, # CYRILLIC CAPITAL LETTER KA WITH DESCENDER 0x008e: 0x04ba, # CYRILLIC CAPITAL LETTER SHHA 0x008f: 0x04b8, # CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE 0x0090: 0x0497, # CYRILLIC SMALL LETTER ZHE WITH DESCENDER 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK 0x0095: 0x2022, # BULLET 0x0096: 0x2013, # EN DASH 0x0097: 0x2014, # EM DASH 0x0098: 0x04b3, # CYRILLIC SMALL LETTER HA WITH DESCENDER 0x0099: 0x04b7, # CYRILLIC SMALL LETTER CHE WITH DESCENDER 0x009a: 0x04a1, # CYRILLIC SMALL LETTER BASHKIR KA 0x009b: 0x04e3, # CYRILLIC SMALL LETTER I WITH MACRON 0x009c: 0x04a3, # CYRILLIC SMALL LETTER EN WITH DESCENDER 0x009d: 0x049b, # CYRILLIC SMALL LETTER KA WITH DESCENDER 0x009e: 0x04bb, # CYRILLIC SMALL LETTER SHHA 0x009f: 0x04b9, # CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE 0x00a1: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U (Byelorussian) 0x00a2: 0x045e, # CYRILLIC SMALL LETTER SHORT U (Byelorussian) 0x00a3: 0x0408, # CYRILLIC CAPITAL LETTER JE 0x00a4: 0x04e8, # CYRILLIC CAPITAL LETTER BARRED O 0x00a5: 0x0498, # CYRILLIC CAPITAL LETTER ZE WITH DESCENDER 0x00a6: 0x04b0, # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE 0x00a8: 0x0401, # CYRILLIC CAPITAL LETTER IO 0x00aa: 0x04d8, # CYRILLIC CAPITAL LETTER SCHWA 0x00ad: 0x04ef, # CYRILLIC SMALL LETTER U WITH MACRON 0x00af: 0x049c, # CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE 0x00b1: 0x04b1, # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE 0x00b2: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 0x00b3: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 0x00b4: 0x0499, # CYRILLIC SMALL LETTER ZE WITH DESCENDER 0x00b5: 0x04e9, # CYRILLIC SMALL LETTER BARRED O 0x00b8: 0x0451, # CYRILLIC SMALL LETTER IO 0x00b9: 0x2116, # NUMERO SIGN 0x00ba: 0x04d9, # CYRILLIC SMALL LETTER SCHWA 0x00bc: 0x0458, # CYRILLIC SMALL LETTER JE 0x00bd: 0x04aa, # CYRILLIC CAPITAL LETTER ES WITH DESCENDER 0x00be: 0x04ab, # CYRILLIC SMALL LETTER ES WITH DESCENDER 0x00bf: 0x049d, # CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE 0x00c0: 0x0410, # CYRILLIC CAPITAL LETTER A 0x00c1: 0x0411, # CYRILLIC CAPITAL LETTER BE 0x00c2: 0x0412, # CYRILLIC CAPITAL LETTER VE 0x00c3: 0x0413, # CYRILLIC CAPITAL LETTER GHE 0x00c4: 0x0414, # CYRILLIC CAPITAL LETTER DE 0x00c5: 0x0415, # CYRILLIC CAPITAL LETTER IE 0x00c6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE 0x00c7: 0x0417, # CYRILLIC CAPITAL LETTER ZE 0x00c8: 0x0418, # CYRILLIC CAPITAL LETTER I 0x00c9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I 0x00ca: 0x041a, # CYRILLIC CAPITAL LETTER KA 0x00cb: 0x041b, # CYRILLIC CAPITAL LETTER EL 0x00cc: 0x041c, # CYRILLIC CAPITAL LETTER EM 0x00cd: 0x041d, # CYRILLIC CAPITAL LETTER EN 0x00ce: 0x041e, # CYRILLIC CAPITAL LETTER O 0x00cf: 0x041f, # CYRILLIC CAPITAL LETTER PE 0x00d0: 0x0420, # CYRILLIC CAPITAL LETTER ER 0x00d1: 0x0421, # CYRILLIC CAPITAL LETTER ES 0x00d2: 0x0422, # CYRILLIC CAPITAL LETTER TE 0x00d3: 0x0423, # CYRILLIC CAPITAL LETTER U 0x00d4: 0x0424, # CYRILLIC CAPITAL LETTER EF 0x00d5: 0x0425, # CYRILLIC CAPITAL LETTER HA 0x00d6: 0x0426, # CYRILLIC CAPITAL LETTER TSE 0x00d7: 0x0427, # CYRILLIC CAPITAL LETTER CHE 0x00d8: 0x0428, # CYRILLIC CAPITAL LETTER SHA 0x00d9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA 0x00da: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN 0x00db: 0x042b, # CYRILLIC CAPITAL LETTER YERU 0x00dc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN 0x00dd: 0x042d, # CYRILLIC CAPITAL LETTER E 0x00de: 0x042e, # CYRILLIC CAPITAL LETTER YU 0x00df: 0x042f, # CYRILLIC CAPITAL LETTER YA 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU 0x00ff: 0x044f, # CYRILLIC SMALL LETTER YA }) ### Encoding Map encoding_map = codecs.make_encoding_map(decoding_map) Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** aliases.py 20 Jan 2004 09:38:52 -0000 1.23 --- aliases.py 19 Mar 2004 08:06:01 -0000 1.24 *************** *** 397,400 **** --- 397,406 ---- 'dbcs' : 'mbcs', + # ptcp154 codec + 'csptcp154' : 'ptcp154', + 'pt154' : 'ptcp154', + 'cp154' : 'ptcp154', + 'cyrillic-asian' : 'ptcp154', + # quopri_codec codec 'quopri' : 'quopri_codec', From perky at users.sourceforge.net Fri Mar 19 03:06:42 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Fri Mar 19 03:16:21 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25582/Doc/lib Modified Files: libcodecs.tex Log Message: Add a new unicode codec: ptcp154 (Kazakh) Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** libcodecs.tex 17 Jan 2004 14:29:28 -0000 1.27 --- libcodecs.tex 19 Mar 2004 08:06:00 -0000 1.28 *************** *** 830,833 **** --- 830,837 ---- {Turkish} + \lineiii{ptcp154} + {csptcp154, pt154, cp154, cyrillic-asian} + {Kazakh} + \lineiii{shift_jis} {csshiftjis, shiftjis, sjis, s_jis} From perky at users.sourceforge.net Fri Mar 19 03:12:00 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Fri Mar 19 03:21:38 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.948,1.949 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26854 Modified Files: NEWS Log Message: Add an entry for addition of the ptcp154 codec. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.948 retrieving revision 1.949 diff -C2 -d -r1.948 -r1.949 *** NEWS 18 Mar 2004 09:48:12 -0000 1.948 --- NEWS 19 Mar 2004 08:11:56 -0000 1.949 *************** *** 277,280 **** --- 277,282 ---- ------- + - The ptcp154 codec was added for Kazakh character set support. + - Support non-anonymous ftp URLs in urllib2. From rhettinger at users.sourceforge.net Fri Mar 19 05:30:02 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 19 05:39:45 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.156,2.157 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23751 Modified Files: dictobject.c Log Message: Factor out a double lookup. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.156 retrieving revision 2.157 diff -C2 -d -r2.156 -r2.157 *** dictobject.c 18 Mar 2004 08:38:00 -0000 2.156 --- dictobject.c 19 Mar 2004 10:30:00 -0000 2.157 *************** *** 1007,1013 **** mask = mp->ma_mask; for (i = 0, j = 0; i <= mask; i++) { ! if (ep[i].me_value != NULL) { key = ep[i].me_key; - value = ep[i].me_value; item = PyList_GET_ITEM(v, j); Py_INCREF(key); --- 1007,1012 ---- mask = mp->ma_mask; for (i = 0, j = 0; i <= mask; i++) { ! if ((value=ep[i].me_value) != NULL) { key = ep[i].me_key; item = PyList_GET_ITEM(v, j); Py_INCREF(key); From montanaro at users.sourceforge.net Fri Mar 19 10:20:18 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri Mar 19 10:30:00 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.161,1.162 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21799 Modified Files: libfuncs.tex Log Message: Expand on the semantics of reload(). Closes #919099. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** libfuncs.tex 1 Jan 2004 03:41:27 -0000 1.161 --- libfuncs.tex 19 Mar 2004 15:20:16 -0000 1.162 *************** *** 786,790 **** \begin{funcdesc}{reload}{module} ! Re-parse and re-initialize an already imported \var{module}. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module --- 786,790 ---- \begin{funcdesc}{reload}{module} ! Reload a previously imported \var{module}. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module *************** *** 793,797 **** the module object (the same as the \var{module} argument). ! There are a number of caveats: If a module is syntactically correct but its initialization fails, --- 793,819 ---- the module object (the same as the \var{module} argument). ! When \code{reload(module)} is executed: ! ! \begin{itemize} ! ! \item{Python modules' code is recompiled and the module-level code ! reexecuted, defining a new set of objects which are bound to names in ! the module's dictionary. The \code{init} function of extension ! modules is not called a second time.} ! ! \item{As with all other objects in Python the old objects are only ! reclaimed after their reference counts drop to zero.} ! ! \item{The names in the module namespace are updated to point to ! any new or changed objects.} ! ! \item{Other references to the old objects (such as names external ! to the module) are not rebound to refer to the new objects and ! must be updated in each namespace where they occur if that is ! desired.} ! ! \end{itemize} ! ! There are a number of other caveats: If a module is syntactically correct but its initialization fails, From fdrake at users.sourceforge.net Fri Mar 19 10:22:39 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Mar 19 10:32:21 2004 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22396 Modified Files: fileobject.c Log Message: PyFile_WriteObject(): some of the local variables are only used when Py_USING_UNICODE is defined Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** fileobject.c 7 Feb 2004 13:53:46 -0000 2.187 --- fileobject.c 19 Mar 2004 15:22:36 -0000 2.188 *************** *** 2006,2011 **** --- 2006,2013 ---- else if (PyFile_Check(f)) { FILE *fp = PyFile_AsFile(f); + #ifdef Py_USING_UNICODE PyObject *enc = ((PyFileObject*)f)->f_encoding; int result; + #endif if (fp == NULL) { err_closed(); From fdrake at users.sourceforge.net Fri Mar 19 10:23:16 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Mar 19 10:32:57 2004 Subject: [Python-checkins] python/dist/src/Objects fileobject.c, 2.179.8.4, 2.179.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22559 Modified Files: Tag: release23-maint fileobject.c Log Message: PyFile_WriteObject(): some of the local variables are only used when Py_USING_UNICODE is defined Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.179.8.4 retrieving revision 2.179.8.5 diff -C2 -d -r2.179.8.4 -r2.179.8.5 *** fileobject.c 18 Oct 2003 09:37:12 -0000 2.179.8.4 --- fileobject.c 19 Mar 2004 15:23:14 -0000 2.179.8.5 *************** *** 2075,2080 **** --- 2075,2082 ---- else if (PyFile_Check(f)) { FILE *fp = PyFile_AsFile(f); + #ifdef Py_USING_UNICODE PyObject *enc = ((PyFileObject*)f)->f_encoding; int result; + #endif if (fp == NULL) { err_closed(); From pje at users.sourceforge.net Fri Mar 19 15:48:15 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 15:58:02 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30744/setuptools Log Message: Directory /cvsroot/python/python/nondist/sandbox/setuptools added to the repository From pje at users.sourceforge.net Fri Mar 19 15:50:37 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:00:23 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31254/setuptools Log Message: Directory /cvsroot/python/python/nondist/sandbox/setuptools/setuptools added to the repository From pje at users.sourceforge.net Fri Mar 19 15:51:01 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:00:49 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31342/setuptools/command Log Message: Directory /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command added to the repository From pje at users.sourceforge.net Fri Mar 19 15:51:06 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:00:53 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31342/setuptools/tests Log Message: Directory /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests added to the repository From pje at users.sourceforge.net Fri Mar 19 15:53:16 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:06:09 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools TODO.txt, NONE, 1.1 setup.py, NONE, 1.1 setuptools_boot.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31783 Added Files: TODO.txt setup.py setuptools_boot.py Log Message: Initial checkin of setuptools 0.0.1. --- NEW FILE: TODO.txt --- To-Do * Automatic download and installation of dependencies * install_deps command (install runtime dependencies) * compute child command line, abort if user specified incompatible options * OPEN ISSUE: should parent install command include child install's files? * Dependency class * Check for presence/version via file existence, regular expression match, version comparison (using 'distutils.version' classes), installed on sys.path, or require just installation directory * Find appropriate release, or explain why not * Base URL(s) and distribution name * Release class * Distro type - source v. binary (determine via extension?) * Platform requirements, whether compiler needed (how can we check?) * Download URL, default from extension + dependency * Download + extract to target dir * run child install * build_deps command (install build-time dependencies) * Build and install documentation sets * Installation database similar to PEP 262 * Needs to write file *before* installing anything, so an aborted install can be uninstalled. Possibly should use 'unknown' for all metadata, then replace with real metadata once it's known. * REQUIRES should probably just be list of dependencies * Bootstrap module The idea here is that you include the "bootstrap module" in your distribution, and it downloads the right version of setuptools automatically if a good-enough version isn't on sys.path. This would let you use setuptools for your installer, without having to distribute the full setuptools package. This would might look something like:: from boot_setuptools import require_version require_version("0.6", "http://somewhere/setuptools-0.6.tar.gz") from setuptools import setup, Feature, findPackages # ...etc --- NEW FILE: setup.py --- #!/usr/bin/env python """Distutils setup file, used to install or test 'setuptools'""" from setuptools import setup, find_packages, Require setup( name="setuptools", version="0.0.1", description="Distutils enhancements", author="Phillip J. Eby", author_email="peak@eby-sarna.com", license="PSF or ZPL", test_suite = 'setuptools.tests.test_suite', requires = [Require('Distutils','1.0.3','distutils')], packages = find_packages(), py_modules = ['setuptools_boot'], ) --- NEW FILE: setuptools_boot.py --- """Bootstrap module to download/quasi-install 'setuptools' package Usage:: from setuptools_boot import require_version require_version('0.0.1') from setuptools import setup, Extension, ... Note that if a suitable version of 'setuptools' is not found on 'sys.path', it will be downloaded and installed to the current directory. This means that if you are using 'setuptools.find_packages()' in the same directory, you will need to exclude the setuptools package from the distribution (unless you want setuptools to be installed as part of your distribution). To do this, you can simply use: setup( # ... packages = [pkg for pkg in find_packages() if not pkg.startswith('setuptools') ], # ... ) to eliminate the setuptools packages from consideration. However, if you are using a 'lib' or 'src' directory to contain your distribution's packages, this will not be an issue. """ from distutils.version import StrictVersion from distutils.util import convert_path import os.path __all__ = ['require_version'] def require_version(version='0.0.1', dlbase='file:../../setuptools/dist'): """Request to use setuptools of specified version 'dlbase', if provided, is the base URL that should be used to download a particular version of setuptools. '/setuptools-VERSION.zip' will be added to 'dlbase' to construct the download URL, if a download is needed. XXX current dlbase works for local testing only """ if StrictVersion(version) > get_installed_version(): unload_setuptools() download_setuptools(version,dlbase) if StrictVersion(version) > get_installed_version(): # Should never get here raise SystemExit( "Downloaded new version of setuptools, but it's not on sys.path" ) def get_installed_version(): """Return version of currently-installed setuptools, or '"0.0.0"'""" try: from setuptools import __version__ return __version__ except ImportError: return '0.0.0' def download_setuptools(version,dlbase): """Download setuptools-VERSION.zip from dlbase and extract in local dir""" basename = 'setuptools-%s' % version filename = basename+'.zip' url = '%s/%s' % (dlbase,filename) download_file(url,filename) extract_zipdir(filename,basename+'/setuptools','setuptools') def unload_setuptools(): """Unload the current (outdated) 'setuptools' version from memory""" import sys for k in sys.modules.keys(): if k.startswith('setuptools.') or k=='setuptools': del sys.modules[k] def download_file(url,filename): """Download 'url', saving to 'filename'""" from urllib2 import urlopen f = urlopen(url); bytes = f.read(); f.close() f = open(filename,'wb'); f.write(bytes); f.close() def extract_zipdir(filename,zipdir,targetdir): """Unpack zipfile 'filename', extracting 'zipdir' to 'targetdir'""" from zipfile import ZipFile f = ZipFile(filename) if zipdir and not zipdir.endswith('/'): zipdir+='/' plen = len(zipdir) paths = [ path for path in f.namelist() if path.startswith(zipdir) and not path.endswith('/') ] paths.sort() paths.reverse() # unpack in reverse order so __init__ goes last! for path in paths: out = os.path.join(targetdir,convert_path(path[plen:])) dir = os.path.dirname(out) if not os.path.isdir(dir): os.makedirs(dir) out=open(out,'wb'); out.write(f.read(path)); out.close() f.close() From pje at users.sourceforge.net Fri Mar 19 15:53:16 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:06:12 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command __init__.py, NONE, 1.1 build_ext.py, NONE, 1.1 build_py.py, NONE, 1.1 depends.py, NONE, 1.1 install.py, NONE, 1.1 install_lib.py, NONE, 1.1 test.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31783/setuptools/command Added Files: __init__.py build_ext.py build_py.py depends.py install.py install_lib.py test.py Log Message: Initial checkin of setuptools 0.0.1. --- NEW FILE: __init__.py --- import distutils.command __all__ = ['test', 'depends'] # Make our commands available as though they were part of the distutils distutils.command.__path__.extend(__path__) distutils.command.__all__.extend( [cmd for cmd in __all__ if cmd not in distutils.command.__all__] ) --- NEW FILE: build_ext.py --- # Attempt to use Pyrex for building extensions, if available try: from Pyrex.Distutils.build_ext import build_ext except ImportError: from distutils.command.build_ext import build_ext --- NEW FILE: build_py.py --- from distutils.command.build_py import build_py as _build_py from distutils.util import convert_path from glob import glob import os.path class build_py(_build_py): """Enhanced 'build_py' command that includes data files with packages The data files are specified via a 'package_data' argument to 'setup()'. See 'setuptools.dist.Distribution' for more details. Also, this version of the 'build_py' command allows you to specify both 'py_modules' and 'packages' in the same setup operation. """ def finalize_options(self): _build_py.finalize_options(self) self.package_data = self.distribution.package_data self.data_files = self.get_data_files() def run(self): """Build modules, packages, and copy data files to build directory""" if not self.py_modules and not self.packages: return if self.py_modules: self.build_modules() if self.packages: self.build_packages() self.build_package_data() # Only compile actual .py files, using our base class' idea of what our # output files are. self.byte_compile(_build_py.get_outputs(self,include_bytecode=0)) def get_data_files(self): """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" data = [] for package in self.packages: # Locate package source directory src_dir = self.get_package_dir(package) # Compute package build directory build_dir = os.path.join(*([self.build_lib]+package.split('.'))) # Length of path to strip from found files plen = len(src_dir)+1 # Strip directory from globbed filenames filenames = [ file[plen:] for file in self.find_data_files(package, src_dir) ] data.append( (package, src_dir, build_dir, filenames) ) return data def find_data_files(self, package, src_dir): """Return filenames for package's data files in 'src_dir'""" globs = self.package_data.get('',[])+self.package_data.get(package,[]) files = [] for pattern in globs: # Each pattern has to be converted to a platform-specific path files.extend(glob(os.path.join(src_dir, convert_path(pattern)))) return files def build_package_data(self): """Copy data files into build directory""" lastdir = None for package, src_dir, build_dir, filenames in self.data_files: for filename in filenames: target = os.path.join(build_dir,filename) self.mkpath(os.path.dirname(target)) self.copy_file(os.path.join(src_dir,filename), target) def get_outputs(self, include_bytecode=1): """Return complete list of files copied to the build directory This includes both '.py' files and data files, as well as '.pyc' and '.pyo' files if 'include_bytecode' is true. (This method is needed for the 'install_lib' command to do its job properly, and to generate a correct installation manifest.) """ return _build_py.get_outputs(self,include_bytecode) + [ os.path.join(build_dir,filename) for package,src_dir,build_dir,filenames in self.data_files for filename in filenames ] --- NEW FILE: depends.py --- from distutils.cmd import Command import os class depends(Command): """Download and install dependencies, if needed""" description = "download and install dependencies, if needed" user_options = [ ('temp=', 't', "directory where dependencies will be downloaded and built"), ('ignore-extra-args', 'i', "ignore options that won't be passed to child setup scripts"), ] def initialize_options(self): self.temp = None self.install_purelib = self.install_platlib = None self.install_lib = self.install_libbase = None self.install_scripts = self.install_data = self.install_headers = None self.compiler = self.debug = self.force = None def finalize_options(self): self.set_undefined_options('build',('build_temp', 'temp')) def run(self): self.announce("downloading and building here") --- NEW FILE: install.py --- from distutils.command.install import install as _install class install(_install): """Build dependencies before installation""" def has_dependencies(self): return self.distribution.has_dependencies() sub_commands = [('depends',has_dependencies)] + _install.sub_commands --- NEW FILE: install_lib.py --- from distutils.command.install_lib import install_lib as _install_lib class install_lib(_install_lib): """Don't add compiled flags to filenames of non-Python files""" def _bytecode_filenames (self, py_filenames): bytecode_files = [] for py_file in py_filenames: if not py_file.endswith('.py'): continue if self.compile: bytecode_files.append(py_file + "c") if self.optimize > 0: bytecode_files.append(py_file + "o") return bytecode_files --- NEW FILE: test.py --- from distutils.cmd import Command from distutils.errors import DistutilsOptionError import sys class test(Command): """Command to run unit tests after installation""" description = "run unit tests after installation" user_options = [ ('test-module=','m', "Run 'test_suite' in specified module"), ('test-suite=','s', "Test suite to run (e.g. 'some_module.test_suite')"), ] test_suite = None test_module = None def initialize_options(self): pass def finalize_options(self): if self.test_suite is None: if self.test_module is None: self.test_suite = self.distribution.test_suite else: self.test_suite = self.test_module+".test_suite" elif self.test_module: raise DistutilsOptionError( "You may specify a module or a suite, but not both" ) self.test_args = [self.test_suite] if self.verbose: self.test_args.insert(0,'--verbose') def run(self): # Install before testing self.run_command('install') if self.test_suite: cmd = ' '.join(self.test_args) if self.dry_run: self.announce('skipping "unittest %s" (dry run)' % cmd) else: self.announce('running "unittest %s"' % cmd) import unittest unittest.main(None, None, [unittest.__file__]+self.test_args) From pje at users.sourceforge.net Fri Mar 19 15:53:16 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:06:15 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, NONE, 1.1 depends.py, NONE, 1.1 dist.py, NONE, 1.1 extension.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31783/setuptools Added Files: __init__.py depends.py dist.py extension.py Log Message: Initial checkin of setuptools 0.0.1. --- NEW FILE: __init__.py --- """Extensions to the 'distutils' for large or complex distributions""" import distutils.core, setuptools.command from setuptools.dist import Distribution, Feature from setuptools.extension import Extension from setuptools.depends import Require from distutils.core import Command from distutils.util import convert_path import os.path __version__ = '0.0.1' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' ] def find_packages(where='.'): """Return a list all Python packages found within directory 'where' 'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. """ out = [] stack=[(convert_path(where), '')] while stack: where,prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where,name) if (os.path.isdir(fn) and os.path.isfile(os.path.join(fn,'__init__.py')) ): out.append(prefix+name); stack.append((fn,prefix+name+'.')) return out def setup(**attrs): """Do package setup This function takes the same arguments as 'distutils.core.setup()', except that the default distribution class is 'setuptools.dist.Distribution'. See that class' documentation for details on the new keyword arguments that it makes available via this function. """ attrs.setdefault("distclass",Distribution) return distutils.core.setup(**attrs) --- NEW FILE: depends.py --- from __future__ import generators import sys, imp, marshal from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN from distutils.version import StrictVersion, LooseVersion __all__ = [ 'Require', 'find_module', 'get_module_constant', 'extract_constant' ] class Require: """A prerequisite to building or installing a distribution""" def __init__(self,name,requested_version,module,attribute=None,format=None): if format is None and requested_version is not None: format = StrictVersion if format is not None: requested_version = format(requested_version) if attribute is None: attribute = '__version__' self.name = name self.requested_version = requested_version self.module = module self.attribute = attribute self.format = format def get_version(self, paths=None, default="unknown"): """Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. The version is formatted according to the requirement's version format (if any), unless it is 'None' or the supplied 'default'. """ if self.attribute is None: try: f,p,i = find_module(self.module,paths) if f: f.close() return default except ImportError: return None v = get_module_constant(self.module,self.attribute,default,paths) if v is not None and v is not default and self.format is not None: return self.format(v) return v def is_present(self,paths=None): """Return true if dependency is present on 'paths'""" return self.get_version(paths) is not None def is_current(self,paths=None): """Return true if dependency is present and up-to-date on 'paths'""" version = self.get_version(paths) if version is None: return False return self.attribute is None or self.format is None or \ version >= self.requested_version def _iter_code(code): """Yield '(op,arg)' pair for each operation in code object 'code'""" from array import array from dis import HAVE_ARGUMENT, EXTENDED_ARG bytes = array('b',code.co_code) eof = len(code.co_code) ptr = 0 extended_arg = 0 while ptr=HAVE_ARGUMENT: arg = bytes[ptr+1] + bytes[ptr+2]*256 + extended_arg ptr += 3 if op==EXTENDED_ARG: extended_arg = arg * 65536L continue else: arg = None ptr += 1 yield op,arg def find_module(module, paths=None): """Just like 'imp.find_module()', but with package support""" parts = module.split('.') while parts: part = parts.pop(0) f, path, (suffix,mode,kind) = info = imp.find_module(part, paths) if kind==PKG_DIRECTORY: parts = parts or ['__init__'] paths = [path] elif parts: raise ImportError("Can't find %r in %s" % (parts,module)) return info def get_module_constant(module, symbol, default=-1, paths=None): """Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.""" try: f, path, (suffix,mode,kind) = find_module(module,paths) except ImportError: # Module doesn't exist return None try: if kind==PY_COMPILED: f.read(8) # skip magic & date code = marshal.load(f) elif kind==PY_FROZEN: code = imp.get_frozen_object(module) elif kind==PY_SOURCE: code = compile(f.read(), path, 'exec') else: # Not something we can parse; we'll have to import it. :( if module not in sys.modules: imp.load_module(module,f,path,(suffix,mode,kind)) return getattr(sys.modules[module],symbol,None) finally: if f: f.close() return extract_constant(code,symbol,default) def extract_constant(code,symbol,default=-1): """Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'. """ if symbol not in code.co_names: # name's not there, can't possibly be an assigment return None name_idx = list(code.co_names).index(symbol) STORE_NAME = 90 STORE_GLOBAL = 97 LOAD_CONST = 100 const = default for op, arg in _iter_code(code): if op==LOAD_CONST: const = code.co_consts[arg] elif arg==name_idx and (op==STORE_NAME or op==STORE_GLOBAL): return const else: const = default --- NEW FILE: dist.py --- __all__ = ['Distribution', 'Feature'] from distutils.core import Distribution as _Distribution from distutils.core import Extension from setuptools.command.build_py import build_py from setuptools.command.build_ext import build_ext from setuptools.command.install import install from setuptools.command.install_lib import install_lib from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.errors import DistutilsSetupError sequence = tuple, list class Distribution(_Distribution): """Distribution with support for features, tests, and package data This is an enhanced version of 'distutils.dist.Distribution' that effectively adds the following new optional keyword arguments to 'setup()': 'features' -- a dictionary mapping option names to 'setuptools.Feature' objects. Features are a portion of the distribution that can be included or excluded based on user options, inter-feature dependencies, and availability on the current system. Excluded features are omitted from all setup commands, including source and binary distributions, so you can create multiple distributions from the same source tree. Feature names should be valid Python identifiers, except that they may contain the '-' (minus) sign. Features can be included or excluded via the command line options '--with-X' and '--without-X', where 'X' is the name of the feature. Whether a feature is included by default, and whether you are allowed to control this from the command line, is determined by the Feature object. See the 'Feature' class for more information. 'test_suite' -- the name of a test suite to run for the 'test' command. If the user runs 'python setup.py test', the package will be installed, and the named test suite will be run. The format is the same as would be used on a 'unittest.py' command line. That is, it is the dotted name of an object to import and call to generate a test suite. 'package_data' -- a dictionary mapping package names to lists of filenames or globs to use to find data files contained in the named packages. If the dictionary has filenames or globs listed under '""' (the empty string), those names will be searched for in every package, in addition to any names for the specific package. Data files found using these names/globs will be installed along with the package, in the same location as the package. Note that globs are allowed to reference the contents of non-package subdirectories, as long as you use '/' as a path separator. (Globs are automatically converted to platform-specific paths at runtime.) In addition to these new keywords, this class also has several new methods for manipulating the distribution's contents. For example, the 'include()' and 'exclude()' methods can be thought of as in-place add and subtract commands that add or remove packages, modules, extensions, and so on from the distribution. They are used by the feature subsystem to configure the distribution for the included and excluded features. """ def __init__ (self, attrs=None): self.features = {} self.package_data = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext',build_ext) self.cmdclass.setdefault('install',install) self.cmdclass.setdefault('install_lib',install_lib) if self.features: self._set_global_opts_from_features() def parse_command_line(self): """Process features after parsing command line options""" result = _Distribution.parse_command_line(self) if self.features: self._finalize_features() return result def _feature_attrname(self,name): """Convert feature name to corresponding option attribute name""" return 'with_'+name.replace('-','_') def _set_global_opts_from_features(self): """Add --with-X/--without-X options based on optional features""" go = [] no = self.negative_opt.copy() for name,feature in self.features.items(): self._set_feature(name,None) feature.validate(self) if feature.optional: descr = feature.description incdef = ' (default)' excdef='' if not feature.include_by_default(): excdef, incdef = incdef, excdef go.append(('with-'+name, None, 'include '+descr+incdef)) go.append(('without-'+name, None, 'exclude '+descr+excdef)) no['without-'+name] = 'with-'+name self.global_options = self.feature_options = go + self.global_options self.negative_opt = self.feature_negopt = no def _finalize_features(self): """Add/remove features and resolve dependencies between them""" # First, flag all the enabled items (and thus their dependencies) for name,feature in self.features.items(): enabled = self.feature_is_included(name) if enabled or (enabled is None and feature.include_by_default()): feature.include_in(self) self._set_feature(name,1) # Then disable the rest, so that off-by-default features don't # get flagged as errors when they're required by an enabled feature for name,feature in self.features.items(): if not self.feature_is_included(name): feature.exclude_from(self) self._set_feature(name,0) def _set_feature(self,name,status): """Set feature's inclusion status""" setattr(self,self._feature_attrname(name),status) def feature_is_included(self,name): """Return 1 if feature is included, 0 if excluded, 'None' if unknown""" return getattr(self,self._feature_attrname(name)) def include_feature(self,name): """Request inclusion of feature named 'name'""" if self.feature_is_included(name)==0: descr = self.features[name].description raise DistutilsOptionError( descr + " is required, but was excluded or is not available" ) self.features[name].include_in(self) self._set_feature(name,1) def include(self,**attrs): """Add items to distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for attributes that are lists or tuples. If you need to add support for adding to other attributes in this or a subclass, you can add an '_include_X' method, where 'X' is the name of the attribute. The method will be called with the value passed to 'include()'. So, 'dist.include(foo={"bar":"baz"})' will try to call 'dist._include_foo({"bar":"baz"})', which can then handle whatever special inclusion logic is needed. """ for k,v in attrs.items(): include = getattr(self, '_include_'+k, None) if include: include(v) else: self._include_misc(k,v) def exclude_package(self,package): """Remove packages, modules, and extensions in named package""" pfx = package+'.' if self.packages: self.packages = [ p for p in self.packages if p<>package and not p.startswith(pfx) ] if self.py_modules: self.py_modules = [ p for p in self.py_modules if p<>package and not p.startswith(pfx) ] if self.ext_modules: self.ext_modules = [ p for p in self.ext_modules if p.name<>package and not p.name.startswith(pfx) ] def has_contents_for(self,package): """Return true if 'exclude_package(package)' would do something""" pfx = package+'.' for p in self.packages or (): if p==package or p.startswith(pfx): return True for p in self.py_modules or (): if p==package or p.startswith(pfx): return True for p in self.ext_modules or (): if p.name==package or p.name.startswith(pfx): return True def _exclude_misc(self,name,value): """Handle 'exclude()' for list/tuple attrs without a special handler""" if not isinstance(value,sequence): raise DistutilsSetupError( "%s: setting must be a list or tuple (%r)" % (name, value) ) try: old = getattr(self,name) except AttributeError: raise DistutilsSetupError( "%s: No such distribution setting" % name ) if old is not None and not isinstance(old,sequence): raise DistutilsSetupError( name+": this setting cannot be changed via include/exclude" ) elif old: setattr(self,name,[item for item in old if item not in value]) def _include_misc(self,name,value): """Handle 'include()' for list/tuple attrs without a special handler""" if not isinstance(value,sequence): raise DistutilsSetupError( "%s: setting must be a list (%r)" % (name, value) ) try: old = getattr(self,name) except AttributeError: raise DistutilsSetupError( "%s: No such distribution setting" % name ) if old is None: setattr(self,name,value) elif not isinstance(old,sequence): raise DistutilsSetupError( name+": this setting cannot be changed via include/exclude" ) else: setattr(self,name,old+[item for item in value if item not in old]) def exclude(self,**attrs): """Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package's contained packages, modules, and extensions are also excluded. Currently, this method only supports exclusion from attributes that are lists or tuples. If you need to add support for excluding from other attributes in this or a subclass, you can add an '_exclude_X' method, where 'X' is the name of the attribute. The method will be called with the value passed to 'exclude()'. So, 'dist.exclude(foo={"bar":"baz"})' will try to call 'dist._exclude_foo({"bar":"baz"})', which can then handle whatever special exclusion logic is needed. """ for k,v in attrs.items(): exclude = getattr(self, '_exclude_'+k, None) if exclude: exclude(v) else: self._exclude_misc(k,v) def _exclude_packages(self,packages): if not isinstance(packages,sequence): raise DistutilsSetupError( "packages: setting must be a list or tuple (%r)" % (packages,) ) map(self.exclude_package, packages) def _parse_command_opts(self, parser, args): # Remove --with-X/--without-X options when processing command args self.global_options = self.__class__.global_options self.negative_opt = self.__class__.negative_opt return _Distribution._parse_command_opts(self, parser, args) def has_dependencies(self): return not not self.requires class Feature: """A subset of the distribution that can be excluded if unneeded/wanted Features are created using these keyword arguments: 'description' -- a short, human readable description of the feature, to be used in error messages, and option help messages. 'standard' -- if true, the feature is included by default if it is available on the current system. Otherwise, the feature is only included if requested via a command line '--with-X' option, or if another included feature requires it. The default setting is 'False'. 'available' -- if true, the feature is available for installation on the current system. The default setting is 'True'. 'optional' -- if true, the feature's inclusion can be controlled from the command line, using the '--with-X' or '--without-X' options. If false, the feature's inclusion status is determined automatically, based on 'availabile', 'standard', and whether any other feature requires it. The default setting is 'True'. 'requires' -- a string or sequence of strings naming features that should also be included if this feature is included. Defaults to empty list. 'remove' -- a string or list of strings naming packages to be removed from the distribution if this feature is *not* included. If the feature *is* included, this argument is ignored. This argument exists to support removing features that "crosscut" a distribution, such as defining a 'tests' feature that removes all the 'tests' subpackages provided by other features. The default for this argument is an empty list. (Note: the named package(s) or modules must exist in the base distribution when the 'setup()' function is initially called.) other keywords -- any other keyword arguments are saved, and passed to the distribution's 'include()' and 'exclude()' methods when the feature is included or excluded, respectively. So, for example, you could pass 'packages=["a","b"]' to cause packages 'a' and 'b' to be added or removed from the distribution as appropriate. A feature must include at least one 'requires', 'remove', or other keyword argument. Otherwise, it can't affect the distribution in any way. Note also that you can subclass 'Feature' to create your own specialized feature types that modify the distribution in other ways when included or excluded. See the docstrings for the various methods here for more detail. Aside from the methods, the only feature attributes that distributions look at are 'description' and 'optional'. """ def __init__(self, description, standard=False, available=True, optional=True, requires=(), remove=(), **extras ): self.description = description self.standard = standard self.available = available self.optional = optional if isinstance(requires,str): requires = requires, self.requires = requires if isinstance(remove,str): remove = remove, self.remove = remove self.extras = extras if not remove and not requires and not extras: raise DistutilsSetupError( "Feature %s: must define 'requires', 'remove', or at least one" " of 'packages', 'py_modules', etc." ) def include_by_default(self): """Should this feature be included by default?""" return self.available and self.standard def include_in(self,dist): """Ensure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent. """ if not self.available: raise DistutilsPlatformError( self.description+" is required," "but is not available on this platform" ) dist.include(**self.extras) for f in self.requires: dist.include_feature(f) def exclude_from(self,dist): """Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to include themselves. """ dist.exclude(**self.extras) if self.remove: for item in self.remove: dist.exclude_package(item) def validate(self,dist): """Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present in the base distribution when 'setup()' is called. You may override it in a subclass to perform any other required validation of the feature against a target distribution. """ for item in self.remove: if not dist.has_contents_for(item): raise DistutilsSetupError( "%s wants to be able to remove %s, but the distribution" " doesn't contain any packages or modules under %s" % (self.description, item, item) ) --- NEW FILE: extension.py --- from distutils.core import Extension as _Extension try: from Pyrex.Distutils.build_ext import build_ext except ImportError: # Pyrex isn't around, so fix up the sources class Extension(_Extension): """Extension that uses '.c' files in place of '.pyx' files""" def __init__(self,*args,**kw): _Extension.__init__(self,*args,**kw) sources = [] for s in self.sources: if s.endswith('.pyx'): sources.append(s[:-3]+'c') else: sources.append(s) self.sources = sources else: # Pyrex is here, just use regular extension type Extension = _Extension From pje at users.sourceforge.net Fri Mar 19 15:53:16 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Fri Mar 19 16:06:18 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests __init__.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31783/setuptools/tests Added Files: __init__.py Log Message: Initial checkin of setuptools 0.0.1. --- NEW FILE: __init__.py --- """Tests for the 'setuptools' package""" from unittest import TestSuite, TestCase, makeSuite import distutils.core, distutils.cmd from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.errors import DistutilsSetupError import setuptools, setuptools.dist from setuptools import Feature from distutils.core import Extension from setuptools.depends import extract_constant, get_module_constant from setuptools.depends import find_module, Require from distutils.version import StrictVersion, LooseVersion import sys, os.path def makeSetup(**args): """Return distribution from 'setup(**args)', without executing commands""" distutils.core._setup_stop_after = "commandline" # Don't let system command line leak into tests! args.setdefault('script_args',['install']) try: return setuptools.setup(**args) finally: distutils.core_setup_stop_after = None class DependsTests(TestCase): def testExtractConst(self): from setuptools.depends import extract_constant def f1(): global x,y,z x = "test" y = z # unrecognized name self.assertEqual(extract_constant(f1.func_code,'q', -1), None) # constant assigned self.assertEqual(extract_constant(f1.func_code,'x', -1), "test") # expression assigned self.assertEqual(extract_constant(f1.func_code,'y', -1), -1) # recognized name, not assigned self.assertEqual(extract_constant(f1.func_code,'z', -1), None) def testFindModule(self): self.assertRaises(ImportError, find_module, 'no-such.-thing') self.assertRaises(ImportError, find_module, 'setuptools.non-existent') f,p,i = find_module('setuptools.tests'); f.close() def testModuleExtract(self): from distutils import __version__ self.assertEqual( get_module_constant('distutils','__version__'), __version__ ) self.assertEqual( get_module_constant('sys','version'), sys.version ) self.assertEqual( get_module_constant('setuptools.tests','__doc__'),__doc__ ) def testDependsCmd(self): dist = makeSetup() cmd = dist.get_command_obj('depends') cmd.ensure_finalized() self.assertEqual(cmd.temp, dist.get_command_obj('build').build_temp) self.assertEqual(cmd.install_lib, dist.get_command_obj('install').install_lib) def testRequire(self): req = Require('Distutils','1.0.3','distutils') self.assertEqual(req.name, 'Distutils') self.assertEqual(req.module, 'distutils') self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') from distutils import __version__ self.assertEqual(req.get_version(), __version__) self.failUnless(req.is_present()) self.failUnless(req.is_current()) req = Require('Distutils 3000','03000','distutils',format=LooseVersion) self.failUnless(req.is_present()) self.failIf(req.is_current()) req = Require('Do-what-I-mean','1.0','d-w-i-m') self.failIf(req.is_present()) self.failIf(req.is_current()) req = Require('Tests', None, 'tests') self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) paths = [os.path.dirname(p) for p in __path__] self.failUnless(req.is_present(paths)) self.failUnless(req.is_current(paths)) class DistroTests(TestCase): def setUp(self): self.e1 = Extension('bar.ext',['bar.c']) self.e2 = Extension('c.y', ['y.c']) self.dist = makeSetup( packages=['a', 'a.b', 'a.b.c', 'b', 'c'], py_modules=['b.d','x'], ext_modules = (self.e1, self.e2), package_dir = {}, ) def testDistroType(self): self.failUnless(isinstance(self.dist,setuptools.dist.Distribution)) def testExcludePackage(self): self.dist.exclude_package('a') self.assertEqual(self.dist.packages, ['b','c']) self.dist.exclude_package('b') self.assertEqual(self.dist.packages, ['c']) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1, self.e2]) self.dist.exclude_package('c') self.assertEqual(self.dist.packages, []) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1]) # test removals from unspecified options makeSetup().exclude_package('x') def testIncludeExclude(self): # remove an extension self.dist.exclude(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2]) # add it back in self.dist.include(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2, self.e1]) # should not add duplicate self.dist.include(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2, self.e1]) def testExcludePackages(self): self.dist.exclude(packages=['c','b','a']) self.assertEqual(self.dist.packages, []) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1]) def testEmpty(self): dist = makeSetup() dist.include(packages=['a'], py_modules=['b'], ext_modules=[self.e2]) dist = makeSetup() dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2]) def testContents(self): self.failUnless(self.dist.has_contents_for('a')) self.dist.exclude_package('a') self.failIf(self.dist.has_contents_for('a')) self.failUnless(self.dist.has_contents_for('b')) self.dist.exclude_package('b') self.failIf(self.dist.has_contents_for('b')) self.failUnless(self.dist.has_contents_for('c')) self.dist.exclude_package('c') self.failIf(self.dist.has_contents_for('c')) def testInvalidIncludeExclude(self): self.assertRaises(DistutilsSetupError, self.dist.include, nonexistent_option='x' ) self.assertRaises(DistutilsSetupError, self.dist.exclude, nonexistent_option='x' ) self.assertRaises(DistutilsSetupError, self.dist.include, packages={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.exclude, packages={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.include, ext_modules={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.exclude, ext_modules={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.include, package_dir=['q'] ) self.assertRaises(DistutilsSetupError, self.dist.exclude, package_dir=['q'] ) class FeatureTests(TestCase): def setUp(self): self.dist = makeSetup( features={ 'foo': Feature("foo",standard=True,requires='baz'), 'bar': Feature("bar", standard=True, packages=['pkg.bar'], py_modules=['bar_et'], remove=['bar.ext'], ), 'baz': Feature( "baz", optional=False, packages=['pkg.baz'], scripts = ['scripts/baz_it'], libraries=[('libfoo','foo/foofoo.c')] ), 'dwim': Feature("DWIM", available=False, remove='bazish'), }, script_args=['--without-bar', 'install'], packages = ['pkg.bar', 'pkg.foo'], py_modules = ['bar_et', 'bazish'], ext_modules = [Extension('bar.ext',['bar.c'])] ) def testDefaults(self): self.failIf( Feature( "test",standard=True,remove='x',available=False ).include_by_default() ) self.failUnless( Feature("test",standard=True,remove='x').include_by_default() ) # Feature must have either kwargs, removes, or requires self.assertRaises(DistutilsSetupError, Feature, "test") def testAvailability(self): self.assertRaises( DistutilsPlatformError, self.dist.features['dwim'].include_in, self.dist ) def testFeatureOptions(self): dist = self.dist self.failUnless( ('with-dwim',None,'include DWIM') in dist.feature_options ) self.failUnless( ('without-dwim',None,'exclude DWIM (default)') in dist.feature_options ) self.failUnless( ('with-bar',None,'include bar (default)') in dist.feature_options ) self.failUnless( ('without-bar',None,'exclude bar') in dist.feature_options ) self.assertEqual(dist.feature_negopt['without-foo'],'with-foo') self.assertEqual(dist.feature_negopt['without-bar'],'with-bar') self.assertEqual(dist.feature_negopt['without-dwim'],'with-dwim') self.failIf('without-baz' in dist.feature_negopt) def testUseFeatures(self): dist = self.dist self.assertEqual(dist.with_foo,1) self.assertEqual(dist.with_bar,0) self.assertEqual(dist.with_baz,1) self.failIf('bar_et' in dist.py_modules) self.failIf('pkg.bar' in dist.packages) self.failUnless('pkg.baz' in dist.packages) self.failUnless('scripts/baz_it' in dist.scripts) self.failUnless(('libfoo','foo/foofoo.c') in dist.libraries) self.assertEqual(dist.ext_modules,[]) # If we ask for bar, it should fail because we explicitly disabled # it on the command line self.assertRaises(DistutilsOptionError, dist.include_feature, 'bar') def testFeatureWithInvalidRemove(self): self.assertRaises( SystemExit, makeSetup, features = {'x':Feature('x', remove='y')} ) class TestCommandTests(TestCase): def testTestIsCommand(self): test_cmd = makeSetup().get_command_obj('test') self.failUnless(isinstance(test_cmd, distutils.cmd.Command)) def testLongOptSuiteWNoDefault(self): ts1 = makeSetup(script_args=['test','--test-suite=foo.tests.suite']) ts1 = ts1.get_command_obj('test') ts1.ensure_finalized() self.assertEqual(ts1.test_suite, 'foo.tests.suite') def testDefaultSuite(self): ts2 = makeSetup(test_suite='bar.tests.suite').get_command_obj('test') ts2.ensure_finalized() self.assertEqual(ts2.test_suite, 'bar.tests.suite') def testDefaultWModuleOnCmdLine(self): ts3 = makeSetup( test_suite='bar.tests', script_args=['test','-m','foo.tests'] ).get_command_obj('test') ts3.ensure_finalized() self.assertEqual(ts3.test_module, 'foo.tests') self.assertEqual(ts3.test_suite, 'foo.tests.test_suite') def testConflictingOptions(self): ts4 = makeSetup( script_args=['test','-m','bar.tests', '-s','foo.tests.suite'] ).get_command_obj('test') self.assertRaises(DistutilsOptionError, ts4.ensure_finalized) def testNoSuite(self): ts5 = makeSetup().get_command_obj('test') ts5.ensure_finalized() self.assertEqual(ts5.test_suite, None) testClasses = (DependsTests, DistroTests, FeatureTests, TestCommandTests) def test_suite(): return TestSuite([makeSuite(t,'test') for t in testClasses]) From tim_one at users.sourceforge.net Fri Mar 19 23:57:35 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 20 00:07:28 2004 Subject: [Python-checkins] python/dist/src/PC/VC6 rmpyc.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/VC6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26688 Added Files: rmpyc.py Log Message: A helper for rt.bat, copied (but with path adjustment) from PCbuild. --- NEW FILE: rmpyc.py --- # Remove all the .pyc and .pyo files under ../Lib. def deltree(root): import os from os.path import join npyc = npyo = 0 for root, dirs, files in os.walk(root): for name in files: delete = False if name.endswith('.pyc'): delete = True npyc += 1 elif name.endswith('.pyo'): delete = True npyo += 1 if delete: os.remove(join(root, name)) return npyc, npyo npyc, npyo = deltree("../../Lib") print npyc, ".pyc deleted,", npyo, ".pyo deleted" From tim_one at users.sourceforge.net Sat Mar 20 00:00:58 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 20 00:11:13 2004 Subject: [Python-checkins] python/dist/src/PC/VC6 .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/VC6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27177 Added Files: .cvsignore Log Message: Ignore oodles of MSVC-generated files. --- NEW FILE: .cvsignore --- *.WSM *.bsc *.dbg *.dll *.exe *.exp *.ilk *.lib *.ncb *.opt *.pdb *.plg *.pyd *-temp-* From kbk at users.sourceforge.net Sat Mar 20 01:42:31 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Sat Mar 20 01:52:24 2004 Subject: [Python-checkins] python/nondist/peps pep-0008.txt,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9079 Modified Files: pep-0008.txt Log Message: Patch 919256 Clarify and standardize the format for names of modules, functions, methods, and instance variables. Consistent, I hope, with discussion on python-dev http://mail.python.org/pipermail/python-dev/2004-March/043257.html http://mail.python.org/pipermail/python-dev/2004-March/043259.html Index: pep-0008.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0008.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pep-0008.txt 27 Sep 2003 02:53:59 -0000 1.20 --- pep-0008.txt 20 Mar 2004 06:42:29 -0000 1.21 *************** *** 425,457 **** Module Names ! Module names can be either CapWords or lowercase. There is no ! unambiguous convention to decide which to use. Modules that ! export a single class (or a number of closely related classes, ! plus some additional support) are often named in CapWords, with ! the module name being the same as the class name (e.g. the ! standard StringIO module). Modules that export a bunch of ! functions are usually named in all lowercase. ! Since module names are mapped to file names, and some file ! systems are case insensitive and truncate long names, it is ! important that module names be chosen to be fairly short and not ! in conflict with other module names that only differ in the case ! -- this won't be a problem on Unix, but it may be a problem when ! the code is transported to Mac or Windows. ! There is an emerging convention that when an extension module ! written in C or C++ has an accompanying Python module that ! provides a higher level (e.g. more object oriented) interface, ! the Python module's name CapWords, while the C/C++ module is ! named in all lowercase and has a leading underscore (e.g. _socket). ! Python packages generally have a short all lowercase name. Class Names ! Almost without exception, class names use the CapWords ! convention. Classes for internal use have a leading underscore ! in addition. Exception Names --- 425,448 ---- Module Names ! Modules should have short, lowercase names, without underscores. ! Since module names are mapped to file names, and some file systems ! are case insensitive and truncate long names, it is important that ! module names be chosen to be fairly short -- this won't be a ! problem on Unix, but it may be a problem when the code is ! transported to Mac or Windows. ! When an extension module written in C or C++ has an accompanying ! Python module that provides a higher level (e.g. more object ! oriented) interface, the C/C++ module has a leading underscore (e.g. _socket). ! Python packages should have short, all-lowercase names, without ! underscores. Class Names ! Almost without exception, class names use the CapWords convention. ! Classes for internal use have a leading underscore in addition. Exception Names *************** *** 465,474 **** Function Names ! Plain functions exported by a module can either use the CapWords ! style or lowercase (or lower_case_with_underscores). There is ! no strong preference, but it seems that the CapWords style is ! used for functions that provide major functionality ! (e.g. nstools.WorldOpen()), while lowercase is used more for ! "utility" functions (e.g. pathhack.kos_root()). Global Variable Names --- 456,463 ---- Function Names ! Function names should be lowercase, possibly with underscores to ! improve readability. mixedCase is allowed only in contexts where ! that's already the prevailing style (e.g. threading.py), to retain ! backwards compatibility. Global Variable Names *************** *** 476,484 **** (Let's hope that these variables are meant for use inside one module only.) The conventions are about the same as those for ! exported functions. Modules that are designed for use via "from ! M import *" should prefix their globals (and internal functions ! and classes) with an underscore to prevent exporting them. ! Method Names The story is largely the same as for functions. Use lowercase --- 465,473 ---- (Let's hope that these variables are meant for use inside one module only.) The conventions are about the same as those for ! functions. Modules that are designed for use via "from M import *" ! should prefix their globals (and internal functions and classes) ! with an underscore to prevent exporting them. ! Method Names and Instance Variables The story is largely the same as for functions. Use lowercase From fdrake at users.sourceforge.net Sat Mar 20 03:13:35 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat Mar 20 03:23:27 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.39, 1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22045 Modified Files: whatsnew24.tex Log Message: fix two typos that turned text into markup Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** whatsnew24.tex 18 Mar 2004 09:48:12 -0000 1.39 --- whatsnew24.tex 20 Mar 2004 08:13:32 -0000 1.40 *************** *** 268,272 **** loops were also optimized for \class{dict} with performance boosts to \method{keys()}, \method{values()}, \method{items()}, ! \method{\iterkeys()}, \method{\itervalues()}, and \method{iteritems()}. \item The machinery for growing and shrinking lists was optimized --- 268,272 ---- loops were also optimized for \class{dict} with performance boosts to \method{keys()}, \method{values()}, \method{items()}, ! \method{iterkeys()}, \method{itervalues()}, and \method{iteritems()}. \item The machinery for growing and shrinking lists was optimized From fdrake at users.sourceforge.net Sat Mar 20 03:15:32 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat Mar 20 03:25:34 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax _exceptions.py, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22325/xml/sax Modified Files: _exceptions.py Log Message: commit the portion of PyXML patch #919008 that is relevant to the standard library: str() of xml.sax.SAXParseException should not fail if the line and/or column number returned by the locator are None (tests added) Index: _exceptions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/_exceptions.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _exceptions.py 22 Mar 2001 15:34:02 -0000 1.9 --- _exceptions.py 20 Mar 2004 08:15:30 -0000 1.10 *************** *** 92,97 **** if sysid is None: sysid = "" ! return "%s:%d:%d: %s" % (sysid, self.getLineNumber(), ! self.getColumnNumber(), self._msg) --- 92,102 ---- if sysid is None: sysid = "" ! linenum = self.getLineNumber() ! if linenum is None: ! linenum = "?" ! colnum = self.getColumnNumber() ! if colnum is None: ! colnum = "?" ! return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) From fdrake at users.sourceforge.net Sat Mar 20 03:15:32 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat Mar 20 03:25:36 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22325/test Modified Files: test_sax.py Log Message: commit the portion of PyXML patch #919008 that is relevant to the standard library: str() of xml.sax.SAXParseException should not fail if the line and/or column number returned by the locator are None (tests added) Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_sax.py 28 Oct 2002 17:58:48 -0000 1.24 --- test_sax.py 20 Mar 2004 08:15:29 -0000 1.25 *************** *** 490,493 **** --- 490,528 ---- return 0 + def test_sax_parse_exception_str(): + # pass various values from a locator to the SAXParseException to + # make sure that the __str__() doesn't fall apart when None is + # passed instead of an integer line and column number + # + # use "normal" values for the locator: + str(SAXParseException("message", None, + DummyLocator(1, 1))) + # use None for the line number: + str(SAXParseException("message", None, + DummyLocator(None, 1))) + # use None for the column number: + str(SAXParseException("message", None, + DummyLocator(1, None))) + # use None for both: + str(SAXParseException("message", None, + DummyLocator(None, None))) + return 1 + + class DummyLocator: + def __init__(self, lineno, colno): + self._lineno = lineno + self._colno = colno + + def getPublicId(self): + return "pubid" + + def getSystemId(self): + return "sysid" + + def getLineNumber(self): + return self._lineno + + def getColumnNumber(self): + return self._colno # =========================================================================== From fdrake at users.sourceforge.net Sat Mar 20 03:20:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat Mar 20 03:30:30 2004 Subject: [Python-checkins] python/dist/src/Lib/xml/sax _exceptions.py, 1.9, 1.9.38.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22992/xml/sax Modified Files: Tag: release23-maint _exceptions.py Log Message: commit the portion of PyXML patch #919008 that is relevant to the standard library: str() of xml.sax.SAXParseException should not fail if the line and/or column number returned by the locator are None (tests added) Index: _exceptions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/_exceptions.py,v retrieving revision 1.9 retrieving revision 1.9.38.1 diff -C2 -d -r1.9 -r1.9.38.1 *** _exceptions.py 22 Mar 2001 15:34:02 -0000 1.9 --- _exceptions.py 20 Mar 2004 08:20:03 -0000 1.9.38.1 *************** *** 92,97 **** if sysid is None: sysid = "" ! return "%s:%d:%d: %s" % (sysid, self.getLineNumber(), ! self.getColumnNumber(), self._msg) --- 92,102 ---- if sysid is None: sysid = "" ! linenum = self.getLineNumber() ! if linenum is None: ! linenum = "?" ! colnum = self.getColumnNumber() ! if colnum is None: ! colnum = "?" ! return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) From fdrake at users.sourceforge.net Sat Mar 20 03:20:05 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat Mar 20 03:30:32 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py, 1.24, 1.24.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22992/test Modified Files: Tag: release23-maint test_sax.py Log Message: commit the portion of PyXML patch #919008 that is relevant to the standard library: str() of xml.sax.SAXParseException should not fail if the line and/or column number returned by the locator are None (tests added) Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.24 retrieving revision 1.24.16.1 diff -C2 -d -r1.24 -r1.24.16.1 *** test_sax.py 28 Oct 2002 17:58:48 -0000 1.24 --- test_sax.py 20 Mar 2004 08:20:03 -0000 1.24.16.1 *************** *** 490,493 **** --- 490,528 ---- return 0 + def test_sax_parse_exception_str(): + # pass various values from a locator to the SAXParseException to + # make sure that the __str__() doesn't fall apart when None is + # passed instead of an integer line and column number + # + # use "normal" values for the locator: + str(SAXParseException("message", None, + DummyLocator(1, 1))) + # use None for the line number: + str(SAXParseException("message", None, + DummyLocator(None, 1))) + # use None for the column number: + str(SAXParseException("message", None, + DummyLocator(1, None))) + # use None for both: + str(SAXParseException("message", None, + DummyLocator(None, None))) + return 1 + + class DummyLocator: + def __init__(self, lineno, colno): + self._lineno = lineno + self._colno = colno + + def getPublicId(self): + return "pubid" + + def getSystemId(self): + return "sysid" + + def getLineNumber(self): + return self._lineno + + def getColumnNumber(self): + return self._colno # =========================================================================== From akuchling at users.sourceforge.net Sat Mar 20 11:09:09 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Mar 20 11:19:03 2004 Subject: [Python-checkins] python/nondist/sandbox/pep262 install_db.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/pep262 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4997 Modified Files: install_db.py Log Message: Rename Package -> Distribution (SoftwareDistribution for the class name) Index: install_db.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/pep262/install_db.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** install_db.py 31 Mar 2003 20:08:46 -0000 1.3 --- install_db.py 20 Mar 2004 16:09:06 -0000 1.4 *************** *** 1,5 **** """distutils.install_db ! Code for the database of installed Python packages. """ --- 1,5 ---- """distutils.install_db ! Code for the database of installed Python distributions. """ *************** *** 44,78 **** self._cache = {} ! def get_package (self, package_name): ! """get_package(package_name:string) : Package ! Get the object corresponding to a single package. """ try: ! return self._cache[package_name] except KeyError: ! for package in self: ! self._cache[package_name] = package ! if package.name == package_name: ! return package return None ! def list_packages (self): ! """list_packages() : [Package] ! Return a list of all packages installed on the system, enumerated in no particular order. """ return list(self) ! def find_package (self, path): ! """find_file(path:string) : Package ! Search and return the package containing the file 'path'. ! Returns None if the file doesn't belong to any package that the InstallationDatabase knows about. XXX should this work for directories? """ ! for package in self: ! if package.has_file(path): ! return package return None --- 44,78 ---- self._cache = {} ! def get_distribution (self, distribution_name): ! """get_distribution(distribution_name:string) : SoftwareDistribution ! Get the object corresponding to a single distribution. """ try: ! return self._cache[distribution_name] except KeyError: ! for distribution in self: ! self._cache[distribution_name] = distribution ! if distribution.name == distribution_name: ! return distribution return None ! def list_distributions (self): ! """list_distributions() : [SoftwareDistribution] ! Return a list of all distributions installed on the system, enumerated in no particular order. """ return list(self) ! def find_distribution (self, path): ! """find_file(path:string) : SoftwareDistribution ! Search and return the distribution containing the file 'path'. ! Returns None if the file doesn't belong to any distribution that the InstallationDatabase knows about. XXX should this work for directories? """ ! for distribution in self: ! if distribution.has_file(path): ! return distribution return None *************** *** 101,125 **** break ! return Package(filename) ! class Package(DistributionMetadata): """Instance attributes: name : string ! Name of package filename : string ! Name of file in which the package's data is stored. files : {string : (size:int, perms:int, owner:string, group:string, digest:string)} ! Dictionary mapping the path of a file installed by this package to information about the file. requires : [string] ! List of requirements for this package. provides : [string] ! List of modules provided by this package. conflicts : [string] ! List of packages that conflict with this package. obsoletes : [string] ! List of packages that are rendered obsolete by this package. """ --- 101,125 ---- break ! return SoftwareDistribution(filename) ! class SoftwareDistribution(DistributionMetadata): """Instance attributes: name : string ! Name of distribution filename : string ! Name of file in which the distribution's data is stored. files : {string : (size:int, perms:int, owner:string, group:string, digest:string)} ! Dictionary mapping the path of a file installed by this distribution to information about the file. requires : [string] ! List of requirements for this distribution. provides : [string] ! List of modules provided by this distribution. conflicts : [string] ! List of distributions that conflict with this distribution. obsoletes : [string] ! List of distributions that are rendered obsolete by this distribution. """ *************** *** 136,144 **** def __repr__ (self): ! return '' % (self.name, self.filename) def set_name (self, name): """set_name(name:string) ! Set the package name. """ self.name = name --- 136,144 ---- def __repr__ (self): ! return '' % (self.name, self.filename) def set_name (self, name): """set_name(name:string) ! Set the distribution name. """ self.name = name *************** *** 204,208 **** """has_file(path:string) : Boolean Returns true if the specified path belongs to a file in this ! package. """ return self.files.has_key(path) --- 204,208 ---- """has_file(path:string) : Boolean Returns true if the specified path belongs to a file in this ! distribution. """ return self.files.has_key(path) *************** *** 214,220 **** returning a possibly-empty list of mismatches. """ ! input = open(path, 'rb') ! digest = _hash_file(input) ! input.close() expected = self.files[path] stats = os.stat(path) --- 214,223 ---- returning a possibly-empty list of mismatches. """ ! # XXX what to do if the file doesn't exist? ! digest = None ! if os.path.exists(path): ! input = open(path, 'rb') ! digest = _hash_file(input) ! input.close() expected = self.files[path] stats = os.stat(path) *************** *** 241,245 **** output = cStringIO.StringIO() print >>output, 'PKG-INFO FILES REQUIRES PROVIDES' ! self._write_pkg_info(output) output.write('\n') for path, t in self.files.items(): --- 244,248 ---- output = cStringIO.StringIO() print >>output, 'PKG-INFO FILES REQUIRES PROVIDES' ! ##self._write_pkg_info(output) output.write('\n') for path, t in self.files.items(): *************** *** 256,260 **** return output.getvalue() ! # class Package def _hash_file (input): --- 259,263 ---- return output.getvalue() ! # class SoftwareDistribution def _hash_file (input): *************** *** 273,277 **** for p in db: print p.__dict__ ! print db.list_packages() f = open('/tmp/i2', 'wt') f.write(p.as_text()) --- 276,280 ---- for p in db: print p.__dict__ ! print db.list_distributions() f = open('/tmp/i2', 'wt') f.write(p.as_text()) From akuchling at users.sourceforge.net Sat Mar 20 12:04:45 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Mar 20 12:14:38 2004 Subject: [Python-checkins] python/nondist/sandbox/pep262 TODO, 1.1, 1.2 install_db.py, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/pep262 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15919 Modified Files: TODO install_db.py Log Message: Allow using a list of paths Index: TODO =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/pep262/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TODO 19 Feb 2004 02:58:35 -0000 1.1 --- TODO 20 Mar 2004 17:04:43 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- + * Store multiple databases * Should the package database store the Conflicts and Obsoletes information? * Write version requirement parser & evaluator Index: install_db.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/pep262/install_db.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** install_db.py 20 Mar 2004 16:09:06 -0000 1.4 --- install_db.py 20 Mar 2004 17:04:43 -0000 1.5 *************** *** 18,29 **** from distutils.dist import DistributionMetadata - INSTALLDB = ('%s%slib%spython%i.%i%sinstall' % (sys.prefix, os.sep, - os.sep, - sys.version_info[0], - sys.version_info[1], - os.sep)) - # XXX temporary hack for testing - INSTALLDB = '/tmp/i' - _inst_db = None def get_install_db (): --- 18,21 ---- *************** *** 34,57 **** class InstallationDatabase: ! def __init__ (self, path=None): """InstallationDatabase(path:string) Read the installation database rooted at the specified path. If path is None, INSTALLDB is used as the default. """ ! if path is None: ! path = INSTALLDB ! self.path = path self._cache = {} ! def get_distribution (self, distribution_name): ! """get_distribution(distribution_name:string) : SoftwareDistribution Get the object corresponding to a single distribution. """ try: ! return self._cache[distribution_name] except KeyError: for distribution in self: ! self._cache[distribution_name] = distribution ! if distribution.name == distribution_name: return distribution --- 26,47 ---- class InstallationDatabase: ! def __init__ (self, paths=None): """InstallationDatabase(path:string) Read the installation database rooted at the specified path. If path is None, INSTALLDB is used as the default. """ ! self.paths = paths self._cache = {} ! def get_distribution (self, dist_name): ! """get_distribution(dist_name:string) : SoftwareDistribution Get the object corresponding to a single distribution. """ try: ! return self._cache[dist_name] except KeyError: for distribution in self: ! self._cache[dist_name] = distribution ! if distribution.name == dist_name: return distribution *************** *** 86,91 **** def __init__ (self, instdb): self.instdb = instdb ! self.queue = [instdb.path] ! def next (self): --- 76,83 ---- def __init__ (self, instdb): self.instdb = instdb ! if instdb.paths is None: ! self.queue = sys.path[:] ! else: ! self.queue = instdb.paths def next (self): *************** *** 214,217 **** --- 206,212 ---- returning a possibly-empty list of mismatches. """ + if not self.has_file(path): + return ["File not part of this distribution"] + # XXX what to do if the file doesn't exist? digest = None *************** *** 273,277 **** if __name__ == '__main__': ! db = InstallationDatabase('/tmp/i/') for p in db: print p.__dict__ --- 268,272 ---- if __name__ == '__main__': ! db = InstallationDatabase(['/tmp/i/']) for p in db: print p.__dict__ From nnorwitz at users.sourceforge.net Sat Mar 20 12:10:49 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Mar 20 12:20:42 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.75, 1.1.2.76 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17930/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Get docstrings working for classes Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.75 retrieving revision 1.1.2.76 diff -C2 -d -r1.1.2.75 -r1.1.2.76 *** newcompile.c 16 Feb 2004 22:11:34 -0000 1.1.2.75 --- newcompile.c 20 Mar 2004 17:10:46 -0000 1.1.2.76 *************** *** 157,160 **** --- 157,161 ---- static char *opnames[]; + static PyObject *__doc__; int *************** *** 204,207 **** --- 205,214 ---- PyCodeObject *co = NULL; + if (!__doc__) { + __doc__ = PyString_InternFromString("__doc__"); + if (!__doc__) + goto error; + } + if (!compiler_init(&c)) goto error; *************** *** 911,917 **** static int compiler_class(struct compiler *c, stmt_ty s) { ! int n; PyCodeObject *co; PyObject *str; --- 918,932 ---- static int + compiler_isdocstring(stmt_ty s) + { + if (s->kind != Expr_kind) + return 0; + return s->v.Expr.value->kind == Str_kind; + } + + static int compiler_class(struct compiler *c, stmt_ty s) { ! int n, i; PyCodeObject *co; PyObject *str; *************** *** 939,944 **** Py_DECREF(str); ! /* XXX: doc strings go POP_TOP, instead of STORE_NAME (__doc__) */ ! VISIT_SEQ(c, stmt, s->v.ClassDef.body); ADDOP(c, LOAD_LOCALS); ADDOP(c, RETURN_VALUE); --- 954,969 ---- Py_DECREF(str); ! stmt_ty st = asdl_seq_GET(s->v.ClassDef.body, 0); ! i = 0; ! if (compiler_isdocstring(st)) { ! i++; ! VISIT(c, expr, st->v.Expr.value); ! if (!compiler_nameop(c, __doc__, Store)) ! return 0; ! } ! ! for (; i < asdl_seq_LEN(s->v.ClassDef.body); i++) ! VISIT(c, stmt, asdl_seq_GET(s->v.ClassDef.body, i)); ! ADDOP(c, LOAD_LOCALS); ADDOP(c, RETURN_VALUE); From tim_one at users.sourceforge.net Sat Mar 20 12:24:53 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 20 12:34:46 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex copyright.tex, 1.1, 1.2 license.tex, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20274/Doc/commontex Modified Files: copyright.tex license.tex Log Message: Update copyright years, and change copyright.tex to use the same spelling as license.tex (SF patch 795531 complained about the spelling discrepancy, although this "repairs" that flaw in a different way than the patch). Index: copyright.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/copyright.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** copyright.tex 27 Sep 2003 07:11:17 -0000 1.1 --- copyright.tex 20 Mar 2004 17:24:51 -0000 1.2 *************** *** 1,3 **** ! Copyright \copyright{} 2001, 2002, 2003 Python Software Foundation. All rights reserved. --- 1,3 ---- ! Copyright \copyright{} 2001-2004 Python Software Foundation. All rights reserved. Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/license.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** license.tex 3 Mar 2004 08:27:25 -0000 1.3 --- license.tex 20 Mar 2004 17:24:51 -0000 1.4 *************** *** 74,78 **** \version{} alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., ! ``Copyright \copyright{} 2001-2003 Python Software Foundation; All Rights Reserved'' are retained in Python \version{} alone or in any derivative version prepared by Licensee. --- 74,78 ---- \version{} alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., ! ``Copyright \copyright{} 2001-2004 Python Software Foundation; All Rights Reserved'' are retained in Python \version{} alone or in any derivative version prepared by Licensee. From akuchling at users.sourceforge.net Sat Mar 20 12:30:34 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Mar 20 12:40:27 2004 Subject: [Python-checkins] distutils TODO,1.15,1.16 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21492 Modified Files: TODO Log Message: Update TODO file Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TODO 21 Nov 2002 19:01:19 -0000 1.15 --- TODO 20 Mar 2004 17:30:26 -0000 1.16 *************** *** 8,19 **** * document the recent bdist_wininst improvements (Thomas Heller) - * Bugs to fix: - #410541 : bdist builds bogus .zips - - * add Richard Jones' register command. - ! ! DISTUTILS 1.1 PLANS ------------------- --- 8,13 ---- * document the recent bdist_wininst improvements (Thomas Heller) ! DISTUTILS 2.0 PLANS ------------------- *************** *** 100,103 **** --- 94,99 ---- -------------------- + * drop fancy_getopt and replace it with optparse + * I think fancy_getopt needs to get fancier to properly support the -I, -D, -l, -L, etc. options of "build_ext": need to be able From twouters at users.sourceforge.net Sat Mar 20 12:31:31 2004 From: twouters at users.sourceforge.net (twouters@users.sourceforge.net) Date: Sat Mar 20 12:41:26 2004 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20855 Modified Files: Parser.py Log Message: Merge in Anthony's new parser code, from the anthony-parser-branch: > ---------------------------- > revision 1.20.4.4 > date: 2003/06/12 09:14:17; author: anthonybaxter; state: Exp; lines: +13 -6 > preamble is None when missing, not ''. > Handle a couple of bogus formatted messages - now parses my main testsuite. > Handle message/external-body. > ---------------------------- > revision 1.20.4.3 > date: 2003/06/12 07:16:40; author: anthonybaxter; state: Exp; lines: +6 -4 > epilogue-processing is now the same as the old parser - the newline at the > end of the line with the --endboundary-- is included as part of the epilogue. > Note that any whitespace after the boundary is _not_ part of the epilogue. > ---------------------------- > revision 1.20.4.2 > date: 2003/06/12 06:39:09; author: anthonybaxter; state: Exp; lines: +6 -4 > message/delivery-status fixed. > HeaderParser fixed. > ---------------------------- > revision 1.20.4.1 > date: 2003/06/12 06:08:56; author: anthonybaxter; state: Exp; lines: +163 -129 > A work-in-progress snapshot of the new parser. A couple of known problems: > > - first (blank) line of MIME epilogues is being consumed > - message/delivery-status isn't quite right > > It still needs a lot of cleanup, but right now it parses a whole lot of > badness that the old parser failed on. I also need to think about adding > back the old 'strict' flag in some way. > ============================================================================= Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Parser.py 6 Mar 2003 05:25:35 -0000 1.20 --- Parser.py 20 Mar 2004 17:31:29 -0000 1.21 *************** *** 23,26 **** --- 23,95 ---- NLCRE = re.compile('\r\n|\r|\n') + class TextUtil: + """ A utility class for wrapping a file object and providing a + couple of additional useful functions. + """ + + def __init__(self, fp): + self.fp = fp + self.unread = [] + + def readline(self): + """ Return a line of data. + + If data has been pushed back with unreadline(), the most recently + returned unreadline()d data will be returned. + """ + if self.unread: + return self.unread.pop() + else: + return self.fp.readline() + + def unreadline(self, line): + """Push a line back into the object. + """ + self.unread.append(line) + + def peekline(self): + """Non-destructively look at the next line""" + line = self.readline() + self.unreadline(line) + return line + + def read(self): + """Return the remaining data + """ + r = self.fp.read() + if self.unread: + r = "\n".join(self.unread) + r + self.unread = [] + return r + + def readuntil(self, re, afterblank=0, includematch=0): + """Read a line at a time until we get the specified RE. + + Returns the text up to (and including, if includematch is true) the + matched text, and the RE match object. If afterblank is true, + there must be a blank line before the matched text. Moves current + filepointer to the line following the matched line. If we reach + end-of-file, return what we've got so far, and return None as the + RE match object. + """ + prematch = [] + blankseen = 0 + while 1: + line = self.readline() + if not line: + # end of file + return EMPTYSTRING.join(prematch), None + if afterblank: + if NLCRE.match(line): + blankseen = 1 + continue + else: + blankseen = 0 + m = re.match(line) + if (m and not afterblank) or (m and afterblank and blankseen): + if includematch: + prematch.append(line) + return EMPTYSTRING.join(prematch), m + prematch.append(line) *************** *** 60,66 **** """ root = self._class() ! firstbodyline = self._parseheaders(root, fp) if not headersonly: ! self._parsebody(root, fp, firstbodyline) return root --- 129,139 ---- """ root = self._class() ! fp = TextUtil(fp) ! self._parseheaders(root, fp) if not headersonly: ! obj = self._parsemessage(root, fp) ! trailer = fp.read() ! if obj and trailer: ! self._attach_trailer(obj, trailer) return root *************** *** 81,85 **** lastvalue = [] lineno = 0 - firstbodyline = None while True: # Don't strip the line before we test for the end condition, --- 154,157 ---- *************** *** 130,134 **** # 2822, but we're in non-strict mode. So just offer up # this current line as the first body line. ! firstbodyline = line break if lastheader: --- 202,206 ---- # 2822, but we're in non-strict mode. So just offer up # this current line as the first body line. ! fp.unreadline(line) break if lastheader: *************** *** 139,276 **** if lastheader: container[lastheader] = NL.join(lastvalue) ! return firstbodyline ! def _parsebody(self, container, fp, firstbodyline=None): ! # Parse the body, but first split the payload on the content-type ! # boundary if present. boundary = container.get_boundary() isdigest = (container.get_content_type() == 'multipart/digest') ! # If there's a boundary, split the payload text into its constituent ! # parts and parse each separately. Otherwise, just parse the rest of ! # the body as a single message. Note: any exceptions raised in the ! # recursive parse need to have their line numbers coerced. ! if boundary: ! preamble = epilogue = None ! # Split into subparts. The first boundary we're looking for won't ! # always have a leading newline since we're at the start of the ! # body text, and there's not always a preamble before the first ! # boundary. separator = '--' + boundary ! payload = fp.read() ! if firstbodyline is not None: ! payload = firstbodyline + '\n' + payload ! # We use an RE here because boundaries can have trailing ! # whitespace. ! mo = re.search( ! r'(?P' + re.escape(separator) + r')(?P[ \t]*)', ! payload) ! if not mo: ! if self._strict: ! raise Errors.BoundaryError( ! "Couldn't find starting boundary: %s" % boundary) ! container.set_payload(payload) ! return ! start = mo.start() ! if start > 0: ! # there's some pre-MIME boundary preamble ! preamble = payload[0:start] ! # Find out what kind of line endings we're using ! start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = NLCRE.search(payload, start) ! if mo: ! start += len(mo.group(0)) ! # We create a compiled regexp first because we need to be able to ! # specify the start position, and the module function doesn't ! # support this signature. :( ! cre = re.compile('(?P\r\n|\r|\n)' + ! re.escape(separator) + '--') ! mo = cre.search(payload, start) ! if mo: ! terminator = mo.start() ! linesep = mo.group('sep') ! if mo.end() < len(payload): ! # There's some post-MIME boundary epilogue ! epilogue = payload[mo.end():] ! elif self._strict: ! raise Errors.BoundaryError( ! "Couldn't find terminating boundary: %s" % boundary) else: ! # Handle the case of no trailing boundary. Check that it ends ! # in a blank line. Some cases (spamspamspam) don't even have ! # that! ! mo = re.search('(?P\r\n|\r|\n){2}$', payload) ! if not mo: ! mo = re.search('(?P\r\n|\r|\n)$', payload) ! if not mo: ! raise Errors.BoundaryError( ! 'No terminating boundary and no trailing empty line') ! linesep = mo.group('sep') ! terminator = len(payload) ! # We split the textual payload on the boundary separator, which ! # includes the trailing newline. If the container is a ! # multipart/digest then the subparts are by default message/rfc822 ! # instead of text/plain. In that case, they'll have a optional ! # block of MIME headers, then an empty line followed by the ! # message headers. ! parts = re.split( ! linesep + re.escape(separator) + r'[ \t]*' + linesep, ! payload[start:terminator]) ! for part in parts: if isdigest: ! if part.startswith(linesep): ! # There's no header block so create an empty message ! # object as the container, and lop off the newline so ! # we can parse the sub-subobject ! msgobj = self._class() ! part = part[len(linesep):] ! else: ! parthdrs, part = part.split(linesep+linesep, 1) ! # msgobj in this case is the "message/rfc822" container ! msgobj = self.parsestr(parthdrs, headersonly=1) ! # while submsgobj is the message itself ! msgobj.set_default_type('message/rfc822') ! maintype = msgobj.get_content_maintype() ! if maintype in ('message', 'multipart'): ! submsgobj = self.parsestr(part) ! msgobj.attach(submsgobj) else: ! msgobj.set_payload(part) else: ! msgobj = self.parsestr(part) ! container.preamble = preamble ! container.epilogue = epilogue ! container.attach(msgobj) ! elif container.get_main_type() == 'multipart': # Very bad. A message is a multipart with no boundary! raise Errors.BoundaryError( ! 'multipart message with no defined boundary') ! elif container.get_type() == 'message/delivery-status': ! # This special kind of type contains blocks of headers separated ! # by a blank line. We'll represent each header block as a ! # separate Message object ! blocks = [] ! while True: ! blockmsg = self._class() ! self._parseheaders(blockmsg, fp) ! if not len(blockmsg): ! # No more header blocks left ! break ! blocks.append(blockmsg) ! container.set_payload(blocks) ! elif container.get_main_type() == 'message': ! # Create a container for the payload, but watch out for there not ! # being any headers left ! try: ! msg = self.parse(fp) ! except Errors.HeaderParseError: msg = self._class() ! self._parsebody(msg, fp) ! container.attach(msg) else: ! text = fp.read() ! if firstbodyline is not None: ! text = firstbodyline + '\n' + text ! container.set_payload(text) --- 211,322 ---- if lastheader: container[lastheader] = NL.join(lastvalue) ! return ! def _parsemessage(self, container, fp): ! # Parse the body. We walk through the body from top to bottom, ! # keeping track of the current multipart nesting as we go. ! # We return the object that gets the data at the end of this ! # block. boundary = container.get_boundary() isdigest = (container.get_content_type() == 'multipart/digest') ! if boundary: separator = '--' + boundary ! boundaryRE = re.compile( ! r'(?P' + re.escape(separator) + ! r')(?P--)?(?P[ \t]*)(?P\r\n|\r|\n)$') ! preamble, matchobj = fp.readuntil(boundaryRE) ! if not matchobj: ! # Broken - we hit the end of file. Just set the body ! # to the text. ! container.set_payload(preamble) ! return container ! if preamble: ! container.preamble = preamble else: ! # The module docs specify an empty preamble is None, not '' ! container.preamble = None ! while 1: ! subobj = self._class() if isdigest: ! subobj.set_default_type('message/rfc822') ! firstline = fp.peekline() ! if firstline.strip(): ! # we have MIME headers. all good. ! self._parseheaders(subobj, fp) else: ! # no MIME headers. this is allowed for multipart/digest ! # Consume the extra blank line ! fp.readline() ! pass else: ! self._parseheaders(subobj, fp) ! container.attach(subobj) ! maintype = subobj.get_content_maintype() ! hassubparts = (subobj.get_content_maintype() in ! ( "message", "multipart" )) ! if hassubparts: ! subobj = self._parsemessage(subobj, fp) ! ! trailer, matchobj = fp.readuntil(boundaryRE) ! if matchobj is None or trailer: ! mo = re.search('(?P\r\n|\r|\n){2}$', trailer) ! if not mo: ! mo = re.search('(?P\r\n|\r|\n)$', trailer) ! if not mo: ! raise Errors.BoundaryError( ! 'No terminating boundary and no trailing empty line') ! linesep = mo.group('sep') ! trailer = trailer[:-len(linesep)] ! if trailer: ! self._attach_trailer(subobj, trailer) ! if matchobj is None or matchobj.group('end'): ! # That was the last piece of data. Let our caller attach ! # the epilogue to us. But before we do that, push the ! # line ending of the match group back into the readline ! # buffer, as it's part of the epilogue. ! if matchobj: ! fp.unreadline(matchobj.group('linesep')) ! return container ! ! elif container.get_content_maintype() == "multipart": # Very bad. A message is a multipart with no boundary! raise Errors.BoundaryError( ! 'multipart message with no defined boundary') ! elif container.get_content_maintype() == "message": ! ct = container.get_content_type() ! if ct == "message/rfc822": ! submessage = self._class() ! self._parseheaders(submessage, fp) ! self._parsemessage(submessage, fp) ! container.attach(submessage) ! return submessage ! elif ct == "message/delivery-status": ! # This special kind of type contains blocks of headers ! # separated by a blank line. We'll represent each header ! # block as a separate Message object ! while 1: ! nextblock = self._class() ! self._parseheaders(nextblock, fp) ! container.attach(nextblock) ! # next peek ahead to see whether we've hit the end or not ! nextline = fp.peekline() ! if nextline[:2] == "--": ! break ! return container ! else: ! # Other sort of message object (e.g. external-body) msg = self._class() ! self._parsemessage(msg, fp) ! container.attach(msg) ! return msg else: ! # single body section. We let our caller set the payload. ! return container + def _attach_trailer(self, obj, trailer): + if obj.get_content_maintype() in ("message", "multipart"): + obj.epilogue = trailer + else: + obj.set_payload(trailer) *************** *** 285,292 **** interested in is the message headers. """ ! def _parsebody(self, container, fp, firstbodyline=None): # Consume but do not parse, the body text = fp.read() - if firstbodyline is not None: - text = firstbodyline + '\n' + text container.set_payload(text) --- 331,337 ---- interested in is the message headers. """ ! def _parsemessage(self, container, fp): # Consume but do not parse, the body text = fp.read() container.set_payload(text) + return None From nnorwitz at users.sourceforge.net Sat Mar 20 12:44:30 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Mar 20 12:54:26 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.76, 1.1.2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24327/Python Modified Files: Tag: ast-branch newcompile.c Log Message: get all docstrings working Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.76 retrieving revision 1.1.2.77 diff -C2 -d -r1.1.2.76 -r1.1.2.77 *** newcompile.c 20 Mar 2004 17:10:46 -0000 1.1.2.76 --- newcompile.c 20 Mar 2004 17:44:21 -0000 1.1.2.77 *************** *** 37,42 **** doesn't output BINARY_TRUE_DIVISION #: co_names doesn't contain locals, only globals, co_varnames may work - #: doc strings at class scope are POPed, not stored - In interactive mode, they are printed. :-) #: ref leaks in interpreter when press return on empty line #: yield or return outside a function don't raise a SyntaxError --- 37,40 ---- *************** *** 614,619 **** static int ! compiler_addop_o(struct compiler *c, int opcode, PyObject *dict, ! PyObject *o) { PyObject *t, *v; --- 612,616 ---- static int ! compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) { PyObject *t, *v; *************** *** 624,628 **** t = Py_BuildValue("(OO)", o, o->ob_type); if (t == NULL) ! return 0; v = PyDict_GetItem(dict, t); --- 621,625 ---- t = Py_BuildValue("(OO)", o, o->ob_type); if (t == NULL) ! return -1; v = PyDict_GetItem(dict, t); *************** *** 632,641 **** if (!v) { Py_DECREF(t); ! return 0; } if (PyDict_SetItem(dict, t, v) < 0) { Py_DECREF(t); Py_DECREF(v); ! return 0; } Py_DECREF(v); --- 629,638 ---- if (!v) { Py_DECREF(t); ! return -1; } if (PyDict_SetItem(dict, t, v) < 0) { Py_DECREF(t); Py_DECREF(v); ! return -1; } Py_DECREF(v); *************** *** 644,648 **** arg = PyInt_AsLong(v); Py_DECREF(t); ! return compiler_addop_i(c, opcode, arg); } --- 641,655 ---- arg = PyInt_AsLong(v); Py_DECREF(t); ! return arg; ! } ! ! static int ! compiler_addop_o(struct compiler *c, int opcode, PyObject *dict, ! PyObject *o) ! { ! int arg = compiler_add_o(c, dict, o); ! if (arg < 0) ! return 0; ! return compiler_addop_i(c, opcode, arg); } *************** *** 874,882 **** static int compiler_function(struct compiler *c, stmt_ty s) { PyCodeObject *co; arguments_ty args = s->v.FunctionDef.args; ! int i, n; assert(s->kind == FunctionDef_kind); --- 881,899 ---- static int + compiler_isdocstring(stmt_ty s) + { + if (s->kind != Expr_kind) + return 0; + return s->v.Expr.value->kind == Str_kind; + } + + static int compiler_function(struct compiler *c, stmt_ty s) { PyCodeObject *co; + PyObject *first_const = Py_None; arguments_ty args = s->v.FunctionDef.args; ! stmt_ty st; ! int i, n, docstring; assert(s->kind == FunctionDef_kind); *************** *** 885,888 **** --- 902,913 ---- if (!compiler_enter_scope(c, s->v.FunctionDef.name, (void *)s)) return 0; + + st = asdl_seq_GET(s->v.FunctionDef.body, 0); + docstring = compiler_isdocstring(st); + if (docstring) + first_const = st->v.Expr.value->v.Str.s; + if (compiler_add_o(c, c->u->u_consts, first_const) < 0) + return 0; + /* unpack nested arguments */ for (i = 0; i < asdl_seq_LEN(args->args); i++) { *************** *** 898,902 **** c->u->u_argcount = asdl_seq_LEN(args->args); n = asdl_seq_LEN(s->v.FunctionDef.body); ! for (i = 0; i < n; i++) { stmt_ty s2 = asdl_seq_GET(s->v.FunctionDef.body, i); if (i == 0 && s2->kind == Expr_kind && --- 923,928 ---- c->u->u_argcount = asdl_seq_LEN(args->args); n = asdl_seq_LEN(s->v.FunctionDef.body); ! /* if there was a docstring, we need to skip the first statement */ ! for (i = docstring; i < n; i++) { stmt_ty s2 = asdl_seq_GET(s->v.FunctionDef.body, i); if (i == 0 && s2->kind == Expr_kind && *************** *** 918,929 **** static int - compiler_isdocstring(stmt_ty s) - { - if (s->kind != Expr_kind) - return 0; - return s->v.Expr.value->kind == Str_kind; - } - - static int compiler_class(struct compiler *c, stmt_ty s) { --- 944,947 ---- *************** *** 957,961 **** i = 0; if (compiler_isdocstring(st)) { ! i++; VISIT(c, expr, st->v.Expr.value); if (!compiler_nameop(c, __doc__, Store)) --- 975,979 ---- i = 0; if (compiler_isdocstring(st)) { ! i = 1; VISIT(c, expr, st->v.Expr.value); if (!compiler_nameop(c, __doc__, Store)) From akuchling at users.sourceforge.net Sat Mar 20 13:00:12 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Mar 20 13:10:05 2004 Subject: [Python-checkins] python/nondist/sandbox/pep262 install_db.py, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/pep262 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27586 Modified Files: install_db.py Log Message: Add parameter for skipping SHA hash Index: install_db.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/pep262/install_db.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** install_db.py 20 Mar 2004 17:09:20 -0000 1.6 --- install_db.py 20 Mar 2004 18:00:09 -0000 1.7 *************** *** 176,180 **** ! def add_file (self, path): """add_file(path:string):None Record the size, ownership, &c., information for an installed file. --- 176,180 ---- ! def add_file (self, path, compute_digest=True): """add_file(path:string):None Record the size, ownership, &c., information for an installed file. *************** *** 185,191 **** return # XXX what to do when hashing: binary or text mode? ! input = open(path, 'rb') ! digest = _hash_file(input) ! input.close() stats = os.stat(path) self.files[path] = (stats.st_size, stats.st_mode, --- 185,193 ---- return # XXX what to do when hashing: binary or text mode? ! digest = '-' ! if compute_digest: ! input = open(path, 'rb') ! digest = _hash_file(input) ! input.close() stats = os.stat(path) self.files[path] = (stats.st_size, stats.st_mode, From akuchling at users.sourceforge.net Sat Mar 20 13:03:45 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Mar 20 13:13:39 2004 Subject: [Python-checkins] python/nondist/sandbox/pep262 README,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/pep262 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28366 Modified Files: README Log Message: Point to Subversion repository Index: README =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/pep262/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 30 Mar 2003 17:06:48 -0000 1.1 --- README 20 Mar 2004 18:03:43 -0000 1.2 *************** *** 1,6 **** ! This directory is for development of a package database to be incorporated ! in the Distutils. Experimental installer programs will probably wind up in ! this directory, too. --amk --- 1,7 ---- ! Development of this installation database has moved to a Subversion ! repository at svn://svn.amk.ca/public/distutils/trunk/ . Checkin ! access to the Subversion repository will be freely granted; ask me at ! amk@amk.ca and provide a user name and password. --amk From rhettinger at users.sourceforge.net Sat Mar 20 13:25:33 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 20 13:35:27 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.162,1.163 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32727 Modified Files: libfuncs.tex Log Message: SF bug #918371: hasattr()'s return type Replace 1 and 0 with True and False. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** libfuncs.tex 19 Mar 2004 15:20:16 -0000 1.162 --- libfuncs.tex 20 Mar 2004 18:25:31 -0000 1.163 *************** *** 470,475 **** \begin{funcdesc}{hasattr}{object, name} ! The arguments are an object and a string. The result is 1 if the ! string is the name of one of the object's attributes, 0 if not. (This is implemented by calling \code{getattr(\var{object}, \var{name})} and seeing whether it raises an exception or not.) --- 470,475 ---- \begin{funcdesc}{hasattr}{object, name} ! The arguments are an object and a string. The result is \code{True} if the ! string is the name of one of the object's attributes, \code{False} if not. (This is implemented by calling \code{getattr(\var{object}, \var{name})} and seeing whether it raises an exception or not.) From rhettinger at users.sourceforge.net Sat Mar 20 13:26:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 20 13:36:37 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.143.8.10, 1.143.8.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv493 Modified Files: Tag: release23-maint libfuncs.tex Log Message: SF bug #918371: hasattr()'s return type Replace 1 and 0 with True and False. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.143.8.10 retrieving revision 1.143.8.11 diff -C2 -d -r1.143.8.10 -r1.143.8.11 *** libfuncs.tex 1 Jan 2004 03:40:57 -0000 1.143.8.10 --- libfuncs.tex 20 Mar 2004 18:26:42 -0000 1.143.8.11 *************** *** 460,465 **** \begin{funcdesc}{hasattr}{object, name} ! The arguments are an object and a string. The result is 1 if the ! string is the name of one of the object's attributes, 0 if not. (This is implemented by calling \code{getattr(\var{object}, \var{name})} and seeing whether it raises an exception or not.) --- 460,465 ---- \begin{funcdesc}{hasattr}{object, name} ! The arguments are an object and a string. The result is \code{True} if the ! string is the name of one of the object's attributes, \code{False} if not. (This is implemented by calling \code{getattr(\var{object}, \var{name})} and seeing whether it raises an exception or not.) From gvanrossum at users.sourceforge.net Sat Mar 20 14:12:01 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat Mar 20 14:21:56 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.157,2.158 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9034 Modified Files: dictobject.c Log Message: GCC was complaining that 'value' in dictiter_iternextvalue() wasn't necessarily always set before used. Between Tim, Armin & me we couldn't prove GCC wrong, so we decided to fix the algorithm. This version is Armin's. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.157 retrieving revision 2.158 diff -C2 -d -r2.157 -r2.158 *** dictobject.c 19 Mar 2004 10:30:00 -0000 2.157 --- dictobject.c 20 Mar 2004 19:11:58 -0000 2.158 *************** *** 2149,2161 **** i = di->di_pos; ! if (i < 0) goto fail; ep = d->ma_table; ! mask = d->ma_mask; ! while (i <= mask && (value=ep[i].me_value) == NULL) i++; di->di_pos = i+1; - if (i > mask) - goto fail; di->len--; Py_INCREF(value); --- 2149,2162 ---- i = di->di_pos; ! mask = d->ma_mask; ! if (i < 0 || i > mask) goto fail; ep = d->ma_table; ! while ((value=ep[i].me_value) == NULL) { i++; + if (i > mask) + goto fail; + } di->di_pos = i+1; di->len--; Py_INCREF(value); From facundobatista at users.sourceforge.net Sat Mar 20 14:33:10 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Sat Mar 20 14:43:04 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13263 Modified Files: test_Decimal.py Log Message: Added from_float to explicit construction test cases and all implicit construction test cases. Also upgraded method names to new GvR definiton. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_Decimal.py 12 Mar 2004 02:07:30 -0000 1.9 --- test_Decimal.py 20 Mar 2004 19:33:07 -0000 1.10 *************** *** 462,474 **** '''Unit tests for Explicit Construction cases of Decimal.''' ! def test_Empty(self): '''Explicit construction without parameters.''' self.assertRaises(TypeError, Decimal) ! def test_FromNone(self): '''Explicit construction passing None as value.''' self.assertRaises(TypeError, Decimal, None) ! def test_FromInt(self): '''Explicit construction with int or long.''' --- 462,474 ---- '''Unit tests for Explicit Construction cases of Decimal.''' ! def test_empty(self): '''Explicit construction without parameters.''' self.assertRaises(TypeError, Decimal) ! def test_from_None(self): '''Explicit construction passing None as value.''' self.assertRaises(TypeError, Decimal, None) ! def test_from_int(self): '''Explicit construction with int or long.''' *************** *** 489,493 **** self.assertEqual(str(d), '0') ! def test_FromString(self): '''Explicit construction with string.''' --- 489,493 ---- self.assertEqual(str(d), '0') ! def test_from_string(self): '''Explicit construction with string.''' *************** *** 510,519 **** self.assertRaises(ValueError, Decimal, 'ugly') ! def test_FromFloat(self): '''Explicit construction with float.''' ! # There is still no agreement here ! def test_FromTuples(self): '''Explicit construction with tuples.''' --- 510,554 ---- self.assertRaises(ValueError, Decimal, 'ugly') ! def test_from_float(self): '''Explicit construction with float.''' ! #positive integer ! d = Decimal.from_float(45.0) ! self.assertEqual(str(d), '45') ! #negative integer ! d = Decimal.from_float(-32.0) ! self.assertEqual(str(d), '-32') ! ! #zero ! d = Decimal.from_float(0.0) ! self.assertEqual(str(d), '0') ! ! #empty ! self.assertRaises(ValueError, Decimal.from_float, '') ! ! #with a string ! self.assertRaises(TypeError, Decimal.from_float, '') ! ! #with an int ! self.assertRaises(TypeError, Decimal.from_float, 5) ! ! #exact float ! d = Decimal.from_float(32.32) ! self.assertEqual(str(d), '32.32') ! ! #inexact float, without positions ! d = Decimal.from_float(2.2) ! self.assertEqual(str(d), '220000000000000017763568394002504646778106689453125e-50') ! ! #inexact float, without some positions ! d = Decimal.from_float(2.2, 16) ! self.assertEqual(str(d), '2.2000000000000002') ! ! #inexact float, without less positions ! d = Decimal.from_float(2.2, 5) ! self.assertEqual(str(d), '2.2') ! ! def test_from_tuples(self): '''Explicit construction with tuples.''' *************** *** 534,538 **** self.assertEqual(str(d), '-4.34913534E-17') ! def test_FromDecimal(self): '''Explicit construction with Decimal.''' --- 569,573 ---- self.assertEqual(str(d), '-4.34913534E-17') ! def test_from_Decimal(self): '''Explicit construction with Decimal.''' *************** *** 562,565 **** --- 597,656 ---- + class DecimalImplicitConstructionTest(unittest.TestCase): + '''Unit tests for Implicit Construction cases of Decimal.''' + + def test_from_None(self): + '''Implicit construction with None.''' + + d = Decimal(5) + try: + d + None + except TypeError: + pass + + def test_from_int(self): + '''Implicit construction with int or long.''' + d = Decimal(5) + + #normal + e = d + 45 + self.assertEqual(str(e), '50') + + #exceeding precision + try: + d + 123456789000 + except TypeError: + pass + + def test_from_string(self): + '''Implicit construction with string.''' + d = Decimal(5) + + #just any string + try: + d + '3' + except TypeError: + pass + + def testIC_FromFloat(self): + '''Implicit construction with float.''' + d = Decimal(5) + + #just any float + try: + d + 2.2 + except TypeError: + pass + + def testIC_FromDecimal(self): + '''Implicit construction with Decimal.''' + + d = Decimal(5) + + #any Decimal + e = d + Decimal(45) + self.assertEqual(str(e), '50') + + def test_main(which=None): """ Execute the tests. From nnorwitz at users.sourceforge.net Sat Mar 20 14:46:53 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Mar 20 14:56:49 2004 Subject: [Python-checkins] python/dist/src/Include Python.h, 2.52.2.1, 2.52.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15883/Include Modified Files: Tag: ast-branch Python.h Log Message: get name mangling working Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.52.2.1 retrieving revision 2.52.2.2 diff -C2 -d -r2.52.2.1 -r2.52.2.2 *** Python.h 28 Apr 2003 17:33:07 -0000 2.52.2.1 --- Python.h 20 Mar 2004 19:46:51 -0000 2.52.2.2 *************** *** 115,120 **** /* _Py_Mangle is defined in compile.c */ ! PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \ ! char *buffer, size_t maxlen); /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ --- 115,119 ---- /* _Py_Mangle is defined in compile.c */ ! PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); /* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ From nnorwitz at users.sourceforge.net Sat Mar 20 14:46:54 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Mar 20 14:56:52 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c, 2.157.2.1, 2.157.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15883/Objects Modified Files: Tag: ast-branch typeobject.c Log Message: get name mangling working Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.157.2.1 retrieving revision 2.157.2.2 diff -C2 -d -r2.157.2.1 -r2.157.2.2 *** typeobject.c 28 Apr 2003 17:18:04 -0000 2.157.2.1 --- typeobject.c 20 Mar 2004 19:46:51 -0000 2.157.2.2 *************** *** 1700,1704 **** for (i = j = 0; i < nslots; i++) { char *s; - char buffer[256]; tmp = PyTuple_GET_ITEM(slots, i); s = PyString_AS_STRING(tmp); --- 1700,1703 ---- *************** *** 1706,1717 **** (add_weak && strcmp(s, "__weakref__") == 0)) continue; ! if (_Py_Mangle(PyString_AS_STRING(name), ! PyString_AS_STRING(tmp), ! buffer, sizeof(buffer))) ! { ! tmp = PyString_FromString(buffer); ! } else { ! Py_INCREF(tmp); ! } PyTuple_SET_ITEM(newslots, j, tmp); j++; --- 1705,1711 ---- (add_weak && strcmp(s, "__weakref__") == 0)) continue; ! tmp =_Py_Mangle(name, tmp); ! if (!tmp) ! goto bad_slots; PyTuple_SET_ITEM(newslots, j, tmp); j++; From nnorwitz at users.sourceforge.net Sat Mar 20 14:46:54 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Mar 20 14:56:54 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.77, 1.1.2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15883/Python Modified Files: Tag: ast-branch newcompile.c Log Message: get name mangling working Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.77 retrieving revision 1.1.2.78 diff -C2 -d -r1.1.2.77 -r1.1.2.78 *** newcompile.c 20 Mar 2004 17:44:21 -0000 1.1.2.77 --- newcompile.c 20 Mar 2004 19:46:51 -0000 1.1.2.78 *************** *** 33,37 **** Invalid behaviour: - #: name mangling in classes (__vars) doesn't work #: doing from __future__ import division doesn't work doesn't output BINARY_TRUE_DIVISION --- 33,36 ---- *************** *** 85,88 **** --- 84,89 ---- PyObject *u_freevars; /* free variables */ + PyObject *u_private; /* for private name mangling */ + int u_argcount; /* number of arguments for block */ int u_nblocks; /* number of used blocks in u_blocks *************** *** 157,186 **** static PyObject *__doc__; ! int ! _Py_Mangle(char *p, char *name, char *buffer, size_t maxlen) { /* Name mangling: __private becomes _classname__private. This is independent from how the name is used. */ size_t nlen, plen; ! if (p == NULL || name == NULL || name[0] != '_' || name[1] != '_') ! return 0; nlen = strlen(name); ! if (nlen+2 >= maxlen) ! return 0; /* Don't mangle __extremely_long_names */ ! if (name[nlen-1] == '_' && name[nlen-2] == '_') ! return 0; /* Don't mangle __whatever__ */ /* Strip leading underscores from class name */ while (*p == '_') p++; ! if (*p == '\0') ! return 0; /* Don't mangle if class is just underscores */ plen = strlen(p); ! if (plen + nlen >= maxlen) ! plen = maxlen-nlen-2; /* Truncate class name if too long */ ! /* buffer = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ ! buffer[0] = '_'; strncpy(buffer+1, p, plen); strcpy(buffer+1+plen, name); ! return 1; } --- 158,196 ---- static PyObject *__doc__; ! PyObject * ! _Py_Mangle(PyObject *private, PyObject *ident) { /* Name mangling: __private becomes _classname__private. This is independent from how the name is used. */ + const char *p, *name = PyString_AsString(ident); + char *buffer; size_t nlen, plen; ! if (private == NULL || name == NULL || name[0] != '_' || name[1] != '_') { ! Py_INCREF(ident); ! return ident; ! } ! p = PyString_AsString(private); nlen = strlen(name); ! if (name[nlen-1] == '_' && name[nlen-2] == '_') { ! Py_INCREF(ident); ! return ident; /* Don't mangle __whatever__ */ ! } /* Strip leading underscores from class name */ while (*p == '_') p++; ! if (*p == '\0') { ! Py_INCREF(ident); ! return ident; /* Don't mangle if class is just underscores */ ! } plen = strlen(p); ! ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); ! if (!ident) ! return 0; ! /* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ ! buffer = PyString_AS_STRING(ident); ! buffer[0] = '_'; strncpy(buffer+1, p, plen); strcpy(buffer+1+plen, name); ! return ident; } *************** *** 389,392 **** --- 399,404 ---- return 0; + u->u_private = NULL; + /* A little debugging output */ compiler_display_symbols(name, u->u_ste->ste_symbols); *************** *** 399,402 **** --- 411,416 ---- Py_DECREF(wrapper); fprintf(stderr, "stack = %s\n", PyObject_REPR(c->c_stack)); + u->u_private = c->u->u_private; + Py_XINCREF(u->u_private); } c->u = u; *************** *** 654,657 **** --- 668,685 ---- } + static int + compiler_addop_name(struct compiler *c, int opcode, PyObject *o) + { + int arg; + PyObject *mangled = _Py_Mangle(c->u->u_private, o); + if (!mangled) + return 0; + arg = compiler_add_o(c, c->u->u_names, mangled); + Py_DECREF(mangled); + if (arg < 0) + return 0; + return compiler_addop_i(c, opcode, arg); + } + /* Add an opcode with an integer argument. Returns 0 on failure, 1 on success. *************** *** 723,726 **** --- 751,761 ---- } + #define ADDOP_NAME(C, OP, O) { \ + if (!compiler_addop_name((C), (OP), (O))) { \ + Py_DECREF(O); \ + return 0; \ + } \ + } + #define ADDOP_I(C, OP, O) { \ if (!compiler_addop_i((C), (OP), (O))) \ *************** *** 958,961 **** --- 993,998 ---- if (!compiler_enter_scope(c, s->v.ClassDef.name, (void *)s)) return 0; + c->u->u_private = s->v.ClassDef.name; + Py_INCREF(c->u->u_private); str = PyString_InternFromString("__name__"); if (!str || !compiler_nameop(c, str, Load)) { *************** *** 1350,1354 **** identifier store_name; ADDOP_O(c, LOAD_CONST, Py_None, consts); ! ADDOP_O(c, IMPORT_NAME, alias->name, names); /* XXX: handling of store_name should be cleaned up */ --- 1387,1391 ---- identifier store_name; ADDOP_O(c, LOAD_CONST, Py_None, consts); ! ADDOP_NAME(c, IMPORT_NAME, alias->name); /* XXX: handling of store_name should be cleaned up */ *************** *** 1395,1399 **** ADDOP_O(c, LOAD_CONST, names, consts); ! ADDOP_O(c, IMPORT_NAME, s->v.ImportFrom.module, names); for (i = 0; i < n; i++) { alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i); --- 1432,1436 ---- ADDOP_O(c, LOAD_CONST, names, consts); ! ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module); for (i = 0; i < n; i++) { alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i); *************** *** 1407,1411 **** } ! ADDOP_O(c, IMPORT_FROM, alias->name, names); store_name = alias->name; if (alias->asname) --- 1444,1448 ---- } ! ADDOP_NAME(c, IMPORT_FROM, alias->name); store_name = alias->name; if (alias->asname) *************** *** 1761,1765 **** assert(op); ! ADDOP_O(c, op, name, names); return 1; } --- 1798,1802 ---- assert(op); ! ADDOP_NAME(c, op, name); return 1; } *************** *** 2059,2063 **** /* Fall through to load */ case Load: ! ADDOP_O(c, LOAD_ATTR, e->v.Attribute.attr, names); break; case AugStore: --- 2096,2100 ---- /* Fall through to load */ case Load: ! ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr); break; case AugStore: *************** *** 2065,2072 **** /* Fall through to save */ case Store: ! ADDOP_O(c, STORE_ATTR, e->v.Attribute.attr, names); break; case Del: ! ADDOP_O(c, DELETE_ATTR, e->v.Attribute.attr, names); break; case Param: --- 2102,2109 ---- /* Fall through to save */ case Store: ! ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr); break; case Del: ! ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr); break; case Param: From arigo at users.sourceforge.net Sat Mar 20 15:03:20 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sat Mar 20 15:13:14 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.383,2.384 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18748 Modified Files: ceval.c Log Message: A 2% speed improvement with gcc on low-endian machines. My guess is that this new pattern for NEXTARG() is detected and optimized as a single (*short) loading. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.383 retrieving revision 2.384 diff -C2 -d -r2.383 -r2.384 *** ceval.c 12 Mar 2004 16:33:17 -0000 2.383 --- ceval.c 20 Mar 2004 20:03:17 -0000 2.384 *************** *** 628,632 **** #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) ! #define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2]) #define JUMPTO(x) (next_instr = first_instr + (x)) #define JUMPBY(x) (next_instr += (x)) --- 628,633 ---- #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) ! #define OPARG() (next_instr[0] + (next_instr[1]<<8)) ! #define OPARG_SIZE 2 #define JUMPTO(x) (next_instr = first_instr + (x)) #define JUMPBY(x) (next_instr += (x)) *************** *** 659,664 **** #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr[2]<<8) + \ ! next_instr[1]; next_instr += 3 /* Stack manipulation macros */ --- 660,664 ---- #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: next_instr++; oparg = OPARG(); next_instr += OPARG_SIZE /* Stack manipulation macros */ *************** *** 863,868 **** opcode = NEXTOP(); ! if (HAS_ARG(opcode)) ! oparg = NEXTARG(); dispatch_opcode: #ifdef DYNAMIC_EXECUTION_PROFILE --- 863,871 ---- opcode = NEXTOP(); ! if (HAS_ARG(opcode)) { ! oparg = OPARG(); ! next_instr += OPARG_SIZE; ! } ! dispatch_opcode: #ifdef DYNAMIC_EXECUTION_PROFILE *************** *** 2250,2254 **** case EXTENDED_ARG: opcode = NEXTOP(); ! oparg = oparg<<16 | NEXTARG(); goto dispatch_opcode; --- 2253,2258 ---- case EXTENDED_ARG: opcode = NEXTOP(); ! oparg = oparg<<16 | OPARG(); ! next_instr += OPARG_SIZE; goto dispatch_opcode; From tim_one at users.sourceforge.net Sat Mar 20 15:11:31 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 20 15:21:27 2004 Subject: [Python-checkins] python/dist/src/Lib hmac.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20234/Lib Modified Files: hmac.py Log Message: Speed HMAC.copy() by installing a secret backdoor argument to HMAC.__init__(). Adapted from SF patch 895445 "hmac.HMAC.copy() speedup" by Trevor Perrin, who reported that this approach increased throughput of his hmac-intensive app by 30%. Index: hmac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hmac.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** hmac.py 3 Jun 2002 15:58:31 -0000 1.7 --- hmac.py 20 Mar 2004 20:11:29 -0000 1.8 *************** *** 13,16 **** --- 13,21 ---- digest_size = None + # A unique object passed by HMAC.copy() to the HMAC constructor, in order + # that the latter return very quickly. HMAC("") in contrast is quite + # expensive. + _secret_backdoor_key = [] + class HMAC: """RFC2104 HMAC class. *************** *** 26,29 **** --- 31,38 ---- digestmod: A module supporting PEP 247. Defaults to the md5 module. """ + + if key is _secret_backdoor_key: # cheap + return + if digestmod is None: import md5 *************** *** 61,66 **** An update to this copy won't affect the original object. """ ! other = HMAC("") other.digestmod = self.digestmod other.inner = self.inner.copy() other.outer = self.outer.copy() --- 70,76 ---- An update to this copy won't affect the original object. """ ! other = HMAC(_secret_backdoor_key) other.digestmod = self.digestmod + other.digest_size = self.digest_size other.inner = self.inner.copy() other.outer = self.outer.copy() From twouters at users.sourceforge.net Sat Mar 20 15:29:52 2004 From: twouters at users.sourceforge.net (twouters@users.sourceforge.net) Date: Sat Mar 20 15:39:46 2004 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py, 1.52, 1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23241/Lib/email/test Modified Files: test_email.py Log Message: test_email: comment out two fail-test cases that no longer fail with the new parser -- for now. Failure behaviour of the new parser(s) will change in any case, so this will be revisited later anyway. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** test_email.py 3 Sep 2003 04:10:52 -0000 1.52 --- test_email.py 20 Mar 2004 20:29:50 -0000 1.53 *************** *** 1188,1201 **** eq(msg.get_subtype(), None) ! def test_bogus_boundary(self): ! fp = openfile(findfile('msg_15.txt')) ! try: ! data = fp.read() ! finally: ! fp.close() ! p = Parser(strict=True) ! # Note, under a future non-strict parsing mode, this would parse the ! # message into the intended message tree. ! self.assertRaises(Errors.BoundaryError, p.parsestr, data) def test_multipart_no_boundary(self): --- 1188,1202 ---- eq(msg.get_subtype(), None) ! ## XXX: No longer fails with the new parser. Should it ? ! ## def test_bogus_boundary(self): ! ## fp = openfile(findfile('msg_15.txt')) ! ## try: ! ## data = fp.read() ! ## finally: ! ## fp.close() ! ## p = Parser(strict=True) ! ## # Note, under a future non-strict parsing mode, this would parse the ! ## # message into the intended message tree. ! ## self.assertRaises(Errors.BoundaryError, p.parsestr, data) def test_multipart_no_boundary(self): *************** *** 1245,1263 **** """) ! def test_no_separating_blank_line(self): ! eq = self.ndiffAssertEqual ! msg = self._msgobj('msg_35.txt') ! eq(msg.as_string(), """\ ! From: aperson@dom.ain ! To: bperson@dom.ain ! Subject: here's something interesting ! ! counter to RFC 2822, there's no separating newline here ! """) ! # strict=True should raise an exception ! self.assertRaises(Errors.HeaderParseError, ! self._msgobj, 'msg_35.txt', True) ! ! # Test RFC 2047 header encoding and decoding --- 1246,1265 ---- """) ! ## XXX: No longer fails with the new parser. Should it ? ! ## def test_no_separating_blank_line(self): ! ## eq = self.ndiffAssertEqual ! ## msg = self._msgobj('msg_35.txt') ! ## eq(msg.as_string(), """\ ! ## From: aperson@dom.ain ! ## To: bperson@dom.ain ! ## Subject: here's something interesting ! ## ! ## counter to RFC 2822, there's no separating newline here ! ## """) ! ## # strict=True should raise an exception ! ## self.assertRaises(Errors.HeaderParseError, ! ## self._msgobj, 'msg_35.txt', True) ! ## ! ## # Test RFC 2047 header encoding and decoding From pje at users.sourceforge.net Sat Mar 20 15:52:14 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat Mar 20 16:02:11 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command depends.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27800/setuptools/command Modified Files: depends.py Log Message: Flesh out 'depends' command to display dependencies' status, and halt if all requirements aren't met. (Also, check planned install location for the dependencies, as well as checking sys.path.) Also: * Allow 'Feature()' objects to include 'Require()' objects, so that dependencies can be optional * 'Require()' objects can set a homepage, whose URL will be displayed by the 'depends' command if the dependency needs to be installed. * Misc. fixes/refactoring of version validation to properly handle "unknown" versions, and to decouple version fetching from version checking. * Updated TODO to remove various completed items. Index: depends.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/depends.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** depends.py 19 Mar 2004 20:53:14 -0000 1.1 --- depends.py 20 Mar 2004 20:52:11 -0000 1.2 *************** *** 1,6 **** from distutils.cmd import Command ! import os class depends(Command): """Download and install dependencies, if needed""" --- 1,8 ---- from distutils.cmd import Command ! import os, sys ! class depends(Command): + """Download and install dependencies, if needed""" *************** *** 14,27 **** ] def initialize_options(self): self.temp = None - self.install_purelib = self.install_platlib = None - self.install_lib = self.install_libbase = None - self.install_scripts = self.install_data = self.install_headers = None - self.compiler = self.debug = self.force = None def finalize_options(self): self.set_undefined_options('build',('build_temp', 'temp')) def run(self): ! self.announce("downloading and building here") --- 16,82 ---- ] + path_attrs = [ + # Note: these must be in *reverse* order, as they are pushed onto the + # *front* of a copy of sys.path. + ('install','install_libbase'), # installation base if extra_path + ('install_lib','install_dir'), # where modules are installed + ] + + def initialize_options(self): self.temp = None def finalize_options(self): self.set_undefined_options('build',('build_temp', 'temp')) + self.set_search_path() + + def set_search_path(self): + """Determine paths to check for installed dependencies""" + path = sys.path[:] # copy sys path + for cmd,attr in self.path_attrs: + dir = getattr(self.get_finalized_command(cmd),attr,None) + if dir and dir not in path: + path.insert(0,dir) # prepend + self.search_path = path def run(self): ! self.announce("checking for installed dependencies") ! needed = [ ! dep for dep in self.distribution.requires if self.is_needed(dep) ! ] ! if not needed: ! self.announce("all dependencies are present and up-to-date") ! return ! ! # Alert the user to missing items ! fmt = "\t%s\t%s\n" ! items = [fmt % (dep.full_name(),dep.homepage) for dep in needed] ! items.insert(0,"Please install the following packages first:\n") ! items.append('') ! raise SystemExit('\n'.join(items)) # dump msg to stderr and exit ! ! ! def is_needed(self,dep): ! """Does the specified dependency need to be installed/updated?""" ! ! self.announce("searching for "+dep.full_name()) ! version = dep.get_version(self.search_path) ! ! if version is None: ! self.announce(name+" not found!") ! return True ! ! if str(version)=="unknown": ! status = dep.name+" is installed" ! else: ! status = dep.name+" version "+str(version)+" found" ! ! if dep.version_ok(version): ! self.announce(status+" (OK)") ! return False ! else: ! self.announce(status+" (update needed)") ! return True ! ! ! From pje at users.sourceforge.net Sat Mar 20 15:52:13 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat Mar 20 16:02:15 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools TODO.txt, 1.1, 1.2 setup.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27800 Modified Files: TODO.txt setup.py Log Message: Flesh out 'depends' command to display dependencies' status, and halt if all requirements aren't met. (Also, check planned install location for the dependencies, as well as checking sys.path.) Also: * Allow 'Feature()' objects to include 'Require()' objects, so that dependencies can be optional * 'Require()' objects can set a homepage, whose URL will be displayed by the 'depends' command if the dependency needs to be installed. * Misc. fixes/refactoring of version validation to properly handle "unknown" versions, and to decouple version fetching from version checking. * Updated TODO to remove various completed items. Index: TODO.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/TODO.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TODO.txt 19 Mar 2004 20:53:14 -0000 1.1 --- TODO.txt 20 Mar 2004 20:52:11 -0000 1.2 *************** *** 11,18 **** * Dependency class - * Check for presence/version via file existence, regular expression match, - version comparison (using 'distutils.version' classes), installed on - sys.path, or require just installation directory - * Find appropriate release, or explain why not --- 11,14 ---- *************** *** 43,58 **** * REQUIRES should probably just be list of dependencies - * Bootstrap module - - The idea here is that you include the "bootstrap module" in your - distribution, and it downloads the right version of setuptools automatically - if a good-enough version isn't on sys.path. This would let you use - setuptools for your installer, without having to distribute the full - setuptools package. This would might look something like:: - - from boot_setuptools import require_version - require_version("0.6", "http://somewhere/setuptools-0.6.tar.gz") - - from setuptools import setup, Feature, findPackages - # ...etc - --- 39,40 ---- Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 19 Mar 2004 20:53:14 -0000 1.1 --- setup.py 20 Mar 2004 20:52:11 -0000 1.2 *************** *** 4,7 **** --- 4,8 ---- from setuptools import setup, find_packages, Require + from distutils.version import LooseVersion setup( *************** *** 15,19 **** test_suite = 'setuptools.tests.test_suite', ! requires = [Require('Distutils','1.0.3','distutils')], packages = find_packages(), py_modules = ['setuptools_boot'], --- 16,25 ---- test_suite = 'setuptools.tests.test_suite', ! requires = [ ! Require('Distutils','1.0.3','distutils', ! "http://www.python.org/sigs/distutils-sig/" ! ), ! Require('PyUnit', None, 'unittest', "http://pyunit.sf.net/"), ! ], packages = find_packages(), py_modules = ['setuptools_boot'], From pje at users.sourceforge.net Sat Mar 20 15:52:13 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat Mar 20 16:02:17 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools depends.py, 1.1, 1.2 dist.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27800/setuptools Modified Files: depends.py dist.py Log Message: Flesh out 'depends' command to display dependencies' status, and halt if all requirements aren't met. (Also, check planned install location for the dependencies, as well as checking sys.path.) Also: * Allow 'Feature()' objects to include 'Require()' objects, so that dependencies can be optional * 'Require()' objects can set a homepage, whose URL will be displayed by the 'depends' command if the dependency needs to be installed. * Misc. fixes/refactoring of version validation to properly handle "unknown" versions, and to decouple version fetching from version checking. * Updated TODO to remove various completed items. Index: depends.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/depends.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** depends.py 19 Mar 2004 20:53:14 -0000 1.1 --- depends.py 20 Mar 2004 20:52:11 -0000 1.2 *************** *** 11,15 **** """A prerequisite to building or installing a distribution""" ! def __init__(self,name,requested_version,module,attribute=None,format=None): if format is None and requested_version is not None: --- 11,17 ---- """A prerequisite to building or installing a distribution""" ! def __init__(self,name,requested_version,module,homepage='', ! attribute=None,format=None ! ): if format is None and requested_version is not None: *************** *** 21,41 **** attribute = '__version__' ! self.name = name ! self.requested_version = requested_version ! self.module = module ! self.attribute = attribute ! self.format = format ! ! ! ! ! ! ! ! --- 23,41 ---- attribute = '__version__' ! self.__dict__.update(locals()) ! del self.self + def full_name(self): + """Return full package/distribution name, w/version""" + if self.requested_version is not None: + return '%s-%s' % (self.name,self.requested_version) + return self.name + def version_ok(self,version): + """Is 'version' sufficiently up-to-date?""" + return self.attribute is None or self.format is None or \ + str(version)<>"unknown" and version >= self.requested_version *************** *** 67,74 **** --- 67,76 ---- return v + def is_present(self,paths=None): """Return true if dependency is present on 'paths'""" return self.get_version(paths) is not None + def is_current(self,paths=None): """Return true if dependency is present and up-to-date on 'paths'""" *************** *** 76,82 **** if version is None: return False ! return self.attribute is None or self.format is None or \ ! version >= self.requested_version ! --- 78,82 ---- if version is None: return False ! return self.version_ok(version) Index: dist.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/dist.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dist.py 19 Mar 2004 20:53:14 -0000 1.1 --- dist.py 20 Mar 2004 20:52:11 -0000 1.2 *************** *** 1,6 **** __all__ = ['Distribution', 'Feature'] - from distutils.core import Distribution as _Distribution from distutils.core import Extension from setuptools.command.build_py import build_py from setuptools.command.build_ext import build_ext --- 1,6 ---- __all__ = ['Distribution', 'Feature'] from distutils.core import Distribution as _Distribution from distutils.core import Extension + from setuptools.depends import Require from setuptools.command.build_py import build_py from setuptools.command.build_ext import build_ext *************** *** 12,16 **** class Distribution(_Distribution): - """Distribution with support for features, tests, and package data --- 12,15 ---- *************** *** 68,72 **** self.cmdclass.setdefault('install',install) self.cmdclass.setdefault('install_lib',install_lib) - if self.features: self._set_global_opts_from_features() --- 67,70 ---- *************** *** 289,293 **** class Feature: - """A subset of the distribution that can be excluded if unneeded/wanted --- 287,290 ---- *************** *** 313,316 **** --- 310,315 ---- 'requires' -- a string or sequence of strings naming features that should also be included if this feature is included. Defaults to empty list. + May also contain 'Require' objects that should be added/removed from + the distribution. 'remove' -- a string or list of strings naming packages to be removed *************** *** 346,358 **** self.available = available self.optional = optional ! ! if isinstance(requires,str): requires = requires, ! self.requires = requires if isinstance(remove,str): remove = remove, - self.remove = remove self.extras = extras --- 345,357 ---- self.available = available self.optional = optional ! if isinstance(requires,(str,Require)): requires = requires, ! self.requires = [r for r in requires if isinstance(r,str)] ! er = [r for r in requires if not isinstance(r,str)] ! if er: extras['requires'] = er if isinstance(remove,str): remove = remove, self.remove = remove self.extras = extras *************** *** 369,373 **** return self.available and self.standard - def include_in(self,dist): --- 368,371 ---- From pje at users.sourceforge.net Sat Mar 20 15:52:14 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sat Mar 20 16:02:20 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests __init__.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27800/setuptools/tests Modified Files: __init__.py Log Message: Flesh out 'depends' command to display dependencies' status, and halt if all requirements aren't met. (Also, check planned install location for the dependencies, as well as checking sys.path.) Also: * Allow 'Feature()' objects to include 'Require()' objects, so that dependencies can be optional * 'Require()' objects can set a homepage, whose URL will be displayed by the 'depends' command if the dependency needs to be installed. * Misc. fixes/refactoring of version validation to properly handle "unknown" versions, and to decouple version fetching from version checking. * Updated TODO to remove various completed items. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 19 Mar 2004 20:53:14 -0000 1.1 --- __init__.py 20 Mar 2004 20:52:12 -0000 1.2 *************** *** 11,17 **** from setuptools.depends import find_module, Require from distutils.version import StrictVersion, LooseVersion ! import sys, os.path def makeSetup(**args): """Return distribution from 'setup(**args)', without executing commands""" --- 11,18 ---- from setuptools.depends import find_module, Require from distutils.version import StrictVersion, LooseVersion ! from distutils.util import convert_path import sys, os.path + def makeSetup(**args): """Return distribution from 'setup(**args)', without executing commands""" *************** *** 39,43 **** - class DependsTests(TestCase): --- 40,43 ---- *************** *** 81,93 **** ) - def testDependsCmd(self): - dist = makeSetup() - cmd = dist.get_command_obj('depends') - cmd.ensure_finalized() - self.assertEqual(cmd.temp, dist.get_command_obj('build').build_temp) - self.assertEqual(cmd.install_lib, dist.get_command_obj('install').install_lib) - - def testRequire(self): req = Require('Distutils','1.0.3','distutils') --- 81,86 ---- ) def testRequire(self): + req = Require('Distutils','1.0.3','distutils') *************** *** 96,102 **** --- 89,99 ---- self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') + self.assertEqual(req.full_name(), 'Distutils-1.0.3') from distutils import __version__ self.assertEqual(req.get_version(), __version__) + self.failUnless(req.version_ok('1.0.9')) + self.failIf(req.version_ok('0.9.1')) + self.failIf(req.version_ok('unknown')) self.failUnless(req.is_present()) *************** *** 106,109 **** --- 103,107 ---- self.failUnless(req.is_present()) self.failIf(req.is_current()) + self.failIf(req.version_ok('unknown')) req = Require('Do-what-I-mean','1.0','d-w-i-m') *************** *** 111,118 **** self.failIf(req.is_current()) ! req = Require('Tests', None, 'tests') self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) paths = [os.path.dirname(p) for p in __path__] --- 109,118 ---- self.failIf(req.is_current()) ! req = Require('Tests', None, 'tests', homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) + self.assertEqual(req.full_name(), 'Tests') + self.assertEqual(req.homepage, 'http://example.com') paths = [os.path.dirname(p) for p in __path__] *************** *** 122,125 **** --- 122,166 ---- + def testDependsCmd(self): + path1 = convert_path('foo/bar/baz') + path2 = convert_path('foo/bar/baz/spam') + + dist = makeSetup( + extra_path='spam', + script_args=['install','--install-lib',path1] + ) + + cmd = dist.get_command_obj('depends') + cmd.ensure_finalized() + + self.assertEqual(cmd.temp, dist.get_command_obj('build').build_temp) + self.assertEqual(cmd.search_path, [path2,path1]+sys.path) + + + + + + + + + + + + + + + + + + + + + + + + + + + class DistroTests(TestCase): *************** *** 248,254 **** def setUp(self): self.dist = makeSetup( features={ ! 'foo': Feature("foo",standard=True,requires='baz'), 'bar': Feature("bar", standard=True, packages=['pkg.bar'], py_modules=['bar_et'], remove=['bar.ext'], --- 289,296 ---- def setUp(self): + self.req = Require('Distutils','1.0.3','distutils') self.dist = makeSetup( features={ ! 'foo': Feature("foo",standard=True,requires=['baz',self.req]), 'bar': Feature("bar", standard=True, packages=['pkg.bar'], py_modules=['bar_et'], remove=['bar.ext'], *************** *** 285,289 **** ) - def testFeatureOptions(self): dist = self.dist --- 327,330 ---- *************** *** 310,314 **** self.assertEqual(dist.with_bar,0) self.assertEqual(dist.with_baz,1) - self.failIf('bar_et' in dist.py_modules) self.failIf('pkg.bar' in dist.packages) --- 351,354 ---- *************** *** 317,320 **** --- 357,361 ---- self.failUnless(('libfoo','foo/foofoo.c') in dist.libraries) self.assertEqual(dist.ext_modules,[]) + self.assertEqual(dist.requires, [self.req]) # If we ask for bar, it should fail because we explicitly disabled From gvanrossum at users.sourceforge.net Sat Mar 20 16:00:29 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat Mar 20 16:10:32 2004 Subject: [Python-checkins] python/dist/src/PCbuild readme.txt,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29168 Modified Files: readme.txt Log Message: Tweaked after following all these instructions. Removed Win9x notes (since the .NET compiler requires Win2K or XP anyway). Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** readme.txt 9 Jan 2004 16:05:07 -0000 1.48 --- readme.txt 20 Mar 2004 21:00:26 -0000 1.49 *************** *** 64,68 **** _tkinter Python wrapper for the Tk windowing system. Requires building ! Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.3: Get source --- 64,69 ---- _tkinter Python wrapper for the Tk windowing system. Requires building ! Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.5; these ! should work for version 8.4.6 too, with suitable substitutions: Get source *************** *** 78,85 **** respectively. ! Build Tcl first (done here w/ MSVC 6 on Win98SE) --------------- cd dist\tcl8.4.5\win - run vcvars32.bat [necessary even on Win2K] nmake -f makefile.vc nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install --- 79,88 ---- respectively. ! Build Tcl first (done here w/ MSVC 7.1 on Windows XP) --------------- + Use "Start -> All Programs -> Microsoft Visual Studio .NET 2003 + -> Visual Studio .NET Tools -> Visual Studio .NET 2003 Command Prompt" + to get a shell window with the correct environment settings cd dist\tcl8.4.5\win nmake -f makefile.vc nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install *************** *** 87,94 **** XXX Should we compile with OPTS=threads? ! XXX Some tests failed in "nmake -f makefile.vc test". ! XXX all.tcl: Total 10480 Passed 9743 Skipped 719 Failed 18 ! XXX ! XXX That was on Win98SE. On Win2K: XXX all.tcl Total 10480 Passed 9781 Skipped 698 Failed 1 --- 90,94 ---- XXX Should we compile with OPTS=threads? ! XXX Some tests failed in "nmake -f makefile.vc test". On Win2K: XXX all.tcl Total 10480 Passed 9781 Skipped 698 Failed 1 *************** *** 181,187 **** instructions for building the Sleepycat software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. ! Build the Release version ("build_all -- Win32 Release"). ! XXX We're actually linking against Release_static\libdb42s.lib. XXX This yields the following warnings: """ --- 181,187 ---- instructions for building the Sleepycat software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. ! Build the "Release Static" version. ! XXX We're linking against Release_static\libdb42s.lib. XXX This yields the following warnings: """ *************** *** 203,208 **** XXX The test_bsddb3 tests don't always pass, on Windows (according to ! XXX me) or on Linux (according to Barry). I had much better luck ! XXX on Win2K than on Win98SE. The common failure mode across platforms XXX is XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable --- 203,208 ---- XXX The test_bsddb3 tests don't always pass, on Windows (according to ! XXX me) or on Linux (according to Barry). (I had much better luck ! XXX on Win2K than on Win98SE.) The common failure mode across platforms XXX is XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable *************** *** 255,260 **** installation, then invokes a simple makefile to build the final .pyd. - Win9x users: see "Win9x note" below. - build_ssl.py attempts to catch the most common errors (such as not being able to find OpenSSL sources, or not being able to find a Perl --- 255,258 ---- *************** *** 268,295 **** this by hand. - Win9x note: If, near the start of the build process, you see - something like - - C:\Code\openssl-0.9.7c>set OPTS=no-asm - Out of environment space - - then you're in trouble, and will probably also see these errors near - the end of the process: - - NMAKE : fatal error U1073: don't know how to make - 'crypto\md5\asm\m5_win32.asm' - Stop. - NMAKE : fatal error U1073: don't know how to make - 'C:\Code\openssl-0.9.6g/out32/libeay32.lib' - Stop. - - You need more environment space. Win9x only has room for 256 bytes - by default, and especially after installing ActivePerl (which fiddles - the PATH envar), you're likely to run out. KB Q230205 - - http://support.microsoft.com/default.aspx?scid=KB;en-us;q230205 - - explains how to edit CONFIG.SYS to cure this. - YOUR OWN EXTENSION DLLs --- 266,269 ---- From python at rcn.com Sat Mar 20 16:14:58 2004 From: python at rcn.com (Raymond Hettinger) Date: Sat Mar 20 16:17:09 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.383,2.384 In-Reply-To: Message-ID: <000201c40ec0$671ed4c0$e229c797@oemcomputer> > Modified Files: > ceval.c > Log Message: > A 2% speed improvement with gcc on low-endian machines. My guess is that > this > new pattern for NEXTARG() is detected and optimized as a single (*short) > loading. It is possible to verify that guess by looking at the generated assembler. There are other possible reasons. One is that the negative array offsets don't compile well into a native addressing mode of base+offset*wordsize. I have seen and proven that is the case in other parts of the code base. The other reason for the speedup is that pre-incrementing the pointer prevented the lookup from being done in parallel (i.e. a sequential dependency was present). If the latter reason is a true cause, then part of the checkin is counter-productive. The change to PREDICTED_WITH_ARG introduces a pre-increment in addition to the post-increment. Please run another timing with and without the change to PREDICTED_WITH_ARG. I suspect the old way ran faster. Also, the old way will always be faster on big-endian machines and would be faster on machines with less sophisticated compilers (and possibly slower on MSVC++ if it doesn't automatically generate a load short). Another consideration is that loading a short may perform much differently on other architectures because even alignment only occurs half of the time. Summary: +1 on the changes to NEXT_ARG and EXTENDED_ARG; -1 on the change to PREDICTED_WITH_ARG. Raymond Hettinger > #define PREDICTED(op) PRED_##op: next_instr++ > ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr[2]<<8) > + \ > ! next_instr[1]; next_instr += 3 > > /* Stack manipulation macros */ > --- 660,664 ---- > > #define PREDICTED(op) PRED_##op: next_instr++ > ! #define PREDICTED_WITH_ARG(op) PRED_##op: next_instr++; oparg = > OPARG(); next_instr += OPARG_SIZE From bcannon at users.sourceforge.net Sat Mar 20 16:08:20 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 16:18:14 2004 Subject: [Python-checkins] python/dist/src/Lib site.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30132/Lib Modified Files: site.py Log Message: Fix how line endings were handled when iterating over a .pth file by stripping all whitespace at the end of the path line. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** site.py 13 Feb 2004 07:14:13 -0000 1.57 --- site.py 20 Mar 2004 21:08:17 -0000 1.58 *************** *** 149,154 **** exec dir continue ! if dir[-1] == '\n': ! dir = dir[:-1] dir, dircase = makepath(sitedir, dir) if not dircase in _dirs_in_sys_path and os.path.exists(dir): --- 149,153 ---- exec dir continue ! dir = dir.rstrip() dir, dircase = makepath(sitedir, dir) if not dircase in _dirs_in_sys_path and os.path.exists(dir): From arigo at users.sourceforge.net Sat Mar 20 16:10:29 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sat Mar 20 16:20:23 2004 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.77,2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30901 Modified Files: frameobject.c Log Message: memset() with small memory sizes just kill us. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -d -r2.77 -r2.78 *** frameobject.c 27 Jan 2004 16:08:07 -0000 2.77 --- frameobject.c 20 Mar 2004 21:10:27 -0000 2.78 *************** *** 541,545 **** PyFrameObject *f; PyObject *builtins; ! int extras, ncells, nfrees; #ifdef Py_DEBUG --- 541,545 ---- PyFrameObject *f; PyObject *builtins; ! int extras, ncells, nfrees, i; #ifdef Py_DEBUG *************** *** 642,646 **** extras = f->f_nlocals + ncells + nfrees; ! memset(f->f_localsplus, 0, extras * sizeof(f->f_localsplus[0])); f->f_valuestack = f->f_localsplus + extras; --- 642,648 ---- extras = f->f_nlocals + ncells + nfrees; ! /* Tim said it's ok to replace memset */ ! for (i=0; if_localsplus[i] = NULL; f->f_valuestack = f->f_localsplus + extras; From bcannon at users.sourceforge.net Sat Mar 20 16:14:27 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 16:24:22 2004 Subject: [Python-checkins] python/dist/src/Lib site.py,1.53.6.4,1.53.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31098/Lib Modified Files: Tag: release23-maint site.py Log Message: Strip all whitespace at the end of a line when validating paths specified in a .pth file. Fixes bug #700055 . Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.53.6.4 retrieving revision 1.53.6.5 diff -C2 -d -r1.53.6.4 -r1.53.6.5 *** site.py 2 Dec 2003 15:00:54 -0000 1.53.6.4 --- site.py 20 Mar 2004 21:14:25 -0000 1.53.6.5 *************** *** 149,154 **** exec dir continue ! if dir[-1] == '\n': ! dir = dir[:-1] dir, dircase = makepath(sitedir, dir) if not dircase in _dirs_in_sys_path and os.path.exists(dir): --- 149,153 ---- exec dir continue ! dir = dir.rstrip() dir, dircase = makepath(sitedir, dir) if not dircase in _dirs_in_sys_path and os.path.exists(dir): From bcannon at users.sourceforge.net Sat Mar 20 16:18:49 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 16:28:42 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.91,1.831.4.92 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32446/Misc Modified Files: Tag: release23-maint NEWS Log Message: Add mention of fix of bug #700055. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.91 retrieving revision 1.831.4.92 diff -C2 -d -r1.831.4.91 -r1.831.4.92 *** NEWS 15 Feb 2004 21:18:46 -0000 1.831.4.91 --- NEWS 20 Mar 2004 21:18:46 -0000 1.831.4.92 *************** *** 35,38 **** --- 35,40 ---- ------- + - bug 700055: .pth files can now have any type of line endings. + - Patch 817379: Allow absolute ftp paths in urllib2. From python at rcn.com Sat Mar 20 16:26:51 2004 From: python at rcn.com (Raymond Hettinger) Date: Sat Mar 20 16:29:01 2004 Subject: [Python-checkins] Timings [Was: Python-checkins] python/dist/src/Python ceval.c, 2.383, 2.384 In-Reply-To: Message-ID: <000501c40ec2$0fef45c0$e229c797@oemcomputer> > A 2% speed improvement with gcc on low-endian machines. My guess is that > this > new pattern for NEXTARG() is detected and optimized as a single (*short) > loading. One other thought: When testing these kind of optimizations, do not use PyStone! Unfortunately, part of its design is to time a long for-loop and the net that timing out of the total. At best, that means that improvements to for-loops don't showup on PyStone. At worst, PyStone gives results *opposite* of reality. Because of cache effects, empty for-loops run a tad faster than for-loops that do something. Raymond Hettinger From nascheme at users.sourceforge.net Sat Mar 20 16:28:24 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat Mar 20 16:38:19 2004 Subject: [Python-checkins] python/dist/src/Include ast.h, 1.1.2.2, 1.1.2.3 pythonrun.h, 2.49.2.5, 2.49.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv989/Include Modified Files: Tag: ast-branch ast.h pythonrun.h Log Message: Handle encoding_decl nodes. The source encoding is still not used when parsing strings. Index: ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/ast.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** ast.h 30 Aug 2002 19:59:55 -0000 1.1.2.2 --- ast.h 20 Mar 2004 21:28:22 -0000 1.1.2.3 *************** *** 5,9 **** #endif ! extern DL_IMPORT(mod_ty) PyAST_FromNode(const node *); #ifdef __cplusplus --- 5,9 ---- #endif ! extern DL_IMPORT(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags); #ifdef __cplusplus Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.49.2.5 retrieving revision 2.49.2.6 diff -C2 -d -r2.49.2.5 -r2.49.2.6 *** pythonrun.h 26 Jul 2003 00:32:10 -0000 2.49.2.5 --- pythonrun.h 20 Mar 2004 21:28:22 -0000 2.49.2.6 *************** *** 37,43 **** PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, ! int, int); PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, ! char *, char *, int, int *); #define PyParser_SimpleParserString(S, B) \ PyParser_SimplerParserStringFlags(S, B, 0) --- 37,44 ---- PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, ! int, PyCompilerFlags *flags); PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, ! char *, char *, ! PyCompilerFlags *, int *); #define PyParser_SimpleParserString(S, B) \ PyParser_SimplerParserStringFlags(S, B, 0) From nascheme at users.sourceforge.net Sat Mar 20 16:28:25 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat Mar 20 16:38:22 2004 Subject: [Python-checkins] python/dist/src/Python ast.c, 1.1.2.44, 1.1.2.45 pythonrun.c, 2.161.2.9, 2.161.2.10 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv989/Python Modified Files: Tag: ast-branch ast.c pythonrun.c Log Message: Handle encoding_decl nodes. The source encoding is still not used when parsing strings. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.44 retrieving revision 1.1.2.45 diff -C2 -d -r1.1.2.44 -r1.1.2.45 *** ast.c 24 Jan 2004 19:44:12 -0000 1.1.2.44 --- ast.c 20 Mar 2004 21:28:22 -0000 1.1.2.45 *************** *** 10,14 **** #include ! #if 1 #define fprintf if (0) fprintf #endif --- 10,14 ---- #include ! #if 0 #define fprintf if (0) fprintf [...2131 lines suppressed...] for (i = 1; i < NCH(n); i++) { PyObject *s; ! s = parsestr(STR(CHILD(n, i))); if (s == NULL) goto onError; --- 2444,2457 ---- */ static PyObject * ! parsestrplus(struct compiling *c, const node *n) { PyObject *v; int i; REQ(CHILD(n, 0), STRING); ! if ((v = parsestr(STR(CHILD(n, 0)), c->c_encoding)) != NULL) { /* String literal concatenation */ for (i = 1; i < NCH(n); i++) { PyObject *s; ! s = parsestr(STR(CHILD(n, i)), c->c_encoding); if (s == NULL) goto onError; Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.9 retrieving revision 2.161.2.10 diff -C2 -d -r2.161.2.9 -r2.161.2.10 *** pythonrun.c 31 Dec 2003 15:00:06 -0000 2.161.2.9 --- pythonrun.c 20 Mar 2004 21:28:22 -0000 2.161.2.10 *************** *** 620,624 **** mod = PyParser_ASTFromFile(fp, filename, Py_single_input, ps1, ps2, ! PARSER_FLAGS(flags), &errcode); Py_XDECREF(v); Py_XDECREF(w); --- 620,624 ---- mod = PyParser_ASTFromFile(fp, filename, Py_single_input, ps1, ps2, ! flags, &errcode); Py_XDECREF(v); Py_XDECREF(w); *************** *** 1060,1065 **** PyObject *locals, PyCompilerFlags *flags) { ! mod_ty mod = PyParser_ASTFromString(str, "", start, ! PARSER_FLAGS(flags)); return run_err_mod(mod, "", globals, locals, flags); } --- 1060,1064 ---- PyObject *locals, PyCompilerFlags *flags) { ! mod_ty mod = PyParser_ASTFromString(str, "", start, flags); return run_err_mod(mod, "", globals, locals, flags); } *************** *** 1070,1074 **** { mod_ty mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, ! PARSER_FLAGS(flags), NULL); if (closeit) fclose(fp); --- 1069,1073 ---- { mod_ty mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, ! flags, NULL); if (closeit) fclose(fp); *************** *** 1137,1142 **** mod_ty mod; PyCodeObject *co; ! mod = PyParser_ASTFromString(str, filename, start, ! PARSER_FLAGS(flags)); if (mod == NULL) return NULL; --- 1136,1140 ---- mod_ty mod; PyCodeObject *co; ! mod = PyParser_ASTFromString(str, filename, start, flags); if (mod == NULL) return NULL; *************** *** 1148,1156 **** Py_SymtableString(const char *str, const char *filename, int start) { ! /* XXX flags? */ ! mod_ty mod; struct symtable *st; ! mod = PyParser_ASTFromString(str, filename, start, 0); if (mod == NULL) return NULL; --- 1146,1156 ---- Py_SymtableString(const char *str, const char *filename, int start) { ! PyCompilerFlags local_flags; mod_ty mod; struct symtable *st; ! ! local_flags.cf_flags = 0; /* XXX flags? */ ! ! mod = PyParser_ASTFromString(str, filename, start, &local_flags); if (mod == NULL) return NULL; *************** *** 1162,1173 **** mod_ty PyParser_ASTFromString(const char *s, const char *filename, int start, ! int flags) { node *n; perrdetail err; n = PyParser_ParseStringFlags(s, &_PyParser_Grammar, start, &err, ! flags); if (n) ! return PyAST_FromNode(n); else { err_input(&err); --- 1162,1173 ---- mod_ty PyParser_ASTFromString(const char *s, const char *filename, int start, ! PyCompilerFlags *flags) { node *n; perrdetail err; n = PyParser_ParseStringFlags(s, &_PyParser_Grammar, start, &err, ! PARSER_FLAGS(flags)); if (n) ! return PyAST_FromNode(n, flags); else { err_input(&err); *************** *** 1178,1182 **** mod_ty PyParser_ASTFromFile(FILE *fp, const char *filename, int start, char *ps1, ! char *ps2, int flags, int *errcode) { node *n; --- 1178,1182 ---- mod_ty PyParser_ASTFromFile(FILE *fp, const char *filename, int start, char *ps1, ! char *ps2, PyCompilerFlags *flags, int *errcode) { node *n; *************** *** 1184,1190 **** fprintf(stderr, "filename=%s\n", filename); n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, start, ! ps1, ps2, &err, flags); if (n) ! return PyAST_FromNode(n); else { err_input(&err); --- 1184,1190 ---- fprintf(stderr, "filename=%s\n", filename); n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, start, ! ps1, ps2, &err, PARSER_FLAGS(flags)); if (n) ! return PyAST_FromNode(n, flags); else { err_input(&err); From python at rcn.com Sat Mar 20 16:36:20 2004 From: python at rcn.com (Raymond Hettinger) Date: Sat Mar 20 16:38:30 2004 Subject: [Python-checkins] python/dist/src/Objects frameobject.c, 2.77, 2.78 In-Reply-To: Message-ID: <000601c40ec3$631a5c20$e229c797@oemcomputer> > memset() with small memory sizes just kill us. If you know what the break-even point is on both GCC and MSVC++, then also see if the same improvement would apply to the dictionary initialization code macro called by PyDict_New(). If it looks favorable, be sure to time it on Brett's MAC as well as a PC. Raymond Hettinger From bcannon at users.sourceforge.net Sat Mar 20 16:31:35 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 16:41:30 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.949,1.950 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2040/Misc Modified Files: NEWS Log Message: Remove non-existent paths. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.949 retrieving revision 1.950 diff -C2 -d -r1.949 -r1.950 *** NEWS 19 Mar 2004 08:11:56 -0000 1.949 --- NEWS 20 Mar 2004 21:31:33 -0000 1.950 *************** *** 277,280 **** --- 277,282 ---- ------- + - site.py now removes paths that do not exist. + - The ptcp154 codec was added for Kazakh character set support. From bcannon at users.sourceforge.net Sat Mar 20 16:31:35 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 16:41:33 2004 Subject: [Python-checkins] python/dist/src/Lib site.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2040/Lib Modified Files: site.py Log Message: Remove non-existent paths. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** site.py 20 Mar 2004 21:08:17 -0000 1.58 --- site.py 20 Mar 2004 21:31:32 -0000 1.59 *************** *** 80,84 **** # paths. dir, dircase = makepath(dir) ! if not dircase in _dirs_in_sys_path: L.append(dir) _dirs_in_sys_path[dircase] = 1 --- 80,84 ---- # paths. dir, dircase = makepath(dir) ! if not dircase in _dirs_in_sys_path and os.path.exists(dir): L.append(dir) _dirs_in_sys_path[dircase] = 1 From arigo at users.sourceforge.net Sat Mar 20 16:35:12 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sat Mar 20 16:46:12 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2882 Modified Files: tupleobject.c Log Message: memset() hunt continuing. This is a net win. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -d -r2.86 -r2.87 *** tupleobject.c 18 Mar 2004 22:43:10 -0000 2.86 --- tupleobject.c 20 Mar 2004 21:35:09 -0000 2.87 *************** *** 28,31 **** --- 28,32 ---- { register PyTupleObject *op; + int i; if (size < 0) { PyErr_BadInternalCall(); *************** *** 69,73 **** return NULL; } ! memset(op->ob_item, 0, sizeof(*op->ob_item) * size); #if MAXSAVESIZE > 0 if (size == 0) { --- 70,75 ---- return NULL; } ! for (i=0; i < size; i++) ! op->ob_item[i] = NULL; #if MAXSAVESIZE > 0 if (size == 0) { From bcannon at users.sourceforge.net Sat Mar 20 16:41:30 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 16:51:24 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsite.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4016/Doc/lib Modified Files: libsite.tex Log Message: Clarify docs on where .pth files can exist. Index: libsite.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsite.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libsite.tex 30 Dec 2003 22:51:32 -0000 1.25 --- libsite.tex 20 Mar 2004 21:41:28 -0000 1.26 *************** *** 27,31 **** A path configuration file is a file whose name has the form ! \file{\var{package}.pth}; its contents are additional items (one per line) to be added to \code{sys.path}. Non-existing items are never added to \code{sys.path}, but no check is made that the item --- 27,32 ---- A path configuration file is a file whose name has the form ! \file{\var{package}.pth} and exists in one of the four directories ! mentioned above; its contents are additional items (one per line) to be added to \code{sys.path}. Non-existing items are never added to \code{sys.path}, but no check is made that the item From arigo at users.sourceforge.net Sat Mar 20 16:50:16 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sat Mar 20 17:00:29 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.384,2.385 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5408 Modified Files: ceval.c Log Message: Cancelled checkin, sorry. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.384 retrieving revision 2.385 diff -C2 -d -r2.384 -r2.385 *** ceval.c 20 Mar 2004 20:03:17 -0000 2.384 --- ceval.c 20 Mar 2004 21:50:13 -0000 2.385 *************** *** 628,633 **** #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) ! #define OPARG() (next_instr[0] + (next_instr[1]<<8)) ! #define OPARG_SIZE 2 #define JUMPTO(x) (next_instr = first_instr + (x)) #define JUMPBY(x) (next_instr += (x)) --- 628,632 ---- #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) ! #define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2]) #define JUMPTO(x) (next_instr = first_instr + (x)) #define JUMPBY(x) (next_instr += (x)) *************** *** 660,664 **** #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: next_instr++; oparg = OPARG(); next_instr += OPARG_SIZE /* Stack manipulation macros */ --- 659,664 ---- #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr[2]<<8) + \ ! next_instr[1]; next_instr += 3 /* Stack manipulation macros */ *************** *** 863,871 **** opcode = NEXTOP(); ! if (HAS_ARG(opcode)) { ! oparg = OPARG(); ! next_instr += OPARG_SIZE; ! } ! dispatch_opcode: #ifdef DYNAMIC_EXECUTION_PROFILE --- 863,868 ---- opcode = NEXTOP(); ! if (HAS_ARG(opcode)) ! oparg = NEXTARG(); dispatch_opcode: #ifdef DYNAMIC_EXECUTION_PROFILE *************** *** 2253,2258 **** case EXTENDED_ARG: opcode = NEXTOP(); ! oparg = oparg<<16 | OPARG(); ! next_instr += OPARG_SIZE; goto dispatch_opcode; --- 2250,2254 ---- case EXTENDED_ARG: opcode = NEXTOP(); ! oparg = oparg<<16 | NEXTARG(); goto dispatch_opcode; From arigo at tunes.org Sat Mar 20 16:57:48 2004 From: arigo at tunes.org (Armin Rigo) Date: Sat Mar 20 17:01:09 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.383,2.384 In-Reply-To: <000201c40ec0$671ed4c0$e229c797@oemcomputer> References: <000201c40ec0$671ed4c0$e229c797@oemcomputer> Message-ID: <20040320215748.GA20718@vicky.ecs.soton.ac.uk> Hello Raymond, On Sat, Mar 20, 2004 at 04:14:58PM -0500, Raymond Hettinger wrote: > > A 2% speed improvement with gcc on low-endian machines. My guess is > that this new pattern for NEXTARG() is detected and optimized as a single > (*short) loading. > > It is possible to verify that guess by looking at the generated > assembler. I was too hasty in checking this in. That guess is actually false. The speed-up was due (as usual) to random changes in performance when anything around there changes, and cannot be reliably reproduced. I cancelled that change altogether. Armin From tim_one at users.sourceforge.net Sat Mar 20 16:51:14 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 20 17:01:14 2004 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5208/Lib Modified Files: CGIHTTPServer.py Log Message: SF patch 508730 CGIHTTPServer execfile should save cwd UNTESTED!!! This simple two-line patch has been sitting on SF for more than 2 years. I'm guessing it's because nobody knows how to test it -- I sure don't. It doesn't look like you can get to this part of the code on Unixish or Windows systems, so the "how to test it?" puzzle has more than one part. OTOH, if this is dead code, it doesn't matter either if I just broke it . Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** CGIHTTPServer.py 12 Feb 2004 17:35:05 -0000 1.33 --- CGIHTTPServer.py 20 Mar 2004 21:51:12 -0000 1.34 *************** *** 121,125 **** return if not os.path.isfile(scriptfile): ! self.send_error(403, "CGI script is not a plain file (%r)" % scriptname) return --- 121,125 ---- return if not os.path.isfile(scriptfile): ! self.send_error(403, "CGI script is not a plain file (%r)" % scriptname) return *************** *** 274,277 **** --- 274,278 ---- save_stderr = sys.stderr try: + save_cwd = os.getcwd() try: sys.argv = [scriptfile] *************** *** 286,289 **** --- 287,291 ---- sys.stdout = save_stdout sys.stderr = save_stderr + os.chdir(save_cwd) except SystemExit, sts: self.log_error("CGI script exit status %s", str(sts)) From bcannon at users.sourceforge.net Sat Mar 20 16:54:36 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 17:04:32 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.92,1.831.4.93 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5214/Misc Modified Files: Tag: release23-maint NEWS Log Message: Raise RuntimeError if the second argument to isinstance() or issubclass() is a tuple nested to a depth beyond the interpreter's recursion limit to prevent a segfault from blowing the C stack. Fixes bug #858016 . Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.92 retrieving revision 1.831.4.93 diff -C2 -d -r1.831.4.92 -r1.831.4.93 *** NEWS 20 Mar 2004 21:18:46 -0000 1.831.4.92 --- NEWS 20 Mar 2004 21:54:33 -0000 1.831.4.93 *************** *** 35,39 **** ------- ! - bug 700055: .pth files can now have any type of line endings. - Patch 817379: Allow absolute ftp paths in urllib2. --- 35,43 ---- ------- ! - Bug #858016: isinstance() and issubclass() can have their second ! argument be a tuple whose nested depth is capped at the interpreter's ! recursion limit. Raises RuntimeError if the limit reached. ! ! - Bug #700055: .pth files can now have any type of line endings. - Patch 817379: Allow absolute ftp paths in urllib2. From bcannon at users.sourceforge.net Sat Mar 20 16:54:37 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 17:04:34 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c, 2.119, 2.119.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5214/Objects Modified Files: Tag: release23-maint abstract.c Log Message: Raise RuntimeError if the second argument to isinstance() or issubclass() is a tuple nested to a depth beyond the interpreter's recursion limit to prevent a segfault from blowing the C stack. Fixes bug #858016 . Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.119 retrieving revision 2.119.12.1 diff -C2 -d -r2.119 -r2.119.12.1 *** abstract.c 1 Mar 2003 01:44:32 -0000 2.119 --- abstract.c 20 Mar 2004 21:54:34 -0000 2.119.12.1 *************** *** 1998,2001 **** --- 1998,2003 ---- /* Not a general sequence -- that opens up the road to recursion and stack overflow. */ + /* XXX: really an issue even though no subsequences get + iterated over? */ n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; i++) { *************** *** 2036,2041 **** } ! int ! PyObject_IsInstance(PyObject *inst, PyObject *cls) { PyObject *icls; --- 2038,2043 ---- } ! static int ! recursive_isinstance(PyObject *inst, PyObject *cls, int recursion_depth) { PyObject *icls; *************** *** 2072,2083 **** } else if (PyTuple_Check(cls)) { - /* Not a general sequence -- that opens up the road to - recursion and stack overflow. */ int i, n; n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; i++) { ! retval = PyObject_IsInstance( ! inst, PyTuple_GET_ITEM(cls, i)); if (retval != 0) break; --- 2074,2091 ---- } else if (PyTuple_Check(cls)) { int i, n; + if (!recursion_depth) { + PyErr_SetString(PyExc_RuntimeError, + "Recursion depth exceeded"); + return NULL; + } + n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; i++) { ! retval = recursive_isinstance( ! inst, ! PyTuple_GET_ITEM(cls, i), ! recursion_depth-1); if (retval != 0) break; *************** *** 2103,2108 **** } int ! PyObject_IsSubclass(PyObject *derived, PyObject *cls) { int retval; --- 2111,2127 ---- } + /* Use recursive_isinstance to have a hard limit on the depth of the possible + tuple second argument. + + Done to prevent segfaulting by blowing the C stack. + */ int ! PyObject_IsInstance(PyObject *inst, PyObject *cls) ! { ! return recursive_isinstance(inst, cls, Py_GetRecursionLimit()); ! } ! ! static int ! recursive_issubclass(PyObject *derived, PyObject *cls, int recursion_depth) { int retval; *************** *** 2116,2122 **** int i; int n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; ++i) { ! retval = PyObject_IsSubclass( ! derived, PyTuple_GET_ITEM(cls, i)); if (retval != 0) { /* either found it, or got an error */ --- 2135,2150 ---- int i; int n = PyTuple_GET_SIZE(cls); + + if (!recursion_depth) { + PyErr_SetString(PyExc_RuntimeError, + "Recursion depth exceeded"); + return NULL; + } + for (i = 0; i < n; ++i) { ! retval = recursive_issubclass( ! derived, ! PyTuple_GET_ITEM(cls, i), ! recursion_depth-1); if (retval != 0) { /* either found it, or got an error */ *************** *** 2144,2147 **** --- 2172,2186 ---- } + /* Use recursive_issubclass to have a hard limit on the depth of the possible + tuple second argument. + + Done to prevent segfaulting by blowing the C stack. + */ + int + PyObject_IsSubclass(PyObject *derived, PyObject *cls) + { + return recursive_issubclass(derived, cls, Py_GetRecursionLimit()); + } + PyObject * PyObject_GetIter(PyObject *o) From bcannon at users.sourceforge.net Sat Mar 20 16:54:38 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 17:04:38 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_isinstance.py, 1.7, 1.7.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5214/Lib/test Modified Files: Tag: release23-maint test_isinstance.py Log Message: Raise RuntimeError if the second argument to isinstance() or issubclass() is a tuple nested to a depth beyond the interpreter's recursion limit to prevent a segfault from blowing the C stack. Fixes bug #858016 . Index: test_isinstance.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_isinstance.py,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** test_isinstance.py 1 May 2003 17:45:37 -0000 1.7 --- test_isinstance.py 20 Mar 2004 21:54:35 -0000 1.7.8.1 *************** *** 5,8 **** --- 5,9 ---- import unittest from test import test_support + import sys *************** *** 245,248 **** --- 246,267 ---- self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring)))) + def test_subclass_recursion_limit(self): + # make sure that issubclass raises RuntimeError before the C stack is + # blown + self.assertRaises(RuntimeError, blowstack, issubclass, str, str) + + def test_isinstance_recursion_limit(self): + # make sure that issubclass raises RuntimeError before the C stack is + # blown + self.assertRaises(RuntimeError, blowstack, isinstance, '', str) + + def blowstack(fxn, arg, compare_to): + # Make sure that calling isinstance with a deeply nested tuple for its + # argument will raise RuntimeError eventually. + tuple_arg = (compare_to,) + for cnt in xrange(sys.getrecursionlimit()+5): + tuple_arg = (tuple_arg,) + fxn(arg, tuple_arg) + From gvanrossum at users.sourceforge.net Sat Mar 20 17:18:05 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat Mar 20 17:28:01 2004 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10624 Modified Files: CGIHTTPServer.py Log Message: Fix for SF 777848. I've been bitten by this myself in the past half year. I hope this fix is right. I'll backport this to 2.3. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** CGIHTTPServer.py 20 Mar 2004 21:51:12 -0000 1.34 --- CGIHTTPServer.py 20 Mar 2004 22:18:03 -0000 1.35 *************** *** 178,187 **** env['HTTP_COOKIE'] = ', '.join(co) # XXX Other HTTP_* headers ! if not self.have_fork: ! # Since we're setting the env in the parent, provide empty ! # values to override previously set values ! for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', ! 'HTTP_USER_AGENT', 'HTTP_COOKIE'): ! env.setdefault(k, "") os.environ.update(env) --- 178,186 ---- env['HTTP_COOKIE'] = ', '.join(co) # XXX Other HTTP_* headers ! # Since we're setting the env in the parent, provide empty ! # values to override previously set values ! for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', ! 'HTTP_USER_AGENT', 'HTTP_COOKIE'): ! env.setdefault(k, "") os.environ.update(env) From arigo at users.sourceforge.net Sat Mar 20 17:19:33 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sat Mar 20 17:29:28 2004 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.199,2.200 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10655 Modified Files: listobject.c Log Message: Get rid of listextend_internal() and explain why the special case 'a.extend(a)' isn't so special anyway. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -d -r2.199 -r2.200 *** listobject.c 18 Mar 2004 22:43:09 -0000 2.199 --- listobject.c 20 Mar 2004 22:19:23 -0000 2.200 *************** *** 648,701 **** } - static int - listextend_internal(PyListObject *self, PyObject *b) - { - int selflen = PyList_GET_SIZE(self); - int blen; - register int i; - PyObject **src, **dest; - - blen = PyObject_Size(b); - if (blen == 0) { - /* short circuit when b is empty */ - Py_DECREF(b); - return 0; - } - - if (self == (PyListObject*)b) { - /* as in list_ass_slice() we must special case the - * situation: a.extend(a) - * - * XXX: I think this way ought to be faster than using - * list_slice() the way list_ass_slice() does. - */ - Py_DECREF(b); - b = PyList_New(selflen); - if (!b) - return -1; - for (i = 0; i < selflen; i++) { - PyObject *o = PyList_GET_ITEM(self, i); - Py_INCREF(o); - PyList_SET_ITEM(b, i, o); - } - } - - if (list_resize(self, selflen + blen) == -1) { - Py_DECREF(b); - return -1; - } - - /* populate the end of self with b's items */ - src = PySequence_Fast_ITEMS(b); - dest = self->ob_item + selflen; - for (i = 0; i < blen; i++) { - PyObject *o = src[i]; - Py_INCREF(o); - dest[i] = o; - } - Py_DECREF(b); - return 0; - } - static PyObject * listextend(PyListObject *self, PyObject *b) --- 648,651 ---- *************** *** 713,721 **** */ if (PyList_CheckExact(b) || PyTuple_CheckExact(b) || (PyObject *)self == b) { b = PySequence_Fast(b, "argument must be iterable"); if (!b) return NULL; ! if (listextend_internal(self, b) < 0) return NULL; Py_RETURN_NONE; } --- 663,695 ---- */ if (PyList_CheckExact(b) || PyTuple_CheckExact(b) || (PyObject *)self == b) { + PyObject **src, **dest; b = PySequence_Fast(b, "argument must be iterable"); if (!b) return NULL; ! n = PySequence_Fast_GET_SIZE(b); ! if (n == 0) { ! /* short circuit when b is empty */ ! Py_DECREF(b); ! Py_RETURN_NONE; ! } ! m = self->ob_size; ! if (list_resize(self, m + n) == -1) { ! Py_DECREF(b); return NULL; + } + /* note that we may still have self == b here for the + * situation a.extend(a), but the following code works + * in that case too. Just make sure to resize self + * before calling PySequence_Fast_ITEMS. + */ + /* populate the end of self with b's items */ + src = PySequence_Fast_ITEMS(b); + dest = self->ob_item + m; + for (i = 0; i < n; i++) { + PyObject *o = src[i]; + Py_INCREF(o); + dest[i] = o; + } + Py_DECREF(b); Py_RETURN_NONE; } From gvanrossum at users.sourceforge.net Sat Mar 20 17:22:33 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat Mar 20 17:32:28 2004 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py, 1.32, 1.32.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11439 Modified Files: Tag: release23-maint CGIHTTPServer.py Log Message: Backporting to 2.3: Fix for SF 777848. I've been bitten by this myself in the past half year. I hope this fix is right. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.32 retrieving revision 1.32.6.1 diff -C2 -d -r1.32 -r1.32.6.1 *** CGIHTTPServer.py 14 Jul 2003 06:56:32 -0000 1.32 --- CGIHTTPServer.py 20 Mar 2004 22:22:31 -0000 1.32.6.1 *************** *** 178,187 **** env['HTTP_COOKIE'] = ', '.join(co) # XXX Other HTTP_* headers ! if not self.have_fork: ! # Since we're setting the env in the parent, provide empty ! # values to override previously set values ! for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', ! 'HTTP_USER_AGENT', 'HTTP_COOKIE'): ! env.setdefault(k, "") os.environ.update(env) --- 178,186 ---- env['HTTP_COOKIE'] = ', '.join(co) # XXX Other HTTP_* headers ! # Since we're setting the env in the parent, provide empty ! # values to override previously set values ! for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', ! 'HTTP_USER_AGENT', 'HTTP_COOKIE'): ! env.setdefault(k, "") os.environ.update(env) From gvanrossum at users.sourceforge.net Sat Mar 20 17:34:17 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat Mar 20 17:44:15 2004 Subject: [Python-checkins] python/dist/src/Parser grammar.c,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13379 Modified Files: grammar.c Log Message: Fix for SF 780407. Change %08l to %p to print a pointer. Will backport to 2.3. Index: grammar.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/grammar.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** grammar.c 10 May 2003 07:36:56 -0000 2.22 --- grammar.c 20 Mar 2004 22:34:14 -0000 2.23 *************** *** 105,109 **** lb->lb_str = strdup(str); if (Py_DebugFlag) ! printf("Label @ %08x, %d: %s\n", (unsigned)ll, ll->ll_nlabels, PyGrammar_LabelRepr(lb)); return lb - ll->ll_label; --- 105,109 ---- lb->lb_str = strdup(str); if (Py_DebugFlag) ! printf("Label @ %8p, %d: %s\n", ll, ll->ll_nlabels, PyGrammar_LabelRepr(lb)); return lb - ll->ll_label; From gvanrossum at users.sourceforge.net Sat Mar 20 17:35:10 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat Mar 20 17:45:04 2004 Subject: [Python-checkins] python/dist/src/Parser grammar.c,2.22,2.22.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13512 Modified Files: Tag: release23-maint grammar.c Log Message: Backport to 2.3: Fix for SF 780407. Change %08l to %p to print a pointer. Index: grammar.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/grammar.c,v retrieving revision 2.22 retrieving revision 2.22.8.1 diff -C2 -d -r2.22 -r2.22.8.1 *** grammar.c 10 May 2003 07:36:56 -0000 2.22 --- grammar.c 20 Mar 2004 22:35:07 -0000 2.22.8.1 *************** *** 105,109 **** lb->lb_str = strdup(str); if (Py_DebugFlag) ! printf("Label @ %08x, %d: %s\n", (unsigned)ll, ll->ll_nlabels, PyGrammar_LabelRepr(lb)); return lb - ll->ll_label; --- 105,109 ---- lb->lb_str = strdup(str); if (Py_DebugFlag) ! printf("Label @ %8p, %d: %s\n", ll, ll->ll_nlabels, PyGrammar_LabelRepr(lb)); return lb - ll->ll_label; From nascheme at users.sourceforge.net Sat Mar 20 17:38:24 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat Mar 20 17:48:19 2004 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.45,1.1.2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13848/Python Modified Files: Tag: ast-branch ast.c Log Message: Refactor code in parsestr. Decoding of unicode strings with explict encoding is still broken. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.45 retrieving revision 1.1.2.46 diff -C2 -d -r1.1.2.45 -r1.1.2.46 *** ast.c 20 Mar 2004 21:28:22 -0000 1.1.2.45 --- ast.c 20 Mar 2004 22:38:22 -0000 1.1.2.46 *************** *** 2298,2301 **** --- 2298,2361 ---- } + static PyObject * + decode_unicode(const char *s, size_t len, int rawmode, const char *encoding) + { + PyObject *v, *u; + char *buf; + char *p; + const char *end; + if (encoding == NULL) { + u = NULL; + } else if (strcmp(encoding, "iso-8859-1") == 0) { + u = NULL; + } else { + /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ + u = PyString_FromStringAndSize((char *)NULL, len * 4); + if (u == NULL) + return NULL; + p = buf = PyString_AsString(u); + end = s + len; + while (s < end) { + if (*s == '\\') { + *p++ = *s++; + if (*s & 0x80) { + strcpy(p, "u005c"); + p += 5; + } + } + if (*s & 0x80) { /* XXX inefficient */ + PyObject *w; + char *r; + int rn, i; + w = decode_utf8(&s, end, "utf-16-be"); + if (w == NULL) { + Py_DECREF(u); + return NULL; + } + r = PyString_AsString(w); + rn = PyString_Size(w); + assert(rn % 2 == 0); + for (i = 0; i < rn; i += 2) { + sprintf(p, "\\u%02x%02x", + r[i + 0] & 0xFF, + r[i + 1] & 0xFF); + p += 6; + } + Py_DECREF(w); + } else { + *p++ = *s++; + } + } + len = p - buf; + s = buf; + } + if (rawmode) + v = PyUnicode_DecodeRawUnicodeEscape(s, len, NULL); + else + v = PyUnicode_DecodeUnicodeEscape(s, len, NULL); + Py_XDECREF(u); + return v; + } + /* s is a Python string literal, including the bracketing quote characters, * and r &/or u prefixes (if any), and embedded escape sequences (if any). *************** *** 2347,2413 **** #ifdef Py_USING_UNICODE if (unicode || Py_UnicodeFlag) { ! PyObject *u; ! if (encoding == NULL) { ! u = NULL; ! } else if (strcmp(encoding, "iso-8859-1") == 0) { ! u = NULL; ! } else { ! #if 0 /* XXX still broken */ ! PyObject *w; ! char *buf; ! char *p; ! const char *end; ! /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ ! u = PyString_FromStringAndSize((char *)NULL, len * 4); ! if (u == NULL) ! return NULL; ! p = buf = PyString_AsString(u); ! end = s + len; ! while (s < end) { ! if (*s == '\\') { ! *p++ = *s++; ! if (*s & 0x80) { ! strcpy(p, "u005c"); ! p += 5; ! } ! } ! if (*s & 0x80) { /* XXX inefficient */ ! char *r; ! int rn, i; ! w = decode_utf8(&s, end, "utf-16-be"); ! if (w == NULL) { ! Py_DECREF(u); ! return NULL; ! } ! r = PyString_AsString(w); ! rn = PyString_Size(w); ! assert(rn % 2 == 0); ! for (i = 0; i < rn; i += 2) { ! sprintf(p, "\\u%02x%02x", ! r[i + 0] & 0xFF, ! r[i + 1] & 0xFF); ! p += 6; ! } ! Py_DECREF(w); ! } else { ! *p++ = *s++; ! } ! } ! len = p - buf; ! s = buf; #else - u = NULL; - fprintf(stderr, "ignoring encoding = %s decl\n", - encoding); - #endif /* XXX */ - } - if (rawmode) ! v = PyUnicode_DecodeRawUnicodeEscape(s, len, NULL); else ! v = PyUnicode_DecodeUnicodeEscape(s, len, NULL); ! Py_XDECREF(u); ! return v; ! } #endif --- 2407,2419 ---- #ifdef Py_USING_UNICODE if (unicode || Py_UnicodeFlag) { ! #if 0 ! /* XXX currently broken */ ! return decode_unicode(s, len, rawmode, encoding); #else if (rawmode) ! return PyUnicode_DecodeRawUnicodeEscape(s, len, NULL); else ! return PyUnicode_DecodeUnicodeEscape(s, len, NULL); ! #endif } #endif From bcannon at users.sourceforge.net Sat Mar 20 17:48:21 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 17:58:16 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.93,1.831.4.94 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15604/Misc Modified Files: Tag: release23-maint NEWS Log Message: Put entry in proper section. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.93 retrieving revision 1.831.4.94 diff -C2 -d -r1.831.4.93 -r1.831.4.94 *** NEWS 20 Mar 2004 21:54:33 -0000 1.831.4.93 --- NEWS 20 Mar 2004 22:48:19 -0000 1.831.4.94 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Bug #858016: isinstance() and issubclass() can have their second + argument be a tuple whose nested depth is capped at the interpreter's + recursion limit. Raises RuntimeError if the limit reached. + - Made omitted callback and None equivalent for weakref.ref() and weakref.proxy(); the None case wasn't handled correctly in all *************** *** 35,42 **** ------- - - Bug #858016: isinstance() and issubclass() can have their second - argument be a tuple whose nested depth is capped at the interpreter's - recursion limit. Raises RuntimeError if the limit reached. - - Bug #700055: .pth files can now have any type of line endings. --- 39,42 ---- From bcannon at users.sourceforge.net Sat Mar 20 17:52:23 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 18:02:20 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.125,2.126 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16155/Objects Modified Files: abstract.c Log Message: Limit the nesting depth of a tuple passed as the second argument to isinstance() or issubclass() to the recursion limit of the interpreter. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -d -r2.125 -r2.126 *** abstract.c 17 Mar 2004 05:24:23 -0000 2.125 --- abstract.c 20 Mar 2004 22:52:14 -0000 2.126 *************** *** 1993,1998 **** } ! int ! PyObject_IsInstance(PyObject *inst, PyObject *cls) { PyObject *icls; --- 1993,1998 ---- } ! static int ! recursive_isinstance(PyObject *inst, PyObject *cls, int recursion_depth) { PyObject *icls; *************** *** 2029,2040 **** } else if (PyTuple_Check(cls)) { - /* Not a general sequence -- that opens up the road to - recursion and stack overflow. */ int i, n; n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; i++) { ! retval = PyObject_IsInstance( ! inst, PyTuple_GET_ITEM(cls, i)); if (retval != 0) break; --- 2029,2046 ---- } else if (PyTuple_Check(cls)) { int i, n; + if (!recursion_depth) { + PyErr_SetString(PyExc_RuntimeError, + "nest level of tuple too deep"); + return NULL; + } + n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; i++) { ! retval = recursive_isinstance( ! inst, ! PyTuple_GET_ITEM(cls, i), ! recursion_depth-1); if (retval != 0) break; *************** *** 2061,2065 **** int ! PyObject_IsSubclass(PyObject *derived, PyObject *cls) { int retval; --- 2067,2077 ---- int ! PyObject_IsInstance(PyObject *inst, PyObject *cls) ! { ! return recursive_isinstance(inst, cls, Py_GetRecursionLimit()); ! } ! ! static int ! recursive_issubclass(PyObject *derived, PyObject *cls, int recursion_depth) { int retval; *************** *** 2073,2079 **** int i; int n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; ++i) { ! retval = PyObject_IsSubclass( ! derived, PyTuple_GET_ITEM(cls, i)); if (retval != 0) { /* either found it, or got an error */ --- 2085,2099 ---- int i; int n = PyTuple_GET_SIZE(cls); + + if (!recursion_depth) { + PyErr_SetString(PyExc_RuntimeError, + "nest level of tuple too deep"); + return NULL; + } for (i = 0; i < n; ++i) { ! retval = recursive_issubclass( ! derived, ! PyTuple_GET_ITEM(cls, i), ! recursion_depth-1); if (retval != 0) { /* either found it, or got an error */ *************** *** 2101,2104 **** --- 2121,2131 ---- } + int + PyObject_IsSubclass(PyObject *derived, PyObject *cls) + { + return recursive_issubclass(derived, cls, Py_GetRecursionLimit()); + } + + PyObject * PyObject_GetIter(PyObject *o) From bcannon at users.sourceforge.net Sat Mar 20 17:52:23 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 18:02:23 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_isinstance.py, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16155/Lib/test Modified Files: test_isinstance.py Log Message: Limit the nesting depth of a tuple passed as the second argument to isinstance() or issubclass() to the recursion limit of the interpreter. Index: test_isinstance.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_isinstance.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_isinstance.py 1 May 2003 17:45:37 -0000 1.7 --- test_isinstance.py 20 Mar 2004 22:52:14 -0000 1.8 *************** *** 5,8 **** --- 5,9 ---- import unittest from test import test_support + import sys *************** *** 245,249 **** --- 246,266 ---- self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring)))) + def test_subclass_recursion_limit(self): + # make sure that issubclass raises RuntimeError before the C stack is + # blown + self.assertRaises(RuntimeError, blowstack, issubclass, str, str) + def test_isinstance_recursion_limit(self): + # make sure that issubclass raises RuntimeError before the C stack is + # blown + self.assertRaises(RuntimeError, blowstack, isinstance, '', str) + + def blowstack(fxn, arg, compare_to): + # Make sure that calling isinstance with a deeply nested tuple for its + # argument will raise RuntimeError eventually. + tuple_arg = (compare_to,) + for cnt in xrange(sys.getrecursionlimit()+5): + tuple_arg = (tuple_arg,) + fxn(arg, tuple_arg) From bcannon at users.sourceforge.net Sat Mar 20 17:52:23 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 18:02:26 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.950,1.951 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16155/Misc Modified Files: NEWS Log Message: Limit the nesting depth of a tuple passed as the second argument to isinstance() or issubclass() to the recursion limit of the interpreter. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.950 retrieving revision 1.951 diff -C2 -d -r1.950 -r1.951 *** NEWS 20 Mar 2004 21:31:33 -0000 1.950 --- NEWS 20 Mar 2004 22:52:13 -0000 1.951 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Limit the nested depth of a tuple for the second argument to isinstance() + and issubclass() to the recursion limit of the interpreter. + Fixes bug #858016 . + - Optimized dict iterators, creating separate types for each and having them reveal their length. Also optimized the From bcannon at users.sourceforge.net Sat Mar 20 18:09:42 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 18:19:38 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_strftime.py, 1.28, 1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19227/Lib/test Modified Files: test_strftime.py Log Message: Deal with case of when locale time values has characters that can be mistaken for regex syntax. Fixes bug #883604 . Index: test_strftime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_strftime.py 2 Mar 2004 04:38:10 -0000 1.28 --- test_strftime.py 20 Mar 2004 23:09:40 -0000 1.29 *************** *** 29,32 **** --- 29,42 ---- strftest(now + (i + j*100)*23*3603) + def escapestr(text, ampm): + """Escape text to deal with possible locale values that have regex + syntax while allowing regex syntax used for the comparison.""" + new_text = re.escape(text) + new_text = new_text.replace(re.escape(ampm), ampm) + new_text = new_text.replace("\%", "%") + new_text = new_text.replace("\:", ":") + new_text = new_text.replace("\?", "?") + return new_text + def strftest(now): if verbose: *************** *** 51,54 **** --- 61,66 ---- else: clock12 = 12 + # Make sure any characters that could be taken as regex syntax is + # escaped in escapestr() expectations = ( ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'), *************** *** 111,115 **** print "Standard '%s' format gave error:" % e[0], error continue ! if re.match(e[1], result): continue if not result or result[0] == '%': print "Does not support standard '%s' format (%s)" % (e[0], e[2]) --- 123,127 ---- print "Standard '%s' format gave error:" % e[0], error continue ! if re.match(escapestr(e[1], ampm), result): continue if not result or result[0] == '%': print "Does not support standard '%s' format (%s)" % (e[0], e[2]) *************** *** 126,130 **** (e[0], e[2], str(result)) continue ! if re.match(e[1], result): if verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) --- 138,142 ---- (e[0], e[2], str(result)) continue ! if re.match(escapestr(e[1], ampm), result): if verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) From bcannon at users.sourceforge.net Sat Mar 20 18:13:52 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 18:23:47 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_strftime.py, 1.27, 1.27.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19971/Lib/test Modified Files: Tag: release23-maint test_strftime.py Log Message: Fix test_strftime.py to escape locale time values that have characters that might be mistaken for regex syntax. Fixes bug #883604 . Index: test_strftime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v retrieving revision 1.27 retrieving revision 1.27.16.1 diff -C2 -d -r1.27 -r1.27.16.1 *** test_strftime.py 23 Jul 2002 19:04:03 -0000 1.27 --- test_strftime.py 20 Mar 2004 23:13:49 -0000 1.27.16.1 *************** *** 29,32 **** --- 29,42 ---- strftest(now + (i + j*100)*23*3603) + def escapestr(text, ampm): + """Escape text to deal with possible locale values that have regex + syntax while allowing regex syntax used for the comparison.""" + new_text = re.escape(text) + new_text = new_text.replace(re.escape(ampm), ampm) + new_text = new_text.replace("\%", "%") + new_text = new_text.replace("\:", ":") + new_text = new_text.replace("\?", "?") + return new_text + def strftest(now): if verbose: *************** *** 51,54 **** --- 61,66 ---- else: clock12 = 12 + # Make sure any characters that could be taken as regex syntax is + # escaped in escapestr() expectations = ( ('%a', calendar.day_abbr[now[6]], 'abbreviated weekday name'), *************** *** 111,115 **** print "Standard '%s' format gave error:" % e[0], error continue ! if re.match(e[1], result): continue if not result or result[0] == '%': print "Does not support standard '%s' format (%s)" % (e[0], e[2]) --- 123,127 ---- print "Standard '%s' format gave error:" % e[0], error continue ! if re.match(escapestr(e[1], ampm), result): continue if not result or result[0] == '%': print "Does not support standard '%s' format (%s)" % (e[0], e[2]) *************** *** 126,130 **** (e[0], e[2], str(result)) continue ! if re.match(e[1], result): if verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) --- 138,142 ---- (e[0], e[2], str(result)) continue ! if re.match(escapestr(e[1], ampm), result): if verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) From bcannon at users.sourceforge.net Sat Mar 20 18:13:52 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Mar 20 18:23:50 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.94,1.831.4.95 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19971/Misc Modified Files: Tag: release23-maint NEWS Log Message: Fix test_strftime.py to escape locale time values that have characters that might be mistaken for regex syntax. Fixes bug #883604 . Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.94 retrieving revision 1.831.4.95 diff -C2 -d -r1.831.4.94 -r1.831.4.95 *** NEWS 20 Mar 2004 22:48:19 -0000 1.831.4.94 --- NEWS 20 Mar 2004 23:13:49 -0000 1.831.4.95 *************** *** 39,42 **** --- 39,45 ---- ------- + - Bug #883604: Fix Lib/test/test_strftime.py to escape characters from locale + time values that might be mistaken as regex syntax. + - Bug #700055: .pth files can now have any type of line endings. From just at letterror.com Sun Mar 21 02:58:36 2004 From: just at letterror.com (Just van Rossum) Date: Sun Mar 21 02:58:00 2004 Subject: [Python-checkins] python/dist/src/Lib site.py,1.58,1.59 In-Reply-To: Message-ID: This checkin is not correct: the change behavior from 2.2 to 2.3 was done for a reason (PEP 302), and should not be reversed. See also http://python.org/sf/693255 Just bcannon@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Lib > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2040/Lib > > Modified Files: > site.py > Log Message: > Remove non-existent paths. > > > Index: site.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v > retrieving revision 1.58 > retrieving revision 1.59 > diff -C2 -d -r1.58 -r1.59 > *** site.py 20 Mar 2004 21:08:17 -0000 1.58 > --- site.py 20 Mar 2004 21:31:32 -0000 1.59 > *************** > *** 80,84 **** > # paths. > dir, dircase = makepath(dir) > ! if not dircase in _dirs_in_sys_path: > L.append(dir) > _dirs_in_sys_path[dircase] = 1 > --- 80,84 ---- > # paths. > dir, dircase = makepath(dir) > ! if not dircase in _dirs_in_sys_path and os.path.exists(dir): > L.append(dir) > _dirs_in_sys_path[dircase] = 1 > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins > From drorer at pigeonportal.com Sun Mar 21 07:37:44 2004 From: drorer at pigeonportal.com (Rhea Nickerson) Date: Sun Mar 21 04:39:33 2004 Subject: [Python-checkins] time for a nicer home.. Message-ID: Got bad-credit? Let us help you refinance your home Lowest In.terest Rates Available! Get a Pre-Approval in 48 hours for F.RE.E Refinancing for the Self-Employed SAVE $100-$400 per month and skip ONE payment Our easy application only takes 1 minute. http://refinancemade-easy.com/?partid=wh6 The above gift or special offer was sent to you as a subscriber of Direct Media. We will continue to bring you valuable offers on products and services that interest you most. To modify your future preference with us: http://refinancemade-easy.com/st.html From bcannon at users.sourceforge.net Sun Mar 21 09:06:52 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Mar 21 09:16:54 2004 Subject: [Python-checkins] python/dist/src/Lib site.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3605/Lib Modified Files: site.py Log Message: Back out last patch that removed an entry from sys.path if it was not an existent path. Pointed out by jvr that entries could be non-file items for custom importers. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** site.py 20 Mar 2004 21:31:32 -0000 1.59 --- site.py 21 Mar 2004 14:06:49 -0000 1.60 *************** *** 80,84 **** # paths. dir, dircase = makepath(dir) ! if not dircase in _dirs_in_sys_path and os.path.exists(dir): L.append(dir) _dirs_in_sys_path[dircase] = 1 --- 80,84 ---- # paths. dir, dircase = makepath(dir) ! if not dircase in _dirs_in_sys_path: L.append(dir) _dirs_in_sys_path[dircase] = 1 From bcannon at users.sourceforge.net Sun Mar 21 09:10:20 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Mar 21 09:20:22 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4836/Doc/lib Modified Files: libsys.tex Log Message: Removed extra period from \versionchanged entry; macro adds period automatically. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** libsys.tex 17 Jul 2003 04:22:44 -0000 1.68 --- libsys.tex 21 Mar 2004 14:10:18 -0000 1.69 *************** *** 366,370 **** A program is free to modify this list for its own purposes. ! \versionchanged[Unicode strings are no longer ignored.]{2.3} \end{datadesc} --- 366,370 ---- A program is free to modify this list for its own purposes. ! \versionchanged[Unicode strings are no longer ignored]{2.3} \end{datadesc} From rhettinger at users.sourceforge.net Sun Mar 21 10:12:02 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 21 10:22:06 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.951,1.952 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15203/Misc Modified Files: NEWS Log Message: Improve byte coding for multiple assignments. Gives 30% speedup on "a,b=1,2" and 25% on "a,b,c=1,2,3". Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.951 retrieving revision 1.952 diff -C2 -d -r1.951 -r1.952 *** NEWS 20 Mar 2004 22:52:13 -0000 1.951 --- NEWS 21 Mar 2004 15:11:59 -0000 1.952 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - Optimized the byte coding for multiple assignments like "a,b=b,a" and + "a,b,c=1,2,3". Improves their speed by 25% to 30%. + - Limit the nested depth of a tuple for the second argument to isinstance() and issubclass() to the recursion limit of the interpreter. From rhettinger at users.sourceforge.net Sun Mar 21 10:12:03 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 21 10:22:09 2004 Subject: [Python-checkins] python/dist/src/Python compile.c,2.299,2.300 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15203/Python Modified Files: compile.c Log Message: Improve byte coding for multiple assignments. Gives 30% speedup on "a,b=1,2" and 25% on "a,b,c=1,2,3". Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.299 retrieving revision 2.300 diff -C2 -d -r2.299 -r2.300 *** compile.c 7 Mar 2004 07:31:06 -0000 2.299 --- compile.c 21 Mar 2004 15:12:00 -0000 2.300 *************** *** 328,331 **** --- 328,368 ---- #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3)) #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 + #define CODESIZE(op) (HAS_ARG(op) ? 3 : 1) + #define ISBASICBLOCK(blocks, start, bytes) (blocks[start]==blocks[start+bytes-1]) + + static unsigned int * + markblocks(unsigned char *code, int len) + { + unsigned int *blocks = PyMem_Malloc(len*sizeof(int)); + int i,j, opcode, oldblock, newblock, blockcnt = 0; + + if (blocks == NULL) + return NULL; + memset(blocks, 0, len*sizeof(int)); + for (i=0 ; i Update of /cvsroot/python/python/dist/src/Lib/compiler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16747 Modified Files: pycodegen.py Log Message: Remove unused instance attributes. Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** pycodegen.py 27 Jun 2003 12:32:39 -0000 1.65 --- pycodegen.py 21 Mar 2004 15:18:50 -0000 1.66 *************** *** 205,210 **** self.locals = misc.Stack() self.setups = misc.Stack() - self.curStack = 0 - self.maxStack = 0 self.last_lineno = None self._setupGraphDelegation() --- 205,208 ---- From loewis at users.sourceforge.net Sun Mar 21 10:26:47 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Mar 21 10:36:48 2004 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tix.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17883 Modified Files: Tix.py Log Message: Patch #853488: Add hlist entry_configure and entry_cget methods. Index: Tix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tix.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Tix.py 12 Feb 2004 17:35:09 -0000 1.17 --- Tix.py 21 Mar 2004 15:26:44 -0000 1.18 *************** *** 1006,1009 **** --- 1006,1020 ---- self.tk.call(self._w, 'item', 'delete', entry, col) + def entrycget(self, entry, opt): + return self.tk.call(self._w, 'entrycget', entry, opt) + + def entryconfigure(self, entry, cnf={}, **kw): + if cnf is None: + return _lst2dict( + self.tk.split( + self.tk.call(self._w, 'entryconfigure', entry))) + self.tk.call(self._w, 'entryconfigure', entry, + *self._options(cnf, kw)) + def nearest(self, y): return self.tk.call(self._w, 'nearest', y) From loewis at users.sourceforge.net Sun Mar 21 10:29:43 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Mar 21 10:39:45 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.952,1.953 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18614 Modified Files: NEWS Log Message: Patch #853488: Tix hlist missing entryconfigure and entrycget methods. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.952 retrieving revision 1.953 diff -C2 -d -r1.952 -r1.953 *** NEWS 21 Mar 2004 15:11:59 -0000 1.952 --- NEWS 21 Mar 2004 15:29:41 -0000 1.953 *************** *** 284,287 **** --- 284,289 ---- ------- + - Add hlist missing entryconfigure and entrycget methods. + - site.py now removes paths that do not exist. From montanaro at users.sourceforge.net Sun Mar 21 11:05:34 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun Mar 21 11:15:40 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.163,1.164 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25156 Modified Files: libfuncs.tex Log Message: concrete example of why retaining old objects is good Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** libfuncs.tex 20 Mar 2004 18:25:31 -0000 1.163 --- libfuncs.tex 21 Mar 2004 16:05:30 -0000 1.164 *************** *** 831,835 **** to the module's advantage if it maintains a global table or cache of objects --- with a \keyword{try} statement it can test for the ! table's presence and skip its initialization if desired. It is legal though generally not very useful to reload built-in or --- 831,843 ---- to the module's advantage if it maintains a global table or cache of objects --- with a \keyword{try} statement it can test for the ! table's presence and skip its initialization if desired: ! ! \begin{verbatim} ! try: ! cache ! except NameError: ! cache = {} ! \end{verbatim} ! It is legal though generally not very useful to reload built-in or From skip at pobox.com Sun Mar 21 11:19:24 2004 From: skip at pobox.com (Skip Montanaro) Date: Sun Mar 21 11:19:30 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.949,1.950 In-Reply-To: References: Message-ID: <16477.49292.556398.536042@montanaro.dyndns.org> bcannon> + - site.py now removes paths that do not exist. bcannon> + I thought someone (Just?) mentioned a reason to leave the pythonNM.zip file in sys.path. Skip From skip at pobox.com Sun Mar 21 11:20:39 2004 From: skip at pobox.com (Skip Montanaro) Date: Sun Mar 21 11:20:46 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c, 2.86, 2.87 In-Reply-To: References: Message-ID: <16477.49367.403242.229270@montanaro.dyndns.org> arigo> memset() hunt continuing. This is a net win. Maybe we should cast this as a _Py_MEMSET macro to make it more obvious what's been done? Skip From jvr at users.sourceforge.net Sun Mar 21 11:26:35 2004 From: jvr at users.sourceforge.net (jvr@users.sourceforge.net) Date: Sun Mar 21 11:36:39 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.953,1.954 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30105 Modified Files: NEWS Log Message: [693255] also back out corresponding NEWS item... Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.953 retrieving revision 1.954 diff -C2 -d -r1.953 -r1.954 *** NEWS 21 Mar 2004 15:29:41 -0000 1.953 --- NEWS 21 Mar 2004 16:26:32 -0000 1.954 *************** *** 286,291 **** - Add hlist missing entryconfigure and entrycget methods. - - site.py now removes paths that do not exist. - - The ptcp154 codec was added for Kazakh character set support. --- 286,289 ---- From nnorwitz at users.sourceforge.net Sun Mar 21 11:52:48 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 12:02:54 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.78, 1.1.2.79 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3460/Python Modified Files: Tag: ast-branch newcompile.c Log Message: get closures working Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.78 retrieving revision 1.1.2.79 diff -C2 -d -r1.1.2.78 -r1.1.2.79 *** newcompile.c 20 Mar 2004 19:46:51 -0000 1.1.2.78 --- newcompile.c 21 Mar 2004 16:52:46 -0000 1.1.2.79 *************** *** 24,28 **** Inappropriate Exceptions: - #: problem with cell objects (closures still have bugs) #: Get this err msg: XXX rd_object called with exception set From Python/marshal.c::PyMarshal_ReadLastObjectFromFile() --- 24,27 ---- *************** *** 300,308 **** static PyObject * ! dictbytype(PyObject *src, int scope_type) { ! int pos = 0, i = 0, scope; PyObject *k, *v, *dest = PyDict_New(); if (dest == NULL) return NULL; --- 299,308 ---- static PyObject * ! dictbytype(PyObject *src, int scope_type, int offset) { ! int pos = 0, i = offset, scope; PyObject *k, *v, *dest = PyDict_New(); + assert(offset >= 0); if (dest == NULL) return NULL; *************** *** 314,328 **** if (scope == scope_type) { ! PyObject *item = PyInt_FromLong(i); if (item == NULL) { Py_DECREF(dest); return NULL; } ! if (PyDict_SetItem(dest, k, item) < 0) { Py_DECREF(item); Py_DECREF(dest); return NULL; } Py_DECREF(item); } } --- 314,332 ---- if (scope == scope_type) { ! PyObject *tuple, *item = PyInt_FromLong(i); if (item == NULL) { Py_DECREF(dest); return NULL; } ! i++; ! tuple = Py_BuildValue("(OO)", k, k->ob_type); ! if (!tuple || PyDict_SetItem(dest, tuple, item) < 0) { Py_DECREF(item); Py_DECREF(dest); + Py_XDECREF(tuple); return NULL; } Py_DECREF(item); + Py_DECREF(tuple); } } *************** *** 379,384 **** u->u_name = name; u->u_varnames = list2dict(u->u_ste->ste_varnames); ! u->u_cellvars = dictbytype(u->u_ste->ste_symbols, CELL); ! u->u_freevars = dictbytype(u->u_ste->ste_symbols, FREE); u->u_nblocks = 0; u->u_nalloc = DEFAULT_BLOCKS; --- 383,390 ---- u->u_name = name; u->u_varnames = list2dict(u->u_ste->ste_varnames); ! u->u_cellvars = dictbytype(u->u_ste->ste_symbols, CELL, 0); ! u->u_freevars = dictbytype(u->u_ste->ste_symbols, FREE, ! PyDict_Size(u->u_cellvars)); ! u->u_nblocks = 0; u->u_nalloc = DEFAULT_BLOCKS; *************** *** 669,673 **** static int ! compiler_addop_name(struct compiler *c, int opcode, PyObject *o) { int arg; --- 675,680 ---- static int ! compiler_addop_name(struct compiler *c, int opcode, PyObject *dict, ! PyObject *o) { int arg; *************** *** 675,679 **** if (!mangled) return 0; ! arg = compiler_add_o(c, c->u->u_names, mangled); Py_DECREF(mangled); if (arg < 0) --- 682,686 ---- if (!mangled) return 0; ! arg = compiler_add_o(c, dict, mangled); Py_DECREF(mangled); if (arg < 0) *************** *** 751,759 **** } ! #define ADDOP_NAME(C, OP, O) { \ ! if (!compiler_addop_name((C), (OP), (O))) { \ ! Py_DECREF(O); \ return 0; \ - } \ } --- 758,764 ---- } ! #define ADDOP_NAME(C, OP, O, TYPE) { \ ! if (!compiler_addop_name((C), (OP), (C)->u->u_ ## TYPE, (O))) \ return 0; \ } *************** *** 865,869 **** compiler_lookup_arg(PyObject *dict, PyObject *name) { ! PyObject *v = PyDict_GetItem(dict, name); if (v == NULL) return -1; --- 870,878 ---- compiler_lookup_arg(PyObject *dict, PyObject *name) { ! PyObject *k, *v; ! k = Py_BuildValue("(OO)", name, name->ob_type); ! if (k == NULL) ! return -1; ! v = PyDict_GetItem(dict, k); if (v == NULL) return -1; *************** *** 1387,1391 **** identifier store_name; ADDOP_O(c, LOAD_CONST, Py_None, consts); ! ADDOP_NAME(c, IMPORT_NAME, alias->name); /* XXX: handling of store_name should be cleaned up */ --- 1396,1400 ---- identifier store_name; ADDOP_O(c, LOAD_CONST, Py_None, consts); ! ADDOP_NAME(c, IMPORT_NAME, alias->name, names); /* XXX: handling of store_name should be cleaned up */ *************** *** 1432,1436 **** ADDOP_O(c, LOAD_CONST, names, consts); ! ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module); for (i = 0; i < n; i++) { alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i); --- 1441,1445 ---- ADDOP_O(c, LOAD_CONST, names, consts); ! ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); for (i = 0; i < n; i++) { alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i); *************** *** 1444,1448 **** } ! ADDOP_NAME(c, IMPORT_FROM, alias->name); store_name = alias->name; if (alias->asname) --- 1453,1457 ---- } ! ADDOP_NAME(c, IMPORT_FROM, alias->name, names); store_name = alias->name; if (alias->asname) *************** *** 1723,1726 **** --- 1732,1736 ---- enum { OP_FAST, OP_GLOBAL, OP_DEREF, OP_NAME } optype; + PyObject *dict = c->u->u_names; /* XXX AugStore isn't used anywhere! */ op = 0; *************** *** 1729,1733 **** --- 1739,1747 ---- switch (scope) { case FREE: + dict = c->u->u_freevars; + optype = OP_DEREF; + break; case CELL: + dict = c->u->u_cellvars; optype = OP_DEREF; break; *************** *** 1798,1803 **** assert(op); ! ADDOP_NAME(c, op, name); ! return 1; } --- 1812,1816 ---- assert(op); ! return compiler_addop_name(c, op, dict, name); } *************** *** 2096,2100 **** /* Fall through to load */ case Load: ! ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr); break; case AugStore: --- 2109,2113 ---- /* Fall through to load */ case Load: ! ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names); break; case AugStore: *************** *** 2102,2109 **** /* Fall through to save */ case Store: ! ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr); break; case Del: ! ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr); break; case Param: --- 2115,2122 ---- /* Fall through to save */ case Store: ! ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names); break; case Del: ! ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names); break; case Param: *************** *** 2695,2698 **** --- 2708,2712 ---- Py_INCREF(k); assert((i - offset) < size); + assert((i - offset) >= 0); PyTuple_SET_ITEM(tuple, i - offset, k); } *************** *** 2752,2760 **** if (!consts || !names || !varnames) goto error; ! freevars = PySequence_Tuple(c->u->u_freevars); ! cellvars = PySequence_Tuple(c->u->u_cellvars); ! if (!varnames || !freevars || !cellvars) goto error; - filename = PyString_FromString(c->c_filename); if (!filename) --- 2766,2776 ---- if (!consts || !names || !varnames) goto error; ! ! cellvars = dict_keys_inorder(c->u->u_cellvars, 0); ! if (!cellvars) ! goto error; ! freevars = dict_keys_inorder(c->u->u_freevars, PyTuple_Size(cellvars)); ! if (!freevars) goto error; filename = PyString_FromString(c->c_filename); if (!filename) From tim_one at users.sourceforge.net Sun Mar 21 11:59:12 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Mar 21 12:09:15 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.126,2.127 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4599/Objects Modified Files: abstract.c Log Message: recursive_isinstance(), recursive_issubclass(): New code here returned NULL in case of error, but the functions are declared to return int. MSVC 6 properly complains about that. Return -1 on error instead. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -d -r2.126 -r2.127 *** abstract.c 20 Mar 2004 22:52:14 -0000 2.126 --- abstract.c 21 Mar 2004 16:59:09 -0000 2.127 *************** *** 2034,2038 **** PyErr_SetString(PyExc_RuntimeError, "nest level of tuple too deep"); ! return NULL; } --- 2034,2038 ---- PyErr_SetString(PyExc_RuntimeError, "nest level of tuple too deep"); ! return -1; } *************** *** 2089,2093 **** PyErr_SetString(PyExc_RuntimeError, "nest level of tuple too deep"); ! return NULL; } for (i = 0; i < n; ++i) { --- 2089,2093 ---- PyErr_SetString(PyExc_RuntimeError, "nest level of tuple too deep"); ! return -1; } for (i = 0; i < n; ++i) { From mondragon at users.sourceforge.net Sun Mar 21 12:00:02 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 12:11:04 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4898 Modified Files: libstring.tex Log Message: Modified string.split documentation to reflect behaviour of splitting emtpy string. Closes SF bug #811604 Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** libstring.tex 30 Dec 2003 23:08:14 -0000 1.56 --- libstring.tex 21 Mar 2004 16:59:59 -0000 1.57 *************** *** 214,217 **** --- 214,222 ---- the list (thus, the list will have at most \code{\var{maxsplit}+1} elements). + + The behavior of split on an empty string depends on the value of \var{sep}. + If \var{sep} is not specified, or specified as \code{None}, the result will + be an empty list. If \var{sep} is specified as any string, the result will + be a list containing one element which is an empty string. \end{funcdesc} From rhettinger at users.sourceforge.net Sun Mar 21 12:01:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 21 12:11:49 2004 Subject: [Python-checkins] python/dist/src/Objects object.c,2.214,2.215 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5564 Modified Files: object.c Log Message: Add identity shortcut to PyObject_RichCompareBool. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.214 retrieving revision 2.215 diff -C2 -d -r2.214 -r2.215 *** object.c 27 Jan 2004 20:17:54 -0000 2.214 --- object.c 21 Mar 2004 17:01:44 -0000 2.215 *************** *** 872,878 **** PyObject_RichCompareBool(PyObject *v, PyObject *w, int op) { ! PyObject *res = PyObject_RichCompare(v, w, op); int ok; if (res == NULL) return -1; --- 872,888 ---- PyObject_RichCompareBool(PyObject *v, PyObject *w, int op) { ! PyObject *res; int ok; + /* Quick result when objects are the same. + Guarantees that identity implies equality. */ + if (v == w) { + if (op == Py_EQ) + return 1; + else if (op == Py_NE) + return 0; + } + + res = PyObject_RichCompare(v, w, op); if (res == NULL) return -1; From tim_one at users.sourceforge.net Sun Mar 21 12:06:23 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Mar 21 12:16:29 2004 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6399/Lib Modified Files: warnings.py Log Message: SF bug 917108: warnings.py does not define _test(). Removed the entire __name__ == '__main__' block. Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** warnings.py 12 Feb 2004 17:35:07 -0000 1.22 --- warnings.py 21 Mar 2004 17:06:20 -0000 1.23 *************** *** 250,259 **** # Module initialization ! if __name__ == "__main__": ! import __main__ ! sys.modules['warnings'] = __main__ ! _test() ! else: ! _processoptions(sys.warnoptions) ! simplefilter("ignore", category=OverflowWarning, append=1) ! simplefilter("ignore", category=PendingDeprecationWarning, append=1) --- 250,254 ---- # Module initialization ! _processoptions(sys.warnoptions) ! simplefilter("ignore", category=OverflowWarning, append=1) ! simplefilter("ignore", category=PendingDeprecationWarning, append=1) From nnorwitz at users.sourceforge.net Sun Mar 21 12:14:35 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 12:24:37 2004 Subject: [Python-checkins] python/dist/src/Python symtable.c, 2.10.8.21, 2.10.8.22 newcompile.c, 1.1.2.79, 1.1.2.80 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8319/Python Modified Files: Tag: ast-branch symtable.c newcompile.c Log Message: get generators working Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.21 retrieving revision 2.10.8.22 diff -C2 -d -r2.10.8.21 -r2.10.8.22 *** symtable.c 15 Feb 2004 04:17:21 -0000 2.10.8.21 --- symtable.c 21 Mar 2004 17:14:32 -0000 2.10.8.22 *************** *** 643,646 **** --- 643,647 ---- case Yield_kind: VISIT(st, expr, s->v.Yield.value); + st->st_cur->ste_generator = 1; break; case Delete_kind: Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.79 retrieving revision 1.1.2.80 diff -C2 -d -r1.1.2.79 -r1.1.2.80 *** newcompile.c 21 Mar 2004 16:52:46 -0000 1.1.2.79 --- newcompile.c 21 Mar 2004 17:14:32 -0000 1.1.2.80 *************** *** 2733,2736 **** --- 2733,2738 ---- if (ste->ste_varkeywords) flags |= CO_VARKEYWORDS; + if (ste->ste_generator) + flags |= CO_GENERATOR; n = PyDict_Size(c->u->u_freevars); if (n < 0) From rhettinger at users.sourceforge.net Sun Mar 21 12:35:14 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 21 12:45:17 2004 Subject: [Python-checkins] python/dist/src/Objects object.c,2.215,2.216 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13123 Modified Files: object.c Log Message: Fix typo in comment. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.215 retrieving revision 2.216 diff -C2 -d -r2.215 -r2.216 *** object.c 21 Mar 2004 17:01:44 -0000 2.215 --- object.c 21 Mar 2004 17:35:06 -0000 2.216 *************** *** 896,900 **** /* Set of hash utility functions to help maintaining the invariant that ! iff a==b then hash(a)==hash(b) All the utility functions (_Py_Hash*()) return "-1" to signify an error. --- 896,900 ---- /* Set of hash utility functions to help maintaining the invariant that ! if a==b then hash(a)==hash(b) All the utility functions (_Py_Hash*()) return "-1" to signify an error. From mondragon at users.sourceforge.net Sun Mar 21 13:37:25 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 13:47:31 2004 Subject: [Python-checkins] python/dist/src/Include traceback.h,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26501/Include Modified Files: traceback.h Log Message: Moved tracebackobject to traceback.h, Closes SF Bug #497067 Index: traceback.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/traceback.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** traceback.h 12 Aug 2002 07:21:57 -0000 2.20 --- traceback.h 21 Mar 2004 18:37:23 -0000 2.21 *************** *** 6,12 **** #endif /* Traceback interface */ ! struct _frame; PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); --- 6,20 ---- #endif + struct _frame; + /* Traceback interface */ ! typedef struct _traceback { ! PyObject_HEAD ! struct _traceback *tb_next; ! struct _frame *tb_frame; ! int tb_lasti; ! int tb_lineno; ! } PyTracebackObject; PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); From mondragon at users.sourceforge.net Sun Mar 21 13:37:26 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 13:47:34 2004 Subject: [Python-checkins] python/dist/src/Python traceback.c,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26501/Python Modified Files: traceback.c Log Message: Moved tracebackobject to traceback.h, Closes SF Bug #497067 Index: traceback.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/traceback.c,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** traceback.c 19 Nov 2003 15:24:47 -0000 2.41 --- traceback.c 21 Mar 2004 18:37:23 -0000 2.42 *************** *** 8,21 **** #include "structmember.h" #include "osdefs.h" ! typedef struct _tracebackobject { ! PyObject_HEAD ! struct _tracebackobject *tb_next; ! PyFrameObject *tb_frame; ! int tb_lasti; ! int tb_lineno; ! } tracebackobject; ! ! #define OFF(x) offsetof(tracebackobject, x) static struct memberlist tb_memberlist[] = { --- 8,14 ---- #include "structmember.h" #include "osdefs.h" + #include "traceback.h" ! #define OFF(x) offsetof(PyTracebackObject, x) static struct memberlist tb_memberlist[] = { *************** *** 28,32 **** static PyObject * ! tb_getattr(tracebackobject *tb, char *name) { return PyMember_Get((char *)tb, tb_memberlist, name); --- 21,25 ---- static PyObject * ! tb_getattr(PyTracebackObject *tb, char *name) { return PyMember_Get((char *)tb, tb_memberlist, name); *************** *** 34,38 **** static void ! tb_dealloc(tracebackobject *tb) { PyObject_GC_UnTrack(tb); --- 27,31 ---- static void ! tb_dealloc(PyTracebackObject *tb) { PyObject_GC_UnTrack(tb); *************** *** 45,49 **** static int ! tb_traverse(tracebackobject *tb, visitproc visit, void *arg) { int err = 0; --- 38,42 ---- static int ! tb_traverse(PyTracebackObject *tb, visitproc visit, void *arg) { int err = 0; *************** *** 59,63 **** static void ! tb_clear(tracebackobject *tb) { Py_XDECREF(tb->tb_next); --- 52,56 ---- static void ! tb_clear(PyTracebackObject *tb) { Py_XDECREF(tb->tb_next); *************** *** 71,75 **** 0, "traceback", ! sizeof(tracebackobject), 0, (destructor)tb_dealloc, /*tp_dealloc*/ --- 64,68 ---- 0, "traceback", ! sizeof(PyTracebackObject), 0, (destructor)tb_dealloc, /*tp_dealloc*/ *************** *** 103,110 **** }; ! static tracebackobject * ! newtracebackobject(tracebackobject *next, PyFrameObject *frame) { ! tracebackobject *tb; if ((next != NULL && !PyTraceBack_Check(next)) || frame == NULL || !PyFrame_Check(frame)) { --- 96,103 ---- }; ! static PyTracebackObject * ! newtracebackobject(PyTracebackObject *next, PyFrameObject *frame) { ! PyTracebackObject *tb; if ((next != NULL && !PyTraceBack_Check(next)) || frame == NULL || !PyFrame_Check(frame)) { *************** *** 112,116 **** return NULL; } ! tb = PyObject_GC_New(tracebackobject, &PyTraceBack_Type); if (tb != NULL) { Py_XINCREF(next); --- 105,109 ---- return NULL; } ! tb = PyObject_GC_New(PyTracebackObject, &PyTraceBack_Type); if (tb != NULL) { Py_XINCREF(next); *************** *** 130,135 **** { PyThreadState *tstate = frame->f_tstate; ! tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback; ! tracebackobject *tb = newtracebackobject(oldtb, frame); if (tb == NULL) return -1; --- 123,128 ---- { PyThreadState *tstate = frame->f_tstate; ! PyTracebackObject *oldtb = (PyTracebackObject *) tstate->curexc_traceback; ! PyTracebackObject *tb = newtracebackobject(oldtb, frame); if (tb == NULL) return -1; *************** *** 223,231 **** static int ! tb_printinternal(tracebackobject *tb, PyObject *f, int limit) { int err = 0; int depth = 0; ! tracebackobject *tb1 = tb; while (tb1 != NULL) { depth++; --- 216,224 ---- static int ! tb_printinternal(PyTracebackObject *tb, PyObject *f, int limit) { int err = 0; int depth = 0; ! PyTracebackObject *tb1 = tb; while (tb1 != NULL) { depth++; *************** *** 268,272 **** err = PyFile_WriteString("Traceback (most recent call last):\n", f); if (!err) ! err = tb_printinternal((tracebackobject *)v, f, limit); return err; } --- 261,265 ---- err = PyFile_WriteString("Traceback (most recent call last):\n", f); if (!err) ! err = tb_printinternal((PyTracebackObject *)v, f, limit); return err; } From mondragon at users.sourceforge.net Sun Mar 21 13:37:26 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 13:47:37 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.954,1.955 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26501/Misc Modified Files: NEWS Log Message: Moved tracebackobject to traceback.h, Closes SF Bug #497067 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.954 retrieving revision 1.955 diff -C2 -d -r1.954 -r1.955 *** NEWS 21 Mar 2004 16:26:32 -0000 1.954 --- NEWS 21 Mar 2004 18:37:23 -0000 1.955 *************** *** 13,16 **** --- 13,18 ---- ----------------- + - Moved tracebackobject into traceback.h and renamed to PyTracebackObject + - Optimized the byte coding for multiple assignments like "a,b=b,a" and "a,b,c=1,2,3". Improves their speed by 25% to 30%. From akuchling at users.sourceforge.net Sun Mar 21 13:48:24 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 13:58:29 2004 Subject: [Python-checkins] python/dist/src/Misc HISTORY,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29134 Modified Files: HISTORY Log Message: Update URLs Index: HISTORY =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/HISTORY,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** HISTORY 20 Oct 2003 14:01:52 -0000 1.12 --- HISTORY 21 Mar 2004 18:48:22 -0000 1.13 *************** *** 892,896 **** Alternatively, a good overview of the changes between 1.5.2 and 2.0 is the document "What's New in Python 2.0" by Kuchling and Moshe Zadka: ! http://starship.python.net/crew/amk/python/writing/new-python/. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/) --- 892,896 ---- Alternatively, a good overview of the changes between 1.5.2 and 2.0 is the document "What's New in Python 2.0" by Kuchling and Moshe Zadka: ! http://www.amk.ca/python/2.0/. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/) *************** *** 1883,1887 **** For this overview, I have borrowed from the document "What's New in Python 2.0" by Andrew Kuchling and Moshe Zadka: ! http://starship.python.net/crew/amk/python/writing/new-python/. There are lots of new modules and lots of bugs have been fixed. A --- 1883,1887 ---- For this overview, I have borrowed from the document "What's New in Python 2.0" by Andrew Kuchling and Moshe Zadka: ! http://www.amk.ca/python/2.0/ . There are lots of new modules and lots of bugs have been fixed. A From akuchling at users.sourceforge.net Sun Mar 21 13:50:45 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:00:49 2004 Subject: [Python-checkins] python/dist/src/Misc HISTORY,1.11.12.1,1.11.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29697 Modified Files: Tag: release23-branch HISTORY Log Message: Update URLs Index: HISTORY =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/HISTORY,v retrieving revision 1.11.12.1 retrieving revision 1.11.12.2 diff -C2 -d -r1.11.12.1 -r1.11.12.2 *** HISTORY 29 Jul 2003 22:58:21 -0000 1.11.12.1 --- HISTORY 21 Mar 2004 18:50:42 -0000 1.11.12.2 *************** *** 2321,2325 **** Alternatively, a good overview of the changes between 1.5.2 and 2.0 is the document "What's New in Python 2.0" by Kuchling and Moshe Zadka: ! http://starship.python.net/crew/amk/python/writing/new-python/. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/) --- 2321,2325 ---- Alternatively, a good overview of the changes between 1.5.2 and 2.0 is the document "What's New in Python 2.0" by Kuchling and Moshe Zadka: ! http://www.amk.ca/python/2.0/. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/) *************** *** 3312,3316 **** For this overview, I have borrowed from the document "What's New in Python 2.0" by Andrew Kuchling and Moshe Zadka: ! http://starship.python.net/crew/amk/python/writing/new-python/. There are lots of new modules and lots of bugs have been fixed. A --- 3312,3316 ---- For this overview, I have borrowed from the document "What's New in Python 2.0" by Andrew Kuchling and Moshe Zadka: ! http://www.amk.ca/python/2.0/. There are lots of new modules and lots of bugs have been fixed. A From akuchling at users.sourceforge.net Sun Mar 21 13:57:51 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:07:55 2004 Subject: [Python-checkins] python/dist/src setup.py,1.183,1.184 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31225 Modified Files: setup.py Log Message: [Patch #850977] Detect Tcl/Tk libraries on FreeBSD/OpenBSD. Bugfix candidate Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** setup.py 7 Feb 2004 12:50:19 -0000 1.183 --- setup.py 21 Mar 2004 18:57:35 -0000 1.184 *************** *** 974,988 **** # Now check for the header files if tklib and tcllib: ! # Check for the include files on Debian, where # they're put in /usr/include/{tcl,tk}X.Y ! debian_tcl_include = [ '/usr/include/tcl' + version ] ! debian_tk_include = [ '/usr/include/tk' + version ] + \ ! debian_tcl_include ! tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) ! tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) if (tcllib is None or tklib is None or tcl_includes is None or tk_includes is None): ! # Something's missing, so give up return --- 974,996 ---- # Now check for the header files if tklib and tcllib: ! # Check for the include files on Debian and {Free,Open}BSD, where # they're put in /usr/include/{tcl,tk}X.Y ! dotversion = version ! if '.' not in dotversion and "bsd" in sys.platform.lower(): ! # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, ! # but the include subdirs are named like .../include/tcl8.3. ! dotversion = dotversion[:-1] + '.' + dotversion[-1] ! tcl_include_sub = [] ! tk_include_sub = [] ! for dir in inc_dirs: ! tcl_include_sub += [dir + os.sep + "tcl" + dotversion] ! tk_include_sub += [dir + os.sep + "tk" + dotversion] ! tk_include_sub += tcl_include_sub ! tcl_includes = find_file('tcl.h', inc_dirs, tcl_include_sub) ! tk_includes = find_file('tk.h', inc_dirs, tk_include_sub) if (tcllib is None or tklib is None or tcl_includes is None or tk_includes is None): ! self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) return From nnorwitz at users.sourceforge.net Sun Mar 21 13:59:30 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 14:09:35 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.80, 1.1.2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31819/Python Modified Files: Tag: ast-branch newcompile.c Log Message: minor cleanup Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.80 retrieving revision 1.1.2.81 diff -C2 -d -r1.1.2.80 -r1.1.2.81 *** newcompile.c 21 Mar 2004 17:14:32 -0000 1.1.2.80 --- newcompile.c 21 Mar 2004 18:59:27 -0000 1.1.2.81 *************** *** 32,35 **** --- 32,36 ---- Invalid behaviour: + #: Ellipsis isn't handled properly #: doing from __future__ import division doesn't work doesn't output BINARY_TRUE_DIVISION *************** *** 981,988 **** compiler_make_closure(c, co, asdl_seq_LEN(args->defaults)); ! if (!compiler_nameop(c, s->v.FunctionDef.name, Store)) ! return 0; ! ! return 1; } --- 982,986 ---- compiler_make_closure(c, co, asdl_seq_LEN(args->defaults)); ! return compiler_nameop(c, s->v.FunctionDef.name, Store); } From akuchling at users.sourceforge.net Sun Mar 21 13:59:54 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:09:57 2004 Subject: [Python-checkins] python/dist/src setup.py,1.184,1.185 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31927 Modified Files: setup.py Log Message: [Patch #905863] Support the CVS version of Tcl/Tk, which has the version number 8.5 Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -d -r1.184 -r1.185 *** setup.py 21 Mar 2004 18:57:35 -0000 1.184 --- setup.py 21 Mar 2004 18:59:46 -0000 1.185 *************** *** 964,968 **** # dots on Windows, for detection by cygwin. tcllib = tklib = tcl_includes = tk_includes = None ! for version in ['8.4', '84', '8.3', '83', '8.2', '82', '8.1', '81', '8.0', '80']: tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version) --- 964,968 ---- # dots on Windows, for detection by cygwin. tcllib = tklib = tcl_includes = tk_includes = None ! for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2', '82', '8.1', '81', '8.0', '80']: tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version) From akuchling at users.sourceforge.net Sun Mar 21 14:07:40 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:17:44 2004 Subject: [Python-checkins] python/dist/src/Tools/webchecker README, 1.2, 1.3 webchecker.py, 1.30, 1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/webchecker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1228 Modified Files: README webchecker.py Log Message: [Patch #918212] Support XHTML's 'id' attribute, which can be on any element. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 17 Nov 1999 15:41:47 -0000 1.2 --- README 21 Mar 2004 19:07:23 -0000 1.3 *************** *** 19,20 **** --- 19,23 ---- into webchecker.py, and corresponding mods to wcgui.py and websucker.py. + + - Mar 2004. Chris Herborth contributed a patch to let webchecker.py + handle XHTML's 'id' attribute. Index: webchecker.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** webchecker.py 27 Feb 2003 06:59:10 -0000 1.30 --- webchecker.py 21 Mar 2004 19:07:23 -0000 1.31 *************** *** 785,819 **** sgmllib.SGMLParser.__init__(self) ! def start_a(self, attributes): ! self.link_attr(attributes, 'href') ! ! # We must rescue the NAME # attributes from the anchor, in order to # cache the internal anchors which are made # available in the page. for name, value in attributes: ! if name == "name": if value in self.names: ! self.checker.message("WARNING: duplicate name %s in %s", value, self.url) else: self.names.append(value) break def end_a(self): pass def do_area(self, attributes): self.link_attr(attributes, 'href') def do_body(self, attributes): self.link_attr(attributes, 'background', 'bgsound') def do_img(self, attributes): self.link_attr(attributes, 'src', 'lowsrc') def do_frame(self, attributes): self.link_attr(attributes, 'src', 'longdesc') def do_iframe(self, attributes): self.link_attr(attributes, 'src', 'longdesc') def do_link(self, attributes): --- 785,833 ---- sgmllib.SGMLParser.__init__(self) ! def check_name_id( self, attributes ): ! """ Check the name or id attributes on an element. ! """ ! # We must rescue the NAME or id (name is deprecated in XHTML) # attributes from the anchor, in order to # cache the internal anchors which are made # available in the page. for name, value in attributes: ! if name == "name" or name == "id": if value in self.names: ! self.checker.message("WARNING: duplicate ID name %s in %s", value, self.url) else: self.names.append(value) break + def unknown_starttag( self, tag, attributes ): + """ In XHTML, you can have id attributes on any element. + """ + self.check_name_id(attributes) + + def start_a(self, attributes): + self.link_attr(attributes, 'href') + self.check_name_id(attributes) + def end_a(self): pass def do_area(self, attributes): self.link_attr(attributes, 'href') + self.check_name_id(attributes) def do_body(self, attributes): self.link_attr(attributes, 'background', 'bgsound') + self.check_name_id(attributes) def do_img(self, attributes): self.link_attr(attributes, 'src', 'lowsrc') + self.check_name_id(attributes) def do_frame(self, attributes): self.link_attr(attributes, 'src', 'longdesc') + self.check_name_id(attributes) def do_iframe(self, attributes): self.link_attr(attributes, 'src', 'longdesc') + self.check_name_id(attributes) def do_link(self, attributes): *************** *** 825,846 **** --- 839,867 ---- self.link_attr(attributes, "href") break + self.check_name_id(attributes) def do_object(self, attributes): self.link_attr(attributes, 'data', 'usemap') + self.check_name_id(attributes) def do_script(self, attributes): self.link_attr(attributes, 'src') + self.check_name_id(attributes) def do_table(self, attributes): self.link_attr(attributes, 'background') + self.check_name_id(attributes) def do_td(self, attributes): self.link_attr(attributes, 'background') + self.check_name_id(attributes) def do_th(self, attributes): self.link_attr(attributes, 'background') + self.check_name_id(attributes) def do_tr(self, attributes): self.link_attr(attributes, 'background') + self.check_name_id(attributes) def link_attr(self, attributes, *args): *************** *** 858,861 **** --- 879,883 ---- self.checker.note(1, " Base %s", value) self.base = value + self.check_name_id(attributes) def getlinks(self): From akuchling at users.sourceforge.net Sun Mar 21 14:13:12 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:23:15 2004 Subject: [Python-checkins] python/nondist/sandbox/asyncore - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/asyncore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2303/asyncore Log Message: Directory /cvsroot/python/python/nondist/sandbox/asyncore added to the repository From akuchling at users.sourceforge.net Sun Mar 21 14:14:21 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:24:26 2004 Subject: [Python-checkins] python/nondist/sandbox/asyncore asynchat.py, NONE, 1.1 asyncore.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/asyncore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2485 Added Files: asynchat.py asyncore.py Log Message: Make copy of asyncore/asynchat --- NEW FILE: asynchat.py --- # -*- Mode: Python; tab-width: 4 -*- # Id: asynchat.py,v 2.26 2000/09/07 22:29:26 rushing Exp # Author: Sam Rushing # ====================================================================== # Copyright 1996 by Sam Rushing # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of Sam # Rushing not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ====================================================================== r"""A class supporting chat-style (command/response) protocols. This class adds support for 'chat' style protocols - where one side sends a 'command', and the other sends a response (examples would be the common internet protocols - smtp, nntp, ftp, etc..). The handle_read() method looks at the input stream for the current 'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n' for multi-line output), calling self.found_terminator() on its receipt. for example: Say you build an async nntp client using this class. At the start of the connection, you'll have self.terminator set to '\r\n', in order to process the single-line greeting. Just before issuing a 'LIST' command you'll set it to '\r\n.\r\n'. The output of the LIST command will be accumulated (using your own 'collect_incoming_data' method) up to the terminator, and then control will be returned to you - by calling your self.found_terminator() method. """ import socket import asyncore from collections import deque class async_chat (asyncore.dispatcher): """This is an abstract class. You must derive from this class, and add the two methods collect_incoming_data() and found_terminator()""" # these are overridable defaults ac_in_buffer_size = 4096 ac_out_buffer_size = 4096 def __init__ (self, conn=None): self.ac_in_buffer = '' self.ac_out_buffer = '' self.producer_fifo = fifo() asyncore.dispatcher.__init__ (self, conn) def collect_incoming_data(self, data): raise NotImplementedError, "must be implemented in subclass" def found_terminator(self): raise NotImplementedError, "must be implemented in subclass" def set_terminator (self, term): "Set the input delimiter. Can be a fixed string of any length, an integer, or None" self.terminator = term def get_terminator (self): return self.terminator # grab some more data from the socket, # throw it to the collector method, # check for the terminator, # if found, transition to the next state. def handle_read (self): try: data = self.recv (self.ac_in_buffer_size) except socket.error, why: self.handle_error() return self.ac_in_buffer = self.ac_in_buffer + data # Continue to search for self.terminator in self.ac_in_buffer, # while calling self.collect_incoming_data. The while loop # is necessary because we might read several data+terminator # combos with a single recv(1024). while self.ac_in_buffer: lb = len(self.ac_in_buffer) terminator = self.get_terminator() if terminator is None or terminator == '': # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' elif isinstance(terminator, int): # numeric terminator n = terminator if lb < n: self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' self.terminator = self.terminator - lb else: self.collect_incoming_data (self.ac_in_buffer[:n]) self.ac_in_buffer = self.ac_in_buffer[n:] self.terminator = 0 self.found_terminator() else: # 3 cases: # 1) end of buffer matches terminator exactly: # collect data, transition # 2) end of buffer matches some prefix: # collect data to the prefix # 3) end of buffer does not match any prefix: # collect data terminator_len = len(terminator) index = self.ac_in_buffer.find(terminator) if index != -1: # we found the terminator if index > 0: # don't bother reporting the empty string (source of subtle bugs) self.collect_incoming_data (self.ac_in_buffer[:index]) self.ac_in_buffer = self.ac_in_buffer[index+terminator_len:] # This does the Right Thing if the terminator is changed here. self.found_terminator() else: # check for a prefix of the terminator index = find_prefix_at_end (self.ac_in_buffer, terminator) if index: if index != lb: # we found a prefix, collect up to the prefix self.collect_incoming_data (self.ac_in_buffer[:-index]) self.ac_in_buffer = self.ac_in_buffer[-index:] break else: # no prefix, collect it all self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' def handle_write (self): self.initiate_send () def handle_close (self): self.close() def push (self, data): self.producer_fifo.push (simple_producer (data)) self.initiate_send() def push_with_producer (self, producer): self.producer_fifo.push (producer) self.initiate_send() def readable (self): "predicate for inclusion in the readable for select()" return (len(self.ac_in_buffer) <= self.ac_in_buffer_size) def writable (self): "predicate for inclusion in the writable for select()" # return len(self.ac_out_buffer) or len(self.producer_fifo) or (not self.connected) # this is about twice as fast, though not as clear. return not ( (self.ac_out_buffer == '') and self.producer_fifo.is_empty() and self.connected ) def close_when_done (self): "automatically close this channel once the outgoing queue is empty" self.producer_fifo.push (None) # refill the outgoing buffer by calling the more() method # of the first producer in the queue def refill_buffer (self): while 1: if len(self.producer_fifo): p = self.producer_fifo.first() # a 'None' in the producer fifo is a sentinel, # telling us to close the channel. if p is None: if not self.ac_out_buffer: self.producer_fifo.pop() self.close() return elif isinstance(p, str): self.producer_fifo.pop() self.ac_out_buffer = self.ac_out_buffer + p return data = p.more() if data: self.ac_out_buffer = self.ac_out_buffer + data return else: self.producer_fifo.pop() else: return def initiate_send (self): obs = self.ac_out_buffer_size # try to refill the buffer if (len (self.ac_out_buffer) < obs): self.refill_buffer() if self.ac_out_buffer and self.connected: # try to send the buffer try: num_sent = self.send (self.ac_out_buffer[:obs]) if num_sent: self.ac_out_buffer = self.ac_out_buffer[num_sent:] except socket.error, why: self.handle_error() return def discard_buffers (self): # Emergencies only! self.ac_in_buffer = '' self.ac_out_buffer = '' while self.producer_fifo: self.producer_fifo.pop() class simple_producer: def __init__ (self, data, buffer_size=512): self.data = data self.buffer_size = buffer_size def more (self): if len (self.data) > self.buffer_size: result = self.data[:self.buffer_size] self.data = self.data[self.buffer_size:] return result else: result = self.data self.data = '' return result class fifo: def __init__ (self, list=None): if not list: self.list = deque() else: self.list = deque(list) def __len__ (self): return len(self.list) def is_empty (self): return self.list == [] def first (self): return self.list[0] def push (self, data): self.list.append(data) def pop (self): if self.list: return (1, self.list.popleft()) else: return (0, None) # Given 'haystack', see if any prefix of 'needle' is at its end. This # assumes an exact match has already been checked. Return the number of # characters matched. # for example: # f_p_a_e ("qwerty\r", "\r\n") => 1 # f_p_a_e ("qwertydkjf", "\r\n") => 0 # f_p_a_e ("qwerty\r\n", "\r\n") => # this could maybe be made faster with a computed regex? # [answer: no; circa Python-2.0, Jan 2001] # new python: 28961/s # old python: 18307/s # re: 12820/s # regex: 14035/s def find_prefix_at_end (haystack, needle): l = len(needle) - 1 while l and not haystack.endswith(needle[:l]): l -= 1 return l --- NEW FILE: asyncore.py --- # -*- Mode: Python -*- # Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp # Author: Sam Rushing # ====================================================================== # Copyright 1996 by Sam Rushing # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of Sam # Rushing not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ====================================================================== """Basic infrastructure for asynchronous socket service clients and servers. There are only two ways to have a program on a single processor do "more than one thing at a time". Multi-threaded programming is the simplest and most popular way to do it, but there is another very different technique, that lets you have nearly all the advantages of multi-threading, without actually using multiple threads. it's really only practical if your program is largely I/O bound. If your program is CPU bound, then pre-emptive scheduled threads are probably what you really need. Network servers are rarely CPU-bound, however. If your operating system supports the select() system call in its I/O library (and nearly all do), then you can use it to juggle multiple communication channels at once; doing other work while your I/O is taking place in the "background." Although this strategy can seem strange and complex, especially at first, it is in many ways easier to understand and control than multi-threaded programming. The module documented here solves many of the difficult problems for you, making the task of building sophisticated high-performance network servers and clients a snap. """ import exceptions import select import socket import sys import time import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ ENOTCONN, ESHUTDOWN, EINTR, EISCONN try: socket_map except NameError: socket_map = {} class ExitNow(exceptions.Exception): pass def read(obj): try: obj.handle_read_event() except ExitNow: raise except: obj.handle_error() def write(obj): try: obj.handle_write_event() except ExitNow: raise except: obj.handle_error() def readwrite(obj, flags): try: if flags & select.POLLIN: obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() except ExitNow: raise except: obj.handle_error() def poll(timeout=0.0, map=None): if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.items(): if obj.readable(): r.append(fd) if obj.writable(): w.append(fd) if [] == r == w == e: time.sleep(timeout) else: try: r, w, e = select.select(r, w, e, timeout) except select.error, err: if err[0] != EINTR: raise else: return for fd in r: obj = map.get(fd) if obj is None: continue read(obj) for fd in w: obj = map.get(fd) if obj is None: continue write(obj) def poll2(timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map = socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.items(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) try: r = pollster.poll(timeout) except select.error, err: if err[0] != EINTR: raise r = [] for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags) poll3 = poll2 # Alias for backward compatibility def loop(timeout=30.0, use_poll=0, map=None): while map: loop_once(timeout, use_poll, map) def loop_once(timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll if map: poll_fun(timeout, map) class dispatcher: debug = 0 connected = 0 accepting = 0 closing = 0 addr = None def __init__(self, sock=None, map=None): if map is None: self._map = socket_map else: self._map = map if sock: self.set_socket(sock, map) # I think it should inherit this anyway self.socket.setblocking(0) self.connected = 1 # XXX Does the constructor require that the socket passed # be connected? try: self.addr = sock.getpeername() except socket.error: # The addr isn't crucial pass else: self.socket = None def __repr__(self): status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append('listening') elif self.connected: status.append('connected') if self.addr is not None: try: status.append('%s:%d' % self.addr) except TypeError: status.append(repr(self.addr)) return '<%s at %#x>' % (' '.join(status), id(self)) def add_channel(self, map=None): #self.log_info('adding channel %s' % self) if map is None: map = self._map map[self._fileno] = self def del_channel(self, map=None): fd = self._fileno if map is None: map = self._map if map.has_key(fd): #self.log_info('closing channel %d:%s' % (fd, self)) del map[fd] self._fileno = None def create_socket(self, family, type): self.family_and_type = family, type self.socket = socket.socket(family, type) self.socket.setblocking(0) self._fileno = self.socket.fileno() self.add_channel() def set_socket(self, sock, map=None): self.socket = sock ## self.__dict__['socket'] = sock self._fileno = sock.fileno() self.add_channel(map) def set_reuse_addr(self): # try to re-use a server port if possible try: self.socket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) except socket.error: pass # ================================================== # predicates for select() # these are used as filters for the lists of sockets # to pass to select(). # ================================================== def readable(self): return True if os.name == 'mac': # The macintosh will select a listening socket for # write if you let it. What might this mean? def writable(self): return not self.accepting else: def writable(self): return True # ================================================== # socket object methods. # ================================================== def listen(self, num): self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 return self.socket.listen(num) def bind(self, addr): self.addr = addr return self.socket.bind(addr) def connect(self, address): self.connected = 0 err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): return if err in (0, EISCONN): self.addr = address self.connected = 1 self.handle_connect() else: raise socket.error, err def accept(self): # XXX can return either an address pair or None try: conn, addr = self.socket.accept() return conn, addr except socket.error, why: if why[0] == EWOULDBLOCK: pass else: raise socket.error, why def send(self, data): try: result = self.socket.send(data) return result except socket.error, why: if why[0] == EWOULDBLOCK: return 0 else: raise socket.error, why return 0 def recv(self, buffer_size): try: data = self.socket.recv(buffer_size) if not data: # a closed connection is indicated by signaling # a read condition, and having recv() return 0. self.handle_close() return '' else: return data except socket.error, why: # winsock sometimes throws ENOTCONN if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]: self.handle_close() return '' else: raise socket.error, why def close(self): self.del_channel() self.socket.close() # cheap inheritance, used to pass all other attribute # references to the underlying socket object. def __getattr__(self, attr): return getattr(self.socket, attr) # log and log_info may be overridden to provide more sophisticated # logging and warning methods. In general, log is for 'hit' logging # and 'log_info' is for informational, warning and error logging. def log(self, message): sys.stderr.write('log: %s\n' % str(message)) def log_info(self, message, type='info'): if __debug__ or type != 'info': print '%s: %s' % (type, message) def handle_read_event(self): if self.accepting: # for an accepting socket, getting a read implies # that we are connected if not self.connected: self.connected = 1 self.handle_accept() elif not self.connected: self.handle_connect() self.connected = 1 self.handle_read() else: self.handle_read() def handle_write_event(self): # getting a write implies that we are connected if not self.connected: self.handle_connect() self.connected = 1 self.handle_write() def handle_expt_event(self): self.handle_expt() def handle_error(self): nil, t, v, tbinfo = compact_traceback() # sometimes a user repr method will crash. try: self_repr = repr(self) except: self_repr = '<__repr__(self) failed for object at %0x>' % id(self) self.log_info( 'uncaptured python exception, closing channel %s (%s:%s %s)' % ( self_repr, t, v, tbinfo ), 'error' ) self.close() def handle_expt(self): self.log_info('unhandled exception', 'warning') def handle_read(self): self.log_info('unhandled read event', 'warning') def handle_write(self): self.log_info('unhandled write event', 'warning') def handle_connect(self): self.log_info('unhandled connect event', 'warning') def handle_accept(self): self.log_info('unhandled accept event', 'warning') def handle_close(self): self.log_info('unhandled close event', 'warning') self.close() # --------------------------------------------------------------------------- # adds simple buffered output capability, useful for simple clients. # [for more sophisticated usage use asynchat.async_chat] # --------------------------------------------------------------------------- class dispatcher_with_send(dispatcher): def __init__(self, sock=None): dispatcher.__init__(self, sock) self.out_buffer = '' def initiate_send(self): num_sent = 0 num_sent = dispatcher.send(self, self.out_buffer[:512]) self.out_buffer = self.out_buffer[num_sent:] def handle_write(self): self.initiate_send() def writable(self): return (not self.connected) or len(self.out_buffer) def send(self, data): if self.debug: self.log_info('sending %s' % repr(data)) self.out_buffer = self.out_buffer + data self.initiate_send() # --------------------------------------------------------------------------- # used for debugging. # --------------------------------------------------------------------------- def compact_traceback(): t, v, tb = sys.exc_info() tbinfo = [] assert tb # Must have a traceback while tb: tbinfo.append(( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) )) tb = tb.tb_next # just to be safe del tb file, function, line = tbinfo[-1] info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo]) return (file, function, line), t, v, info def close_all(map=None): if map is None: map = socket_map for x in map.values(): x.socket.close() map.clear() # Asynchronous File I/O: # # After a little research (reading man pages on various unixen, and # digging through the linux kernel), I've determined that select() # isn't meant for doing asynchronous file i/o. # Heartening, though - reading linux/mm/filemap.c shows that linux # supports asynchronous read-ahead. So _MOST_ of the time, the data # will be sitting in memory for us already when we go to read it. # # What other OS's (besides NT) support async file i/o? [VMS?] # # Regardless, this is useful for pipes, and stdin/stdout... if os.name == 'posix': import fcntl class file_wrapper: # here we override just enough to make a file # look like a socket for the purposes of asyncore. def __init__(self, fd): self.fd = fd def recv(self, *args): return os.read(self.fd, *args) def send(self, *args): return os.write(self.fd, *args) read = recv write = send def close(self): return os.close(self.fd) def fileno(self): return self.fd class file_dispatcher(dispatcher): def __init__(self, fd): dispatcher.__init__(self) self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK fcntl.fcntl(fd, fcntl.F_SETFL, flags) self.set_file(fd) def set_file(self, fd): self._fileno = fd self.socket = file_wrapper(fd) self.add_channel() From akuchling at users.sourceforge.net Sun Mar 21 14:15:05 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:25:29 2004 Subject: [Python-checkins] python/nondist/sandbox/asyncore asyncore.py, 1.1, 1.2 asynchat.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/asyncore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2630 Modified Files: asyncore.py asynchat.py Log Message: Add patches from patch #909005 Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/asyncore/asyncore.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asyncore.py 21 Mar 2004 19:14:19 -0000 1.1 --- asyncore.py 21 Mar 2004 19:15:02 -0000 1.2 *************** *** 51,63 **** import socket import sys - import time import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ ! ENOTCONN, ESHUTDOWN, EINTR, EISCONN ! try: ! socket_map ! except NameError: socket_map = {} --- 51,61 ---- import socket import sys import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ ! ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, \ ! errorcode ! if not 'socket_map' in dir(): socket_map = {} *************** *** 81,90 **** obj.handle_error() def readwrite(obj, flags): try: ! if flags & select.POLLIN: obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() except ExitNow: raise --- 79,98 ---- obj.handle_error() + def expt(obj): + try: + obj.handle_expt_event() + except ExitNow: + raise + except: + obj.handle_error() + def readwrite(obj, flags): try: ! if flags & (select.POLLIN | select.POLLPRI): obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() + if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL): + obj.handle_expt_event() except ExitNow: raise *************** *** 96,117 **** map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.items(): ! if obj.readable(): r.append(fd) ! if obj.writable(): w.append(fd) ! if [] == r == w == e: ! time.sleep(timeout) ! else: ! try: ! r, w, e = select.select(r, w, e, timeout) ! except select.error, err: ! if err[0] != EINTR: ! raise ! else: ! return ! for fd in r: obj = map.get(fd) if obj is None: --- 104,138 ---- map = socket_map if map: + pr = []; pw = [] r = []; w = []; e = [] for fd, obj in map.items(): ! e.append(fd) ! if obj.pending_read(): ! pr.append(fd) ! timeout = 0.0 ! elif obj._readable(): r.append(fd) ! if obj.pending_write(): ! pw.append(fd) ! timeout = 0.0 ! elif obj._writable(): w.append(fd) ! try: ! #print '>', r, w, e ! r, w, e = select.select(r, w, e, timeout) ! #print '<', r, w, e ! except select.error, err: ! if err[0] != EINTR: ! raise ! else: ! return ! for fd in e: ! obj = map.get(fd) ! if obj is None: ! continue ! expt(obj) ! ! for fd in pr + r: obj = map.get(fd) if obj is None: *************** *** 119,123 **** read(obj) ! for fd in w: obj = map.get(fd) if obj is None: --- 140,144 ---- read(obj) ! for fd in pw + w: obj = map.get(fd) if obj is None: *************** *** 134,145 **** pollster = select.poll() if map: for fd, obj in map.items(): ! flags = 0 ! if obj.readable(): ! flags = select.POLLIN ! if obj.writable(): flags = flags | select.POLLOUT ! if flags: ! pollster.register(fd, flags) try: r = pollster.poll(timeout) --- 155,172 ---- pollster = select.poll() if map: + pr = [] for fd, obj in map.items(): ! flags = select.POLLERR | select.POLLHUP | select.POLLNVAL ! if obj.pending_read(): ! pr.append((fd, select.POLLIN)) ! timeout = 0.0 ! elif obj._readable(): ! flags = select.POLLIN | select.POLLPRI ! if obj.pending_write(): ! pr.append((fd, select.POLLOUT)) ! timeout = 0.0 ! elif obj._writable(): flags = flags | select.POLLOUT ! pollster.register(fd, flags) try: r = pollster.poll(timeout) *************** *** 147,152 **** if err[0] != EINTR: raise ! r = [] ! for fd, flags in r: obj = map.get(fd) if obj is None: --- 174,181 ---- if err[0] != EINTR: raise ! else: ! return ! ! for fd, flags in pr + r: obj = map.get(fd) if obj is None: *************** *** 172,231 **** poll_fun(timeout, map) ! class dispatcher: debug = 0 - connected = 0 - accepting = 0 - closing = 0 - addr = None def __init__(self, sock=None, map=None): if map is None: ! self._map = socket_map ! else: ! self._map = map if sock: ! self.set_socket(sock, map) ! # I think it should inherit this anyway ! self.socket.setblocking(0) ! self.connected = 1 ! # XXX Does the constructor require that the socket passed ! # be connected? ! try: ! self.addr = sock.getpeername() ! except socket.error: ! # The addr isn't crucial ! pass else: ! self.socket = None ! def __repr__(self): ! status = [self.__class__.__module__+"."+self.__class__.__name__] ! if self.accepting and self.addr: ! status.append('listening') ! elif self.connected: ! status.append('connected') ! if self.addr is not None: ! try: ! status.append('%s:%d' % self.addr) ! except TypeError: ! status.append(repr(self.addr)) ! return '<%s at %#x>' % (' '.join(status), id(self)) ! def add_channel(self, map=None): ! #self.log_info('adding channel %s' % self) ! if map is None: ! map = self._map ! map[self._fileno] = self ! def del_channel(self, map=None): ! fd = self._fileno ! if map is None: ! map = self._map ! if map.has_key(fd): ! #self.log_info('closing channel %d:%s' % (fd, self)) ! del map[fd] ! self._fileno = None def create_socket(self, family, type): --- 201,359 ---- poll_fun(timeout, map) ! class _closed_socket(object): ! __slots__ = [] ! def _dummy(*args): ! raise socket.error(EBADF, 'Bad file descriptor') ! __getattr__ = _dummy ! ! class idispatcher(object): ! ! def __repr__(self): ! status = [self.__class__.__module__+'.'+self.__class__.__name__+'['+str(self.fileno())+']'] ! try: ! if self.accepting and self.addr: ! status.append('listening') ! elif self.connected: ! status.append('connected') ! if self.addr is not None: ! try: ! status.append('%s:%d' % self.addr) ! except TypeError: ! status.append(repr(self.addr)) ! except AttributeError: ! pass ! # On some systems (RH10) id() can be a negative number. ! # work around this. ! MAX = 2L*sys.maxint+1 ! return '<%s at %#x>' % (' '.join(status), id(self)&MAX) ! ! # log and log_info may be overridden to provide more sophisticated ! # logging and warning methods. In general, log is for 'hit' logging ! # and 'log_info' is for informational, warning and error logging. ! ! def log(self, message): ! sys.stderr.write('log: %s\n' % str(message)) ! ! def log_info(self, message, type='info'): ! if __debug__ or type != 'info': ! print '%s: %s' % (type, message) ! ! def fileno(self): ! raise NotImplementedError ! ! def create_socket(self, family, type): ! raise NotImplementedError ! ! def set_socket(self, sock): ! raise NotImplementedError ! ! def set_reuse_addr(self): ! raise NotImplementedError ! ! def listen(self, num): ! raise NotImplementedError ! ! def bind(self, addr): ! raise NotImplementedError ! ! def connect(self, address): ! raise NotImplementedError ! ! def accept(self): ! raise NotImplementedError ! ! def send(self, data): ! raise NotImplementedError ! ! def recv(self, buffer_size): ! raise NotImplementedError ! ! def close(self): ! raise NotImplementedError ! ! def readable(self): ! return False ! ! def pending_read(self): ! return False ! ! def writable(self): ! return False ! ! def pending_write(self): ! return False ! ! def handle_error(self): ! nil, t, v, tbinfo = compact_traceback() ! ! # sometimes a user repr method will crash. ! try: ! self_repr = repr(self) ! except: ! self_repr = '<__repr__(self) failed for object at %0x>' % id(self) ! ! self.log_info( ! 'uncaptured python exception, closing channel %s (%s:%s %s)' % ( ! self_repr, ! t, ! v, ! tbinfo ! ), ! 'error' ! ) ! self.close() ! ! def handle_read(self): ! self.log_info('unhandled read event on %s' % (repr(self)), 'warning') ! ! def handle_write(self): ! self.log_info('unhandled write event on %s' % (repr(self)), 'warning') ! ! def handle_connect(self): ! self.log_info('unhandled connect event on %s' % (repr(self)), 'warning') ! ! def handle_accept(self): ! self.log_info('unhandled accept event on %s' % (repr(self)), 'warning') ! ! def handle_close(self): ! self.log_info('unhandled close event on %s' % (repr(self)), 'warning') ! self.close() ! ! class dispatcher(idispatcher): debug = 0 def __init__(self, sock=None, map=None): + idispatcher.__init__(self) if map is None: ! map = socket_map ! self._map = map ! self.connected = False ! self.accepting = False ! self.addr = None ! self.pending_accept = None if sock: ! self.set_socket(sock) else: ! self.socket = _closed_socket() ! def fileno(self): ! return self._fileno ! def add_channel(self): ! if self.debug: ! self.log_info('adding channel %d:%s' % (self._fileno, self)) ! self._map[self._fileno] = self ! def del_channel(self): ! if self._fileno is not None: ! if self.debug: ! self.log_info('closing channel %d:%s' % (self._fileno, self)) ! try: ! del self._map[self._fileno] ! except: ! pass ! self._fileno = None def create_socket(self, family, type): *************** *** 236,244 **** self.add_channel() ! def set_socket(self, sock, map=None): self.socket = sock ! ## self.__dict__['socket'] = sock ! self._fileno = sock.fileno() ! self.add_channel(map) def set_reuse_addr(self): --- 364,384 ---- self.add_channel() ! def set_socket(self, sock): self.socket = sock ! ! self.socket.setblocking(0) ! self.connected = False ! try: ! self.addr = sock.getpeername() ! self.connected = True ! except socket.error, err: ! if err[0] == ENOTCONN: ! pass ! else: ! raise ! ! fd = sock.fileno() ! self._fileno = fd ! self.add_channel() def set_reuse_addr(self): *************** *** 259,272 **** # ================================================== ! def readable(self): ! return True ! if os.name == 'mac': ! # The macintosh will select a listening socket for ! # write if you let it. What might this mean? ! def writable(self): ! return not self.accepting ! else: ! def writable(self): return True --- 399,418 ---- # ================================================== ! def _readable(self): ! if self.accepting: ! # wait for readable event for accepting socket (man accept) ! return True ! if self.connected: ! return self.readable() ! else: ! return False ! def _writable(self): ! if self.accepting: ! return False ! if self.connected: ! return self.writable() ! else: ! # wait for writable event for connecting socket (man connect) return True *************** *** 276,280 **** def listen(self, num): ! self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 --- 422,426 ---- def listen(self, num): ! self.accepting = True if os.name == 'nt' and num > 5: num = 1 *************** *** 286,290 **** def connect(self, address): ! self.connected = 0 err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values --- 432,436 ---- def connect(self, address): ! self.connected = False err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values *************** *** 293,311 **** if err in (0, EISCONN): self.addr = address ! self.connected = 1 self.handle_connect() else: ! raise socket.error, err def accept(self): ! # XXX can return either an address pair or None ! try: ! conn, addr = self.socket.accept() ! return conn, addr ! except socket.error, why: ! if why[0] == EWOULDBLOCK: ! pass ! else: ! raise socket.error, why def send(self, data): --- 439,451 ---- if err in (0, EISCONN): self.addr = address ! self.connected = True self.handle_connect() else: ! raise socket.error, (err, errorcode[err]) def accept(self): ! res = self.pending_accept ! self.pending_accept = None ! return res def send(self, data): *************** *** 316,322 **** if why[0] == EWOULDBLOCK: return 0 else: ! raise socket.error, why ! return 0 def recv(self, buffer_size): --- 456,465 ---- if why[0] == EWOULDBLOCK: return 0 + if why[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN): + self.connected = False + self.handle_close() + return 0 else: ! raise def recv(self, buffer_size): *************** *** 326,329 **** --- 469,473 ---- # a closed connection is indicated by signaling # a read condition, and having recv() return 0. + self.connected = False self.handle_close() return '' *************** *** 331,342 **** return data except socket.error, why: ! # winsock sometimes throws ENOTCONN ! if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]: self.handle_close() return '' else: ! raise socket.error, why def close(self): self.del_channel() self.socket.close() --- 475,490 ---- return data except socket.error, why: ! if why[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN): ! self.connected = False self.handle_close() return '' else: ! raise def close(self): + self.connected = False + self.accepting = False + self.addr = None + self.pending_accept = None self.del_channel() self.socket.close() *************** *** 347,423 **** return getattr(self.socket, attr) - # log and log_info may be overridden to provide more sophisticated - # logging and warning methods. In general, log is for 'hit' logging - # and 'log_info' is for informational, warning and error logging. - - def log(self, message): - sys.stderr.write('log: %s\n' % str(message)) - - def log_info(self, message, type='info'): - if __debug__ or type != 'info': - print '%s: %s' % (type, message) - def handle_read_event(self): if self.accepting: ! # for an accepting socket, getting a read implies ! # that we are connected ! if not self.connected: ! self.connected = 1 self.handle_accept() - elif not self.connected: - self.handle_connect() - self.connected = 1 - self.handle_read() else: self.handle_read() def handle_write_event(self): ! # getting a write implies that we are connected ! if not self.connected: ! self.handle_connect() ! self.connected = 1 ! self.handle_write() def handle_expt_event(self): ! self.handle_expt() ! ! def handle_error(self): ! nil, t, v, tbinfo = compact_traceback() ! ! # sometimes a user repr method will crash. ! try: ! self_repr = repr(self) ! except: ! self_repr = '<__repr__(self) failed for object at %0x>' % id(self) ! ! self.log_info( ! 'uncaptured python exception, closing channel %s (%s:%s %s)' % ( ! self_repr, ! t, ! v, ! tbinfo ! ), ! 'error' ! ) ! self.close() ! ! def handle_expt(self): ! self.log_info('unhandled exception', 'warning') ! ! def handle_read(self): ! self.log_info('unhandled read event', 'warning') ! ! def handle_write(self): ! self.log_info('unhandled write event', 'warning') ! ! def handle_connect(self): ! self.log_info('unhandled connect event', 'warning') ! ! def handle_accept(self): ! self.log_info('unhandled accept event', 'warning') - def handle_close(self): - self.log_info('unhandled close event', 'warning') - self.close() # --------------------------------------------------------------------------- --- 495,531 ---- return getattr(self.socket, attr) def handle_read_event(self): if self.accepting: ! try: ! self.pending_accept = self.socket.accept() ! except socket.error: ! # treat errors after accept() as EWOULDBLOCK ! return ! except: ! raise self.handle_accept() else: + # impossible get read event for connecting socket + assert(self.connected) self.handle_read() def handle_write_event(self): ! # impossible get write event for accepting socket ! assert(not self.accepting) ! if self.connected: ! self.handle_write() ! else: ! err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) ! if err != 0: ! raise socket.error, (err, errorcode[err]) ! else: ! self.connected = True ! self.handle_connect() def handle_expt_event(self): ! err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) ! assert(err != 0) ! raise socket.error, (err, errorcode[err]) # --------------------------------------------------------------------------- *************** *** 476,480 **** map = socket_map for x in map.values(): ! x.socket.close() map.clear() --- 584,594 ---- map = socket_map for x in map.values(): ! try: ! x.close() ! except OSError, x: ! if x[0] == EBADF: ! pass ! else: ! raise map.clear() *************** *** 502,516 **** self.fd = fd ! def recv(self, *args): return os.read(self.fd, *args) ! def send(self, *args): return os.write(self.fd, *args) ! read = recv ! write = send def close(self): ! return os.close(self.fd) def fileno(self): --- 616,630 ---- self.fd = fd ! def read(self, *args): return os.read(self.fd, *args) ! def write(self, *args): return os.write(self.fd, *args) ! recv = read ! send = write def close(self): ! os.close(self.fd) def fileno(self): *************** *** 519,530 **** class file_dispatcher(dispatcher): ! def __init__(self, fd): ! dispatcher.__init__(self) ! self.connected = 1 # set it to non-blocking mode ! flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK ! fcntl.fcntl(fd, fcntl.F_SETFL, flags) ! self.set_file(fd) def set_file(self, fd): --- 633,644 ---- class file_dispatcher(dispatcher): ! def __init__(self, fd, map=None): ! dispatcher.__init__(self, None, map) ! self.connected = True ! self.set_file(fd) # set it to non-blocking mode ! flags = fcntl.fcntl(self._fileno, fcntl.F_GETFL, 0) flags = flags | os.O_NONBLOCK ! fcntl.fcntl(self._fileno, fcntl.F_SETFL, flags) def set_file(self, fd): *************** *** 532,533 **** --- 646,648 ---- self.socket = file_wrapper(fd) self.add_channel() + Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/asyncore/asynchat.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asynchat.py 21 Mar 2004 19:14:19 -0000 1.1 --- asynchat.py 21 Mar 2004 19:15:02 -0000 1.2 *************** *** 51,55 **** from collections import deque ! class async_chat (asyncore.dispatcher): """This is an abstract class. You must derive from this class, and add the two methods collect_incoming_data() and found_terminator()""" --- 51,55 ---- from collections import deque ! class iasync_chat (asyncore.idispatcher): """This is an abstract class. You must derive from this class, and add the two methods collect_incoming_data() and found_terminator()""" *************** *** 60,68 **** ac_out_buffer_size = 4096 ! def __init__ (self, conn=None): self.ac_in_buffer = '' self.ac_out_buffer = '' self.producer_fifo = fifo() - asyncore.dispatcher.__init__ (self, conn) def collect_incoming_data(self, data): --- 60,68 ---- ac_out_buffer_size = 4096 ! def __init__ (self): ! asyncore.idispatcher.__init__ (self) self.ac_in_buffer = '' self.ac_out_buffer = '' self.producer_fifo = fifo() def collect_incoming_data(self, data): *************** *** 233,236 **** --- 233,242 ---- + class async_chat (iasync_chat, asyncore.dispatcher): + + def __init__ (self, sock=None, map=None): + asyncore.dispatcher.__init__ (self, sock, map) + iasync_chat.__init__ (self) + class simple_producer: From akuchling at users.sourceforge.net Sun Mar 21 14:26:02 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:36:06 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4819 Modified Files: asyncore.py Log Message: [Part of patch #909005] Handle POLLPRI flag, and various errors cases. Fixes bug #887279 Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** asyncore.py 8 Feb 2004 11:32:50 -0000 1.44 --- asyncore.py 21 Mar 2004 19:26:00 -0000 1.45 *************** *** 83,90 **** def readwrite(obj, flags): try: ! if flags & select.POLLIN: obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() except ExitNow: raise --- 83,92 ---- def readwrite(obj, flags): try: ! if flags & (select.POLLIN | select.POLLPRI): obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() + if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL): + obj.handle_expt_event() except ExitNow: raise From akuchling at users.sourceforge.net Sun Mar 21 14:28:50 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:38:55 2004 Subject: [Python-checkins] python/dist/src/Lib optparse.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5343 Modified Files: optparse.py Log Message: [Patch #900071] Be case-insensitive when removing 'usage:' string Index: optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/optparse.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** optparse.py 26 Jan 2004 16:42:30 -0000 1.6 --- optparse.py 21 Mar 2004 19:28:48 -0000 1.7 *************** *** 1034,1038 **** elif usage is SUPPRESS_USAGE: self.usage = None ! elif usage.startswith("usage: "): # for backwards compatibility with Optik 1.3 and earlier self.usage = usage[7:] --- 1034,1038 ---- elif usage is SUPPRESS_USAGE: self.usage = None ! elif usage.lower().startswith("usage: "): # for backwards compatibility with Optik 1.3 and earlier self.usage = usage[7:] From nnorwitz at users.sourceforge.net Sun Mar 21 14:34:13 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 14:44:16 2004 Subject: [Python-checkins] python/dist/src/Python future.c, 2.12.2.5, 2.12.2.6 newcompile.c, 1.1.2.81, 1.1.2.82 pythonrun.c, 2.161.2.10, 2.161.2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6528/Python Modified Files: Tag: ast-branch future.c newcompile.c pythonrun.c Log Message: get future division working Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.12.2.5 retrieving revision 2.12.2.6 diff -C2 -d -r2.12.2.5 -r2.12.2.6 *** future.c 26 Jan 2004 14:38:58 -0000 2.12.2.5 --- future.c 21 Mar 2004 19:34:11 -0000 2.12.2.6 *************** *** 59,63 **** } ! if (mod->kind != Module_kind) /* XXX */ return 1; for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { --- 59,63 ---- } ! if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) return 1; for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.81 retrieving revision 1.1.2.82 diff -C2 -d -r1.1.2.81 -r1.1.2.82 *** newcompile.c 21 Mar 2004 18:59:27 -0000 1.1.2.81 --- newcompile.c 21 Mar 2004 19:34:11 -0000 1.1.2.82 *************** *** 33,38 **** Invalid behaviour: #: Ellipsis isn't handled properly - #: doing from __future__ import division doesn't work - doesn't output BINARY_TRUE_DIVISION #: co_names doesn't contain locals, only globals, co_varnames may work #: ref leaks in interpreter when press return on empty line --- 33,36 ---- *************** *** 212,215 **** --- 210,215 ---- struct compiler c; PyCodeObject *co = NULL; + PyCompilerFlags local_flags; + int merged; if (!__doc__) { *************** *** 225,233 **** if (c.c_future == NULL) goto error; ! if (flags) { ! int merged = c.c_future->ff_features | flags->cf_flags; ! c.c_future->ff_features = merged; ! flags->cf_flags = merged; ! } /* Trivial test of marshal code for now. */ --- 225,236 ---- if (c.c_future == NULL) goto error; ! if (!flags) { ! local_flags.cf_flags = 0; ! flags = &local_flags; ! } ! merged = c.c_future->ff_features | flags->cf_flags; ! c.c_future->ff_features = merged; ! flags->cf_flags = merged; ! c.c_flags = flags; /* Trivial test of marshal code for now. */ *************** *** 2733,2736 **** --- 2736,2741 ---- if (ste->ste_generator) flags |= CO_GENERATOR; + if (c->c_flags->cf_flags & CO_FUTURE_DIVISION) + flags |= CO_FUTURE_DIVISION; n = PyDict_Size(c->u->u_freevars); if (n < 0) Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.10 retrieving revision 2.161.2.11 diff -C2 -d -r2.161.2.10 -r2.161.2.11 *** pythonrun.c 20 Mar 2004 21:28:22 -0000 2.161.2.10 --- pythonrun.c 21 Mar 2004 19:34:11 -0000 2.161.2.11 *************** *** 1146,1156 **** Py_SymtableString(const char *str, const char *filename, int start) { - PyCompilerFlags local_flags; mod_ty mod; struct symtable *st; ! local_flags.cf_flags = 0; /* XXX flags? */ ! ! mod = PyParser_ASTFromString(str, filename, start, &local_flags); if (mod == NULL) return NULL; --- 1146,1153 ---- Py_SymtableString(const char *str, const char *filename, int start) { mod_ty mod; struct symtable *st; ! mod = PyParser_ASTFromString(str, filename, start, NULL); if (mod == NULL) return NULL; *************** *** 1182,1186 **** node *n; perrdetail err; - fprintf(stderr, "filename=%s\n", filename); n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, start, ps1, ps2, &err, PARSER_FLAGS(flags)); --- 1179,1182 ---- From perky at users.sourceforge.net Sun Mar 21 14:34:33 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Mar 21 14:44:36 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.955,1.956 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6269/Misc Modified Files: NEWS Log Message: Bug #920575: Add a workaround for GNU libc nl_langinfo()'s returning NULL. (Reported by Matthias Klose) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.955 retrieving revision 1.956 diff -C2 -d -r1.955 -r1.956 *** NEWS 21 Mar 2004 18:37:23 -0000 1.955 --- NEWS 21 Mar 2004 19:34:30 -0000 1.956 *************** *** 194,197 **** --- 194,200 ---- ----------------- + - Bug #920575: A problem that _locale module segfaults on + nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed. + - array objects now support the copy module. Also, their resizing scheme has been updated the same as for list objects. The improves From perky at users.sourceforge.net Sun Mar 21 14:34:33 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Mar 21 14:44:39 2004 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c, 2.44, 2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6269/Modules Modified Files: _localemodule.c Log Message: Bug #920575: Add a workaround for GNU libc nl_langinfo()'s returning NULL. (Reported by Matthias Klose) Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** _localemodule.c 20 Nov 2003 13:30:59 -0000 2.44 --- _localemodule.c 21 Mar 2004 19:34:30 -0000 2.45 *************** *** 593,598 **** #endif for (i = 0; langinfo_constants[i].name; i++) ! if (langinfo_constants[i].value == item) ! return PyString_FromString(nl_langinfo(item)); PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; --- 593,602 ---- #endif for (i = 0; langinfo_constants[i].name; i++) ! if (langinfo_constants[i].value == item) { ! /* Check NULL as a workaround for GNU libc's returning NULL ! instead of an empty string for nl_langinfo(ERA). */ ! const char *result = nl_langinfo(item); ! return PyString_FromString(result != NULL ? result : ""); ! } PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; From arigo at users.sourceforge.net Sun Mar 21 14:43:26 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sun Mar 21 14:53:31 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.82, 1.1.2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8215 Modified Files: Tag: ast-branch newcompile.c Log Message: Report a bug. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.82 retrieving revision 1.1.2.83 diff -C2 -d -r1.1.2.82 -r1.1.2.83 *** newcompile.c 21 Mar 2004 19:34:11 -0000 1.1.2.82 --- newcompile.c 21 Mar 2004 19:43:23 -0000 1.1.2.83 *************** *** 22,25 **** --- 22,26 ---- #: exec generally still has problems #: test_errno fails because stackdepth() isn't implemented (assert'ed) + #: do something about memory management! Inappropriate Exceptions: *************** *** 585,589 **** if (newsize <= 0) { PyErr_NoMemory(); ! return 0; } b->b_ialloc <<= 1; --- 586,590 ---- if (newsize <= 0) { PyErr_NoMemory(); ! return -1; } b->b_ialloc <<= 1; From akuchling at users.sourceforge.net Sun Mar 21 14:46:22 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 14:56:26 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8687 Modified Files: asyncore.py Log Message: [Part of patch #909005] Use True/False Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** asyncore.py 21 Mar 2004 19:26:00 -0000 1.45 --- asyncore.py 21 Mar 2004 19:46:16 -0000 1.46 *************** *** 158,162 **** poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map --- 158,162 ---- poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map *************** *** 172,179 **** class dispatcher: ! debug = 0 ! connected = 0 ! accepting = 0 ! closing = 0 addr = None --- 172,179 ---- class dispatcher: ! debug = False ! connected = False ! accepting = False ! closing = False addr = None *************** *** 188,192 **** # I think it should inherit this anyway self.socket.setblocking(0) ! self.connected = 1 # XXX Does the constructor require that the socket passed # be connected? --- 188,192 ---- # I think it should inherit this anyway self.socket.setblocking(0) ! self.connected = True # XXX Does the constructor require that the socket passed # be connected? *************** *** 274,278 **** def listen(self, num): ! self.accepting = 1 if os.name == 'nt' and num > 5: num = 1 --- 274,278 ---- def listen(self, num): ! self.accepting = True if os.name == 'nt' and num > 5: num = 1 *************** *** 284,288 **** def connect(self, address): ! self.connected = 0 err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values --- 284,288 ---- def connect(self, address): ! self.connected = False err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values *************** *** 291,295 **** if err in (0, EISCONN): self.addr = address ! self.connected = 1 self.handle_connect() else: --- 291,295 ---- if err in (0, EISCONN): self.addr = address ! self.connected = True self.handle_connect() else: *************** *** 361,369 **** # that we are connected if not self.connected: ! self.connected = 1 self.handle_accept() elif not self.connected: self.handle_connect() ! self.connected = 1 self.handle_read() else: --- 361,369 ---- # that we are connected if not self.connected: ! self.connected = True self.handle_accept() elif not self.connected: self.handle_connect() ! self.connected = True self.handle_read() else: *************** *** 374,378 **** if not self.connected: self.handle_connect() ! self.connected = 1 self.handle_write() --- 374,378 ---- if not self.connected: self.handle_connect() ! self.connected = True self.handle_write() *************** *** 519,523 **** def __init__(self, fd): dispatcher.__init__(self) ! self.connected = 1 # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) --- 519,523 ---- def __init__(self, fd): dispatcher.__init__(self) ! self.connected = True # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) From akuchling at users.sourceforge.net Sun Mar 21 14:50:11 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 15:00:15 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9305 Modified Files: asyncore.py Log Message: [Part of patch #909005] Set initial poll flags Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** asyncore.py 21 Mar 2004 19:46:16 -0000 1.46 --- asyncore.py 21 Mar 2004 19:50:09 -0000 1.47 *************** *** 137,143 **** if map: for fd, obj in map.items(): ! flags = 0 if obj.readable(): ! flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT --- 137,143 ---- if map: for fd, obj in map.items(): ! flags = select.POLLERR | select.POLLHUP | select.POLLNVAL if obj.readable(): ! flags = select.POLLIN | select.POLLPRI if obj.writable(): flags = flags | select.POLLOUT From akuchling at users.sourceforge.net Sun Mar 21 14:52:04 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 15:02:07 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9569 Modified Files: asyncore.py Log Message: [Part of patch #909005] Remove Mac code for writable Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** asyncore.py 21 Mar 2004 19:50:09 -0000 1.47 --- asyncore.py 21 Mar 2004 19:52:01 -0000 1.48 *************** *** 260,271 **** return True ! if os.name == 'mac': ! # The macintosh will select a listening socket for ! # write if you let it. What might this mean? ! def writable(self): ! return not self.accepting ! else: ! def writable(self): ! return True # ================================================== --- 260,265 ---- return True ! def writable(self): ! return True # ================================================== From perky at users.sourceforge.net Sun Mar 21 14:54:02 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Mar 21 15:04:08 2004 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c, 2.40.4.2, 2.40.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9690/Modules Modified Files: Tag: release23-maint _localemodule.c Log Message: Backport checkin: [Bug #920575] Add a workaround for GNU libc nl_langinfo()'s returning NULL. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.40.4.2 retrieving revision 2.40.4.3 diff -C2 -d -r2.40.4.2 -r2.40.4.3 *** _localemodule.c 4 Sep 2003 18:26:07 -0000 2.40.4.2 --- _localemodule.c 21 Mar 2004 19:53:59 -0000 2.40.4.3 *************** *** 593,598 **** #endif for (i = 0; langinfo_constants[i].name; i++) ! if (langinfo_constants[i].value == item) ! return PyString_FromString(nl_langinfo(item)); PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; --- 593,602 ---- #endif for (i = 0; langinfo_constants[i].name; i++) ! if (langinfo_constants[i].value == item) { ! /* Check NULL as a workaround for GNU libc's returning NULL ! instead of an empty string for nl_langinfo(ERA). */ ! const char *result = nl_langinfo(item); ! return PyString_FromString(result != NULL ? result : ""); ! } PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; From perky at users.sourceforge.net Sun Mar 21 14:54:02 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Mar 21 15:04:11 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.95,1.831.4.96 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9690/Misc Modified Files: Tag: release23-maint NEWS Log Message: Backport checkin: [Bug #920575] Add a workaround for GNU libc nl_langinfo()'s returning NULL. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.95 retrieving revision 1.831.4.96 diff -C2 -d -r1.831.4.95 -r1.831.4.96 *** NEWS 20 Mar 2004 23:13:49 -0000 1.831.4.95 --- NEWS 21 Mar 2004 19:53:59 -0000 1.831.4.96 *************** *** 39,42 **** --- 39,45 ---- ------- + - Bug #920575: A problem that _locale module segfaults on + nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed. + - Bug #883604: Fix Lib/test/test_strftime.py to escape characters from locale time values that might be mistaken as regex syntax. From akuchling at users.sourceforge.net Sun Mar 21 14:58:46 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 15:08:50 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10878 Modified Files: asyncore.py Log Message: [Part of patch #909005] Repeating exception changed from 'raise socket.error, why' to just raise. Make use of connect_ex() raise socket.error with 2-tuple instead of just error code Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** asyncore.py 21 Mar 2004 19:52:01 -0000 1.48 --- asyncore.py 21 Mar 2004 19:58:28 -0000 1.49 *************** *** 55,59 **** import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ ! ENOTCONN, ESHUTDOWN, EINTR, EISCONN try: --- 55,59 ---- import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ ! ENOTCONN, ESHUTDOWN, EINTR, EISCONN, errorcode try: *************** *** 288,292 **** self.handle_connect() else: ! raise socket.error, err def accept(self): --- 288,292 ---- self.handle_connect() else: ! raise socket.error, (err, errorcode[err]) def accept(self): *************** *** 299,303 **** pass else: ! raise socket.error, why def send(self, data): --- 299,303 ---- pass else: ! raise def send(self, data): *************** *** 309,313 **** return 0 else: ! raise socket.error, why return 0 --- 309,313 ---- return 0 else: ! raise return 0 *************** *** 328,332 **** return '' else: ! raise socket.error, why def close(self): --- 328,332 ---- return '' else: ! raise def close(self): From akuchling at users.sourceforge.net Sun Mar 21 15:03:21 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 15:13:24 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11722 Modified Files: asyncore.py Log Message: [Part of patch #909005] Added map parameter for file_dispatcher and dispatcher_with_send Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** asyncore.py 21 Mar 2004 19:58:28 -0000 1.49 --- asyncore.py 21 Mar 2004 20:03:18 -0000 1.50 *************** *** 420,425 **** class dispatcher_with_send(dispatcher): ! def __init__(self, sock=None): ! dispatcher.__init__(self, sock) self.out_buffer = '' --- 420,425 ---- class dispatcher_with_send(dispatcher): ! def __init__(self, sock=None, map=None): ! dispatcher.__init__(self, sock, map) self.out_buffer = '' *************** *** 511,516 **** class file_dispatcher(dispatcher): ! def __init__(self, fd): ! dispatcher.__init__(self) self.connected = True # set it to non-blocking mode --- 511,516 ---- class file_dispatcher(dispatcher): ! def __init__(self, fd, map=None): ! dispatcher.__init__(self, None, map) self.connected = True # set it to non-blocking mode From mondragon at users.sourceforge.net Sun Mar 21 15:24:09 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 15:34:14 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.956,1.957 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15479/Misc Modified Files: NEWS Log Message: Changed file.name to be the object passed as the 'name' argument to file() Fixes SF Bug #773356 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.956 retrieving revision 1.957 diff -C2 -d -r1.956 -r1.957 *** NEWS 21 Mar 2004 19:34:30 -0000 1.956 --- NEWS 21 Mar 2004 20:24:07 -0000 1.957 *************** *** 13,16 **** --- 13,18 ---- ----------------- + - Set file.name to the object passed to open (instead of a new string) + - Moved tracebackobject into traceback.h and renamed to PyTracebackObject From mondragon at users.sourceforge.net Sun Mar 21 15:24:09 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 15:34:17 2004 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.188,2.189 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15479/Objects Modified Files: fileobject.c Log Message: Changed file.name to be the object passed as the 'name' argument to file() Fixes SF Bug #773356 Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** fileobject.c 19 Mar 2004 15:22:36 -0000 2.188 --- fileobject.c 21 Mar 2004 20:24:07 -0000 2.189 *************** *** 96,101 **** static PyObject * ! fill_file_fields(PyFileObject *f, FILE *fp, char *name, char *mode, ! int (*close)(FILE *), PyObject *wname) { assert(f != NULL); --- 96,101 ---- static PyObject * ! fill_file_fields(PyFileObject *f, FILE *fp, PyObject *name, char *mode, ! int (*close)(FILE *)) { assert(f != NULL); *************** *** 106,115 **** Py_DECREF(f->f_mode); Py_DECREF(f->f_encoding); ! #ifdef Py_USING_UNICODE ! if (wname) ! f->f_name = PyUnicode_FromObject(wname); ! else ! #endif ! f->f_name = PyString_FromString(name); f->f_mode = PyString_FromString(mode); --- 106,113 ---- Py_DECREF(f->f_mode); Py_DECREF(f->f_encoding); ! ! Py_INCREF (name); ! f->f_name = name; ! f->f_mode = PyString_FromString(mode); *************** *** 203,211 **** mode); else - #ifdef MS_WINDOWS PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, f->f_name); - #else - PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); - #endif /* MS_WINDOWS */ f = NULL; } --- 201,205 ---- *************** *** 221,228 **** NULL, NULL); if (f != NULL) { ! if (fill_file_fields(f, fp, name, mode, close, NULL) == NULL) { Py_DECREF(f); f = NULL; } } return (PyObject *) f; --- 215,224 ---- NULL, NULL); if (f != NULL) { ! PyObject *o_name = PyString_FromString(name); ! if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { Py_DECREF(f); f = NULL; } + Py_DECREF(o_name); } return (PyObject *) f; *************** *** 1854,1859 **** kwlist, &po, &mode, &bufsize)) { wideargument = 1; ! if (fill_file_fields(foself, NULL, name, mode, ! fclose, po) == NULL) goto Error; } else { --- 1850,1855 ---- kwlist, &po, &mode, &bufsize)) { wideargument = 1; ! if (fill_file_fields(foself, NULL, po, mode, ! fclose) == NULL) goto Error; } else { *************** *** 1866,1869 **** --- 1862,1867 ---- if (!wideargument) { + PyObject *o_name; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:file", kwlist, Py_FileSystemDefaultEncoding, *************** *** 1871,1876 **** &mode, &bufsize)) return -1; ! if (fill_file_fields(foself, NULL, name, mode, ! fclose, NULL) == NULL) goto Error; } --- 1869,1880 ---- &mode, &bufsize)) return -1; ! ! /* We parse again to get the name as a PyObject */ ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file", kwlist, ! &o_name, &mode, &bufsize)) ! return -1; ! ! if (fill_file_fields(foself, NULL, o_name, mode, ! fclose) == NULL) goto Error; } From arigo at users.sourceforge.net Sun Mar 21 15:27:51 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sun Mar 21 15:37:55 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.87,2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16049 Modified Files: tupleobject.c Log Message: This is the fastest I could get on Intel GCC. I kept the memset() in to clear the newly created tuples, but tuples added in the freelist are now cleared in tupledealloc already (which is very cheap, because we are already Py_XDECREF'ing all elements anyway). Python should have a standard Py_ZAP macro like ZAP in pystate.c. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -d -r2.87 -r2.88 *** tupleobject.c 20 Mar 2004 21:35:09 -0000 2.87 --- tupleobject.c 21 Mar 2004 20:27:49 -0000 2.88 *************** *** 69,75 **** if (op == NULL) return NULL; } - for (i=0; i < size; i++) - op->ob_item[i] = NULL; #if MAXSAVESIZE > 0 if (size == 0) { --- 69,74 ---- if (op == NULL) return NULL; + memset(op->ob_item, 0, size*sizeof(PyObject*)); } #if MAXSAVESIZE > 0 if (size == 0) { *************** *** 166,171 **** if (len > 0) { i = len; - while (--i >= 0) - Py_XDECREF(op->ob_item[i]); #if MAXSAVESIZE > 0 if (len < MAXSAVESIZE && --- 165,168 ---- *************** *** 173,176 **** --- 170,180 ---- op->ob_type == &PyTuple_Type) { + while (--i >= 0) { + PyObject* o = op->ob_item[i]; + if (o != NULL) { + op->ob_item[i] = NULL; + Py_DECREF(o); + } + } op->ob_item[0] = (PyObject *) free_tuples[len]; num_free_tuples[len]++; *************** *** 178,182 **** --- 182,189 ---- goto done; /* return */ } + else #endif + while (--i >= 0) + Py_XDECREF(op->ob_item[i]); } op->ob_type->tp_free((PyObject *)op); From nnorwitz at users.sourceforge.net Sun Mar 21 15:48:07 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 15:58:12 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.83, 1.1.2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21045/Python Modified Files: Tag: ast-branch newcompile.c Log Message: always print error message Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.83 retrieving revision 1.1.2.84 diff -C2 -d -r1.1.2.83 -r1.1.2.84 *** newcompile.c 21 Mar 2004 19:43:23 -0000 1.1.2.83 --- newcompile.c 21 Mar 2004 20:48:05 -0000 1.1.2.84 *************** *** 913,917 **** arg = compiler_lookup_arg(c->u->u_freevars, name); if (arg == -1) { ! fprintf(stderr, "lookup %s in %s %d %d\n" "freevars of %s: %s\n", PyObject_REPR(name), --- 913,917 ---- arg = compiler_lookup_arg(c->u->u_freevars, name); if (arg == -1) { ! printf("lookup %s in %s %d %d\n" "freevars of %s: %s\n", PyObject_REPR(name), From nnorwitz at users.sourceforge.net Sun Mar 21 15:49:23 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 15:59:27 2004 Subject: [Python-checkins] python/dist/src/Python symtable.c, 2.10.8.22, 2.10.8.23 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21395/Python Modified Files: Tag: ast-branch symtable.c Log Message: fix nested closures Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.22 retrieving revision 2.10.8.23 diff -C2 -d -r2.10.8.22 -r2.10.8.23 *** symtable.c 21 Mar 2004 17:14:32 -0000 2.10.8.22 --- symtable.c 21 Mar 2004 20:49:13 -0000 2.10.8.23 *************** *** 369,373 **** analyze_cells(PyObject *scope, PyObject *free) { ! PyObject *name, *v, *w; int flags, pos = 0, success = 0; --- 369,373 ---- analyze_cells(PyObject *scope, PyObject *free) { ! PyObject *name, *v, *w; int flags, pos = 0, success = 0; *************** *** 399,405 **** /* Enter the final scope information into the st_symbols dict. */ static int ! update_symbols(PyObject *symbols, PyObject *scope) { ! PyObject *name, *v, *u, *w; int i, flags, pos = 0; --- 399,406 ---- /* Enter the final scope information into the st_symbols dict. */ static int ! update_symbols(PyObject *symbols, PyObject *scope, ! PyObject *bound, PyObject *free) { ! PyObject *name, *v, *u, *w, *free_value = NULL; int i, flags, pos = 0; *************** *** 418,421 **** --- 419,441 ---- Py_DECREF(u); } + + free_value = PyInt_FromLong(FREE << SCOPE_OFF); + if (!free_value) + return 0; + + /* add a free variable when it's only use is for creating a closure */ + pos = 0; + while (PyDict_Next(free, &pos, &name, &v)) { + if (PyDict_GetItem(symbols, name)) + continue; /* it's not free, probably a cell */ + if (!PyDict_GetItem(bound, name)) + continue; /* it's a global */ + + if (PyDict_SetItem(symbols, name, free_value) < 0) { + Py_DECREF(free_value); + return 0; + } + } + Py_DECREF(free_value); return 1; } *************** *** 447,451 **** if (!newbound) goto error; ! if (ste->ste_type != ClassBlock) { if (PyDict_Update(newbound, local) < 0) goto error; --- 467,471 ---- if (!newbound) goto error; ! if (ste->ste_type == FunctionBlock) { if (PyDict_Update(newbound, local) < 0) goto error; *************** *** 459,463 **** PyObject *c = PyList_GET_ITEM(ste->ste_children, i); assert(c && PySTEntry_Check(c)); ! if (!analyze_block((PySTEntryObject *)c, local, free)) goto error; } --- 479,483 ---- PyObject *c = PyList_GET_ITEM(ste->ste_children, i); assert(c && PySTEntry_Check(c)); ! if (!analyze_block((PySTEntryObject *)c, newbound, free)) goto error; } *************** *** 465,469 **** if (!analyze_cells(scope, free)) goto error; ! if (!update_symbols(ste->ste_symbols, scope)) goto error; success = 1; --- 485,489 ---- if (!analyze_cells(scope, free)) goto error; ! if (!update_symbols(ste->ste_symbols, scope, bound, free)) goto error; success = 1; From mondragon at users.sourceforge.net Sun Mar 21 15:55:49 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 16:05:53 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode_file.py, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22939/Lib/test Modified Files: test_unicode_file.py Log Message: Normalized files in test_unicode_file to eliminate failure on OSX Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_unicode_file.py 18 Jan 2004 20:29:55 -0000 1.13 --- test_unicode_file.py 21 Mar 2004 20:55:47 -0000 1.14 *************** *** 3,6 **** --- 3,7 ---- # that their names can be used with Unicode characters. import os, glob, time, shutil + import unicodedata import unittest *************** *** 39,43 **** # 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 --- 40,54 ---- # basename should appear in listdir. path, base = os.path.split(os.path.abspath(filename)) ! if (isinstance (filename, str)): ! new_base = base.decode(TESTFN_ENCODING) ! file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)] ! else: ! new_base = base ! file_list = os.listdir(path) ! ! new_base = unicodedata.normalize("NFD", new_base) ! file_list = [unicodedata.normalize("NFD", f) for f in file_list] ! ! self.failUnless(new_base in file_list) # Do as many "equivalancy' tests as we can - ie, check that although we *************** *** 92,96 **** os.unlink(filename1 + ".new") ! def _do_directory(self, make_name, chdir_name, getcwd_func): cwd = os.getcwd() if os.path.isdir(make_name): --- 103,107 ---- os.unlink(filename1 + ".new") ! def _do_directory(self, make_name, chdir_name, encoded): cwd = os.getcwd() if os.path.isdir(make_name): *************** *** 100,105 **** os.chdir(chdir_name) try: ! self.failUnlessEqual(os.path.basename(getcwd_func()), ! make_name) finally: os.chdir(cwd) --- 111,125 ---- os.chdir(chdir_name) try: ! if not encoded: ! cwd_result = os.getcwdu() ! name_result = make_name ! else: ! cwd_result = os.getcwd().decode(TESTFN_ENCODING) ! name_result = make_name.decode(TESTFN_ENCODING) ! ! cwd_result = unicodedata.normalize("NFD", cwd_result) ! name_result = unicodedata.normalize("NFD", name_result) ! ! self.failUnlessEqual(os.path.basename(cwd_result),name_result) finally: os.chdir(cwd) *************** *** 153,165 **** # (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. if TESTFN_UNICODE_UNENCODEABLE is not None: self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, TESTFN_UNICODE_UNENCODEABLE+ext, ! os.getcwdu) def test_main(): --- 173,185 ---- # (or unicode/encoded/unicode, etc ext = ".dir" ! self._do_directory(TESTFN_ENCODED+ext, TESTFN_ENCODED+ext, True) ! self._do_directory(TESTFN_ENCODED+ext, TESTFN_UNICODE+ext, True) ! self._do_directory(TESTFN_UNICODE+ext, TESTFN_ENCODED+ext, False) ! self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, False) # 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, ! False) def test_main(): From nnorwitz at users.sourceforge.net Sun Mar 21 16:19:36 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Mar 21 16:29:40 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.84, 1.1.2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28232/Python Modified Files: Tag: ast-branch newcompile.c Log Message: fix yield/returns outside of functions Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.84 retrieving revision 1.1.2.85 diff -C2 -d -r1.1.2.84 -r1.1.2.85 *** newcompile.c 21 Mar 2004 20:48:05 -0000 1.1.2.84 --- newcompile.c 21 Mar 2004 21:19:33 -0000 1.1.2.85 *************** *** 36,40 **** #: co_names doesn't contain locals, only globals, co_varnames may work #: ref leaks in interpreter when press return on empty line - #: yield or return outside a function don't raise a SyntaxError #: line numbers are off a bit (may just need to add calls to set lineno) In some cases, the line numbers for generated code aren't strictly --- 36,39 ---- *************** *** 108,111 **** --- 107,111 ---- int c_interactive; + int c_nestlevel; struct compiler_unit *u; *************** *** 234,237 **** --- 234,238 ---- flags->cf_flags = merged; c.c_flags = flags; + c.c_nestlevel = 0; /* Trivial test of marshal code for now. */ *************** *** 427,430 **** --- 428,432 ---- c->u = u; + c->c_nestlevel++; if (compiler_use_new_block(c) < 0) return 0; *************** *** 475,478 **** --- 477,481 ---- PyObject *wrapper; + c->c_nestlevel--; compiler_unit_free(c->u); /* Restore c->u to the parent unit. */ *************** *** 1515,1518 **** --- 1518,1523 ---- return compiler_class(c, s); case Return_kind: + if (c->c_nestlevel <= 1) + return compiler_error(c, "'return' outside function"); if (s->v.Return.value) VISIT(c, expr, s->v.Return.value) *************** *** 1522,1525 **** --- 1527,1532 ---- break; case Yield_kind: + if (c->c_nestlevel <= 1) + return compiler_error(c, "'yield' outside function"); VISIT(c, expr, s->v.Yield.value); ADDOP(c, YIELD_VALUE); From tim_one at users.sourceforge.net Sun Mar 21 16:35:43 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Mar 21 16:45:48 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.88,2.89 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31487/Objects Modified Files: tupleobject.c Log Message: PyTuple_New(): vrbl i no longer referenced, so removed it (which kills off a new compiler wng under MSVC6). Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -d -r2.88 -r2.89 *** tupleobject.c 21 Mar 2004 20:27:49 -0000 2.88 --- tupleobject.c 21 Mar 2004 21:35:41 -0000 2.89 *************** *** 28,32 **** { register PyTupleObject *op; ! int i; if (size < 0) { PyErr_BadInternalCall(); --- 28,32 ---- { register PyTupleObject *op; ! if (size < 0) { PyErr_BadInternalCall(); From akuchling at users.sourceforge.net Sun Mar 21 17:11:18 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 17:21:23 2004 Subject: [Python-checkins] python/nondist/peps pep-0320.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6545 Modified Files: pep-0320.txt Log Message: Update PEP 320 based on a meeting of python-dev'vers at PyCon. Index: pep-0320.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0320.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0320.txt 16 Jan 2004 15:58:37 -0000 1.8 --- pep-0320.txt 21 Mar 2004 22:11:15 -0000 1.9 *************** *** 18,27 **** 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. Release Manager ! TBD --- 18,37 ---- 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 for the first alpha is July 2004. + land generator expressions -- first week of May (this PEP seems to + be the largest potential source of upheaval, so it should go + in well before the alpha release). + alpha 1 -- second week of July 2004 + alpha 2 -- four weeks later + beta 1 -- TBD (perhaps August) depending on the number of bugs + in the alphas. + final -- September? This will depend on how the alphas and betas + go, and might be pushed back if several rounds of bugfixing are needed. + Release Manager ! Anthony Baxter *************** *** 48,52 **** or codec. ! A Decimal package for fixed precision arithmetic. Deprecate and/or remove the modules listed in PEP 4 (posixfile, --- 58,68 ---- or codec. ! PEP 318: Function/method decorator syntax ! ! PEP 327: A Decimal package for fixed precision arithmetic. ! ! PEP 328: Imports: Multi-line and Absolute/Relative. (Possibly ! the absolute/relative stuff is too controversial and will be ! pushed off to 2.4.) Deprecate and/or remove the modules listed in PEP 4 (posixfile, *************** *** 76,79 **** --- 92,98 ---- packages such as pyopenssl. + AST-based compiler: if this branch can land in the trunk by early + May, it can go in. Otherwise it can wait for a future release. + Ongoing tasks From akuchling at users.sourceforge.net Sun Mar 21 17:12:47 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 21 17:22:53 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.224,1.225 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6879 Modified Files: tut.tex Log Message: Remove 'now' Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.224 retrieving revision 1.225 diff -C2 -d -r1.224 -r1.225 *** tut.tex 24 Feb 2004 16:13:36 -0000 1.224 --- tut.tex 21 Mar 2004 22:12:45 -0000 1.225 *************** *** 4161,4165 **** There is limited support for class-private identifiers. Any identifier of the form \code{__spam} (at least two ! leading underscores, at most one trailing underscore) is now textually replaced with \code{_classname__spam}, where \code{classname} is the current class name with leading underscore(s) stripped. This mangling --- 4161,4165 ---- There is limited support for class-private identifiers. Any identifier of the form \code{__spam} (at least two ! leading underscores, at most one trailing underscore) is textually replaced with \code{_classname__spam}, where \code{classname} is the current class name with leading underscore(s) stripped. This mangling From bcannon at users.sourceforge.net Sun Mar 21 17:16:19 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Mar 21 17:26:25 2004 Subject: [Python-checkins] python/dist/src/Lib cgi.py,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7486/Lib Modified Files: cgi.py Log Message: Change parse_qsl() to accept control-name's with no equal sign (e.g., "name") when keep_blank_values is true. Index: cgi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** cgi.py 12 Feb 2004 17:35:06 -0000 1.77 --- cgi.py 21 Mar 2004 22:16:15 -0000 1.78 *************** *** 214,218 **** if strict_parsing: raise ValueError, "bad query field: %r" % (name_value,) ! continue if len(nv[1]) or keep_blank_values: name = urllib.unquote(nv[0].replace('+', ' ')) --- 214,222 ---- if strict_parsing: raise ValueError, "bad query field: %r" % (name_value,) ! # Handle case of a control-name with no equal sign ! if keep_blank_values: ! nv.append('') ! else: ! continue if len(nv[1]) or keep_blank_values: name = urllib.unquote(nv[0].replace('+', ' ')) From arigo at users.sourceforge.net Sun Mar 21 17:29:07 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Sun Mar 21 17:39:13 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.89,2.90 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10474 Modified Files: tupleobject.c Log Message: Restored revision 2.87. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -d -r2.89 -r2.90 *** tupleobject.c 21 Mar 2004 21:35:41 -0000 2.89 --- tupleobject.c 21 Mar 2004 22:29:05 -0000 2.90 *************** *** 28,32 **** { register PyTupleObject *op; ! if (size < 0) { PyErr_BadInternalCall(); --- 28,32 ---- { register PyTupleObject *op; ! int i; if (size < 0) { PyErr_BadInternalCall(); *************** *** 69,74 **** if (op == NULL) return NULL; - memset(op->ob_item, 0, size*sizeof(PyObject*)); } #if MAXSAVESIZE > 0 if (size == 0) { --- 69,75 ---- if (op == NULL) return NULL; } + for (i=0; i < size; i++) + op->ob_item[i] = NULL; #if MAXSAVESIZE > 0 if (size == 0) { *************** *** 165,168 **** --- 166,171 ---- if (len > 0) { i = len; + while (--i >= 0) + Py_XDECREF(op->ob_item[i]); #if MAXSAVESIZE > 0 if (len < MAXSAVESIZE && *************** *** 170,180 **** op->ob_type == &PyTuple_Type) { - while (--i >= 0) { - PyObject* o = op->ob_item[i]; - if (o != NULL) { - op->ob_item[i] = NULL; - Py_DECREF(o); - } - } op->ob_item[0] = (PyObject *) free_tuples[len]; num_free_tuples[len]++; --- 173,176 ---- *************** *** 182,189 **** goto done; /* return */ } - else #endif - while (--i >= 0) - Py_XDECREF(op->ob_item[i]); } op->ob_type->tp_free((PyObject *)op); --- 178,182 ---- From tim_one at users.sourceforge.net Sun Mar 21 18:38:43 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Mar 21 18:48:49 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py, 1.45, 1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24198/Lib/test Modified Files: test_datetime.py Log Message: SF bug 847019 datetime.datetime initialization needs more strict checking It's possible to create insane datetime objects by using the constructor "backdoor" inserted for fast unpickling. Doing extensive range checking would eliminate the backdoor's purpose (speed), but at least a little checking can stop honest mistakes. Bugfix candidate. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_datetime.py 27 Jun 2003 08:14:17 -0000 1.45 --- test_datetime.py 21 Mar 2004 23:38:41 -0000 1.46 *************** *** 1030,1033 **** --- 1030,1053 ---- self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) + def test_backdoor_resistance(self): + # For fast unpickling, the constructor accepts a pickle string. + # This is a low-overhead backdoor. A user can (by intent or + # mistake) pass a string directly, which (if it's the right length) + # will get treated like a pickle, and bypass the normal sanity + # checks in the constructor. This can create insane objects. + # The constructor doesn't want to burn the time to validate all + # fields, but does check the month field. This stops, e.g., + # datetime.datetime('1995-03-25') from yielding an insane object. + base = '1995-03-25' + if not issubclass(self.theclass, datetime): + base = base[:4] + for month_byte in '9', chr(0), chr(13), '\xff': + self.assertRaises(TypeError, self.theclass, + base[:2] + month_byte + base[3:]) + for ord_byte in range(1, 13): + # This shouldn't blow up because of the month byte alone. If + # the implementation changes to do more-careful checking, it may + # blow up because other fields are insane. + self.theclass(base[:2] + chr(ord_byte) + base[3:]) ############################################################################# From tim_one at users.sourceforge.net Sun Mar 21 18:38:59 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Mar 21 18:49:04 2004 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c, 1.70, 1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24198/Modules Modified Files: datetimemodule.c Log Message: SF bug 847019 datetime.datetime initialization needs more strict checking It's possible to create insane datetime objects by using the constructor "backdoor" inserted for fast unpickling. Doing extensive range checking would eliminate the backdoor's purpose (speed), but at least a little checking can stop honest mistakes. Bugfix candidate. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** datetimemodule.c 2 Mar 2004 04:38:10 -0000 1.70 --- datetimemodule.c 21 Mar 2004 23:38:41 -0000 1.71 *************** *** 81,84 **** --- 81,90 ---- #define HASTZINFO(p) (((_PyDateTime_BaseTZInfo *)(p))->hastzinfo) + /* M is a char or int claiming to be a valid month. The macro is equivalent + * to the two-sided Python test + * 1 <= M <= 12 + */ + #define MONTH_IS_SANE(M) ((unsigned int)(M) - 1 < 12) + /* Forward declarations. */ static PyTypeObject PyDateTime_DateType; *************** *** 2196,2200 **** if (PyTuple_GET_SIZE(args) == 1 && PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && ! PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE) { PyDateTime_Date *me; --- 2202,2207 ---- if (PyTuple_GET_SIZE(args) == 1 && PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && ! PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && ! MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_Date *me; *************** *** 3551,3555 **** PyTuple_GET_SIZE(args) <= 2 && PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && ! PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE) { PyDateTime_DateTime *me; --- 3558,3563 ---- PyTuple_GET_SIZE(args) <= 2 && PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && ! PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && ! MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_DateTime *me; From mondragon at users.sourceforge.net Sun Mar 21 18:45:44 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 18:55:51 2004 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.75,2.76 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26224/Modules Modified Files: selectmodule.c Log Message: Added configure check for broken poll() on some unix systems (MacOS X 10.3) Fixes SF Bug #850981 Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.75 retrieving revision 2.76 diff -C2 -d -r2.75 -r2.76 *** selectmodule.c 12 Oct 2003 19:09:37 -0000 2.75 --- selectmodule.c 21 Mar 2004 23:45:42 -0000 2.76 *************** *** 319,323 **** } ! #ifdef HAVE_POLL /* * poll() support --- 319,323 ---- } ! #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) /* * poll() support *************** *** 613,617 **** return (PyObject *)rv; } ! #endif /* HAVE_POLL */ PyDoc_STRVAR(select_doc, --- 613,617 ---- return (PyObject *)rv; } ! #endif /* HAVE_POLL && !HAVE_BROKEN_POLL */ PyDoc_STRVAR(select_doc, *************** *** 640,646 **** static PyMethodDef select_methods[] = { {"select", select_select, METH_VARARGS, select_doc}, ! #ifdef HAVE_POLL {"poll", select_poll, METH_VARARGS, poll_doc}, ! #endif /* HAVE_POLL */ {0, 0}, /* sentinel */ }; --- 640,646 ---- static PyMethodDef select_methods[] = { {"select", select_select, METH_VARARGS, select_doc}, ! #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) {"poll", select_poll, METH_VARARGS, poll_doc}, ! #endif /* HAVE_POLL && !HAVE_BROKEN_POLL */ {0, 0}, /* sentinel */ }; *************** *** 661,665 **** Py_INCREF(SelectError); PyModule_AddObject(m, "error", SelectError); ! #ifdef HAVE_POLL poll_Type.ob_type = &PyType_Type; PyModule_AddIntConstant(m, "POLLIN", POLLIN); --- 661,665 ---- Py_INCREF(SelectError); PyModule_AddObject(m, "error", SelectError); ! #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) poll_Type.ob_type = &PyType_Type; PyModule_AddIntConstant(m, "POLLIN", POLLIN); *************** *** 685,688 **** PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); #endif ! #endif /* HAVE_POLL */ } --- 685,688 ---- PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); #endif ! #endif /* HAVE_POLL && !HAVE_BROKEN_POLL */ } From mondragon at users.sourceforge.net Sun Mar 21 18:45:44 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Mar 21 18:55:55 2004 Subject: [Python-checkins] python/dist/src configure, 1.441, 1.442 configure.in, 1.452, 1.453 pyconfig.h.in, 1.95, 1.96 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26224 Modified Files: configure configure.in pyconfig.h.in Log Message: Added configure check for broken poll() on some unix systems (MacOS X 10.3) Fixes SF Bug #850981 Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.441 retrieving revision 1.442 diff -C2 -d -r1.441 -r1.442 *** configure 10 Feb 2004 16:50:15 -0000 1.441 --- configure 21 Mar 2004 23:45:39 -0000 1.442 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.451 . # 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.452 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. *************** *** 17578,17581 **** --- 17578,17653 ---- fi + echo "$as_me:$LINENO: checking for broken poll()" >&5 + echo $ECHO_N "checking for broken poll()... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + ac_cv_broken_poll=no + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + + #include + + int main (void) + { + struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; + + close (42); + + int poll_test = poll (&poll_struct, 1, 0); + + if (poll_test < 0) + { + exit(0); + } + else if (poll_test == 0 && poll_struct.revents != POLLNVAL) + { + exit(0); + } + else + { + exit(1); + } + } + + _ACEOF + rm -f conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_broken_poll=yes + else + echo "$as_me: program exited with status $ac_status" >&5 + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + ( exit $ac_status ) + ac_cv_broken_poll=no + fi + rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: $ac_cv_broken_poll" >&5 + echo "${ECHO_T}$ac_cv_broken_poll" >&6 + if test "$ac_cv_broken_poll" = yes + then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_BROKEN_POLL 1 + _ACEOF + + fi + + # tzset(3) exists and works like we expect it to echo "$as_me:$LINENO: checking for working tzset()" >&5 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.452 retrieving revision 1.453 diff -C2 -d -r1.452 -r1.453 *** configure.in 10 Feb 2004 16:50:18 -0000 1.452 --- configure.in 21 Mar 2004 23:45:41 -0000 1.453 *************** *** 2766,2769 **** --- 2766,2806 ---- fi + AC_MSG_CHECKING(for broken poll()) + AC_TRY_RUN([ + #include + + int main (void) + { + struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; + + close (42); + + int poll_test = poll (&poll_struct, 1, 0); + + if (poll_test < 0) + { + exit(0); + } + else if (poll_test == 0 && poll_struct.revents != POLLNVAL) + { + exit(0); + } + else + { + exit(1); + } + } + ], + ac_cv_broken_poll=yes, + ac_cv_broken_poll=no, + ac_cv_broken_poll=no) + AC_MSG_RESULT($ac_cv_broken_poll) + if test "$ac_cv_broken_poll" = yes + then + AC_DEFINE(HAVE_BROKEN_POLL, 1, + [Define if poll() sets errno on invalid file descriptors.]) + fi + + # tzset(3) exists and works like we expect it to AC_MSG_CHECKING(for working tzset()) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** pyconfig.h.in 10 Feb 2004 16:50:18 -0000 1.95 --- pyconfig.h.in 21 Mar 2004 23:45:42 -0000 1.96 *************** *** 47,50 **** --- 47,53 ---- #undef HAVE_BROKEN_NICE + /* Define if poll() sets errno on invalid file descriptors. */ + #undef HAVE_BROKEN_POLL + /* Define if the Posix semaphores do not work on your system */ #undef HAVE_BROKEN_POSIX_SEMAPHORES *************** *** 436,439 **** --- 439,448 ---- #undef HAVE_STDINT_H + /* Define to 1 if you have the header file. */ + #undef HAVE_STDLIB_H + + /* Define to 1 if you have the `strdup' function. */ + #undef HAVE_STRDUP + /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR *************** *** 445,448 **** --- 454,460 ---- #undef HAVE_STRINGS_H + /* Define to 1 if you have the header file. */ + #undef HAVE_STRING_H + /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H From anthonybaxter at users.sourceforge.net Sun Mar 21 19:33:30 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Sun Mar 21 19:43:40 2004 Subject: [Python-checkins] python/dist/src/Lib/email FeedParser.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2931 Added Files: FeedParser.py Log Message: New parser. Next up, making the current parser use this parser --- NEW FILE: FeedParser.py --- # A new Feed-style Parser from email import Errors, Message import re NLCRE = re.compile('\r\n|\r|\n') EMPTYSTRING = '' NL = '\n' NeedMoreData = object() class FeedableLumpOfText: "A file-like object that can have new data loaded into it" def __init__(self): self._partial = '' self._done = False # _pending is a list of lines, in reverse order self._pending = [] def readline(self): """ Return a line of data. If data has been pushed back with unreadline(), the most recently returned unreadline()d data will be returned. """ if not self._pending: if self._done: return '' return NeedMoreData return self._pending.pop() def unreadline(self, line): """ Push a line back into the object. """ self._pending.append(line) def peekline(self): """ Non-destructively look at the next line """ if not self._pending: if self._done: return '' return NeedMoreData return self._pending[-1] # for r in self._input.readuntil(regexp): # if r is NeedMoreData: # yield NeedMoreData # preamble, matchobj = r def readuntil(self, matchre, afterblank=False, includematch=False): """ Read a line at a time until we get the specified RE. Returns the text up to (and including, if includematch is true) the matched text, and the RE match object. If afterblank is true, there must be a blank line before the matched text. Moves current filepointer to the line following the matched line. If we reach end-of-file, return what we've got so far, and return None as the RE match object. """ prematch = [] blankseen = 0 while 1: if not self._pending: if self._done: # end of file yield EMPTYSTRING.join(prematch), None else: yield NeedMoreData continue line = self._pending.pop() if afterblank: if NLCRE.match(line): blankseen = 1 continue else: blankseen = 0 m = matchre.match(line) if (m and not afterblank) or (m and afterblank and blankseen): if includematch: prematch.append(line) yield EMPTYSTRING.join(prematch), m prematch.append(line) NLatend = re.compile('(\r\n|\r|\n)$').match NLCRE_crack = re.compile('(\r\n|\r|\n)') def push(self, data): """ Push some new data into this object """ # Handle any previous leftovers data, self._partial = self._partial+data, '' # Crack into lines, but leave the newlines on the end of each lines = self.NLCRE_crack.split(data) # The *ahem* interesting behaviour of re.split when supplied # groups means that the last element is the data after the # final RE. In the case of a NL/CR terminated string, this is # the empty string. self._partial = lines.pop() o = [] for i in range(len(lines) / 2): o.append(EMPTYSTRING.join([lines[i*2], lines[i*2+1]])) self.pushlines(o) def pushlines(self, lines): """ Push a list of new lines into the object """ # Reverse and insert at the front of _pending self._pending[:0] = lines[::-1] def end(self): """ There is no more data """ self._done = True def is_done(self): return self._done def __iter__(self): return self def next(self): l = self.readline() if l == '': raise StopIteration return l class FeedParser: "A feed-style parser of email. copy docstring here" def __init__(self, _class=Message.Message): "fnord fnord fnord" self._class = _class self._input = FeedableLumpOfText() self._root = None self._objectstack = [] self._parse = self._parsegen().next def end(self): self._input.end() self._call_parse() return self._root def feed(self, data): self._input.push(data) self._call_parse() def _call_parse(self): try: self._parse() except StopIteration: pass headerRE = re.compile(r'^(From |[-\w]{2,}:|[\t ])') def _parse_headers(self,headerlist): # Passed a list of strings that are the headers for the # current object lastheader = '' lastvalue = [] for lineno, line in enumerate(headerlist): # Check for continuation if line[0] in ' \t': if not lastheader: raise Errors.HeaderParseError('First line must not be a continuation') lastvalue.append(line) continue if lastheader: # XXX reconsider the joining of folded lines self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip() lastheader, lastvalue = '', [] # Check for Unix-From if line.startswith('From '): if lineno == 0: self._cur.set_unixfrom(line) continue elif lineno == len(headerlist) - 1: # Something looking like a unix-from at the end - it's # probably the first line of the body self._input.unreadline(line) return else: # Weirdly placed unix-from line. Ignore it. continue i = line.find(':') if i < 0: # The older parser had various special-cases here. We've # already handled them raise Errors.HeaderParseError( "Not a header, not a continuation: ``%s''" % line) lastheader = line[:i] lastvalue = [line[i+1:].lstrip()] if lastheader: # XXX reconsider the joining of folded lines self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip() def _parsegen(self): # Parse any currently available text self._new_sub_object() self._root = self._cur completing = False last = None for line in self._input: if line is NeedMoreData: yield None # Need More Data continue self._input.unreadline(line) if not completing: headers = [] # Now collect all headers. for line in self._input: if line is NeedMoreData: yield None # Need More Data continue if not self.headerRE.match(line): self._parse_headers(headers) # A message/rfc822 has no body and no internal # boundary. if self._cur.get_content_maintype() == "message": self._new_sub_object() completing = False headers = [] continue if line.strip(): # No blank line between headers and body. # Push this line back, it's the first line of # the body. self._input.unreadline(line) break else: headers.append(line) else: # We're done with the data and are still inside the headers self._parse_headers(headers) # Now we're dealing with the body boundary = self._cur.get_boundary() isdigest = (self._cur.get_content_type() == 'multipart/digest') if boundary and not self._cur._finishing: separator = '--' + boundary self._cur._boundaryRE = re.compile( r'(?P' + re.escape(separator) + r')(?P--)?(?P[ \t]*)(?P\r\n|\r|\n)$') for r in self._input.readuntil(self._cur._boundaryRE): if r is NeedMoreData: yield NeedMoreData else: preamble, matchobj = r break if not matchobj: # Broken - we hit the end of file. Just set the body # to the text. if completing: self._attach_trailer(last, preamble) else: self._attach_preamble(self._cur, preamble) # XXX move back to the parent container. self._pop_container() completing = True continue if preamble: if completing: preamble = preamble[:-len(matchobj.group('linesep'))] self._attach_trailer(last, preamble) else: self._attach_preamble(self._cur, preamble) elif not completing: # The module docs specify an empty preamble is None, not '' self._cur.preamble = None # If we _are_ completing, the last object gets no payload if matchobj.group('end'): # That was the end boundary tag. Bounce back to the # parent container last = self._pop_container() self._input.unreadline(matchobj.group('linesep')) completing = True continue # A number of MTAs produced by a nameless large company # we shall call "SicroMoft" produce repeated boundary # lines. while True: line = self._input.peekline() if line is NeedMoreData: yield None continue if self._cur._boundaryRE.match(line): self._input.readline() else: break self._new_sub_object() completing = False if isdigest: self._cur.set_default_type('message/rfc822') continue else: # non-multipart or after end-boundary if last is not self._root: last = self._pop_container() if self._cur.get_content_maintype() == "message": # We double-pop to leave the RFC822 object self._pop_container() completing = True elif self._cur._boundaryRE and last <> self._root: completing = True else: # Non-multipart top level, or in the trailer of the # top level multipart while not self._input.is_done(): yield None data = list(self._input) body = EMPTYSTRING.join(data) self._attach_trailer(last, body) def _attach_trailer(self, obj, trailer): #import pdb ; pdb.set_trace() if obj.get_content_maintype() in ( "multipart", "message" ): obj.epilogue = trailer else: obj.set_payload(trailer) def _attach_preamble(self, obj, trailer): if obj.get_content_maintype() in ( "multipart", "message" ): obj.preamble = trailer else: obj.set_payload(trailer) def _new_sub_object(self): new = self._class() #print "pushing", self._objectstack, repr(new) if self._objectstack: self._objectstack[-1].attach(new) self._objectstack.append(new) new._boundaryRE = None new._finishing = False self._cur = new def _pop_container(self): # Move the pointer to the container of the current object. # Returns the (old) current object #import pdb ; pdb.set_trace() #print "popping", self._objectstack last = self._objectstack.pop() if self._objectstack: self._cur = self._objectstack[-1] else: self._cur._finishing = True return last From pje at users.sourceforge.net Sun Mar 21 20:12:33 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun Mar 21 20:22:42 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools dist.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10308/setuptools Modified Files: dist.py Log Message: Compute command line that should be passed to child setup scripts. Warn user if unsupported options are supplied, and cancel unless 'depends -i' (aka '--ignore-extra-args') was used. Index: dist.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/dist.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dist.py 20 Mar 2004 20:52:11 -0000 1.2 --- dist.py 22 Mar 2004 01:12:31 -0000 1.3 *************** *** 286,289 **** --- 286,330 ---- + def get_cmdline_options(self): + """Return a '{cmd: {opt:val}}' map of all command-line options + + Option names are all long, but do not include the leading '--', and + contain dashes rather than underscores. If the option doesn't take + an argument (e.g. '--quiet'), the 'val' is 'None'. + + Note that options provided by config files are intentionally excluded. + """ + + d = {} + + for cmd,opts in self.command_options.items(): + + for opt,(src,val) in opts.items(): + + if src != "command line": + continue + + opt = opt.replace('_','-') + + if val==0: + cmdobj = self.get_command_obj(cmd) + neg_opt = self.negative_opt.copy() + neg_opt.update(getattr(cmdobj,'negative_opt',{})) + for neg,pos in neg_opt.items(): + if pos==opt: + opt=neg + val=None + break + else: + raise AssertionError("Shouldn't be able to get here") + + elif val==1: + val = None + + d.setdefault(cmd,{})[opt] = val + + return d + + class Feature: """A subset of the distribution that can be excluded if unneeded/wanted From pje at users.sourceforge.net Sun Mar 21 20:12:33 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun Mar 21 20:22:47 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools TODO.txt, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10308 Modified Files: TODO.txt Log Message: Compute command line that should be passed to child setup scripts. Warn user if unsupported options are supplied, and cancel unless 'depends -i' (aka '--ignore-extra-args') was used. Index: TODO.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/TODO.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TODO.txt 20 Mar 2004 20:52:11 -0000 1.2 --- TODO.txt 22 Mar 2004 01:12:30 -0000 1.3 *************** *** 5,10 **** * install_deps command (install runtime dependencies) - * compute child command line, abort if user specified incompatible options - * OPEN ISSUE: should parent install command include child install's files? --- 5,8 ---- From pje at users.sourceforge.net Sun Mar 21 20:12:33 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun Mar 21 20:22:50 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/command depends.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10308/setuptools/command Modified Files: depends.py Log Message: Compute command line that should be passed to child setup scripts. Warn user if unsupported options are supplied, and cancel unless 'depends -i' (aka '--ignore-extra-args') was used. Index: depends.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/depends.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** depends.py 20 Mar 2004 20:52:11 -0000 1.2 --- depends.py 22 Mar 2004 01:12:31 -0000 1.3 *************** *** 23,33 **** ] def initialize_options(self): ! self.temp = None def finalize_options(self): self.set_undefined_options('build',('build_temp', 'temp')) self.set_search_path() def set_search_path(self): --- 23,74 ---- ] + # Command options that can be safely passed to dependencies' setup scripts + safe_opts = { + 'install': [ + 'prefix','exec-prefix','home','install-base','install-platbase', + 'root','optimize','force','verbose','quiet' + ], + 'build': ['compiler','debug','force','verbose','quiet'], + } + + # Options with string arguments that are *not* directories or files, and + # so should *not* have absolute-path fixups applied. + non_fs_opts = {'build':['compiler'] } + def initialize_options(self): ! self.temp = None; self.ignore_extra_args = None def finalize_options(self): self.set_undefined_options('build',('build_temp', 'temp')) self.set_search_path() + self.set_subcommand_args() + + def set_subcommand_args(self): + safe = {'install':[]} # ensure we at least perform an install + unsafe = {} + copts = self.distribution.get_cmdline_options() + + if 'depends' in copts: + del copts['depends'] + + for cmd,opts in copts.items(): + safe_opts = self.safe_opts.get(cmd,()) + non_fs_opts = self.non_fs_opts.get(cmd,()) + + for opt,val in opts.items(): + if opt in safe_opts: + cmdline = safe.setdefault(cmd,[]) + if val is not None and opt not in non_fs_opts: + val = os.path.abspath(val) + else: + cmdline = unsafe.setdefault(cmd,[]) + + cmdline.append('--'+opt) + if val is not None: + cmdline.append(val) + + self.safe_options = safe + self.unsafe_options = unsafe def set_search_path(self): *************** *** 42,60 **** def run(self): self.announce("checking for installed dependencies") needed = [ dep for dep in self.distribution.requires if self.is_needed(dep) ] if not needed: self.announce("all dependencies are present and up-to-date") return # Alert the user to missing items fmt = "\t%s\t%s\n" items = [fmt % (dep.full_name(),dep.homepage) for dep in needed] ! items.insert(0,"Please install the following packages first:\n") items.append('') raise SystemExit('\n'.join(items)) # dump msg to stderr and exit def is_needed(self,dep): """Does the specified dependency need to be installed/updated?""" --- 83,135 ---- def run(self): self.announce("checking for installed dependencies") + needed = [ dep for dep in self.distribution.requires if self.is_needed(dep) ] + if not needed: self.announce("all dependencies are present and up-to-date") return + argv = [sys.executable,'setup.py'] + for cmd,line in self.safe_options.items(): + argv.append(cmd); argv.extend(line) + + self.announce( + "dependencies will be installed using:\n "+' '.join(argv)+'\n' + ) + + # Alert for unsupported commands/options, unless '-i' was used + if self.unsafe_options: + self.warn_unsafe_options_used() + if not self.ignore_extra_args: + raise SystemExit( + "Unsupported options for building dependencies; please" + " add 'depends -i'\nto your command line if you want to" + " force the build to proceed.\nOtherwise, you will need" + " to omit the unsupported options,\nor install the" + " dependencies manually." + ) + + # Alert the user to missing items fmt = "\t%s\t%s\n" items = [fmt % (dep.full_name(),dep.homepage) for dep in needed] ! items.insert(0,"Please install the following packages *first*:\n") items.append('') raise SystemExit('\n'.join(items)) # dump msg to stderr and exit + + def warn_unsafe_options_used(self): + lines = []; write = lines.append + write("the following command options are not supported for building") + write("dependencies, and will be IGNORED:") + for cmd,line in self.unsafe_options.items(): + write('\t%s %s' % (cmd,' '.join(line))) + write('') + self.warn('\n'.join(lines)) + + def is_needed(self,dep): """Does the specified dependency need to be installed/updated?""" *************** *** 81,82 **** --- 156,164 ---- + + + + + + + From pje at users.sourceforge.net Sun Mar 21 20:12:34 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun Mar 21 20:22:53 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests __init__.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10308/setuptools/tests Modified Files: __init__.py Log Message: Compute command line that should be passed to child setup scripts. Warn user if unsupported options are supplied, and cancel unless 'depends -i' (aka '--ignore-extra-args') was used. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 20 Mar 2004 20:52:12 -0000 1.2 --- __init__.py 22 Mar 2004 01:12:31 -0000 1.3 *************** *** 128,132 **** dist = makeSetup( extra_path='spam', ! script_args=['install','--install-lib',path1] ) --- 128,135 ---- dist = makeSetup( extra_path='spam', ! script_args=[ ! 'install','--install-lib',path1, '--prefix',path2, ! 'build','--compiler=mingw32', ! ] ) *************** *** 137,150 **** self.assertEqual(cmd.search_path, [path2,path1]+sys.path) ! ! ! ! ! ! ! ! ! ! --- 140,150 ---- self.assertEqual(cmd.search_path, [path2,path1]+sys.path) ! self.assertEqual(cmd.unsafe_options, ! {'install':['--install-lib',path1]} ! ) ! self.assertEqual(cmd.safe_options, { ! 'build':['--compiler','mingw32'], ! 'install':['--prefix',os.path.abspath(path2)] ! }) *************** *** 173,176 **** --- 173,180 ---- py_modules=['b.d','x'], ext_modules = (self.e1, self.e2), + script_args = [ + 'build', '-q', 'build_ext', '-i', + 'install', '--prefix=/usr/lib', '--install-lib','/test' + ], package_dir = {}, ) *************** *** 200,207 **** - - - - def testIncludeExclude(self): # remove an extension --- 204,207 ---- *************** *** 272,281 **** ) ! ! ! ! ! ! --- 272,281 ---- ) ! def testCmdLineOpts(self): ! self.assertEqual(self.dist.get_cmdline_options(), ! { 'install':{'prefix':'/usr/lib', 'install-lib':'/test'}, ! 'build': {'quiet':None}, 'build_ext':{'inplace':None}, ! } ! ) From perky at users.sourceforge.net Mon Mar 22 03:43:57 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Mar 22 03:54:07 2004 Subject: [Python-checkins] python/dist/src/Include pyport.h,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19398/Include Modified Files: pyport.h Log Message: Patch #871657: Set EDOM for `nan' return values on FreeBSD and OpenBSD. This fixes a problem that math.sqrt(-1) doesn't raise math.error. Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** pyport.h 10 Feb 2004 16:50:18 -0000 2.66 --- pyport.h 22 Mar 2004 08:43:55 -0000 2.67 *************** *** 274,292 **** #endif ! /* Py_SET_ERANGE_ON_OVERFLOW(x) * If a libm function did not set errno, but it looks like the result ! * overflowed, set errno to ERANGE. Set errno to 0 before calling a libm ! * function, and invoke this macro after, passing the function result. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ ! #define Py_SET_ERANGE_IF_OVERFLOW(X) \ do { \ ! if (errno == 0 && ((X) == Py_HUGE_VAL || \ ! (X) == -Py_HUGE_VAL)) \ ! errno = ERANGE; \ } while(0) /* Py_ADJUST_ERANGE1(x) * Py_ADJUST_ERANGE2(x, y) --- 274,305 ---- #endif ! /* Py_SET_ERRNO_ON_MATH_ERROR(x) * If a libm function did not set errno, but it looks like the result ! * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno ! * to 0 before calling a libm function, and invoke this macro after, ! * passing the function result. * Caution: * This isn't reliable. See Py_OVERFLOWED comments. * X is evaluated more than once. */ ! #if defined(__FreeBSD__) || defined(__OpenBSD__) ! #define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; ! #else ! #define _Py_SET_EDOM_FOR_NAN(X) ; ! #endif ! #define Py_SET_ERRNO_ON_MATH_ERROR(X) \ do { \ ! if (errno == 0) { \ ! if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ ! errno = ERANGE; \ ! else _Py_SET_EDOM_FOR_NAN(X) \ ! } \ } while(0) + /* Py_SET_ERANGE_ON_OVERFLOW(x) + * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. + */ + #define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) + /* Py_ADJUST_ERANGE1(x) * Py_ADJUST_ERANGE2(x, y) From perky at users.sourceforge.net Mon Mar 22 03:43:57 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Mar 22 03:54:10 2004 Subject: [Python-checkins] python/dist/src/Modules mathmodule.c,2.73,2.74 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19398/Modules Modified Files: mathmodule.c Log Message: Patch #871657: Set EDOM for `nan' return values on FreeBSD and OpenBSD. This fixes a problem that math.sqrt(-1) doesn't raise math.error. Index: mathmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mathmodule.c,v retrieving revision 2.73 retrieving revision 2.74 diff -C2 -d -r2.73 -r2.74 *** mathmodule.c 19 Nov 2003 15:24:46 -0000 2.73 --- mathmodule.c 22 Mar 2004 08:43:55 -0000 2.74 *************** *** 58,62 **** x = (*func)(x); PyFPE_END_PROTECT(x) ! Py_SET_ERANGE_IF_OVERFLOW(x); if (errno && is_error(x)) return NULL; --- 58,62 ---- x = (*func)(x); PyFPE_END_PROTECT(x) ! Py_SET_ERRNO_ON_MATH_ERROR(x); if (errno && is_error(x)) return NULL; *************** *** 75,79 **** x = (*func)(x, y); PyFPE_END_PROTECT(x) ! Py_SET_ERANGE_IF_OVERFLOW(x); if (errno && is_error(x)) return NULL; --- 75,79 ---- x = (*func)(x, y); PyFPE_END_PROTECT(x) ! Py_SET_ERRNO_ON_MATH_ERROR(x); if (errno && is_error(x)) return NULL; *************** *** 144,148 **** errno = 0; x = frexp(x, &i); ! Py_SET_ERANGE_IF_OVERFLOW(x); if (errno && is_error(x)) return NULL; --- 144,148 ---- errno = 0; x = frexp(x, &i); ! Py_SET_ERRNO_ON_MATH_ERROR(x); if (errno && is_error(x)) return NULL; *************** *** 169,173 **** x = ldexp(x, exp); PyFPE_END_PROTECT(x) ! Py_SET_ERANGE_IF_OVERFLOW(x); if (errno && is_error(x)) return NULL; --- 169,173 ---- x = ldexp(x, exp); PyFPE_END_PROTECT(x) ! Py_SET_ERRNO_ON_MATH_ERROR(x); if (errno && is_error(x)) return NULL; *************** *** 187,191 **** errno = 0; x = modf(x, &y); ! Py_SET_ERANGE_IF_OVERFLOW(x); if (errno && is_error(x)) return NULL; --- 187,191 ---- errno = 0; x = modf(x, &y); ! Py_SET_ERRNO_ON_MATH_ERROR(x); if (errno && is_error(x)) return NULL; From arigo at users.sourceforge.net Mon Mar 22 12:52:56 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon Mar 22 13:03:18 2004 Subject: [Python-checkins] python/dist/src/Python compile.c,2.300,2.301 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13591 Modified Files: compile.c Log Message: Fix for line events in the case: def f(a): if a: print 5 else: pass Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.300 retrieving revision 2.301 diff -C2 -d -r2.300 -r2.301 *** compile.c 21 Mar 2004 15:12:00 -0000 2.300 --- compile.c 22 Mar 2004 17:52:53 -0000 2.301 *************** *** 630,634 **** int c_firstlineno; PyObject *c_lnotab; /* Table mapping address to line number */ ! int c_last_addr, c_last_line, c_lnotab_next; char *c_private; /* for private name mangling */ int c_tmpname; /* temporary local name counter */ --- 630,637 ---- int c_firstlineno; PyObject *c_lnotab; /* Table mapping address to line number */ ! int c_last_addr; /* last op addr seen and recorded in lnotab */ ! int c_last_line; /* last line seen and recorded in lnotab */ ! int c_lnotab_next; /* current length of lnotab */ ! int c_lnotab_last; /* start of last lnotab record added */ char *c_private; /* for private name mangling */ int c_tmpname; /* temporary local name counter */ *************** *** 849,852 **** --- 852,856 ---- c->c_last_line = 0; c->c_lnotab_next = 0; + c->c_lnotab_last = 0; c->c_tmpname = 0; c->c_nested = 0; *************** *** 965,968 **** --- 969,973 ---- int incr_addr = c->c_nexti - c->c_last_addr; int incr_line = lineno - c->c_last_line; + c->c_lnotab_last = c->c_lnotab_next; while (incr_addr > 255) { com_add_lnotab(c, 255, 0); *************** *** 982,985 **** --- 987,1011 ---- static void + com_strip_lnotab(struct compiling *c) + { + /* strip the last lnotab entry if no opcode were emitted. + * This prevents a line number to be generated on a final + * pass, like in the following example: + * + * if a: + * print 5 + * else: + * pass + * + * Without the fix, a line trace event would be generated + * on the pass even if a is true (because of the implicit + * return). + */ + if (c->c_nexti == c->c_last_addr && c->c_lnotab_last > 0) { + c->c_lnotab_next = c->c_lnotab_last; + } + } + + static void com_addoparg(struct compiling *c, int op, int arg) { *************** *** 4168,4171 **** --- 4194,4198 ---- com_node(c, CHILD(n, 4)); c->c_infunction = 0; + com_strip_lnotab(c); com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); com_push(c, 1); *************** *** 4219,4222 **** --- 4246,4250 ---- (void) com_addconst(c, Py_None); com_node(c, ch); + com_strip_lnotab(c); com_addbyte(c, LOAD_LOCALS); com_push(c, 1); *************** *** 4238,4241 **** --- 4266,4270 ---- if (TYPE(n) != NEWLINE) com_node(c, n); + com_strip_lnotab(c); com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); com_push(c, 1); *************** *** 4247,4250 **** --- 4276,4280 ---- case file_input: /* A whole file, or built-in function exec() */ com_file_input(c, n); + com_strip_lnotab(c); com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); com_push(c, 1); From mondragon at users.sourceforge.net Mon Mar 22 13:30:44 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 13:41:04 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21907/Lib/test Modified Files: test_trace.py Log Message: Test for lack of implicit return line event Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_trace.py 1 May 2003 17:45:52 -0000 1.9 --- test_trace.py 22 Mar 2004 18:30:42 -0000 1.10 *************** *** 126,129 **** --- 126,145 ---- (4, 'return')] + # implicit return example + def ireturn_example(): + a = 5 + b = 5 + if a == b: + b = a+1 + else: + pass + + ireturn_example.events = [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (4, 'return')] + class Tracer: def __init__(self): *************** *** 158,180 **** tracer.events, func.events) ! def test_1_basic(self): self.run_test(basic) ! def test_2_arigo(self): self.run_test(arigo_example) ! def test_3_one_instr(self): self.run_test(one_instr_line) ! def test_4_no_pop_blocks(self): self.run_test(no_pop_blocks) ! def test_5_no_pop_tops(self): self.run_test(no_pop_tops) ! def test_6_call(self): self.run_test(call) ! def test_7_raise(self): self.run_test(test_raise) ! def test_8_settrace_and_return(self): self.run_test2(settrace_and_return) ! def test_9_settrace_and_raise(self): self.run_test2(settrace_and_raise) class RaisingTraceFuncTestCase(unittest.TestCase): --- 174,198 ---- tracer.events, func.events) ! def test_01_basic(self): self.run_test(basic) ! def test_02_arigo(self): self.run_test(arigo_example) ! def test_03_one_instr(self): self.run_test(one_instr_line) ! def test_04_no_pop_blocks(self): self.run_test(no_pop_blocks) ! def test_05_no_pop_tops(self): self.run_test(no_pop_tops) ! def test_06_call(self): self.run_test(call) ! def test_07_raise(self): self.run_test(test_raise) ! def test_08_settrace_and_return(self): self.run_test2(settrace_and_return) ! def test_09_settrace_and_raise(self): self.run_test2(settrace_and_raise) + def test_10_ireturn(self): + self.run_test(ireturn_example) class RaisingTraceFuncTestCase(unittest.TestCase): From mondragon at users.sourceforge.net Mon Mar 22 14:21:49 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 14:32:03 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv667 Modified Files: test_trace.py Log Message: Test for tight loop line event fix, SF bug #765624 Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_trace.py 22 Mar 2004 18:30:42 -0000 1.10 --- test_trace.py 22 Mar 2004 19:21:47 -0000 1.11 *************** *** 142,145 **** --- 142,168 ---- (4, 'return')] + # Tight loop with while(1) example (SF #765624) + def tightloop_example(): + items = range(0, 3) + try: + i = 0 + while 1: + print items[i]; i+=1 + except IndexError: + pass + + tightloop_example.events = [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (5, 'line'), + (5, 'line'), + (5, 'exception'), + (6, 'line'), + (7, 'line'), + (7, 'return')] + class Tracer: def __init__(self): *************** *** 195,198 **** --- 218,223 ---- def test_10_ireturn(self): self.run_test(ireturn_example) + def test_11_tightloop(self): + self.run_test(tightloop_example) class RaisingTraceFuncTestCase(unittest.TestCase): From mondragon at users.sourceforge.net Mon Mar 22 14:23:49 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 14:34:02 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1179 Modified Files: test_trace.py Log Message: Fix (really) for tight loop line events Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_trace.py 22 Mar 2004 19:21:47 -0000 1.11 --- test_trace.py 22 Mar 2004 19:23:46 -0000 1.12 *************** *** 148,152 **** i = 0 while 1: ! print items[i]; i+=1 except IndexError: pass --- 148,152 ---- i = 0 while 1: ! b = items[i]; i+=1 except IndexError: pass *************** *** 160,163 **** --- 160,164 ---- (5, 'line'), (5, 'line'), + (5, 'line'), (5, 'exception'), (6, 'line'), From arigo at users.sourceforge.net Mon Mar 22 14:25:01 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon Mar 22 14:35:16 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.385,2.386 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1426/Python Modified Files: ceval.c Log Message: Fix SF bug #765624. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.385 retrieving revision 2.386 diff -C2 -d -r2.385 -r2.386 *** ceval.c 20 Mar 2004 21:50:13 -0000 2.385 --- ceval.c 22 Mar 2004 19:24:58 -0000 2.386 *************** *** 49,53 **** static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, ! PyFrameObject *, int *, int *); static PyObject *apply_slice(PyObject *, PyObject *, PyObject *); --- 49,53 ---- static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, ! PyFrameObject *, int *, int *, int *); static PyObject *apply_slice(PyObject *, PyObject *, PyObject *); *************** *** 603,607 **** initial values are such as to make this false the first time it is tested. */ ! int instr_ub = -1, instr_lb = 0; unsigned char *first_instr; --- 603,607 ---- initial values are such as to make this false the first time it is tested. */ ! int instr_ub = -1, instr_lb = 0, instr_prev = -1; unsigned char *first_instr; *************** *** 847,851 **** err = maybe_call_line_trace(tstate->c_tracefunc, tstate->c_traceobj, ! f, &instr_lb, &instr_ub); /* Reload possibly changed frame fields */ JUMPTO(f->f_lasti); --- 847,852 ---- err = maybe_call_line_trace(tstate->c_tracefunc, tstate->c_traceobj, ! f, &instr_lb, &instr_ub, ! &instr_prev); /* Reload possibly changed frame fields */ JUMPTO(f->f_lasti); *************** *** 3086,3090 **** static int maybe_call_line_trace(Py_tracefunc func, PyObject *obj, ! PyFrameObject *frame, int *instr_lb, int *instr_ub) { /* The theory of SET_LINENO-less tracing. --- 3087,3092 ---- static int maybe_call_line_trace(Py_tracefunc func, PyObject *obj, ! PyFrameObject *frame, int *instr_lb, int *instr_ub, ! int *instr_prev) { /* The theory of SET_LINENO-less tracing. *************** *** 3210,3214 **** } } ! return result; } --- 3212,3221 ---- } } ! else if (frame->f_lasti <= *instr_prev) { ! /* jumping back in the same line forces a trace event */ ! result = call_trace(func, obj, frame, ! PyTrace_LINE, Py_None); ! } ! *instr_prev = frame->f_lasti; return result; } From arigo at users.sourceforge.net Mon Mar 22 14:30:41 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon Mar 22 14:40:56 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2636 Modified Files: test_trace.py Log Message: The fix in ceval.c 2.386 allows iteration-by-iteration line tracing even in single-line loops. Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_trace.py 22 Mar 2004 19:23:46 -0000 1.12 --- test_trace.py 22 Mar 2004 19:30:39 -0000 1.13 *************** *** 166,169 **** --- 166,190 ---- (7, 'return')] + def tighterloop_example(): + items = range(1, 4) + try: + i = 0 + while 1: i = items[i] + except IndexError: + pass + + tighterloop_example.events = [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (4, 'line'), + (4, 'line'), + (4, 'line'), + (4, 'exception'), + (5, 'line'), + (6, 'line'), + (6, 'return')] + class Tracer: def __init__(self): *************** *** 221,224 **** --- 242,247 ---- def test_11_tightloop(self): self.run_test(tightloop_example) + def test_12_tighterloop(self): + self.run_test(tighterloop_example) class RaisingTraceFuncTestCase(unittest.TestCase): From mondragon at users.sourceforge.net Mon Mar 22 15:12:58 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:23:21 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_profile, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12193/Lib/test/output Modified Files: test_profile Log Message: Added global runctx function to profile to fix SF Bug #716587 Index: test_profile =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_profile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_profile 4 Oct 2001 00:58:24 -0000 1.1 --- test_profile 22 Mar 2004 20:12:55 -0000 1.2 *************** *** 8,17 **** 0 0.000 0.000 profile:0(profiler) 1 0.000 0.000 1.000 1.000 profile:0(testfunc()) ! 1 0.400 0.400 1.000 1.000 test_profile.py:21(testfunc) ! 2 0.080 0.040 0.600 0.300 test_profile.py:30(helper) ! 4 0.116 0.029 0.120 0.030 test_profile.py:48(helper1) ! 8 0.312 0.039 0.400 0.050 test_profile.py:56(helper2) ! 8 0.064 0.008 0.080 0.010 test_profile.py:66(subhelper) ! 28 0.028 0.001 0.028 0.001 test_profile.py:78(__getattr__) --- 8,17 ---- 0 0.000 0.000 profile:0(profiler) 1 0.000 0.000 1.000 1.000 profile:0(testfunc()) ! 1 0.400 0.400 1.000 1.000 test_profile.py:23(testfunc) ! 2 0.080 0.040 0.600 0.300 test_profile.py:32(helper) ! 4 0.116 0.029 0.120 0.030 test_profile.py:50(helper1) ! 8 0.312 0.039 0.400 0.050 test_profile.py:58(helper2) ! 8 0.064 0.008 0.080 0.010 test_profile.py:68(subhelper) ! 28 0.028 0.001 0.028 0.001 test_profile.py:80(__getattr__) From mondragon at users.sourceforge.net Mon Mar 22 15:12:57 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:23:25 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_profile.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12193/Lib/test Modified Files: test_profile.py Log Message: Added global runctx function to profile to fix SF Bug #716587 Index: test_profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profile.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_profile.py 4 Oct 2001 05:36:56 -0000 1.2 --- test_profile.py 22 Mar 2004 20:12:55 -0000 1.3 *************** *** 2,5 **** --- 2,7 ---- import profile + import os + from test.test_support import TESTFN, vereq # In order to have reproducible time, we simulate a timer in the global *************** *** 83,86 **** --- 85,100 ---- raise AttributeError + + def test_2(): + d = globals().copy() + def testfunc(): + global x + x = 1 + d['testfunc'] = testfunc + profile.runctx("testfunc()", d, d, TESTFN) + vereq (x, 1) + os.unlink (TESTFN) + if __name__ == "__main__": test_main() + test_2() From mondragon at users.sourceforge.net Mon Mar 22 15:12:57 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:23:28 2004 Subject: [Python-checkins] python/dist/src/Lib profile.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12193/Lib Modified Files: profile.py Log Message: Added global runctx function to profile to fix SF Bug #716587 Index: profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** profile.py 12 Feb 2004 17:35:07 -0000 1.51 --- profile.py 22 Mar 2004 20:12:55 -0000 1.52 *************** *** 77,80 **** --- 77,97 ---- return prof.print_stats() + def runctx(statement, globals, locals, filename=None): + """Run statement under profiler, supplying your own globals and locals, + optionally saving results in filename. + + statement and filename have the same semantics as profile.run + """ + prof = Profile() + try: + prof = prof.runctx(statement, globals, locals) + except SystemExit: + pass + + if filename is not None: + prof.dump_stats(filename) + else: + return prof.print_stats() + # print help def help(): From mondragon at users.sourceforge.net Mon Mar 22 15:12:59 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:23:31 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.957,1.958 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12193/Misc Modified Files: NEWS Log Message: Added global runctx function to profile to fix SF Bug #716587 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.957 retrieving revision 1.958 diff -C2 -d -r1.957 -r1.958 *** NEWS 21 Mar 2004 20:24:07 -0000 1.957 --- NEWS 22 Mar 2004 20:12:56 -0000 1.958 *************** *** 291,294 **** --- 291,296 ---- ------- + - Added global runctx function to profile module + - Add hlist missing entryconfigure and entrycget methods. From mondragon at users.sourceforge.net Mon Mar 22 15:13:27 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:23:41 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libprofile.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12193/Doc/lib Modified Files: libprofile.tex Log Message: Added global runctx function to profile to fix SF Bug #716587 Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** libprofile.tex 20 Oct 2003 14:01:46 -0000 1.43 --- libprofile.tex 22 Mar 2004 20:12:54 -0000 1.44 *************** *** 276,280 **** code for these modules. ! \begin{funcdesc}{run}{string\optional{, filename\optional{, ...}}} This function takes a single argument that has can be passed to the --- 276,280 ---- code for these modules. ! \begin{funcdesc}{run}{command\optional{, filename}} This function takes a single argument that has can be passed to the *************** *** 340,343 **** --- 340,349 ---- \end{funcdesc} + \begin{funcdesc}{runctx}{command, globals, locals\optional{, filename}} + This function is similar to \function{profile.run()}, with added + arguments to supply the globals and locals dictionaries for the + \var{command} string. + \end{funcdesc} + Analysis of the profiler data is done using this class from the \module{pstats} module: From arigo at users.sourceforge.net Mon Mar 22 15:17:01 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon Mar 22 15:27:16 2004 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.203,2.204 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13597/Python Modified Files: pythonrun.c Log Message: Lost reference. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.203 retrieving revision 2.204 diff -C2 -d -r2.203 -r2.204 *** pythonrun.c 10 Feb 2004 16:50:20 -0000 2.203 --- pythonrun.c 22 Mar 2004 20:16:58 -0000 2.204 *************** *** 1087,1092 **** { int err = 0; - PyObject *v = value; PyObject *f = PySys_GetObject("stderr"); if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); --- 1087,1092 ---- { int err = 0; PyObject *f = PySys_GetObject("stderr"); + Py_INCREF(value); if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); *************** *** 1098,1107 **** err = PyTraceBack_Print(tb, f); if (err == 0 && ! PyObject_HasAttrString(v, "print_file_and_line")) { PyObject *message; const char *filename, *text; int lineno, offset; ! if (!parse_syntax_error(v, &message, &filename, &lineno, &offset, &text)) PyErr_Clear(); --- 1098,1107 ---- err = PyTraceBack_Print(tb, f); if (err == 0 && ! PyObject_HasAttrString(value, "print_file_and_line")) { PyObject *message; const char *filename, *text; int lineno, offset; ! if (!parse_syntax_error(value, &message, &filename, &lineno, &offset, &text)) PyErr_Clear(); *************** *** 1119,1123 **** if (text != NULL) print_error_text(f, offset, text); ! v = message; /* Can't be bothered to check all those PyFile_WriteString() calls */ --- 1119,1124 ---- if (text != NULL) print_error_text(f, offset, text); ! Py_DECREF(value); ! value = message; /* Can't be bothered to check all those PyFile_WriteString() calls */ *************** *** 1156,1161 **** err = PyFile_WriteObject(exception, f, Py_PRINT_RAW); if (err == 0) { ! if (v != NULL && v != Py_None) { ! PyObject *s = PyObject_Str(v); /* only print colon if the str() of the object is not the empty string --- 1157,1162 ---- err = PyFile_WriteObject(exception, f, Py_PRINT_RAW); if (err == 0) { ! if (value != Py_None) { ! PyObject *s = PyObject_Str(value); /* only print colon if the str() of the object is not the empty string *************** *** 1174,1177 **** --- 1175,1179 ---- err = PyFile_WriteString("\n", f); } + Py_DECREF(value); /* If an error happened here, don't show it. XXX This is wrong, but too many callers rely on this behavior. */ From mondragon at users.sourceforge.net Mon Mar 22 15:20:35 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:30:50 2004 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c, 2.73, 2.73.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14693/Modules Modified Files: Tag: release23-maint selectmodule.c Log Message: Added check for broken poll on OSes where it exists but sets errno for bad file descriptor. Fixes SF Bug #850981 Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.73 retrieving revision 2.73.12.1 diff -C2 -d -r2.73 -r2.73.12.1 *** selectmodule.c 11 Feb 2003 17:18:58 -0000 2.73 --- selectmodule.c 22 Mar 2004 20:20:33 -0000 2.73.12.1 *************** *** 319,323 **** } ! #ifdef HAVE_POLL /* * poll() support --- 319,323 ---- } ! #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) /* * poll() support *************** *** 613,617 **** return (PyObject *)rv; } ! #endif /* HAVE_POLL */ PyDoc_STRVAR(select_doc, --- 613,617 ---- return (PyObject *)rv; } ! #endif /* HAVE_POLL && !HAVE_BROKEN_POLL */ PyDoc_STRVAR(select_doc, *************** *** 640,646 **** static PyMethodDef select_methods[] = { {"select", select_select, METH_VARARGS, select_doc}, ! #ifdef HAVE_POLL {"poll", select_poll, METH_VARARGS, poll_doc}, ! #endif /* HAVE_POLL */ {0, 0}, /* sentinel */ }; --- 640,646 ---- static PyMethodDef select_methods[] = { {"select", select_select, METH_VARARGS, select_doc}, ! #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) {"poll", select_poll, METH_VARARGS, poll_doc}, ! #endif /* HAVE_POLL && !HAVE_BROKEN_POLL */ {0, 0}, /* sentinel */ }; *************** *** 661,665 **** Py_INCREF(SelectError); PyModule_AddObject(m, "error", SelectError); ! #ifdef HAVE_POLL poll_Type.ob_type = &PyType_Type; PyModule_AddIntConstant(m, "POLLIN", POLLIN); --- 661,665 ---- Py_INCREF(SelectError); PyModule_AddObject(m, "error", SelectError); ! #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) poll_Type.ob_type = &PyType_Type; PyModule_AddIntConstant(m, "POLLIN", POLLIN); *************** *** 685,688 **** PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); #endif ! #endif /* HAVE_POLL */ } --- 685,688 ---- PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); #endif ! #endif /* HAVE_POLL && !HAVE_BROKEN_POLL */ } From mondragon at users.sourceforge.net Mon Mar 22 15:20:37 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Mar 22 15:30:56 2004 Subject: [Python-checkins] python/dist/src README, 1.177.4.7, 1.177.4.8 configure, 1.416.4.11, 1.416.4.12 configure.in, 1.427.4.10, 1.427.4.11 pyconfig.h.in, 1.83.4.3, 1.83.4.4 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14693 Modified Files: Tag: release23-maint README configure configure.in pyconfig.h.in Log Message: Added check for broken poll on OSes where it exists but sets errno for bad file descriptor. Fixes SF Bug #850981 Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.177.4.7 retrieving revision 1.177.4.8 diff -C2 -d -r1.177.4.7 -r1.177.4.8 *** README 4 Dec 2003 20:33:58 -0000 1.177.4.7 --- README 22 Mar 2004 20:20:26 -0000 1.177.4.8 *************** *** 668,671 **** --- 668,672 ---- work (It does not return POLLNVAL for bad fds and hangs). + (Believed fixed, unverified - autoconf check for broken poll) - posix: statvfs and fstatvfs always return ENOSYS. - disabled modules: Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.416.4.11 retrieving revision 1.416.4.12 diff -C2 -d -r1.416.4.11 -r1.416.4.12 *** configure 18 Nov 2003 19:59:36 -0000 1.416.4.11 --- configure 22 Mar 2004 20:20:27 -0000 1.416.4.12 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.427.4.9 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.427.4.10 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.3. *************** *** 18419,18422 **** --- 18419,18494 ---- fi + echo "$as_me:$LINENO: checking for broken poll()" >&5 + echo $ECHO_N "checking for broken poll()... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + ac_cv_broken_poll=no + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + /* confdefs.h. */ + _ACEOF + cat confdefs.h >>conftest.$ac_ext + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + + #include + + int main (void) + { + struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; + + close (42); + + int poll_test = poll (&poll_struct, 1, 0); + + if (poll_test < 0) + { + exit(0); + } + else if (poll_test == 0 && poll_struct.revents != POLLNVAL) + { + exit(0); + } + else + { + exit(1); + } + } + + _ACEOF + rm -f conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_broken_poll=yes + else + echo "$as_me: program exited with status $ac_status" >&5 + echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + + ( exit $ac_status ) + ac_cv_broken_poll=no + fi + rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: $ac_cv_broken_poll" >&5 + echo "${ECHO_T}$ac_cv_broken_poll" >&6 + if test "$ac_cv_broken_poll" = yes + then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_BROKEN_POLL 1 + _ACEOF + + fi + + # tzset(3) exists and works like we expect it to echo "$as_me:$LINENO: checking for working tzset()" >&5 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.427.4.10 retrieving revision 1.427.4.11 diff -C2 -d -r1.427.4.10 -r1.427.4.11 *** configure.in 18 Nov 2003 19:59:39 -0000 1.427.4.10 --- configure.in 22 Mar 2004 20:20:32 -0000 1.427.4.11 *************** *** 2840,2843 **** --- 2840,2880 ---- fi + AC_MSG_CHECKING(for broken poll()) + AC_TRY_RUN([ + #include + + int main (void) + { + struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; + + close (42); + + int poll_test = poll (&poll_struct, 1, 0); + + if (poll_test < 0) + { + exit(0); + } + else if (poll_test == 0 && poll_struct.revents != POLLNVAL) + { + exit(0); + } + else + { + exit(1); + } + } + ], + ac_cv_broken_poll=yes, + ac_cv_broken_poll=no, + ac_cv_broken_poll=no) + AC_MSG_RESULT($ac_cv_broken_poll) + if test "$ac_cv_broken_poll" = yes + then + AC_DEFINE(HAVE_BROKEN_POLL, 1, + [Define if poll() sets errno on invalid file descriptors.]) + fi + + # tzset(3) exists and works like we expect it to AC_MSG_CHECKING(for working tzset()) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.83.4.3 retrieving revision 1.83.4.4 diff -C2 -d -r1.83.4.3 -r1.83.4.4 *** pyconfig.h.in 25 Sep 2003 15:21:00 -0000 1.83.4.3 --- pyconfig.h.in 22 Mar 2004 20:20:32 -0000 1.83.4.4 *************** *** 45,48 **** --- 45,51 ---- #undef HAVE_BROKEN_NICE + /* Define if poll() sets errno on invalid file descriptors. */ + #undef HAVE_BROKEN_POLL + /* Define if the Posix semaphores do not work on your system */ #undef HAVE_BROKEN_POSIX_SEMAPHORES *************** *** 127,130 **** --- 130,136 ---- #undef HAVE_FSTATVFS + /* Define if you have the 'fsync' function. */ + #undef HAVE_FSYNC + /* Define to 1 if you have the `ftell64' function. */ #undef HAVE_FTELL64 *************** *** 486,492 **** #undef HAVE_SYMLINK - /* Define if you have the 'fsync' function. */ - #undef HAVE_FSYNC - /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF --- 492,495 ---- From arigo at users.sourceforge.net Mon Mar 22 15:39:51 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon Mar 22 15:50:08 2004 Subject: [Python-checkins] python/dist/src/Objects abstract.c, 2.119.12.1, 2.119.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19156 Modified Files: Tag: release23-maint abstract.c Log Message: Backported fix of revision 2.217. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.119.12.1 retrieving revision 2.119.12.2 diff -C2 -d -r2.119.12.1 -r2.119.12.2 *** abstract.c 20 Mar 2004 21:54:34 -0000 2.119.12.1 --- abstract.c 22 Mar 2004 20:39:42 -0000 2.119.12.2 *************** *** 2079,2083 **** PyErr_SetString(PyExc_RuntimeError, "Recursion depth exceeded"); ! return NULL; } --- 2079,2083 ---- PyErr_SetString(PyExc_RuntimeError, "Recursion depth exceeded"); ! return -1; } *************** *** 2139,2143 **** PyErr_SetString(PyExc_RuntimeError, "Recursion depth exceeded"); ! return NULL; } --- 2139,2143 ---- PyErr_SetString(PyExc_RuntimeError, "Recursion depth exceeded"); ! return -1; } From arigo at users.sourceforge.net Mon Mar 22 15:41:50 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Mon Mar 22 15:52:05 2004 Subject: [Python-checkins] python/dist/src/Python pythonrun.c, 2.195.6.4, 2.195.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19489 Modified Files: Tag: release23-maint pythonrun.c Log Message: Backport for bug fix of 2.204. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.195.6.4 retrieving revision 2.195.6.5 diff -C2 -d -r2.195.6.4 -r2.195.6.5 *** pythonrun.c 1 Dec 2003 22:13:12 -0000 2.195.6.4 --- pythonrun.c 22 Mar 2004 20:41:47 -0000 2.195.6.5 *************** *** 1099,1104 **** { int err = 0; - PyObject *v = value; PyObject *f = PySys_GetObject("stderr"); if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); --- 1099,1104 ---- { int err = 0; PyObject *f = PySys_GetObject("stderr"); + Py_INCREF(value); if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); *************** *** 1110,1119 **** err = PyTraceBack_Print(tb, f); if (err == 0 && ! PyObject_HasAttrString(v, "print_file_and_line")) { PyObject *message; const char *filename, *text; int lineno, offset; ! if (!parse_syntax_error(v, &message, &filename, &lineno, &offset, &text)) PyErr_Clear(); --- 1110,1119 ---- err = PyTraceBack_Print(tb, f); if (err == 0 && ! PyObject_HasAttrString(value, "print_file_and_line")) { PyObject *message; const char *filename, *text; int lineno, offset; ! if (!parse_syntax_error(value, &message, &filename, &lineno, &offset, &text)) PyErr_Clear(); *************** *** 1131,1135 **** if (text != NULL) print_error_text(f, offset, text); ! v = message; /* Can't be bothered to check all those PyFile_WriteString() calls */ --- 1131,1136 ---- if (text != NULL) print_error_text(f, offset, text); ! Py_DECREF(value); ! value = message; /* Can't be bothered to check all those PyFile_WriteString() calls */ *************** *** 1168,1173 **** err = PyFile_WriteObject(exception, f, Py_PRINT_RAW); if (err == 0) { ! if (v != NULL && v != Py_None) { ! PyObject *s = PyObject_Str(v); /* only print colon if the str() of the object is not the empty string --- 1169,1174 ---- err = PyFile_WriteObject(exception, f, Py_PRINT_RAW); if (err == 0) { ! if (value != Py_None) { ! PyObject *s = PyObject_Str(value); /* only print colon if the str() of the object is not the empty string *************** *** 1186,1189 **** --- 1187,1191 ---- err = PyFile_WriteString("\n", f); } + Py_DECREF(value); /* If an error happened here, don't show it. XXX This is wrong, but too many callers rely on this behavior. */ From wkmfmmv9lu at lostmylovelife.com Mon Mar 22 10:58:30 2004 From: wkmfmmv9lu at lostmylovelife.com (Zachary Tabor) Date: Mon Mar 22 16:06:13 2004 Subject: [Python-checkins] Interested in an invitation Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040322/ba2590e2/attachment.html From fdrake at users.sourceforge.net Mon Mar 22 15:56:54 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Mar 22 16:07:10 2004 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23879 Modified Files: distref.tex Log Message: fix various markup errors Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** distref.tex 13 Jun 2003 04:32:15 -0000 1.10 --- distref.tex 22 Mar 2004 20:56:51 -0000 1.11 *************** *** 998,1002 **** \begin{funcdesc}{subst_vars}{s, local_vars} Perform shell/Perl-style variable substitution on \var{s}. Every ! occurrence of \code{$} followed by a name is considered a variable, and variable is substituted by the value found in the \var{local_vars} dictionary, or in \code{os.environ} if it's not in \var{local_vars}. --- 998,1002 ---- \begin{funcdesc}{subst_vars}{s, local_vars} Perform shell/Perl-style variable substitution on \var{s}. Every ! occurrence of \code{\$} followed by a name is considered a variable, and variable is substituted by the value found in the \var{local_vars} dictionary, or in \code{os.environ} if it's not in \var{local_vars}. *************** *** 1006,1010 **** Note that this is not a fully-fledged string interpolation function. A ! valid \code{$variable} can consist only of upper and lower case letters, numbers and an underscore. No \{ \} or \( \) style quoting is available. \end{funcdesc} --- 1006,1010 ---- Note that this is not a fully-fledged string interpolation function. A ! valid \code{\$variable} can consist only of upper and lower case letters, numbers and an underscore. No \{ \} or \( \) style quoting is available. \end{funcdesc} *************** *** 1262,1266 **** This class provides a file-like object that takes care of all the things you commonly want to do when processing a text file ! that has some line-by-line syntax: strip comments (as long as \code{#} is your comment character), skip blank lines, join adjacent lines by escaping the newline (ie. backslash at end of line), strip --- 1262,1266 ---- This class provides a file-like object that takes care of all the things you commonly want to do when processing a text file ! that has some line-by-line syntax: strip comments (as long as \code{\#} is your comment character), skip blank lines, join adjacent lines by escaping the newline (ie. backslash at end of line), strip From fdrake at users.sourceforge.net Mon Mar 22 16:44:46 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Mar 22 16:55:02 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3904 Modified Files: dist.tex Log Message: convert from a howto to a manual Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** dist.tex 19 Feb 2004 23:17:46 -0000 1.66 --- dist.tex 22 Mar 2004 21:44:43 -0000 1.67 *************** *** 1,3 **** ! \documentclass{howto} \usepackage{distutils} --- 1,3 ---- ! \documentclass{manual} \usepackage{distutils} *************** *** 41,45 **** ! \section{Introduction} \label{intro} --- 41,45 ---- ! \chapter{An Introduction to Distutils} \label{intro} *************** *** 77,81 **** ! \subsection{A Simple Example} \label{simple-example} --- 77,81 ---- ! \section{A Simple Example} \label{simple-example} *************** *** 179,183 **** ! \subsection{General Python terminology} \label{python-terms} --- 179,183 ---- ! \section{General Python terminology} \label{python-terms} *************** *** 218,222 **** ! \subsection{Distutils-specific terminology} \label{distutils-term} --- 218,222 ---- ! \section{Distutils-specific terminology} \label{distutils-term} *************** *** 246,250 **** ! \section{Writing the Setup Script} \label{setup-script} --- 246,250 ---- ! \chapter{Writing the Setup Script} \label{setup-script} *************** *** 813,817 **** full traceback in case an exception occurs. ! \section{Writing the Setup Configuration File} \label{setup-config} --- 813,817 ---- full traceback in case an exception occurs. ! \chapter{Writing the Setup Configuration File} \label{setup-config} *************** *** 950,954 **** ! \section{Creating a Source Distribution} \label{source-dist} --- 950,954 ---- ! \chapter{Creating a Source Distribution} \label{source-dist} *************** *** 1143,1147 **** ! \section{Creating Built Distributions} \label{built-dist} --- 1143,1147 ---- ! \chapter{Creating Built Distributions} \label{built-dist} *************** *** 1532,1536 **** \end{funcdesc} ! \section{Registering with the Package Index} \label{package-index} --- 1532,1536 ---- \end{funcdesc} ! \chapter{Registering with the Package Index} \label{package-index} *************** *** 1585,1592 **** ! \section{Examples} \label{examples} ! \subsection{Pure Python distribution (by module)} \label{pure-mod} --- 1585,1592 ---- ! \chapter{Examples} \label{examples} ! \section{Pure Python distribution (by module)} \label{pure-mod} *************** *** 1639,1643 **** ! \subsection{Pure Python distribution (by package)} \label{pure-pkg} --- 1639,1643 ---- ! \section{Pure Python distribution (by package)} \label{pure-pkg} *************** *** 1761,1765 **** ! \subsection{Single extension module} \label{single-ext} --- 1761,1765 ---- ! \section{Single extension module} \label{single-ext} *************** *** 1794,1813 **** ! %\subsection{Multiple extension modules} %\label{multiple-ext} ! %\subsection{Putting it all together} ! %\section{Extending the Distutils} %\label{extending} ! %\subsection{Extending existing commands} %\label{extend-existing} ! %\subsection{Writing new commands} %\label{new-commands} --- 1794,1813 ---- ! %\section{Multiple extension modules} %\label{multiple-ext} ! %\section{Putting it all together} ! %\chapter{Extending the Distutils} %\label{extending} ! %\section{Extending existing commands} %\label{extend-existing} ! %\section{Writing new commands} %\label{new-commands} *************** *** 1816,1820 **** ! \section{Reference} \label{reference} --- 1816,1820 ---- ! \chapter{Command Reference} \label{reference} *************** *** 1836,1840 **** ! \subsection{Installing modules: the \protect\command{install} command family} \label{install-cmd} --- 1836,1840 ---- ! \section{Installing modules: the \protect\command{install} command family} \label{install-cmd} *************** *** 1847,1855 **** %\label{install-lib-cmd} ! \subsubsection{\protect\command{install\_data}} \label{install-data-cmd} This command installs all data files provided with the distribution. ! \subsubsection{\protect\command{install\_scripts}} \label{install-scripts-cmd} This command installs all (Python) scripts in the distribution. --- 1847,1855 ---- %\label{install-lib-cmd} ! \subsection{\protect\command{install\_data}} \label{install-data-cmd} This command installs all data files provided with the distribution. ! \subsection{\protect\command{install\_scripts}} \label{install-scripts-cmd} This command installs all (Python) scripts in the distribution. *************** *** 1860,1864 **** ! \subsection{Creating a source distribution: the \protect\command{sdist} command} \label{sdist-cmd} --- 1860,1864 ---- ! \section{Creating a source distribution: the \protect\command{sdist} command} \label{sdist-cmd} *************** *** 1899,1914 **** ! %\subsection{Creating a built distribution: the % \protect\command{bdist} command family} %\label{bdist-cmds} ! %\subsubsection{\protect\command{bdist}} ! %\subsubsection{\protect\command{bdist\_dumb}} ! %\subsubsection{\protect\command{bdist\_rpm}} ! %\subsubsection{\protect\command{bdist\_wininst}} --- 1899,1914 ---- ! %\section{Creating a built distribution: the % \protect\command{bdist} command family} %\label{bdist-cmds} ! %\subsection{\protect\command{bdist}} ! %\subsection{\protect\command{bdist\_dumb}} ! %\subsection{\protect\command{bdist\_rpm}} ! %\subsection{\protect\command{bdist\_wininst}} From loewis at users.sourceforge.net Mon Mar 22 16:49:49 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Mar 22 17:00:04 2004 Subject: [Python-checkins] python/dist/src/Lib/lib-tk SimpleDialog.py, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4766 Modified Files: SimpleDialog.py Log Message: Patch #911176: Move test function into __main__ Index: SimpleDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/SimpleDialog.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SimpleDialog.py 20 Mar 1998 20:45:43 -0000 1.4 --- SimpleDialog.py 22 Mar 2004 21:49:47 -0000 1.5 *************** *** 87,94 **** ! def test(): ! root = Tk() ! def doit(root=root): ! d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " --- 87,96 ---- ! if __name__ == '__main__': ! ! def test(): ! root = Tk() ! def doit(root=root): ! d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " *************** *** 100,111 **** cancel=2, title="Test Dialog") ! print d.go() ! t = Button(root, text='Test', command=doit) ! t.pack() ! q = Button(root, text='Quit', command=t.quit) ! q.pack() ! t.mainloop() ! - if __name__ == '__main__': test() --- 102,111 ---- cancel=2, title="Test Dialog") ! print d.go() ! t = Button(root, text='Test', command=doit) ! t.pack() ! q = Button(root, text='Quit', command=t.quit) ! q.pack() ! t.mainloop() test() From anthonybaxter at users.sourceforge.net Mon Mar 22 17:22:07 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon Mar 22 17:32:39 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command checkdep.py, NONE, 1.1 __init__.py, 1.18, 1.19 install.py, 1.67, 1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11533/command Modified Files: __init__.py install.py Added Files: checkdep.py Log Message: Basic dependency checking. setup() has two new optional arguments requires and provides. requires is a sequence of strings, of the form 'packagename-version'. The dependency checking so far merely does an '__import__(packagename)' and checks for packagename.__version__ You can also leave off the version, and any version of the package will be installed. There's a special case for the package 'python' - sys.version_info is used, so requires= ( 'python-2.3', ) just works. Provides is of the same format as requires - but if it's not supplied, a provides is generated by adding the version to each entry in packages, or modules if packages isn't there. Provides is currently only used in the PKG-INFO file. Shortly, PyPI will grow the ability to accept these lines, and register will be updated to send them. There's a new command 'checkdep' command that runs these checks. For this version, only greater-than-or-equal checking is done. We'll add the ability to specify an optional operator later. --- NEW FILE: checkdep.py --- """distutils.command.x Implements the Distutils 'x' command. """ # created 2000/mm/dd, John Doe __revision__ = "$Id: checkdep.py,v 1.1 2004/03/22 22:22:05 anthonybaxter Exp $" from distutils.core import Command class DependencyFailure(Exception): pass class VersionTooOld(DependencyFailure): pass class VersionNotKnown(DependencyFailure): pass class checkdep (Command): # Brief (40-50 characters) description of the command description = "check package dependencies" # List of option tuples: long name, short name (None if no short # name), and help string. # Later on, we might have auto-fetch and the like here. Feel free. user_options = [] def initialize_options (self): self.debug = None # initialize_options() def finalize_options (self): pass # finalize_options() def run (self): from distutils.version import LooseVersion failed = [] for pkg, ver in self.distribution.metadata.requires: if pkg == 'python': if ver is not None: # Special case the 'python' package import sys thisver = LooseVersion('%d.%d.%d'%sys.version_info[:3]) if thisver < ver: failed.append(((pkg,ver), VersionTooOld(thisver))) continue # Kinda hacky - we should do more here try: mod = __import__(pkg) except Exception, e: failed.append(((pkg,ver), e)) continue if ver is not None: if hasattr(mod, '__version__'): thisver = LooseVersion(mod.__version__) if thisver < ver: failed.append(((pkg,ver), VersionTooOld(thisver))) else: failed.append(((pkg,ver), VersionNotKnown())) if failed: raise DependencyFailure, failed # run() # class x Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/__init__.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** __init__.py 3 Mar 2003 18:37:16 -0000 1.18 --- __init__.py 22 Mar 2004 22:22:05 -0000 1.19 *************** *** 25,28 **** --- 25,29 ---- 'bdist_rpm', 'bdist_wininst', + 'checkdep', # These two are reserved for future use: #'bdist_sdux', Index: install.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** install.py 19 Nov 2002 13:12:28 -0000 1.67 --- install.py 22 Mar 2004 22:22:05 -0000 1.68 *************** *** 127,130 **** --- 127,132 ---- ('skip-build', None, "skip rebuilding everything (for testing/debugging)"), + ('skip-checkdep', None, + "skip checking dependencies (use at own risk)"), # Where to install documentation (eventually!) *************** *** 184,188 **** # 'force' forces installation, even if target files are not # out-of-date. 'skip_build' skips running the "build" command, ! # handy if you know it's not necessary. 'warn_dir' (which is *not* # a user option, it's just there so the bdist_* commands can turn # it off) determines whether we warn about installing to a --- 186,192 ---- # 'force' forces installation, even if target files are not # out-of-date. 'skip_build' skips running the "build" command, ! # handy if you know it's not necessary. 'skip_checkdep' skips ! # the 'checkdep' command, if you are sure you can work around the ! # dependency failure in another way. 'warn_dir' (which is *not* # a user option, it's just there so the bdist_* commands can turn # it off) determines whether we warn about installing to a *************** *** 190,193 **** --- 194,198 ---- self.force = 0 self.skip_build = 0 + self.skip_checkdep = 0 self.warn_dir = 1 *************** *** 501,504 **** --- 506,515 ---- self.run_command('build') + # We check dependencies before we install + # For now, this is disabled. Before 2.4 is released, this will + # be turned on. + #if not self.skip_checkdep: + # self.run_command('checkdep') + # Run all sub-commands (at least those that need to be run) for cmd_name in self.get_sub_commands(): From anthonybaxter at users.sourceforge.net Mon Mar 22 17:22:07 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon Mar 22 17:32:42 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils core.py, 1.59, 1.60 dist.py, 1.65, 1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11533 Modified Files: core.py dist.py Log Message: Basic dependency checking. setup() has two new optional arguments requires and provides. requires is a sequence of strings, of the form 'packagename-version'. The dependency checking so far merely does an '__import__(packagename)' and checks for packagename.__version__ You can also leave off the version, and any version of the package will be installed. There's a special case for the package 'python' - sys.version_info is used, so requires= ( 'python-2.3', ) just works. Provides is of the same format as requires - but if it's not supplied, a provides is generated by adding the version to each entry in packages, or modules if packages isn't there. Provides is currently only used in the PKG-INFO file. Shortly, PyPI will grow the ability to accept these lines, and register will be updated to send them. There's a new command 'checkdep' command that runs these checks. For this version, only greater-than-or-equal checking is done. We'll add the ability to specify an optional operator later. Index: core.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/core.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** core.py 12 Feb 2004 17:35:08 -0000 1.59 --- core.py 22 Mar 2004 22:22:04 -0000 1.60 *************** *** 48,52 **** 'maintainer', 'maintainer_email', 'url', 'license', 'description', 'long_description', 'keywords', ! 'platforms', 'classifiers', 'download_url') # Legal keyword arguments for the Extension constructor --- 48,53 ---- 'maintainer', 'maintainer_email', 'url', 'license', 'description', 'long_description', 'keywords', ! 'platforms', 'classifiers', 'download_url', ! 'provides', 'requires', ) # Legal keyword arguments for the Extension constructor Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** dist.py 17 Feb 2004 22:35:19 -0000 1.65 --- dist.py 22 Mar 2004 22:22:04 -0000 1.66 *************** *** 215,218 **** --- 215,263 ---- sys.stderr.write(msg + "\n") + # Build up the requires sequence + from distutils.version import LooseVersion + requires = attrs.get('requires') + if requires: + if isinstance(requires, type('')): + raise DistutilsOptionError, 'requires should be a sequence' + newreq = [] + for req in requires: + if '-' not in req: + # We have a plain package name - any version will do + newreq.append((req,None)) + else: + pkg, ver = string.split(req, '-', 1) + newreq.append((pkg, LooseVersion(ver))) + attrs['requires'] = newreq + + # Build up the provides object. If the setup() has no + # provides line, we use packages or modules and the version + # to synthesise the provides. If no version is provided (no + # pun intended) we don't have a provides entry at all. + provides = attrs.get('provides') + if provides: + if isinstance(provides, type('')): + raise DistutilsOptionError, 'provides should be a sequence' + newprov = [] + for prov in provides: + if '-' not in prov: + # We have a plain package name - any version will do + newprov.append((prov,None)) + else: + pkg, ver = string.split(prov, '-', 1) + newprov.append((pkg, LooseVersion(ver))) + attrs['provides'] = newprov + elif attrs.get('version'): + # Build a provides line + prov = [] + if attrs.get('packages'): + for pkg in attrs['packages']: + pkg = string.replace(pkg, '/', '.') + prov.append('%s-%s'%(pkg, attrs['version'])) + elif attrs.get('modules'): + for mod in attrs['modules']: + prov.append('%s-%s'%(mod, attrs['version'])) + attrs['provides'] = prov + # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! *************** *** 975,979 **** "keywords", "platforms", "fullname", "contact", "contact_email", "license", "classifiers", ! "download_url") def __init__ (self): --- 1020,1024 ---- "keywords", "platforms", "fullname", "contact", "contact_email", "license", "classifiers", ! "download_url", "provides", "requires",) def __init__ (self): *************** *** 992,995 **** --- 1037,1042 ---- self.classifiers = None self.download_url = None + self.requires = [] + self.provides = [] def write_pkg_info (self, base_dir): *************** *** 1007,1010 **** --- 1054,1061 ---- pkg_info.write('Author-email: %s\n' % self.get_contact_email() ) pkg_info.write('License: %s\n' % self.get_license() ) + for req in self.get_requires(): + pkg_info.write('Requires: %s\n' % req ) + for prov in self.get_provides(): + pkg_info.write('Provides: %s\n' % prov ) if self.download_url: pkg_info.write('Download-URL: %s\n' % self.download_url) *************** *** 1085,1088 **** --- 1136,1146 ---- return self.download_url or "UNKNOWN" + def get_requires(self): + return [ '%s%s%s'%(x, (y and '-') or '', y or '') + for x,y in self.requires ] + + def get_provides(self): + return self.provides + # class DistributionMetadata From loewis at users.sourceforge.net Tue Mar 23 11:28:18 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Mar 23 11:39:55 2004 Subject: [Python-checkins] python/dist/src/Python import.c,2.226,2.227 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31567 Modified Files: import.c Log Message: Decref all if ensure_fromlist fails. Fixes #876533. Backported to 2.3. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.226 retrieving revision 2.227 diff -C2 -d -r2.226 -r2.227 *** import.c 2 Jan 2004 23:25:32 -0000 2.226 --- import.c 23 Mar 2004 16:28:13 -0000 2.227 *************** *** 2105,2111 **** PyErr_Clear(); else { ! if (!ensure_fromlist(mod, all, buf, buflen, 1)) ! return 0; Py_DECREF(all); } continue; --- 2105,2112 ---- PyErr_Clear(); else { ! int ret = ensure_fromlist(mod, all, buf, buflen, 1); Py_DECREF(all); + if (!ret) + return 0; } continue; From loewis at users.sourceforge.net Tue Mar 23 11:28:47 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Mar 23 11:39:58 2004 Subject: [Python-checkins] python/dist/src/Python import.c, 2.222.6.1, 2.222.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31971 Modified Files: Tag: release23-maint import.c Log Message: Decref all if ensure_fromlist fails. Fixes #876533. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.222.6.1 retrieving revision 2.222.6.2 diff -C2 -d -r2.222.6.1 -r2.222.6.2 *** import.c 20 Oct 2003 14:34:48 -0000 2.222.6.1 --- import.c 23 Mar 2004 16:28:45 -0000 2.222.6.2 *************** *** 2179,2185 **** PyErr_Clear(); else { ! if (!ensure_fromlist(mod, all, buf, buflen, 1)) ! return 0; Py_DECREF(all); } continue; --- 2179,2186 ---- PyErr_Clear(); else { ! int ret = ensure_fromlist(mod, all, buf, buflen, 1); Py_DECREF(all); + if (!ret) + return 0; } continue; From montanaro at users.sourceforge.net Tue Mar 23 11:41:19 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue Mar 23 11:51:42 2004 Subject: [Python-checkins] python/nondist/peps pep-0318.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2332 Modified Files: pep-0318.txt Log Message: Checking in what we have so far. Still digesting some of Jim Jewett's inputs. Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0318.txt 28 Feb 2004 19:09:44 -0000 1.4 --- pep-0318.txt 23 Mar 2004 16:41:17 -0000 1.5 *************** *** 3,243 **** Version: $Revision$ Last-Modified: $Date$ ! Author: Kevin D. Smith Status: Draft Type: Standards Track ! Content-Type: text/plain Created: 05-Jun-2003 Python-Version: 2.4 ! Post-History: 09-Jun-2003, 10-Jun-2003, 27-Feb-2004 Abstract ! The current method for declaring class and static methods ! is awkward and can lead to code that is difficult to understand. ! This PEP introduces possible new syntax which will place the ! translation of instance methods to class/static methods at ! the same point in the code as the method's declaration. Motivation ! The current method of translating an instance method into a ! class/static method places the actual translation at a different ! point in the code than the declaration of the method. The ! code below demonstrates this. ! def foo(self): ! perform method operation ! foo = classmethod(foo) ! When the method is very short, it is easy to look ahead and see ! that this is a class method. However, if the method is more than ! 15 lines or so, the translation into a class method is not ! obvious. A solution to this problem is to move the translation ! of the method to the same point as the method's declaration. ! The proposed syntax, shown in the example below, is discussed ! in the following sections. ! def foo(self) as synchronized(lock), classmethod: ! perform method operation ! Proposal ! Probably the simplest way to place the decorator that translates ! an instance method to a class/static method is illustrated in the ! code below. ! def classmethod foo(self): ! perform method operation ! The code in this example will simply perform the following. ! def foo(self): ! perform method operation ! foo = classmethod(foo) ! ! This syntax does not introduce any new keywords and is completely ! backwards compatible with any existing code. The word between the ! 'def' and the actual name of the method is simply a reference to ! a callable object that returns a new function reference. ! This syntax could also be extended to allow multiple function ! decorators in the form of a space delimited list as follows: ! def protected classmethod foo(self): ! perform method operation ! which would be equivalent to the current form: ! def foo(self): ! perform method operation ! foo = protected(classmethod(foo)) ! While this syntax is simple and easy to read, it does become ! cluttered and more obscure if you wish to allow arguments to be ! sent to the function decorator. ! def synchronized(lock) classmethod foo(self): ! perform method operation ! Instead of placing the decorators in front of the function name, ! a better place might be after it, as shown below. The word 'as' is ! added simply as a separator to assist in readability. ! def foo(self) as synchronized(lock), classmethod: ! perform method operation ! This syntax is quite clear and could probably be interpreted ! by those not familiar with Python. The proposed syntax can be ! generalized as follows: ! 'def' NAME '(' PARAMETERS ')' ['as' DECORATORS] ':' ! where DECORATORS is a comma-separated list of expressions, ! or a tuple. Using the latter form, the last example above ! would look like: ! def foo(self) as (synchronized(lock), classmethod): ! perform method operation ! This form make is possible for the list of decorators to ! span multiple lines without using the line continuation operator. ! Alternate Syntaxes ! Other syntaxes have been proposed in comp.lang.python and ! python-dev. Unfortunately, no one syntax has come out as a clear ! winner in the lengthy discussions. The most common suggestions ! are demonstrated below. The proposed syntax is also included ! for easy comparison. ! Proposed Syntax ! def foo(self) as synchronized(lock), classmethod: ! perform method operation ! def foo(self) as (synchronized(lock), classmethod): ! perform method operation ! Prefix Forms ! def [synchronized(lock), classmethod] foo(self): ! perform method operation ! def synchronized(lock), classmethod foo(self): ! perform method operation ! # Same as above, but only identifiers are allowed ! sync = synchronized(lock) ! def sync, classmethod foo(self): ! perform method operation ! # Java-like ! sync = synchronized(lock) ! def @sync @classmethod foo(self): ! perform method operation ! Postfix Forms ! def foo(self) [synchronized(lock), classmethod]: ! perform method operation ! def foo(self) (synchronized(lock), classmethod): ! perform method operation ! def foo(self) {'pre': synchronized(lock), 'classmethod': True}: ! perform method operation ! I'm not as fond of the forms that use '[ ]' since code like ! 'foo()[a]' looks as if you are getting the item 'a' from 'foo()'. ! Although, this isn't as much of an issue when using '[ ]' in ! a prefix form. The Java-like syntax adds new syntax that is ! very arbitrary and is almost Perl-ish. In addition, since the ! order in which the decorators are applied may matter, the last, ! dictionary-style, syntax must be eliminated. ! ! Implementation Issues ! In the following example there are two function decorators: ! synchronized(lock) and classmethod. ! def foo(self) as synchronized(lock), classmethod: ! perform method operation ! Since these all appear within the operation of the 'def' ! itself, it makes sense that synchronized, lock, and ! classmethod must exist at the time that the definition ! is executed. In addition, each of these arguments will be ! evaluated before being applied to the compiled function. ! This means that arguments like synchronized(lock) must ! return a descriptor that will be applied to foo. Therefore, ! the code above translates to: ! def foo(self): ! perform method operation ! foo = classmethod((foo)) ! ! In the example above, refers to the ! descriptor returned by evaluating synchronized(lock). ! It could easily be argued that the descriptors should be applied ! in reverse order to make the application of the descriptor look ! more like the resultant code. I tend to prefer this form. ! def foo(self): ! perform method operation ! foo = (classmethod(foo)) ! In either case, the modified function is bound to the function ! name when the 'def' statement is executed. ! Open Issues ! It is not clear at the moment if it is even possible to have ! multiple decorators for a function. If decorators are required ! to take a function/method and return a descriptor, it might ! not even be possible to wrap multiple decorators. This should ! be explored since the best syntax for multiple decorators ! may not be the same as the best syntax for a single decorator. ! Current Implementations ! I am not personally familiar enough with Python's source to ! implement the proposed syntax; however, Michael Hudson has ! implemented the "square-bracketed" syntax (see patch at ! http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar.diff). ! It should be fairly simple for the Python development team ! to translate this patch to the proposed syntax. ! Possible Extensions ! The proposed syntax is general enough that it could be used ! on class definitions as well as shown below. ! class foo(object) as classmodifier: ! class definition here ! However, there are no obvious parallels for use with other ! descriptors such as property(). ! Conclusion ! The current method of translating an instance method to a class ! or static method is awkward. A new syntax for applying function ! decorators should be implemented (proposed syntax shown below). ! def foo(self) as synchronized(lock), classmethod: ! perform method operation ! The proposed syntax is simple, powerful, easy to read, and ! therefore preserves those qualities of the Python language. Copyright ! This document has been placed in the public domain. --- 3,281 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Kevin D. Smith , ! Jim Jewett , ! Skip Montanaro Status: Draft Type: Standards Track ! Content-Type: text/x-rst Created: 05-Jun-2003 Python-Version: 2.4 ! Post-History: 09-Jun-2003, 10-Jun-2003, 27-Feb-2004, 23-Mar-2004 Abstract + ======== ! The current method for declaring class and static methods is awkward ! and can lead to code that is difficult to understand. Ideally, these ! transformations should be made at the same point in the code where the ! declaration itself is made. This PEP introduces new syntax for ! transformations of a declaration. Motivation + ========== ! The current method of applying a transformation to a function or ! method places the actual translation after the function body. For ! large functions this separates a key component of the function's ! behavior from the definition of the rest of the function's external ! interface. For example:: ! def foo(self): ! perform method operation ! foo = classmethod(foo) ! This becomes less readable with longer methods. It also seems less ! than pythonic to name the function three times for what is ! conceptually a single declaration. A solution to this problem is to ! move the transformation of the method closer to the method's own ! declaration. While the new syntax is not yet final, the intent is to ! replace:: ! def foo(cls): ! pass ! foo = synchronized(lock)(foo) ! foo = classmethod(foo) + with an alternative that places the decoration in the function's + declaration:: ! def foo(cls) using [synchronized(lock), classmethod]: ! pass ! Background ! ========== ! There is general agreement that syntactic support is desirable to the ! current state of affairs. Guido mentioned `syntactic support for ! decorators`_ in his DevDay keynote presentation at the `10th Python ! Conference`_, though `he later said`_ it was only one of several ! extensions he proposed there "semi-jokingly". `Michael Hudson raised ! the topic`_ on ``python-dev`` shortly after the conference, ! attributing the bracketed syntax to an earlier proposal on ! ``comp.lang.python`` by `Gareth ! McCaughan`_. ! .. _syntactic support for decorators: http://www.python.org/doc/essays/ppt/python10/py10keynote.pdf ! .. _10th python conference: http://www.python.org/workshops/2002-02/ ! .. _michael hudson raised the topic: http://mail.python.org/pipermail/python-dev/2002-February/020005.html ! .. _he later said: http://mail.python.org/pipermail/python-dev/2002-February/020017.html ! .. _gareth mccaughan: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=slrna40k88.2h9o.Gareth.McCaughan%40g.local ! Design Goals ! ============ ! The new syntax should ! * work for arbitrary wrappers, including user-defined callables and ! the existing builtins ``classmethod()`` and ``staticmethod`` ! * work with multiple wrappers per definition ! * make it obvious what is happening; at the very least it should be ! obvious that new users can safely ignore it when writing their own ! code ! * not make future extensions more difficult ! * be easy to type; programs that use it are expected to use it very ! frequently ! * not make it more difficult to scan through code quickly. It should ! still be easy to search for all definitions, a particular ! definition, or the arguments that a function accepts ! * not needlessly complicate secondary support tools such as ! language-sensitive editors and other "`toy parser tools out ! there`_" ! .. _toy parser tools out there: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=mailman.1010809396.32158.python-list%40python.org ! Proposed Syntax ! =============== ! The currently proposed syntax is:: ! def func(arg1, arg2, ...) [dec1, dec2, ...]: ! pass ! The decorators are near the declaration of the function's API but are ! clearly secondary. The square brackets make it possible to fairly ! easily break long lists of decorators across multiple lines. ! Alternate Proposals ! =================== ! A few other syntaxes have been proposed:: ! def func(arg1, arg2, ...) as dec1, dec2, ...: ! pass ! The absence of brackets makes it cumbersome to break long lists of ! decorators across multiple lines. The keyword "as" doesn't have the ! same meaning as its use in the ``import`` statement. ! :: ! def [dec1, dec2, ...] func(arg1, arg2, ...): ! pass ! This form has the disadvantage that the decorators become visually ! higher priority than the function name and argument list. ! :: ! def func [dec1, dec2, ...] (arg1, arg2, ...): ! pass ! Quixote's Page Template Language uses this form, but only supports a ! single decorator chosen from a restricted set. For short lists it ! works okay, but for long list it separates the argument list from the ! function name. ! :: ! using: ! dec1 ! dec2 ! ... ! def foo(arg1, arg2, ...): ! pass ! The function definition is not nested within the using: block making ! it impossible to tell which objects following the block will be ! decorated. Nesting the function definition within the using: block ! suggests block structure that doesn't exist. The name ``foo`` would ! actually exist at the same scope as the using: block. Finally, it ! would require the introduction of a new keyword. ! Current Implementation ! ====================== ! Michael Hudson has posted a `patch`_ at Starship, which implements the ! proposed syntax and left-first application of decorators:: ! def func(arg1, arg2, ...) [dec1, dec2]: ! pass ! is equivalent to:: ! def func(arg1, arg2, ...): ! pass ! func = dec2(dec1(func)) ! though without the intermediate creation of a variable named ``func``. ! .. _patch: http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar.diff ! Examples ! ======== ! Much of the discussion on ``comp.lang.python`` and the ``python-dev`` ! mailing list focuses on the use of the ``staticmethod()`` and ! ``classmethod()`` builtins. This capability is much more powerful ! than that. This section presents some examples of use. ! 1. Define a function to be executed at exit. Note that the function ! isn't actually "wrapped" in the usual sense. ! :: ! def onexit(f): ! import atexit ! atexit.register(f) ! return f + def func() [onexit]: + ... ! 2. Define a class with a singleton instance. Note that once the class ! disappears enterprising programmers would have to be more creative ! to create more instances. (From Shane Hathaway on ``python-dev``.) ! :: ! def singleton(cls): ! return cls() ! class MyClass [singleton]: ! ... + 3. Decorate a function with release information. (Based on an example + posted by Anders Munch on ``python-dev``.) ! :: ! def release(**kwds): ! def decorate(f): ! for k in kwds: ! setattr(f, k, kwds[k]) ! return f ! return decorate ! def classmethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ! ... ! 4. Enforce function argument and return types. ! ! :: ! ! def accepts(*types): ! def check_accepts(f): ! def new_f(*args, **kwds): ! for (a, t) in zip(args, types): ! assert isinstance(a, t), \ ! "arg %r does not match %s" % (a,t) ! return f(*args, **kwds) ! assert len(types) == f.func_code.co_argcount ! return new_f ! return check_accepts ! ! def returns(rtype): ! def check_returns(f): ! def new_f(*args, **kwds): ! result = f(*args, **kwds) ! assert isinstance(result, rtype), \ ! "return value %r does not match %s" % (result,rtype) ! return result ! return new_f ! return check_returns ! ! def func(arg1, arg2) [accepts(int, (int,float)), ! returns((int,float))]: ! return arg1 * arg2 ! ! Of course, all these examples are possible today, though without the ! syntactic support. ! ! Possible Extensions ! =================== ! ! The proposed syntax is general enough that it could be used on class ! definitions as well:: ! ! class foo(object) [dec1, dec2, ...]: ! class definition here ! ! Use would likely be much less than function decorators. The current ! patch only implements function decorators. Copyright + ========= ! This document has been placed in the public domain. From loewis at users.sourceforge.net Tue Mar 23 13:40:17 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Mar 23 13:50:43 2004 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31131/Objects Modified Files: funcobject.c Log Message: Intern __name__. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** funcobject.c 18 Jun 2003 01:13:41 -0000 2.63 --- funcobject.c 23 Mar 2004 18:40:15 -0000 2.64 *************** *** 12,15 **** --- 12,16 ---- PyFunctionObject *op = PyObject_GC_New(PyFunctionObject, &PyFunction_Type); + static PyObject *__name__ = 0; if (op != NULL) { PyObject *doc; *************** *** 41,45 **** Otherwise, use None. */ ! module = PyDict_GetItemString(globals, "__name__"); if (module) { Py_INCREF(module); --- 42,53 ---- Otherwise, use None. */ ! if (!__name__) { ! __name__ = PyString_InternFromString("__name__"); ! if (!__name__) { ! Py_DECREF(op); ! return NULL; ! } ! } ! module = PyDict_GetItem(globals, __name__); if (module) { Py_INCREF(module); From fdrake at users.sourceforge.net Tue Mar 23 13:43:06 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 23 13:53:30 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31820 Modified Files: dist.tex Log Message: merge Anthony Baxter's distutils API reference into the package author's documentation Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** dist.tex 22 Mar 2004 21:44:43 -0000 1.67 --- dist.tex 23 Mar 2004 18:43:03 -0000 1.68 *************** *** 13,17 **** \input{boilerplate} ! \author{Greg Ward} \authoraddress{ \strong{Python Software Foundation}\\ --- 13,18 ---- \input{boilerplate} ! \author{Greg Ward\\ ! Anthony Baxter} [...1530 lines suppressed...] + \end{methoddesc} + + \var{sub_commands} formalizes the notion of a ``family'' of commands, + eg. \code{install} as the parent with sub-commands \code{install_lib}, + \code{install_headers}, etc. The parent of a family of commands + defines \var{sub_commands} as a class attribute; it's a list of + 2-tuples \samp{(command_name, predicate)}, with \var{command_name} a string + and \var{predicate} an unbound method, a string or None. + \var{predicate} is a method of the parent command that + determines whether the corresponding command is applicable in the + current situation. (Eg. we \code{install_headers} is only applicable if + we have any C header files to install.) If \var{predicate} is None, + that command is always applicable. + + \var{sub_commands} is usually defined at the *end* of a class, because + predicates can be unbound methods, so they must already have been + defined. The canonical example is the \command{install} command. + + \end{document} From mondragon at users.sourceforge.net Tue Mar 23 13:44:42 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue Mar 23 13:55:07 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.958,1.959 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31776/Misc Modified Files: NEWS Log Message: Added command line options for profile.py - one for stats output file and one for sort order when using stdout. Uses optparse. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.958 retrieving revision 1.959 diff -C2 -d -r1.958 -r1.959 *** NEWS 22 Mar 2004 20:12:56 -0000 1.958 --- NEWS 23 Mar 2004 18:44:39 -0000 1.959 *************** *** 291,294 **** --- 291,297 ---- ------- + - Added two new command-line arguments for profile (output file and + default sort). + - Added global runctx function to profile module From mondragon at users.sourceforge.net Tue Mar 23 13:44:41 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue Mar 23 13:55:11 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libprofile.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31776/Doc/lib Modified Files: libprofile.tex Log Message: Added command line options for profile.py - one for stats output file and one for sort order when using stdout. Uses optparse. Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** libprofile.tex 22 Mar 2004 20:12:54 -0000 1.44 --- libprofile.tex 23 Mar 2004 18:44:39 -0000 1.45 *************** *** 132,135 **** --- 132,144 ---- \end{verbatim} + \file{profile.py} accepts two optional arguments on the command line: + + \begin{verbatim} + profile.py [-o output_file] [-s sort_order] + \end{verbatim} + + \samp{-s} only applies to stdout (i.e. \samp{-o} is not supplied. + Look in the \class{Stats} documentation for valid sort values. + When you wish to review the profile, you should use the methods in the \module{pstats} module. Typically you would load the statistics data as From mondragon at users.sourceforge.net Tue Mar 23 13:44:42 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue Mar 23 13:55:14 2004 Subject: [Python-checkins] python/dist/src/Lib profile.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31776/Lib Modified Files: profile.py Log Message: Added command line options for profile.py - one for stats output file and one for sort order when using stdout. Uses optparse. Index: profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** profile.py 22 Mar 2004 20:12:55 -0000 1.52 --- profile.py 23 Mar 2004 18:44:39 -0000 1.53 *************** *** 40,43 **** --- 40,44 ---- import time import marshal + from optparse import OptionParser __all__ = ["run","help","Profile"] *************** *** 56,60 **** #************************************************************************** ! def run(statement, filename=None): """Run statement under profiler optionally saving results in filename --- 57,61 ---- #************************************************************************** ! def run(statement, filename=None, sort=-1): """Run statement under profiler optionally saving results in filename *************** *** 75,79 **** prof.dump_stats(filename) else: ! return prof.print_stats() def runctx(statement, globals, locals, filename=None): --- 76,80 ---- prof.dump_stats(filename) else: ! return prof.print_stats(sort) def runctx(statement, globals, locals, filename=None): *************** *** 385,391 **** ! def print_stats(self): import pstats ! pstats.Stats(self).strip_dirs().sort_stats(-1). \ print_stats() --- 386,392 ---- ! def print_stats(self, sort=-1): import pstats ! pstats.Stats(self).strip_dirs().sort_stats(sort). \ print_stats() *************** *** 557,570 **** # When invoked as main program, invoke the profiler on a script if __name__ == '__main__': if not sys.argv[1:]: ! print "usage: profile.py scriptfile [arg] ..." sys.exit(2) ! filename = sys.argv[1] # Get script filename ! ! del sys.argv[0] # Hide "profile.py" from argument list ! # Insert script directory in front of module search path ! sys.path.insert(0, os.path.dirname(filename)) ! run('execfile(%r)' % (filename,)) --- 558,584 ---- # When invoked as main program, invoke the profiler on a script if __name__ == '__main__': + usage = "profile.py [-o output_file_path] [-s sort] scriptfile [arg] ..." if not sys.argv[1:]: ! print "Usage: ", usage sys.exit(2) ! class ProfileParser(OptionParser): ! def __init__(self, usage): ! OptionParser.__init__(self) ! self.usage = usage ! parser = ProfileParser(usage) ! parser.allow_interspersed_args = False ! parser.add_option('-o', '--outfile', dest="outfile", ! help="Save stats to ", default=None) ! parser.add_option('-s', '--sort', dest="sort", ! help="Sort order when printing to stdout, based on pstats.Stats class", default=-1) ! (options, args) = parser.parse_args() ! sys.argv[:] = args ! ! if (len(sys.argv) > 0): ! sys.path.insert(0, os.path.dirname(sys.argv[0])) ! run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort) ! else: ! print "Usage: ", usage From fdrake at users.sourceforge.net Tue Mar 23 13:54:15 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 23 14:04:40 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2208 Modified Files: dist.tex Log Message: - use recommended Python style in examples (no spaces around "=" for keyword args) - format multi-line calls to distutils.core.setup() consistently, and in line with general practice (one keyword arg per line, comma/newline after the last - fix a few typos Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** dist.tex 23 Mar 2004 18:43:03 -0000 1.68 --- dist.tex 23 Mar 2004 18:54:12 -0000 1.69 *************** *** 94,100 **** \begin{verbatim} from distutils.core import setup ! setup(name="foo", ! version="1.0", ! py_modules=["foo"]) \end{verbatim} --- 94,101 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foo', ! version='1.0', ! py_modules=['foo'], ! ) \end{verbatim} *************** *** 271,280 **** from distutils.core import setup ! setup(name="Distutils", ! version="1.0", ! description="Python Distribution Utilities", ! author="Greg Ward", ! author_email="gward@python.net", ! url="http://www.python.org/sigs/distutils-sig/", packages=['distutils', 'distutils.command'], ) --- 272,281 ---- from distutils.core import setup ! setup(name='Distutils', ! version='1.0', ! description='Python Distribution Utilities', ! author='Greg Ward', ! author_email='gward@python.net', ! url='http://www.python.org/sigs/distutils-sig/', packages=['distutils', 'distutils.command'], ) *************** *** 410,414 **** \begin{verbatim} ! uExtension("foo", ["foo.c"]) \end{verbatim} --- 411,415 ---- \begin{verbatim} ! Extension('foo', ['foo.c']) \end{verbatim} *************** *** 420,425 **** \begin{verbatim} from distutils.core import setup, Extension ! setup(name="foo", version="1.0", ! ext_modules=[Extension("foo", ["foo.c"])]) \end{verbatim} --- 421,428 ---- \begin{verbatim} from distutils.core import setup, Extension ! setup(name='foo', ! version='1.0', ! ext_modules=[Extension('foo', ['foo.c'])], ! ) \end{verbatim} *************** *** 436,440 **** \begin{verbatim} ! Extension("foo", ["src/foo1.c", "src/foo2.c"]) \end{verbatim} --- 439,443 ---- \begin{verbatim} ! Extension('foo', ['src/foo1.c', 'src/foo2.c']) \end{verbatim} *************** *** 442,446 **** \begin{verbatim} ! Extension("pkg.foo", ["src/foo1.c", "src/foo2.c"]) \end{verbatim} --- 445,449 ---- \begin{verbatim} ! Extension('pkg.foo', ['src/foo1.c', 'src/foo2.c']) \end{verbatim} *************** *** 456,462 **** \begin{verbatim} setup(... ! ext_package="pkg", ! ext_modules=[Extension("foo", ["foo.c"]), ! Extension("subpkg.bar", ["bar.c"])] ) \end{verbatim} --- 459,465 ---- \begin{verbatim} setup(... ! ext_package='pkg', ! ext_modules=[Extension('foo', ['foo.c']), ! Extension('subpkg.bar', ['bar.c'])], ) \end{verbatim} *************** *** 503,507 **** \begin{verbatim} ! Extension("foo", ["foo.c"], include_dirs=["include"]) \end{verbatim} --- 506,510 ---- \begin{verbatim} ! Extension('foo', ['foo.c'], include_dirs=['include']) \end{verbatim} *************** *** 511,515 **** \begin{verbatim} ! Extension("foo", ["foo.c"], include_dirs=["/usr/include/X11"]) \end{verbatim} --- 514,518 ---- \begin{verbatim} ! Extension('foo', ['foo.c'], include_dirs=['/usr/include/X11']) \end{verbatim} *************** *** 535,545 **** If you must put the \file{Numerical} include directory right into your header search path, though, you can find that directory using the ! Distutils \module{sysconfig} module: \begin{verbatim} from distutils.sysconfig import get_python_inc ! incdir = os.path.join(get_python_inc(plat_specific=1), "Numerical") setup(..., ! Extension(..., include_dirs=[incdir])) \end{verbatim} --- 538,549 ---- If you must put the \file{Numerical} include directory right into your header search path, though, you can find that directory using the ! Distutils \refmodule{distutils.sysconfig} module: \begin{verbatim} from distutils.sysconfig import get_python_inc ! incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical') setup(..., ! Extension(..., include_dirs=[incdir]), ! ) \end{verbatim} *************** *** 591,595 **** \begin{verbatim} Extension(..., ! libraries=["gdbm", "readline"]) \end{verbatim} --- 595,599 ---- \begin{verbatim} Extension(..., ! libraries=['gdbm', 'readline']) \end{verbatim} *************** *** 599,604 **** \begin{verbatim} Extension(..., ! library_dirs=["/usr/X11R6/lib"], ! libraries=["X11", "Xt"]) \end{verbatim} --- 603,608 ---- \begin{verbatim} Extension(..., ! library_dirs=['/usr/X11R6/lib'], ! libraries=['X11', 'Xt']) \end{verbatim} *************** *** 642,647 **** \begin{verbatim} ! setup (... ! scripts = ['scripts/xmlproc_parse', 'scripts/xmlproc_val'] ) \end{verbatim} --- 646,651 ---- \begin{verbatim} ! setup(... ! scripts=['scripts/xmlproc_parse', 'scripts/xmlproc_val'] ) \end{verbatim} *************** *** 728,735 **** available from the \ulink{PyPI website}{http://www.python.org/pypi}. ! \item["short string"] A single line of text, not more than 200 characters. ! \item["long string"] Multiple lines of plain text in ReStructuredText format (see \url{http://docutils.sf.net/}). ! \item["list of strings"] See below. \end{description} --- 732,739 ---- available from the \ulink{PyPI website}{http://www.python.org/pypi}. ! \item['short string'] A single line of text, not more than 200 characters. ! \item['long string'] Multiple lines of plain text in reStructuredText format (see \url{http://docutils.sf.net/}). ! \item['list of strings'] See below. \end{description} *************** *** 759,763 **** \begin{verbatim} setup(... ! classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Console', --- 763,767 ---- \begin{verbatim} setup(... ! classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', *************** *** 781,785 **** wish to remain backwards-compatible with Python releases prior to 2.2.3, then you can include the following code fragment in your \file{setup.py} ! before the \code{setup()} call. \begin{verbatim} --- 785,789 ---- wish to remain backwards-compatible with Python releases prior to 2.2.3, then you can include the following code fragment in your \file{setup.py} ! before the \function{setup()} call. \begin{verbatim} *************** *** 1045,1051 **** The meanings should be fairly clear: include all files in the ! distribution root matching \code{*.txt}, all files anywhere under the ! \file{examples} directory matching \code{*.txt} or \code{*.py}, and ! exclude all directories matching \code{examples/sample?/build}. All of this is done \emph{after} the standard include set, so you can exclude files from the standard set with explicit instructions in the manifest --- 1049,1055 ---- The meanings should be fairly clear: include all files in the ! distribution root matching \file{*.txt}, all files anywhere under the ! \file{examples} directory matching \file{*.txt} or \file{*.py}, and ! exclude all directories matching \file{examples/sample?/build}. All of this is done \emph{after} the standard include set, so you can exclude files from the standard set with explicit instructions in the manifest *************** *** 1308,1312 **** \begin{verbatim} ! python setup.py bdist_rpm --packager="John Doe " \ bdist_wininst --target_version="2.0" \end{verbatim} --- 1312,1316 ---- \begin{verbatim} ! python setup.py bdist_rpm --packager="John Doe " \ bdist_wininst --target_version="2.0" \end{verbatim} *************** *** 1609,1614 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foo", version = "1.0", ! py_modules = ["foo"]) \end{verbatim} Note that the name of the distribution is specified independently with --- 1613,1620 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foo', ! version='1.0', ! py_modules=['foo'], ! ) \end{verbatim} Note that the name of the distribution is specified independently with *************** *** 1631,1636 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! py_modules = ["foo", "bar"]) \end{verbatim} --- 1637,1644 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! py_modules=['foo', 'bar'], ! ) \end{verbatim} *************** *** 1654,1659 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! packages = [""]) \end{verbatim} (The empty string stands for the root package.) --- 1662,1669 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! packages=[''], ! ) \end{verbatim} (The empty string stands for the root package.) *************** *** 1671,1677 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! package_dir = {"": "src"}, ! packages = [""]) \end{verbatim} --- 1681,1689 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! package_dir={'': 'src'}, ! packages=[''], ! ) \end{verbatim} *************** *** 1692,1697 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! packages = ["foobar"]) \end{verbatim} --- 1704,1711 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! packages=['foobar'], ! ) \end{verbatim} *************** *** 1711,1717 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! package_dir = {"foobar" : "src"}, ! packages = ["foobar"]) \end{verbatim} --- 1725,1733 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! package_dir={'foobar': 'src'}, ! packages=['foobar'], ! ) \end{verbatim} *************** *** 1728,1734 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! package_dir = {"foobar" : ""}, ! packages = ["foobar"]) \end{verbatim} (The empty string also stands for the current directory.) --- 1744,1752 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! package_dir={'foobar': ''}, ! packages=['foobar'], ! ) \end{verbatim} (The empty string also stands for the current directory.) *************** *** 1755,1760 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! packages = ["foobar", "foobar.subfoo"]) \end{verbatim} (Again, the empty string in \option{package\_dir} stands for the current --- 1773,1780 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! packages=['foobar', 'foobar.subfoo'], ! ) \end{verbatim} (Again, the empty string in \option{package\_dir} stands for the current *************** *** 1778,1783 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! ext_modules = [Extension("foo", ["foo.c"])]) \end{verbatim} --- 1798,1805 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! ext_modules=[Extension('foo', ['foo.c'])], ! ) \end{verbatim} *************** *** 1790,1795 **** \begin{verbatim} from distutils.core import setup ! setup(name = "foobar", version = "1.0", ! ext_modules = [Extension("foopkg.foo", ["foo.c"])]) \end{verbatim} --- 1812,1819 ---- \begin{verbatim} from distutils.core import setup ! setup(name='foobar', ! version='1.0', ! ext_modules=[Extension('foopkg.foo', ['foo.c'])], ! ) \end{verbatim} From fdrake at users.sourceforge.net Tue Mar 23 14:02:40 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 23 14:13:05 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4173 Modified Files: dist.tex Log Message: give the document indexes Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** dist.tex 23 Mar 2004 18:54:12 -0000 1.69 --- dist.tex 23 Mar 2004 19:02:38 -0000 1.70 *************** *** 21,24 **** --- 21,25 ---- \makeindex + \makemodindex \begin{document} *************** *** 3479,3482 **** --- 3480,3498 ---- defined. The canonical example is the \command{install} command. + % + % The ugly "%begin{latexonly}" pseudo-environments are really just to + % keep LaTeX2HTML quiet during the \renewcommand{} macros; they're + % not really valuable. + % + + %begin{latexonly} + \renewcommand{\indexname}{Module Index} + %end{latexonly} + \input{modlib.ind} % Module Index + + %begin{latexonly} + \renewcommand{\indexname}{Index} + %end{latexonly} + \input{lib.ind} % Index \end{document} From gvanrossum at users.sourceforge.net Tue Mar 23 14:19:24 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Mar 23 14:29:49 2004 Subject: [Python-checkins] python/dist/src/Lib profile.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8093 Modified Files: profile.py Log Message: Add runctx to __all__. Index: profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** profile.py 23 Mar 2004 18:44:39 -0000 1.53 --- profile.py 23 Mar 2004 19:19:21 -0000 1.54 *************** *** 42,46 **** from optparse import OptionParser ! __all__ = ["run","help","Profile"] # Sample timer for use with --- 42,46 ---- from optparse import OptionParser ! __all__ = ["run", "runctx", "help", "Profile"] # Sample timer for use with From fdrake at users.sourceforge.net Tue Mar 23 14:26:57 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 23 14:37:23 2004 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.272,1.273 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9701 Modified Files: Makefile Log Message: add the distutils modules to the global modules list Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.272 retrieving revision 1.273 diff -C2 -d -r1.272 -r1.273 *** Makefile 1 Oct 2003 18:49:55 -0000 1.272 --- Makefile 23 Mar 2004 19:26:54 -0000 1.273 *************** *** 362,370 **** html/modindex.html: $(TOOLSDIR)/support.py $(TOOLSDIR)/mkmodindex html/modindex.html: html/lib/lib.html html/mac/mac.html cd html && \ ! $(PYTHON) ../$(TOOLSDIR)/mkmodindex --columns 4 \ --output modindex.html --address $(PYTHONDOCS) \ --favicon icons/pyfav.gif \ lib/modindex.html mac/modindex.html --- 362,372 ---- html/modindex.html: $(TOOLSDIR)/support.py $(TOOLSDIR)/mkmodindex + html/modindex.html: html/dist/dist.html html/modindex.html: html/lib/lib.html html/mac/mac.html cd html && \ ! $(PYTHON) ../$(TOOLSDIR)/mkmodindex --columns 3 \ --output modindex.html --address $(PYTHONDOCS) \ --favicon icons/pyfav.gif \ + dist/modindex.html \ lib/modindex.html mac/modindex.html From fdrake at users.sourceforge.net Tue Mar 23 15:31:01 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 23 15:41:25 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libprofile.tex,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24675 Modified Files: libprofile.tex Log Message: fix markup nits Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** libprofile.tex 23 Mar 2004 18:44:39 -0000 1.45 --- libprofile.tex 23 Mar 2004 20:30:59 -0000 1.46 *************** *** 362,366 **** \stmodindex{pstats} ! \begin{classdesc}{Stats}{filename\optional{, ...}} This class constructor creates an instance of a ``statistics object'' from a \var{filename} (or set of filenames). \class{Stats} objects are --- 362,366 ---- \stmodindex{pstats} ! \begin{classdesc}{Stats}{filename\optional{, \moreargs}} This class constructor creates an instance of a ``statistics object'' from a \var{filename} (or set of filenames). \class{Stats} objects are *************** *** 399,403 **** ! \begin{methoddesc}[Stats]{add}{filename\optional{, ...}} This method of the \class{Stats} class accumulates additional profiling information into the current profiling object. Its --- 399,403 ---- ! \begin{methoddesc}[Stats]{add}{filename\optional{, \moreargs}} This method of the \class{Stats} class accumulates additional profiling information into the current profiling object. Its *************** *** 416,420 **** \end{methoddesc} ! \begin{methoddesc}[Stats]{sort_stats}{key\optional{, ...}} This method modifies the \class{Stats} object by sorting it according to the supplied criteria. The argument is typically a string --- 416,420 ---- \end{methoddesc} ! \begin{methoddesc}[Stats]{sort_stats}{key\optional{, \moreargs}} This method modifies the \class{Stats} object by sorting it according to the supplied criteria. The argument is typically a string *************** *** 552,556 **** enough measurements are taken, then the ``error'' will tend to average out. Unfortunately, removing this first error induces a second source ! of error... The second problem is that it ``takes a while'' from when an event is --- 552,556 ---- enough measurements are taken, then the ``error'' will tend to average out. Unfortunately, removing this first error induces a second source ! of error. The second problem is that it ``takes a while'' from when an event is From bcannon at users.sourceforge.net Tue Mar 23 16:26:42 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Mar 23 16:37:56 2004 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.160,1.161 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5420/Lib Modified Files: urllib.py Log Message: Replace code in urllib for basejoin (undocumented) with urlparse.urljoin . Test suites for urllib and urlparse run with each other's function to verify correctness of replacement and both test suites pass. Bumped urllib's __version__ attribute up a minor number. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** urllib.py 12 Feb 2004 17:35:07 -0000 1.160 --- urllib.py 23 Mar 2004 21:26:39 -0000 1.161 *************** *** 28,31 **** --- 28,32 ---- import time import sys + from urlparse import urljoin as basejoin __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", *************** *** 37,41 **** "splitgophertype", "getproxies"] ! __version__ = '1.15' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size --- 38,42 ---- "splitgophertype", "getproxies"] ! __version__ = '1.16' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size *************** *** 846,907 **** - def basejoin(base, url): - """Utility to combine a URL with a base URL to form a new URL.""" - type, path = splittype(url) - if type: - # if url is complete (i.e., it contains a type), return it - return url - host, path = splithost(path) - type, basepath = splittype(base) # inherit type from base - if host: - # if url contains host, just inherit type - if type: return type + '://' + host + path - else: - # no type inherited, so url must have started with // - # just return it - return url - host, basepath = splithost(basepath) # inherit host - basepath, basetag = splittag(basepath) # remove extraneous cruft - basepath, basequery = splitquery(basepath) # idem - if path[:1] != '/': - # non-absolute path name - if path[:1] in ('#', '?'): - # path is just a tag or query, attach to basepath - i = len(basepath) - else: - # else replace last component - i = basepath.rfind('/') - if i < 0: - # basepath not absolute - if host: - # host present, make absolute - basepath = '/' - else: - # else keep non-absolute - basepath = '' - else: - # remove last file component - basepath = basepath[:i+1] - # Interpret ../ (important because of symlinks) - while basepath and path[:3] == '../': - path = path[3:] - i = basepath[:-1].rfind('/') - if i > 0: - basepath = basepath[:i+1] - elif i == 0: - basepath = '/' - break - else: - basepath = '' - - path = basepath + path - if host and path and path[0] != '/': - path = '/' + path - if type and host: return type + '://' + host + path - elif type: return type + ':' + path - elif host: return '//' + host + path # don't know what this means - else: return path - - # Utilities to parse URLs (most of these return None for missing parts): # unwrap('') --> 'type://host/path' --- 847,850 ---- From fdrake at users.sourceforge.net Tue Mar 23 16:40:10 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 23 16:50:58 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libprofile.tex,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8995 Modified Files: libprofile.tex Log Message: more markup nits Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** libprofile.tex 23 Mar 2004 20:30:59 -0000 1.46 --- libprofile.tex 23 Mar 2004 21:40:07 -0000 1.47 *************** *** 105,110 **** rapidly perform profiling on an existing application. ! To profile an application with a main entry point of \samp{foo()}, you ! would add the following to your module: \begin{verbatim} --- 105,110 ---- rapidly perform profiling on an existing application. ! To profile an application with a main entry point of \function{foo()}, ! you would add the following to your module: \begin{verbatim} *************** *** 113,117 **** \end{verbatim} ! The above action would cause \samp{foo()} to be run, and a series of informative lines (the profile) to be printed. The above approach is most useful when working with the interpreter. If you would like to --- 113,117 ---- \end{verbatim} ! The above action would cause \function{foo()} to be run, and a series of informative lines (the profile) to be printed. The above approach is most useful when working with the interpreter. If you would like to *************** *** 138,143 **** \end{verbatim} ! \samp{-s} only applies to stdout (i.e. \samp{-o} is not supplied. ! Look in the \class{Stats} documentation for valid sort values. When you wish to review the profile, you should use the methods in the --- 138,144 ---- \end{verbatim} ! \programopt{-s} only applies to standard output (\programopt{-o} is ! not supplied). Look in the \class{Stats} documentation for valid sort ! values. When you wish to review the profile, you should use the methods in the *************** *** 152,156 **** The class \class{Stats} (the above code just created an instance of this class) has a variety of methods for manipulating and printing the ! data that was just read into \samp{p}. When you ran \function{profile.run()} above, what was printed was the result of three method calls: --- 153,157 ---- The class \class{Stats} (the above code just created an instance of this class) has a variety of methods for manipulating and printing the ! data that was just read into \code{p}. When you ran \function{profile.run()} above, what was printed was the result of three method calls: *************** *** 200,205 **** This will sort all the statistics by file name, and then print out ! statistics for only the class init methods ('cause they are spelled ! with \samp{__init__} in them). As one final example, you could try: \begin{verbatim} --- 201,206 ---- This will sort all the statistics by file name, and then print out ! statistics for only the class init methods (since they are spelled ! with \code{__init__} in them). As one final example, you could try: \begin{verbatim} *************** *** 214,218 **** If you wondered what functions called the above functions, you could ! now (\samp{p} is still sorted according to the last criteria) do: \begin{verbatim} --- 215,219 ---- If you wondered what functions called the above functions, you could ! now (\code{p} is still sorted according to the last criteria) do: \begin{verbatim} *************** *** 424,428 **** When more than one key is provided, then additional keys are used as secondary criteria when there is equality in all keys selected ! before them. For example, \samp{sort_stats('name', 'file')} will sort all the entries according to their function name, and resolve all ties (identical function names) by sorting by file name. --- 425,429 ---- When more than one key is provided, then additional keys are used as secondary criteria when there is equality in all keys selected ! before them. For example, \code{sort_stats('name', 'file')} will sort all the entries according to their function name, and resolve all ties (identical function names) by sorting by file name. *************** *** 496,500 **** would first limit the printing to first 10\% of list, and then only ! print functions that were part of filename \samp{.*foo:}. In contrast, the command: --- 497,501 ---- would first limit the printing to first 10\% of list, and then only ! print functions that were part of filename \file{.*foo:}. In contrast, the command: *************** *** 503,507 **** \end{verbatim} ! would limit the list to all functions having file names \samp{.*foo:}, and then proceed to only print the first 10\% of them. \end{methoddesc} --- 504,508 ---- \end{verbatim} ! would limit the list to all functions having file names \file{.*foo:}, and then proceed to only print the first 10\% of them. \end{methoddesc} From bcannon at users.sourceforge.net Tue Mar 23 18:16:56 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Mar 23 18:27:23 2004 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.285, 1.286 socketmodule.h, 1.11, 1.12 _ssl.c, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32400/Modules Modified Files: socketmodule.c socketmodule.h _ssl.c Log Message: Make socket.sslerror a subclass of socket.error . Added socket.error to the socket module's C API. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.285 retrieving revision 1.286 diff -C2 -d -r1.285 -r1.286 *** socketmodule.c 16 Feb 2004 05:35:28 -0000 1.285 --- socketmodule.c 23 Mar 2004 23:16:53 -0000 1.286 *************** *** 3560,3563 **** --- 3560,3564 ---- { &sock_type, + NULL }; *************** *** 3597,3600 **** --- 3598,3602 ---- if (socket_error == NULL) return; + PySocketModuleAPI.error = socket_error; Py_INCREF(socket_error); PyModule_AddObject(m, "error", socket_error); Index: socketmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** socketmodule.h 2 Feb 2004 08:48:45 -0000 1.11 --- socketmodule.h 23 Mar 2004 23:16:54 -0000 1.12 *************** *** 161,164 **** --- 161,165 ---- typedef struct { PyTypeObject *Sock_Type; + PyObject *error; } PySocketModule_APIObject; Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** _ssl.c 27 Oct 2003 14:24:37 -0000 1.15 --- _ssl.c 23 Mar 2004 23:16:54 -0000 1.16 *************** *** 610,614 **** /* Add symbols to module dict */ ! PySSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); if (PySSLErrorObject == NULL) return; --- 610,616 ---- /* Add symbols to module dict */ ! PySSLErrorObject = PyErr_NewException("socket.sslerror", ! PySocketModule.error, ! NULL); if (PySSLErrorObject == NULL) return; From bcannon at users.sourceforge.net Tue Mar 23 18:16:55 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Mar 23 18:27:27 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.959,1.960 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32400/Misc Modified Files: NEWS Log Message: Make socket.sslerror a subclass of socket.error . Added socket.error to the socket module's C API. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.959 retrieving revision 1.960 diff -C2 -d -r1.959 -r1.960 *** NEWS 23 Mar 2004 18:44:39 -0000 1.959 --- NEWS 23 Mar 2004 23:16:52 -0000 1.960 *************** *** 196,199 **** --- 196,202 ---- ----------------- + - socket.sslerror is now a subclass of socket.error . Also added + socket.error to the socket module's C API. + - Bug #920575: A problem that _locale module segfaults on nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed. From mondragon at users.sourceforge.net Tue Mar 23 18:29:04 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue Mar 23 18:39:29 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.260,1.261 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2379 Modified Files: ACKS Log Message: ...for work done at PyCon 2004 (and beyond...) Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.260 retrieving revision 1.261 diff -C2 -d -r1.260 -r1.261 *** ACKS 4 Mar 2004 08:25:44 -0000 1.260 --- ACKS 23 Mar 2004 23:29:01 -0000 1.261 *************** *** 37,40 **** --- 37,41 ---- Des Barry Ulf Bartelt + Nick Bastin Jeff Bauer Anthony Baxter From loewis at users.sourceforge.net Tue Mar 23 18:40:38 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Mar 23 18:51:05 2004 Subject: [Python-checkins] python/dist/src/Lib/encodings idna.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4649/Lib/encodings Modified Files: idna.py Log Message: Convert input to a string object. Fixes #909230. Backported 2.3. Index: idna.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/idna.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** idna.py 5 Aug 2003 06:19:47 -0000 1.3 --- idna.py 23 Mar 2004 23:40:36 -0000 1.4 *************** *** 172,175 **** --- 172,176 ---- else: # Must be ASCII string + input = str(input) unicode(input, "ascii") labels = input.split(".") From loewis at users.sourceforge.net Tue Mar 23 18:42:57 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Mar 23 18:53:23 2004 Subject: [Python-checkins] python/dist/src/Lib/encodings idna.py, 1.2.12.1, 1.2.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4992/Lib/encodings Modified Files: Tag: release23-maint idna.py Log Message: Convert input to a string object. Fixes #909230. Index: idna.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/idna.py,v retrieving revision 1.2.12.1 retrieving revision 1.2.12.2 diff -C2 -d -r1.2.12.1 -r1.2.12.2 *** idna.py 5 Aug 2003 06:20:23 -0000 1.2.12.1 --- idna.py 23 Mar 2004 23:42:54 -0000 1.2.12.2 *************** *** 172,175 **** --- 172,176 ---- else: # Must be ASCII string + input = str(input) unicode(input, "ascii") labels = input.split(".") From bcannon at users.sourceforge.net Tue Mar 23 18:50:19 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Mar 23 19:00:44 2004 Subject: [Python-checkins] python/dist/src/Lib locale.py, 1.25, 1.26 urllib.py, 1.161, 1.162 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7115/Lib Modified Files: locale.py urllib.py Log Message: Replace sequential split/join calls on strings with a single replace call. Thanks Andrew Gaul. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** locale.py 30 Mar 2003 15:42:13 -0000 1.25 --- locale.py 23 Mar 2004 23:50:16 -0000 1.26 *************** *** 160,175 **** return format("%.12g",val) ! def atof(str,func=float): "Parses a string as a float according to the locale settings." #First, get rid of the grouping ts = localeconv()['thousands_sep'] if ts: ! s=str.split(ts) ! str="".join(s) #next, replace the decimal point with a dot dd = localeconv()['decimal_point'] if dd: ! s=str.split(dd) ! str='.'.join(s) #finally, parse the string return func(str) --- 160,173 ---- return format("%.12g",val) ! def atof(string,func=float): "Parses a string as a float according to the locale settings." #First, get rid of the grouping ts = localeconv()['thousands_sep'] if ts: ! str = str.replace(ts, '') #next, replace the decimal point with a dot dd = localeconv()['decimal_point'] if dd: ! str = str.replace(dd, '.') #finally, parse the string return func(str) Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** urllib.py 23 Mar 2004 21:26:39 -0000 1.161 --- urllib.py 23 Mar 2004 23:50:17 -0000 1.162 *************** *** 170,176 **** name = 'open_' + urltype self.type = urltype ! if '-' in name: ! # replace - with _ ! name = '_'.join(name.split('-')) if not hasattr(self, name): if proxy: --- 170,174 ---- name = 'open_' + urltype self.type = urltype ! name = name.replace('-', '_') if not hasattr(self, name): if proxy: *************** *** 1046,1052 **** def unquote_plus(s): """unquote('%7e/abc+def') -> '~/abc def'""" ! if '+' in s: ! # replace '+' with ' ' ! s = ' '.join(s.split('+')) return unquote(s) --- 1044,1048 ---- def unquote_plus(s): """unquote('%7e/abc+def') -> '~/abc def'""" ! s = s.replace('+', ' ') return unquote(s) From 03mlbj at nikocity.de Tue Mar 23 17:29:15 2004 From: 03mlbj at nikocity.de (Ahmed North) Date: Tue Mar 23 19:37:36 2004 Subject: [Python-checkins] The complete A-Z affiliate program aid lxrlaob wnou Message-ID: <1$9a-h62sbc8u-9e$11t4u$n@5ott182h.0g.3a> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040323/3814e733/attachment.html From facundobatista at users.sourceforge.net Tue Mar 23 20:57:51 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Tue Mar 23 21:08:18 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv841 Modified Files: test_Decimal.py Log Message: Added arithmetic operators test and corrected minor method case issues. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_Decimal.py 20 Mar 2004 19:33:07 -0000 1.10 --- test_Decimal.py 24 Mar 2004 01:57:49 -0000 1.11 *************** *** 15,20 **** """ ! # 0.1.1 2003.3.11 facundobatista: Added Explicit Construction tests ! # 0.1.0 2003.3.11 facundobatista: Placed the structure to run separate test groups # ToDo: --- 15,25 ---- """ ! # 0.1.3 2003.3.23 facundobatista: Added arithmetic operators test and corrected ! # minor method case issues. ! # 0.1.2 2003.3.20 facundobatista: Added from_float to explicit construction test ! # cases and all implicit construction test cases. Also upgraded ! # method names to new GvR definiton. ! # 0.1.1 2003.3.11 facundobatista: Added Explicit Construction tests ! # 0.1.0 2003.3.11 facundobatista: Placed the structure to run separate test groups # ToDo: *************** *** 22,25 **** --- 27,32 ---- # Add the behaviour tests according to the PEP + from __future__ import division + import unittest import glob *************** *** 633,637 **** pass ! def testIC_FromFloat(self): '''Implicit construction with float.''' d = Decimal(5) --- 640,644 ---- pass ! def test_from_float(self): '''Implicit construction with float.''' d = Decimal(5) *************** *** 643,647 **** pass ! def testIC_FromDecimal(self): '''Implicit construction with Decimal.''' --- 650,654 ---- pass ! def test_from_Decimal(self): '''Implicit construction with Decimal.''' *************** *** 653,656 **** --- 660,905 ---- + class DecimalArithmeticOperatorsTest(unittest.TestCase): + '''Unit tests for all arithmetic operators, binary and unary.''' + + def test_addition(self): + '''Test addition in all its ways.''' + + d1 = Decimal('-11.1') + d2 = Decimal('22.2') + + #two Decimals + self.assertEqual(d1+d2, Decimal('11.1')) + self.assertEqual(d2+d1, Decimal('11.1')) + + #with other type, left + c = d1 + 5 + self.assertEqual(c, Decimal('-6.1')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 5 + d1 + self.assertEqual(c, Decimal('-6.1')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 += d2 + self.assertEqual(d1, Decimal('11.1')) + + #inline with other type + d1 += 5 + self.assertEqual(d1, Decimal('-6.1')) + + def test_subtraction(self): + '''Test subtraction in all its ways.''' + + d1 = Decimal('-11.1') + d2 = Decimal('22.2') + + #two Decimals + self.assertEqual(d1-d2, Decimal('-33.3')) + self.assertEqual(d2-d1, Decimal('33.3')) + + #with other type, left + c = d1 - 5 + self.assertEqual(c, Decimal('-16.1')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 5 - d1 + self.assertEqual(c, Decimal('6.1')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 -= d2 + self.assertEqual(d1, Decimal('-33.3')) + + #inline with other type + d1 -= 5 + self.assertEqual(d1, Decimal('-16.1')) + + def test_multiplication(self): + '''Test multiplication in all its ways.''' + + d1 = Decimal('-5') + d2 = Decimal('3') + + #two Decimals + self.assertEqual(d1*d2, Decimal('-15')) + self.assertEqual(d2*d1, Decimal('-15')) + + #with other type, left + c = d1 * 5 + self.assertEqual(c, Decimal('-25')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 5 * d1 + self.assertEqual(c, Decimal('-25')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 *= d2 + self.assertEqual(d1, Decimal('-15')) + + #inline with other type + d1 *= 5 + self.assertEqual(d1, Decimal('-25')) + + def test_division(self): + '''Test division in all its ways.''' + + d1 = Decimal('-5') + d2 = Decimal('2') + + #two Decimals + self.assertEqual(d1/d2, Decimal('-2.5')) + self.assertEqual(d2/d1, Decimal('-0.4')) + + #with other type, left + c = d1 / 4 + self.assertEqual(c, Decimal('-1.25')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 4 / d1 + self.assertEqual(c, Decimal('-0.8')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 /= d2 + self.assertEqual(d1, Decimal('-2.5')) + + #inline with other type + d1 /= 4 + self.assertEqual(d1, Decimal('-1.25')) + + def test_floor_division(self): + '''Test floor division in all its ways.''' + + d1 = Decimal('5') + d2 = Decimal('2') + + #two Decimals + self.assertEqual(d1//d2, Decimal('2')) + self.assertEqual(d2//d1, Decimal('0')) + + #with other type, left + c = d1 // 4 + self.assertEqual(c, Decimal('1')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 7 // d1 + self.assertEqual(c, Decimal('1')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 /= d2 + self.assertEqual(d1, Decimal('2')) + + #inline with other type + d1 /= 4 + self.assertEqual(d1, Decimal('1')) + + def test_powering(self): + '''Test powering in all its ways.''' + + d1 = Decimal('5') + d2 = Decimal('2') + + #two Decimals + self.assertEqual(d1**d2, Decimal('25')) + self.assertEqual(d2**d1, Decimal('32')) + + #with other type, left + c = d1 ** 4 + self.assertEqual(c, Decimal('625')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 7 ** d1 + self.assertEqual(c, Decimal('16807')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 **= d2 + self.assertEqual(d1, Decimal('25')) + + #inline with other type + d1 **= 4 + self.assertEqual(d1, Decimal('625')) + + def test_module(self): + '''Test module in all its ways.''' + + d1 = Decimal('5') + d2 = Decimal('2') + + #two Decimals + self.assertEqual(d1%d2, Decimal('1')) + self.assertEqual(d2%d1, Decimal('2')) + + #with other type, left + c = d1 % 4 + self.assertEqual(c, Decimal('1')) + self.assertEqual(type(c), type(d1)) + + #with other type, right + c = 7 % d1 + self.assertEqual(c, Decimal('2')) + self.assertEqual(type(c), type(d1)) + + #inline with decimal + d1 %= d2 + self.assertEqual(d1, Decimal('1')) + + #inline with other type + d1 %= 4 + self.assertEqual(d1, Decimal('1')) + + def test_floor_div_module(self): + '''Test floor division with module in all its ways.''' + + d1 = Decimal('5') + d2 = Decimal('2') + + #two Decimals + (p, q) = divmod(d1, d2) + self.assertEqual(p, Decimal('2')) + self.assertEqual(q, Decimal('1')) + self.assertEqual(type(p), type(d1)) + self.assertEqual(type(q), type(d1)) + + #with other type, left + (p, q) = divmod(d1, 4) + self.assertEqual(p, Decimal('1')) + self.assertEqual(q, Decimal('1')) + self.assertEqual(type(p), type(d1)) + self.assertEqual(type(q), type(d1)) + + #with other type, right + (p, q) = divmod(7, d1) + self.assertEqual(p, Decimal('1')) + self.assertEqual(q, Decimal('2')) + self.assertEqual(type(p), type(d1)) + self.assertEqual(type(q), type(d1)) + + def test_unary_operators(self): + '''Testing -, +, abs.''' + + #test '+' + d = Decimal(45) + self.assertEqual(+d, d) + self.assertEqual(id(+d), id(d)) + + #test '-' + self.assertEqual(-Decimal(45), Decimal(-45)) + + #test abs + self.assertEqual(abs(Decimal(45)), abs(Decimal(-45))) + + + def test_main(which=None): """ Execute the tests. *************** *** 661,671 **** """ ! if which == "Arithmetic": ! run_unittest(DecimalTest) ! elif which == "Behaviour": ! run_unittest(DecimalExplicitConstructionTest) ! else: run_unittest(DecimalTest) run_unittest(DecimalExplicitConstructionTest) return --- 910,920 ---- """ ! if which == "Arithmetic" or which is None: run_unittest(DecimalTest) + + if which == "Behaviour" or which is None: run_unittest(DecimalExplicitConstructionTest) + run_unittest(DecimalImplicitConstructionTest) + run_unittest(DecimalArithmeticOperatorsTest) return From bwarsaw at users.sourceforge.net Tue Mar 23 22:08:04 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue Mar 23 22:18:33 2004 Subject: [Python-checkins] python/nondist/peps pep-0292.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12811 Modified Files: pep-0292.txt Log Message: Updated based on recent Pycon discussions, with a pointer to the SF patch containing the reference implementation. Index: pep-0292.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0292.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0292.txt 22 Sep 2003 04:51:50 -0000 1.6 --- pep-0292.txt 24 Mar 2004 03:08:02 -0000 1.7 *************** *** 7,12 **** Type: Standards Track Created: 18-Jun-2002 ! Python-Version: 2.3 ! Post-History: 18-Jun-2002 --- 7,12 ---- Type: Standards Track Created: 18-Jun-2002 ! Python-Version: 2.4 ! Post-History: 18-Jun-2002, 23-Mar-2004 *************** *** 17,23 **** respects: ! 1. Python's current string substitution feature (commonly known as ! %-substitutions) is complicated and error prone. This PEP is ! simpler at the cost of less expressiveness. 2. PEP 215 proposed an alternative string interpolation feature, --- 17,23 ---- respects: ! 1. Python's current string substitution feature ! (i.e. %-substitution) is complicated and error prone. This PEP ! is simpler at the cost of some expressiveness. 2. PEP 215 proposed an alternative string interpolation feature, *************** *** 25,44 **** this because it involves no syntax changes and has much simpler rules for what substitutions can occur in the string. ! Rationale ! Python currently supports a string substitution (a.k.a. string ! interpolation) syntax based on C's printf() % formatting ! character[1]. While quite rich, %-formatting codes are also quite ! error prone, even for experienced Python programmers. A common ! mistake is to leave off the trailing format character, e.g. the ! `s' in "%(name)s". In addition, the rules for what can follow a % sign are fairly ! complex, while the usual application rarely needs such ! complexity. Also error prone is the right-hand side of the % ! operator: e.g. singleton tuples. ! Most scripts need to do some string interpolation, but most of those use simple `stringification' formats, i.e. %s or %(name)s --- 25,40 ---- this because it involves no syntax changes and has much simpler rules for what substitutions can occur in the string. ! Rationale ! Python currently supports a string substitution syntax based on ! C's printf() '%' formatting character[1]. While quite rich, ! %-formatting codes are also error prone, even for ! experienced Python programmers. A common mistake is to leave off ! the trailing format character, e.g. the `s' in "%(name)s". In addition, the rules for what can follow a % sign are fairly ! complex, while the usual application rarely needs such complexity. Most scripts need to do some string interpolation, but most of those use simple `stringification' formats, i.e. %s or %(name)s *************** *** 48,54 **** A Simpler Proposal ! Here we propose the addition of a new string method, called .sub() ! which performs substitution of mapping values into a string with ! special substitution placeholders. These placeholders are introduced with the $ character. The following rules for $-placeholders apply: --- 44,50 ---- A Simpler Proposal ! We propose the addition of a new class -- called 'dstring' -- ! derived from the built-in unicode type, which supports new rules ! for string substitution. dstring's value contains placeholders, introduced with the $ character. The following rules for $-placeholders apply: *************** *** 57,63 **** 2. $identifier names a substitution placeholder matching a mapping ! key of "identifier". "identifier" must be a Python identifier ! as defined in [2]. The first non-identifier character after ! the $ character terminates this placeholder specification. 3. ${identifier} is equivalent to $identifier. It is required for --- 53,60 ---- 2. $identifier names a substitution placeholder matching a mapping ! key of "identifier". By default, "identifier" must spell a ! Python identifier as defined in [2]. The first non-identifier ! character after the $ character terminates this placeholder ! specification. 3. ${identifier} is equivalent to $identifier. It is required for *************** *** 65,94 **** not part of the placeholder, e.g. "${noun}ification". ! No other characters have special meaning. ! ! The .sub() method takes an optional mapping (e.g. dictionary) ! where the keys match placeholders in the string, and the values ! are substituted for the placeholders. For example: ! ! '${name} was born in ${country}'.sub({'name': 'Guido', ! 'country': 'the Netherlands'}) ! ! returns ! ! 'Guido was born in the Netherlands' ! ! The mapping argument is optional; if it is omitted then the ! mapping is taken from the locals and globals of the context in ! which the .sub() method is executed. For example: ! ! def birth(self, name): ! country = self.countryOfOrigin[name] ! return '${name} was born in ${country}'.sub() ! ! birth('Guido') ! returns ! 'Guido was born in the Netherlands' --- 62,78 ---- not part of the placeholder, e.g. "${noun}ification". ! No other characters have special meaning, however it is possible ! to derive from the dstring class to define different rules for the ! placeholder. For example, a derived class could allow for periods ! in the placeholder (e.g. to support a kind of dynamic namespace ! and attribute path lookup). ! Once the dstring has been created, substitutions can be performed ! using traditional Python syntax. For example: ! >>> mapping = dict(name='Guido', country='the Netherlands') ! >>> s = dstring('${name} was born in ${country}) ! >>> print s % mapping ! Guido was born in the Netherlands *************** *** 96,271 **** The BDFL said it best: The $ means "substitution" in so many ! languages besides Perl that I wonder where you've been. [...] We're copying this from the shell. - Security Issues - - Never use no-arg .sub() on strings that come from untrusted - sources. It could be used to gain unauthorized information about - variables in your local or global scope. - - Reference Implementation ! Here's a Python 2.2-based reference implementation. Of course the ! real implementation would be in C, would not require a string ! subclass, and would not be modeled on the existing %-interpolation ! feature. ! ! import sys ! import re ! ! class dstr(str): ! def sub(self, mapping=None): ! # Default mapping is locals/globals of caller ! if mapping is None: ! frame = sys._getframe(1) ! mapping = frame.f_globals.copy() ! mapping.update(frame.f_locals) ! def repl(m): ! return mapping[m.group(m.lastindex)] ! return re.sub(r'\$(?:([_a-z]\w*)|\{([_a-z]\w*)\})', repl, self) ! ! And here are some examples: ! ! s = dstr('${name} was born in ${country}') ! print s.sub({'name': 'Guido', ! 'country': 'the Netherlands'}) ! ! name = 'Barry' ! country = 'the USA' ! print s.sub() ! ! This will print "Guido was born in the Netherlands" followed by ! "Barry was born in the USA". ! ! ! Handling Missing Keys ! ! What should happen when one of the substitution keys is missing ! from the mapping (or the locals/globals namespace if no argument ! is given)? There are two possibilities: ! ! - We can simply allow the exception. ! ! - We can return the original substitution placeholder unchanged. ! ! An example of the first is: ! ! print dstr('${name} was born in ${country}').sub({'name': 'Bob'}) ! ! would raise: ! ! Traceback (most recent call last): ! File "sub.py", line 66, in ? ! print s.sub({'name': 'Bob'}) ! File "sub.py", line 26, in sub ! return EMPTYSTRING.join(filter(None, parts)) % mapping ! KeyError: country ! ! An example of the second is: ! ! print dstr('${name} was born in ${country}').sub({'name': 'Bob'}) ! ! would print: ! ! Bob was born in ${country} ! ! We could almost ignore the issue, since the latter example could ! be accomplished by passing in a "safe-dictionary" in instead of a ! normal dictionary, like so: ! ! class safedict(dict): ! def __getitem__(self, key): ! try: ! return dict.__getitem__(self, key) ! except KeyError: ! return '${%s}' % key ! ! so that ! ! d = safedict({'name': 'Bob'}) ! print dstr('${name} was born in ${country}').sub(d) ! ! would print: ! ! Bob was born in ${country} ! ! The one place where this won't work is when no arguments are given ! to the .sub() method. .sub() wouldn't know whether to wrap ! locals/globals in a safedict or not. ! ! This ambiguity can be solved in several ways: ! ! - we could have a parallel method called .safesub() which always ! wrapped its argument in a safedict() ! ! - .sub() could take an optional keyword argument flag which ! indicates whether to wrap the argument in a safedict or not. ! ! - .sub() could take an optional keyword argument which is a ! callable that would get called with the original mapping and ! return the mapping to be used for the substitution. By default, ! this callable would be the identity function, but you could ! easily pass in the safedict constructor instead. ! ! BDFL proto-pronouncement: Strongly in favor of raising the ! exception, with KeyError when a dict is used and NameError when ! locals/globals are used. There may not be sufficient use case for ! soft failures in the no-argument version. ! ! ! Open Issues, Comments, and Suggestions ! ! - Ka-Ping Yee makes the suggestion that .sub() should take keyword ! arguments instead of a dictionary, and that if a dictionary was ! to be passed in it should be done with **dict. For example: ! ! s = '${name} was born in ${country}' ! print s.sub(name='Guido', country='the Netherlands') ! ! or ! ! print s.sub(**{'name': 'Guido', 'country': 'the Netherlands'}) ! ! - Paul Prescod wonders whether having a method use sys._getframe() ! doesn't set a bad precedent. ! ! - Oren Tirosh suggests that .sub() take an optional argument which ! would be used as a default for missing keys. If the optional ! argument were not given, an exception would be raised. This may ! not play well with Ka-Ping's suggestion. ! ! - Other suggestions have been made as an alternative to a string ! method including: a builtin function, a function in a module, an ! operator (similar to "string % dict", e.g. "string / dict"). ! One strong argument for making it a built-in is given by Paul ! Prescod: ! ! "I really hate putting things in modules that will be needed in ! a Python programmer's second program (the one after "Hello ! world"). If this is to be the *simpler* way of doing ! introspection then getting at it should be simpler than getting ! at "%". $ is taught in hour 2, import is taught on day 2. ! Some people may never make it to the metaphorical day 2 if they ! are doing simple text processing in some kind of ! embedded-Python environment." ! ! - Should we take a cue from the `make' program and allow $(name) ! as an alternative (or instead of) ${name}? ! ! - Should we require a dictionary to the .sub() method? Some ! people feel that it could be a security risk allowing implicit ! access to globals/locals, even with the proper admonitions in ! the documentation. In that case, a new built-in would be ! necessary (because none of globals(), locals(), or vars() does ! the right the w.r.t. nested scopes, etc.). Chirstian Tismer ! has suggested allvars(). Perhaps allvars() should be a method ! on a frame object (too?)? ! ! - It has been suggested that using $ at all violates TOOWTDI. ! Some other suggestions include using the % sign in the ! following way: %{name} --- 80,94 ---- The BDFL said it best: The $ means "substitution" in so many ! languages besides Perl that I wonder where you've been. [...] We're copying this from the shell. Reference Implementation ! A reference implementation is available at [4]. The ! implementation contains the dstring class described above, ! situated in a new standard library package called 'stringlib'. ! Inside the reference implementation stringlib package are a few ! other related nifty tools that aren't described in this PEP. *************** *** 275,279 **** Unlike that PEP, this one does not propose any new syntax for Python. All the proposed new features are embodied in a new ! string method. PEP 215 proposes a new string prefix representation such as $"" which signal to Python that a new type of string is present. $-strings would have to interact with the --- 98,102 ---- Unlike that PEP, this one does not propose any new syntax for Python. All the proposed new features are embodied in a new ! library module. PEP 215 proposes a new string prefix representation such as $"" which signal to Python that a new type of string is present. $-strings would have to interact with the *************** *** 284,328 **** $-strings, so that you could do things like: ! import sys ! print $"sys = $sys, sys = $sys.modules['sys']" which would return ! sys = , sys = ! It's generally accepted that the rules in PEP 215 are safe in the sense that they introduce no new security issues (see PEP 215, "Security Issues" for details). However, the rules are still ! quite complex, and make it more difficult to see what exactly is ! the substitution placeholder in the original $-string. ! ! By design, this PEP does not provide as much interpolation power ! as PEP 215, however it is expected that the no-argument version of ! .sub() allows at least as much power with no loss of readability. ! BDFL Weathervane - Guido lays out[3] what he feels are the real issues that need to - be fleshed out in this PEP: ! - Compile-time vs. run-time parsing. I've become convinced that ! the compiler should do the parsing: this is the only way to make ! access to variables in nested scopes work, avoids security ! issues, and makes it easier to diagnose errors (e.g. in ! PyChecker). ! - How to support translation. Here the template must be replaced ! at run-time, but it is still desirable that the collection of ! available names is known at compile time (to avoid the security ! issues). ! - Optional formatting specifiers. I agree with Lalo that these ! should not be part of the interpolation syntax but need to be ! dealt with at a different level. I think these are only ! relevant for numeric data. Funny, there's still a ! (now-deprecated) module fpformat.py that supports arbitrary ! floating point formatting, and string.zfill() supports a bit of ! integer formatting. --- 107,148 ---- $-strings, so that you could do things like: ! import sys ! print $"sys = $sys, sys = $sys.modules['sys']" which would return ! sys = , sys = ! It's generally accepted that the rules in PEP 215 are safe in the sense that they introduce no new security issues (see PEP 215, "Security Issues" for details). However, the rules are still ! quite complex, and make it more difficult to see the substitution ! placeholder in the original $-string. + The interesting thing is that the dstring class defined in this + PEP has nothing to say about the values that are substituted for + the placeholders. Thus, with a little extra work, it's possible + to support PEP 215's functionality using existing Python syntax. ! For example, one could define a subclass of dict that allowed a ! more complex placeholder syntax and a mapping that evaluated those ! placeholders. ! Internationalization ! The reference implementation accomplishes this magic by parsing ! the constructor string, transforming $-strings into standard ! Python %-strings. dstring caches this value and uses it whenever ! the special __mod__() method is called via the % operator. ! However the string value of a dstring is the string that was ! passed to its constructor. ! This approach allows a gettext-based internationalized program to ! use the dstring instance as a lookup into the catalog; in fact ! gettext doesn't care that the catalog key is a dstring. Because ! the value of the dstring is the original $-string, translators ! also never need to use %-strings. The right thing will happen at ! run-time. *************** *** 333,341 **** [2] Identifiers and Keywords ! http://www.python.org/doc/current/ref/identifiers.html [3] Guido's python-dev posting from 21-Jul-2002 http://mail.python.org/pipermail/python-dev/2002-July/026397.html Copyright --- 153,164 ---- [2] Identifiers and Keywords ! http://www.python.org/doc/current/ref/identifiers.html [3] Guido's python-dev posting from 21-Jul-2002 http://mail.python.org/pipermail/python-dev/2002-July/026397.html + [4] Reference implementation + http://sourceforge.net/tracker/index.php?func=detail&aid=922115&group_id=5470&atid=305470 + Copyright From bwarsaw at users.sourceforge.net Tue Mar 23 22:10:58 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue Mar 23 22:21:24 2004 Subject: [Python-checkins] python/nondist/peps pep-0320.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13372 Modified Files: pep-0320.txt Log Message: Minor PEP 292 update. Index: pep-0320.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0320.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0320.txt 21 Mar 2004 22:11:15 -0000 1.9 --- pep-0320.txt 24 Mar 2004 03:10:55 -0000 1.10 *************** *** 55,60 **** PEP 289 Generator expressions. ! PEP 292 Simpler String Substitutions to be implemented as a module ! or codec. PEP 318: Function/method decorator syntax --- 55,59 ---- PEP 289 Generator expressions. ! PEP 292 Simpler String Substitutions to be implemented as a module. PEP 318: Function/method decorator syntax From loewis at users.sourceforge.net Wed Mar 24 11:48:26 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Mar 24 11:59:00 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_codecs.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3366/Lib/test Modified Files: test_codecs.py Log Message: Add test case for unicode(somestring, "idna"). Index: test_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_codecs.py 1 May 2003 17:45:36 -0000 1.9 --- test_codecs.py 24 Mar 2004 16:48:24 -0000 1.10 *************** *** 333,336 **** --- 333,340 ---- raise test_support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) + class CodecTest(unittest.TestCase): + def test_builtin(self): + self.assertEquals(unicode("python.org", "idna"), u"python.org") + def test_main(): test_support.run_unittest( *************** *** 339,343 **** RecodingTest, PunycodeTest, ! NameprepTest ) --- 343,348 ---- RecodingTest, PunycodeTest, ! NameprepTest, ! CodecTest ) From mondragon at users.sourceforge.net Wed Mar 24 16:57:10 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 17:08:17 2004 Subject: [Python-checkins] python/dist/src/Lib bdb.py, 1.43, 1.44 profile.py, 1.54, 1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Lib Modified Files: bdb.py profile.py Log Message: Enable the profiling of C functions (builtins and extensions) Index: bdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bdb.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** bdb.py 12 Feb 2004 17:35:05 -0000 1.43 --- bdb.py 24 Mar 2004 21:57:08 -0000 1.44 *************** *** 53,56 **** --- 53,62 ---- if event == 'exception': return self.dispatch_exception(frame, arg) + if event == 'c_call': + return self.trace_dispatch + if event == 'c_exception': + return self.trace_dispatch + if event == 'c_return': + return self.trace_dispatch print 'bdb.Bdb.dispatch: unknown debugging event:', repr(event) return self.trace_dispatch Index: profile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/profile.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** profile.py 23 Mar 2004 19:19:21 -0000 1.54 --- profile.py 24 Mar 2004 21:57:08 -0000 1.55 *************** *** 164,167 **** --- 164,168 ---- self.cur = None self.cmd = "" + self.c_func_name = "" if bias is None: *************** *** 215,218 **** --- 216,222 ---- t = t[0] + t[1] - self.t - self.bias + if event == "c_call": + self.c_func_name = arg + if self.dispatch[event](self, frame,t): t = timer() *************** *** 228,232 **** timer = self.timer t = timer() - self.t - self.bias ! if self.dispatch[event](self, frame,t): self.t = timer() else: --- 232,240 ---- timer = self.timer t = timer() - self.t - self.bias ! ! if event == "c_call": ! self.c_func_name = arg ! ! if self.dispatch[event](self, frame, t): self.t = timer() else: *************** *** 239,242 **** --- 247,254 ---- timer = self.timer t = timer()/60.0 - self.t - self.bias + + if event == "c_call": + self.c_func_name = arg + if self.dispatch[event](self, frame, t): self.t = timer()/60.0 *************** *** 250,253 **** --- 262,268 ---- t = get_time() - self.t - self.bias + if event == "c_call": + self.c_func_name = arg + if self.dispatch[event](self, frame, t): self.t = get_time() *************** *** 292,295 **** --- 307,321 ---- return 1 + def trace_dispatch_c_call (self, frame, t): + fn = ("", 0, self.c_func_name) + self.cur = (t, 0, 0, fn, frame, self.cur) + timings = self.timings + if timings.has_key(fn): + cc, ns, tt, ct, callers = timings[fn] + timings[fn] = cc, ns+1, tt, ct, callers + else: + timings[fn] = 0, 0, 0, 0, {} + return 1 + def trace_dispatch_return(self, frame, t): if frame is not self.cur[-2]: *************** *** 334,337 **** --- 360,366 ---- "exception": trace_dispatch_exception, "return": trace_dispatch_return, + "c_call": trace_dispatch_c_call, + "c_exception": trace_dispatch_exception, + "c_return": trace_dispatch_return, } From mondragon at users.sourceforge.net Wed Mar 24 16:57:11 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 17:08:24 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_profilehooks.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Lib/test Modified Files: test_profilehooks.py Log Message: Enable the profiling of C functions (builtins and extensions) Index: test_profilehooks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profilehooks.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_profilehooks.py 1 May 2003 17:45:46 -0000 1.10 --- test_profilehooks.py 24 Mar 2004 21:57:08 -0000 1.11 *************** *** 12,16 **** def callback(self, frame, event, arg): ! self.add_event(event, frame) def add_event(self, event, frame=None): --- 12,19 ---- def callback(self, frame, event, arg): ! if (event == "call" ! or event == "return" ! or event == "exception"): ! self.add_event(event, frame) def add_event(self, event, frame=None): *************** *** 57,64 **** --- 60,73 ---- "the profiler should never receive exception events") + def trace_pass(self, frame): + pass + dispatch = { 'call': trace_call, 'exception': trace_exception, 'return': trace_return, + 'c_call': trace_pass, + 'c_return': trace_pass, + 'c_exception': trace_pass, } From mondragon at users.sourceforge.net Wed Mar 24 16:57:11 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 17:08:28 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_profile, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Lib/test/output Modified Files: test_profile Log Message: Enable the profiling of C functions (builtins and extensions) Index: test_profile =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_profile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_profile 22 Mar 2004 20:12:55 -0000 1.2 --- test_profile 24 Mar 2004 21:57:09 -0000 1.3 *************** *** 1,8 **** test_profile ! 53 function calls in 1.000 CPU seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 1.000 1.000 :1(?) 0 0.000 0.000 profile:0(profiler) --- 1,11 ---- test_profile ! 74 function calls in 1.000 CPU seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) + 12 0.000 0.000 0.012 0.001 :0(hasattr) + 8 0.000 0.000 0.000 0.000 :0(range) + 1 0.000 0.000 0.000 0.000 :0(setprofile) 1 0.000 0.000 1.000 1.000 :1(?) 0 0.000 0.000 profile:0(profiler) From mondragon at users.sourceforge.net Wed Mar 24 16:57:40 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 17:08:32 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpdb.tex,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Doc/lib Modified Files: libpdb.tex Log Message: Enable the profiling of C functions (builtins and extensions) Index: libpdb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpdb.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** libpdb.tex 25 Aug 2003 04:28:04 -0000 1.38 --- libpdb.tex 24 Mar 2004 21:57:08 -0000 1.39 *************** *** 351,356 **** Trace functions have three arguments: \var{frame}, \var{event}, and \var{arg}. \var{frame} is the current stack frame. \var{event} is a ! string: \code{'call'}, \code{'line'}, \code{'return'} or ! \code{'exception'}. \var{arg} depends on the event type. The global trace function is invoked (with \var{event} set to --- 351,357 ---- Trace functions have three arguments: \var{frame}, \var{event}, and \var{arg}. \var{frame} is the current stack frame. \var{event} is a ! string: \code{'call'}, \code{'line'}, \code{'return'}, \code{'exception'}, ! \code{'c_call'}, \code{'c_return'}, or \code{'c_exception'}. \var{arg} ! depends on the event type. The global trace function is invoked (with \var{event} set to *************** *** 391,394 **** --- 392,405 ---- function. + \item[\code{'c_call'}] + A C function is about to be called. This may be an extension function + or a builtin. \var{arg} is the C function name. + + \item[\code{'c_return'}] + A C function has returned. \var{arg} is \code{None}. + + \item[\code{'c_exception'}] + A C function has thrown an exception. \var{arg} is \code{None}. + \end{description} From mondragon at users.sourceforge.net Wed Mar 24 17:22:13 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 17:33:09 2004 Subject: [Python-checkins] python/dist/src/Modules threadmodule.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14535/Modules Modified Files: threadmodule.c Log Message: Changed random calls to PyThreadState_Get() to use the macro Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** threadmodule.c 16 Jun 2003 18:51:28 -0000 2.56 --- threadmodule.c 24 Mar 2004 22:22:11 -0000 2.57 *************** *** 234,238 **** if (boot == NULL) return PyErr_NoMemory(); ! boot->interp = PyThreadState_Get()->interp; boot->func = func; boot->args = args; --- 234,238 ---- if (boot == NULL) return PyErr_NoMemory(); ! boot->interp = PyThreadState_GET()->interp; boot->func = func; boot->args = args; From mondragon at users.sourceforge.net Wed Mar 24 17:22:22 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 17:33:13 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.387, 2.388 codecs.c, 2.22, 2.23 errors.c, 2.81, 2.82 import.c, 2.227, 2.228 pystate.c, 2.29, 2.30 pythonrun.c, 2.204, 2.205 sysmodule.c, 2.122, 2.123 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14535/Python Modified Files: ceval.c codecs.c errors.c import.c pystate.c pythonrun.c sysmodule.c Log Message: Changed random calls to PyThreadState_Get() to use the macro Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.387 retrieving revision 2.388 diff -C2 -d -r2.387 -r2.388 *** ceval.c 24 Mar 2004 21:57:09 -0000 2.387 --- ceval.c 24 Mar 2004 22:22:11 -0000 2.388 *************** *** 2844,2848 **** if (type == NULL) { /* Reraise */ ! PyThreadState *tstate = PyThreadState_Get(); type = tstate->exc_type == NULL ? Py_None : tstate->exc_type; value = tstate->exc_value; --- 2844,2848 ---- if (type == NULL) { /* Reraise */ ! PyThreadState *tstate = PyThreadState_GET(); type = tstate->exc_type == NULL ? Py_None : tstate->exc_type; value = tstate->exc_value; *************** *** 3222,3226 **** PyEval_SetProfile(Py_tracefunc func, PyObject *arg) { ! PyThreadState *tstate = PyThreadState_Get(); PyObject *temp = tstate->c_profileobj; Py_XINCREF(arg); --- 3222,3226 ---- PyEval_SetProfile(Py_tracefunc func, PyObject *arg) { ! PyThreadState *tstate = PyThreadState_GET(); PyObject *temp = tstate->c_profileobj; Py_XINCREF(arg); *************** *** 3237,3241 **** PyEval_SetTrace(Py_tracefunc func, PyObject *arg) { ! PyThreadState *tstate = PyThreadState_Get(); PyObject *temp = tstate->c_traceobj; Py_XINCREF(arg); --- 3237,3241 ---- PyEval_SetTrace(Py_tracefunc func, PyObject *arg) { ! PyThreadState *tstate = PyThreadState_GET(); PyObject *temp = tstate->c_traceobj; Py_XINCREF(arg); *************** *** 3255,3259 **** PyFrameObject *current_frame = PyEval_GetFrame(); if (current_frame == NULL) ! return PyThreadState_Get()->interp->builtins; else return current_frame->f_builtins; --- 3255,3259 ---- PyFrameObject *current_frame = PyEval_GetFrame(); if (current_frame == NULL) ! return PyThreadState_GET()->interp->builtins; else return current_frame->f_builtins; *************** *** 3283,3287 **** PyEval_GetFrame(void) { ! PyThreadState *tstate = PyThreadState_Get(); return _PyThreadState_GetFrame(tstate); } --- 3283,3287 ---- PyEval_GetFrame(void) { ! PyThreadState *tstate = PyThreadState_GET(); return _PyThreadState_GetFrame(tstate); } Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** codecs.c 29 Dec 2003 01:36:01 -0000 2.22 --- codecs.c 24 Mar 2004 22:22:11 -0000 2.23 *************** *** 29,33 **** int PyCodec_Register(PyObject *search_function) { ! PyInterpreterState *interp = PyThreadState_Get()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; --- 29,33 ---- int PyCodec_Register(PyObject *search_function) { ! PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; *************** *** 104,108 **** } ! interp = PyThreadState_Get()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; --- 104,108 ---- } ! interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; *************** *** 396,400 **** int PyCodec_RegisterError(const char *name, PyObject *error) { ! PyInterpreterState *interp = PyThreadState_Get()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) return -1; --- 396,400 ---- int PyCodec_RegisterError(const char *name, PyObject *error) { ! PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) return -1; *************** *** 414,418 **** PyObject *handler = NULL; ! PyInterpreterState *interp = PyThreadState_Get()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) return NULL; --- 414,418 ---- PyObject *handler = NULL; ! PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) return NULL; *************** *** 803,807 **** }; ! PyInterpreterState *interp = PyThreadState_Get()->interp; PyObject *mod; int i; --- 803,807 ---- }; ! PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *mod; int i; Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -d -r2.81 -r2.82 *** errors.c 20 Nov 2003 01:44:58 -0000 2.81 --- errors.c 24 Mar 2004 22:22:11 -0000 2.82 *************** *** 206,210 **** PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) { ! PyThreadState *tstate = PyThreadState_Get(); *p_type = tstate->curexc_type; --- 206,210 ---- PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) { ! PyThreadState *tstate = PyThreadState_GET(); *p_type = tstate->curexc_type; Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.227 retrieving revision 2.228 diff -C2 -d -r2.227 -r2.228 *** import.c 23 Mar 2004 16:28:13 -0000 2.227 --- import.c 24 Mar 2004 22:22:12 -0000 2.228 *************** *** 322,326 **** PyImport_GetModuleDict(void) { ! PyInterpreterState *interp = PyThreadState_Get()->interp; if (interp->modules == NULL) Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); --- 322,326 ---- PyImport_GetModuleDict(void) { ! PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->modules == NULL) Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); *************** *** 354,358 **** char *name; PyObject *key, *value, *dict; ! PyInterpreterState *interp = PyThreadState_Get()->interp; PyObject *modules = interp->modules; --- 354,358 ---- char *name; PyObject *key, *value, *dict; ! PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *modules = interp->modules; Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** pystate.c 13 Jul 2003 10:41:53 -0000 2.29 --- pystate.c 24 Mar 2004 22:22:12 -0000 2.30 *************** *** 314,318 **** int PyThreadState_SetAsyncExc(long id, PyObject *exc) { ! PyThreadState *tstate = PyThreadState_Get(); PyInterpreterState *interp = tstate->interp; PyThreadState *p; --- 314,318 ---- int PyThreadState_SetAsyncExc(long id, PyObject *exc) { ! PyThreadState *tstate = PyThreadState_GET(); PyInterpreterState *interp = tstate->interp; PyThreadState *p; Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.204 retrieving revision 2.205 diff -C2 -d -r2.204 -r2.205 *** pythonrun.c 22 Mar 2004 20:16:58 -0000 2.204 --- pythonrun.c 24 Mar 2004 22:22:12 -0000 2.205 *************** *** 317,321 **** /* Get current thread state and interpreter pointer */ ! tstate = PyThreadState_Get(); interp = tstate->interp; --- 317,321 ---- /* Get current thread state and interpreter pointer */ ! tstate = PyThreadState_GET(); interp = tstate->interp; *************** *** 530,534 **** PyInterpreterState *interp = tstate->interp; ! if (tstate != PyThreadState_Get()) Py_FatalError("Py_EndInterpreter: thread is not current"); if (tstate->frame != NULL) --- 530,534 ---- PyInterpreterState *interp = tstate->interp; ! if (tstate != PyThreadState_GET()) Py_FatalError("Py_EndInterpreter: thread is not current"); if (tstate->frame != NULL) *************** *** 1462,1466 **** break; case E_DECODE: { /* XXX */ ! PyThreadState* tstate = PyThreadState_Get(); PyObject* value = tstate->curexc_value; if (value != NULL) { --- 1462,1466 ---- break; case E_DECODE: { /* XXX */ ! PyThreadState* tstate = PyThreadState_GET(); PyObject* value = tstate->curexc_value; if (value != NULL) { Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.122 retrieving revision 2.123 diff -C2 -d -r2.122 -r2.123 *** sysmodule.c 24 Mar 2004 21:57:10 -0000 2.122 --- sysmodule.c 24 Mar 2004 22:22:12 -0000 2.123 *************** *** 49,53 **** PySys_GetObject(char *name) { ! PyThreadState *tstate = PyThreadState_Get(); PyObject *sd = tstate->interp->sysdict; if (sd == NULL) --- 49,53 ---- PySys_GetObject(char *name) { ! PyThreadState *tstate = PyThreadState_GET(); PyObject *sd = tstate->interp->sysdict; if (sd == NULL) *************** *** 71,75 **** PySys_SetObject(char *name, PyObject *v) { ! PyThreadState *tstate = PyThreadState_Get(); PyObject *sd = tstate->interp->sysdict; if (v == NULL) { --- 71,75 ---- PySys_SetObject(char *name, PyObject *v) { ! PyThreadState *tstate = PyThreadState_GET(); PyObject *sd = tstate->interp->sysdict; if (v == NULL) { *************** *** 87,91 **** { PyObject *outf; ! PyInterpreterState *interp = PyThreadState_Get()->interp; PyObject *modules = interp->modules; PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); --- 87,91 ---- { PyObject *outf; ! PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *modules = interp->modules; PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); *************** *** 150,154 **** { PyThreadState *tstate; ! tstate = PyThreadState_Get(); return Py_BuildValue( "(OOO)", --- 150,154 ---- { PyThreadState *tstate; ! tstate = PyThreadState_GET(); return Py_BuildValue( "(OOO)", *************** *** 169,173 **** sys_exc_clear(PyObject *self, PyObject *noargs) { ! PyThreadState *tstate = PyThreadState_Get(); PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; --- 169,173 ---- sys_exc_clear(PyObject *self, PyObject *noargs) { ! PyThreadState *tstate = PyThreadState_GET(); PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; *************** *** 515,519 **** { int new_val; ! PyThreadState *tstate = PyThreadState_Get(); if (!PyArg_ParseTuple(args, "i:setdlopenflags", &new_val)) return NULL; --- 515,519 ---- { int new_val; ! PyThreadState *tstate = PyThreadState_GET(); if (!PyArg_ParseTuple(args, "i:setdlopenflags", &new_val)) return NULL; *************** *** 538,542 **** sys_getdlopenflags(PyObject *self, PyObject *args) { ! PyThreadState *tstate = PyThreadState_Get(); if (!tstate) return NULL; --- 538,542 ---- sys_getdlopenflags(PyObject *self, PyObject *args) { ! PyThreadState *tstate = PyThreadState_GET(); if (!tstate) return NULL; *************** *** 616,620 **** sys_getframe(PyObject *self, PyObject *args) { ! PyFrameObject *f = PyThreadState_Get()->frame; int depth = -1; --- 616,620 ---- sys_getframe(PyObject *self, PyObject *args) { ! PyFrameObject *f = PyThreadState_GET()->frame; int depth = -1; From mondragon at users.sourceforge.net Wed Mar 24 16:57:40 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 18:46:15 2004 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Doc/api Modified Files: init.tex Log Message: Enable the profiling of C functions (builtins and extensions) Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** init.tex 18 Mar 2004 01:38:11 -0000 1.15 --- init.tex 24 Mar 2004 21:57:07 -0000 1.16 *************** *** 727,740 **** function as \var{obj}, \var{frame} is the frame object to which the event pertains, \var{what} is one of the constants ! \constant{PyTrace_CALL}, \constant{PyTrace_EXCEPT}, ! \constant{PyTrace_LINE} or \constant{PyTrace_RETURN}, and \var{arg} depends on the value of \var{what}: \begin{tableii}{l|l}{constant}{Value of \var{what}}{Meaning of \var{arg}} \lineii{PyTrace_CALL}{Always \NULL.} ! \lineii{PyTrace_EXCEPT}{Exception information as returned by \function{sys.exc_info()}.} \lineii{PyTrace_LINE}{Always \NULL.} \lineii{PyTrace_RETURN}{Value being returned to the caller.} \end{tableii} \end{ctypedesc} --- 727,745 ---- function as \var{obj}, \var{frame} is the frame object to which the event pertains, \var{what} is one of the constants ! \constant{PyTrace_CALL}, \constant{PyTrace_EXCEPTION}, ! \constant{PyTrace_LINE}, \constant{PyTrace_RETURN}, ! \constant{PyTrace_C_CALL}, \constant{PyTrace_C_EXCEPTION}, ! or \constant{PyTrace_C_RETURN}, and \var{arg} depends on the value of \var{what}: \begin{tableii}{l|l}{constant}{Value of \var{what}}{Meaning of \var{arg}} \lineii{PyTrace_CALL}{Always \NULL.} ! \lineii{PyTrace_EXCEPTION}{Exception information as returned by \function{sys.exc_info()}.} \lineii{PyTrace_LINE}{Always \NULL.} \lineii{PyTrace_RETURN}{Value being returned to the caller.} + \lineii{PyTrace_C_CALL}{Name of function being called.} + \lineii{PyTrace_C_EXCEPTION}{Always \NULL.} + \lineii{PyTrace_C_RETURN}{Always \NULL.} \end{tableii} \end{ctypedesc} *************** *** 748,752 **** \end{cvardesc} ! \begin{cvardesc}{int}{PyTrace_EXCEPT} The value of the \var{what} parameter to a \ctype{Py_tracefunc} function when an exception has been raised. The callback function --- 753,757 ---- \end{cvardesc} ! \begin{cvardesc}{int}{PyTrace_EXCEPTION} The value of the \var{what} parameter to a \ctype{Py_tracefunc} function when an exception has been raised. The callback function *************** *** 771,774 **** --- 776,794 ---- \end{cvardesc} + \begin{cvardesc}{int}{PyTrace_C_CALL} + The value for the \var{what} parameter to \ctype{Py_tracefunc} + functions when a C function is about to be called. + \end{cvardesc} + + \begin{cvardesc}{int}{PyTrace_C_EXCEPTION} + The value for the \var{what} parameter to \ctype{Py_tracefunc} + functions when a C function has thrown an exception. + \end{cvardesc} + + \begin{cvardesc}{int}{PyTrace_C_RETURN} + The value for the \var{what} parameter to \ctype{Py_tracefunc} + functions when a C function has returned. + \end{cvardesc} + \begin{cfuncdesc}{void}{PyEval_SetProfile}{Py_tracefunc func, PyObject *obj} Set the profiler function to \var{func}. The \var{obj} parameter is From pierslauder at users.sourceforge.net Wed Mar 24 19:12:24 2004 From: pierslauder at users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Wed Mar 24 19:23:01 2004 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11292/dist/src/Lib Modified Files: imaplib.py Log Message: fix name in setacl method doc string Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** imaplib.py 12 Feb 2004 17:35:06 -0000 1.66 --- imaplib.py 25 Mar 2004 00:12:21 -0000 1.67 *************** *** 622,626 **** """Set a mailbox acl. ! (typ, [data]) = .create(mailbox, who, what) """ return self._simple_command('SETACL', mailbox, who, what) --- 622,626 ---- """Set a mailbox acl. ! (typ, [data]) = .setacl(mailbox, who, what) """ return self._simple_command('SETACL', mailbox, who, what) From mondragon at users.sourceforge.net Wed Mar 24 21:16:25 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 21:27:02 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c, 1.30, 1.31 readline.c, 2.67, 2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2642/Modules Modified Files: _bsddb.c readline.c Log Message: A few more PyThreadState_Get to PyThreadState_GET conversions Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** _bsddb.c 16 Mar 2004 06:56:58 -0000 1.30 --- _bsddb.c 25 Mar 2004 02:16:22 -0000 1.31 *************** *** 4458,4462 **** #if defined(WITH_THREAD) && !defined(MYDB_USE_GILSTATE) /* Save the current interpreter, so callbacks can do the right thing. */ ! _db_interpreterState = PyThreadState_Get()->interp; #endif --- 4458,4462 ---- #if defined(WITH_THREAD) && !defined(MYDB_USE_GILSTATE) /* Save the current interpreter, so callbacks can do the right thing. */ ! _db_interpreterState = PyThreadState_GET()->interp; #endif Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** readline.c 10 Feb 2004 16:50:19 -0000 2.67 --- readline.c 25 Mar 2004 02:16:22 -0000 2.68 *************** *** 179,183 **** *hook_var = function; Py_XDECREF(tmp); ! *tstate = PyThreadState_Get(); } else { --- 179,183 ---- *hook_var = function; Py_XDECREF(tmp); ! *tstate = PyThreadState_GET(); } else { From mondragon at users.sourceforge.net Wed Mar 24 21:16:25 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 21:27:07 2004 Subject: [Python-checkins] python/dist/src/Python dynload_shlib.c,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2642/Python Modified Files: dynload_shlib.c Log Message: A few more PyThreadState_Get to PyThreadState_GET conversions Index: dynload_shlib.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/dynload_shlib.c,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** dynload_shlib.c 3 May 2003 09:14:53 -0000 2.15 --- dynload_shlib.c 25 Mar 2004 02:16:23 -0000 2.16 *************** *** 110,114 **** #if !(defined(PYOS_OS2) && defined(PYCC_GCC)) ! dlopenflags = PyThreadState_Get()->interp->dlopenflags; #endif --- 110,114 ---- #if !(defined(PYOS_OS2) && defined(PYCC_GCC)) ! dlopenflags = PyThreadState_GET()->interp->dlopenflags; #endif From pje at users.sourceforge.net Wed Mar 24 21:19:36 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed Mar 24 21:30:14 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py, 1.200, 1.201 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3103/Lib/test Modified Files: test_descr.py Log Message: Ensure super() lookup of descriptor from classmethod works (SF #743627) Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** test_descr.py 12 Feb 2004 17:35:11 -0000 1.200 --- test_descr.py 25 Mar 2004 02:19:34 -0000 1.201 *************** *** 2065,2068 **** --- 2065,2082 ---- vereq(super(DDsub, dd).x, 42) + # Ensure that super() lookup of descriptor from classmethod + # works (SF ID# 743627) + + class Base(object): + aProp = property(lambda self: "foo") + + class Sub(Base): + def test(klass): + return super(Sub,klass).aProp + test = classmethod(test) + + veris(Sub.test(), Base.aProp) + + def inherits(): if verbose: print "Testing inheritance from basic types..." From pje at users.sourceforge.net Wed Mar 24 21:19:36 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed Mar 24 21:30:19 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.256,2.257 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3103/Objects Modified Files: typeobject.c Log Message: Ensure super() lookup of descriptor from classmethod works (SF #743627) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.256 retrieving revision 2.257 diff -C2 -d -r2.256 -r2.257 *** typeobject.c 8 Feb 2004 04:21:26 -0000 2.256 --- typeobject.c 25 Mar 2004 02:19:34 -0000 2.257 *************** *** 5538,5542 **** f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, (PyObject *)starttype); Py_DECREF(res); --- 5538,5549 ---- f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, ! /* Only pass 'obj' param if ! this is instance-mode super ! (See SF ID #743627) ! */ ! (su->obj==su->obj_type ! ? (PyObject *)NULL ! : su->obj), (PyObject *)starttype); Py_DECREF(res); From pje at users.sourceforge.net Wed Mar 24 21:36:31 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed Mar 24 21:47:09 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c, 2.241.6.7, 2.241.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6199/Objects Modified Files: Tag: release23-maint typeobject.c Log Message: Ensure super() lookup of descriptor from classmethod works (SF ID# 743627) (Backport to 2.3 maintenance branch) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.241.6.7 retrieving revision 2.241.6.8 diff -C2 -d -r2.241.6.7 -r2.241.6.8 *** typeobject.c 9 Feb 2004 02:57:18 -0000 2.241.6.7 --- typeobject.c 25 Mar 2004 02:36:29 -0000 2.241.6.8 *************** *** 5497,5501 **** f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, (PyObject *)starttype); Py_DECREF(res); --- 5497,5508 ---- f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, ! /* Only pass 'obj' param if ! this is instance-mode super ! (See SF ID #743627) ! */ ! (su->obj==su->obj_type ! ? (PyObject *)NULL ! : su->obj), (PyObject *)starttype); Py_DECREF(res); From pje at users.sourceforge.net Wed Mar 24 21:36:31 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Wed Mar 24 21:47:13 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py, 1.196.8.1, 1.196.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6199/Lib/test Modified Files: Tag: release23-maint test_descr.py Log Message: Ensure super() lookup of descriptor from classmethod works (SF ID# 743627) (Backport to 2.3 maintenance branch) Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.196.8.1 retrieving revision 1.196.8.2 diff -C2 -d -r1.196.8.1 -r1.196.8.2 *** test_descr.py 7 Aug 2003 15:08:54 -0000 1.196.8.1 --- test_descr.py 25 Mar 2004 02:36:29 -0000 1.196.8.2 *************** *** 2065,2068 **** --- 2065,2082 ---- vereq(super(DDsub, dd).x, 42) + # Ensure that super() lookup of descriptor from classmethod + # works (SF ID# 743627) + + class Base(object): + aProp = property(lambda self: "foo") + + class Sub(Base): + def test(klass): + return super(Sub,klass).aProp + test = classmethod(test) + + veris(Sub.test(), Base.aProp) + + def inherits(): if verbose: print "Testing inheritance from basic types..." From mondragon at users.sourceforge.net Wed Mar 24 16:57:12 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 22:05:02 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.960,1.961 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Misc Modified Files: NEWS Log Message: Enable the profiling of C functions (builtins and extensions) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.960 retrieving revision 1.961 diff -C2 -d -r1.960 -r1.961 *** NEWS 23 Mar 2004 23:16:52 -0000 1.960 --- NEWS 24 Mar 2004 21:57:09 -0000 1.961 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - Enabled the profiling of C extension functions (and builtins) - check + new documentation and modified profiler and bdb modules for more details + - Set file.name to the object passed to open (instead of a new string) From mondragon at users.sourceforge.net Wed Mar 24 16:57:12 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Wed Mar 24 22:07:38 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.386, 2.387 sysmodule.c, 2.121, 2.122 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Python Modified Files: ceval.c sysmodule.c Log Message: Enable the profiling of C functions (builtins and extensions) Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.386 retrieving revision 2.387 diff -C2 -d -r2.386 -r2.387 *** ceval.c 22 Mar 2004 19:24:58 -0000 2.386 --- ceval.c 24 Mar 2004 21:57:09 -0000 2.387 *************** *** 537,543 **** } - /* Status code for main loop (reason for stack unwind) */ - enum why_code { WHY_NOT, /* No error */ --- 537,541 ---- *************** *** 3426,3429 **** --- 3424,3463 ---- } + #define BEGIN_C_TRACE \ + if (tstate->use_tracing) { \ + if (tstate->c_profilefunc != NULL) { \ + PyObject *func_name = \ + PyString_FromString (((PyCFunctionObject *) \ + func)->m_ml->ml_name); \ + are_tracing = 1; \ + if (call_trace(tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_CALL, \ + func_name)) \ + { return NULL; } \ + Py_DECREF (func_name); \ + } \ + } + + #define END_C_TRACE \ + if (tstate->use_tracing && are_tracing) { \ + if (tstate->c_profilefunc != NULL) { \ + if (x == NULL) { \ + if (call_trace (tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_EXCEPTION, \ + NULL)) \ + { return NULL; } \ + } else { \ + if (call_trace(tstate->c_profilefunc, \ + tstate->c_profileobj, \ + tstate->frame, PyTrace_C_RETURN, \ + NULL)) \ + { return NULL; } \ + } \ + } \ + } + + static PyObject * call_function(PyObject ***pp_stack, int oparg) *************** *** 3436,3439 **** --- 3470,3477 ---- PyObject *x, *w; + int are_tracing = 0; + + PyThreadState *tstate = PyThreadState_GET(); + /* Always dispatch PyCFunction first, because these are presumed to be the most frequent callable object. *************** *** 3445,3453 **** PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); ! if (flags & METH_NOARGS && na == 0) x = (*meth)(self, NULL); else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); x = (*meth)(self, arg); Py_DECREF(arg); } --- 3483,3496 ---- PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); ! if (flags & METH_NOARGS && na == 0) { ! BEGIN_C_TRACE x = (*meth)(self, NULL); + END_C_TRACE + } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); + BEGIN_C_TRACE x = (*meth)(self, arg); + END_C_TRACE Py_DECREF(arg); } *************** *** 3460,3464 **** --- 3503,3509 ---- PyObject *callargs; callargs = load_args(pp_stack, na); + BEGIN_C_TRACE x = PyCFunction_Call(func, callargs, NULL); + END_C_TRACE Py_XDECREF(callargs); } Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.121 retrieving revision 2.122 diff -C2 -d -r2.121 -r2.122 *** sysmodule.c 9 Aug 2003 09:47:11 -0000 2.121 --- sysmodule.c 24 Mar 2004 21:57:10 -0000 2.122 *************** *** 273,285 **** * trace functions. Initialized by trace_init(). */ ! static PyObject *whatstrings[4] = {NULL, NULL, NULL, NULL}; static int trace_init(void) { ! static char *whatnames[4] = {"call", "exception", "line", "return"}; PyObject *name; int i; ! for (i = 0; i < 4; ++i) { if (whatstrings[i] == NULL) { name = PyString_InternFromString(whatnames[i]); --- 273,286 ---- * trace functions. Initialized by trace_init(). */ ! static PyObject *whatstrings[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static int trace_init(void) { ! static char *whatnames[7] = {"call", "exception", "line", "return", ! "c_call", "c_exception", "c_return"}; PyObject *name; int i; ! for (i = 0; i < 7; ++i) { if (whatstrings[i] == NULL) { name = PyString_InternFromString(whatnames[i]); From rhettinger at users.sourceforge.net Thu Mar 25 03:51:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 25 04:02:25 2004 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9934/doc Modified Files: doc.tex Log Message: SF bug: #921927: Fixed a typo/thinko spelling "parameter" as "paramter" Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** doc.tex 10 Feb 2004 18:30:22 -0000 1.83 --- doc.tex 25 Mar 2004 08:51:36 -0000 1.84 *************** *** 323,327 **** A macro which takes an optional parameter would be typed like this ! when the optional paramter is given: \begin{verbatim} --- 323,327 ---- A macro which takes an optional parameter would be typed like this ! when the optional parameter is given: \begin{verbatim} From rhettinger at users.sourceforge.net Thu Mar 25 03:51:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 25 04:02:29 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9934/api Modified Files: concrete.tex Log Message: SF bug: #921927: Fixed a typo/thinko spelling "parameter" as "paramter" Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** concrete.tex 9 Feb 2004 10:47:11 -0000 1.38 --- concrete.tex 25 Mar 2004 08:51:22 -0000 1.39 *************** *** 2463,2467 **** parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single paramter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not --- 2463,2467 ---- parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single parameter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not *************** *** 2478,2482 **** parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single paramter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not callable, --- 2478,2482 ---- parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single parameter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not callable, From rhettinger at users.sourceforge.net Thu Mar 25 03:56:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 25 04:06:52 2004 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex, 1.75.8.3, 1.75.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10821/doc Modified Files: Tag: release23-maint doc.tex Log Message: SF bug #921927: Fixed a typo/thinko spelling "parameter" as "paramter" Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.75.8.3 retrieving revision 1.75.8.4 diff -C2 -d -r1.75.8.3 -r1.75.8.4 *** doc.tex 8 Jan 2004 15:00:13 -0000 1.75.8.3 --- doc.tex 25 Mar 2004 08:55:58 -0000 1.75.8.4 *************** *** 323,327 **** A macro which takes an optional parameter would be typed like this ! when the optional paramter is given: \begin{verbatim} --- 323,327 ---- A macro which takes an optional parameter would be typed like this ! when the optional parameter is given: \begin{verbatim} From rhettinger at users.sourceforge.net Thu Mar 25 03:56:01 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Mar 25 04:06:57 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.25.10.6, 1.25.10.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10821/api Modified Files: Tag: release23-maint concrete.tex Log Message: SF bug #921927: Fixed a typo/thinko spelling "parameter" as "paramter" Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.25.10.6 retrieving revision 1.25.10.7 diff -C2 -d -r1.25.10.6 -r1.25.10.7 *** concrete.tex 20 Feb 2004 11:58:27 -0000 1.25.10.6 --- concrete.tex 25 Mar 2004 08:55:58 -0000 1.25.10.7 *************** *** 2435,2439 **** parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single paramter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not --- 2435,2439 ---- parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single parameter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not *************** *** 2450,2454 **** parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single paramter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not callable, --- 2450,2454 ---- parameter, \var{callback}, can be a callable object that receives notification when \var{ob} is garbage collected; it should accept a ! single parameter, which will be the weak reference object itself. \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not callable, From mjessbmj at hotmail.com Wed Mar 24 23:06:30 2004 From: mjessbmj at hotmail.com (Burl Gonzalez) Date: Thu Mar 25 04:37:10 2004 Subject: [Python-checkins] featured on CNN and ABC Message-ID: Drop the HAMMER on the next bitch you Nail.... http://lanky.homesr45.com/vp5 Click here if you do not wish to be invited again: http://fightnottobesingle.com/remove/?oc=xxxxyyyy From loewis at users.sourceforge.net Thu Mar 25 08:51:03 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Mar 25 09:01:48 2004 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3541 Modified Files: sre_compile.py Log Message: Use True/False instead of 0/1 for character classes. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** sre_compile.py 17 Oct 2003 22:13:16 -0000 1.50 --- sre_compile.py 25 Mar 2004 13:50:59 -0000 1.51 *************** *** 194,198 **** # internal: optimize character set out = [] ! charmap = [0]*256 try: for op, av in charset: --- 194,198 ---- # internal: optimize character set out = [] ! charmap = [False]*256 try: for op, av in charset: *************** *** 200,207 **** out.append((op, av)) elif op is LITERAL: ! charmap[fixup(av)] = 1 elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = 1 elif op is CATEGORY: # XXX: could append to charmap tail --- 200,207 ---- out.append((op, av)) elif op is LITERAL: ! charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = True elif op is CATEGORY: # XXX: could append to charmap tail *************** *** 287,291 **** except ImportError: return charset ! charmap = [0]*65536 negate = 0 try: --- 287,291 ---- except ImportError: return charset ! charmap = [False]*65536 negate = 0 try: *************** *** 294,301 **** negate = 1 elif op is LITERAL: ! charmap[fixup(av)] = 1 elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = 1 elif op is CATEGORY: # XXX: could expand category --- 294,301 ---- negate = 1 elif op is LITERAL: ! charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = True elif op is CATEGORY: # XXX: could expand category From fdrake at users.sourceforge.net Thu Mar 25 08:59:58 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 09:10:41 2004 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex, 1.11, NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6205/distutilsref Removed Files: distref.tex Log Message: Remove this from the sandbox; the contents have been integrated into the "Distributing Python Modules" document. --- distref.tex DELETED --- From fdrake at users.sourceforge.net Thu Mar 25 09:25:30 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 09:36:12 2004 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11514 Modified Files: exceptions.tex Log Message: Remove note that PyErr_SetInterrupt() is obsolete; add comment about the fact that it was marked obsolete but is still needed. Closes SF bug #919299. Someone else should backport this to Python 2.3. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** exceptions.tex 7 Dec 2003 11:40:16 -0000 1.16 --- exceptions.tex 25 Mar 2004 14:25:28 -0000 1.17 *************** *** 300,304 **** \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} ! This function is obsolete. It simulates the effect of a \constant{SIGINT}\ttindex{SIGINT} signal arriving --- the next time \cfunction{PyErr_CheckSignals()} is called, --- 300,304 ---- \begin{cfuncdesc}{void}{PyErr_SetInterrupt}{} ! It simulates the effect of a \constant{SIGINT}\ttindex{SIGINT} signal arriving --- the next time \cfunction{PyErr_CheckSignals()} is called, *************** *** 306,309 **** --- 306,311 ---- \exception{KeyboardInterrupt} will be raised. It may be called without holding the interpreter lock. + % XXX This was described as obsolete, but is used in + % thread.interrupt_main() (used from IDLE), so it's still needed. \end{cfuncdesc} From loewis at users.sourceforge.net Thu Mar 25 09:58:25 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Mar 25 10:09:07 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils util.py,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18673 Modified Files: util.py Log Message: Defer compilation of regular expressions until first use. Index: util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** util.py 12 Feb 2004 17:35:08 -0000 1.74 --- util.py 25 Mar 2004 14:58:19 -0000 1.75 *************** *** 210,216 **** # Needed by 'split_quoted()' ! _wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace) ! _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") ! _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"') def split_quoted (s): --- 210,219 ---- # Needed by 'split_quoted()' ! _wordchars_re = _squote_re = _dquote_re = None ! def _init_regex(): ! global _wordchars_re, _squote_re, _dquote_re ! _wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace) ! _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") ! _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"') def split_quoted (s): *************** *** 228,231 **** --- 231,235 ---- # doesn't require character-by-character examination. It was a little # bit of a brain-bender to get it working right, though... + if _wordchars_re is None: _init_regex() s = string.strip(s) From fdrake at users.sourceforge.net Thu Mar 25 10:44:58 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 10:55:49 2004 Subject: [Python-checkins] python/dist/src/Doc/api veryhigh.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28836/api Modified Files: veryhigh.tex Log Message: improve the very-high-level API docs (contributed by Jeff Epler) Closes SF patch #798638. Index: veryhigh.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/veryhigh.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** veryhigh.tex 12 Oct 2001 19:01:43 -0000 1.1 --- veryhigh.tex 25 Mar 2004 15:44:56 -0000 1.2 *************** *** 34,38 **** \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_AnyFile}{FILE *fp, char *filename} If \var{fp} refers to a file associated with an interactive device (console or terminal input or \UNIX{} pseudo-terminal), return the --- 34,57 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_AnyFile}{FILE *fp, const char *filename} ! This is a simplified interface to \cfunction{PyRun_AnyFileExFlags()} ! below, leaving \var{closeit} set to \code{0} and \var{flags} set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_AnyFileFlags}{FILE *fp, const char *filename, ! PyCompilerFlags *flags} ! This is a simplified interface to \cfunction{PyRun_AnyFileExFlags()} ! below, leaving the \var{closeit} argument set to \code{0}. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_AnyFileEx}{FILE *fp, const char *filename, ! int closeit} ! This is a simplified interface to \cfunction{PyRun_AnyFileExFlags()} ! below, leaving the \var{flags} argument set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_AnyFileExFlags}{FILE *fp, const char *filename, ! int closeit, ! PyCompilerFlags *flags} If \var{fp} refers to a file associated with an interactive device (console or terminal input or \UNIX{} pseudo-terminal), return the *************** *** 42,72 **** \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_SimpleString}{char *command} Executes the Python source code from \var{command} in the ! \module{__main__} module. If \module{__main__} does not already ! exist, it is created. Returns \code{0} on success or \code{-1} if ! an exception was raised. If there was an error, there is no way to ! get the exception information. \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_SimpleFile}{FILE *fp, char *filename} ! Similar to \cfunction{PyRun_SimpleString()}, but the Python source code is read from \var{fp} instead of an in-memory string. ! \var{filename} should be the name of the file. \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_InteractiveOne}{FILE *fp, char *filename} Read and execute a single statement from a file associated with an ! interactive device. If \var{filename} is \NULL, \code{"???"} is ! used instead. The user will be prompted using \code{sys.ps1} and ! \code{sys.ps2}. Returns \code{0} when the input was executed ! successfully, \code{-1} if there was an exception, or an error code ! from the \file{errcode.h} include file distributed as part of Python ! if there was a parse error. (Note that \file{errcode.h} is not ! included by \file{Python.h}, so must be included specifically if ! needed.) \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_InteractiveLoop}{FILE *fp, char *filename} Read and execute statements from a file associated with an interactive device until \EOF{} is reached. If \var{filename} is --- 61,133 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_SimpleString}{const char *command} ! This is a simplified interface to \cfunction{PyRun_SimpleStringFlags()} ! below, leaving the \var{PyCompilerFlags*} argument set to NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_SimpleStringFlags}{const char *command, ! PyCompilerFlags *flags} Executes the Python source code from \var{command} in the ! \module{__main__} module according to the \var{flags} argument. ! If \module{__main__} does not already exist, it is created. Returns ! \code{0} on success or \code{-1} if an exception was raised. If there ! was an error, there is no way to get the exception information. ! For the meaning of \var{flags}, see below. \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_SimpleFile}{FILE *fp, const char *filename} ! This is a simplified interface to \cfunction{PyRun_SimpleFileExFlags()} ! below, leaving \var{closeit} set to \code{0} and \var{flags} set to ! \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_SimpleFileFlags}{FILE *fp, const char *filename, ! PyCompilerFlags *flags} ! This is a simplified interface to \cfunction{PyRun_SimpleFileExFlags()} ! below, leaving \var{closeit} set to \code{0}. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_SimpleFileEx}{FILE *fp, const char *filename, ! int closeit} ! This is a simplified interface to \cfunction{PyRun_SimpleFileExFlags()} ! below, leaving \var{flags} set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_SimpleFileExFlags}{FILE *fp, const char *filename, ! int closeit, ! PyCompilerFlags *flags} ! Similar to \cfunction{PyRun_SimpleStringFlags()}, but the Python source code is read from \var{fp} instead of an in-memory string. ! \var{filename} should be the name of the file. If \var{closeit} is ! true, the file is closed before PyRun_SimpleFileExFlags returns. \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_InteractiveOne}{FILE *fp, const char *filename} ! This is a simplified interface to \cfunction{PyRun_InteractiveOneFlags()} ! below, leaving \var{flags} set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_InteractiveOneFlags}{FILE *fp, ! const char *filename, ! PyCompilerFlags *flags} Read and execute a single statement from a file associated with an ! interactive device according to the \var{flags} argument. If ! \var{filename} is \NULL, \code{"???"} is used instead. The user will ! be prompted using \code{sys.ps1} and \code{sys.ps2}. Returns \code{0} ! when the input was executed successfully, \code{-1} if there was an ! exception, or an error code from the \file{errcode.h} include file ! distributed as part of Python if there was a parse error. (Note that ! \file{errcode.h} is not included by \file{Python.h}, so must be included ! specifically if needed.) \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyRun_InteractiveLoop}{FILE *fp, const char *filename} ! This is a simplified interface to \cfunction{PyRun_InteractiveLoopFlags()} ! below, leaving \var{flags} set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyRun_InteractiveLoopFlags}{FILE *fp, ! const char *filename, ! PyCompilerFlags *flags} Read and execute statements from a file associated with an interactive device until \EOF{} is reached. If \var{filename} is *************** *** 75,100 **** \end{cfuncdesc} ! \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseString}{char *str, int start} Parse Python source code from \var{str} using the start token ! \var{start}. The result can be used to create a code object which ! can be evaluated efficiently. This is useful if a code fragment ! must be evaluated many times. \end{cfuncdesc} \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseFile}{FILE *fp, ! char *filename, int start} ! Similar to \cfunction{PyParser_SimpleParseString()}, but the Python ! source code is read from \var{fp} instead of an in-memory string. ! \var{filename} should be the name of the file. \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyRun_String}{char *str, int start, PyObject *globals, PyObject *locals} Execute Python source code from \var{str} in the context specified ! by the dictionaries \var{globals} and \var{locals}. The parameter ! \var{start} specifies the start token that should be used to parse ! the source code. Returns the result of executing the code as a Python object, or --- 136,190 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseString}{const char *str, int start} + This is a simplified interface to + \cfunction{PyParser_SimpleParseStringFlagsFilename()} below, leaving + \var{filename} set to \NULL{} and \var{flags} set to \code{0}. + \end{cfuncdesc} + + \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseStringFlags}{ + const char *str, int start, int flags} + This is a simplified interface to + \cfunction{PyParser_SimpleParseStringFlagsFilename()} below, leaving + \var{filename} set to \NULL. + \end{cfuncdesc} + + \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseStringFlagsFilename}{ + const char *str, const char *filename, + int start, int flags} Parse Python source code from \var{str} using the start token ! \var{start} according to the \var{flags} argument. The result can ! be used to create a code object which can be evaluated efficiently. ! This is useful if a code fragment must be evaluated many times. \end{cfuncdesc} \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseFile}{FILE *fp, ! const char *filename, int start} ! This is a simplified interface to \cfunction{PyParser_SimpleParseFileFlags()} ! below, leaving \var{flags} set to \code{0} \end{cfuncdesc} ! \begin{cfuncdesc}{struct _node*}{PyParser_SimpleParseFileFlags}{FILE *fp, ! const char *filename, int start, int flags} ! Similar to \cfunction{PyParser_SimpleParseStringFlagsFilename()}, but ! the Python source code is read from \var{fp} instead of an in-memory ! string. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyRun_String}{const char *str, int start, PyObject *globals, PyObject *locals} + This is a simplified interface to \cfunction{PyRun_StringFlags()} below, + leaving \var{flags} set to \NULL. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyRun_StringFlags}{const char *str, int start, + PyObject *globals, + PyObject *locals, + PyCompilerFlags *flags} Execute Python source code from \var{str} in the context specified ! by the dictionaries \var{globals} and \var{locals} with the compiler ! flags specified by \var{flags}. The parameter \var{start} specifies ! the start token that should be used to parse the source code. Returns the result of executing the code as a Python object, or *************** *** 102,115 **** \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyRun_File}{FILE *fp, char *filename, int start, PyObject *globals, PyObject *locals} ! Similar to \cfunction{PyRun_String()}, but the Python source code is read from \var{fp} instead of an in-memory string. \var{filename} should be the name of the file. \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{Py_CompileString}{char *str, char *filename, int start} Parse and compile the Python source code in \var{str}, returning the resulting code object. The start token is given by \var{start}; --- 192,239 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyRun_File}{FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals} ! This is a simplified interface to \cfunction{PyRun_FileExFlags()} below, ! leaving \var{closeit} set to \code{0} and \var{flags} set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyRun_FileEx}{FILE *fp, const char *filename, ! int start, PyObject *globals, ! PyObject *locals, int closeit} ! This is a simplified interface to \cfunction{PyRun_FileExFlags()} below, ! leaving \var{flags} set to \NULL. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyRun_FileFlags}{FILE *fp, const char *filename, ! int start, PyObject *globals, ! PyObject *locals, ! PyCompilerFlags *flags} ! This is a simplified interface to \cfunction{PyRun_FileExFlags()} below, ! leaving \var{closeit} set to \code{0}. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyRun_FileExFlags}{FILE *fp, const char *filename, ! int start, PyObject *globals, ! PyObject *locals, int closeit, ! PyCompilerFlags *flags} ! Similar to \cfunction{PyRun_StringFlags()}, but the Python source code is read from \var{fp} instead of an in-memory string. \var{filename} should be the name of the file. + If \var{closeit} is true, the file is closed before + \cfunction{PyRun_FileExFlags()} returns. \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{Py_CompileString}{const char *str, ! const char *filename, int start} + This is a simplified interface to \cfunction{Py_CompileStringFlags()} below, + leaving \var{flags} set to \NULL. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{Py_CompileStringFlags}{const char *str, + const char *filename, + int start, + PyCompilerFlags *flags} Parse and compile the Python source code in \var{str}, returning the resulting code object. The start token is given by \var{start}; *************** *** 140,141 **** --- 264,287 ---- This is the symbol used for the interactive interpreter loop. \end{cvardesc} + + \begin{ctypedesc}[PyCompilerFlags]{struct PyCompilerFlags} + This is the structure used to hold compiler flags. In cases where + code is only being compiled, it is passed as \code{int flags}, and in + cases where code is being executed, it is passed as + \code{PyCompilerFlags *flags}. In this case, \code{from __future__ + import} can modify \var{flags}. + + Whenever \code{PyCompilerFlags *flags} is \NULL, \member{cf_flags} + is treated as equal to \code{0}, and any modification due to + \code{from __future__ import} is discarded. + \begin{verbatim} + struct PyCompilerFlags { + int cf_flags; + } + \end{verbatim} + \end{ctypedesc} + + \begin{cvardesc}{int}{CO_FUTURE_DIVISION} + This bit can be set in \var{flags} to cause division operator \code{/} + to be interpreted as ``true division'' according to \pep{238}. + \end{cvardesc} From fdrake at users.sourceforge.net Thu Mar 25 11:12:11 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 11:22:55 2004 Subject: [Python-checkins] python/dist/src/Doc/lib distutils.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1948 Modified Files: distutils.tex Log Message: note that distutils API docs are included in "Distributing Python Modules" Index: distutils.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/distutils.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** distutils.tex 24 Jul 2001 16:19:24 -0000 1.1 --- distutils.tex 25 Mar 2004 16:12:08 -0000 1.2 *************** *** 17,21 **** in the Python documentation package. To learn about distributing new modules using the \module{distutils} facilities, read ! \citetitle[../dist/dist.html]{Distributing Python Modules}. To learn about installing Python modules, whether or not the author made use of the \module{distutils} package, read --- 17,22 ---- in the Python documentation package. To learn about distributing new modules using the \module{distutils} facilities, read ! \citetitle[../dist/dist.html]{Distributing Python Modules}; this ! includes documentation needed to extend distutils. To learn about installing Python modules, whether or not the author made use of the \module{distutils} package, read From fdrake at users.sourceforge.net Thu Mar 25 11:14:20 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 11:25:03 2004 Subject: [Python-checkins] python/dist/src/Doc/lib distutils.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2367 Modified Files: distutils.tex Log Message: fix typo Index: distutils.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/distutils.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** distutils.tex 25 Mar 2004 16:12:08 -0000 1.2 --- distutils.tex 25 Mar 2004 16:14:17 -0000 1.3 *************** *** 29,33 **** describes how to prepare \module{distutils}-based packages so that they may be easily installed into an existing ! Python installaion.} \seetitle[../inst/inst.html]{Installing Python Modules}{An --- 29,33 ---- describes how to prepare \module{distutils}-based packages so that they may be easily installed into an existing ! Python installation.} \seetitle[../inst/inst.html]{Installing Python Modules}{An From loewis at users.sourceforge.net Thu Mar 25 11:16:30 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Mar 25 11:27:18 2004 Subject: [Python-checkins] python/dist/src/Objects bufferobject.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2734/Objects Modified Files: bufferobject.c Log Message: Correct code to advance ptr to be well-formed C. Index: bufferobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** bufferobject.c 11 Mar 2004 02:42:45 -0000 2.23 --- bufferobject.c 25 Mar 2004 16:16:28 -0000 2.24 *************** *** 44,48 **** else offset = self->b_offset; ! (char *)*ptr = (char *)*ptr + offset; if (self->b_size == Py_END_OF_BUFFER) *size = count; --- 44,48 ---- else offset = self->b_offset; ! *(char **)ptr = *(char **)ptr + offset; if (self->b_size == Py_END_OF_BUFFER) *size = count; From fdrake at users.sourceforge.net Thu Mar 25 11:33:46 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 11:44:33 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5902 Modified Files: dist.tex Log Message: remove duplicate use of the meta-data label Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** dist.tex 23 Mar 2004 19:02:38 -0000 1.70 --- dist.tex 25 Mar 2004 16:33:29 -0000 1.71 *************** *** 799,803 **** \subsection{Debugging the setup script} - \label{meta-data} Sometimes things go wrong, and the setup script doesn't do what the --- 799,802 ---- From fdrake at users.sourceforge.net Thu Mar 25 11:39:48 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 11:51:29 2004 Subject: [Python-checkins] python/dist/src/Doc/lib xmldomminidom.tex, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7603 Modified Files: xmldomminidom.tex Log Message: - make sure the methods minidom adds to the basic DOM are attributed to Node objects in the index (closes SF bug #832251) - fix a variety of markup nits Someone should backport this patch to Python 2.3.x. Index: xmldomminidom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldomminidom.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** xmldomminidom.tex 18 Apr 2003 22:04:34 -0000 1.8 --- xmldomminidom.tex 25 Mar 2004 16:39:46 -0000 1.9 *************** *** 128,132 **** ! \begin{methoddesc}{unlink}{} Break internal references within the DOM so that it will be garbage collected on versions of Python without cyclic GC. Even when cyclic --- 128,132 ---- ! \begin{methoddesc}[Node]{unlink}{} Break internal references within the DOM so that it will be garbage collected on versions of Python without cyclic GC. Even when cyclic *************** *** 138,160 **** \end{methoddesc} ! \begin{methoddesc}{writexml}{writer} Write XML to the writer object. The writer should have a \method{write()} method which matches that of the file object interface. ! \versionadded[To support pretty output, new keyword parameters indent, ! addindent, and newl have been added]{2.1} ! \versionadded[For the \class{Document} node, an additional keyword argument encoding can be used to specify the encoding field of the XML header]{2.3} - \end{methoddesc} ! \begin{methoddesc}{toxml}{\optional{encoding}} Return the XML that the DOM represents as a string. - \versionadded[the \var{encoding} argument]{2.3} - With no argument, the XML header does not specify an encoding, and the result is Unicode string if the default encoding cannot represent all --- 138,157 ---- \end{methoddesc} ! \begin{methoddesc}[Node]{writexml}{writer} Write XML to the writer object. The writer should have a \method{write()} method which matches that of the file object interface. ! \versionchanged[To support pretty output, new keyword parameters ! \var{indent}, \var{addindent}, and \var{newl} have been added]{2.1} ! \versionchanged[For the \class{Document} node, an additional keyword argument encoding can be used to specify the encoding field of the XML header]{2.3} \end{methoddesc} ! \begin{methoddesc}[Node]{toxml}{\optional{encoding}} Return the XML that the DOM represents as a string. With no argument, the XML header does not specify an encoding, and the result is Unicode string if the default encoding cannot represent all *************** *** 169,176 **** as "utf-8". \end{methoddesc} ! \begin{methoddesc}{toprettyxml}{\optional{indent\optional{, newl}}} ! Return a pretty-printed version of the document. \var{indent} specifies the indentation string and defaults to a tabulator; \var{newl} specifies --- 166,173 ---- as "utf-8". + \versionchanged[the \var{encoding} argument was introduced]{2.3} \end{methoddesc} ! \begin{methoddesc}[Node]{toprettyxml}{\optional{indent\optional{, newl}}} Return a pretty-printed version of the document. \var{indent} specifies the indentation string and defaults to a tabulator; \var{newl} specifies *************** *** 178,184 **** \versionadded{2.1} ! ! \versionadded[the encoding argument; see \method{toxml}]{2.3} ! \end{methoddesc} --- 175,179 ---- \versionadded{2.1} ! \versionchanged[the encoding argument; see \method{toxml()}]{2.3} \end{methoddesc} *************** *** 186,190 **** \refmodule{xml.dom.minidom}: ! \begin{methoddesc}{cloneNode}{deep} Although this method was present in the version of \refmodule{xml.dom.minidom} packaged with Python 2.0, it was seriously --- 181,185 ---- \refmodule{xml.dom.minidom}: ! \begin{methoddesc}[Node]{cloneNode}{deep} Although this method was present in the version of \refmodule{xml.dom.minidom} packaged with Python 2.0, it was seriously From fdrake at users.sourceforge.net Thu Mar 25 11:51:15 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 12:01:59 2004 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib.tex,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10007 Modified Files: liburllib.tex Log Message: Note that reading from a socket may not always return all of the remaining content of a stream when expected to do so. Closes SF bug #725265. Should be backported to Python 2.3.x. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** liburllib.tex 27 Aug 2003 15:11:40 -0000 1.51 --- liburllib.tex 25 Mar 2004 16:51:12 -0000 1.52 *************** *** 30,33 **** --- 30,37 ---- \method{close()}, \method{info()} and \method{geturl()}. It also has proper support for the iterator protocol. + One caveat: the \method{read()} method, if the size argument is + omitted or negative, may not read until the end of the data stream; + there is no good way to determine that the entire stream from a socket + has been read in the general case. Except for the \method{info()} and \method{geturl()} methods, From bcannon at users.sourceforge.net Thu Mar 25 11:55:20 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 25 12:06:04 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.961,1.962 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11409/Misc Modified Files: NEWS Log Message: Fixed a caching bug in platform.platform() where the argument of 'terse' was not taken into consideration when caching value. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.961 retrieving revision 1.962 diff -C2 -d -r1.961 -r1.962 *** NEWS 24 Mar 2004 21:57:09 -0000 1.961 --- NEWS 25 Mar 2004 16:55:12 -0000 1.962 *************** *** 284,288 **** 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. --- 284,288 ---- 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. *************** *** 297,300 **** --- 297,303 ---- ------- + - Fixed a caching bug in platform.platform() where the argument of 'terse' was + not taken into consideration when caching value. + - Added two new command-line arguments for profile (output file and default sort). From bcannon at users.sourceforge.net Thu Mar 25 11:55:45 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 25 12:06:30 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11409/Lib Modified Files: platform.py Log Message: Fixed a caching bug in platform.platform() where the argument of 'terse' was not taken into consideration when caching value. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** platform.py 6 Nov 2003 14:06:47 -0000 1.9 --- platform.py 25 Mar 2004 16:55:11 -0000 1.10 *************** *** 1136,1141 **** ### The Opus Magnum of platform strings :-) ! _platform_cache = None ! _platform_aliased_cache = None def platform(aliased=0, terse=0): --- 1136,1141 ---- ### The Opus Magnum of platform strings :-) ! _platform_cache = {True:None, False:None} ! _platform_aliased_cache = {True:None, False:None} def platform(aliased=0, terse=0): *************** *** 1160,1167 **** global _platform_cache,_platform_aliased_cache ! if not aliased and (_platform_cache is not None): ! return _platform_cache ! elif _platform_aliased_cache is not None: ! return _platform_aliased_cache # Get uname information and then apply platform specific cosmetics --- 1160,1167 ---- global _platform_cache,_platform_aliased_cache ! if not aliased and (_platform_cache[bool(terse)] is not None): ! return _platform_cache[bool(terse)] ! elif _platform_aliased_cache[bool(terse)] is not None: ! return _platform_aliased_cache[bool(terse)] # Get uname information and then apply platform specific cosmetics *************** *** 1220,1228 **** if aliased: ! _platform_aliased_cache = platform elif terse: pass else: ! _platform_cache = platform return platform --- 1220,1228 ---- if aliased: ! _platform_aliased_cache[bool(terse)] = platform elif terse: pass else: ! _platform_cache[bool(terse)] = platform return platform From bcannon at users.sourceforge.net Thu Mar 25 11:56:16 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 25 12:07:02 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.5.8.1,1.5.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11663/Lib Modified Files: Tag: release23-maint platform.py Log Message: Fixed a caching bug in platform.platform() where the argument of 'terse' was not taken into consideration when caching value. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.5.8.1 retrieving revision 1.5.8.2 diff -C2 -d -r1.5.8.1 -r1.5.8.2 *** platform.py 14 Oct 2003 22:32:34 -0000 1.5.8.1 --- platform.py 25 Mar 2004 16:56:14 -0000 1.5.8.2 *************** *** 1137,1142 **** ### The Opus Magnum of platform strings :-) ! _platform_cache = None ! _platform_aliased_cache = None def platform(aliased=0, terse=0): --- 1137,1142 ---- ### The Opus Magnum of platform strings :-) ! _platform_cache = {True:None, False:None} ! _platform_aliased_cache = {True:None, False:None} def platform(aliased=0, terse=0): *************** *** 1161,1168 **** global _platform_cache,_platform_aliased_cache ! if not aliased and (_platform_cache is not None): ! return _platform_cache ! elif _platform_aliased_cache is not None: ! return _platform_aliased_cache # Get uname information and then apply platform specific cosmetics --- 1161,1168 ---- global _platform_cache,_platform_aliased_cache ! if not aliased and (_platform_cache[bool(terse)] is not None): ! return _platform_cache[bool(terse)] ! elif _platform_aliased_cache[bool(terse)] is not None: ! return _platform_aliased_cache[bool(terse)] # Get uname information and then apply platform specific cosmetics *************** *** 1221,1229 **** if aliased: ! _platform_aliased_cache = platform elif terse: pass else: ! _platform_cache = platform return platform --- 1221,1229 ---- if aliased: ! _platform_aliased_cache[bool(terse)] = platform elif terse: pass else: ! _platform_cache[bool(terse)] = platform return platform From bcannon at users.sourceforge.net Thu Mar 25 11:56:16 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 25 12:07:07 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.96,1.831.4.97 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11663/Misc Modified Files: Tag: release23-maint NEWS Log Message: Fixed a caching bug in platform.platform() where the argument of 'terse' was not taken into consideration when caching value. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.96 retrieving revision 1.831.4.97 diff -C2 -d -r1.831.4.96 -r1.831.4.97 *** NEWS 21 Mar 2004 19:53:59 -0000 1.831.4.96 --- NEWS 25 Mar 2004 16:56:14 -0000 1.831.4.97 *************** *** 39,42 **** --- 39,45 ---- ------- + - Fixed a caching bug in platform.platform() where the argument of 'terse' was + not taken into consideration when caching value. + - Bug #920575: A problem that _locale module segfaults on nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed. From mondragon at users.sourceforge.net Wed Mar 24 16:57:40 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Thu Mar 25 13:33:20 2004 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8622/Include Modified Files: pystate.h Log Message: Enable the profiling of C functions (builtins and extensions) Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** pystate.h 13 Mar 2004 20:45:47 -0000 2.26 --- pystate.h 24 Mar 2004 21:57:08 -0000 2.27 *************** *** 46,49 **** --- 46,52 ---- #define PyTrace_LINE 2 #define PyTrace_RETURN 3 + #define PyTrace_C_CALL 4 + #define PyTrace_C_EXCEPTION 5 + #define PyTrace_C_RETURN 6 typedef struct _ts { From bcannon at users.sourceforge.net Thu Mar 25 13:32:13 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 25 13:42:57 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31797/Lib Modified Files: platform.py Log Message: Fix last patch to be backwards-compatible with Python 1.5.2 . Bumped version micro number. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** platform.py 25 Mar 2004 16:55:11 -0000 1.10 --- platform.py 25 Mar 2004 18:32:11 -0000 1.11 *************** *** 32,35 **** --- 32,36 ---- # # History: + # 1.0.2 - fix a bug with caching of value for platform() # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS *************** *** 103,107 **** """ ! __version__ = '1.0.1' import sys,string,os,re --- 104,108 ---- """ ! __version__ = '1.0.2' import sys,string,os,re *************** *** 1136,1141 **** ### The Opus Magnum of platform strings :-) ! _platform_cache = {True:None, False:None} ! _platform_aliased_cache = {True:None, False:None} def platform(aliased=0, terse=0): --- 1137,1144 ---- ### The Opus Magnum of platform strings :-) ! _platform_cache_terse = None ! _platform_cache_not_terse = None ! _platform_aliased_cache_terse = None ! _platform_aliased_cache_not_terse = None def platform(aliased=0, terse=0): *************** *** 1158,1167 **** """ ! global _platform_cache,_platform_aliased_cache ! if not aliased and (_platform_cache[bool(terse)] is not None): ! return _platform_cache[bool(terse)] ! elif _platform_aliased_cache[bool(terse)] is not None: ! return _platform_aliased_cache[bool(terse)] # Get uname information and then apply platform specific cosmetics --- 1161,1175 ---- """ ! global _platform_cache_terse, _platform_cache_not_terse ! global _platform_aliased_cache_terse, _platform_aliased_cache_not_terse ! if not aliased and terse and (_platform_cache_terse is not None): ! return _platform_cache_terse ! elif not aliased and not terse and (_platform_cache_not_terse is not None): ! return _platform_cache_not_terse ! elif terse and _platform_aliased_cache_terse is not None: ! return _platform_aliased_cache_terse ! elif not terse and _platform_aliased_cache_not_terse is not None: ! return _platform_aliased_cache_not_terse # Get uname information and then apply platform specific cosmetics *************** *** 1219,1228 **** platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased: ! _platform_aliased_cache[bool(terse)] = platform elif terse: pass else: ! _platform_cache[bool(terse)] = platform return platform --- 1227,1241 ---- platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased and terse: ! _platform_aliased_cache_terse = platform ! elif aliased and not terse: ! _platform_aliased_cache_not_terse = platform elif terse: pass else: ! if terse: ! _platform_cache_terse = platform ! else: ! _platform_cache_not_terse = platform return platform From lemburg at users.sourceforge.net Thu Mar 25 13:35:14 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Thu Mar 25 13:45:59 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32651 Modified Files: platform.py Log Message: Added more Windows version names (thanks to Thomas Heller). Fixed bug in platform() cache (thanks to Brett Cannon). (Restored Python 1.5.2 compatibility.) Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** platform.py 25 Mar 2004 18:32:11 -0000 1.11 --- platform.py 25 Mar 2004 18:35:12 -0000 1.12 *************** *** 32,36 **** # # History: ! # 1.0.2 - fix a bug with caching of value for platform() # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS --- 32,36 ---- # # History: ! # 1.0.2 - added more Windows support # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS *************** *** 458,462 **** --- 458,466 ---- # XXX Is there any way to find out the processor type on WinXX ? # XXX Is win32 available on Windows CE ? + # # Adapted from code posted by Karl Putland to comp.lang.python. + # + # The mappings between reg. values and release names can be found + # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp # Import the needed APIs *************** *** 480,485 **** if min == 0: release = '95' ! else: release = '98' elif maj == 5: release = '2000' --- 484,493 ---- if min == 0: release = '95' ! elif min == 10: release = '98' + elif min == 90: + release = 'Me' + else: + release = 'postMe' elif maj == 5: release = '2000' *************** *** 489,493 **** release = 'NT' elif maj == 5: ! release = '2000' else: if not release: --- 497,508 ---- release = 'NT' elif maj == 5: ! if min == 0: ! release = '2000' ! elif min == 1: ! release = 'XP' ! elif min == 2: ! release = '2003Server' ! else: ! release = 'post2003' else: if not release: *************** *** 1137,1144 **** ### The Opus Magnum of platform strings :-) ! _platform_cache_terse = None ! _platform_cache_not_terse = None ! _platform_aliased_cache_terse = None ! _platform_aliased_cache_not_terse = None def platform(aliased=0, terse=0): --- 1152,1156 ---- ### The Opus Magnum of platform strings :-) ! _platform_cache = {} def platform(aliased=0, terse=0): *************** *** 1161,1175 **** """ ! global _platform_cache_terse, _platform_cache_not_terse ! global _platform_aliased_cache_terse, _platform_aliased_cache_not_terse ! ! if not aliased and terse and (_platform_cache_terse is not None): ! return _platform_cache_terse ! elif not aliased and not terse and (_platform_cache_not_terse is not None): ! return _platform_cache_not_terse ! elif terse and _platform_aliased_cache_terse is not None: ! return _platform_aliased_cache_terse ! elif not terse and _platform_aliased_cache_not_terse is not None: ! return _platform_aliased_cache_not_terse # Get uname information and then apply platform specific cosmetics --- 1173,1179 ---- """ ! result = _platform_cache.get((aliased, terse), None) ! if result is not None: ! return result # Get uname information and then apply platform specific cosmetics *************** *** 1227,1241 **** platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased and terse: ! _platform_aliased_cache_terse = platform ! elif aliased and not terse: ! _platform_aliased_cache_not_terse = platform ! elif terse: ! pass ! else: ! if terse: ! _platform_cache_terse = platform ! else: ! _platform_cache_not_terse = platform return platform --- 1231,1235 ---- platform = _platform(system,release,machine,processor,bits,linkage) ! _platform_cache[(aliased, terse)] = platform return platform From bcannon at users.sourceforge.net Thu Mar 25 13:35:40 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Mar 25 13:46:24 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.5.8.2,1.5.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32702/Lib Modified Files: Tag: release23-maint platform.py Log Message: Fix last patch to make backwards-compatible with Python 1.5.2 . Bumped up micro version number. Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.5.8.2 retrieving revision 1.5.8.3 diff -C2 -d -r1.5.8.2 -r1.5.8.3 *** platform.py 25 Mar 2004 16:56:14 -0000 1.5.8.2 --- platform.py 25 Mar 2004 18:35:38 -0000 1.5.8.3 *************** *** 32,35 **** --- 32,36 ---- # # History: + # 1.0.2 - fix a bug with caching of value for platform() # 1.0.1 - reformatted to make doc.py happy # 1.0.0 - reformatted a bit and checked into Python CVS *************** *** 103,107 **** """ ! __version__ = '1.0.1' import sys,string,os,re --- 104,108 ---- """ ! __version__ = '1.0.2' import sys,string,os,re *************** *** 202,206 **** # Check for slackware verson tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') ! for n in range(len(verfiles)-1, -1, -1): if verfiles[n][:14] != 'slack-version-': del verfiles[n] --- 203,207 ---- # Check for slackware verson tag file (thanks to Greg Andruk) verfiles = os.listdir('/usr/lib/setup') ! for n in reversed(xrange(len(verfiles))): if verfiles[n][:14] != 'slack-version-': del verfiles[n] *************** *** 1083,1087 **** """ global _sys_version_cache - import time if _sys_version_cache is not None: --- 1084,1087 ---- *************** *** 1137,1142 **** ### The Opus Magnum of platform strings :-) ! _platform_cache = {True:None, False:None} ! _platform_aliased_cache = {True:None, False:None} def platform(aliased=0, terse=0): --- 1137,1144 ---- ### The Opus Magnum of platform strings :-) ! _platform_cache_terse = None ! _platform_cache_not_terse = None ! _platform_aliased_cache_terse = None ! _platform_aliased_cache_not_terse = None def platform(aliased=0, terse=0): *************** *** 1159,1168 **** """ ! global _platform_cache,_platform_aliased_cache ! if not aliased and (_platform_cache[bool(terse)] is not None): ! return _platform_cache[bool(terse)] ! elif _platform_aliased_cache[bool(terse)] is not None: ! return _platform_aliased_cache[bool(terse)] # Get uname information and then apply platform specific cosmetics --- 1161,1175 ---- """ ! global _platform_cache_terse, _platform_cache_not_terse ! global _platform_aliased_cache_terse, _platform_aliased_cache_not_terse ! if not aliased and terse and (_platform_cache_terse is not None): ! return _platform_cache_terse ! elif not aliased and not terse and (_platform_cache_not_terse is not None): ! return _platform_cache_not_terse ! elif terse and _platform_aliased_cache_terse is not None: ! return _platform_aliased_cache_terse ! elif not terse and _platform_aliased_cache_not_terse is not None: ! return _platform_aliased_cache_not_terse # Get uname information and then apply platform specific cosmetics *************** *** 1220,1229 **** platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased: ! _platform_aliased_cache[bool(terse)] = platform elif terse: pass else: ! _platform_cache[bool(terse)] = platform return platform --- 1227,1241 ---- platform = _platform(system,release,machine,processor,bits,linkage) ! if aliased and terse: ! _platform_aliased_cache_terse = platform ! elif aliased and not terse: ! _platform_aliased_cache_not_terse = platform elif terse: pass else: ! if terse: ! _platform_cache_terse = platform ! else: ! _platform_cache_not_terse = platform return platform From montanaro at users.sourceforge.net Thu Mar 25 16:46:00 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu Mar 25 16:56:56 2004 Subject: [Python-checkins] python/nondist/peps pep-0318.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10566 Modified Files: pep-0318.txt Log Message: Add verbiage about class decorators and their status Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0318.txt 23 Mar 2004 16:41:17 -0000 1.5 --- pep-0318.txt 25 Mar 2004 21:45:58 -0000 1.6 *************** *** 1,4 **** PEP: 318 ! Title: Function/Method Decorator Syntax Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 318 ! Title: Decorators for Functions, Methods and Classes Version: $Revision$ Last-Modified: $Date$ *************** *** 16,24 **** Abstract ======== ! ! The current method for declaring class and static methods is awkward ! and can lead to code that is difficult to understand. Ideally, these ! transformations should be made at the same point in the code where the ! declaration itself is made. This PEP introduces new syntax for transformations of a declaration. --- 16,24 ---- Abstract ======== ! ! The current method for declaring class and static methods is awkward ! and can lead to code that is difficult to understand. Ideally, these ! transformations should be made at the same point in the code where the ! declaration itself is made. This PEP introduces new syntax for transformations of a declaration. *************** *** 55,58 **** --- 55,65 ---- pass + Modifying classes in this fashion is also possible, though the + benefits are not as immediately apparent. Almost certainly, anything + which could be done with class decorators could be done using + metaclasses, but using metaclasses is sufficiently obscure that there + is some attraction to having an easier way to make simple + modifications to classes. + Background ========== *************** *** 65,70 **** the topic`_ on ``python-dev`` shortly after the conference, attributing the bracketed syntax to an earlier proposal on ! ``comp.lang.python`` by `Gareth ! McCaughan`_. .. _syntactic support for decorators: http://www.python.org/doc/essays/ppt/python10/py10keynote.pdf --- 72,76 ---- the topic`_ on ``python-dev`` shortly after the conference, attributing the bracketed syntax to an earlier proposal on ! ``comp.lang.python`` by `Gareth McCaughan`_. .. _syntactic support for decorators: http://www.python.org/doc/essays/ppt/python10/py10keynote.pdf *************** *** 74,77 **** --- 80,86 ---- .. _gareth mccaughan: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=slrna40k88.2h9o.Gareth.McCaughan%40g.local + Class decorations seem like an obvious next step because class + definition and function definition are syntactically similar. + Design Goals ============ *************** *** 84,98 **** * work with multiple wrappers per definition ! * make it obvious what is happening; at the very least it should be ! obvious that new users can safely ignore it when writing their own code * not make future extensions more difficult ! * be easy to type; programs that use it are expected to use it very frequently ! * not make it more difficult to scan through code quickly. It should ! still be easy to search for all definitions, a particular definition, or the arguments that a function accepts --- 93,107 ---- * work with multiple wrappers per definition ! * make it obvious what is happening; at the very least it should be ! obvious that new users can safely ignore it when writing their own code * not make future extensions more difficult ! * be easy to type; programs that use it are expected to use it very frequently ! * not make it more difficult to scan through code quickly. It should ! still be easy to search for all definitions, a particular definition, or the arguments that a function accepts *************** *** 106,110 **** =============== ! The currently proposed syntax is:: def func(arg1, arg2, ...) [dec1, dec2, ...]: --- 115,119 ---- =============== ! The currently proposed syntax for function decorators is:: def func(arg1, arg2, ...) [dec1, dec2, ...]: *************** *** 115,118 **** --- 124,132 ---- easily break long lists of decorators across multiple lines. + Class decorators are defined in an analogous fashion:: + + class MyClass(base1, base2) [dec1, dec2, ...]: + pass + Alternate Proposals =================== *************** *** 124,129 **** The absence of brackets makes it cumbersome to break long lists of ! decorators across multiple lines. The keyword "as" doesn't have the ! same meaning as its use in the ``import`` statement. :: --- 138,146 ---- The absence of brackets makes it cumbersome to break long lists of ! decorators across multiple lines, and the keyword "as" doesn't have ! the same meaning as its use in the ``import`` statement. Plenty of ! `alternatives to "as"`_ have been proposed. :-) ! ! .. _alternatives to "as": http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=mailman.236.1079968472.742.python-list%40python.org&rnum=2&prev=/groups%3Fq%3Dpython%2Bpep%2B318%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3Dmailman.236.1079968472.742.python-list%2540python.org%26rnum%3D2 :: *************** *** 132,136 **** pass ! This form has the disadvantage that the decorators become visually higher priority than the function name and argument list. --- 149,153 ---- pass ! This form has the disadvantage that the decorators visually assume higher priority than the function name and argument list. *************** *** 140,148 **** pass ! Quixote's Page Template Language uses this form, but only supports a single decorator chosen from a restricted set. For short lists it works okay, but for long list it separates the argument list from the function name. :: --- 157,167 ---- pass ! Quixote's `Python Template Language`_ uses this form, but only supports a single decorator chosen from a restricted set. For short lists it works okay, but for long list it separates the argument list from the function name. + .. _Python Template Language: http://www.mems-exchange.org/software/quixote/doc/PTL.html + :: *************** *** 157,169 **** it impossible to tell which objects following the block will be decorated. Nesting the function definition within the using: block ! suggests block structure that doesn't exist. The name ``foo`` would ! actually exist at the same scope as the using: block. Finally, it ! would require the introduction of a new keyword. Current Implementation ====================== ! Michael Hudson has posted a `patch`_ at Starship, which implements the ! proposed syntax and left-first application of decorators:: def func(arg1, arg2, ...) [dec1, dec2]: --- 176,189 ---- it impossible to tell which objects following the block will be decorated. Nesting the function definition within the using: block ! suggests nesting of namespaces that doesn't exist. The name ``foo`` ! would actually exist at the same scope as the using: block. Finally, ! it would require the introduction of a new keyword. Current Implementation ====================== ! Michael Hudson posted a `patch`_ at Starship, which implements the ! proposed syntax changes for both functions and classes and left-first ! application of decorators:: def func(arg1, arg2, ...) [dec1, dec2]: *************** *** 178,182 **** though without the intermediate creation of a variable named ``func``. ! .. _patch: http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar.diff Examples --- 198,202 ---- though without the intermediate creation of a variable named ``func``. ! .. _patch: http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar-3.diff Examples *************** *** 184,190 **** Much of the discussion on ``comp.lang.python`` and the ``python-dev`` ! mailing list focuses on the use of the ``staticmethod()`` and ! ``classmethod()`` builtins. This capability is much more powerful ! than that. This section presents some examples of use. 1. Define a function to be executed at exit. Note that the function --- 204,211 ---- Much of the discussion on ``comp.lang.python`` and the ``python-dev`` ! mailing list focuses on the use of decorators as a cleaner way to use ! the ``staticmethod()`` and ``classmethod()`` builtins. This ! capability is much more powerful than that. This section presents ! some examples of use. 1. Define a function to be executed at exit. Note that the function *************** *** 225,230 **** return decorate ! def classmethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ... --- 246,251 ---- return decorate ! def mymethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ... *************** *** 235,238 **** --- 256,260 ---- def accepts(*types): def check_accepts(f): + assert len(types) == f.func_code.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): *************** *** 240,244 **** "arg %r does not match %s" % (a,t) return f(*args, **kwds) - assert len(types) == f.func_code.co_argcount return new_f return check_accepts --- 262,265 ---- *************** *** 258,275 **** return arg1 * arg2 Of course, all these examples are possible today, though without the syntactic support. ! Possible Extensions ! =================== ! ! The proposed syntax is general enough that it could be used on class ! definitions as well:: ! class foo(object) [dec1, dec2, ...]: ! class definition here ! Use would likely be much less than function decorators. The current ! patch only implements function decorators. --- 279,319 ---- return arg1 * arg2 + 5. Declare that a class implements a particular (set of) interface(s). + This is from a posting by Bob Ippolito on ``python-dev`` based on + experience with `PyProtocols`_. + + .. _PyProtocols: http://peak.telecommunity.com/PyProtocols.html + :: + + def provides(*interfaces): + """ + An actual, working, implementation of provides for + the current implementation of PyProtocols. Not + particularly important for the PEP text. + """ + def provides(typ): + declareImplementation(typ, instancesProvide=interfaces) + return typ + return provides + + class IBar(Interface): + """Declare something about IBar here""" + + class Foo(object) [provides(IBar)]: + """Implement something here...""" + Of course, all these examples are possible today, though without the syntactic support. ! Open Issues ! =========== ! 1. It's not yet certain that class decorators will be incorporated ! into the language at this point. Guido expressed skepticism about ! the concept, but various people have made some `strong arguments`_ ! (search for ``PEP 318 - posting draft``) on their behalf in ! ``python-dev``. ! .. _strong arguments: http://mail.python.org/pipermail/python-dev/2004-March/thread.html From fdrake at users.sourceforge.net Thu Mar 25 17:04:56 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Mar 25 17:15:45 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_scripts.py, 1.21, 1.22 sdist.py, 1.56, 1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16236 Modified Files: build_scripts.py sdist.py Log Message: make sure the default manifest generation includes files identified as scripts closes SF bug 796042 Index: build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** build_scripts.py 27 Jun 2003 19:33:38 -0000 1.21 --- build_scripts.py 25 Mar 2004 22:04:51 -0000 1.22 *************** *** 42,45 **** --- 42,47 ---- self.scripts = self.distribution.scripts + def get_source_files(self): + return self.scripts def run (self): Index: sdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/sdist.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** sdist.py 19 Nov 2002 13:12:28 -0000 1.56 --- sdist.py 25 Mar 2004 22:04:52 -0000 1.57 *************** *** 305,308 **** --- 305,312 ---- self.filelist.extend(build_clib.get_source_files()) + if self.distribution.has_scripts(): + build_scripts = self.get_finalized_command('build_scripts') + self.filelist.extend(build_scripts.get_source_files()) + # add_defaults () From rhettinger at users.sourceforge.net Fri Mar 26 02:56:27 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 26 03:07:16 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.225,1.226 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24443 Modified Files: tut.tex Log Message: Update timeit example to reflect current performance. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.225 retrieving revision 1.226 diff -C2 -d -r1.225 -r1.226 *** tut.tex 21 Mar 2004 22:12:45 -0000 1.225 --- tut.tex 26 Mar 2004 07:56:23 -0000 1.226 *************** *** 4635,4646 **** 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 >>> 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} --- 4635,4646 ---- feature instead of the traditional approach to swapping arguments. The \ulink{\module{timeit}}{../lib/module-timeit.html} module ! quickly demonstrates a modest performance advantage: \begin{verbatim} >>> from timeit import Timer >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() ! 0.57535828626024577 >>> Timer('a,b = b,a', 'a=1; b=2').timeit() ! 0.54962537085770791 \end{verbatim} From rhettinger at users.sourceforge.net Fri Mar 26 06:17:12 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 26 06:28:07 2004 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32139 Modified Files: sre_compile.py Log Message: Simple optimizations: * pre-build a single identity function for the fixup function * pre-build membership tests in dictionaries instead of in-line tuples * assign len() to a local variable * assign append() methods to a local variable * use xrange() instead of range() * replace "x<<1" with "x+x" Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** sre_compile.py 25 Mar 2004 13:50:59 -0000 1.51 --- sre_compile.py 26 Mar 2004 11:16:55 -0000 1.52 *************** *** 22,30 **** MAXCODE = 0xFFFFFFFFL def _compile(code, pattern, flags): # internal: compile a (sub)pattern emit = code.append for op, av in pattern: ! if op in (LITERAL, NOT_LITERAL): if flags & SRE_FLAG_IGNORECASE: emit(OPCODES[OP_IGNORE[op]]) --- 22,44 ---- MAXCODE = 0xFFFFFFFFL + def _identityfunction(x): + return x + + # use xrange if available + try: + xrange + except NameError: + xrange = range + def _compile(code, pattern, flags): # internal: compile a (sub)pattern emit = code.append + _len = len + LITERAL_CODES = {LITERAL:1, NOT_LITERAL:1} + REPEATING_CODES = {REPEAT:1, MIN_REPEAT:1, MAX_REPEAT:1} + SUCCESS_CODES = {SUCCESS:1, FAILURE:1} + ASSERT_CODES = {ASSERT:1, ASSERT_NOT:1} for op, av in pattern: ! if op in LITERAL_CODES: if flags & SRE_FLAG_IGNORECASE: emit(OPCODES[OP_IGNORE[op]]) *************** *** 40,47 **** else: emit(OPCODES[op]) ! fixup = lambda x: x ! skip = len(code); emit(0) _compile_charset(av, flags, code, fixup) ! code[skip] = len(code) - skip elif op is ANY: if flags & SRE_FLAG_DOTALL: --- 54,61 ---- else: emit(OPCODES[op]) ! fixup = _identityfunction ! skip = _len(code); emit(0) _compile_charset(av, flags, code, fixup) ! code[skip] = _len(code) - skip elif op is ANY: if flags & SRE_FLAG_DOTALL: *************** *** 49,81 **** else: emit(OPCODES[ANY]) ! elif op in (REPEAT, MIN_REPEAT, MAX_REPEAT): if flags & SRE_FLAG_TEMPLATE: raise error, "internal: unsupported template operator" emit(OPCODES[REPEAT]) ! skip = len(code); emit(0) emit(av[0]) emit(av[1]) _compile(code, av[2], flags) emit(OPCODES[SUCCESS]) ! code[skip] = len(code) - skip ! elif _simple(av) and op != REPEAT: ! if op == MAX_REPEAT: emit(OPCODES[REPEAT_ONE]) else: emit(OPCODES[MIN_REPEAT_ONE]) ! skip = len(code); emit(0) emit(av[0]) emit(av[1]) _compile(code, av[2], flags) emit(OPCODES[SUCCESS]) ! code[skip] = len(code) - skip else: emit(OPCODES[REPEAT]) ! skip = len(code); emit(0) emit(av[0]) emit(av[1]) _compile(code, av[2], flags) ! code[skip] = len(code) - skip ! if op == MAX_REPEAT: emit(OPCODES[MAX_UNTIL]) else: --- 63,95 ---- else: emit(OPCODES[ANY]) ! elif op in REPEATING_CODES: if flags & SRE_FLAG_TEMPLATE: raise error, "internal: unsupported template operator" emit(OPCODES[REPEAT]) ! skip = _len(code); emit(0) emit(av[0]) emit(av[1]) _compile(code, av[2], flags) emit(OPCODES[SUCCESS]) ! code[skip] = _len(code) - skip ! elif _simple(av) and op is not REPEAT: ! if op is MAX_REPEAT: emit(OPCODES[REPEAT_ONE]) else: emit(OPCODES[MIN_REPEAT_ONE]) ! skip = _len(code); emit(0) emit(av[0]) emit(av[1]) _compile(code, av[2], flags) emit(OPCODES[SUCCESS]) ! code[skip] = _len(code) - skip else: emit(OPCODES[REPEAT]) ! skip = _len(code); emit(0) emit(av[0]) emit(av[1]) _compile(code, av[2], flags) ! code[skip] = _len(code) - skip ! if op is MAX_REPEAT: emit(OPCODES[MAX_UNTIL]) else: *************** *** 90,98 **** emit(OPCODES[MARK]) emit((av[0]-1)*2+1) ! elif op in (SUCCESS, FAILURE): emit(OPCODES[op]) ! elif op in (ASSERT, ASSERT_NOT): emit(OPCODES[op]) ! skip = len(code); emit(0) if av[0] >= 0: emit(0) # look ahead --- 104,112 ---- emit(OPCODES[MARK]) emit((av[0]-1)*2+1) ! elif op in SUCCESS_CODES: emit(OPCODES[op]) ! elif op in ASSERT_CODES: emit(OPCODES[op]) ! skip = _len(code); emit(0) if av[0] >= 0: emit(0) # look ahead *************** *** 104,114 **** _compile(code, av[1], flags) emit(OPCODES[SUCCESS]) ! code[skip] = len(code) - skip elif op is CALL: emit(OPCODES[op]) ! skip = len(code); emit(0) _compile(code, av, flags) emit(OPCODES[SUCCESS]) ! code[skip] = len(code) - skip elif op is AT: emit(OPCODES[op]) --- 118,128 ---- _compile(code, av[1], flags) emit(OPCODES[SUCCESS]) ! code[skip] = _len(code) - skip elif op is CALL: emit(OPCODES[op]) ! skip = _len(code); emit(0) _compile(code, av, flags) emit(OPCODES[SUCCESS]) ! code[skip] = _len(code) - skip elif op is AT: emit(OPCODES[op]) *************** *** 123,136 **** emit(OPCODES[op]) tail = [] for av in av[1]: ! skip = len(code); emit(0) # _compile_info(code, av, flags) _compile(code, av, flags) emit(OPCODES[JUMP]) ! tail.append(len(code)); emit(0) ! code[skip] = len(code) - skip emit(0) # end of branch for tail in tail: ! code[tail] = len(code) - tail elif op is CATEGORY: emit(OPCODES[op]) --- 137,151 ---- emit(OPCODES[op]) tail = [] + tailappend = tail.append for av in av[1]: ! skip = _len(code); emit(0) # _compile_info(code, av, flags) _compile(code, av, flags) emit(OPCODES[JUMP]) ! tailappend(_len(code)); emit(0) ! code[skip] = _len(code) - skip emit(0) # end of branch for tail in tail: ! code[tail] = _len(code) - tail elif op is CATEGORY: emit(OPCODES[op]) *************** *** 149,162 **** emit(OPCODES[op]) emit((av[0]-1)*2) ! skipyes = len(code); emit(0) _compile(code, av[1], flags) if av[2]: emit(OPCODES[JUMP]) ! skipno = len(code); emit(0) ! code[skipyes] = len(code) - skipyes + 1 _compile(code, av[2], flags) ! code[skipno] = len(code) - skipno else: ! code[skipyes] = len(code) - skipyes + 1 else: raise ValueError, ("unsupported operand type", op) --- 164,177 ---- emit(OPCODES[op]) emit((av[0]-1)*2) ! skipyes = _len(code); emit(0) _compile(code, av[1], flags) if av[2]: emit(OPCODES[JUMP]) ! skipno = _len(code); emit(0) ! code[skipyes] = _len(code) - skipyes + 1 _compile(code, av[2], flags) ! code[skipno] = _len(code) - skipno else: ! code[skipyes] = _len(code) - skipyes + 1 else: raise ValueError, ("unsupported operand type", op) *************** *** 166,170 **** emit = code.append if fixup is None: ! fixup = lambda x: x for op, av in _optimize_charset(charset, fixup): emit(OPCODES[op]) --- 181,185 ---- emit = code.append if fixup is None: ! fixup = _identityfunction for op, av in _optimize_charset(charset, fixup): emit(OPCODES[op]) *************** *** 194,202 **** # internal: optimize character set out = [] charmap = [False]*256 try: for op, av in charset: if op is NEGATE: ! out.append((op, av)) elif op is LITERAL: charmap[fixup(av)] = True --- 209,218 ---- # internal: optimize character set out = [] + outappend = out.append charmap = [False]*256 try: for op, av in charset: if op is NEGATE: ! outappend((op, av)) elif op is LITERAL: charmap[fixup(av)] = True *************** *** 213,216 **** --- 229,233 ---- i = p = n = 0 runs = [] + runsappend = runs.append for c in charmap: if c: *************** *** 219,234 **** n = n + 1 elif n: ! runs.append((p, n)) n = 0 i = i + 1 if n: ! runs.append((p, n)) if len(runs) <= 2: # use literal/range for p, n in runs: if n == 1: ! out.append((LITERAL, p)) else: ! out.append((RANGE, (p, p+n-1))) if len(out) < len(charset): return out --- 236,251 ---- n = n + 1 elif n: ! runsappend((p, n)) n = 0 i = i + 1 if n: ! runsappend((p, n)) if len(runs) <= 2: # use literal/range for p, n in runs: if n == 1: ! outappend((LITERAL, p)) else: ! outappend((RANGE, (p, p+n-1))) if len(out) < len(charset): return out *************** *** 236,240 **** # use bitmap data = _mk_bitmap(charmap) ! out.append((CHARSET, data)) return out return charset --- 253,257 ---- # use bitmap data = _mk_bitmap(charmap) ! outappend((CHARSET, data)) return out return charset *************** *** 242,245 **** --- 259,263 ---- def _mk_bitmap(bits): data = [] + dataappend = data.append if _sre.CODESIZE == 2: start = (1, 0) *************** *** 250,256 **** if c: v = v + m ! m = m << 1 if m > MAXCODE: ! data.append(v) m, v = start return data --- 268,274 ---- if c: v = v + m ! m = m + m if m > MAXCODE: ! dataappend(v) m, v = start return data *************** *** 296,300 **** charmap[fixup(av)] = True elif op is RANGE: ! for i in range(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: --- 314,318 ---- charmap[fixup(av)] = True elif op is RANGE: ! for i in xrange(fixup(av[0]), fixup(av[1])+1): charmap[i] = True elif op is CATEGORY: *************** *** 308,312 **** # XXX: negation does not work with big charsets return charset ! for i in range(65536): charmap[i] = not charmap[i] comps = {} --- 326,330 ---- # XXX: negation does not work with big charsets return charset ! for i in xrange(65536): charmap[i] = not charmap[i] comps = {} *************** *** 314,318 **** block = 0 data = [] ! for i in range(256): chunk = tuple(charmap[i*256:(i+1)*256]) new = comps.setdefault(chunk, block) --- 332,336 ---- block = 0 data = [] ! for i in xrange(256): chunk = tuple(charmap[i*256:(i+1)*256]) new = comps.setdefault(chunk, block) *************** *** 349,354 **** --- 367,374 ---- # look for a literal prefix prefix = [] + prefixappend = prefix.append prefix_skip = 0 charset = [] # not used + charsetappend = charset.append if not (flags & SRE_FLAG_IGNORECASE): # look for literal prefix *************** *** 357,365 **** if len(prefix) == prefix_skip: prefix_skip = prefix_skip + 1 ! prefix.append(av) elif op is SUBPATTERN and len(av[1]) == 1: op, av = av[1][0] if op is LITERAL: ! prefix.append(av) else: break --- 377,385 ---- if len(prefix) == prefix_skip: prefix_skip = prefix_skip + 1 ! prefixappend(av) elif op is SUBPATTERN and len(av[1]) == 1: op, av = av[1][0] if op is LITERAL: ! prefixappend(av) else: break *************** *** 372,378 **** op, av = av[1][0] if op is LITERAL: ! charset.append((op, av)) elif op is BRANCH: c = [] for p in av[1]: if not p: --- 392,399 ---- op, av = av[1][0] if op is LITERAL: ! charsetappend((op, av)) elif op is BRANCH: c = [] + cappend = c.append for p in av[1]: if not p: *************** *** 380,384 **** op, av = p[0] if op is LITERAL: ! c.append((op, av)) else: break --- 401,405 ---- op, av = p[0] if op is LITERAL: ! cappend((op, av)) else: break *************** *** 387,390 **** --- 408,412 ---- elif op is BRANCH: c = [] + cappend = c.append for p in av[1]: if not p: *************** *** 392,396 **** op, av = p[0] if op is LITERAL: ! c.append((op, av)) else: break --- 414,418 ---- op, av = p[0] if op is LITERAL: ! cappend((op, av)) else: break *************** *** 433,437 **** # generate overlap table table = [-1] + ([0]*len(prefix)) ! for i in range(len(prefix)): table[i+1] = table[i]+1 while table[i+1] > 0 and prefix[i] != prefix[table[i+1]-1]: --- 455,459 ---- # generate overlap table table = [-1] + ([0]*len(prefix)) ! for i in xrange(len(prefix)): table[i+1] = table[i]+1 while table[i+1] > 0 and prefix[i] != prefix[table[i+1]-1]: From onanh693rl at alles.or.jp Thu Mar 25 22:09:52 2004 From: onanh693rl at alles.or.jp (Kristi Abbott) Date: Fri Mar 26 07:07:33 2004 Subject: [Python-checkins] Stock to climb on unprecedented run of profitability iwysnilsokypkewv Message-ID: <18$mdbk-3d9e26-kgw4g0$$7j4@m090i5.8y> **SRGE****SRGE****SRGE****SRGE****SRGE****SRGE** Market Watch News Flash Explosive short term trading profits in a new technology issue (Ticker: SRGE) are being predicted as many significant news releases indicate strong contractual revenues with major Telecom firms. SRGE has been successfully working with Telecommunications giants (with five million subscriber lines) over the last 4 years, but is now projecting "a banner expansion year with geometric growth in revenues" due largely to sales demands for their innovative patented products and expansion into International telecom markets. Surge Technologies, Inc. (SRGE) is a cutting-edge leader that designs, develops, manufactures, and markets superior patented outside plant electrical surge protection equipment for the telecommunications industry. The US sales projections for this market are $4 Billion annually, with this figure growing rapidly as the expansion of new HDSL and ADSL technologies permeate the industry. SRGE provides the Telecom industry with the highest quality "protection element" for complex digital switches. Protecting these Telecom switching devices is crucial to inclusive components that are sensitive to interruptions in voltage which can cause extensive network damage, thus negating costly and time-consuming repair and down-time. Major Telecoms require this protection throughout their network in order to prevent the hazards of harming personnel, damaging expensive equipment, and massive system failures. Opening Price: 1.15 10 Day Target: 2.30 1 Month Target: 4.50 Outstanding Shares: 16.5 million Est. Float: 2.2 million How many times have you seen issues explode but you couldn't get your hands on them or didn't have the right information in time? We are alerting you now to a special Company with a unique technology that is on the forefront of a breakout! We are excited about SRGE's technology and expansion as they prepare to ink deal after deal with Major US Telecoms in conjunction with dramatic increases in revenue for 2004 and 2005. SRGE has made phenomenal advancements but may be one of the few stocks left in this industry group that is unknown and undervalued, therefore a 300%-400% jump may wind up being conservative. -------------------------------------------------------- Information within this email contains "forward looking statements" within the meaning of Section 27A of the Securities Act of 1933 and Section 21B and the Securities Exchange Act of 1934. Any statements that express or involve discussions with respect to predictions, goals, expectations, beliefs, plans, projections, objectives, assumptions or future events or performance are not statements of historical fact and may be "forward looking statements". Forward looking statements are based upon expectations, estimates and projections, at the time the statements are made that involve a number of risks and uncertainties which could cause actual results or events to differ materially from those presently anticipated. Forward looking statements in this action may be identified through the use of words such as: "projects", "foresee", "expects", "estimates", "believes", "understands", "will", "anticipates", or that by statements indicating certain actions "may", "could", or "might" occur. All information provided within this email pertaining to investing, stocks, securities must be understood as information provided and not investment advice. Emerging Equity Alert advises all readers and subscribers to seek advice from a registered professional securities representative before deciding to trade in stocks featured within this email. None of the material within this report shall be construed as any kind of investment advice. In compliance with Section 17(b), we disclose the holdings of independently purchased shares of srge prior to the publication of this report. Be aware of an inherent conflict of interest resulting from such holdings due to our intent to profit from the liquidation of these shares. Shares may be sold at any time, even after positive statements have been made regarding the above company. pxsrthlippplzkdf lia qvg j From bcannon at users.sourceforge.net Fri Mar 26 10:01:32 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri Mar 26 10:12:25 2004 Subject: [Python-checkins] python/nondist/sandbox/string - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14758/string Log Message: Directory /cvsroot/python/python/nondist/sandbox/string added to the repository From bcannon at users.sourceforge.net Fri Mar 26 10:03:42 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri Mar 26 10:14:35 2004 Subject: [Python-checkins] python/nondist/sandbox/string __init__.py, NONE, 1.1 string.py, NONE, 1.1 pep292.py, NONE, 1.1 safedict.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14961/string Added Files: __init__.py string.py pep292.py safedict.py Log Message: Initial go at a PEP 292 implementation. 'string' module in check-in is a straight copy from Lib in order to make imports work without any hassle. --- NEW FILE: __init__.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) __version__ = '1.0' # __all__ either needs to be left out for blanket importation or needs to have # something like ``__all__.extend([stuff # for stuff from dir(sys.modules['string']) # if not stuff.startswith('_')])`` #__all__ = [ # 'dstring', 'astring', # 'safedict', 'nsdict', # ] from pep292 import dstring, astring from safedict import safedict, nsdict from string import * --- NEW FILE: string.py --- """A collection of string operations (most are no longer used). Warning: most of the code you see here isn't normally used nowadays. Beginning with Python 1.6, many of these functions are implemented as methods on the standard string object. They used to be implemented by a built-in module called strop, but strop is now obsolete itself. Public module variables: whitespace -- a string containing all characters considered whitespace lowercase -- a string containing all characters considered lowercase letters uppercase -- a string containing all characters considered uppercase letters letters -- a string containing all characters considered letters digits -- a string containing all characters considered decimal digits hexdigits -- a string containing all characters considered hexadecimal digits octdigits -- a string containing all characters considered octal digits punctuation -- a string containing all characters considered punctuation printable -- a string containing all characters considered printable """ # Some strings for ctype-style character classification whitespace = ' \t\n\r\v\f' lowercase = 'abcdefghijklmnopqrstuvwxyz' uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' letters = lowercase + uppercase ascii_lowercase = lowercase ascii_uppercase = uppercase ascii_letters = ascii_lowercase + ascii_uppercase digits = '0123456789' hexdigits = digits + 'abcdef' + 'ABCDEF' octdigits = '01234567' punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" printable = digits + letters + punctuation + whitespace # Case conversion helpers # Use str to convert Unicode literal in case of -U l = map(chr, xrange(256)) _idmap = str('').join(l) del l # Backward compatible names for exceptions index_error = ValueError atoi_error = ValueError atof_error = ValueError atol_error = ValueError # convert UPPER CASE letters to lower case def lower(s): """lower(s) -> string Return a copy of the string s converted to lowercase. """ return s.lower() # Convert lower case letters to UPPER CASE def upper(s): """upper(s) -> string Return a copy of the string s converted to uppercase. """ return s.upper() # Swap lower case letters and UPPER CASE def swapcase(s): """swapcase(s) -> string Return a copy of the string s with upper case characters converted to lowercase and vice versa. """ return s.swapcase() # Strip leading and trailing tabs and spaces def strip(s, chars=None): """strip(s [,chars]) -> string Return a copy of the string s with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping. """ return s.strip(chars) # Strip leading tabs and spaces def lstrip(s, chars=None): """lstrip(s [,chars]) -> string Return a copy of the string s with leading whitespace removed. If chars is given and not None, remove characters in chars instead. """ return s.lstrip(chars) # Strip trailing tabs and spaces def rstrip(s, chars=None): """rstrip(s [,chars]) -> string Return a copy of the string s with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. """ return s.rstrip(chars) # Split a string into a list of space/tab-separated words def split(s, sep=None, maxsplit=-1): """split(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the delimiter string. If maxsplit is given, splits at no more than maxsplit places (resulting in at most maxsplit+1 words). If sep is not specified, any whitespace string is a separator. (split and splitfields are synonymous) """ return s.split(sep, maxsplit) 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 = ' '): """join(list [,sep]) -> string Return a string composed of the words in list, with intervening occurrences of sep. The default separator is a single space. (joinfields and join are synonymous) """ return sep.join(words) joinfields = join # Find substring, raise exception if not found def index(s, *args): """index(s, sub [,start [,end]]) -> int Like find but raises ValueError when the substring is not found. """ return s.index(*args) # Find last substring, raise exception if not found def rindex(s, *args): """rindex(s, sub [,start [,end]]) -> int Like rfind but raises ValueError when the substring is not found. """ return s.rindex(*args) # Count non-overlapping occurrences of substring def count(s, *args): """count(s, sub[, start[,end]]) -> int Return the number of occurrences of substring sub in string s[start:end]. Optional arguments start and end are interpreted as in slice notation. """ return s.count(*args) # Find substring, return -1 if not found def find(s, *args): """find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.find(*args) # Find last substring, return -1 if not found def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.rfind(*args) # for a bit of speed _float = float _int = int _long = long # Convert string to float def atof(s): """atof(s) -> float Return the floating point number represented by the string s. """ return _float(s) # Convert string to integer def atoi(s , base=10): """atoi(s [,base]) -> int Return the integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. If base is 16, a preceding 0x or 0X is accepted. """ return _int(s, base) # Convert string to long integer def atol(s, base=10): """atol(s [,base]) -> long Return the long integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. If base is 16, a preceding 0x or 0X is accepted. A trailing L or l is not accepted, unless base is 0. """ return _long(s, base) # Left-justify a string def ljust(s, width, *args): """ljust(s, width[, fillchar]) -> string Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. If specified the fillchar is used instead of spaces. """ return s.ljust(width, *args) # Right-justify a string def rjust(s, width, *args): """rjust(s, width[, fillchar]) -> string Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. If specified the fillchar is used instead of spaces. """ return s.rjust(width, *args) # Center a string def center(s, width, *args): """center(s, width[, fillchar]) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated. If specified the fillchar is used instead of spaces. """ return s.center(width, *args) # Zero-fill a number, e.g., (12, 3) --> '012' and (-3, 3) --> '-03' # Decadent feature: the argument may be a string or a number # (Use of this is deprecated; it should be a string as with ljust c.s.) def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if not isinstance(x, basestring): x = repr(x) return x.zfill(width) # Expand tabs in a string. # Doesn't take non-printing chars into account, but does understand \n. def expandtabs(s, tabsize=8): """expandtabs(s [,tabsize]) -> string Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8). """ return s.expandtabs(tabsize) # Character translation through look-up table. def translate(s, table, deletions=""): """translate(s,table [,deletions]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. The deletions argument is not allowed for Unicode strings. """ if deletions: return s.translate(table, deletions) else: # Add s[:0] so that if s is Unicode and table is an 8-bit string, # table is converted to Unicode. This means that table *cannot* # be a dictionary -- for that feature, use u.translate() directly. return s.translate(table + s[:0]) # Capitalize a string, e.g. "aBc dEf" -> "Abc def". def capitalize(s): """capitalize(s) -> string Return a copy of the string s with only its first character capitalized. """ return s.capitalize() # Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def". # See also regsub.capwords(). def capwords(s, sep=None): """capwords(s, [sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. Note that this replaces runs of whitespace characters by a single space. """ return join(map(capitalize, s.split(sep)), sep or ' ') # Construct a translation string _idmapL = None def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments must have same length" global _idmapL if not _idmapL: _idmapL = map(None, _idmap) L = _idmapL[:] fromstr = map(ord, fromstr) for i in range(len(fromstr)): L[fromstr[i]] = tostr[i] return join(L, "") # Substring replacement (global) def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. """ return s.replace(old, new, maxsplit) # Try importing optional built-in module "strop" -- if it exists, # it redefines some string operations that are 100-1000 times faster. # It also defines values for whitespace, lowercase and uppercase # that match 's definitions. try: from strop import maketrans, lowercase, uppercase, whitespace letters = lowercase + uppercase except ImportError: pass # Use the original versions --- NEW FILE: pep292.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) """A package supporting PEP 292 Simple String Substitutions. See http://www.python.org/peps/pep-0292.html for full specification. Two subclasses of the unicode type are provided: dstring - PEP 292 'dollar' strings with the following substitution rules: 1. $$ is an escape; it is replaced with a single $ 2. $identifier names a substitution placeholder matching a mapping key of "identifier". "identifier" must be a Python identifier as defined in [2]. The first non-identifier character after the $ character terminates this placeholder specification. 3. ${identifier} is equivalent to $identifier. It is required for when valid identifier characters follow the placeholder but are not part of the placeholder, e.g. "${noun}ification". No other characters have special meaning. [2] Identifiers and Keywords http://www.python.org/doc/current/ref/identifiers.html astring - like dstring, but allows dotted identifiers (i.e. attribute paths) as the substitution variables. You can also derive your own classes from dstring to define different identifier rules. UTSL for details. Examples: >>> x = dstring('$who owes me $what') >>> print x $who owes me $what >>> print x % {'who': 'Tim', 'what': 'a bag of ham'} Tim owes me a bag of ham >>> import re >>> class mstring(dstring): ... cre = re.compile( ... r'(\${2})|\$(mm:[_a-z]\w*)|\$({mm:[_a-z]\w*})', re.IGNORECASE) ... >>> x = mstring('$who owes me $mm:what') >>> print x % {'who': 'Tim', 'mm:what', 'nothing'} $who owes me nothing """ __all__ = ['dstring', 'astring'] import re # Search for $$, $identifier, or ${identifier} dre = re.compile(r'(\${2})|\$([_a-z][_a-z0-9]*)|\$({[_a-z][_a-z0-9]*})', re.IGNORECASE) # Like dre, but allows dots after the first character are = re.compile(r'(\${2})|\$([_a-z][_.a-z0-9]*)|\$({[_a-z][_.a-z0-9]*})', re.IGNORECASE) EMPTYSTRING = '' class dstring(unicode): cre = dre """A string class for supporting $-substitutions.""" def __init__(self, s, *args, **kws): s = s.replace('%', '%%') parts = self.cre.split(s) # Here's what the elements of parts looks like after the split: # # 0 - any text before the first match # i, i+1, i+2 - groups of 3 corresponding to the three capturing # parentheses in the regular expression. Only one of these # three will not be None, since of course only one group will # match. # i+3 - this will be all the non-matching text between this match and # the next one, or the end of the string if this is the last # match. # # The algorithm then is to figure out which of the three groups # matched, and replace it with the %()s equivalent syntax. for i in range(1, len(parts), 4): if parts[i] is not None: # This matched the escape pattern. It can just be replaced # with a single dollar since that's not special to Python's # build-in string interpolation. parts[i] = '$' elif parts[i+1] is not None: # This matched $identifier. The $ is not retained in the # capturing parenthesis group. parts[i+1] = '%(' + parts[i+1] + ')s' else: # This matched ${identifier}. The $ is not retained in the # capturing parenthesis group, but the curly braces are. # Doing so is useful for the safedict. parts[i+2] = '%(' + parts[i+2] + ')s' # Cache Pythonically syntaxed substitution string self._modstr = EMPTYSTRING.join(filter(None, parts)) super(unicode, self).__init__(s, *args, **kws) def __mod__(self, other): return self._modstr % other class astring(dstring): """Like string, but allow for dotted attribute paths.""" cre = are --- NEW FILE: safedict.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) """Substitution dictionaries. These work with $-string to provide foolproof substitutions. """ import sys _missing = object() class safedict(dict): """Dictionary which returns a default value for unknown keys.""" def __getitem__(self, key): if key.startswith('{') and key.endswith('}'): key = key[1:-1] fmt = '${%s}' else: fmt = '$%s' try: return super(safedict, self).__getitem__(key) except KeyError: return fmt % key class nsdict(dict): startframe = 1 """Dictionary which substitutes in locals and globals.""" def __getitem__(self, key): if key.startswith('{') and key.endswith('}'): key = key[1:-1] fmt = '${%s}' else: fmt = '$%s' # Split the key as if it were an attribute path parts = key.split('.') part0 = parts.pop(0) # Now search for the parts, starting with the locals and then trying # the globals, in the frame one call site up. _getframe(0) would be # nsdict.__getitem__(). You can start in different frame locations by # deriving from this class and overriding startframe. The default is # to start at our caller. frame = sys._getframe(self.startframe) if frame.f_locals.has_key(part0): obj = frame.f_locals[part0] elif frame.f_globals.has_key(part0): obj = frame.f_globals[part0] else: return fmt % key while parts: attr = parts.pop(0) obj = getattr(obj, attr, _missing) if obj is _missing: return fmt % key return obj From arigo at users.sourceforge.net Fri Mar 26 10:09:29 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Fri Mar 26 10:20:22 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_marshal.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16157/Lib/test Modified Files: test_marshal.py Log Message: Marshal clean-up (SF patch #873224) Index: test_marshal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_marshal.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_marshal.py 18 Jan 2004 20:29:55 -0000 1.5 --- test_marshal.py 26 Mar 2004 15:09:27 -0000 1.6 *************** *** 176,179 **** --- 176,184 ---- marshal.dumps([128] * 1000) + def test_patch_873224(self): + self.assertRaises(Exception, marshal.loads, '0') + self.assertRaises(Exception, marshal.loads, 'f') + self.assertRaises(Exception, marshal.loads, marshal.dumps(5L)[:-1]) + def test_main(): test_support.run_unittest(IntTestCase, From arigo at users.sourceforge.net Fri Mar 26 10:09:29 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Fri Mar 26 10:20:25 2004 Subject: [Python-checkins] python/dist/src/Python import.c, 2.228, 2.229 marshal.c, 1.75, 1.76 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16157/Python Modified Files: import.c marshal.c Log Message: Marshal clean-up (SF patch #873224) Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.228 retrieving revision 2.229 diff -C2 -d -r2.228 -r2.229 *** import.c 24 Mar 2004 22:22:12 -0000 2.228 --- import.c 26 Mar 2004 15:09:27 -0000 2.229 *************** *** 707,716 **** co = PyMarshal_ReadLastObjectFromFile(fp); ! /* Ugly: rd_object() may return NULL with or without error */ ! if (co == NULL || !PyCode_Check(co)) { ! if (!PyErr_Occurred()) ! PyErr_Format(PyExc_ImportError, ! "Non-code object in %.200s", cpathname); ! Py_XDECREF(co); return NULL; } --- 707,716 ---- co = PyMarshal_ReadLastObjectFromFile(fp); ! if (co == NULL) ! return NULL; ! if (!PyCode_Check(co)) { ! PyErr_Format(PyExc_ImportError, ! "Non-code object in %.200s", cpathname); ! Py_DECREF(co); return NULL; } *************** *** 820,824 **** PyMarshal_WriteLongToFile(0L, fp); PyMarshal_WriteObjectToFile((PyObject *)co, fp); ! if (ferror(fp)) { if (Py_VerboseFlag) PySys_WriteStderr("# can't write %s\n", cpathname); --- 820,824 ---- PyMarshal_WriteLongToFile(0L, fp); PyMarshal_WriteObjectToFile((PyObject *)co, fp); ! if (fflush(fp) != 0 || ferror(fp)) { if (Py_VerboseFlag) PySys_WriteStderr("# can't write %s\n", cpathname); Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** marshal.c 4 Sep 2003 11:59:50 -0000 1.75 --- marshal.c 26 Mar 2004 15:09:27 -0000 1.76 *************** *** 381,384 **** --- 381,386 ---- r_object(RFILE *p) { + /* NULL is a valid return value, it does not necessarily means that + an exception is set. */ PyObject *v, *v2; long i, n; *************** *** 431,436 **** return NULL; ob->ob_size = n; ! for (i = 0; i < size; i++) ! ob->ob_digit[i] = r_short(p); return (PyObject *)ob; } --- 433,446 ---- return NULL; ob->ob_size = n; ! for (i = 0; i < size; i++) { ! int digit = r_short(p); ! if (digit < 0) { ! Py_DECREF(ob); ! PyErr_SetString(PyExc_ValueError, ! "bad marshal data"); ! return NULL; ! } ! ob->ob_digit[i] = digit; ! } return (PyObject *)ob; } *************** *** 441,445 **** double dx; n = r_byte(p); ! if (r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); --- 451,455 ---- double dx; n = r_byte(p); ! if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); *************** *** 459,463 **** Py_complex c; n = r_byte(p); ! if (r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); --- 469,473 ---- Py_complex c; n = r_byte(p); ! if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); *************** *** 469,473 **** PyFPE_END_PROTECT(c) n = r_byte(p); ! if (r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); --- 479,483 ---- PyFPE_END_PROTECT(c) n = r_byte(p); ! if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); *************** *** 536,539 **** --- 546,552 ---- v2 = r_object(p); if ( v2 == NULL ) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_TypeError, + "NULL object in marshal data"); Py_DECREF(v); v = NULL; *************** *** 556,559 **** --- 569,575 ---- v2 = r_object(p); if ( v2 == NULL ) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_TypeError, + "NULL object in marshal data"); Py_DECREF(v); v = NULL; *************** *** 572,576 **** key = r_object(p); if (key == NULL) ! break; /* XXX Assume TYPE_NULL, not an error */ val = r_object(p); if (val != NULL) --- 588,592 ---- key = r_object(p); if (key == NULL) ! break; val = r_object(p); if (val != NULL) *************** *** 579,582 **** --- 595,602 ---- Py_XDECREF(val); } + if (PyErr_Occurred()) { + Py_DECREF(v); + v = NULL; + } return v; *************** *** 593,619 **** int stacksize = r_long(p); int flags = r_long(p); ! PyObject *code = NULL; ! PyObject *consts = NULL; ! PyObject *names = NULL; ! PyObject *varnames = NULL; ! PyObject *freevars = NULL; ! PyObject *cellvars = NULL; ! PyObject *filename = NULL; ! PyObject *name = NULL; ! int firstlineno = 0; ! PyObject *lnotab = NULL; ! ! code = r_object(p); ! if (code) consts = r_object(p); ! if (consts) names = r_object(p); ! if (names) varnames = r_object(p); ! if (varnames) freevars = r_object(p); ! if (freevars) cellvars = r_object(p); ! if (cellvars) filename = r_object(p); ! if (filename) name = r_object(p); ! if (name) { ! firstlineno = r_long(p); ! lnotab = r_object(p); ! } if (!PyErr_Occurred()) { --- 613,626 ---- int stacksize = r_long(p); int flags = r_long(p); ! PyObject *code = r_object(p); ! PyObject *consts = r_object(p); ! PyObject *names = r_object(p); ! PyObject *varnames = r_object(p); ! PyObject *freevars = r_object(p); ! PyObject *cellvars = r_object(p); ! PyObject *filename = r_object(p); ! PyObject *name = r_object(p); ! int firstlineno = r_long(p); ! PyObject *lnotab = r_object(p); if (!PyErr_Occurred()) { *************** *** 648,651 **** --- 655,672 ---- } + PyObject * + read_object(RFILE *p) + { + PyObject *v; + if (PyErr_Occurred()) { + fprintf(stderr, "XXX readobject called with exception set\n"); + return NULL; + } + v = r_object(p); + if (v == NULL && !PyErr_Occurred()) + PyErr_SetString(PyExc_TypeError, "NULL object in marshal data"); + return v; + } + int PyMarshal_ReadShortFromFile(FILE *fp) *************** *** 694,701 **** off_t filesize; #endif - if (PyErr_Occurred()) { - fprintf(stderr, "XXX rd_object called with exception set\n"); - return NULL; - } #ifdef HAVE_FSTAT filesize = getfilesize(fp); --- 715,718 ---- *************** *** 731,740 **** { RFILE rf; - if (PyErr_Occurred()) { - fprintf(stderr, "XXX rd_object called with exception set\n"); - return NULL; - } rf.fp = fp; ! return r_object(&rf); } --- 748,753 ---- { RFILE rf; rf.fp = fp; ! return read_object(&rf); } *************** *** 743,755 **** { RFILE rf; - if (PyErr_Occurred()) { - fprintf(stderr, "XXX rds_object called with exception set\n"); - return NULL; - } rf.fp = NULL; - rf.str = NULL; rf.ptr = str; rf.end = str + len; ! return r_object(&rf); } --- 756,763 ---- { RFILE rf; rf.fp = NULL; rf.ptr = str; rf.end = str + len; ! return read_object(&rf); } *************** *** 817,821 **** RFILE rf; PyObject *f; - PyObject *v; if (!PyArg_ParseTuple(args, "O:load", &f)) return NULL; --- 825,828 ---- *************** *** 826,838 **** } rf.fp = PyFile_AsFile(f); ! rf.str = NULL; ! rf.ptr = rf.end = NULL; ! PyErr_Clear(); ! v = r_object(&rf); ! if (PyErr_Occurred()) { ! Py_XDECREF(v); ! v = NULL; ! } ! return v; } --- 833,837 ---- } rf.fp = PyFile_AsFile(f); ! return read_object(&rf); } *************** *** 850,854 **** { RFILE rf; - PyObject *v; char *s; int n; --- 849,852 ---- *************** *** 856,869 **** return NULL; rf.fp = NULL; - rf.str = args; rf.ptr = s; rf.end = s + n; ! PyErr_Clear(); ! v = r_object(&rf); ! if (PyErr_Occurred()) { ! Py_XDECREF(v); ! v = NULL; ! } ! return v; } --- 854,860 ---- return NULL; rf.fp = NULL; rf.ptr = s; rf.end = s + n; ! return read_object(&rf); } From david_ascher at users.sourceforge.net Fri Mar 26 10:10:27 2004 From: david_ascher at users.sourceforge.net (david_ascher@users.sourceforge.net) Date: Fri Mar 26 10:21:19 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_tcl.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16089 Modified Files: test_tcl.py Log Message: Fix test failure for test_tcl on OS/X and Windows if a version of Tcl other than ActiveTcl is installed (ActiveTcl included TclX, other Tcl distros didn't). I'm removing the package loading test because it's hard to come up with a package that is guaranteed to be in any Tcl installation. Special-casing darwin and windows is ok since that leaves the only Tk platform (X) which the test was trying to address. Index: test_tcl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tcl.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_tcl.py 29 Feb 2004 15:37:50 -0000 1.3 --- test_tcl.py 26 Mar 2004 15:10:25 -0000 1.4 *************** *** 112,121 **** self.assertRaises(TclError,tcl.evalfile,filename) - def testPackageRequire(self): - tcl = self.interp - tcl.eval('package require Tclx') - tcl.eval('keylset a b.c 1') - self.assertEqual(tcl.eval('keylget a b.c'),'1') - def testPackageRequireException(self): tcl = self.interp --- 112,115 ---- *************** *** 136,140 **** old_display = None import sys ! if sys.platform.startswith('win'): return # no failure possible on windows? if 'DISPLAY' in os.environ: --- 130,134 ---- old_display = None import sys ! if sys.platform.startswith('win') or sys.platform.startswith('darwin'): return # no failure possible on windows? if 'DISPLAY' in os.environ: From nascheme at users.sourceforge.net Fri Mar 26 10:30:01 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri Mar 26 10:40:55 2004 Subject: [Python-checkins] python/dist/src/Include pyport.h, 2.51.2.1, 2.51.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20531/Include Modified Files: Tag: ast-branch pyport.h Log Message: Provide INT_MIN too. Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.51.2.1 retrieving revision 2.51.2.2 diff -C2 -d -r2.51.2.1 -r2.51.2.2 *** pyport.h 28 Apr 2003 17:32:50 -0000 2.51.2.1 --- pyport.h 26 Mar 2004 15:29:59 -0000 2.51.2.2 *************** *** 516,519 **** --- 516,520 ---- #ifndef INT_MAX #define INT_MAX 2147483647 + #define INT_MIN (-INT_MAX - 1) #endif From nascheme at users.sourceforge.net Fri Mar 26 10:34:12 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri Mar 26 10:45:05 2004 Subject: [Python-checkins] python/dist/src/Include compile.h, 2.37.2.8, 2.37.2.9 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20689/Include Modified Files: Tag: ast-branch compile.h Log Message: Implement a smarter stackdepth() function. * Move 'instr' and 'basicblock' structure definitions out of compile.h and into newcompile.c. * Add an 'i_target' field to the 'instr' struct. Use it instead of using 'i_oparg' for both block indices and instruction offsets. * Update list of outstanding issues and bugs. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37.2.8 retrieving revision 2.37.2.9 diff -C2 -d -r2.37.2.8 -r2.37.2.9 *** compile.h 26 Jul 2003 00:35:15 -0000 2.37.2.8 --- compile.h 26 Mar 2004 15:34:10 -0000 2.37.2.9 *************** *** 35,66 **** DL_IMPORT(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); - #define DEFAULT_BLOCK_SIZE 16 - #define DEFAULT_BLOCKS 8 - #define DEFAULT_CODE_SIZE 128 - #define DEFAULT_LNOTAB_SIZE 16 - - struct instr { - int i_jabs : 1; - int i_jrel : 1; - int i_hasarg : 1; - unsigned char i_opcode; - int i_oparg; - int i_lineno; - }; - - struct basicblock { - int b_iused; - int b_ialloc; - /* If b_next is non-zero, it is the block id of the next - block reached by normal control flow. - Since a valid b_next must always be > 0, - 0 can be reserved to mean no next block. */ - int b_next; - /* b_seen is used to perform a DFS of basicblocks. */ - int b_seen : 1; - /* b_return is true if a RETURN_VALUE opcode is inserted. */ - int b_return : 1; - struct instr b_instr[DEFAULT_BLOCK_SIZE]; - }; #ifdef __cplusplus --- 35,38 ---- From nascheme at users.sourceforge.net Fri Mar 26 10:34:13 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri Mar 26 10:45:12 2004 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.85, 1.1.2.86 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20689/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Implement a smarter stackdepth() function. * Move 'instr' and 'basicblock' structure definitions out of compile.h and into newcompile.c. * Add an 'i_target' field to the 'instr' struct. Use it instead of using 'i_oparg' for both block indices and instruction offsets. * Update list of outstanding issues and bugs. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.85 retrieving revision 1.1.2.86 diff -C2 -d -r1.1.2.85 -r1.1.2.86 *** newcompile.c 21 Mar 2004 21:19:33 -0000 1.1.2.85 --- newcompile.c 26 Mar 2004 15:34:10 -0000 1.1.2.86 *************** *** 17,25 **** Seg Faults: - #: using coding statement, such as in getopt: - # -*- coding: iso-8859-1 -*- - needs to be implemented (see also Python/ast.c encoding_decl) #: exec generally still has problems - #: test_errno fails because stackdepth() isn't implemented (assert'ed) #: do something about memory management! --- 17,21 ---- *************** *** 33,36 **** --- 29,34 ---- Invalid behaviour: + #: Source encoding (via encoding_decl) is ignored. decode_unicode() + seems to be running into a memory management bug. #: Ellipsis isn't handled properly #: co_names doesn't contain locals, only globals, co_varnames may work *************** *** 48,51 **** --- 46,56 ---- to use real pointers for jump targets rather than indexes into an array of basic blocks. + + opcode_stack_effect() function should be reviewed since stack depth bugs + could be really hard to find later. Also, the stack effect of + MAKE_CLOSURE is not accurate. One idea is to have the compiler generate + an explict BUILD_TUPLE opcode before MAKE_CLOSURE. + + Dead code is being generated (i.e. after unconditional jumps). */ *************** *** 65,68 **** --- 70,104 ---- }; + #define DEFAULT_BLOCK_SIZE 16 + #define DEFAULT_BLOCKS 8 + #define DEFAULT_CODE_SIZE 128 + #define DEFAULT_LNOTAB_SIZE 16 + + struct instr { + int i_jabs : 1; + int i_jrel : 1; + int i_hasarg : 1; + unsigned char i_opcode; + int i_oparg; + int i_target; /* target block index (if jump instruction) */ + int i_lineno; + }; + + struct basicblock { + int b_iused; + int b_ialloc; + /* If b_next is non-zero, it is the block id of the next + block reached by normal control flow. + Since a valid b_next must always be > 0, + 0 can be reserved to mean no next block. */ + int b_next; + /* b_seen is used to perform a DFS of basicblocks. */ + int b_seen : 1; + /* b_return is true if a RETURN_VALUE opcode is inserted. */ + int b_return : 1; + int b_startdepth; /* depth of stack upon entry of block */ + struct instr b_instr[DEFAULT_BLOCK_SIZE]; + }; + /* The following items change on entry and exit of code blocks. They must be saved and restored when returning to a block. *************** *** 621,624 **** --- 657,878 ---- static int + opcode_stack_effect(int opcode, int oparg) + { + switch (opcode) { + case POP_TOP: + return -1; + case ROT_TWO: + case ROT_THREE: + return 0; + case DUP_TOP: + return 1; + case ROT_FOUR: + return 0; + + case UNARY_POSITIVE: + case UNARY_NEGATIVE: + case UNARY_NOT: + case UNARY_CONVERT: + case UNARY_INVERT: + return 0; + + case BINARY_POWER: + case BINARY_MULTIPLY: + case BINARY_DIVIDE: + case BINARY_MODULO: + case BINARY_ADD: + case BINARY_SUBTRACT: + case BINARY_SUBSCR: + case BINARY_FLOOR_DIVIDE: + case BINARY_TRUE_DIVIDE: + return -1; + case INPLACE_FLOOR_DIVIDE: + case INPLACE_TRUE_DIVIDE: + return -1; + + case SLICE+0: + return 0; + case SLICE+1: + return -1; + case SLICE+2: + return -1; + case SLICE+3: + return -2; + + case STORE_SLICE+0: + return -2; + case STORE_SLICE+1: + return -3; + case STORE_SLICE+2: + return -3; + case STORE_SLICE+3: + return -4; + + case DELETE_SLICE+0: + return -1; + case DELETE_SLICE+1: + return -2; + case DELETE_SLICE+2: + return -2; + case DELETE_SLICE+3: + return -3; + + case INPLACE_ADD: + case INPLACE_SUBTRACT: + case INPLACE_MULTIPLY: + case INPLACE_DIVIDE: + case INPLACE_MODULO: + return -1; + case STORE_SUBSCR: + return -3; + case DELETE_SUBSCR: + return -2; + + case BINARY_LSHIFT: + case BINARY_RSHIFT: + case BINARY_AND: + case BINARY_XOR: + case BINARY_OR: + return -1; + case INPLACE_POWER: + return -1; + case GET_ITER: + return 0; + + case PRINT_EXPR: + return -1; + case PRINT_ITEM: + return -1; + case PRINT_NEWLINE: + return 0; + case PRINT_ITEM_TO: + return -2; + case PRINT_NEWLINE_TO: + return -1; + case INPLACE_LSHIFT: + case INPLACE_RSHIFT: + case INPLACE_AND: + case INPLACE_XOR: + case INPLACE_OR: + return -1; + case BREAK_LOOP: + return 0; + + case LOAD_LOCALS: + return 1; + case RETURN_VALUE: + return -1; + case IMPORT_STAR: + return -1; + case EXEC_STMT: + return -3; + case YIELD_VALUE: + return -1; + + case POP_BLOCK: + return 0; + case END_FINALLY: + return -1; /* XXX or -2 or -3 */ + case BUILD_CLASS: + return -2; + + case STORE_NAME: + return -1; + case DELETE_NAME: + return 0; + case UNPACK_SEQUENCE: + return oparg-1; + case FOR_ITER: + return 1; + + case STORE_ATTR: + return -2; + case DELETE_ATTR: + return -1; + case STORE_GLOBAL: + return -1; + case DELETE_GLOBAL: + return 0; + case DUP_TOPX: + return oparg; + case LOAD_CONST: + return 1; + case LOAD_NAME: + return 1; + case BUILD_TUPLE: + case BUILD_LIST: + return 1-oparg; + case BUILD_MAP: + return 1; + case LOAD_ATTR: + return 0; + case COMPARE_OP: + return -1; + case IMPORT_NAME: + return 0; + case IMPORT_FROM: + return 1; + + case JUMP_FORWARD: + case JUMP_IF_FALSE: + case JUMP_IF_TRUE: + case JUMP_ABSOLUTE: + return 0; + + case LOAD_GLOBAL: + return 1; + + case CONTINUE_LOOP: + return 0; + case SETUP_LOOP: + return 0; + case SETUP_EXCEPT: + case SETUP_FINALLY: + return 3; /* XXX isn't this 0? */ + + case LOAD_FAST: + return 1; + case STORE_FAST: + return -1; + case DELETE_FAST: + return 0; + + case RAISE_VARARGS: + return -oparg; + #define NARGS(o) (((o) % 256) + 2*((o) / 256)) + case CALL_FUNCTION: + return -NARGS(oparg); + case CALL_FUNCTION_VAR: + case CALL_FUNCTION_KW: + return -NARGS(oparg)-1; + case CALL_FUNCTION_VAR_KW: + return -NARGS(oparg)-2; + #undef NARGS + case MAKE_FUNCTION: + return -oparg; + case BUILD_SLICE: + if (oparg == 3) + return -2; + else + return -1; + + case MAKE_CLOSURE: + /* XXX Also pops free variables to creates a tuple. */ + return -oparg; + case LOAD_CLOSURE: + return 1; + case LOAD_DEREF: + return 1; + case STORE_DEREF: + return -1; + default: + fprintf(stderr, "opcode = %d\n", opcode); + Py_FatalError("opcode_stack_effect()"); + + } + return 0; /* not reachable */ + } + + static int compiler_addop(struct compiler *c, int opcode) { *************** *** 730,734 **** i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off]; i->i_opcode = opcode; ! i->i_oparg = block; i->i_hasarg = 1; if (absolute) --- 984,988 ---- i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off]; i->i_opcode = opcode; ! i->i_target = block; i->i_hasarg = 1; if (absolute) *************** *** 2409,2422 **** instr = &b->b_instr[i]; if (instr->i_jrel || instr->i_jabs) ! dfs(c, instr->i_oparg, a); } a->a_postorder[a->a_nblocks++] = block; } static int stackdepth(struct compiler *c) { ! /* XXX need to do this */ ! return 1000; } --- 2663,2716 ---- instr = &b->b_instr[i]; if (instr->i_jrel || instr->i_jabs) ! dfs(c, instr->i_target, a); } a->a_postorder[a->a_nblocks++] = block; } + int + stackdepth_walk(struct compiler *c, int block, int depth, int maxdepth) + { + int i; + struct instr *instr; + struct basicblock *b; + b = c->u->u_blocks[block]; + if (b->b_seen || b->b_startdepth >= depth) + return maxdepth; + b->b_seen = 1; + b->b_startdepth = depth; + for (i = 0; i < b->b_iused; i++) { + instr = &b->b_instr[i]; + depth += opcode_stack_effect(instr->i_opcode, instr->i_oparg); + assert(depth >= 0); /* invalid code or bug in stackdepth() */ + if (depth > maxdepth) + maxdepth = depth; + if (instr->i_jrel || instr->i_jabs) { + maxdepth = stackdepth_walk(c, instr->i_target, + depth, maxdepth); + if (instr->i_opcode == JUMP_ABSOLUTE || + instr->i_opcode == JUMP_FORWARD) { + goto out; /* remaining code is dead */ + } + } + } + if (b->b_next) + maxdepth = stackdepth_walk(c, b->b_next, depth, maxdepth); + out: + b->b_seen = 0; + return maxdepth; + } + + /* Find the flow path that needs the largest stack. We assume that + * cycles in the flow graph have no net effect on the stack depth. + */ static int stackdepth(struct compiler *c) { ! int i; ! for (i = 0; i < c->u->u_nblocks; i++) { ! c->u->u_blocks[i]->b_seen = 0; ! c->u->u_blocks[i]->b_startdepth = INT_MIN; ! } ! return stackdepth_walk(c, 0, 0, 0); } *************** *** 2691,2697 **** bsize += instrsize(instr); if (instr->i_jabs) ! instr->i_oparg = blockoff[instr->i_oparg]; else if (instr->i_jrel) { ! int delta = blockoff[instr->i_oparg] - bsize; instr->i_oparg = delta; } --- 2985,2991 ---- bsize += instrsize(instr); if (instr->i_jabs) ! instr->i_oparg = blockoff[instr->i_target]; else if (instr->i_jrel) { ! int delta = blockoff[instr->i_target] - bsize; instr->i_oparg = delta; } *************** *** 2794,2799 **** if (flags < 0) goto error; ! co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), ! flags, a->a_bytecode, consts, names, varnames, freevars, cellvars, --- 3088,3092 ---- if (flags < 0) goto error; ! co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), flags, a->a_bytecode, consts, names, varnames, freevars, cellvars, From fdrake at users.sourceforge.net Fri Mar 26 12:10:36 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Mar 26 12:21:35 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpkgutil.tex, 1.1, 1.1.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8856 Modified Files: Tag: release23-maint libpkgutil.tex Log Message: remove out-of-date warning Index: libpkgutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpkgutil.tex,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -C2 -d -r1.1 -r1.1.18.1 *** libpkgutil.tex 23 Dec 2002 16:53:59 -0000 1.1 --- libpkgutil.tex 26 Mar 2004 17:10:33 -0000 1.1.18.1 *************** *** 7,15 **** \versionadded{2.3} - \begin{notice}[warning] - This is an experimental module. It may be withdrawn or completely - changed up to an including the release of Python 2.3 beta 1. - \end{notice} - This module provides a single function: --- 7,10 ---- From fdrake at users.sourceforge.net Fri Mar 26 12:11:12 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Mar 26 12:22:06 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libpkgutil.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9052 Modified Files: libpkgutil.tex Log Message: remove out-of-date warning Index: libpkgutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpkgutil.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libpkgutil.tex 23 Dec 2002 16:53:59 -0000 1.1 --- libpkgutil.tex 26 Mar 2004 17:11:10 -0000 1.2 *************** *** 7,15 **** \versionadded{2.3} - \begin{notice}[warning] - This is an experimental module. It may be withdrawn or completely - changed up to an including the release of Python 2.3 beta 1. - \end{notice} - This module provides a single function: --- 7,10 ---- From nascheme at users.sourceforge.net Fri Mar 26 13:17:34 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri Mar 26 13:28:28 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.314.2.3, 2.314.2.4 newcompile.c, 1.1.2.86, 1.1.2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22531/Python Modified Files: Tag: ast-branch ceval.c newcompile.c Log Message: Change the behavior of the MAKE_CLOSURE opcode. Instead of building a tuple of free variables internally, the compiler now generates an explict BUILD_TUPLE instruction. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.314.2.3 retrieving revision 2.314.2.4 diff -C2 -d -r2.314.2.3 -r2.314.2.4 *** ceval.c 28 Apr 2003 17:17:05 -0000 2.314.2.3 --- ceval.c 26 Mar 2004 18:17:31 -0000 2.314.2.4 *************** *** 2167,2187 **** case MAKE_CLOSURE: { - int nfree; v = POP(); /* code object */ x = PyFunction_New(v, f->f_globals); - nfree = PyCode_GetNumFree((PyCodeObject *)v); Py_DECREF(v); ! /* XXX Maybe this should be a separate opcode? */ ! if (x != NULL && nfree > 0) { ! v = PyTuple_New(nfree); ! if (v == NULL) { ! Py_DECREF(x); ! x = NULL; ! break; ! } ! while (--nfree >= 0) { ! w = POP(); ! PyTuple_SET_ITEM(v, nfree, w); ! } err = PyFunction_SetClosure(x, v); Py_DECREF(v); --- 2167,2175 ---- case MAKE_CLOSURE: { v = POP(); /* code object */ x = PyFunction_New(v, f->f_globals); Py_DECREF(v); ! if (x != NULL) { ! v = POP(); err = PyFunction_SetClosure(x, v); Py_DECREF(v); Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.86 retrieving revision 1.1.2.87 diff -C2 -d -r1.1.2.86 -r1.1.2.87 *** newcompile.c 26 Mar 2004 15:34:10 -0000 1.1.2.86 --- newcompile.c 26 Mar 2004 18:17:31 -0000 1.1.2.87 *************** *** 48,54 **** opcode_stack_effect() function should be reviewed since stack depth bugs ! could be really hard to find later. Also, the stack effect of ! MAKE_CLOSURE is not accurate. One idea is to have the compiler generate ! an explict BUILD_TUPLE opcode before MAKE_CLOSURE. Dead code is being generated (i.e. after unconditional jumps). --- 48,52 ---- opcode_stack_effect() function should be reviewed since stack depth bugs ! could be really hard to find later. Dead code is being generated (i.e. after unconditional jumps). *************** *** 773,777 **** return 0; case END_FINALLY: ! return -1; /* XXX or -2 or -3 */ case BUILD_CLASS: return -2; --- 771,775 ---- return 0; case END_FINALLY: ! return -1; /* or -2 or -3 if exception occurred */ case BUILD_CLASS: return -2; *************** *** 829,833 **** case SETUP_EXCEPT: case SETUP_FINALLY: ! return 3; /* XXX isn't this 0? */ case LOAD_FAST: --- 827,831 ---- case SETUP_EXCEPT: case SETUP_FINALLY: ! return 3; /* actually pushed by an exception */ case LOAD_FAST: *************** *** 858,862 **** case MAKE_CLOSURE: - /* XXX Also pops free variables to creates a tuple. */ return -oparg; case LOAD_CLOSURE: --- 856,859 ---- *************** *** 1181,1184 **** --- 1178,1182 ---- ADDOP_I(c, LOAD_CLOSURE, arg); } + ADDOP_I(c, BUILD_TUPLE, free); ADDOP_O(c, LOAD_CONST, (PyObject*)co, consts); ADDOP_I(c, MAKE_CLOSURE, args); *************** *** 2679,2682 **** --- 2677,2681 ---- b->b_seen = 1; b->b_startdepth = depth; + fprintf("block %d\n", block); for (i = 0; i < b->b_iused; i++) { instr = &b->b_instr[i]; *************** *** 2685,2688 **** --- 2684,2688 ---- if (depth > maxdepth) maxdepth = depth; + fprintf(" %s %d\n", opnames[instr->i_opcode], depth); if (instr->i_jrel || instr->i_jabs) { maxdepth = stackdepth_walk(c, instr->i_target, From rhettinger at users.sourceforge.net Fri Mar 26 15:16:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 26 15:27:37 2004 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16633 Modified Files: sre_compile.py Log Message: Remove unnecessary test. (Thanks Skip) Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** sre_compile.py 26 Mar 2004 11:16:55 -0000 1.52 --- sre_compile.py 26 Mar 2004 20:16:39 -0000 1.53 *************** *** 25,34 **** return x - # use xrange if available - try: - xrange - except NameError: - xrange = range - def _compile(code, pattern, flags): # internal: compile a (sub)pattern --- 25,28 ---- From rhettinger at users.sourceforge.net Fri Mar 26 18:24:15 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Mar 26 18:35:13 2004 Subject: [Python-checkins] python/dist/src/Lib sre_parse.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22850 Modified Files: sre_parse.py Log Message: Simple Optimizations: * Factor constant expressions out of loops. * Presize a list being grown to a known length. Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** sre_parse.py 18 Jan 2004 20:29:54 -0000 1.59 --- sre_parse.py 26 Mar 2004 23:24:00 -0000 1.60 *************** *** 104,107 **** --- 104,108 ---- def dump(self, level=0): nl = 1 + seqtypes = type(()), type([]) for op, av in self.data: print level*" " + op,; nl = 0 *************** *** 119,123 **** a.dump(level+1); nl = 1 i = i + 1 ! elif type(av) in (type(()), type([])): for a in av: if isinstance(a, SubPattern): --- 120,124 ---- a.dump(level+1); nl = 1 i = i + 1 ! elif type(av) in seqtypes: for a in av: if isinstance(a, SubPattern): *************** *** 150,153 **** --- 151,156 ---- return self.width lo = hi = 0L + UNITCODES = (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY) + REPEATCODES = (MIN_REPEAT, MAX_REPEAT) for op, av in self.data: if op is BRANCH: *************** *** 168,176 **** lo = lo + i hi = hi + j ! elif op in (MIN_REPEAT, MAX_REPEAT): i, j = av[2].getwidth() lo = lo + long(i) * av[0] hi = hi + long(j) * av[1] ! elif op in (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY): lo = lo + 1 hi = hi + 1 --- 171,179 ---- lo = lo + i hi = hi + j ! elif op in REPEATCODES: i, j = av[2].getwidth() lo = lo + long(i) * av[0] hi = hi + long(j) * av[1] ! elif op in UNITCODES: lo = lo + 1 hi = hi + 1 *************** *** 314,324 **** items = [] while 1: ! items.append(_parse(source, state)) ! if source.match("|"): continue if not nested: break ! if not source.next or source.match(")", 0): break else: --- 317,329 ---- items = [] + itemsappend = items.append + sourcematch = source.match while 1: ! itemsappend(_parse(source, state)) ! if sourcematch("|"): continue if not nested: break ! if not source.next or sourcematch(")", 0): break else: *************** *** 329,332 **** --- 334,338 ---- subpattern = SubPattern(state) + subpatternappend = subpattern.append # check if all items share a common prefix *************** *** 345,349 **** for item in items: del item[0] ! subpattern.append(prefix) continue # check next one break --- 351,355 ---- for item in items: del item[0] ! subpatternappend(prefix) continue # check next one break *************** *** 357,363 **** # branch (the compiler may optimize this even more) set = [] for item in items: ! set.append(item[0]) ! subpattern.append((IN, set)) return subpattern --- 363,370 ---- # branch (the compiler may optimize this even more) set = [] + setappend = set.append for item in items: ! setappend(item[0]) ! subpatternappend((IN, set)) return subpattern *************** *** 381,392 **** def _parse(source, state): # parse a simple pattern - subpattern = SubPattern(state) while 1: ! if source.next in ("|", ")"): break # end of subpattern ! this = source.get() if this is None: break # end of pattern --- 388,408 ---- def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) + # precompute constants into local variables + subpatternappend = subpattern.append + sourceget = source.get + sourcematch = source.match + _len = len + PATTERNENDERS = ("|", ")") + ASSERTCHARS = ("=", "!", "<") + LOOKBEHINDASSERTCHARS = ("=", "!") + REPEATCODES = (MIN_REPEAT, MAX_REPEAT) + while 1: ! if source.next in PATTERNENDERS: break # end of subpattern ! this = sourceget() if this is None: break # end of pattern *************** *** 398,402 **** if this == "#": while 1: ! this = source.get() if this in (None, "\n"): break --- 414,418 ---- if this == "#": while 1: ! this = sourceget() if this in (None, "\n"): break *************** *** 404,420 **** if this and this[0] not in SPECIAL_CHARS: ! subpattern.append((LITERAL, ord(this))) elif this == "[": # character set set = [] ! ## if source.match(":"): ## pass # handle character classes ! if source.match("^"): ! set.append((NEGATE, None)) # check remaining characters start = set[:] while 1: ! this = source.get() if this == "]" and set != start: break --- 420,437 ---- if this and this[0] not in SPECIAL_CHARS: ! subpatternappend((LITERAL, ord(this))) elif this == "[": # character set set = [] ! setappend = set.append ! ## if sourcematch(":"): ## pass # handle character classes ! if sourcematch("^"): ! setappend((NEGATE, None)) # check remaining characters start = set[:] while 1: ! this = sourceget() if this == "]" and set != start: break *************** *** 425,436 **** else: raise error, "unexpected end of regular expression" ! if source.match("-"): # potential range ! this = source.get() if this == "]": if code1[0] is IN: code1 = code1[1][0] ! set.append(code1) ! set.append((LITERAL, ord("-"))) break elif this: --- 442,453 ---- else: raise error, "unexpected end of regular expression" ! if sourcematch("-"): # potential range ! this = sourceget() if this == "]": if code1[0] is IN: code1 = code1[1][0] ! setappend(code1) ! setappend((LITERAL, ord("-"))) break elif this: *************** *** 445,449 **** if hi < lo: raise error, "bad character range" ! set.append((RANGE, (lo, hi))) else: raise error, "unexpected end of regular expression" --- 462,466 ---- if hi < lo: raise error, "bad character range" ! setappend((RANGE, (lo, hi))) else: raise error, "unexpected end of regular expression" *************** *** 451,464 **** if code1[0] is IN: code1 = code1[1][0] ! set.append(code1) # XXX: should move set optimization to compiler! ! if len(set)==1 and set[0][0] is LITERAL: ! subpattern.append(set[0]) # optimization ! elif len(set)==2 and set[0][0] is NEGATE and set[1][0] is LITERAL: ! subpattern.append((NOT_LITERAL, set[1][1])) # optimization else: # XXX: should add charmap optimization here ! subpattern.append((IN, set)) elif this and this[0] in REPEAT_CHARS: --- 468,481 ---- if code1[0] is IN: code1 = code1[1][0] ! setappend(code1) # XXX: should move set optimization to compiler! ! if _len(set)==1 and set[0][0] is LITERAL: ! subpatternappend(set[0]) # optimization ! elif _len(set)==2 and set[0][0] is NEGATE and set[1][0] is LITERAL: ! subpatternappend((NOT_LITERAL, set[1][1])) # optimization else: # XXX: should add charmap optimization here ! subpatternappend((IN, set)) elif this and this[0] in REPEAT_CHARS: *************** *** 477,487 **** while source.next in DIGITS: lo = lo + source.get() ! if source.match(","): while source.next in DIGITS: ! hi = hi + source.get() else: hi = lo ! if not source.match("}"): ! subpattern.append((LITERAL, ord(this))) source.seek(here) continue --- 494,504 ---- while source.next in DIGITS: lo = lo + source.get() ! if sourcematch(","): while source.next in DIGITS: ! hi = hi + sourceget() else: hi = lo ! if not sourcematch("}"): ! subpatternappend((LITERAL, ord(this))) source.seek(here) continue *************** *** 499,507 **** else: item = None ! if not item or (len(item) == 1 and item[0][0] == AT): raise error, "nothing to repeat" ! if item[0][0] in (MIN_REPEAT, MAX_REPEAT): raise error, "multiple repeat" ! if source.match("?"): subpattern[-1] = (MIN_REPEAT, (min, max, item)) else: --- 516,524 ---- else: item = None ! if not item or (_len(item) == 1 and item[0][0] == AT): raise error, "nothing to repeat" ! if item[0][0] in REPEATCODES: raise error, "multiple repeat" ! if sourcematch("?"): subpattern[-1] = (MIN_REPEAT, (min, max, item)) else: *************** *** 509,513 **** elif this == ".": ! subpattern.append((ANY, None)) elif this == "(": --- 526,530 ---- elif this == ".": ! subpatternappend((ANY, None)) elif this == "(": *************** *** 515,528 **** name = None condgroup = None ! if source.match("?"): group = 0 # options ! if source.match("P"): # python extensions ! if source.match("<"): # named group: skip forward to end of name name = "" while 1: ! char = source.get() if char is None: raise error, "unterminated name" --- 532,545 ---- name = None condgroup = None ! if sourcematch("?"): group = 0 # options ! if sourcematch("P"): # python extensions ! if sourcematch("<"): # named group: skip forward to end of name name = "" while 1: ! char = sourceget() if char is None: raise error, "unterminated name" *************** *** 533,541 **** if not isname(name): raise error, "bad character in group name" ! elif source.match("="): # named backreference name = "" while 1: ! char = source.get() if char is None: raise error, "unterminated name" --- 550,558 ---- if not isname(name): raise error, "bad character in group name" ! elif sourcematch("="): # named backreference name = "" while 1: ! char = sourceget() if char is None: raise error, "unterminated name" *************** *** 548,592 **** if gid is None: raise error, "unknown group name" ! subpattern.append((GROUPREF, gid)) continue else: ! char = source.get() if char is None: raise error, "unexpected end of pattern" raise error, "unknown specifier: ?P%s" % char ! elif source.match(":"): # non-capturing group group = 2 ! elif source.match("#"): # comment while 1: if source.next is None or source.next == ")": break ! source.get() ! if not source.match(")"): raise error, "unbalanced parenthesis" continue ! elif source.next in ("=", "!", "<"): # lookahead assertions ! char = source.get() dir = 1 if char == "<": ! if source.next not in ("=", "!"): raise error, "syntax error" dir = -1 # lookbehind ! char = source.get() p = _parse_sub(source, state) ! if not source.match(")"): raise error, "unbalanced parenthesis" if char == "=": ! subpattern.append((ASSERT, (dir, p))) else: ! subpattern.append((ASSERT_NOT, (dir, p))) continue ! elif source.match("("): # conditional backreference group condname = "" while 1: ! char = source.get() if char is None: raise error, "unterminated name" --- 565,609 ---- if gid is None: raise error, "unknown group name" ! subpatternappend((GROUPREF, gid)) continue else: ! char = sourceget() if char is None: raise error, "unexpected end of pattern" raise error, "unknown specifier: ?P%s" % char ! elif sourcematch(":"): # non-capturing group group = 2 ! elif sourcematch("#"): # comment while 1: if source.next is None or source.next == ")": break ! sourceget() ! if not sourcematch(")"): raise error, "unbalanced parenthesis" continue ! elif source.next in ASSERTCHARS: # lookahead assertions ! char = sourceget() dir = 1 if char == "<": ! if source.next not in LOOKBEHINDASSERTCHARS: raise error, "syntax error" dir = -1 # lookbehind ! char = sourceget() p = _parse_sub(source, state) ! if not sourcematch(")"): raise error, "unbalanced parenthesis" if char == "=": ! subpatternappend((ASSERT, (dir, p))) else: ! subpatternappend((ASSERT_NOT, (dir, p))) continue ! elif sourcematch("("): # conditional backreference group condname = "" while 1: ! char = sourceget() if char is None: raise error, "unterminated name" *************** *** 609,613 **** raise error, "unexpected end of pattern" while source.next in FLAGS: ! state.flags = state.flags | FLAGS[source.get()] if group: # parse group contents --- 626,630 ---- raise error, "unexpected end of pattern" while source.next in FLAGS: ! state.flags = state.flags | FLAGS[sourceget()] if group: # parse group contents *************** *** 621,632 **** else: p = _parse_sub(source, state) ! if not source.match(")"): raise error, "unbalanced parenthesis" if group is not None: state.closegroup(group) ! subpattern.append((SUBPATTERN, (group, p))) else: while 1: ! char = source.get() if char is None: raise error, "unexpected end of pattern" --- 638,649 ---- else: p = _parse_sub(source, state) ! if not sourcematch(")"): raise error, "unbalanced parenthesis" if group is not None: state.closegroup(group) ! subpatternappend((SUBPATTERN, (group, p))) else: while 1: ! char = sourceget() if char is None: raise error, "unexpected end of pattern" *************** *** 636,640 **** elif this == "^": ! subpattern.append((AT, AT_BEGINNING)) elif this == "$": --- 653,657 ---- elif this == "^": ! subpatternappend((AT, AT_BEGINNING)) elif this == "$": *************** *** 643,647 **** elif this and this[0] == "\\": code = _escape(source, this, state) ! subpattern.append(code) else: --- 660,664 ---- elif this and this[0] == "\\": code = _escape(source, this, state) ! subpatternappend(code) else: *************** *** 682,692 **** # group references s = Tokenizer(source) p = [] a = p.append ! def literal(literal, p=p): if p and p[-1][0] is LITERAL: p[-1] = LITERAL, p[-1][1] + literal else: ! p.append((LITERAL, literal)) sep = source[:0] if type(sep) is type(""): --- 699,710 ---- # group references s = Tokenizer(source) + sget = s.get p = [] a = p.append ! def literal(literal, p=p, pappend=a): if p and p[-1][0] is LITERAL: p[-1] = LITERAL, p[-1][1] + literal else: ! pappend((LITERAL, literal)) sep = source[:0] if type(sep) is type(""): *************** *** 695,699 **** makechar = unichr while 1: ! this = s.get() if this is None: break # end of replacement string --- 713,717 ---- makechar = unichr while 1: ! this = sget() if this is None: break # end of replacement string *************** *** 704,708 **** if s.match("<"): while 1: ! char = s.get() if char is None: raise error, "unterminated group name" --- 722,726 ---- if s.match("<"): while 1: ! char = sget() if char is None: raise error, "unterminated group name" *************** *** 732,736 **** break elif s.next in OCTDIGITS: ! this = this + s.get() else: break --- 750,754 ---- break elif s.next in OCTDIGITS: ! this = this + sget() else: break *************** *** 753,763 **** i = 0 groups = [] ! literals = [] for c, s in p: if c is MARK: ! groups.append((i, s)) ! literals.append(None) else: ! literals.append(s) i = i + 1 return groups, literals --- 771,782 ---- i = 0 groups = [] ! groupsappend = groups.append ! literals = [None] * len(p) for c, s in p: if c is MARK: ! groupsappend((i, s)) ! # literal[i] is already None else: ! literals[i] = s i = i + 1 return groups, literals From rhettinger at users.sourceforge.net Sat Mar 27 04:24:39 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Mar 27 04:35:45 2004 Subject: [Python-checkins] python/dist/src/Lib sre_compile.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16846 Modified Files: sre_compile.py Log Message: Revert 1.51 booleans so that sre will still run on old pythons. Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** sre_compile.py 26 Mar 2004 20:16:39 -0000 1.53 --- sre_compile.py 27 Mar 2004 09:24:36 -0000 1.54 *************** *** 204,208 **** out = [] outappend = out.append ! charmap = [False]*256 try: for op, av in charset: --- 204,208 ---- out = [] outappend = out.append ! charmap = [0]*256 try: for op, av in charset: *************** *** 210,217 **** outappend((op, av)) elif op is LITERAL: ! charmap[fixup(av)] = True elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = True elif op is CATEGORY: # XXX: could append to charmap tail --- 210,217 ---- outappend((op, av)) elif op is LITERAL: ! charmap[fixup(av)] = 1 elif op is RANGE: for i in range(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = 1 elif op is CATEGORY: # XXX: could append to charmap tail *************** *** 299,303 **** except ImportError: return charset ! charmap = [False]*65536 negate = 0 try: --- 299,303 ---- except ImportError: return charset ! charmap = [0]*65536 negate = 0 try: *************** *** 306,313 **** negate = 1 elif op is LITERAL: ! charmap[fixup(av)] = True elif op is RANGE: for i in xrange(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = True elif op is CATEGORY: # XXX: could expand category --- 306,313 ---- negate = 1 elif op is LITERAL: ! charmap[fixup(av)] = 1 elif op is RANGE: for i in xrange(fixup(av[0]), fixup(av[1])+1): ! charmap[i] = 1 elif op is CATEGORY: # XXX: could expand category From montanaro at users.sourceforge.net Sat Mar 27 13:23:13 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Mar 27 13:34:17 2004 Subject: [Python-checkins] python/dist/src/Doc/tut glossary.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14413 Modified Files: glossary.tex Log Message: - add entry for complex number - fix a couple typos - refine definitions for "interpreted" and "coercion" based upon updates on the python glossary wiki Index: glossary.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** glossary.tex 28 Sep 2003 19:03:36 -0000 1.5 --- glossary.tex 27 Mar 2004 18:23:11 -0000 1.6 *************** *** 38,48 **** \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} --- 38,68 ---- \index{coercion} \item[coercion] ! ! The implicit conversion of an instance of one type to another during an ! operation which involves two arguments of the same type. For example, ! {}\code{int(3.15)} converts the floating point number to the integer, ! {}\code{3}, but in {}\code{3+4.5}, each argument is of a different type (one ! int, one float), and both must be converted to the same type before they can ! be added or it will raise a {}\code{TypeError}. Coercion between two ! operands can be performed with the {}\code{coerce} builtin function; thus, ! {}\code{3+4.5} is equivalent to calling {}\code{operator.add(*coerce(3, ! 4.5))} and results in {}\code{operator.add(3.0, 4.5)}. Without coercion, ! all arguments of even compatible types would have to be normalized to the ! same value by the programmer, e.g., {}\code{float(3)+4.5} rather than just ! {}\code{3+4.5}. ! ! \index{complex number} ! \item[complex number] ! ! An extension of the familiar real number system in which all numbers are ! expressed as a sum of a real part and an imaginary part. Imaginary numbers ! are real multiples of the imaginary unit (the square root of {}\code{-1}), ! often written {}\code{i} in mathematics or {}\code{j} in engineering. ! Python has builtin support for complex numbers, which are written with this ! latter notation; the imaginary part is written with a {}\code{j} suffix, ! e.g., {}\code{3+1j}. To get access to complex equivalents of the ! {}\module{math} module, use {}\module{cmath}. Use of complex numbers is a ! fairy advanced mathematical feature. If you're not aware of a need for it's ! almost certain you can safely ignore them. \index{descriptor} *************** *** 100,111 **** \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} --- 120,131 ---- \index{generator} \item[generator] ! A function that returns an iterator. It looks like a normal function except ! that values are returned to the caller using a \keyword{yield} statement ! instead of a {}\keyword{return} statement. 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} *************** *** 135,139 **** \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 --- 155,159 ---- \index{immutable} \item[immutable] ! An 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 *************** *** 150,154 **** 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{/} --- 170,174 ---- 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, an 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{/} *************** *** 165,173 **** \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} --- 185,193 ---- \index{interpreted} \item[interpreted] ! Python is an interpreted language, as opposed to a compiled one. This means ! that the source files can be run directly without first creating an ! executable which is then run. Interpreted languages typically have a ! shorter development/debug cycle than compiled ones, though their programs ! generally also run more slowly. See also {}\emph{interactive}. \index{iterable} From montanaro at users.sourceforge.net Sat Mar 27 13:43:59 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Mar 27 13:55:04 2004 Subject: [Python-checkins] python/dist/src/Tools/scripts reindent.py, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18556 Modified Files: reindent.py Log Message: add usage() function, -h(elp) flag and long versions of short flags Index: reindent.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/reindent.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** reindent.py 26 Mar 2002 11:39:26 -0000 1.4 --- reindent.py 27 Mar 2004 18:43:56 -0000 1.5 *************** *** 5,11 **** """reindent [-d][-r][-v] [ path ... ] ! -d Dry run. Analyze, but don't make any changes to, files. ! -r Recurse. Search for all .py files in subdirectories too. ! -v Verbose. Print informative msgs; else no output. Change Python (.py) files to use 4-space indents and no hard tab characters. --- 5,12 ---- """reindent [-d][-r][-v] [ path ... ] ! -d (--dryrun) Dry run. Analyze, but don't make any changes to, files. ! -r (--recurse) Recurse. Search for all .py files in subdirectories too. ! -v (--verbose) Verbose. Print informative msgs; else no output. ! -h (--help) Help. Print this usage information and exit. Change Python (.py) files to use 4-space indents and no hard tab characters. *************** *** 43,46 **** --- 44,52 ---- dryrun = 0 + def usage(msg=None): + if msg is not None: + print >> sys.stderr, msg + print >> sys.stderr, __doc__ + def errprint(*args): sep = "" *************** *** 54,68 **** global verbose, recurse, dryrun try: ! opts, args = getopt.getopt(sys.argv[1:], "drv") except getopt.error, msg: ! errprint(msg) return for o, a in opts: ! if o == '-d': dryrun += 1 ! elif o == '-r': recurse += 1 ! elif o == '-v': verbose += 1 if not args: r = Reindenter(sys.stdin) --- 60,78 ---- global verbose, recurse, dryrun try: ! opts, args = getopt.getopt(sys.argv[1:], "drvh", ! ["dryrun", "recurse", "verbose", "help"]) except getopt.error, msg: ! usage(msg) return for o, a in opts: ! if o in ('-d', '--dryrun'): dryrun += 1 ! elif o in ('-r', '--recurse'): recurse += 1 ! elif o in ('-v', '--verbose'): verbose += 1 + elif o in ('-h', '--help'): + usage() + return if not args: r = Reindenter(sys.stdin) From bwarsaw at users.sourceforge.net Sat Mar 27 15:14:21 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat Mar 27 15:25:35 2004 Subject: [Python-checkins] python/nondist/peps pep-0008.txt,1.21,1.22 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2842 Modified Files: pep-0008.txt Log Message: A few more minor updates for the Naming Conventions section: - recommend that all new libraries use the standards, but point out that internal consistency with existing standards is more important. - Use b and B instead of x and X (it's hard to distinguish the case of X in some fonts) - StudlyCaps is another name for CapWords - Re-order list so Function Names are followed by Method Names. Also, added a few blank lines in the Method Names section, and described how underscores should separate words for readability. - Added that double leading underscore is usually only necessary to resolve name conflicts in subclasses. Index: pep-0008.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0008.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pep-0008.txt 20 Mar 2004 06:42:29 -0000 1.21 --- pep-0008.txt 27 Mar 2004 20:14:19 -0000 1.22 *************** *** 343,349 **** Naming Conventions ! The naming conventions of Python's library are a bit of a mess, so ! we'll never get this completely consistent -- nevertheless, here ! are some guidelines. Descriptive: Naming Styles --- 343,352 ---- Naming Conventions ! The naming conventions of Python's library are a bit of a mess, so we'll ! never get this completely consistent -- nevertheless, here are the ! currently recommended naming standards. New modules and packages ! (including 3rd party frameworks) should be written to these standards, but ! where an existing library has a different style, internal consistency is ! preferred. Descriptive: Naming Styles *************** *** 355,361 **** The following naming styles are commonly distinguished: ! - x (single lowercase letter) ! - X (single uppercase letter) - lowercase --- 358,364 ---- The following naming styles are commonly distinguished: ! - b (single lowercase letter) ! - B (single uppercase letter) - lowercase *************** *** 368,372 **** - CapitalizedWords (or CapWords, or CamelCase -- so named because ! of the bumpy look of its letters[4]) - mixedCase (differs from CapitalizedWords by initial lowercase --- 371,376 ---- - CapitalizedWords (or CapWords, or CamelCase -- so named because ! of the bumpy look of its letters[4]). This is also sometimes known as ! StudlyCaps. - mixedCase (differs from CapitalizedWords by initial lowercase *************** *** 454,464 **** The trend seems to be toward CapWords exception names. - Function Names - - Function names should be lowercase, possibly with underscores to - improve readability. mixedCase is allowed only in contexts where - that's already the prevailing style (e.g. threading.py), to retain - backwards compatibility. - Global Variable Names --- 458,461 ---- *************** *** 469,485 **** with an underscore to prevent exporting them. Method Names and Instance Variables ! The story is largely the same as for functions. Use lowercase ! for methods accessed by other classes or functions that are part ! of the implementation of an object type. Use one leading ! underscore for "internal" methods and instance variables when ! there is no chance of a conflict with subclass or superclass ! attributes or when a subclass might actually need access to ! them. Use two leading underscores (class-private names, ! enforced by Python 1.4) in those cases where it is important ! that only the current class accesses an attribute. (But realize ! that Python contains enough loopholes so that an insistent user ! could gain access nevertheless, e.g. via the __dict__ attribute.) Designing for inheritance --- 466,494 ---- with an underscore to prevent exporting them. + Function Names + + Function names should be lowercase, possibly with words separated by + underscores to improve readability. mixedCase is allowed only in + contexts where that's already the prevailing style (e.g. threading.py), + to retain backwards compatibility. + Method Names and Instance Variables ! The story is largely the same as for functions; in general use lowercase ! with words separated by underscores to improve readability. Do not use ! a leading underscore for methods accessed by other classes or functions ! that are part of the implementation of an object type. ! ! Use one leading underscore for "internal" methods and instance variables ! when there is no chance of a conflict with subclass or superclass ! attributes or when a subclass might actually need access to them. ! ! Use two leading underscores (class-private names, enforced by Python ! 1.4) in those cases where it is important that only the current class ! accesses an attribute. Realize that Python contains enough loopholes so ! that an insistent user could gain access nevertheless, e.g. via the ! __dict__ attribute. Generally, double leading underscores should be ! used only to avoid name conflicts with attributes in classes designed to ! be subclassed. Designing for inheritance From bwarsaw at users.sourceforge.net Sat Mar 27 15:37:05 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat Mar 27 15:48:12 2004 Subject: [Python-checkins] python/nondist/peps pep-0008.txt,1.22,1.23 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7361 Modified Files: pep-0008.txt Log Message: updated a link Index: pep-0008.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0008.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pep-0008.txt 27 Mar 2004 20:14:19 -0000 1.22 --- pep-0008.txt 27 Mar 2004 20:37:02 -0000 1.23 *************** *** 604,609 **** [4] http://www.wikipedia.com/wiki/CamelCase ! [5] Barry's GNU Mailman/mimelib style guide ! http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mimelib/mimelib/STYLEGUIDE.txt?rev=1.1&content-type=text/vnd.viewcvs-markup --- 604,609 ---- [4] http://www.wikipedia.com/wiki/CamelCase ! [5] Barry's GNU Mailman style guide ! http://barry.warsaw.us/software/STYLEGUIDE.txt From tim_one at users.sourceforge.net Sat Mar 27 21:20:47 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 27 21:31:57 2004 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3895/lib Modified Files: socket.py Log Message: SF bug 924242: socket._fileobject._getclosed() returns wrong value The .closed property always returned the wrong result. Bugfix candidate! Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** socket.py 14 Jun 2003 13:30:53 -0000 1.42 --- socket.py 28 Mar 2004 02:20:44 -0000 1.43 *************** *** 218,222 **** def _getclosed(self): ! return self._sock is not None closed = property(_getclosed, doc="True if the file is closed") --- 218,222 ---- def _getclosed(self): ! return self._sock is None closed = property(_getclosed, doc="True if the file is closed") From tim_one at users.sourceforge.net Sat Mar 27 21:20:47 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat Mar 27 21:32:02 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py, 1.67, 1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3895/lib/test Modified Files: test_socket.py Log Message: SF bug 924242: socket._fileobject._getclosed() returns wrong value The .closed property always returned the wrong result. Bugfix candidate! Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** test_socket.py 10 Feb 2004 15:51:15 -0000 1.67 --- test_socket.py 28 Mar 2004 02:20:45 -0000 1.68 *************** *** 591,594 **** --- 591,595 ---- def tearDown(self): self.serv_file.close() + self.assert_(self.serv_file.closed) self.serv_file = None SocketConnectedTest.tearDown(self) *************** *** 600,603 **** --- 601,605 ---- def clientTearDown(self): self.cli_file.close() + self.assert_(self.cli_file.closed) self.cli_file = None SocketConnectedTest.clientTearDown(self) *************** *** 646,649 **** --- 648,657 ---- self.cli_file.flush() + def testClosedAttr(self): + self.assert_(not self.serv_file.closed) + + def _testClosedAttr(self): + self.assert_(not self.cli_file.closed) + class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase): From vcxx71 at nemetschek.de Sun Mar 28 03:42:20 2004 From: vcxx71 at nemetschek.de (Audrey Lacey) Date: Sun Mar 28 02:11:03 2004 Subject: [Python-checkins] A healthy balance sheet adds value to the stock price gg qacrqxj rnpz Message-ID: <64r48w-$7g088l-$-akd$-4l94n2@xce2maxo> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040328/8f296201/attachment-0001.html From facundobatista at users.sourceforge.net Sun Mar 28 10:39:41 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Sun Mar 28 10:50:55 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6260 Modified Files: test_Decimal.py Log Message: Added two groups of test classes and corrected some minor try/except issues. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_Decimal.py 24 Mar 2004 01:57:49 -0000 1.11 --- test_Decimal.py 28 Mar 2004 15:39:38 -0000 1.12 *************** *** 15,25 **** """ ! # 0.1.3 2003.3.23 facundobatista: Added arithmetic operators test and corrected ! # minor method case issues. ! # 0.1.2 2003.3.20 facundobatista: Added from_float to explicit construction test ! # cases and all implicit construction test cases. Also upgraded ! # method names to new GvR definiton. ! # 0.1.1 2003.3.11 facundobatista: Added Explicit Construction tests ! # 0.1.0 2003.3.11 facundobatista: Placed the structure to run separate test groups # ToDo: --- 15,29 ---- """ ! # 0.1.4 2003.03.28 fb: Added Use of Context and Decimal Usability test cases. ! # Corrected tests using try/except/else. ! # 0.1.3 2003.03.23 fb: Added arithmetic operators test and corrected minor ! # method case issues. ! # 0.1.2 2003.03.20 fb: Added from_float to explicit construction test cases ! # and all implicit construction test cases. Also upgraded ! # method names to new GvR definiton. ! # 0.1.1 2003.03.11 fb: Added Explicit Construction tests ! # 0.1.0 2003.03.11 fb: Placed the structure to run separate test groups ! # ! # fb = facundobatista # ToDo: *************** *** 615,619 **** except TypeError: pass ! def test_from_int(self): '''Implicit construction with int or long.''' --- 619,625 ---- except TypeError: pass ! else: ! self.fail('Did not raised an error!') ! def test_from_int(self): '''Implicit construction with int or long.''' *************** *** 629,632 **** --- 635,640 ---- except TypeError: pass + else: + self.fail('Did not raised an error!') def test_from_string(self): *************** *** 639,642 **** --- 647,652 ---- except TypeError: pass + else: + self.fail('Did not raised an error!') def test_from_float(self): *************** *** 649,652 **** --- 659,664 ---- except TypeError: pass + else: + self.fail('Did not raised an error!') def test_from_Decimal(self): *************** *** 901,904 **** --- 913,1141 ---- + # The following are two functions used to test threading in the next class + + def thfunc1(cls): + d1 = Decimal(1) + d3 = Decimal(3) + cls.assertEqual(d1/d3, Decimal('0.333333333')) + cls.event.wait() + cls.assertEqual(d1/d3, Decimal('0.333333333')) + return + + def thfunc2(cls): + d1 = Decimal(1) + d3 = Decimal(3) + cls.assertEqual(d1/d3, Decimal('0.333333333')) + thiscontext = getcontext() + thiscontext.prec = 18 + cls.assertEqual(d1/d3, Decimal('0.333333333333333333')) + cls.event.set() + return + + + class DecimalUseOfContextTest(unittest.TestCase): + '''Unit tests for Use of Context cases in Decimal.''' + + import threading + # Take care executing this test from IDLE, there's an issue in threading + # that hangs IDLE and I couldn't find it + + def test_threading(self): + '''Test the "threading isolation" of a Context.''' + + self.event = threading.Event() + + th1 = threading.Thread(target=thfunc1, args=(self,)) + th2 = threading.Thread(target=thfunc2, args=(self,)) + + th1.start() + th2.start() + return + + + class DecimalUsabilityTest(unittest.TestCase): + '''Unit tests for Usability cases of Decimal.''' + + def test_comparison_operators(self): + '''Testing ==, !=, <, >, <=, >=, cmp.''' + + da = Decimal('23.42') + db = Decimal('23.42') + dc = Decimal('45') + + #two Decimals + self.failUnless(dc > da) + self.failUnless(dc >= da) + self.failUnless(da < dc) + self.failUnless(da <= dc) + self.failUnless(da == db) + self.failUnless(da != dc) + self.failUnless(da <= db) + self.failUnless(da >= db) + self.assertEqual(cmp(dc,da), 1) + self.assertEqual(cmp(da,dc), -1) + self.assertEqual(cmp(da,db), 0) + + #a Decimal and an int + self.failUnless(dc > 23) + self.failUnless(23 < dc) + self.failUnless(dc == 45) + self.assertEqual(cmp(dc,23), 1) + self.assertEqual(cmp(23,dc), -1) + self.assertEqual(cmp(dc,45), 0) + + #a Decimal and a float + self.failUnless(dc > 23.42) + self.failUnless(23.42 < dc) + self.failUnless(da == 23.42) + self.assertEqual(cmp(dc,23.42), 1) + self.assertEqual(cmp(23.42,dc), -1) + self.assertEqual(cmp(da,23.42), 0) + + #a Decimal and uncomparable + self.assertRaises(TypeError, da == 'ugly') + self.assertRaises(TypeError, da == '32.7') + self.assertRaises(TypeError, da == object) + + def test_copy_methods(self): + '''Test copy and deepcopy.''' + + import copy + d = Decimal('43.24') + + #copy + c = copy.copy(d) + self.assertEqual(c, d) + self.assertNotEqual(id(c), id(d)) + + #deepcopy + dc = copy.deepcopy(d) + self.assertEqual(dc, d) + self.assertNotEqual(id(dc), id(d)) + + def test_hash_method(self): + '''Test hash.''' + + #just that it's hashable + hash(Decimal(23)) + + #the same hash that to an int + self.assertEqual(hash(Decimal(23)), hash(23)) + + #the same hash that to an "exact float" + self.assertEqual(hash(Decimal('32.32')), hash(32.32)) + + #the same hash that to an "inexact float" + self.assertEqual(hash(Decimal('23.72')), hash(23.72)) + + def test_minmax_methods(self): + '''Test min and max between Decimal and others.''' + + d1 = Decimal('15.32') + d2 = Decimal('28.5') + l1 = 15 + l2 = 28 + f1 = 15.32 + f2 = 28.5 + + #between Decimals + self.failUnless(min(d1,d2) is d1) + self.failUnless(min(d2,d1) is d1) + self.failUnless(max(d1,d2) is d2) + self.failUnless(max(d2,d1) is d2) + + #between Decimal and long + self.failUnless(min(d1,l2) is d1) + self.failUnless(min(l2,d1) is d1) + self.failUnless(max(l1,d2) is d2) + self.failUnless(max(d2,l1) is d2) + + #between Decimal and float + self.failUnless(min(d1,f2) is d1) + self.failUnless(min(f2,d1) is d1) + self.failUnless(max(f1,d2) is d2) + self.failUnless(max(d2,f1) is d2) + + def test_as_boolean(self): + '''Test that it can be used as boolean.''' + + #as false + self.failIf(Decimal(0)) + + #as true + self.failUnless(Decimal('0.372')) + + def test_tostring_methods(self): + '''Test str and repr methods.''' + + d = Decimal('15.32') + + #str + self.assertEqual(str(d), '15.32') + + #repr + self.assertEqual(repr(d), 'Decimal( (0, (1, 5, 3, 2), -2) )') + + def test_tonum_methods(self): + '''Test float, int and long methods.''' + + d1 = Decimal('66') + d2 = Decimal('15.32') + + #int + self.assertEqual(int(d1), 66) + self.assertEqual(int(d2), 15) + + #long + self.assertEqual(long(d1), 66) + self.assertEqual(long(d2), 15) + + #float + self.assertEqual(float(d1), 66) + self.assertEqual(float(d2), 15.32) + + def test_round_trip(self): + '''Testing that d == eval(repr(d)) with d as Decimal.''' + + #with zero + d = Decimal( (0, (0,), 0) ) + self.assertEqual(d, eval(repr(d))) + + #int + d = Decimal( (1, (4, 5), 0) ) + self.assertEqual(d, eval(repr(d))) + + #float + d = Decimal( (0, (4, 5, 3, 4), -2) ) + self.assertEqual(d, eval(repr(d))) + + #weird + d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) + self.assertEqual(d, eval(repr(d))) + + def test_immutability(self): + '''Try to change internal objects and see if immutable.''' + + d = Decimal(42) + + #the used attributes + try: + d._exp = 20 + d._int = 3 + d._sign = 1 + except TypeError: + pass + else: + self.fail('Did not raised an error!') + + #some new attribute + try: + d.newone = None + except TypeError: + pass + else: + self.fail('Did not raised an error!') + + def test_main(which=None): *************** *** 917,920 **** --- 1154,1160 ---- run_unittest(DecimalImplicitConstructionTest) run_unittest(DecimalArithmeticOperatorsTest) + run_unittest(DecimalUseOfContextTest) + run_unittest(DecimalUsabilityTest) + return From esldoatul at msn.com Sun Mar 28 01:33:22 2004 From: esldoatul at msn.com (Chi Mcgill) Date: Sun Mar 28 12:10:37 2004 Subject: [Python-checkins] girth? Message-ID: Drop the HAMMER on the next bitch you Nail.... http://mecca.abonepha.com/vp5 Click here if you do not wish to be invited again: http://fightnottobesingle.com/remove/?oc=xxxxyyyy From xkgghxicp at kitel.co.kr Sun Mar 28 17:28:27 2004 From: xkgghxicp at kitel.co.kr (Edna Delacruz) Date: Sun Mar 28 17:36:36 2004 Subject: [Python-checkins] diplomas for sale from accredited universities Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040328/9243a8dc/attachment.html From rhettinger at users.sourceforge.net Sun Mar 28 17:44:12 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Mar 28 17:55:28 2004 Subject: [Python-checkins] python/dist/src/Doc/tut glossary.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27575 Modified Files: glossary.tex Log Message: Insert missing pronoun Index: glossary.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** glossary.tex 27 Mar 2004 18:23:11 -0000 1.6 --- glossary.tex 28 Mar 2004 22:44:09 -0000 1.7 *************** *** 63,68 **** e.g., {}\code{3+1j}. To get access to complex equivalents of the {}\module{math} module, use {}\module{cmath}. Use of complex numbers is a ! fairy advanced mathematical feature. If you're not aware of a need for it's ! almost certain you can safely ignore them. \index{descriptor} --- 63,68 ---- e.g., {}\code{3+1j}. To get access to complex equivalents of the {}\module{math} module, use {}\module{cmath}. Use of complex numbers is a ! fairy advanced mathematical feature. If you're not aware of a need for them, ! it's almost certain you can safely ignore them. \index{descriptor} From akuchling at users.sourceforge.net Sun Mar 28 20:19:57 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Mar 28 20:31:14 2004 Subject: [Python-checkins] python/dist/src/Doc/tut glossary.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24403 Modified Files: glossary.tex Log Message: fix typo Index: glossary.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** glossary.tex 28 Mar 2004 22:44:09 -0000 1.7 --- glossary.tex 29 Mar 2004 01:19:54 -0000 1.8 *************** *** 63,67 **** e.g., {}\code{3+1j}. To get access to complex equivalents of the {}\module{math} module, use {}\module{cmath}. Use of complex numbers is a ! fairy advanced mathematical feature. If you're not aware of a need for them, it's almost certain you can safely ignore them. --- 63,67 ---- e.g., {}\code{3+1j}. To get access to complex equivalents of the {}\module{math} module, use {}\module{cmath}. Use of complex numbers is a ! fairly advanced mathematical feature. If you're not aware of a need for them, it's almost certain you can safely ignore them. From tim_one at users.sourceforge.net Sun Mar 28 21:24:29 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Mar 28 21:35:47 2004 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2629/include Modified Files: pystate.h Log Message: Added a comment about the unreferenced PyThreadState.tick_counter member. Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** pystate.h 24 Mar 2004 21:57:08 -0000 2.27 --- pystate.h 29 Mar 2004 02:24:26 -0000 2.28 *************** *** 75,79 **** --- 75,86 ---- PyObject *dict; + /* tick_counter is incremented whenever the check_interval ticker + * reaches zero. The purpose is to give a useful measure of the number + * of interpreted bytecode instructions in a given thread. This + * extremely lightweight statistic collector may be of interest to + * profilers (like psyco.jit()), although nothing in the core uses it. + */ int tick_counter; + int gilstate_counter; *************** *** 113,117 **** #endif ! typedef enum {PyGILState_LOCKED, PyGILState_UNLOCKED} PyGILState_STATE; --- 120,124 ---- #endif ! typedef enum {PyGILState_LOCKED, PyGILState_UNLOCKED} PyGILState_STATE; *************** *** 120,126 **** C API, regardless of the current state of Python, or of its thread lock. This may be called as many times as desired ! by a thread so long as each call is matched with a call to ! PyGILState_Release(). In general, other thread-state APIs may ! be used between _Ensure() and _Release() calls, so long as the thread-state is restored to its previous state before the Release(). For example, normal use of the Py_BEGIN_ALLOW_THREADS/ --- 127,133 ---- C API, regardless of the current state of Python, or of its thread lock. This may be called as many times as desired ! by a thread so long as each call is matched with a call to ! PyGILState_Release(). In general, other thread-state APIs may ! be used between _Ensure() and _Release() calls, so long as the thread-state is restored to its previous state before the Release(). For example, normal use of the Py_BEGIN_ALLOW_THREADS/ *************** *** 130,135 **** PyGILState_Ensure() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even ! though recursive calls are allowed, these handles can *not* be shared - ! each unique call to PyGILState_Ensure must save the handle for its call to PyGILState_Release. --- 137,142 ---- PyGILState_Ensure() was called, and must be passed to PyGILState_Release() to ensure Python is left in the same state. Even ! though recursive calls are allowed, these handles can *not* be shared - ! each unique call to PyGILState_Ensure must save the handle for its call to PyGILState_Release. *************** *** 142,149 **** /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding ! PyGILState_Ensure() call (but generally this state will be unknown to the caller, hence the use of the GILState API.) ! Every call to PyGILState_Ensure must be matched by a call to PyGILState_Release on the same thread. */ --- 149,156 ---- /* Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding ! PyGILState_Ensure() call (but generally this state will be unknown to the caller, hence the use of the GILState API.) ! Every call to PyGILState_Ensure must be matched by a call to PyGILState_Release on the same thread. */ *************** *** 151,157 **** /* Helper/diagnostic function - get the current thread state for ! this thread. May return NULL if no GILState API has been used ! on the current thread. Note the main thread always has such a ! thread-state, even if no auto-thread-state call has been made on the main thread. */ --- 158,164 ---- /* Helper/diagnostic function - get the current thread state for ! this thread. May return NULL if no GILState API has been used ! on the current thread. Note the main thread always has such a ! thread-state, even if no auto-thread-state call has been made on the main thread. */ From aimacintyre at users.sourceforge.net Mon Mar 29 06:49:26 2004 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon Mar 29 07:00:51 2004 Subject: [Python-checkins] python/dist/src/PC/os2vacpp makefile, 1.8, 1.9 pyconfig.h, 1.6, 1.7 python.def, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2vacpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2862 Modified Files: makefile pyconfig.h python.def Log Message: OS/2 VACPP build updates/fixes Index: makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** makefile 18 Aug 2002 06:31:01 -0000 1.8 --- makefile 29 Mar 2004 11:49:24 -0000 1.9 *************** *** 166,169 **** --- 166,170 ---- $(PATHOBJ)\ModuleObject.obj \ $(PATHOBJ)\Object.obj \ + $(PATHOBJ)\ObMalloc.obj \ $(PATHOBJ)\RangeObject.obj \ $(PATHOBJ)\SliceObject.obj \ Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/pyconfig.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pyconfig.h 10 Feb 2004 16:50:20 -0000 1.6 --- pyconfig.h 29 Mar 2004 11:49:24 -0000 1.7 *************** *** 55,59 **** * won't have to explicitly specify it anymore */ ! #pragma library("Python22.lib") /***************************************************/ --- 55,59 ---- * won't have to explicitly specify it anymore */ ! #pragma library("Python24.lib") /***************************************************/ Index: python.def =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/python.def,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** python.def 5 Nov 2001 02:45:58 -0000 1.4 --- python.def 29 Mar 2004 11:49:24 -0000 1.5 *************** *** 1,4 **** ! LIBRARY PYTHON22 INITINSTANCE TERMINSTANCE ! DESCRIPTION 'Python 2.2 Core DLL' PROTMODE DATA MULTIPLE NONSHARED --- 1,4 ---- ! LIBRARY PYTHON24 INITINSTANCE TERMINSTANCE ! DESCRIPTION 'Python 2.4 Core DLL' PROTMODE DATA MULTIPLE NONSHARED From aimacintyre at users.sourceforge.net Mon Mar 29 06:50:57 2004 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon Mar 29 07:02:19 2004 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.308,2.309 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3078 Modified Files: bltinmodule.c Log Message: OS/2 VACPP build updates/fixes Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.308 retrieving revision 2.309 diff -C2 -d -r2.308 -r2.309 *** bltinmodule.c 2 Feb 2004 13:39:01 -0000 2.308 --- bltinmodule.c 29 Mar 2004 11:50:55 -0000 2.309 *************** *** 576,580 **** if (stat(filename, &s) == 0) { if (S_ISDIR(s.st_mode)) ! # if defined(PY_OS2) && defined(PYCC_VACPP) errno = EOS2ERR; # else --- 576,580 ---- if (stat(filename, &s) == 0) { if (S_ISDIR(s.st_mode)) ! # if defined(PYOS_OS2) && defined(PYCC_VACPP) errno = EOS2ERR; # else From aimacintyre at users.sourceforge.net Mon Mar 29 06:53:41 2004 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon Mar 29 07:05:04 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.314, 2.315 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3515 Modified Files: posixmodule.c Log Message: OS/2 VACPP build updates/fixes Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.314 retrieving revision 2.315 diff -C2 -d -r2.314 -r2.315 *** posixmodule.c 16 Feb 2004 01:26:34 -0000 2.314 --- posixmodule.c 29 Mar 2004 11:53:38 -0000 2.315 *************** *** 43,48 **** #include #include - #include "osdefs.h" #endif #endif --- 43,48 ---- #include #include #endif + #include "osdefs.h" #endif From aimacintyre at users.sourceforge.net Mon Mar 29 06:55:09 2004 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon Mar 29 07:06:30 2004 Subject: [Python-checkins] python/dist/src/PC/os2vacpp makefile, 1.8, 1.8.14.1 pyconfig.h, 1.4, 1.4.16.1 python.def, 1.4, 1.4.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2vacpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3906 Modified Files: Tag: release23-maint makefile pyconfig.h python.def Log Message: OS/2 VACPP build updates/fixes Index: makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/makefile,v retrieving revision 1.8 retrieving revision 1.8.14.1 diff -C2 -d -r1.8 -r1.8.14.1 *** makefile 18 Aug 2002 06:31:01 -0000 1.8 --- makefile 29 Mar 2004 11:55:06 -0000 1.8.14.1 *************** *** 166,169 **** --- 166,170 ---- $(PATHOBJ)\ModuleObject.obj \ $(PATHOBJ)\Object.obj \ + $(PATHOBJ)\ObMalloc.obj \ $(PATHOBJ)\RangeObject.obj \ $(PATHOBJ)\SliceObject.obj \ Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/pyconfig.h,v retrieving revision 1.4 retrieving revision 1.4.16.1 diff -C2 -d -r1.4 -r1.4.16.1 *** pyconfig.h 9 Jun 2002 13:41:37 -0000 1.4 --- pyconfig.h 29 Mar 2004 11:55:06 -0000 1.4.16.1 *************** *** 55,59 **** * won't have to explicitly specify it anymore */ ! #pragma library("Python22.lib") /***************************************************/ --- 55,59 ---- * won't have to explicitly specify it anymore */ ! #pragma library("Python23.lib") /***************************************************/ Index: python.def =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/python.def,v retrieving revision 1.4 retrieving revision 1.4.24.1 diff -C2 -d -r1.4 -r1.4.24.1 *** python.def 5 Nov 2001 02:45:58 -0000 1.4 --- python.def 29 Mar 2004 11:55:06 -0000 1.4.24.1 *************** *** 1,4 **** ! LIBRARY PYTHON22 INITINSTANCE TERMINSTANCE ! DESCRIPTION 'Python 2.2 Core DLL' PROTMODE DATA MULTIPLE NONSHARED --- 1,4 ---- ! LIBRARY PYTHON23 INITINSTANCE TERMINSTANCE ! DESCRIPTION 'Python 2.3 Core DLL' PROTMODE DATA MULTIPLE NONSHARED From aimacintyre at users.sourceforge.net Mon Mar 29 06:57:04 2004 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon Mar 29 07:08:26 2004 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.292.10.4, 2.292.10.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4177 Modified Files: Tag: release23-maint bltinmodule.c Log Message: OS/2 VACPP build updates/fixes Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.292.10.4 retrieving revision 2.292.10.5 diff -C2 -d -r2.292.10.4 -r2.292.10.5 *** bltinmodule.c 5 Dec 2003 17:33:55 -0000 2.292.10.4 --- bltinmodule.c 29 Mar 2004 11:57:01 -0000 2.292.10.5 *************** *** 580,584 **** if (stat(filename, &s) == 0) { if (S_ISDIR(s.st_mode)) ! # if defined(PY_OS2) && defined(PYCC_VACPP) errno = EOS2ERR; # else --- 580,584 ---- if (stat(filename, &s) == 0) { if (S_ISDIR(s.st_mode)) ! # if defined(PYOS_OS2) && defined(PYCC_VACPP) errno = EOS2ERR; # else From aimacintyre at users.sourceforge.net Mon Mar 29 06:58:59 2004 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon Mar 29 07:10:24 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.300.8.6, 2.300.8.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4579 Modified Files: Tag: release23-maint posixmodule.c Log Message: OS/2 VACPP build updates/fixes Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.300.8.6 retrieving revision 2.300.8.7 diff -C2 -d -r2.300.8.6 -r2.300.8.7 *** posixmodule.c 16 Feb 2004 01:30:49 -0000 2.300.8.6 --- posixmodule.c 29 Mar 2004 11:58:55 -0000 2.300.8.7 *************** *** 43,48 **** #include #include - #include "osdefs.h" #endif #endif --- 43,48 ---- #include #include #endif + #include "osdefs.h" #endif From kbk at users.sourceforge.net Mon Mar 29 20:12:25 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Mon Mar 29 20:23:53 2004 Subject: [Python-checkins] python/nondist/peps pep-0008.txt,1.23,1.24 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5017 Modified Files: pep-0008.txt Log Message: Clarifications resulting from further discussion with Barry Warsaw. Index: pep-0008.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0008.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** pep-0008.txt 27 Mar 2004 20:37:02 -0000 1.23 --- pep-0008.txt 30 Mar 2004 01:12:22 -0000 1.24 *************** *** 475,494 **** Method Names and Instance Variables ! The story is largely the same as for functions; in general use lowercase ! with words separated by underscores to improve readability. Do not use ! a leading underscore for methods accessed by other classes or functions ! that are part of the implementation of an object type. ! Use one leading underscore for "internal" methods and instance variables ! when there is no chance of a conflict with subclass or superclass ! attributes or when a subclass might actually need access to them. ! Use two leading underscores (class-private names, enforced by Python ! 1.4) in those cases where it is important that only the current class ! accesses an attribute. Realize that Python contains enough loopholes so ! that an insistent user could gain access nevertheless, e.g. via the ! __dict__ attribute. Generally, double leading underscores should be ! used only to avoid name conflicts with attributes in classes designed to ! be subclassed. Designing for inheritance --- 475,493 ---- Method Names and Instance Variables ! The story is largely the same as with functions: in general, use ! lowercase with words separated by underscores as necessary to improve ! readability. ! Use one leading underscore only for internal methods and instance ! variables which are not intended to be part of the class's public ! interface. Python does not enforce this; it is up to programmers to ! respect the convention. ! Use two leading underscores to denote class-private names. Python ! "mangles" these names with the class name: if class Foo has an ! attribute named __a, it cannot be accessed by Foo.__a. (An insistent ! user could still gain access by calling Foo._Foo__a.) Generally, ! double leading underscores should be used only to avoid name conflicts ! with attributes in classes designed to be subclassed. Designing for inheritance From gvanrossum at users.sourceforge.net Mon Mar 29 22:49:02 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon Mar 29 23:00:47 2004 Subject: [Python-checkins] python/nondist/peps pep-0318.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29511 Modified Files: pep-0318.txt Log Message: Insert blank line to remove ReST warning/2. Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0318.txt 25 Mar 2004 21:45:58 -0000 1.6 --- pep-0318.txt 30 Mar 2004 03:48:59 -0000 1.7 *************** *** 284,287 **** --- 284,288 ---- .. _PyProtocols: http://peak.telecommunity.com/PyProtocols.html + :: From kbk at users.sourceforge.net Mon Mar 29 23:07:02 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Mon Mar 29 23:18:32 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt, 1.23.4.4, 1.23.4.5 PyShell.py, 1.81.4.1, 1.81.4.2 config-keys.def, 1.19, 1.19.8.1 configHandler.py, 1.31, 1.31.8.1 keybindingDialog.py, 1.11, 1.11.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32028 Modified Files: Tag: release23-maint NEWS.txt PyShell.py config-keys.def configHandler.py keybindingDialog.py Log Message: Keybindings with the Shift modifier now work correctly. So do bindings which use the Space key. Limit unmodified user keybindings to the function keys. Python Bug 775353, IDLEfork Bugs 755647, 761557 Improve error handling during startup if there's no Tkinter. M NEWS.txt M PyShell.py M config-keys.def M configHandler.py M keybindingDialog.py Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.23.4.4 retrieving revision 1.23.4.5 diff -C2 -d -r1.23.4.4 -r1.23.4.5 *** NEWS.txt 4 Dec 2003 20:44:28 -0000 1.23.4.4 --- NEWS.txt 30 Mar 2004 04:06:59 -0000 1.23.4.5 *************** *** 1,2 **** --- 1,11 ---- + What's New in IDLE 1.0.3? + =================================== + + *Release date: XX-XXX-2004* + + - Keybindings with the Shift modifier now work correctly. So do bindings which + use the Space key. Limit unmodified user keybindings to the function keys. + Python Bug 775353, IDLEfork Bugs 755647, 761557 + What's New in IDLE 1.0.2? =================================== Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.81.4.1 retrieving revision 1.81.4.2 diff -C2 -d -r1.81.4.1 -r1.81.4.2 *** PyShell.py 14 Aug 2003 15:15:02 -0000 1.81.4.1 --- PyShell.py 30 Mar 2004 04:06:59 -0000 1.81.4.2 *************** *** 17,21 **** from code import InteractiveInterpreter ! from Tkinter import * import tkMessageBox --- 17,26 ---- from code import InteractiveInterpreter ! try: ! from Tkinter import * ! except ImportError: ! print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ ! "Your Python may not be configured for Tk. **" ! sys.exit(1) import tkMessageBox Index: config-keys.def =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/config-keys.def,v retrieving revision 1.19 retrieving revision 1.19.8.1 diff -C2 -d -r1.19 -r1.19.8.1 *** config-keys.def 18 May 2003 02:21:55 -0000 1.19 --- config-keys.def 30 Mar 2004 04:06:59 -0000 1.19.8.1 *************** *** 31,38 **** plain-newline-and-indent= print-window= ! redo= remove-selection= ! save-copy-of-window-as-file= ! save-window-as-file= save-window= select-all= --- 31,38 ---- plain-newline-and-indent= print-window= ! redo= remove-selection= ! save-copy-of-window-as-file= ! save-window-as-file= save-window= select-all= *************** *** 79,83 **** print-window= python-docs= ! python-context-help= redo= remove-selection= --- 79,83 ---- print-window= python-docs= ! python-context-help= redo= remove-selection= *************** *** 129,135 **** plain-newline-and-indent= print-window= ! redo= remove-selection= ! save-window-as-file= save-window= save-copy-of-window-as-file= --- 129,135 ---- plain-newline-and-indent= print-window= ! redo= remove-selection= ! save-window-as-file= save-window= save-copy-of-window-as-file= Index: configHandler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configHandler.py,v retrieving revision 1.31 retrieving revision 1.31.8.1 diff -C2 -d -r1.31 -r1.31.8.1 *** configHandler.py 27 Jan 2003 02:36:18 -0000 1.31 --- configHandler.py 30 Mar 2004 04:06:59 -0000 1.31.8.1 *************** *** 532,536 **** '<>': [''], '<>': [''], ! '<>': [''], '<>': [''], '<>': [''], --- 532,536 ---- '<>': [''], '<>': [''], ! '<>': [''], '<>': [''], '<>': [''], Index: keybindingDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/keybindingDialog.py,v retrieving revision 1.11 retrieving revision 1.11.6.1 diff -C2 -d -r1.11 -r1.11.6.1 *** keybindingDialog.py 9 Jul 2003 18:48:24 -0000 1.11 --- keybindingDialog.py 30 Mar 2004 04:07:00 -0000 1.11.6.1 *************** *** 1,4 **** """ ! dialog for building tkinter accelerator key bindings """ from Tkinter import * --- 1,4 ---- """ ! Dialog for building Tkinter accelerator key bindings """ from Tkinter import * *************** *** 50,56 **** frameButtons=Frame(self) frameButtons.pack(side=BOTTOM,fill=X) ! self.buttonOk = Button(frameButtons,text='Ok', ! width=8,command=self.Ok) ! self.buttonOk.grid(row=0,column=0,padx=5,pady=5) self.buttonCancel = Button(frameButtons,text='Cancel', width=8,command=self.Cancel) --- 50,56 ---- frameButtons=Frame(self) frameButtons.pack(side=BOTTOM,fill=X) ! self.buttonOK = Button(frameButtons,text='OK', ! width=8,command=self.OK) ! self.buttonOK.grid(row=0,column=0,padx=5,pady=5) self.buttonCancel = Button(frameButtons,text='Cancel', width=8,command=self.Cancel) *************** *** 86,92 **** column += 1 labelFnAdvice=Label(self.frameControlsBasic,justify=LEFT, ! text="Select the desired modifier\n"+ ! "keys above, and final key\n"+ ! "from the list on the right.") labelFnAdvice.grid(row=1,column=0,columnspan=4,padx=2,sticky=W) self.listKeysFinal=Listbox(self.frameControlsBasic,width=15,height=10, --- 86,96 ---- column += 1 labelFnAdvice=Label(self.frameControlsBasic,justify=LEFT, ! text=\ ! "Select the desired modifier keys\n"+ ! "above, and the final key from the\n"+ ! "list on the right.\n\n" + ! "Use upper case Symbols when using\n" + ! "the Shift modifier. (Letters will be\n" + ! "converted automatically.)") labelFnAdvice.grid(row=1,column=0,columnspan=4,padx=2,sticky=W) self.listKeysFinal=Listbox(self.frameControlsBasic,width=15,height=10, *************** *** 103,107 **** labelTitleAdvanced = Label(self.frameKeySeqAdvanced,justify=LEFT, text="Enter new binding(s) for '"+self.action+"' :\n"+ ! "(will not be checked for validity)") labelTitleAdvanced.pack(anchor=W) self.entryKeysAdvanced=Entry(self.frameKeySeqAdvanced, --- 107,111 ---- labelTitleAdvanced = Label(self.frameKeySeqAdvanced,justify=LEFT, text="Enter new binding(s) for '"+self.action+"' :\n"+ ! "(These bindings will not be checked for validity!)") labelTitleAdvanced.pack(anchor=W) self.entryKeysAdvanced=Entry(self.frameKeySeqAdvanced, *************** *** 109,117 **** self.entryKeysAdvanced.pack(fill=X) labelHelpAdvanced=Label(self.frameHelpAdvanced,justify=LEFT, ! text="Key bindings are specified using tkinter key id's as\n"+ "in these samples: , , ,\n" ! ", , .\n\n"+ ! "'Emacs style' multi-keystroke bindings are specified as\n"+ ! "follows: or .\n\n"+ "Multiple separate bindings for one action should be\n"+ "separated by a space, eg., ." ) --- 113,123 ---- self.entryKeysAdvanced.pack(fill=X) labelHelpAdvanced=Label(self.frameHelpAdvanced,justify=LEFT, ! text="Key bindings are specified using Tkinter keysyms as\n"+ "in these samples: , , ,\n" ! ", , .\n" ! "Upper case is used when the Shift modifier is present!\n\n" + ! "'Emacs style' multi-keystroke bindings are specified as\n" + ! "follows: , where the first key\n" + ! "is the 'do-nothing' keybinding.\n\n" + "Multiple separate bindings for one action should be\n"+ "separated by a space, eg., ." ) *************** *** 150,167 **** def BuildKeyString(self): ! keyList=[] ! modifiers=self.GetModifiers() ! finalKey=self.listKeysFinal.get(ANCHOR) ! if modifiers: modifiers[0]='<'+modifiers[0] ! keyList=keyList+modifiers if finalKey: ! if (not modifiers) and (finalKey not ! in self.alphanumKeys+self.punctuationKeys): ! finalKey='<'+self.TranslateKey(finalKey) ! else: ! finalKey=self.TranslateKey(finalKey) ! keyList.append(finalKey+'>') ! keyStr=string.join(keyList,'-') ! self.keyString.set(keyStr) def GetModifiers(self): --- 156,165 ---- def BuildKeyString(self): ! keyList = modifiers = self.GetModifiers() ! finalKey = self.listKeysFinal.get(ANCHOR) if finalKey: ! finalKey = self.TranslateKey(finalKey, modifiers) ! keyList.append(finalKey) ! self.keyString.set('<' + string.join(keyList,'-') + '>') def GetModifiers(self): *************** *** 191,197 **** self.listKeysFinal.insert(END, *keys) ! def TranslateKey(self,key): ! #translate from key list value to tkinter key-id ! translateDict={'~':'asciitilde','!':'exclam','@':'at','#':'numbersign', '%':'percent','^':'asciicircum','&':'ampersand','*':'asterisk', '(':'parenleft',')':'parenright','_':'underscore','-':'minus', --- 189,196 ---- self.listKeysFinal.insert(END, *keys) ! def TranslateKey(self, key, modifiers): ! "Translate from keycap symbol to the Tkinter keysym" ! translateDict = {'Space':'space', ! '~':'asciitilde','!':'exclam','@':'at','#':'numbersign', '%':'percent','^':'asciicircum','&':'ampersand','*':'asterisk', '(':'parenleft',')':'parenright','_':'underscore','-':'minus', *************** *** 201,212 **** '/':'slash','?':'question','Page Up':'Prior','Page Down':'Next', 'Left Arrow':'Left','Right Arrow':'Right','Up Arrow':'Up', ! 'Down Arrow': 'Down'} if key in translateDict.keys(): ! key=translateDict[key] ! key='Key-'+key return key ! def Ok(self, event=None): ! if self.KeysOk(): self.result=self.keyString.get() self.destroy() --- 200,213 ---- '/':'slash','?':'question','Page Up':'Prior','Page Down':'Next', 'Left Arrow':'Left','Right Arrow':'Right','Up Arrow':'Up', ! 'Down Arrow': 'Down', 'Tab':'tab'} if key in translateDict.keys(): ! key = translateDict[key] ! if 'Shift' in modifiers and key in string.ascii_lowercase: ! key = key.upper() ! key = 'Key-' + key return key ! def OK(self, event=None): ! if self.KeysOK(): self.result=self.keyString.get() self.destroy() *************** *** 216,253 **** self.destroy() ! def KeysOk(self): ! #simple validity check ! keysOk=1 ! keys=self.keyString.get() keys.strip() ! finalKey=self.listKeysFinal.get(ANCHOR) ! modifiers=self.GetModifiers() ! keySequence=keys.split()#make into a key sequence list for overlap check ! if not keys: #no keys specified ! tkMessageBox.showerror(title='Key Sequence Error', ! message='No keys specified.') ! keysOk=0 ! elif not keys.endswith('>'): #no final key specified ! tkMessageBox.showerror(title='Key Sequence Error', ! message='No final key specified.') ! keysOk=0 ! elif (not modifiers) and (finalKey in ! self.alphanumKeys+self.punctuationKeys): ! #modifier required ! tkMessageBox.showerror(title='Key Sequence Error', ! message='No modifier key(s) specified.') ! keysOk=0 ! elif (modifiers==['Shift']) and (finalKey not ! in self.functionKeys+('Tab',)): ! #shift alone is only a useful modifier with a function key ! tkMessageBox.showerror(title='Key Sequence Error', ! message='Shift alone is not a useful modifier '+ ! 'when used with this final key key.') ! keysOk=0 ! elif keySequence in self.currentKeySequences: #keys combo already in use ! tkMessageBox.showerror(title='Key Sequence Error', ! message='This key combination is already in use.') ! keysOk=0 ! return keysOk if __name__ == '__main__': --- 217,253 ---- self.destroy() ! def KeysOK(self): ! "Validity check on user's keybinding selection" ! keys = self.keyString.get() keys.strip() ! finalKey = self.listKeysFinal.get(ANCHOR) ! modifiers = self.GetModifiers() ! # create a key sequence list for overlap check: ! keySequence = keys.split() ! keysOK = False ! title = 'Key Sequence Error' ! if not keys: ! tkMessageBox.showerror(title=title, parent=self, ! message='No keys specified.') ! elif not keys.endswith('>'): ! tkMessageBox.showerror(title=title, parent=self, ! message='Missing the final Key') ! elif not modifiers and finalKey not in self.functionKeys: ! tkMessageBox.showerror(title=title, parent=self, ! message='No modifier key(s) specified.') ! elif (modifiers == ['Shift']) \ ! and (finalKey not in ! self.functionKeys + ('Tab', 'Space')): ! msg = 'The shift modifier by itself may not be used with' \ ! ' this key symbol; only with F1-F12, Tab, or Space' ! tkMessageBox.showerror(title=title, parent=self, ! message=msg) ! elif keySequence in self.currentKeySequences: ! msg = 'This key combination is already in use.' ! tkMessageBox.showerror(title=title, parent=self, ! message=msg) ! else: ! keysOK = True ! return keysOK if __name__ == '__main__': From goodger at users.sourceforge.net Tue Mar 30 08:39:24 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue Mar 30 08:51:15 2004 Subject: [Python-checkins] python/nondist/peps pep-0318.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27770 Modified Files: pep-0318.txt Log Message: fixed list containment (indents) & whitespace Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0318.txt 30 Mar 2004 03:48:59 -0000 1.7 --- pep-0318.txt 30 Mar 2004 13:39:21 -0000 1.8 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: Kevin D. Smith , Jim Jewett , Skip Montanaro --- 3,7 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Kevin D. Smith , Jim Jewett , Skip Montanaro *************** *** 62,65 **** --- 62,66 ---- modifications to classes. + Background ========== *************** *** 74,86 **** ``comp.lang.python`` by `Gareth McCaughan`_. ! .. _syntactic support for decorators: http://www.python.org/doc/essays/ppt/python10/py10keynote.pdf ! .. _10th python conference: http://www.python.org/workshops/2002-02/ ! .. _michael hudson raised the topic: http://mail.python.org/pipermail/python-dev/2002-February/020005.html ! .. _he later said: http://mail.python.org/pipermail/python-dev/2002-February/020017.html ! .. _gareth mccaughan: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=slrna40k88.2h9o.Gareth.McCaughan%40g.local Class decorations seem like an obvious next step because class definition and function definition are syntactically similar. Design Goals ============ --- 75,93 ---- ``comp.lang.python`` by `Gareth McCaughan`_. ! .. _syntactic support for decorators: ! http://www.python.org/doc/essays/ppt/python10/py10keynote.pdf ! .. _10th python conference: ! http://www.python.org/workshops/2002-02/ ! .. _michael hudson raised the topic: ! http://mail.python.org/pipermail/python-dev/2002-February/020005.html ! .. _he later said: ! http://mail.python.org/pipermail/python-dev/2002-February/020017.html ! .. _gareth mccaughan: ! http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=slrna40k88.2h9o.Gareth.McCaughan%40g.local Class decorations seem like an obvious next step because class definition and function definition are syntactically similar. + Design Goals ============ *************** *** 110,114 **** there`_" ! .. _toy parser tools out there: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=mailman.1010809396.32158.python-list%40python.org Proposed Syntax --- 117,123 ---- there`_" ! .. _toy parser tools out there: ! http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=mailman.1010809396.32158.python-list%40python.org ! Proposed Syntax *************** *** 129,132 **** --- 138,142 ---- pass + Alternate Proposals =================== *************** *** 142,146 **** `alternatives to "as"`_ have been proposed. :-) ! .. _alternatives to "as": http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=mailman.236.1079968472.742.python-list%40python.org&rnum=2&prev=/groups%3Fq%3Dpython%2Bpep%2B318%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3Dmailman.236.1079968472.742.python-list%2540python.org%26rnum%3D2 :: --- 152,157 ---- `alternatives to "as"`_ have been proposed. :-) ! .. _alternatives to "as": ! http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=mailman.236.1079968472.742.python-list%40python.org&rnum=2&prev=/groups%3Fq%3Dpython%2Bpep%2B318%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3Dmailman.236.1079968472.742.python-list%2540python.org%26rnum%3D2 :: *************** *** 162,166 **** function name. ! .. _Python Template Language: http://www.mems-exchange.org/software/quixote/doc/PTL.html :: --- 173,178 ---- function name. ! .. _Python Template Language: ! http://www.mems-exchange.org/software/quixote/doc/PTL.html :: *************** *** 180,183 **** --- 192,196 ---- it would require the introduction of a new keyword. + Current Implementation ====================== *************** *** 200,203 **** --- 213,217 ---- .. _patch: http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar-3.diff + Examples ======== *************** *** 212,224 **** isn't actually "wrapped" in the usual sense. ! :: ! def onexit(f): ! import atexit ! atexit.register(f) ! return f ! def func() [onexit]: ! ... 2. Define a class with a singleton instance. Note that once the class --- 226,238 ---- isn't actually "wrapped" in the usual sense. ! :: ! def onexit(f): ! import atexit ! atexit.register(f) ! return f ! def func() [onexit]: ! ... 2. Define a class with a singleton instance. Note that once the class *************** *** 226,281 **** to create more instances. (From Shane Hathaway on ``python-dev``.) ! :: ! def singleton(cls): ! return cls() ! class MyClass [singleton]: ! ... 3. Decorate a function with release information. (Based on an example posted by Anders Munch on ``python-dev``.) ! :: ! def release(**kwds): ! def decorate(f): ! for k in kwds: ! setattr(f, k, kwds[k]) ! return f ! return decorate ! def mymethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ! ... 4. Enforce function argument and return types. ! :: ! def accepts(*types): ! def check_accepts(f): ! assert len(types) == f.func_code.co_argcount ! def new_f(*args, **kwds): ! for (a, t) in zip(args, types): ! assert isinstance(a, t), \ ! "arg %r does not match %s" % (a,t) ! return f(*args, **kwds) ! return new_f ! return check_accepts ! def returns(rtype): ! def check_returns(f): ! def new_f(*args, **kwds): ! result = f(*args, **kwds) ! assert isinstance(result, rtype), \ ! "return value %r does not match %s" % (result,rtype) ! return result ! return new_f ! return check_returns ! def func(arg1, arg2) [accepts(int, (int,float)), ! returns((int,float))]: ! return arg1 * arg2 5. Declare that a class implements a particular (set of) interface(s). --- 240,295 ---- to create more instances. (From Shane Hathaway on ``python-dev``.) ! :: ! def singleton(cls): ! return cls() ! class MyClass [singleton]: ! ... 3. Decorate a function with release information. (Based on an example posted by Anders Munch on ``python-dev``.) ! :: ! def release(**kwds): ! def decorate(f): ! for k in kwds: ! setattr(f, k, kwds[k]) ! return f ! return decorate ! def mymethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ! ... 4. Enforce function argument and return types. ! :: ! def accepts(*types): ! def check_accepts(f): ! assert len(types) == f.func_code.co_argcount ! def new_f(*args, **kwds): ! for (a, t) in zip(args, types): ! assert isinstance(a, t), \ ! "arg %r does not match %s" % (a,t) ! return f(*args, **kwds) ! return new_f ! return check_accepts ! def returns(rtype): ! def check_returns(f): ! def new_f(*args, **kwds): ! result = f(*args, **kwds) ! assert isinstance(result, rtype), \ ! "return value %r does not match %s" % (result,rtype) ! return result ! return new_f ! return check_returns ! def func(arg1, arg2) [accepts(int, (int,float)), ! returns((int,float))]: ! return arg1 * arg2 5. Declare that a class implements a particular (set of) interface(s). *************** *** 283,310 **** experience with `PyProtocols`_. ! .. _PyProtocols: http://peak.telecommunity.com/PyProtocols.html ! :: ! def provides(*interfaces): ! """ ! An actual, working, implementation of provides for ! the current implementation of PyProtocols. Not ! particularly important for the PEP text. ! """ ! def provides(typ): ! declareImplementation(typ, instancesProvide=interfaces) ! return typ ! return provides ! class IBar(Interface): ! """Declare something about IBar here""" ! class Foo(object) [provides(IBar)]: ! """Implement something here...""" Of course, all these examples are possible today, though without the syntactic support. Open Issues =========== --- 297,325 ---- experience with `PyProtocols`_. ! .. _PyProtocols: http://peak.telecommunity.com/PyProtocols.html ! :: ! def provides(*interfaces): ! """ ! An actual, working, implementation of provides for ! the current implementation of PyProtocols. Not ! particularly important for the PEP text. ! """ ! def provides(typ): ! declareImplementation(typ, instancesProvide=interfaces) ! return typ ! return provides ! class IBar(Interface): ! """Declare something about IBar here""" ! class Foo(object) [provides(IBar)]: ! """Implement something here...""" Of course, all these examples are possible today, though without the syntactic support. + Open Issues =========== *************** *** 316,320 **** ``python-dev``. ! .. _strong arguments: http://mail.python.org/pipermail/python-dev/2004-March/thread.html --- 331,336 ---- ``python-dev``. ! .. _strong arguments: ! http://mail.python.org/pipermail/python-dev/2004-March/thread.html From o722obu at ksi.ms.mff.cuni.cz Tue Mar 30 03:19:31 2004 From: o722obu at ksi.ms.mff.cuni.cz (Roxanne Hester) Date: Tue Mar 30 17:27:01 2004 Subject: [Python-checkins] The spotlight shines on the dynamics of this earnings play fe obgaoujc Message-ID: <3$p089nm17cvs8w6i58q-uql8-k63@dm81cw> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040330/647dae57/attachment.html From fdrake at users.sourceforge.net Tue Mar 30 20:50:40 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Mar 30 21:02:17 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11601 Modified Files: dist.tex Log Message: added scripts to the list of files automatically included in the distribution (see SF bug #796042) Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** dist.tex 25 Mar 2004 16:35:10 -0000 1.72 --- dist.tex 31 Mar 2004 01:50:37 -0000 1.73 *************** *** 1015,1018 **** --- 1015,1019 ---- \option{libraries} options (\XXX{getting C library sources currently broken---no \method{get_source_files()} method in \file{build_clib.py}!}) + \item scripts identified by the \option{scripts} option \item anything that looks like a test script: \file{test/test*.py} (currently, the Distutils don't do anything with test scripts except From fdrake at users.sourceforge.net Wed Mar 31 02:45:49 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 02:57:29 2004 Subject: [Python-checkins] python/dist/src/Doc/api intro.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5090/api Modified Files: intro.tex Log Message: Emphasize the requirement that Python.h be included first more strongly. Closes SF bug #837228; backporting for Python 2.3.4. Index: intro.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/intro.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** intro.tex 6 Nov 2003 21:08:11 -0000 1.5 --- intro.tex 31 Mar 2004 07:45:46 -0000 1.6 *************** *** 38,44 **** \code{}, \code{}, \code{}, \code{}, and \code{} (if available). ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you must include \file{Python.h} ! before any standard headers are included. All user visible names defined by Python.h (except those defined by --- 38,47 ---- \code{}, \code{}, \code{}, \code{}, and \code{} (if available). ! ! \begin{notice}[warning] ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you \emph{must} include ! \file{Python.h} before any standard headers are included. ! \end{notice} All user visible names defined by Python.h (except those defined by From fdrake at users.sourceforge.net Wed Mar 31 02:45:49 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 02:57:35 2004 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5090/ext Modified Files: extending.tex Log Message: Emphasize the requirement that Python.h be included first more strongly. Closes SF bug #837228; backporting for Python 2.3.4. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** extending.tex 7 Nov 2003 11:45:34 -0000 1.26 --- extending.tex 31 Mar 2004 07:45:46 -0000 1.27 *************** *** 47,53 **** which pulls in the Python API (you can add a comment describing the purpose of the module and a copyright notice if you like). ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you must include \file{Python.h} ! before any standard headers are included. All user-visible symbols defined by \file{Python.h} have a prefix of --- 47,56 ---- which pulls in the Python API (you can add a comment describing the purpose of the module and a copyright notice if you like). ! ! \begin{notice}[warning] ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you \emph{must} include ! \file{Python.h} before any standard headers are included. ! \end{notice} All user-visible symbols defined by \file{Python.h} have a prefix of From fdrake at users.sourceforge.net Wed Mar 31 02:48:17 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 02:59:57 2004 Subject: [Python-checkins] python/dist/src/Doc/api intro.tex, 1.3.24.2, 1.3.24.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5465/api Modified Files: Tag: release23-maint intro.tex Log Message: Emphasize the requirement that Python.h be included first more strongly. Closes SF bug #837228; backported from the head. Index: intro.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/intro.tex,v retrieving revision 1.3.24.2 retrieving revision 1.3.24.3 diff -C2 -d -r1.3.24.2 -r1.3.24.3 *** intro.tex 6 Nov 2003 21:07:47 -0000 1.3.24.2 --- intro.tex 31 Mar 2004 07:48:14 -0000 1.3.24.3 *************** *** 38,44 **** \code{}, \code{}, \code{}, \code{}, and \code{} (if available). ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you must include \file{Python.h} ! before any standard headers are included. All user visible names defined by Python.h (except those defined by --- 38,47 ---- \code{}, \code{}, \code{}, \code{}, and \code{} (if available). ! ! \begin{notice}[warning] ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you \emph{must} include ! \file{Python.h} before any standard headers are included. ! \end{notice} All user visible names defined by Python.h (except those defined by From fdrake at users.sourceforge.net Wed Mar 31 02:48:17 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 03:00:03 2004 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex, 1.24.10.2, 1.24.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5465/ext Modified Files: Tag: release23-maint extending.tex Log Message: Emphasize the requirement that Python.h be included first more strongly. Closes SF bug #837228; backported from the head. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.24.10.2 retrieving revision 1.24.10.3 diff -C2 -d -r1.24.10.2 -r1.24.10.3 *** extending.tex 7 Nov 2003 12:11:16 -0000 1.24.10.2 --- extending.tex 31 Mar 2004 07:48:14 -0000 1.24.10.3 *************** *** 47,53 **** which pulls in the Python API (you can add a comment describing the purpose of the module and a copyright notice if you like). ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you must include \file{Python.h} ! before any standard headers are included. All user-visible symbols defined by \file{Python.h} have a prefix of --- 47,56 ---- which pulls in the Python API (you can add a comment describing the purpose of the module and a copyright notice if you like). ! ! \begin{notice}[warning] ! Since Python may define some pre-processor definitions which affect ! the standard headers on some systems, you \emph{must} include ! \file{Python.h} before any standard headers are included. ! \end{notice} All user-visible symbols defined by \file{Python.h} have a prefix of From ltqjxjuyjg at bbaw.de Wed Mar 31 04:54:19 2004 From: ltqjxjuyjg at bbaw.de (Louella Keller) Date: Wed Mar 31 03:02:47 2004 Subject: [Python-checkins] Eliminate any trading losses by loading up on this pick wiyy magu Message-ID: <20m50l$-q-5-1472876kcra@p1f74.h.dez> April 2004 Top Pick of the Month Life Energy and Technology Holdings, Inc. (OTCBB: LETH) LETH Receives $250,000,000 in Financing to Fund the Manufacture of the Environmentally Friendly Biosphere Process System "waste-to-energy" Units in the United States. First Unit to Roll-out in New Orleans in early Second Quarter. We are expecting earth-shattering upcoming news leading a strong rally in LETH for a Company that has announced over $100 Million in sales orders in the past year, and tops that record-setting achievement by acquiring the equivalent of $8.62 per share in cash for major worldwide expansion. **Our readers grabbed substantial profits for our March pick** USHG featured at .75 Reached 3.65 in 8 days! Traded as high as 4.55 since! The Biosphere Process System - Soaring Worldwide Demand: LETH is utilizing the unique proprietary technology of their Biosphere Process System to generate revenue from the disposal of a wide variety of waste products at 5 to 7 tons per hour which makes a major impact on the global waste problem. This profitable and environmentally safe process converts into clean, "green" electricity such waste materials as Municipal Solid Waste, agricultural wastes, forestry wastes, medical wastes, industrial wastes, sewage sludge, shale oil, sour natural gas, and the huge market of used tires. LETH profits from the sale of electricity created from the waste conversion on a continuous basis by generating 5 to 10 mega-watts per hour of electricity which is then sold to replenish the local or national grid. The Biosphere Process succeeds in filling an urgent worldwide need for cost-effective renewable energy sources and a corresponding universal need to solve critical problems in the disposal of waste. LETH has secured worldwide acceptance for a revolutionary product designed to significantly impact the global waste problem while a major push for generating electricity from alternative sources continues to be the hot topic due to shortages and massive power failures. Financing of $250 Million Positions LETH for Astronomical Sales: The magnitude of this financing package goes much deeper than the fact that this $1.50 stock now has accessible capital equivalent to $8.62 per common share in cash. There are 26 Biosphere Process Systems presently in operation worldwide. The available funding could easily be used to produce 100 additional Biospheres. Now factor in that average sale price is $7 Million per Biosphere. We cannot even comprehend what this stock should be trading for with a potential $700,000,000 in future sales with 29 million shares outstanding! LETH Stock Guidance: Current Price: 1.55 Near-Term Target: 4.80 Projected High for '04: 12.50 LETH's Blue Chip Partner - Fortifying the System: LETH is an alliance partner with Tetra Tech, Inc. (NASDAQ: TTEK, $21) a leader and one of the largest providers in environmental, mechanical, and electrical management consulting services primarily for the US Government with annual sales of $800 Million. Tetra Tech will coordinate the securing of necessary permits, installation, and continuous worldwide monitoring of the Biosphere Process System for LETH. Tetra Tech is now in the process of obtaining Department of Environmental Quality permitting for the Biosphere Process in the state of Louisiana. This is a monumental event for LETH which opens the floodgates for major project revenues in Louisiana while having a parallel effect on LETH stock in the form of a huge near-term announcement. Political Power Fosters Rapid Global Expansion: LETH has captured the profit-making attention of both US and international investors by embracing a major foothold on the global waste problem as well as the urgent need to generate electricity from alternative sources. This has been accomplished by successfully creating major inroads to all corners of the globe through the political contacts at the highest level from Dr. Albert Reynolds, Chairman of LETH, who is also the former Prime Minister of Ireland. Dr. Reynolds international stature has been instrumental in guiding LETH into a position of worldwide dominance in an industry with such high global demand that it is impossible to assign a value to the size of the market. Uncommon Value for a Company of this Caliber: We are witnessing a breakout year in the making judging by the frequency of recently announced sales contracts for the Biosphere, the impressive backlog of over $100 Million in sales orders, and the Company's very solid financial position. We view this perfectly timed convergence of events as the catalyst for additional contracts that will perpetuate the shattering of the Company's own sales records. As our Top Stock Pick for April, we anticipate the continuation of strong positive developments that will ignite LETH shares which carry our highest rating for short-term trading profits followed by robust long-term capital gains. Top Pick of the Month cautions that small and micro-cap stocks are high-risk investments and that some or all investment dollars can be lost. We suggest you consult a professional investment advisor before purchasing any stock. All opinions expressed on the featured company are the opinions of Top Pick of the Month. Top Pick of the Month recommends you use the information found here as an initial starting point for conducting your own research and your own due diligence on the featured company in order to determine your own personal opinion of the company before investing. Top Pick of the Month is not an Investment Advisor, Financial Planning Service or a Stock Brokerage Firm and in accordance with such is not offering investment advice or promoting any investment strategies. Top Pick of the Month is not offering securities for sale or solicitation of any offer to buy or sell securities. Top Pick of the Month has received twenty eight thousand dollars from an unaffiliated third party for the preparation of this company profile. Since we have received compensation there is an inherent conflict of interest in our statements and opinions. Readers of this publication are cautioned not to place undue reliance on forward looking statements, which are based on certain assumptions and expectations involving various risks and uncertainties, that could cause results to differ materially from those set forth in the forward looking statements. nr hzuqh From fdrake at users.sourceforge.net Wed Mar 31 03:02:58 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 03:14:39 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex license.tex, 1.1.2.1, 1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7963 Modified Files: Tag: release23-maint license.tex Log Message: add missing and forthcoming releases Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/license.tex,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** license.tex 27 Sep 2003 07:14:32 -0000 1.1.2.1 --- license.tex 31 Mar 2004 08:02:55 -0000 1.1.2.2 *************** *** 44,47 **** --- 44,49 ---- \linev{2.3.1}{2.3}{2002-2003}{PSF}{yes} \linev{2.3.2}{2.3.1}{2003}{PSF}{yes} + \linev{2.3.3}{2.3.2}{2003}{PSF}{yes} + \linev{2.3.4}{2.3.3}{2004}{PSF}{yes} \end{tablev} From fdrake at users.sourceforge.net Wed Mar 31 03:04:51 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 03:16:39 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex license.tex, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8336 Modified Files: license.tex Log Message: add missing and forthcoming releases Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/license.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** license.tex 20 Mar 2004 17:24:51 -0000 1.4 --- license.tex 31 Mar 2004 08:04:46 -0000 1.5 *************** *** 44,47 **** --- 44,49 ---- \linev{2.3.1}{2.3}{2002-2003}{PSF}{yes} \linev{2.3.2}{2.3.1}{2003}{PSF}{yes} + \linev{2.3.3}{2.3.2}{2003}{PSF}{yes} + \linev{2.3.4}{2.3.3}{2004}{PSF}{yes} \end{tablev} From fdrake at users.sourceforge.net Wed Mar 31 03:08:37 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 03:20:18 2004 Subject: [Python-checkins] python/dist/src/Doc/texinputs howto.cls, 1.14, 1.15 manual.cls, 1.18, 1.19 python.sty, 1.108, 1.109 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8874/texinputs Modified Files: howto.cls manual.cls python.sty Log Message: add a heavy box around warning notices to make them really stand out in the PDF and PostScript versions of the docs (the CSS already does this for HTML) Index: howto.cls =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/howto.cls,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** howto.cls 17 Jul 2003 04:15:35 -0000 1.14 --- howto.cls 31 Mar 2004 08:08:34 -0000 1.15 *************** *** 8,11 **** --- 8,12 ---- \RequirePackage{pypaper} + \RequirePackage{fancybox} % Change the options here to get a different set of basic options, This Index: manual.cls =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/manual.cls,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** manual.cls 15 Mar 2002 22:38:16 -0000 1.18 --- manual.cls 31 Mar 2004 08:08:34 -0000 1.19 *************** *** 8,11 **** --- 8,12 ---- \RequirePackage{pypaper} + \RequirePackage{fancybox} % Change the options here to get a different set of basic options, but only Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** python.sty 10 Feb 2004 18:29:43 -0000 1.108 --- python.sty 31 Mar 2004 08:08:34 -0000 1.109 *************** *** 980,988 **** } \newcommand{\py@noticelabel@note}{Note:} \newcommand{\py@noticelabel@warning}{Warning:} \newenvironment{notice}[1][note]{ \par\strong{\csname py@noticelabel@#1\endcsname} ! }{} \newcommand{\note}[1]{\strong{\py@noticelabel@note} #1} \newcommand{\warning}[1]{\strong{\py@noticelabel@warning} #1} --- 980,1016 ---- } + \newlength{\py@noticelength} + + \newcommand{\py@heavybox}{ + \setlength{\fboxrule}{2pt} + \setlength{\fboxsep}{7pt} + \setlength{\py@noticelength}{\linewidth} + \addtolength{\py@noticelength}{-2\fboxsep} + \addtolength{\py@noticelength}{-2\fboxrule} + \setlength{\shadowsize}{3pt} + \Sbox + \minipage{\py@noticelength} + } + \newcommand{\py@endheavybox}{ + \endminipage + \endSbox + \fbox{\TheSbox} + } + + % a 'note' is as plain as it gets: \newcommand{\py@noticelabel@note}{Note:} + \newcommand{\py@noticestart@note}{} + \newcommand{\py@noticeend@note}{} + + % a 'warning' gets more visible distinction: \newcommand{\py@noticelabel@warning}{Warning:} + \newcommand{\py@noticestart@warning}{\py@heavybox} + \newcommand{\py@noticeend@warning}{\py@endheavybox} + \newenvironment{notice}[1][note]{ + \def\py@noticetype{#1} + \csname py@noticestart@#1\endcsname \par\strong{\csname py@noticelabel@#1\endcsname} ! }{\csname py@noticeend@\py@noticetype\endcsname} \newcommand{\note}[1]{\strong{\py@noticelabel@note} #1} \newcommand{\warning}[1]{\strong{\py@noticelabel@warning} #1} From goodger at users.sourceforge.net Wed Mar 31 11:24:03 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Wed Mar 31 11:36:53 2004 Subject: [Python-checkins] python/nondist/peps pep-0327.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10738 Modified Files: pep-0327.txt Log Message: updates from Facundo Batista, with edits Index: pep-0327.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0327.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0327.txt 29 Jan 2004 19:59:56 -0000 1.1 --- pep-0327.txt 31 Mar 2004 16:24:00 -0000 1.2 *************** *** 9,13 **** Created: 17-Oct-2003 Python-Version: 2.4 ! Post-History: 30-Nov-2003, 02-Jan-2004 --- 9,13 ---- Created: 17-Oct-2003 Python-Version: 2.4 ! Post-History: 30-Nov-2003, 02-Jan-2004, 29-Jan-2004 *************** *** 401,419 **** affects just operations' results. ! **From int or long**: There's no loss and no need to specify any other ! information:: Decimal(35) Decimal(-124) ! **From string**: Strings with floats in normal and engineering ! notation will be supported. In this transformation there is no loss ! of information, as the string is directly converted to Decimal (there ! is not an intermediate conversion through float):: Decimal("-12") Decimal("23.2e-7") ! **From float**: The initial discussion on this item was what should happen when passing floating point to the constructor: --- 401,430 ---- affects just operations' results. ! ! From int or long ! '''''''''''''''' ! ! There's no loss and no need to specify any other information:: Decimal(35) Decimal(-124) ! ! From string ! ''''''''''' ! ! Strings with floats in normal and engineering notation will be ! supported. In this transformation there is no loss of information, as ! the string is directly converted to Decimal (there is not an ! intermediate conversion through float):: Decimal("-12") Decimal("23.2e-7") ! ! From float ! '''''''''' ! ! The initial discussion on this item was what should happen when passing floating point to the constructor: *************** *** 461,474 **** a substantial risk of tricking naive users. ! So, I think that the best solution is to have a parameter that says in ! which position after the decimal point you apply a round-half-up ! rounding. If you do not specify this parameter, you get an exact ! conversion. In this way:: ! Decimal(1.1, 2) == Decimal('1.1') ! Decimal(1.1, 16) == Decimal('1.1000000000000001') ! Decimal(1.1) == Decimal('110000000000000008881784197001252...e-51') ! **From tuples**: Aahz suggested to construct from tuples: it's easier to implement ``eval()``'s round trip and "someone who has numeric values representing a Decimal does not need to convert them to a --- 472,494 ---- a substantial risk of tricking naive users. ! So, the accepted solution through c.l.p is that you can not call Decimal ! with a float. Instead you must use a method: Decimal.from_float(). The ! syntax:: ! Decimal.from_float(floatNumber, [positions]) ! ! where ``floatNumber`` is the float number origin of the construction and ! ``positions`` is the positions after the decimal point where you apply a ! round-half-up rounding, if any. In this way you can do, for example:: ! Decimal.from_float(1.1, 2): The same that doing Decimal('1.1'). ! Decimal.from_float(1.1, 16): The same that doing Decimal('1.1000000000000001'). ! Decimal.from_float(1.1): The same that doing Decimal('110000000000000008881784197001252...e-51'). ! ! ! From tuples ! ''''''''''' ! ! Aahz suggested to construct from tuples: it's easier to implement ``eval()``'s round trip and "someone who has numeric values representing a Decimal does not need to convert them to a *************** *** 481,492 **** Decimal((1, (3, 2, 2, 5), -2)) # for -32.25 - **From Decimal**: No mystery here, just a copy. ! **Syntax to all the cases**:: ! Decimal(value, [decimal_digits]) ! where ``value`` can be any of the data types just mentioned and ! ``decimal_digits`` is allowed only when value is float. --- 501,522 ---- Decimal((1, (3, 2, 2, 5), -2)) # for -32.25 ! From Decimal ! '''''''''''' ! No mystery here, just a copy. ! ! Syntax for All Cases ! '''''''''''''''''''' ! ! :: ! ! Decimal(value1) ! Decimal.from_float(value2, [decimal_digits]) ! ! where ``value1`` can be int, long, string, tuple or Decimal, ! ``value1`` can be only float, and ``decimal_digits`` is an optional ! int. *************** *** 510,522 **** So, here I define the behaviour again for each data type. - **From int or long**: Aahz suggested the need of an explicit - conversion from int, but also thinks it's OK if the precision in the - current Context is not exceeded; in that case you raise ValueError. - Votes in comp.lang.python agreed with this. ! **From string**: Everybody agrees to raise an exception here. ! **From float**: Aahz is strongly opposed to interact with float, ! suggesting an explicit conversion: The problem is that Decimal is capable of greater precision, --- 540,564 ---- So, here I define the behaviour again for each data type. ! From int or long ! '''''''''''''''' ! Aahz suggested the need of an explicit conversion from int, but also ! thinks it's OK if the precision in the current Context is not ! exceeded; in that case you raise ValueError. Votes in ! comp.lang.python agreed with this. ! ! ! From string ! ''''''''''' ! ! Everybody agrees to raise an exception here. ! ! ! From float ! '''''''''' ! ! Aahz is strongly opposed to interact with float, suggesting an ! explicit conversion: The problem is that Decimal is capable of greater precision, *************** *** 534,538 **** ``Decimal(35) + 1.1`` raises an error). ! **From Decimal**: There isn't any issue here. --- 576,587 ---- ``Decimal(35) + 1.1`` raises an error). ! This resulted to be too tricky. So tricky, that c.l.p agreed to raise ! TypeError in this case: you could not mix Decimal and float. ! ! ! From Decimal ! '''''''''''' ! ! There isn't any issue here. From montanaro at users.sourceforge.net Wed Mar 31 13:19:24 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed Mar 31 13:31:24 2004 Subject: [Python-checkins] python/nondist/peps pep-0318.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv870 Modified Files: pep-0318.txt Log Message: * tweak adding attributes example * add open issue about changing func_name Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0318.txt 30 Mar 2004 13:39:21 -0000 1.8 --- pep-0318.txt 31 Mar 2004 18:19:22 -0000 1.9 *************** *** 248,257 **** ... ! 3. Decorate a function with release information. (Based on an example ! posted by Anders Munch on ``python-dev``.) :: ! def release(**kwds): def decorate(f): for k in kwds: --- 248,257 ---- ... ! 3. Add attributes to a function. (Based on an example posted by ! Anders Munch on ``python-dev``.) :: ! def attrs(**kwds): def decorate(f): for k in kwds: *************** *** 260,268 **** return decorate ! def mymethod(f) [release(versionadded="2.2", ! author="Guido van Rossum")]: ... ! 4. Enforce function argument and return types. :: --- 260,270 ---- return decorate ! def mymethod(f) [attrs(versionadded="2.2", ! author="Guido van Rossum")]: ... ! 4. Enforce function argument and return types. (Note that this is not ! exactly correct, as the returned new_f doesn't have "func" as its ! func_name attribute.) :: *************** *** 331,334 **** --- 333,341 ---- ``python-dev``. + 2. Decorators which wrap a function and return a different function + should be able to easily change the func_name attribute without + constructing it with new.function(). Perhaps the func_name + attribute should be writable. + .. _strong arguments: http://mail.python.org/pipermail/python-dev/2004-March/thread.html From gvanrossum at users.sourceforge.net Wed Mar 31 13:53:32 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Mar 31 14:05:38 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7203 Modified Files: test_tempfile.py Log Message: When /tmp has certain sticky bits set, newly created subdirectories inherit those bits, causing the test_mkdtemp.test_mode() test to fail. Remove those before comparing the actual mode to the expected mode. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_tempfile.py 23 Oct 2003 15:55:28 -0000 1.16 --- test_tempfile.py 31 Mar 2004 18:53:29 -0000 1.17 *************** *** 480,483 **** --- 480,484 ---- try: mode = stat.S_IMODE(os.stat(dir).st_mode) + mode &= 0777 # Mask off sticky bits inherited from /tmp expected = 0700 if sys.platform in ('win32', 'os2emx', 'mac'): From gvanrossum at users.sourceforge.net Wed Mar 31 13:55:20 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Mar 31 14:07:06 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py, 1.14.8.3, 1.14.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7522 Modified Files: Tag: release23-maint test_tempfile.py Log Message: Backport 1.17: When /tmp has certain sticky bits set, newly created subdirectories inherit those bits, causing the test_mkdtemp.test_mode() test to fail. Remove those before comparing the actual mode to the expected mode. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.14.8.3 retrieving revision 1.14.8.4 diff -C2 -d -r1.14.8.3 -r1.14.8.4 *** test_tempfile.py 23 Oct 2003 15:55:03 -0000 1.14.8.3 --- test_tempfile.py 31 Mar 2004 18:55:17 -0000 1.14.8.4 *************** *** 474,477 **** --- 474,478 ---- try: mode = stat.S_IMODE(os.stat(dir).st_mode) + mode &= 0777 # Mask off sticky bits inherited from /tmp expected = 0700 if sys.platform in ('win32', 'os2emx', 'mac'): From loewis at users.sourceforge.net Wed Mar 31 13:58:45 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Mar 31 14:10:31 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.7, 1.2.12.8 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8092 Modified Files: Tag: release23-maint python-2.3.spec Log Message: Patch #924497: find(1) all files with /usr/local/bin/python in them. Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.7 retrieving revision 1.2.12.8 diff -C2 -d -r1.2.12.7 -r1.2.12.8 *** python-2.3.spec 15 Feb 2004 21:26:44 -0000 1.2.12.7 --- python-2.3.spec 31 Mar 2004 18:58:42 -0000 1.2.12.8 *************** *** 33,37 **** %define version 2.3.3 %define libvers 2.3 ! %define release 1pydotorg %define __prefix /usr --- 33,37 ---- %define version 2.3.3 %define libvers 2.3 ! %define release 3pydotorg %define __prefix /usr *************** *** 128,131 **** --- 128,135 ---- %changelog + * Sat Mar 27 2003 Sean Reifschneider [2.3.2-3pydotorg] + - Being more agressive about finding the paths to fix for + #!/usr/local/bin/python. + * Sat Feb 07 2004 Sean Reifschneider [2.3.3-2pydotorg] - Adding code to remove "#!/usr/local/bin/python" from particular files and *************** *** 268,275 **** # fix the #! line in installed files ! for file in \ ! usr/lib/python2.3/Tools/scripts/parseentities.py \ ! usr/lib/python2.3/cgi.py \ ! usr/lib/python2.3/Tools/faqwiz/faqw.py do sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ --- 272,277 ---- # fix the #! line in installed files ! find . -type f -print0 | xargs -0 grep -l /usr/local/bin/python | ! while read file do sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ From loewis at users.sourceforge.net Wed Mar 31 13:59:07 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Mar 31 14:10:52 2004 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8253 Modified Files: python-2.3.spec Log Message: Patch #924497: find(1) all files with /usr/local/bin/python in them. Backported to 2.3. Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** python-2.3.spec 15 Feb 2004 21:27:03 -0000 1.4 --- python-2.3.spec 31 Mar 2004 18:59:04 -0000 1.5 *************** *** 33,37 **** %define version 2.3.3 %define libvers 2.3 ! %define release 1pydotorg %define __prefix /usr --- 33,37 ---- %define version 2.3.3 %define libvers 2.3 ! %define release 3pydotorg %define __prefix /usr *************** *** 128,131 **** --- 128,135 ---- %changelog + * Sat Mar 27 2003 Sean Reifschneider [2.3.2-3pydotorg] + - Being more agressive about finding the paths to fix for + #!/usr/local/bin/python. + * Sat Feb 07 2004 Sean Reifschneider [2.3.3-2pydotorg] - Adding code to remove "#!/usr/local/bin/python" from particular files and *************** *** 268,275 **** # fix the #! line in installed files ! for file in \ ! usr/lib/python2.3/Tools/scripts/parseentities.py \ ! usr/lib/python2.3/cgi.py \ ! usr/lib/python2.3/Tools/faqwiz/faqw.py do sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ --- 272,277 ---- # fix the #! line in installed files ! find . -type f -print0 | xargs -0 grep -l /usr/local/bin/python | ! while read file do sed 's|^#!.*python|#!/usr/bin/env python'"%{binsuffix}"'|' \ From akuchling at users.sourceforge.net Wed Mar 31 15:17:59 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Mar 31 15:29:45 2004 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25977 Modified Files: cgitb.py Log Message: [Bugfix candidate] Escape traceback type and value. There are probably additional cases where cgitb.py doesn't escape as paranoidly as it should (e.g. attribute names) Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** cgitb.py 29 Jun 2003 05:46:53 -0000 1.9 --- cgitb.py 31 Mar 2004 20:17:56 -0000 1.10 *************** *** 147,151 **** %s''' % '\n'.join(rows)) ! exception = ['

%s: %s' % (strong(str(etype)), str(evalue))] if type(evalue) is types.InstanceType: for name in dir(evalue): --- 147,152 ---- %s''' % '\n'.join(rows)) ! exception = ['

%s: %s' % (strong(pydoc.html.escape(str(etype))), ! pydoc.html.escape(str(evalue)))] if type(evalue) is types.InstanceType: for name in dir(evalue): From jhylton at users.sourceforge.net Wed Mar 31 21:45:25 2004 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed Mar 31 21:57:14 2004 Subject: [Python-checkins] python/dist/src/Python import.c,2.229,2.230 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32543 Modified Files: import.c Log Message: Bump the magic number to avoid sharing bytecode between 2.3 and 2.4. Revise the long comment that explained details of the magic number in gory detail. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.229 retrieving revision 2.230 diff -C2 -d -r2.229 -r2.230 *** import.c 26 Mar 2004 15:09:27 -0000 2.229 --- import.c 1 Apr 2004 02:45:22 -0000 2.230 *************** *** 20,56 **** /* In getmtime.c */ ! /* Magic word to reject .pyc files generated by other Python versions */ ! /* Change for each incompatible change */ ! /* The value of CR and LF is incorporated so if you ever read or write a .pyc file in text mode the magic number will be wrong; also, the Apple MPW compiler swaps their values, botching string constants. - XXX That probably isn't important anymore. - */ - /* XXX Perhaps the magic number should be frozen and a version field - added to the .pyc file header? */ - /* New way to come up with the low 16 bits of the magic number: - (YEAR-1995) * 10000 + MONTH * 100 + DAY - where MONTH and DAY are 1-based. - XXX Whatever the "old way" may have been isn't documented. - XXX This scheme breaks in 2002, as (2002-1995)*10000 = 70000 doesn't - fit in 16 bits. - XXX Later, sometimes 1 gets added to MAGIC in order to record that - the Unicode -U option is in use. IMO (Tim's), that's a Bad Idea - (quite apart from that the -U option doesn't work so isn't used - anyway). ! XXX MAL, 2002-02-07: I had to modify the MAGIC due to a fix of the ! UTF-8 encoder (it previously produced invalid UTF-8 for unpaired ! high surrogates), so I simply bumped the month value to 20 (invalid ! month) and set the day to 1. This should be recognizable by any ! algorithm relying on the above scheme. Perhaps we should simply ! start counting in increments of 10 from now on ?! ! ! MWH, 2002-08-03: Removed SET_LINENO. Couldn't be bothered figuring ! out the MAGIC schemes, so just incremented it by 10. ! GvR, 2002-08-31: Because MWH changed the bytecode again, moved the ! magic number *back* to 62011. This should get the snake-farm to ! throw away its old .pyc files, amongst others. Known values: --- 20,37 ---- /* In getmtime.c */ ! /* Magic word to reject .pyc files generated by other Python versions. ! It should change for each incompatible change to the bytecode. ! ! The value of CR and LF is incorporated so if you ever read or write a .pyc file in text mode the magic number will be wrong; also, the Apple MPW compiler swaps their values, botching string constants. ! Apparently, there was a distinction made between even and odd ! bytecodes that is related to Unicode. The details aren't clear, ! but the magic number has been odd for a long time. ! There were a variety of old schemes for setting the magic number. ! The current working scheme is to increment the previous value by ! 10. Known values: *************** *** 67,72 **** Python 2.3a0: 62021 Python 2.3a0: 62011 (!) */ ! #define MAGIC (62011 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the --- 48,54 ---- Python 2.3a0: 62021 Python 2.3a0: 62011 (!) + Python 2.4a0: 62031 */ ! #define MAGIC (62031 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the From fdrake at users.sourceforge.net Wed Mar 31 22:56:49 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 23:08:38 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_scripts.py, 1.21, 1.21.8.1 sdist.py, 1.56, 1.56.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11059/Lib/distutils/command Modified Files: Tag: release23-maint build_scripts.py sdist.py Log Message: backport fix for SF bug #796042: sdist ignores scripts argument in setup The fix adds a get_source_files() method to the build_scripts command and adds the result to the default manifest list. Index: build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v retrieving revision 1.21 retrieving revision 1.21.8.1 diff -C2 -d -r1.21 -r1.21.8.1 *** build_scripts.py 27 Jun 2003 19:33:38 -0000 1.21 --- build_scripts.py 1 Apr 2004 03:56:46 -0000 1.21.8.1 *************** *** 42,45 **** --- 42,47 ---- self.scripts = self.distribution.scripts + def get_source_files(self): + return self.scripts def run (self): Index: sdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/sdist.py,v retrieving revision 1.56 retrieving revision 1.56.14.1 diff -C2 -d -r1.56 -r1.56.14.1 *** sdist.py 19 Nov 2002 13:12:28 -0000 1.56 --- sdist.py 1 Apr 2004 03:56:46 -0000 1.56.14.1 *************** *** 305,308 **** --- 305,312 ---- self.filelist.extend(build_clib.get_source_files()) + if self.distribution.has_scripts(): + build_scripts = self.get_finalized_command('build_scripts') + self.filelist.extend(build_scripts.get_source_files()) + # add_defaults () From fdrake at users.sourceforge.net Wed Mar 31 22:56:49 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 23:08:44 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex, 1.56.8.4, 1.56.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11059/Doc/dist Modified Files: Tag: release23-maint dist.tex Log Message: backport fix for SF bug #796042: sdist ignores scripts argument in setup The fix adds a get_source_files() method to the build_scripts command and adds the result to the default manifest list. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.56.8.4 retrieving revision 1.56.8.5 diff -C2 -d -r1.56.8.4 -r1.56.8.5 *** dist.tex 19 Oct 2003 07:31:14 -0000 1.56.8.4 --- dist.tex 1 Apr 2004 03:56:46 -0000 1.56.8.5 *************** *** 1004,1007 **** --- 1004,1008 ---- \option{libraries} options (\XXX{getting C library sources currently broken -- no get\_source\_files() method in build\_clib.py!}) + \item scripts identified by the \option{scripts} option \item anything that looks like a test script: \file{test/test*.py} (currently, the Distutils don't do anything with test scripts except From fdrake at users.sourceforge.net Wed Mar 31 23:06:55 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 23:18:44 2004 Subject: [Python-checkins] python/dist/src/Doc/lib xmldomminidom.tex, 1.8, 1.8.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12534 Modified Files: Tag: release23-maint xmldomminidom.tex Log Message: - make sure the methods minidom adds to the basic DOM are attributed to Node objects in the index (closes SF bug #832251) - fix a variety of markup nits Backported from trunk revision 1.9. Index: xmldomminidom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldomminidom.tex,v retrieving revision 1.8 retrieving revision 1.8.12.1 diff -C2 -d -r1.8 -r1.8.12.1 *** xmldomminidom.tex 18 Apr 2003 22:04:34 -0000 1.8 --- xmldomminidom.tex 1 Apr 2004 04:06:52 -0000 1.8.12.1 *************** *** 128,132 **** ! \begin{methoddesc}{unlink}{} Break internal references within the DOM so that it will be garbage collected on versions of Python without cyclic GC. Even when cyclic --- 128,132 ---- ! \begin{methoddesc}[Node]{unlink}{} Break internal references within the DOM so that it will be garbage collected on versions of Python without cyclic GC. Even when cyclic *************** *** 138,160 **** \end{methoddesc} ! \begin{methoddesc}{writexml}{writer} Write XML to the writer object. The writer should have a \method{write()} method which matches that of the file object interface. ! \versionadded[To support pretty output, new keyword parameters indent, ! addindent, and newl have been added]{2.1} ! \versionadded[For the \class{Document} node, an additional keyword argument encoding can be used to specify the encoding field of the XML header]{2.3} - \end{methoddesc} ! \begin{methoddesc}{toxml}{\optional{encoding}} Return the XML that the DOM represents as a string. - \versionadded[the \var{encoding} argument]{2.3} - With no argument, the XML header does not specify an encoding, and the result is Unicode string if the default encoding cannot represent all --- 138,157 ---- \end{methoddesc} ! \begin{methoddesc}[Node]{writexml}{writer} Write XML to the writer object. The writer should have a \method{write()} method which matches that of the file object interface. ! \versionchanged[To support pretty output, new keyword parameters ! \var{indent}, \var{addindent}, and \var{newl} have been added]{2.1} ! \versionchanged[For the \class{Document} node, an additional keyword argument encoding can be used to specify the encoding field of the XML header]{2.3} \end{methoddesc} ! \begin{methoddesc}[Node]{toxml}{\optional{encoding}} Return the XML that the DOM represents as a string. With no argument, the XML header does not specify an encoding, and the result is Unicode string if the default encoding cannot represent all *************** *** 169,176 **** as "utf-8". \end{methoddesc} ! \begin{methoddesc}{toprettyxml}{\optional{indent\optional{, newl}}} ! Return a pretty-printed version of the document. \var{indent} specifies the indentation string and defaults to a tabulator; \var{newl} specifies --- 166,173 ---- as "utf-8". + \versionchanged[the \var{encoding} argument was introduced]{2.3} \end{methoddesc} ! \begin{methoddesc}[Node]{toprettyxml}{\optional{indent\optional{, newl}}} Return a pretty-printed version of the document. \var{indent} specifies the indentation string and defaults to a tabulator; \var{newl} specifies *************** *** 178,184 **** \versionadded{2.1} ! ! \versionadded[the encoding argument; see \method{toxml}]{2.3} ! \end{methoddesc} --- 175,179 ---- \versionadded{2.1} ! \versionchanged[the encoding argument; see \method{toxml()}]{2.3} \end{methoddesc} *************** *** 186,190 **** \refmodule{xml.dom.minidom}: ! \begin{methoddesc}{cloneNode}{deep} Although this method was present in the version of \refmodule{xml.dom.minidom} packaged with Python 2.0, it was seriously --- 181,185 ---- \refmodule{xml.dom.minidom}: ! \begin{methoddesc}[Node]{cloneNode}{deep} Although this method was present in the version of \refmodule{xml.dom.minidom} packaged with Python 2.0, it was seriously From fdrake at users.sourceforge.net Wed Mar 31 23:11:07 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 23:22:56 2004 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib.tex, 1.50.8.1, 1.50.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13286 Modified Files: Tag: release23-maint liburllib.tex Log Message: Note that reading from a socket may not always return all of the remaining content of a stream when expected to do so. Closes SF bug #725265. Backported from trunk revision 1.52. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.50.8.1 retrieving revision 1.50.8.2 diff -C2 -d -r1.50.8.1 -r1.50.8.2 *** liburllib.tex 27 Aug 2003 15:10:54 -0000 1.50.8.1 --- liburllib.tex 1 Apr 2004 04:11:05 -0000 1.50.8.2 *************** *** 30,33 **** --- 30,37 ---- \method{close()}, \method{info()} and \method{geturl()}. It also has proper support for the iterator protocol. + One caveat: the \method{read()} method, if the size argument is + omitted or negative, may not read until the end of the data stream; + there is no good way to determine that the entire stream from a socket + has been read in the general case. Except for the \method{info()} and \method{geturl()} methods, From fdrake at users.sourceforge.net Wed Mar 31 23:33:42 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Mar 31 23:45:32 2004 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl, 1.137.8.1, 1.137.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17255 Modified Files: Tag: release23-maint python.perl Log Message: backport trunk revision 1.144, closing SF bug #793702: - make "--" in code text not get converted to "-" - fix minor typo in comment (but this time the typo is fixed correctly!) Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.137.8.1 retrieving revision 1.137.8.2 diff -C2 -d -r1.137.8.1 -r1.137.8.2 *** python.perl 8 Jan 2004 15:00:13 -0000 1.137.8.1 --- python.perl 1 Apr 2004 04:33:39 -0000 1.137.8.2 *************** *** 156,159 **** --- 156,167 ---- } + # Helper used in many places that arbitrary code-like text appears: + + sub codetext($){ + my $text = "$_[0]"; + $text =~ s/--/-\-/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], '', ''); } sub do_cmd_code{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_module{ return use_wrappers($_[0], '', ''); } --- 196,200 ---- return use_wrappers($_[0], '', ''); } sub do_cmd_code{ ! return use_code_wrappers($_[0], '', ''); } sub do_cmd_module{ return use_wrappers($_[0], '', ''); } *************** *** 206,212 **** return use_wrappers($_[0], '', ''); } sub do_cmd_regexp{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_character{ ! return use_wrappers($_[0], '"', '"'); } sub do_cmd_program{ return use_wrappers($_[0], '', ''); } --- 220,226 ---- return use_wrappers($_[0], '', ''); } sub do_cmd_regexp{ ! return use_code_wrappers($_[0], '', ''); } sub do_cmd_character{ ! return use_code_wrappers($_[0], '"', '"'); } sub do_cmd_program{ return use_wrappers($_[0], '', ''); } *************** *** 233,237 **** return do_cmd_file($_[0]); } sub do_cmd_samp{ ! return use_wrappers($_[0], '"', '"'); } sub do_cmd_kbd{ return use_wrappers($_[0], '', ''); } --- 247,251 ---- return do_cmd_file($_[0]); } sub do_cmd_samp{ ! return use_code_wrappers($_[0], '"', '"'); } sub do_cmd_kbd{ return use_wrappers($_[0], '', ''); } *************** *** 612,616 **** define_indexing_macro('ttindex'); sub idx_cmd_ttindex($){ ! my $str = next_argument(); my $entry = $str . get_indexsubitem(); add_index_entry($entry, $_[0]); --- 626,630 ---- define_indexing_macro('ttindex'); sub idx_cmd_ttindex($){ ! my $str = codetext(next_argument()); my $entry = $str . get_indexsubitem(); add_index_entry($entry, $_[0]); *************** *** 2028,2035 **** }; $open_tags_R = [ @keep_open_tags ]; ! $_; } ! # List of all filenames produced ny do_cmd_verbatiminput() %VerbatimFiles = (); @VerbatimOutputs = (); --- 2042,2049 ---- }; $open_tags_R = [ @keep_open_tags ]; ! return codetext($_); } ! # List of all filenames produced by do_cmd_verbatiminput() %VerbatimFiles = (); @VerbatimOutputs = ();