From nnorwitz@users.sourceforge.net Mon Apr 1 00:09:02 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Sun, 31 Mar 2002 16:09:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.152,2.153 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21852/Objects Modified Files: fileobject.c Log Message: Convert file.readinto() to stop using METH_OLDARGS & PyArg_Parse. Add test for file.readinto(). Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.152 retrieving revision 2.153 diff -C2 -d -r2.152 -r2.153 *** fileobject.c 23 Mar 2002 19:41:34 -0000 2.152 --- fileobject.c 1 Apr 2002 00:08:59 -0000 2.153 *************** *** 687,691 **** if (f->f_fp == NULL) return err_closed(); ! if (!PyArg_Parse(args, "w#", &ptr, &ntodo)) return NULL; ndone = 0; --- 687,691 ---- if (f->f_fp == NULL) return err_closed(); ! if (!PyArg_ParseTuple(args, "w#", &ptr, &ntodo)) return NULL; ndone = 0; *************** *** 1463,1467 **** #endif {"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc}, ! {"readinto", (PyCFunction)file_readinto, METH_OLDARGS, readinto_doc}, {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, {"xreadlines", (PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc}, --- 1463,1467 ---- #endif {"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc}, ! {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, {"xreadlines", (PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc}, From nnorwitz@users.sourceforge.net Mon Apr 1 00:09:02 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Sun, 31 Mar 2002 16:09:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_file.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21852/Lib/test Modified Files: test_file.py Log Message: Convert file.readinto() to stop using METH_OLDARGS & PyArg_Parse. Add test for file.readinto(). Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_file.py 1 Jan 2002 19:11:13 -0000 1.6 --- test_file.py 1 Apr 2002 00:09:00 -0000 1.7 *************** *** 1,3 **** --- 1,4 ---- import os + from array import array from test_support import verify, TESTFN *************** *** 14,17 **** --- 15,25 ---- verify(buf == '12') + # verify readinto + a = array('c', 'x'*10) + f = open(TESTFN, 'rb') + n = f.readinto(a) + f.close() + verify(buf == a.tostring()[:n]) + # verify writelines with integers f = open(TESTFN, 'wb') *************** *** 69,72 **** --- 77,87 ---- if f.closed: raise TestError, 'file.closed should be false' + + try: + f.readinto("") + except TypeError: + pass + else: + raise TestError, 'file.readinto("") should raise a TypeError' f.close() From tim_one@users.sourceforge.net Mon Apr 1 00:29:01 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 31 Mar 2002 16:29:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib difflib.py,1.6,1.7 tokenize.py,1.29,1.30 types.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27182/python/Lib Modified Files: difflib.py tokenize.py types.py Log Message: Remove some now-obsolete generator future statements. I left the email pkg alone; I'm not sure how Barry would like to handle that. Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** difflib.py 4 Oct 2001 05:36:56 -0000 1.6 --- difflib.py 1 Apr 2002 00:28:59 -0000 1.7 *************** *** 1,6 **** #! /usr/bin/env python - from __future__ import generators - """ Module difflib -- helpers for computing deltas between objects. --- 1,4 ---- Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tokenize.py 26 Mar 2002 16:20:26 -0000 1.29 --- tokenize.py 1 Apr 2002 00:28:59 -0000 1.30 *************** *** 23,28 **** each time a new token is found.""" - from __future__ import generators - __author__ = 'Ka-Ping Yee ' __credits__ = \ --- 23,26 ---- Index: types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/types.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** types.py 2 Dec 2001 12:08:06 -0000 1.25 --- types.py 1 Apr 2002 00:28:59 -0000 1.26 *************** *** 3,8 **** Types that are part of optional modules (e.g. array) are not listed. """ - from __future__ import generators - import sys --- 3,6 ---- *************** *** 84,86 **** DictProxyType = type(TypeType.__dict__) ! del sys, _f, _C, _x, generators # Not for export --- 82,84 ---- DictProxyType = type(TypeType.__dict__) ! del sys, _f, _C, _x # Not for export From tim_one@users.sourceforge.net Mon Apr 1 00:29:01 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 31 Mar 2002 16:29:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_generators.py,1.31,1.32 test_parser.py,1.10,1.11 test_profilehooks.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27182/python/Lib/test Modified Files: test_generators.py test_parser.py test_profilehooks.py Log Message: Remove some now-obsolete generator future statements. I left the email pkg alone; I'm not sure how Barry would like to handle that. Index: test_generators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_generators.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** test_generators.py 10 Mar 2002 07:59:13 -0000 1.31 --- test_generators.py 1 Apr 2002 00:28:59 -0000 1.32 *************** *** 1,4 **** - from __future__ import generators - tutorial_tests = """ Let's try a simple generator: --- 1,2 ---- Index: test_parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_parser.py 20 Sep 2001 21:33:42 -0000 1.10 --- test_parser.py 1 Apr 2002 00:28:59 -0000 1.11 *************** *** 28,39 **** def test_yield_statement(self): ! self.check_suite("from __future__ import generators\n" ! "def f(): yield 1") ! self.check_suite("from __future__ import generators\n" ! "def f(): return; yield 1") ! self.check_suite("from __future__ import generators\n" ! "def f(): yield 1; return") ! self.check_suite("from __future__ import generators\n" ! "def f():\n" " for x in range(30):\n" " yield x\n") --- 28,35 ---- def test_yield_statement(self): ! self.check_suite("def f(): yield 1") ! self.check_suite("def f(): return; yield 1") ! self.check_suite("def f(): yield 1; return") ! self.check_suite("def f():\n" " for x in range(30):\n" " yield x\n") Index: test_profilehooks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profilehooks.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_profilehooks.py 3 Mar 2002 15:11:17 -0000 1.7 --- test_profilehooks.py 1 Apr 2002 00:28:59 -0000 1.8 *************** *** 1,4 **** - from __future__ import generators - from test_support import TestFailed --- 1,2 ---- From nnorwitz@users.sourceforge.net Mon Apr 1 01:37:16 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Sun, 31 Mar 2002 17:37:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mpz.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7702/Lib/test Added Files: test_mpz.py Log Message: Get rid of all METH_OLDARGS & PyArg_Parse. Fix floating point exception if mpz.powm(10, 1, 0) (modulus == 0). Add a test. --- NEW FILE: test_mpz.py --- import mpz from test_support import vereq def check_conversion(num): mpz_num = mpz.mpz(num) vereq(int(mpz_num), num) vereq(long(mpz_num), num) vereq(str(mpz_num), 'mpz(%s)' % `int(num)`) check_conversion(10) check_conversion(10L) # FIXME: should check strings, but I'm not sure it works, this seems odd: # mpz.mpz('10') == mpz(12337) vereq(mpz.divm(100, 200, 3), 2) vereq(mpz.divm(100L, 200, 3), 2) vereq(mpz.divm(100, 200L, 3), 2) vereq(mpz.divm(100L, 200L, 3), 2) vereq(mpz.gcd(100, 200), 100) vereq(mpz.gcd(100L, 200), 100) vereq(mpz.gcd(100, 200L), 100) vereq(mpz.gcd(100L, 200L), 100) vereq(mpz.gcdext(100, 200), (100, 1, 0)) vereq(mpz.gcdext(100L, 200), (100, 1, 0)) vereq(mpz.gcdext(100, 200L), (100, 1, 0)) vereq(mpz.gcdext(100L, 200L), (100, 1, 0)) vereq(mpz.powm(100, 0, 3), 1) vereq(mpz.powm(100L, 0, 3), 1) vereq(mpz.powm(100, 0L, 3), 1) vereq(mpz.powm(100L, 0L, 3), 1) vereq(mpz.powm(101, 5, 3333), 1616) vereq(mpz.powm(101L, 5, 3333), 1616) vereq(mpz.powm(101, 5L, 3333), 1616) vereq(mpz.powm(101L, 5L, 3333), 1616) vereq(mpz.sqrt(100), 10) vereq(mpz.sqrt(100L), 10) vereq(mpz.sqrt(200), 14) vereq(mpz.sqrt(200L), 14) vereq(mpz.sqrtrem(100), (10, 0)) vereq(mpz.sqrtrem(100L), (10, 0)) vereq(mpz.sqrtrem(200), (14, 4)) vereq(mpz.sqrtrem(200L), (14, 4)) try: mpz.mpz(10.) except TypeError: pass else: raise TestFailed, 'mpz(10.) should raise a TypeError' try: mpz.powm(10.) except TypeError: pass else: raise TestFailed, 'powm(10.) should raise a TypeError' try: mpz.powm(100, 1, 0) except ValueError: pass else: raise TestFailed, 'powm(100, 1, 0) should raise a ValueError' try: mpz.divm(10, 10) except TypeError: pass else: raise TestFailed, 'divm(10, 10) should raise a TypeError' try: mpz.divm(10, 10, 10.) except TypeError: pass else: raise TestFailed, 'divm(10, 10, 10.) should raise a TypeError' try: mpz.gcd(10) except TypeError: pass else: raise TestFailed, 'gcd(10) should raise a TypeError' try: mpz.gcd(10, 10.) except TypeError: pass else: raise TestFailed, 'gcd(10, 10.) should raise a TypeError' try: mpz.gcdext(10) except TypeError: pass else: raise TestFailed, 'gcdext(10) should raise a TypeError' try: mpz.gcdext(10, 10.) except TypeError: pass else: raise TestFailed, 'gcdext(10, 10.) should raise a TypeError' try: mpz.mpz(-10).binary() except ValueError: pass else: raise TestFailed, 'mpz(-10).binary() should raise a ValueError' From nnorwitz@users.sourceforge.net Mon Apr 1 01:37:16 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Sun, 31 Mar 2002 17:37:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules mpzmodule.c,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7702/Modules Modified Files: mpzmodule.c Log Message: Get rid of all METH_OLDARGS & PyArg_Parse. Fix floating point exception if mpz.powm(10, 1, 0) (modulus == 0). Add a test. Index: mpzmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** mpzmodule.c 31 Mar 2002 22:02:37 -0000 2.42 --- mpzmodule.c 1 Apr 2002 01:37:14 -0000 2.43 *************** *** 836,840 **** { mpzobject *mpzp; - PyObject *objp; --- 836,839 ---- *************** *** 843,858 **** #endif /* def MPZ_DEBUG */ - if (!PyArg_Parse(args, "O", &objp)) - return NULL; - /* at least we know it's some object */ ! /* note DON't Py_DECREF args NEITHER objp */ ! ! if (PyInt_Check(objp)) { ! long lval; ! ! if (!PyArg_Parse(objp, "l", &lval)) ! return NULL; if (lval == (long)0) { Py_INCREF(mpz_value_zero); --- 842,850 ---- #endif /* def MPZ_DEBUG */ /* at least we know it's some object */ ! /* note DON't Py_DECREF args */ + if (PyInt_Check(args)) { + long lval = PyInt_AS_LONG(args); if (lval == (long)0) { Py_INCREF(mpz_value_zero); *************** *** 867,871 **** else mpz_set_si(&mpzp->mpz, lval); } ! else if (PyLong_Check(objp)) { MP_INT mplongdigit; int i; --- 859,863 ---- else mpz_set_si(&mpzp->mpz, lval); } ! else if (PyLong_Check(args)) { MP_INT mplongdigit; int i; *************** *** 881,885 **** /* how we're gonna handle this? */ if ((isnegative = ! ((i = ((PyLongObject *)objp)->ob_size) < 0) )) i = -i; --- 873,877 ---- /* how we're gonna handle this? */ if ((isnegative = ! ((i = ((PyLongObject *)args)->ob_size) < 0) )) i = -i; *************** *** 887,891 **** mpz_set_ui(&mplongdigit, (unsigned long) ! ((PyLongObject *)objp)->ob_digit[i]); mpz_mul_2exp(&mplongdigit,&mplongdigit, (unsigned long int)i * SHIFT); --- 879,883 ---- mpz_set_ui(&mplongdigit, (unsigned long) ! ((PyLongObject *)args)->ob_digit[i]); mpz_mul_2exp(&mplongdigit,&mplongdigit, (unsigned long int)i * SHIFT); *************** *** 899,905 **** mpz_clear(&mplongdigit); } ! else if (PyString_Check(objp)) { ! unsigned char *cp = (unsigned char *)PyString_AS_STRING(objp); ! int len = PyString_GET_SIZE(objp); MP_INT mplongdigit; --- 891,897 ---- mpz_clear(&mplongdigit); } ! else if (PyString_Check(args)) { ! unsigned char *cp = (unsigned char *)PyString_AS_STRING(args); ! int len = PyString_GET_SIZE(args); MP_INT mplongdigit; *************** *** 924,930 **** mpz_clear(&mplongdigit); } ! else if (is_mpzobject(objp)) { ! Py_INCREF(objp); ! mpzp = (mpzobject *)objp; } else { --- 916,922 ---- mpz_clear(&mplongdigit); } ! else if (is_mpzobject(args)) { ! Py_INCREF(args); ! mpzp = (mpzobject *)args; } else { *************** *** 974,978 **** ! if (!PyArg_Parse(args, "(OOO)", &base, &exp, &mod)) return NULL; --- 966,970 ---- ! if (!PyArg_ParseTuple(args, "OOO", &base, &exp, &mod)) return NULL; *************** *** 992,995 **** --- 984,995 ---- } + if (mpz_cmp_ui(&mpzmod->mpz, 0) == 0) { + Py_DECREF(mpzbase); + Py_DECREF(mpzexp); + Py_DECREF(mpzmod); + PyErr_SetString(PyExc_ValueError, "modulus cannot be 0"); + return NULL; + } + if (tstres < 0) { MP_INT absexp; *************** *** 1024,1028 **** ! if (!PyArg_Parse(args, "(OO)", &op1, &op2)) return NULL; --- 1024,1028 ---- ! if (!PyArg_ParseTuple(args, "OO", &op1, &op2)) return NULL; *************** *** 1053,1057 **** ! if (!PyArg_Parse(args, "(OO)", &op1, &op2)) return NULL; --- 1053,1057 ---- ! if (!PyArg_ParseTuple(args, "OO", &op1, &op2)) return NULL; *************** *** 1087,1099 **** MPZ_sqrt(PyObject *self, PyObject *args) { - PyObject *op; mpzobject *mpzop = NULL; mpzobject *z; ! if (!PyArg_Parse(args, "O", &op)) ! return NULL; ! ! if ((mpzop = mpz_mpzcoerce(op)) == NULL || (z = newmpzobject()) == NULL) { Py_XDECREF(mpzop); --- 1087,1095 ---- MPZ_sqrt(PyObject *self, PyObject *args) { mpzobject *mpzop = NULL; mpzobject *z; ! if ((mpzop = mpz_mpzcoerce(args)) == NULL || (z = newmpzobject()) == NULL) { Py_XDECREF(mpzop); *************** *** 1112,1124 **** MPZ_sqrtrem(PyObject *self, PyObject *args) { ! PyObject *op, *z = NULL; mpzobject *mpzop = NULL; mpzobject *root = NULL, *rem = NULL; ! ! if (!PyArg_Parse(args, "O", &op)) ! return NULL; ! ! if ((mpzop = mpz_mpzcoerce(op)) == NULL || (z = PyTuple_New(2)) == NULL || (root = newmpzobject()) == NULL --- 1108,1116 ---- MPZ_sqrtrem(PyObject *self, PyObject *args) { ! PyObject *z = NULL; mpzobject *mpzop = NULL; mpzobject *root = NULL, *rem = NULL; ! if ((mpzop = mpz_mpzcoerce(args)) == NULL || (z = PyTuple_New(2)) == NULL || (root = newmpzobject()) == NULL *************** *** 1213,1217 **** ! if (!PyArg_Parse(args, "(OOO)", &num, &den, &mod)) return NULL; --- 1205,1209 ---- ! if (!PyArg_ParseTuple(args, "OOO", &num, &den, &mod)) return NULL; *************** *** 1551,1565 **** static PyMethodDef mpz_functions[] = { #if 0 ! {initialiser_name, MPZ_mpz, METH_OLDARGS}, #else /* 0 */ /* until guido ``fixes'' struct PyMethodDef */ ! {(char *)initialiser_name, MPZ_mpz, METH_OLDARGS}, #endif /* 0 else */ ! {"powm", MPZ_powm, METH_OLDARGS}, ! {"gcd", MPZ_gcd, METH_OLDARGS}, ! {"gcdext", MPZ_gcdext, METH_OLDARGS}, ! {"sqrt", MPZ_sqrt, METH_OLDARGS}, ! {"sqrtrem", MPZ_sqrtrem, METH_OLDARGS}, ! {"divm", MPZ_divm, METH_OLDARGS}, {NULL, NULL} /* Sentinel */ }; --- 1543,1557 ---- static PyMethodDef mpz_functions[] = { #if 0 ! {initialiser_name, MPZ_mpz, METH_O}, #else /* 0 */ /* until guido ``fixes'' struct PyMethodDef */ ! {(char *)initialiser_name, MPZ_mpz, METH_O}, #endif /* 0 else */ ! {"powm", MPZ_powm, METH_VARARGS}, ! {"gcd", MPZ_gcd, METH_VARARGS}, ! {"gcdext", MPZ_gcdext, METH_VARARGS}, ! {"sqrt", MPZ_sqrt, METH_O}, ! {"sqrtrem", MPZ_sqrtrem, METH_O}, ! {"divm", MPZ_divm, METH_VARARGS}, {NULL, NULL} /* Sentinel */ }; From nnorwitz@users.sourceforge.net Mon Apr 1 01:41:22 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Sun, 31 Mar 2002 17:41:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.156,2.157 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8937/Python Modified Files: pythonrun.c Log Message: Get rid of another use of PyArg_Parse() Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.156 retrieving revision 2.157 diff -C2 -d -r2.156 -r2.157 *** pythonrun.c 22 Mar 2002 23:53:36 -0000 2.156 --- pythonrun.c 1 Apr 2002 01:41:20 -0000 2.157 *************** *** 737,742 **** /* old style errors */ if (PyTuple_Check(err)) ! return PyArg_Parse(err, "(O(ziiz))", message, filename, ! lineno, offset, text); /* new style errors. `err' is an instance */ --- 737,742 ---- /* old style errors */ if (PyTuple_Check(err)) ! return PyArg_ParseTuple(err, "O(ziiz)", message, filename, ! lineno, offset, text); /* new style errors. `err' is an instance */ From fdrake@users.sourceforge.net Mon Apr 1 03:45:09 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 31 Mar 2002 19:45:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules arraymodule.c,2.68,2.69 cmathmodule.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29107 Modified Files: arraymodule.c cmathmodule.c Log Message: Use the PyModule_*() API instead of manipulating the module dictionary directly. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** arraymodule.c 4 Mar 2002 09:38:52 -0000 2.68 --- arraymodule.c 1 Apr 2002 03:45:06 -0000 2.69 *************** *** 1732,1742 **** initarray(void) { ! PyObject *m, *d; Arraytype.ob_type = &PyType_Type; m = Py_InitModule3("array", a_methods, module_doc); ! d = PyModule_GetDict(m); ! PyDict_SetItemString(d, "ArrayType", (PyObject *)&Arraytype); ! PyDict_SetItemString(d, "array", (PyObject *)&Arraytype); /* No need to check the error here, the caller will do that */ } --- 1732,1744 ---- initarray(void) { ! PyObject *m; Arraytype.ob_type = &PyType_Type; m = Py_InitModule3("array", a_methods, module_doc); ! ! Py_INCREF((PyObject *)&Arraytype); ! PyModule_AddObject(m, "ArrayType", (PyObject *)&Arraytype); ! Py_INCREF((PyObject *)&Arraytype); ! PyModule_AddObject(m, "array", (PyObject *)&Arraytype); /* No need to check the error here, the caller will do that */ } Index: cmathmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cmathmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** cmathmodule.c 9 Mar 2002 04:58:24 -0000 2.28 --- cmathmodule.c 1 Apr 2002 03:45:06 -0000 2.29 *************** *** 395,406 **** initcmath(void) { ! PyObject *m, *d, *v; m = Py_InitModule3("cmath", cmath_methods, module_doc); ! d = PyModule_GetDict(m); ! PyDict_SetItemString(d, "pi", ! v = PyFloat_FromDouble(atan(1.0) * 4.0)); ! Py_DECREF(v); ! PyDict_SetItemString(d, "e", v = PyFloat_FromDouble(exp(1.0))); ! Py_DECREF(v); } --- 395,404 ---- initcmath(void) { ! PyObject *m; m = Py_InitModule3("cmath", cmath_methods, module_doc); ! ! PyModule_AddObject(m, "pi", ! PyFloat_FromDouble(atan(1.0) * 4.0)); ! PyModule_AddObject(m, "e", PyFloat_FromDouble(exp(1.0))); } From tim_one@users.sourceforge.net Mon Apr 1 05:04:48 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 31 Mar 2002 21:04:48 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10639/python/Lib/test Modified Files: regrtest.py Log Message: We expect to skip the new test_mpz on Windows. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** regrtest.py 15 Mar 2002 02:54:03 -0000 1.72 --- regrtest.py 1 Apr 2002 05:04:46 -0000 1.73 *************** *** 467,470 **** --- 467,473 ---- return data + # Map sys.platform to a string containing the basenames of tests + # expected to be skipped on that platform. + _expectations = { 'win32': *************** *** 487,490 **** --- 490,494 ---- test_linuxaudiodev test_mhlib + test_mpz test_nis test_openpty *************** *** 678,682 **** def __init__(self): self.valid = 0 ! if _expectations.has_key(sys.platform): s = _expectations[sys.platform] self.expected = _Set(s.split()) --- 682,686 ---- def __init__(self): self.valid = 0 ! if sys.platform in _expectations: s = _expectations[sys.platform] self.expected = _Set(s.split()) From tim_one@users.sourceforge.net Mon Apr 1 06:04:23 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 31 Mar 2002 22:04:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include pymem.h,2.10,2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv19323/python/Include Modified Files: pymem.h Log Message: New PYMALLOC_DEBUG function void _PyMalloc_DebugDumpStats(void). This displays stats about the # of arenas, pools, blocks and bytes, to stderr, both used and reserved but unused. CAUTION: Because PYMALLOC_DEBUG is on, the debug malloc routine adds 16 bytes to each request. This makes each block appear two size classes higher than it would be if PYMALLOC_DEBUG weren't on. So far, playing with this confirms the obvious: there's a lot of activity in the "small dict" size class, but nothing in the core makes any use of the 8-byte or 16-byte classes. Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** pymem.h 28 Mar 2002 07:32:11 -0000 2.10 --- pymem.h 1 Apr 2002 06:04:21 -0000 2.11 *************** *** 103,106 **** --- 103,107 ---- DL_IMPORT(void) _PyMalloc_DebugDumpAddress(const void *p); DL_IMPORT(void) _PyMalloc_DebugCheckAddress(const void *p); + DL_IMPORT(void) _PyMalloc_DebugDumpStats(void); #define _PyMalloc_MALLOC _PyMalloc_DebugMalloc #define _PyMalloc_REALLOC _PyMalloc_DebugRealloc From tim_one@users.sourceforge.net Mon Apr 1 06:04:23 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 31 Mar 2002 22:04:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19323/python/Objects Modified Files: obmalloc.c Log Message: New PYMALLOC_DEBUG function void _PyMalloc_DebugDumpStats(void). This displays stats about the # of arenas, pools, blocks and bytes, to stderr, both used and reserved but unused. CAUTION: Because PYMALLOC_DEBUG is on, the debug malloc routine adds 16 bytes to each request. This makes each block appear two size classes higher than it would be if PYMALLOC_DEBUG weren't on. So far, playing with this confirms the obvious: there's a lot of activity in the "small dict" size class, but nothing in the core makes any use of the 8-byte or 16-byte classes. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** obmalloc.c 31 Mar 2002 02:59:48 -0000 2.24 --- obmalloc.c 1 Apr 2002 06:04:21 -0000 2.25 *************** *** 1027,1031 **** } ! void _PyMalloc_DebugCheckAddress(const void *p) { --- 1027,1035 ---- } ! /* Check the forbidden bytes on both ends of the memory allocated for p. ! * If anything is wrong, print info to stderr via _PyMalloc_DebugDumpAddress, ! * and call Py_FatalError to kill the program. ! */ ! void _PyMalloc_DebugCheckAddress(const void *p) { *************** *** 1064,1067 **** --- 1068,1072 ---- } + /* Display info to stderr about the memory block at p. */ void _PyMalloc_DebugDumpAddress(const void *p) *************** *** 1148,1151 **** --- 1153,1247 ---- fputc('\n', stderr); } + } + + /* Print summary info to stderr about the state of pymalloc's structures. */ + void + _PyMalloc_DebugDumpStats(void) + { + uint i; + const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT; + uint numfreepools = 0; + /* # of pools per class index */ + ulong numpools[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; + /* # of allocated blocks per class index */ + ulong numblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; + /* # of free blocks per class index */ + ulong numfreeblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; + ulong grandtotal; /* total # of allocated bytes */ + ulong freegrandtotal; /* total # of available bytes in used blocks */ + + fprintf(stderr, "%u arenas * %d bytes/arena = %lu total bytes.\n", + narenas, ARENA_SIZE, narenas * (ulong)ARENA_SIZE); + fprintf(stderr, "Small block threshold = %d, in %u size classes.\n", + SMALL_REQUEST_THRESHOLD, numclasses); + fprintf(stderr, "pymalloc malloc+realloc called %lu times.\n", + serialno); + + for (i = 0; i < numclasses; ++i) + numpools[i] = numblocks[i] = numfreeblocks[i] = 0; + + /* Because empty pools aren't linked to from anything, it's easiest + * to march over all the arenas. + */ + for (i = 0; i < narenas; ++i) { + uint poolsinarena; + uint j; + uptr base = arenas[i]; + + /* round up to pool alignment */ + poolsinarena = ARENA_SIZE / POOL_SIZE; + if (base & (uptr)POOL_SIZE_MASK) { + --poolsinarena; + base &= ~(uptr)POOL_SIZE_MASK; + base += POOL_SIZE; + } + + if (i == narenas - 1) { + /* current arena may have raw memory at the end */ + numfreepools += nfreepools; + poolsinarena -= nfreepools; + } + + /* visit every pool in the arena */ + for (j = 0; j < poolsinarena; ++j, base += POOL_SIZE) { + poolp p = (poolp)base; + if (p->ref.count == 0) { + /* currently unused */ + ++numfreepools; + continue; + } + ++numpools[p->szidx]; + numblocks[p->szidx] += p->ref.count; + numfreeblocks[p->szidx] += p->capacity - p->ref.count; + } + } + + fputc('\n', stderr); + fprintf(stderr, "Number of unused pools: %u\n", numfreepools); + fputc('\n', stderr); + fputs("class num bytes num pools blocks in use avail blocks\n" + "----- --------- --------- ------------- ------------\n", + stderr); + + grandtotal = freegrandtotal = 0; + for (i = 0; i < numclasses; ++i) { + ulong p = numpools[i]; + ulong b = numblocks[i]; + ulong f = numfreeblocks[i]; + uint size = (i+1) << ALIGNMENT_SHIFT; + if (p == 0) { + assert(b == 0 && f == 0); + continue; + } + fprintf(stderr, "%5u %11u %11lu %15lu %13lu\n", + i, size, p, b, f); + grandtotal += b * size; + freegrandtotal += f * size; + } + fputc('\n', stderr); + fprintf(stderr, "Total bytes in allocated blocks: %lu\n", + grandtotal); + fprintf(stderr, "Total free bytes in used pools: %lu\n", + freegrandtotal); } From loewis@users.sourceforge.net Mon Apr 1 12:34:36 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Mon, 01 Apr 2002 04:34:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.76,2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv28762 Modified Files: cPickle.c Log Message: Remove UNLESS. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -d -r2.76 -r2.77 *** cPickle.c 31 Mar 2002 14:44:22 -0000 2.76 --- cPickle.c 1 Apr 2002 12:34:33 -0000 2.77 *************** *** 64,68 **** #include ! #define UNLESS(E) if (!(E)) #define DEL_LIST_SLICE(list, from, to) (PyList_SetSlice(list, from, to, NULL)) --- 64,68 ---- #include ! [...1519 lines suppressed...] Py_DECREF(t); ! if (!( UnpicklingError = PyErr_NewException("cPickle.UnpicklingError", ! PickleError, NULL))) return -1; *************** *** 4651,4655 **** return -1; ! UNLESS (BadPickleGet = PyString_FromString("cPickle.BadPickleGet")) return -1; --- 4651,4655 ---- return -1; ! if (!( BadPickleGet = PyString_FromString("cPickle.BadPickleGet"))) return -1; From fdrake@users.sourceforge.net Mon Apr 1 14:29:00 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 06:29:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _testcapimodule.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29675 Modified Files: _testcapimodule.c Log Message: Switch to using METH_NOARGS where possible. Convert to use PyModule_*() instead of manipulating the module dict directly. Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** _testcapimodule.c 9 Jan 2002 16:21:27 -0000 1.15 --- _testcapimodule.c 1 Apr 2002 14:28:58 -0000 1.16 *************** *** 45,53 **** static PyObject* ! test_config(PyObject *self, PyObject *args) { - if (!PyArg_ParseTuple(args, ":test_config")) - return NULL; - #define CHECK_SIZEOF(FATNAME, TYPE) \ if (FATNAME != sizeof(TYPE)) \ --- 45,50 ---- static PyObject* ! test_config(PyObject *self) { #define CHECK_SIZEOF(FATNAME, TYPE) \ if (FATNAME != sizeof(TYPE)) \ *************** *** 70,79 **** static PyObject* ! test_list_api(PyObject *self, PyObject *args) { PyObject* list; int i; - if (!PyArg_ParseTuple(args, ":test_list_api")) - return NULL; /* SF bug 132008: PyList_Reverse segfaults */ --- 67,74 ---- static PyObject* ! test_list_api(PyObject *self) { PyObject* list; int i; /* SF bug 132008: PyList_Reverse segfaults */ *************** *** 158,168 **** static PyObject* ! test_dict_iteration(PyObject* self, PyObject* args) { int i; - if (!PyArg_ParseTuple(args, ":test_dict_iteration")) - return NULL; - for (i = 0; i < 200; i++) { if (test_dict_inner(i) < 0) { --- 153,160 ---- static PyObject* ! test_dict_iteration(PyObject* self) { int i; for (i = 0; i < 200; i++) { if (test_dict_inner(i) < 0) { *************** *** 209,217 **** static PyObject * ! test_long_api(PyObject* self, PyObject* args) { - if (!PyArg_ParseTuple(args, ":test_long_api")) - return NULL; - return TESTNAME(raise_test_long_error); } --- 201,206 ---- static PyObject * ! test_long_api(PyObject* self) { return TESTNAME(raise_test_long_error); } *************** *** 242,250 **** static PyObject * ! test_longlong_api(PyObject* self, PyObject* args) { - if (!PyArg_ParseTuple(args, ":test_longlong_api")) - return NULL; - return TESTNAME(raise_test_longlong_error); } --- 231,236 ---- static PyObject * ! test_longlong_api(PyObject* self) { return TESTNAME(raise_test_longlong_error); } *************** *** 262,273 **** */ static PyObject * ! test_L_code(PyObject *self, PyObject *args) { PyObject *tuple, *num; LONG_LONG value; - if (!PyArg_ParseTuple(args, ":test_L_code")) - return NULL; - tuple = PyTuple_New(1); if (tuple == NULL) --- 248,256 ---- */ static PyObject * ! test_L_code(PyObject *self) { PyObject *tuple, *num; LONG_LONG value; tuple = PyTuple_New(1); if (tuple == NULL) *************** *** 314,318 **** */ static PyObject * ! test_u_code(PyObject *self, PyObject *args) { PyObject *tuple, *obj; --- 297,301 ---- */ static PyObject * ! test_u_code(PyObject *self) { PyObject *tuple, *obj; *************** *** 320,326 **** int len; - if (!PyArg_ParseTuple(args, ":test_u_code")) - return NULL; - tuple = PyTuple_New(1); if (tuple == NULL) --- 303,306 ---- *************** *** 382,396 **** static PyMethodDef TestMethods[] = { ! {"raise_exception", raise_exception, METH_VARARGS}, ! {"test_config", test_config, METH_VARARGS}, ! {"test_list_api", test_list_api, METH_VARARGS}, ! {"test_dict_iteration", test_dict_iteration, METH_VARARGS}, ! {"test_long_api", test_long_api, METH_VARARGS}, #ifdef HAVE_LONG_LONG ! {"test_longlong_api", test_longlong_api, METH_VARARGS}, ! {"test_L_code", test_L_code, METH_VARARGS}, #endif #ifdef Py_USING_UNICODE ! {"test_u_code", test_u_code, METH_VARARGS}, #endif {NULL, NULL} /* sentinel */ --- 362,376 ---- static PyMethodDef TestMethods[] = { ! {"raise_exception", raise_exception, METH_VARARGS}, ! {"test_config", (PyCFunction)test_config, METH_NOARGS}, ! {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, ! {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, ! {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, #ifdef HAVE_LONG_LONG ! {"test_longlong_api", (PyCFunction)test_longlong_api, METH_NOARGS}, ! {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS}, #endif #ifdef Py_USING_UNICODE ! {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, #endif {NULL, NULL} /* sentinel */ *************** *** 400,409 **** init_testcapi(void) { ! PyObject *m, *d; m = Py_InitModule("_testcapi", TestMethods); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); ! d = PyModule_GetDict(m); ! PyDict_SetItemString(d, "error", TestError); } --- 380,389 ---- init_testcapi(void) { ! PyObject *m; m = Py_InitModule("_testcapi", TestMethods); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); ! Py_INCREF(TestError); ! PyModule_AddObject(m, "error", TestError); } From fdrake@users.sourceforge.net Mon Apr 1 14:30:52 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 06:30:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules shamodule.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30022 Modified Files: shamodule.c Log Message: Remove unused variable and call to PyModule_GetDict(). Index: shamodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/shamodule.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** shamodule.c 8 Dec 2001 18:02:58 -0000 2.17 --- shamodule.c 1 Apr 2002 14:30:50 -0000 2.18 *************** *** 530,534 **** initsha(void) { ! PyObject *d, *m; SHAtype.ob_type = &PyType_Type; --- 530,534 ---- initsha(void) { ! PyObject *m; SHAtype.ob_type = &PyType_Type; *************** *** 536,540 **** /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); insint("blocksize", 1); /* For future use, in case some hash functions require an integral number of --- 536,539 ---- From fdrake@users.sourceforge.net Mon Apr 1 14:53:39 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 06:53:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules selectmodule.c,2.61,2.62 socketmodule.c,1.212,1.213 stropmodule.c,2.85,2.86 syslogmodule.c,2.17,2.18 zlibmodule.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2476 Modified Files: selectmodule.c socketmodule.c stropmodule.c syslogmodule.c zlibmodule.c Log Message: Use the PyModule_Add*() APIs instead of manipulating the module dict directly. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** selectmodule.c 3 Mar 2002 02:59:16 -0000 2.61 --- selectmodule.c 1 Apr 2002 14:53:37 -0000 2.62 *************** *** 658,689 **** initselect(void) { ! PyObject *m, *d; m = Py_InitModule3("select", select_methods, module_doc); ! d = PyModule_GetDict(m); SelectError = PyErr_NewException("select.error", NULL, NULL); ! PyDict_SetItemString(d, "error", SelectError); #ifdef HAVE_POLL poll_Type.ob_type = &PyType_Type; ! insint(d, "POLLIN", POLLIN); ! insint(d, "POLLPRI", POLLPRI); ! insint(d, "POLLOUT", POLLOUT); ! insint(d, "POLLERR", POLLERR); ! insint(d, "POLLHUP", POLLHUP); ! insint(d, "POLLNVAL", POLLNVAL); #ifdef POLLRDNORM ! insint(d, "POLLRDNORM", POLLRDNORM); #endif #ifdef POLLRDBAND ! insint(d, "POLLRDBAND", POLLRDBAND); #endif #ifdef POLLWRNORM ! insint(d, "POLLWRNORM", POLLWRNORM); #endif #ifdef POLLWRBAND ! insint(d, "POLLWRBAND", POLLWRBAND); #endif #ifdef POLLMSG ! insint(d, "POLLMSG", POLLMSG); #endif #endif /* HAVE_POLL */ --- 658,690 ---- initselect(void) { ! PyObject *m; m = Py_InitModule3("select", select_methods, module_doc); ! SelectError = PyErr_NewException("select.error", NULL, NULL); ! Py_INCREF(SelectError); ! PyModule_AddObject(m, "error", SelectError); #ifdef HAVE_POLL poll_Type.ob_type = &PyType_Type; ! PyModule_AddIntConstant(m, "POLLIN", POLLIN); ! PyModule_AddIntConstant(m, "POLLPRI", POLLPRI); ! PyModule_AddIntConstant(m, "POLLOUT", POLLOUT); ! PyModule_AddIntConstant(m, "POLLERR", POLLERR); ! PyModule_AddIntConstant(m, "POLLHUP", POLLHUP); ! PyModule_AddIntConstant(m, "POLLNVAL", POLLNVAL); #ifdef POLLRDNORM ! PyModule_AddIntConstant(m, "POLLRDNORM", POLLRDNORM); #endif #ifdef POLLRDBAND ! PyModule_AddIntConstant(m, "POLLRDBAND", POLLRDBAND); #endif #ifdef POLLWRNORM ! PyModule_AddIntConstant(m, "POLLWRNORM", POLLWRNORM); #endif #ifdef POLLWRBAND ! PyModule_AddIntConstant(m, "POLLWRBAND", POLLWRBAND); #endif #ifdef POLLMSG ! PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); #endif #endif /* HAVE_POLL */ Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** socketmodule.c 25 Mar 2002 22:23:53 -0000 1.212 --- socketmodule.c 1 Apr 2002 14:53:37 -0000 1.213 *************** *** 2695,2699 **** init_socket(void) { ! PyObject *m, *d; #ifdef RISCOS _kernel_swi_regs r; --- 2695,2699 ---- init_socket(void) { ! PyObject *m; #ifdef RISCOS [...1172 lines suppressed...] #endif #ifdef NI_MAXSERV ! PyModule_AddIntConstant(m, "NI_MAXSERV", NI_MAXSERV); #endif #ifdef NI_NOFQDN ! PyModule_AddIntConstant(m, "NI_NOFQDN", NI_NOFQDN); #endif #ifdef NI_NUMERICHOST ! PyModule_AddIntConstant(m, "NI_NUMERICHOST", NI_NUMERICHOST); #endif #ifdef NI_NAMEREQD ! PyModule_AddIntConstant(m, "NI_NAMEREQD", NI_NAMEREQD); #endif #ifdef NI_NUMERICSERV ! PyModule_AddIntConstant(m, "NI_NUMERICSERV", NI_NUMERICSERV); #endif #ifdef NI_DGRAM ! PyModule_AddIntConstant(m, "NI_DGRAM", NI_DGRAM); #endif Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -d -r2.85 -r2.86 *** stropmodule.c 20 Mar 2002 21:32:07 -0000 2.85 --- stropmodule.c 1 Apr 2002 14:53:37 -0000 2.86 *************** *** 1216,1225 **** initstrop(void) { ! PyObject *m, *d, *s; char buf[256]; int c, n; m = Py_InitModule4("strop", strop_methods, strop_module__doc__, (PyObject*)NULL, PYTHON_API_VERSION); - d = PyModule_GetDict(m); /* Create 'whitespace' object */ --- 1216,1224 ---- initstrop(void) { ! PyObject *m, *s; char buf[256]; int c, n; m = Py_InitModule4("strop", strop_methods, strop_module__doc__, (PyObject*)NULL, PYTHON_API_VERSION); /* Create 'whitespace' object */ *************** *** 1230,1237 **** } s = PyString_FromStringAndSize(buf, n); ! if (s) { ! PyDict_SetItemString(d, "whitespace", s); ! Py_DECREF(s); ! } /* Create 'lowercase' object */ n = 0; --- 1229,1235 ---- } s = PyString_FromStringAndSize(buf, n); ! if (s) ! PyModule_AddObject(m, "whitespace", s); ! /* Create 'lowercase' object */ n = 0; *************** *** 1241,1248 **** } s = PyString_FromStringAndSize(buf, n); ! if (s) { ! PyDict_SetItemString(d, "lowercase", s); ! Py_DECREF(s); ! } /* Create 'uppercase' object */ --- 1239,1244 ---- } s = PyString_FromStringAndSize(buf, n); ! if (s) ! PyModule_AddObject(m, "lowercase", s); /* Create 'uppercase' object */ *************** *** 1253,1259 **** } s = PyString_FromStringAndSize(buf, n); ! if (s) { ! PyDict_SetItemString(d, "uppercase", s); ! Py_DECREF(s); ! } } --- 1249,1253 ---- } s = PyString_FromStringAndSize(buf, n); ! if (s) ! PyModule_AddObject(m, "uppercase", s); } Index: syslogmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/syslogmodule.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** syslogmodule.c 1 Sep 2000 09:01:32 -0000 2.17 --- syslogmodule.c 1 Apr 2002 14:53:37 -0000 2.18 *************** *** 154,169 **** }; - /* helper function for initialization function */ - - static void - ins(PyObject *d, char *s, long x) - { - PyObject *v = PyInt_FromLong(x); - if (v) { - PyDict_SetItemString(d, s, v); - Py_DECREF(v); - } - } - /* Initialization function for the module */ --- 154,157 ---- *************** *** 171,175 **** initsyslog(void) { ! PyObject *m, *d; /* Create the module and add the functions */ --- 159,163 ---- initsyslog(void) { ! PyObject *m; /* Create the module and add the functions */ *************** *** 177,218 **** /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); /* Priorities */ ! ins(d, "LOG_EMERG", LOG_EMERG); ! ins(d, "LOG_ALERT", LOG_ALERT); ! ins(d, "LOG_CRIT", LOG_CRIT); ! ins(d, "LOG_ERR", LOG_ERR); ! ins(d, "LOG_WARNING", LOG_WARNING); ! ins(d, "LOG_NOTICE", LOG_NOTICE); ! ins(d, "LOG_INFO", LOG_INFO); ! ins(d, "LOG_DEBUG", LOG_DEBUG); /* openlog() option flags */ ! ins(d, "LOG_PID", LOG_PID); ! ins(d, "LOG_CONS", LOG_CONS); ! ins(d, "LOG_NDELAY", LOG_NDELAY); #ifdef LOG_NOWAIT ! ins(d, "LOG_NOWAIT", LOG_NOWAIT); #endif #ifdef LOG_PERROR ! ins(d, "LOG_PERROR", LOG_PERROR); #endif /* Facilities */ ! ins(d, "LOG_KERN", LOG_KERN); ! ins(d, "LOG_USER", LOG_USER); ! ins(d, "LOG_MAIL", LOG_MAIL); ! ins(d, "LOG_DAEMON", LOG_DAEMON); ! ins(d, "LOG_AUTH", LOG_AUTH); ! ins(d, "LOG_LPR", LOG_LPR); ! ins(d, "LOG_LOCAL0", LOG_LOCAL0); ! ins(d, "LOG_LOCAL1", LOG_LOCAL1); ! ins(d, "LOG_LOCAL2", LOG_LOCAL2); ! ins(d, "LOG_LOCAL3", LOG_LOCAL3); ! ins(d, "LOG_LOCAL4", LOG_LOCAL4); ! ins(d, "LOG_LOCAL5", LOG_LOCAL5); ! ins(d, "LOG_LOCAL6", LOG_LOCAL6); ! ins(d, "LOG_LOCAL7", LOG_LOCAL7); #ifndef LOG_SYSLOG --- 165,205 ---- /* Add some symbolic constants to the module */ /* Priorities */ ! PyModule_AddIntConstant(m, "LOG_EMERG", LOG_EMERG); ! PyModule_AddIntConstant(m, "LOG_ALERT", LOG_ALERT); ! PyModule_AddIntConstant(m, "LOG_CRIT", LOG_CRIT); ! PyModule_AddIntConstant(m, "LOG_ERR", LOG_ERR); ! PyModule_AddIntConstant(m, "LOG_WARNING", LOG_WARNING); ! PyModule_AddIntConstant(m, "LOG_NOTICE", LOG_NOTICE); ! PyModule_AddIntConstant(m, "LOG_INFO", LOG_INFO); ! PyModule_AddIntConstant(m, "LOG_DEBUG", LOG_DEBUG); /* openlog() option flags */ ! PyModule_AddIntConstant(m, "LOG_PID", LOG_PID); ! PyModule_AddIntConstant(m, "LOG_CONS", LOG_CONS); ! PyModule_AddIntConstant(m, "LOG_NDELAY", LOG_NDELAY); #ifdef LOG_NOWAIT ! PyModule_AddIntConstant(m, "LOG_NOWAIT", LOG_NOWAIT); #endif #ifdef LOG_PERROR ! PyModule_AddIntConstant(m, "LOG_PERROR", LOG_PERROR); #endif /* Facilities */ ! PyModule_AddIntConstant(m, "LOG_KERN", LOG_KERN); ! PyModule_AddIntConstant(m, "LOG_USER", LOG_USER); ! PyModule_AddIntConstant(m, "LOG_MAIL", LOG_MAIL); ! PyModule_AddIntConstant(m, "LOG_DAEMON", LOG_DAEMON); ! PyModule_AddIntConstant(m, "LOG_AUTH", LOG_AUTH); ! PyModule_AddIntConstant(m, "LOG_LPR", LOG_LPR); ! PyModule_AddIntConstant(m, "LOG_LOCAL0", LOG_LOCAL0); ! PyModule_AddIntConstant(m, "LOG_LOCAL1", LOG_LOCAL1); ! PyModule_AddIntConstant(m, "LOG_LOCAL2", LOG_LOCAL2); ! PyModule_AddIntConstant(m, "LOG_LOCAL3", LOG_LOCAL3); ! PyModule_AddIntConstant(m, "LOG_LOCAL4", LOG_LOCAL4); ! PyModule_AddIntConstant(m, "LOG_LOCAL5", LOG_LOCAL5); ! PyModule_AddIntConstant(m, "LOG_LOCAL6", LOG_LOCAL6); ! PyModule_AddIntConstant(m, "LOG_LOCAL7", LOG_LOCAL7); #ifndef LOG_SYSLOG *************** *** 229,235 **** #endif ! ins(d, "LOG_SYSLOG", LOG_SYSLOG); ! ins(d, "LOG_CRON", LOG_CRON); ! ins(d, "LOG_UUCP", LOG_UUCP); ! ins(d, "LOG_NEWS", LOG_NEWS); } --- 216,222 ---- #endif ! PyModule_AddIntConstant(m, "LOG_SYSLOG", LOG_SYSLOG); ! PyModule_AddIntConstant(m, "LOG_CRON", LOG_CRON); ! PyModule_AddIntConstant(m, "LOG_UUCP", LOG_UUCP); ! PyModule_AddIntConstant(m, "LOG_NEWS", LOG_NEWS); } Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** zlibmodule.c 11 Mar 2002 09:20:47 -0000 2.58 --- zlibmodule.c 1 Apr 2002 14:53:37 -0000 2.59 *************** *** 848,852 **** PyInit_zlib(void) { ! PyObject *m, *d, *ver; Comptype.ob_type = &PyType_Type; Decomptype.ob_type = &PyType_Type; --- 848,852 ---- PyInit_zlib(void) { ! PyObject *m, *ver; Comptype.ob_type = &PyType_Type; Decomptype.ob_type = &PyType_Type; *************** *** 854,862 **** zlib_module_documentation, (PyObject*)NULL,PYTHON_API_VERSION); - d = PyModule_GetDict(m); - ZlibError = PyErr_NewException("zlib.error", NULL, NULL); - if (ZlibError != NULL) - PyDict_SetItemString(d, "error", ZlibError); PyModule_AddIntConstant(m, "MAX_WBITS", MAX_WBITS); PyModule_AddIntConstant(m, "DEFLATED", DEFLATED); --- 854,863 ---- zlib_module_documentation, (PyObject*)NULL,PYTHON_API_VERSION); + ZlibError = PyErr_NewException("zlib.error", NULL, NULL); + if (ZlibError != NULL) { + Py_INCREF(ZlibError); + PyModule_AddObject(m, "error", ZlibError); + } PyModule_AddIntConstant(m, "MAX_WBITS", MAX_WBITS); PyModule_AddIntConstant(m, "DEFLATED", DEFLATED); *************** *** 875,882 **** ver = PyString_FromString(ZLIB_VERSION); ! if (ver != NULL) { ! PyDict_SetItemString(d, "ZLIB_VERSION", ver); ! Py_DECREF(ver); ! } #ifdef WITH_THREAD --- 876,881 ---- ver = PyString_FromString(ZLIB_VERSION); ! if (ver != NULL) ! PyModule_AddObject(m, "ZLIB_VERSION", ver); #ifdef WITH_THREAD From fdrake@users.sourceforge.net Mon Apr 1 14:50:02 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 06:50:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.124,2.125 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1455 Modified Files: timemodule.c Log Message: Remove all but one use of the module dict. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -d -r2.124 -r2.125 *** timemodule.c 12 Mar 2002 21:38:49 -0000 2.124 --- timemodule.c 1 Apr 2002 14:49:59 -0000 2.125 *************** *** 561,575 **** }; - static void - ins(PyObject *d, char *name, PyObject *v) - { - /* Don't worry too much about errors, they'll be caught by the - * caller of inittime(). - */ - if (v) - PyDict_SetItemString(d, name, v); - Py_XDECREF(v); - } - static char module_doc[] = --- 561,564 ---- *************** *** 622,653 **** inittime(void) { ! PyObject *m, *d; char *p; m = Py_InitModule3("time", time_methods, module_doc); ! d = PyModule_GetDict(m); /* Accept 2-digit dates unless PYTHONY2K is set and non-empty */ p = Py_GETENV("PYTHONY2K"); ! ins(d, "accept2dyear", PyInt_FromLong((long) (!p || !*p))); /* Squirrel away the module's dictionary for the y2k check */ ! Py_INCREF(d); ! moddict = d; #if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) tzset(); #ifdef PYOS_OS2 ! ins(d, "timezone", PyInt_FromLong((long)_timezone)); #else /* !PYOS_OS2 */ ! ins(d, "timezone", PyInt_FromLong((long)timezone)); #endif /* PYOS_OS2 */ #ifdef HAVE_ALTZONE ! ins(d, "altzone", PyInt_FromLong((long)altzone)); #else #ifdef PYOS_OS2 ! ins(d, "altzone", PyInt_FromLong((long)_timezone-3600)); #else /* !PYOS_OS2 */ ! ins(d, "altzone", PyInt_FromLong((long)timezone-3600)); #endif /* PYOS_OS2 */ #endif ! ins(d, "daylight", PyInt_FromLong((long)daylight)); ! ins(d, "tzname", Py_BuildValue("(zz)", tzname[0], tzname[1])); #else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ #ifdef HAVE_TM_ZONE --- 611,643 ---- inittime(void) { ! PyObject *m; char *p; m = Py_InitModule3("time", time_methods, module_doc); ! /* Accept 2-digit dates unless PYTHONY2K is set and non-empty */ p = Py_GETENV("PYTHONY2K"); ! PyModule_AddIntConstant(m, "accept2dyear", (long) (!p || !*p)); /* Squirrel away the module's dictionary for the y2k check */ ! moddict = PyModule_GetDict(m); ! Py_INCREF(moddict); #if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) tzset(); #ifdef PYOS_OS2 ! PyModule_AddIntConstant(m, "timezone", _timezone); #else /* !PYOS_OS2 */ ! PyModule_AddIntConstant(m, "timezone", timezone); #endif /* PYOS_OS2 */ #ifdef HAVE_ALTZONE ! PyModule_AddIntConstant(m, "altzone", altzone); #else #ifdef PYOS_OS2 ! PyModule_AddIntConstant(m, "altzone", _timezone-3600); #else /* !PYOS_OS2 */ ! PyModule_AddIntConstant(m, "altzone", timezone-3600); #endif /* PYOS_OS2 */ #endif ! PyModule_AddIntConstant(m, "daylight", daylight); ! PyModule_AddObject(m, "tzname", ! Py_BuildValue("(zz)", tzname[0], tzname[1])); #else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ #ifdef HAVE_TM_ZONE *************** *** 671,687 **** if( janzone < julyzone ) { /* DST is reversed in the southern hemisphere */ ! ins(d, "timezone", PyInt_FromLong(julyzone)); ! ins(d, "altzone", PyInt_FromLong(janzone)); ! ins(d, "daylight", ! PyInt_FromLong((long)(janzone != julyzone))); ! ins(d, "tzname", ! Py_BuildValue("(zz)", julyname, janname)); } else { ! ins(d, "timezone", PyInt_FromLong(janzone)); ! ins(d, "altzone", PyInt_FromLong(julyzone)); ! ins(d, "daylight", ! PyInt_FromLong((long)(janzone != julyzone))); ! ins(d, "tzname", ! Py_BuildValue("(zz)", janname, julyname)); } } --- 661,679 ---- if( janzone < julyzone ) { /* DST is reversed in the southern hemisphere */ ! PyModule_AddIntConstant(m, "timezone", julyzone); ! PyModule_AddIntConstant(m, "altzone", janzone); ! PyModule_AddIntConstant(m, "daylight", ! janzone != julyzone); ! PyModule_AddObject(m, "tzname", ! Py_BuildValue("(zz)", ! julyname, janname)); } else { ! PyModule_AddIntConstant(m, "timezone", janzone); ! PyModule_AddIntConstant(m, "altzone", julyzone); ! PyModule_AddIntConstant(m, "daylight", ! janzone != julyzone); ! PyModule_AddObject(m, "tzname", ! Py_BuildValue("(zz)", ! janname, julyname)); } } *************** *** 693,713 **** */ initmactimezone(); ! ins(d, "timezone", PyInt_FromLong(timezone)); ! ins(d, "altzone", PyInt_FromLong(timezone)); ! ins(d, "daylight", PyInt_FromLong((long)0)); ! ins(d, "tzname", Py_BuildValue("(zz)", "", "")); #endif /* macintosh */ #endif /* HAVE_TM_ZONE */ #ifdef __CYGWIN__ tzset(); ! ins(d, "timezone", PyInt_FromLong(_timezone)); ! ins(d, "altzone", PyInt_FromLong(_timezone)); ! ins(d, "daylight", PyInt_FromLong(_daylight)); ! ins(d, "tzname", Py_BuildValue("(zz)", _tzname[0], _tzname[1])); #endif /* __CYGWIN__ */ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ PyStructSequence_InitType(&StructTimeType, &struct_time_type_desc); ! PyDict_SetItemString(d, "struct_time", (PyObject*) &StructTimeType); } --- 685,707 ---- */ initmactimezone(); ! PyModule_AddIntConstant(m, "timezone", timezone); ! PyModule_AddIntConstant(m, "altzone", timezone); ! PyModule_AddIntConstant(m, "daylight", 0); ! PyModule_AddObject(m, "tzname", Py_BuildValue("(zz)", "", "")); #endif /* macintosh */ #endif /* HAVE_TM_ZONE */ #ifdef __CYGWIN__ tzset(); ! PyModule_AddIntConstant(m, "timezone", _timezone); ! PyModule_AddIntConstant(m, "altzone", _timezone); ! PyModule_AddIntConstant(m, "daylight", _daylight); ! PyModule_AddObject(m, "tzname", ! Py_BuildValue("(zz)", _tzname[0], _tzname[1])); #endif /* __CYGWIN__ */ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ PyStructSequence_InitType(&StructTimeType, &struct_time_type_desc); ! Py_INCREF(&StructTimeType); ! PyModule_AddObject(m, "struct_time", (PyObject*) &StructTimeType); } From bwarsaw@users.sourceforge.net Mon Apr 1 15:31:14 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 07:31:14 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0216.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13691 Modified Files: pep-0216.txt Log Message: Marking as Rejected as per agreement with Moshe and David Goodger (who promises to submit a replacement). Index: pep-0216.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0216.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0216.txt 11 Dec 2000 23:08:11 -0000 1.8 --- pep-0216.txt 1 Apr 2002 15:31:11 -0000 1.9 *************** *** 3,9 **** Version: $Revision$ Author: moshez@zadka.site.co.il (Moshe Zadka) ! Status: Draft Type: Informational Created: 31-Jul-2000 Abstract --- 3,14 ---- Version: $Revision$ Author: moshez@zadka.site.co.il (Moshe Zadka) ! Status: Rejected Type: Informational Created: 31-Jul-2000 + + Notice + + This PEP is rejected by the author. It will be superseded by a + new PEP, at which time this notice will be updated. Abstract From bwarsaw@users.sourceforge.net Mon Apr 1 15:31:41 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 07:31:41 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.169,1.170 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13788 Modified Files: pep-0000.txt Log Message: Marking PEP 216 as Rejected as per agreement with Moshe and David Goodger (who promises to submit a replacement). Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** pep-0000.txt 11 Mar 2002 18:55:31 -0000 1.169 --- pep-0000.txt 1 Apr 2002 15:31:38 -0000 1.170 *************** *** 61,65 **** S 209 Adding Multidimensional Arrays Barrett, Oliphant S 215 String Interpolation Yee - I 216 Docstring Format Zadka S 228 Reworking Python's Numeric Model Zadka, van Rossum S 237 Unifying Long Integers and Integers Zadka, van Rossum --- 61,64 ---- *************** *** 140,143 **** --- 139,143 ---- SD 212 Loop Counter Iteration Schneider-Kamp SD 213 Attribute Access Handlers Prescod + IR 216 Docstring Format Zadka SD 218 Adding a Built-In Set Object Type Wilson SD 219 Stackless Python McMillan *************** *** 191,195 **** SF 214 Extended Print Statement Warsaw SD 215 String Interpolation Yee ! I 216 Docstring Format Zadka SF 217 Display Hook for Interactive Use Zadka SD 218 Adding a Built-In Set Object Type Wilson --- 191,195 ---- SF 214 Extended Print Statement Warsaw SD 215 String Interpolation Yee ! IR 216 Docstring Format Zadka SF 217 Display Hook for Interactive Use Zadka SD 218 Adding a Built-In Set Object Type Wilson From bwarsaw@users.sourceforge.net Mon Apr 1 15:57:29 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 07:57:29 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0287.txt,NONE,1.1 pep-0000.txt,1.170,1.171 pep-0216.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20414 Modified Files: pep-0000.txt pep-0216.txt Added Files: pep-0287.txt Log Message: PEP 287, reStructuredText Standard Docstring Format, Goodger Replaces PEP 216, Zadka --- NEW FILE: pep-0287.txt --- PEP: 287 Title: reStructuredText Standard Docstring Format Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/04/01 15:57:27 $ Author: goodger@users.sourceforge.net (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Informational Created: 25-Mar-2002 Post-History: Replaces: PEP 216 Abstract This PEP proposes that the reStructuredText [1]_ markup be adopted as the standard markup format for plaintext documentation in Python docstrings, and (optionally) for PEPs and ancillary documents as well. reStructuredText is a rich and extensible yet easy-to-read, what-you-see-is-what-you-get plaintext markup syntax. Only the low-level syntax of docstrings is addressed here. This PEP is not concerned with docstring semantics or processing at all. Goals These are the generally accepted goals for a docstring format, as discussed in the Python Documentation Special Interest Group (Doc-SIG) [2]_: 1. It must be easy to type with any standard text editor. 2. It must be readable to the casual observer. 3. It must not need to contain information which can be deduced from parsing the module. 4. It must contain sufficient information (structure) so it can be converted to any reasonable markup format. 5. It must be possible to write a module's entire documentation in docstrings, without feeling hampered by the markup language. [[Are these in fact the goals of the Doc-SIG members? Anything to add?]] reStructuredText meets and exceeds all of these goals, and sets its own goals as well, even more stringent. See "Features" below. The goals of this PEP are as follows: 1. To establish a standard docstring format by attaining "accepted" status (Python community consensus; BDFL pronouncement). Once reStructuredText is a Python standard, all effort can be focused on tools instead of arguing for a standard. Python needs a standard set of documentation tools. 2. To address any related concerns raised by the Python community. 3. To encourage community support. As long as multiple competing markups are out there, the development community remains fractured. Once a standard exists, people will start to use it, and momentum will inevitably gather. 4. To consolidate efforts from related auto-documentation projects. It is hoped that interested developers will join forces and work on a joint/merged/common implementation. 5. (Optional.) To adopt reStructuredText as the standard markup for PEPs. One or both of the following strategies may be applied: a) Keep the existing PEP section structure constructs (one-line section headers, indented body text). Subsections can either be forbidden or supported with underlined headers in the indented body text. b) Replace the PEP section structure constructs with the reStructuredText syntax. Section headers will require underlines, subsections will be supported out of the box, and body text need not be indented (except for block quotes). Support for RFC 2822 headers will be added to the reStructuredText parser (unambiguous given a specific context: the first contiguous block of a PEP document). It may be desired to concretely specify what over/underline styles are allowed for PEP section headers, for uniformity. 6. (Optional.) To adopt reStructuredText as the standard markup for README-type files and other standalone documents in the Python distribution. Rationale The __doc__ attribute is called a documentation string, or docstring. It is often used to summarize the interface of the module, class or function. The lack of a standard syntax for docstrings has hampered the development of standard tools for extracting docstrings and transforming them into documentation in standard formats (e.g., HTML, DocBook, TeX). There have been a number of proposed markup formats and variations, and many tools tied to these proposals, but without a standard docstring format they have failed to gain a strong following and/or floundered half-finished. The adoption of a standard will, at the very least, benefit docstring processing tools by preventing further "reinventing the wheel". Throughout the existence of the Doc-SIG, consensus on a single standard docstring format has never been reached. A lightweight, implicit markup has been sought, for the following reasons (among others): 1. Docstrings written within Python code are available from within the interactive interpreter, and can be 'print'ed. Thus the use of plaintext for easy readability. 2. Programmers want to add structure to their docstrings, without sacrificing raw docstring readability. Unadorned plaintext cannot be transformed ('up-translated') into useful structured formats. 3. Explicit markup (like XML or TeX) is widely considered unreadable by the uninitiated. 4. Implicit markup is aesthetically compatible with the clean and minimalist Python syntax. Proposed alternatives have included: - XML [3]_, SGML [4]_, DocBook [5]_, HTML [6]_, XHTML [7]_ XML and SGML are explicit, well-formed meta-languages suitable for all kinds of documentation. XML is a variant of SGML. They are best used behind the scenes, because they are verbose, difficult to type, and too cluttered to read comfortably as source. DocBook, HTML, and XHTML are all applications of SGML and/or XML, and all share the same basic syntax and the same shortcomings. - TeX [8]_ TeX is similar to XML/SGML in that it's explicit, not very easy to write, and not easy for the uninitiated to read. - Perl POD [9]_ Most Perl modules are documented in a format called POD -- Plain Old Documentation. This is an easy-to-type, very low level format with strong integration with the Perl parser. Many tools exist to turn POD documentation into other formats: info, HTML and man pages, among others. However, the POD syntax takes after Perl itself in terms of readability. - JavaDoc [10]_ Special comments before Java classes and functions serve to document the code. A program to extract these, and turn them into HTML documentation is called javadoc, and is part of the standard Java distribution. However, the only output format that is supported is HTML, and JavaDoc has a very intimate relationship with HTML, using HTML tags for most markup. Thus it shares the readability problems of HTML. - Setext [11]_, StructuredText [12]_ Early on, variants of Setext (Structure Enhanced Text), including Zope Corp's StructuredText, were proposed for Python docstring formatting. Hereafter these variants will collectively be call 'STexts'. STexts have the advantage of being easy to read without special knowledge, and relatively easy to write. Although used by some (including in most existing Python auto-documentation tools), until now STexts have failed to become standard because: - STexts have been incomplete. Lacking "essential" constructs that people want to use in their docstrings, STexts are rendered less than ideal. Note that these "essential" constructs are not universal; everyone has their own requirements. - STexts have been sometimes surprising. Bits of text are marked up unexpectedly, leading to user frustration. - SText implementations have been buggy. - Most STexts have have had no formal specification except for the implementation itself. A buggy implementation meant a buggy spec, and vice-versa. - There has been no mechanism to get around the SText markup rules when a markup character is used in a non-markup context. Proponents of implicit STexts have vigorously opposed proposals for explicit markup (XML, HTML, TeX, POD, etc.), and the debates have continued off and on since 1996 or earlier. reStructuredText is a complete revision and reinterpretation of the SText idea, addressing all of the problems listed above. Features Rather than repeating or summarizing the extensive reStructuredText spec, please read the originals available from http://structuredtext.sourceforge.net/spec/ (.txt & .html files). Reading the documents in following order is recommended: - An Introduction to reStructuredText [13]_ - Problems With StructuredText [14]_ (optional, if you've used StructuredText; it explains many markup decisions made) - reStructuredText Markup Specification [15]_ - A Record of reStructuredText Syntax Alternatives [16]_ (explains markup decisions made independently of StructuredText) - reStructuredText Directives [17]_ There is also a "Quick reStructuredText" user reference [18]_. A summary of features addressing often-raised docstring markup concerns follows: - A markup escaping mechanism. Backslashes (``\``) are used to escape markup characters when needed for non-markup purposes. However, the inline markup recognition rules have been constructed in order to minimize the need for backslash-escapes. For example, although asterisks are used for *emphasis*, in non-markup contexts such as "*" or "(*)" or "x * y", the asterisks are not interpreted as markup and are left unchanged. For many non-markup uses of backslashes (e.g., describing regular expressions), inline literals or literal blocks are applicable; see the next item. - Markup to include Python source code and Python interactive sessions: inline literals, literal blocks, and doctest blocks. Inline literals use ``double-backquotes`` to indicate program I/O or code snippets. No markup interpretation (including backslash-escape [``\``] interpretation) is done within inline literals. Literal blocks (block-level literal text, such as code excerpts or ASCII graphics) are indented, and indicated with a double-colon ("::") at the end of the preceding paragraph (right here -->):: if literal_block: text = 'is left as-is' spaces_and_linebreaks = 'are preserved' markup_processing = None Doctest blocks begin with ">>> " and end with a blank line. Neither indentation nor literal block double-colons are required. For example:: Here's a doctest block: >>> print 'Python-specific usage examples; begun with ">>>"' Python-specific usage examples; begun with ">>>" >>> print '(cut and pasted from interactive sessions)' (cut and pasted from interactive sessions) - Markup that isolates a Python identifier: interpreted text. Text enclosed in single backquotes is recognized as "interpreted text", whose interpretation is application-dependent. In the context of a Python docstring, the default interpretation of interpreted text is as Python identifiers. The text will be marked up with a hyperlink connected to the documentation for the identifier given. Lookup rules are the same as in Python itself: LGB namespace lookups (local, global, builtin). The "role" of the interpreted text (identifying a class, module, function, etc.) is determined implicitly from the namespace lookup. For example:: class Keeper(Storer): """ Extend `Storer`. Class attribute `instances` keeps track of the number of `Keeper` objects instantiated. """ instances = 0 """How many `Keeper` objects are there?""" def __init__(self): """ Extend `Storer.__init__()` to keep track of instances. Keep count in `self.instances` and data in `self.data`. """ Storer.__init__(self) self.instances += 1 self.data = [] """Store data in a list, most recent last.""" def storedata(self, data): """ Extend `Storer.storedata()`; append new `data` to a list (in `self.data`). """ self.data = data Each piece of interpreted text is looked up according to the local namespace of the block containing its docstring. - Markup that isolates a Python identifier and specifies its type: interpreted text with roles. Although the Python source context reader is designed not to require explicit roles, they may be used. To classify identifiers explicitly, the role is given along with the identifier in either prefix or suffix form:: Use :method:`Keeper.storedata` to store the object's data in `Keeper.data`:instance_attribute:. The syntax chosen for roles is verbose, but necessarily so (if anyone has a better alternative, please post it to the Doc-SIG). The intention of the markup is that there should be little need to use explicit roles; their use is to be kept to an absolute minimum. - Markup for "tagged lists" or "label lists": field lists. Field lists represent a mapping from field name to field body. These are mostly used for extension syntax, such as "bibliographic field lists" (representing document metadata such as author, date, and version) and extension attributes for directives (see below). They may be used to implement docstring semantics, such as identifying parameters, exceptions raised, etc.; such usage is beyond the scope of this PEP. A modified RFC 2822 syntax is used, with a colon *before* as well as *after* the field name. Field bodies are more versatile as well; they may contain multiple field bodies (even nested field lists). For example:: :Date: 2002-03-22 :Version: 1 :Authors: - Me - Myself - I Standard RFC 2822 header syntax cannot be used for this construct because it is ambiguous. A word followed by a colon at the beginning of a line is common in written text. However, with the addition of a well-defined context, such as when a field list invariably occurs at the beginning of a document (e.g., PEPs and email messages), standard RFC 2822 header syntax can be used. - Markup extensibility: directives and substitutions. Directives are used as an extension mechanism for reStructuredText, a way of adding support for new block-level constructs without adding new syntax. Directives for images, admonitions (note, caution, etc.), and tables of contents generation (among others) have been implemented. For example, here's how to place an image:: .. image:: mylogo.png Substitution definitions allow the power and flexibility of block-level directives to be shared by inline text. For example:: The |biohazard| symbol must be used on containers used to dispose of medical waste. .. |biohazard| image:: biohazard.png - Section structure markup. Section headers in reStructuredText use adornment via underlines (and possibly overlines) rather than indentation. For example:: This is a Section Title ======================= This is a Subsection Title -------------------------- This paragraph is in the subsection. This is Another Section Title ============================= This paragraph is in the second section. Questions & Answers Q: Is reStructuredText rich enough? A: Yes, it is for most people. If it lacks some construct that is require for a specific application, it can be added via the directive mechanism. If a common construct has been overlooked and a suitably readable syntax can be found, it can be added to the specification and parser. Q: Is reStructuredText *too* rich? A: No. Since the very beginning, whenever a markup syntax has been proposed on the Doc-SIG, someone has complained about the lack of support for some construct or other. The reply was often something like, "These are docstrings we're talking about, and docstrings shouldn't have complex markup." The problem is that a construct that seems superfluous to one person may be absolutely essential to another. reStructuredText takes the opposite approach: it provides a rich set of implicit markup constructs (plus a generic extension mechanism for explicit markup), allowing for all kinds of documents. If the set of constructs is too rich for a particular application, the unused constructs can either be removed from the parser (via application-specific overrides) or simply omitted by convention. Q: Why not use indentation for section structure, like StructuredText does? Isn't it more "Pythonic"? A: Guido van Rossum wrote the following in a 2001-06-13 Doc-SIG post: I still think that using indentation to indicate sectioning is wrong. If you look at how real books and other print publications are laid out, you'll notice that indentation is used frequently, but mostly at the intra-section level. Indentation can be used to offset lists, tables, quotations, examples, and the like. (The argument that docstrings are different because they are input for a text formatter is wrong: the whole point is that they are also readable without processing.) I reject the argument that using indentation is Pythonic: text is not code, and different traditions and conventions hold. People have been presenting text for readability for over 30 centuries. Let's not innovate needlessly. See "Section Structure via Indentation" in "Problems With StructuredText" [14 ]_ for further elaboration. Q: Why use reStructuredText for PEPs? What's wrong with the existing standard? A: The existing standard for PEPs is very limited in terms of general expressibility, and referencing is especially lacking for such a reference-rich document type. PEPs are currently converted into HTML, but the results (mostly monospaced text) are less than attractive, and most of the value-added potential of HTML is untapped. Making reStructuredText the standard markup for PEPs will enable much richer expression, including support for section structure, inline markup, graphics, and tables. In several PEPs there are ASCII graphics diagrams, which are all that plaintext documents can support. Since PEPs are made available in HTML form, the ability to include proper diagrams would be immediately useful. Current PEP practices allow for reference markers in the form "[1]" in the text, and the footnotes/references themselves are listed in a section toward the end of the document. There is currently no hyperlinking between the reference marker and the footnote/reference itself (it would be possible to add this to pep2html.py, but the "markup" as it stands is ambiguous and mistakes would be inevitable). A PEP with many references (such as this one ;-) requires a lot of flipping back and forth. When revising a PEP, often new references are added or unused references deleted. It is painful to renumber the references, since it has to be done in two places and can have a cascading effect (insert a single new reference 1, and every other reference has to be renumbered; always adding new references to the end is suboptimal). It is easy for references to go out of sync. PEPs use references for two purposes: simple URL references and footnotes. reStructuredText differentiates between the two. A PEP might contain references like this:: Abstract This PEP proposes a adding frungible doodads [1] to the core. It extends PEP 9876 [2] via the BCA [3] mechanism. References and Footnotes [1] http://www.doodads.org/frungible.html [2] PEP 9876, Let's Hope We Never Get Here http://www.python.org/peps/pep-9876.html [3] "Bogus Complexity Addition" Reference 1 is a simple URL reference. Reference 2 is a footnote containing text and a URL. Reference 3 is a footnote containing text only. Rewritten using reStructuredText, this PEP could look like this:: Abstract ======== This PEP proposes a adding `frungible doodads`_ to the core. It extends PEP 9876 [#pep9876] via the BCA [#] mechanism. .. _frungible doodads: http://www.doodads.org/frungible.html .. [#pep9876] `PEP 9876`__, Let's Hope We Never Get Here __ http://www.python.org/peps/pep-9876.html .. [#] "Bogus Complexity Addition" URLs and footnotes can be defined close to their references if desired, making them easier to read in the source text, and making the PEPs easier to revise. The "References and Footnotes" section can be auto-generated with a document tree transform. Footnotes from throughout the PEP would be gathered and displayed under a standard header. If URL references should likewise be written out explicitly (in citation form), another tree transform could be used. URL references can be named ("frungible doodads"), and can be referenced from multiple places in the document without additional definitions. When converted to HTML, references will be replaced with inline hyperlinks (HTML tags). The two footnotes are automatically numbered, so they will always stay in sync. The first footnote also contains an internal reference name, "pep9876", so it's easier to see the connection between reference and footnote in the source text. Named footnotes can be referenced multiple times, maintaining consistent numbering. The "#pep9876" footnote could also be written in the form of a citation:: It extends PEP 9876 [PEP9876]_ ... .. [PEP9876] `PEP 9876`_, Let's Hope We Never Get Here Footnotes are numbered, whereas citations use text for their references. Q: Wouldn't it be better to keep the docstring and PEP proposals separate? A: The PEP markup proposal is an option to this PEP. It may be removed if it is deemed that there is no need for PEP markup. The PEP markup proposal could be made into a separate PEP if necessary. If accepted, PEP 1, PEP Purpose and Guidelines [19]_, and PEP 9, Sample PEP Template [20]_ will be updated. It seems natural to adopt a single consistent markup standard for all uses of plaintext in Python. Q: The existing pep2html.py script converts the existing PEP format to HTML. How will the new-format PEPs be converted to HTML? A: One of the deliverables of the Docutils project [21]_ will be a new version of pep2html.py with integrated reStructuredText parsing. The Docutils project will support PEPs with a "PEP Reader" component, including all functionality currently in pep2html.py (auto-recognition of PEP & RFC references). Q: Who's going to convert the existing PEPs to reStructuredText? A: A call for volunteers will be put out to the Doc-SIG and greater Python communities. If insufficient volunteers are forthcoming, I (David Goodger) will convert the documents myself, perhaps with some level of automation. A transitional system whereby both old and new standards can coexist will be easy to implement (and I pledge to implement it if necessary). Q: Why use reStructuredText for README and other ancillary files? A: The same reasoning used for PEPs above applies to README and other ancillary files. By adopting a standard markup, these files can be converted to attractive cross-referenced HTML and put up on python.org. Developers of Python projects can also take advantage of this facility for their own documentation. References and Footnotes [1] http://structuredtext.sourceforge.net/ [2] http://www.python.org/sigs/doc-sig/ [3] http://www.w3.org/XML/ [4] http://www.oasis-open.org/cover/general.html [5] http://docbook.org/tdg/en/html/docbook.html [6] http://www.w3.org/MarkUp/ [7] http://www.w3.org/MarkUp/#xhtml1 [8] http://www.tug.org/interest.html [9] http://www.perldoc.com/perl5.6/pod/perlpod.html [10] http://java.sun.com/j2se/javadoc/ [11] http://docutils.sourceforge.net/mirror/setext.html [12] http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage [13] An Introduction to reStructuredText http://structuredtext.sourceforge.net/spec/introduction.txt [14] Problems with StructuredText http://structuredtext.sourceforge.net/spec/problems.txt [15] reStructuredText Markup Specification http://structuredtext.sourceforge.net/spec/reStructuredText.txt [16] A Record of reStructuredText Syntax Alternatives http://structuredtext.sourceforge.net/spec/alternatives.txt [17] reStructuredText Directives http://structuredtext.sourceforge.net/spec/directives.txt [18] Quick reStructuredText http://structuredtext.sourceforge.net/docs/quickref.html [19] PEP 1, PEP Guidelines, Warsaw, Hylton http://www.python.org/peps/pep-0001.html [20] PEP 9, Sample PEP Template, Warsaw http://www.python.org/peps/pep-0009.html [21] http://docutils.sourceforge.net/ [22] PEP 216, Docstring Format, Zadka http://www.python.org/peps/pep-0216.html Copyright This document has been placed in the public domain. Acknowledgements Some text is borrowed from PEP 216, Docstring Format, by Moshe Zadka [22]_. Special thanks to all members past & present of the Python Doc-SIG. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** pep-0000.txt 1 Apr 2002 15:31:38 -0000 1.170 --- pep-0000.txt 1 Apr 2002 15:57:26 -0000 1.171 *************** *** 94,97 **** --- 94,98 ---- S 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis + S 287 reStructuredText Standard Docstring Format Goodger Finished PEPs (done, implemented in CVS) *************** *** 262,265 **** --- 263,267 ---- S 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis + S 287 reStructuredText Standard Docstring Format Goodger SR 666 Reject Foolish Indentation Creighton Index: pep-0216.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0216.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0216.txt 1 Apr 2002 15:31:11 -0000 1.9 --- pep-0216.txt 1 Apr 2002 15:57:27 -0000 1.10 *************** *** 6,14 **** Type: Informational Created: 31-Jul-2000 Notice ! This PEP is rejected by the author. It will be superseded by a ! new PEP, at which time this notice will be updated. Abstract --- 6,15 ---- Type: Informational Created: 31-Jul-2000 + Replaced-By: PEP 287 Notice ! This PEP is rejected by the author. It has been superseded by PEP ! 287. Abstract From bwarsaw@users.sourceforge.net Mon Apr 1 15:59:22 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 07:59:22 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0009.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20933 Modified Files: pep-0009.txt Log Message: In David Goodger's PEP 287, he has a better Emacs turd section. Adopting that here. Index: pep-0009.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0009.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0009.txt 13 Nov 2001 19:12:03 -0000 1.6 --- pep-0009.txt 1 Apr 2002 15:59:19 -0000 1.7 *************** *** 204,207 **** --- 204,208 ---- mode: indented-text indent-tabs-mode: nil + sentence-end-double-space: t fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Apr 1 16:10:21 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 08:10:21 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0288.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24035 Added Files: pep-0288.txt Log Message: PEP 288, Generators Attributes and Exceptions, Hettinger --- NEW FILE: pep-0288.txt --- PEP: 288 Title: Generators Attributes and Exceptions Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/04/01 16:10:19 $ Author: python@rcn.com (Raymond D. Hettinger) Status: Deferred Type: Standards Track Created: 21-Mar-2002 Python-Version: 2.4 Post-History: Abstract This PEP introduces ideas for enhancing the generators introduced in Python version 2.2 [1]. The goal is to increase the convenience, utility, and power of generators by providing a mechanism for passing data into a generator and for triggering exceptions inside a generator. These mechanisms were first proposed along with two other generator tools in PEP 279 [7]. They were split-off to this separate PEP to allow the ideas more time to mature and for alternatives to be considered. Rationale Python 2.2 introduced the concept of an iterable interface as proposed in PEP 234 [2]. The iter() factory function was provided as common calling convention and deep changes were made to use iterators as a unifying theme throughout Python. The unification came in the form of establishing a common iterable interface for mappings, sequences, and file objects. Generators, as proposed in PEP 255 [1], were introduced as a means for making it easier to create iterators, especially ones with complex internal execution or variable states. The next step in the evolution of generators is to extend the syntax of the 'yield' keyword to enable generator parameter passing. The resulting increase in power simplifies the creation of consumer streams which have a complex execution state and/or variable state. A better alternative being considered is to allow generators to accept attribute assignments. This allows data to be passed in a standard Python fashion. A related evolutionary step is to add a generator method to enable exceptions to be passed to a generator. Currently, there is no clean method for triggering exceptions from outside the generator. Also, generator exception passing helps mitigate the try/finally prohibition for generators. These suggestions are designed to take advantage of the existing implementation and require little additional effort to incorporate. They are backwards compatible and require no new keywords. They are being recommended for Python version 2.4. Reference Implementation There is not currently a CPython implementation; however, a simulation module written in pure Python is available on SourceForge [5]. The simulation is meant to allow direct experimentation with the proposal. There is also a module [6] with working source code for all of the examples used in this PEP. It serves as a test suite for the simulator and it documents how each of the feature works in practice. The authors and implementers of PEP 255 [1] were contacted to provide their assessment of whether the enhancement was going to be straight-forward to implement and require only minor modification of the existing generator code. Neil felt the assertion was correct. Ka-Ping thought so also. GvR said he could believe that it was true. Tim did not have an opportunity to give an assessment. Specification for Generator Parameter Passing 1. Allow 'yield' to assign a value as in: def mygen(): while 1: x = yield None print x 2. Let the .next() method take a value to pass to the generator as in: g = mygen() g.next() # runs the generator until the first 'yield' g.next(1) # '1' is bound to 'x' in mygen(), then printed g.next(2) # '2' is bound to 'x' in mygen(), then printed The control flow of 'yield' and 'next' is unchanged by this proposal. The only change is that a value can be sent into the generator. By analogy, consider the quality improvement from GOSUB (which had no argument passing mechanism) to modern procedure calls (which can pass in arguments and return values). Most of the underlying machinery is already in place, only the communication needs to be added by modifying the parse syntax to accept the new 'x = yield expr' syntax and by allowing the .next() method to accept an optional argument. Yield is more than just a simple iterator creator. It does something else truly wonderful -- it suspends execution and saves state. It is good for a lot more than writing iterators. This proposal further expands its capability by making it easier to share data with the generator. The .next(arg) mechanism is especially useful for: 1. Sending data to any generator 2. Writing lazy consumers with complex execution states 3. Writing co-routines (as demonstrated in Dr. Mertz's articles [3]) The proposal is a clear improvement over the existing alternative of passing data via global variables. It is also much simpler, more readable and easier to debug than an approach involving the threading module with its attendant mutexes, semaphores, and data queues. A class-based approach competes well when there are no complex execution states or variable states. However, when the complexity increases, generators with parameter passing are much simpler because they automatically save state (unlike classes which must explicitly save the variable and execution state in instance variables). Note A: This proposal changes 'yield' from a statement to an expression with binding and precedence similar to lambda. Examples Example of a Complex Consumer The encoder for arithmetic compression sends a series of fractional values to a complex, lazy consumer. That consumer makes computations based on previous inputs and only writes out when certain conditions have been met. After the last fraction is received, it has a procedure for flushing any unwritten data. Example of a Consumer Stream def filelike(packagename, appendOrOverwrite): cum = [] if appendOrOverwrite == 'w+': cum.extend(packages[packagename]) try: while 1: dat = yield None cum.append(dat) except FlushStream: packages[packagename] = cum ostream = filelike('mydest','w') # Analogous to file.open(name,flag) ostream.next() # Advance to the first yield ostream.next(firstdat) # Analogous to file.write(dat) ostream.next(seconddat) ostream.throw(FlushStream) # Throw is proposed below Example of a Complex Consumer Loop over the picture files in a directory, shrink them one at a time to thumbnail size using PIL [4], and send them to a lazy consumer. That consumer is responsible for creating a large blank image, accepting thumbnails one at a time and placing them in a 5 by 3 grid format onto the blank image. Whenever the grid is full, it writes-out the large image as an index print. A FlushStream exception indicates that no more thumbnails are available and that the partial index print should be written out if there are one or more thumbnails on it. Example of a Producer and Consumer Used Together in a Pipe-like Fashion 'Analogy to Linux style pipes: source | upper | sink' sink = sinkgen() sink.next() for word in source(): sink.next(word.upper()) Comments Comments from GvR: We discussed this at length when we were hashing out generators and coroutines, and found that there's always a problem with this: the argument to the first next() call has to be thrown away, because it doesn't correspond to a yield statement. This looks ugly (note that the example code has a dummy call to next() to get the generator going). But there may be useful examples that can only be programmed (elegantly) with this feature, so I'm reserving judgment. I can believe that it's easy to implement. Comments from Ka-Ping Yee: I also think there is a lot of power to be gained from generator argument passing. Comments from Neil Schemenauer: I like the idea of being able to pass values back into a generator. I originally pitched this idea to Guido but in the end we decided against it (at least for the initial implementation). There was a few issues to work out but I can't seem to remember what they were. My feeling is that we need to wait until the Python community has more experience with generators before adding this feature. Maybe for 2.4 but not for 2.3. In the mean time you can work around this limitation by making your generator a method. Values can be passed back by mutating the instance. Comments for Magnus Lie Hetland: I like the generator parameter passing mechanism. Although I see no need to defer it, deferral seems to be the most likely scenario, and in the meantime I guess the functionality can be emulated either by implementing the generator as a method, or by passing a parameter with the exception passing mechanism. Author response: Okay, consider this proposal deferred until version 2.4 so the idea can fully mature. I am currently teasing out two alternatives which may eliminate the issue with the initial next() call not having a corresponding yield. Alternative 1: Submit Instead of next(arg), use a separate method, submit(arg). Submit would behave just like next() except that on the first call, it will call next() twice. The word 'submit' has the further advantage of being explicit in its intent. It also allows checking for the proper number of arguments (next always has zero and submit always has one). Using this alternative, the call to the consumer stream looks like this: ostream = filelike('mydest','w') ostream.submit(firstdat) # No call to next is needed ostream.submit(seconddat) ostream.throw(FlushStream) # Throw is proposed below Alternative 2: Generator Attributes Instead of generator parameter passing, enable writable generator attributes: g.data=firstdat; g.next(). The code on the receiving end is written knowing that the attribute is set from the very beginning. This solves the problem because the first next call does not need to be associated with a yield statement. This solution uses a standard Python tool, object attributes, in a standard way. It is also explicit in its intention and provides some error checking (the receiving code raises an AttributeError if the expected field has not be set before the call). The one unclean part of this approach is that the generator needs some way to reference itself (something parallel to the use of the function name in a recursive function or to the use of 'self' in a method). The only way I can think of is to introduce a new system variable, __self__, in any function that employs a yield statement. Using this alternative, the code for the consumer stream looks like this: def filelike(packagename, appendOrOverwrite): cum = [] if appendOrOverwrite == 'w+': cum.extend(packages[packagename]) try: while 1: cum.append(__self__.dat) yield None except FlushStream: packages[packagename] = cum ostream = filelike('mydest','w') ostream.dat = firstdat; ostream.next() ostream.dat = firstdat; ostream.next() ostream.throw(FlushStream) # Throw is proposed in PEP 279 Specification for Generator Exception Passing: Add a .throw(exception) method to the generator interface: def logger(): start = time.time() log = [] try: while 1: log.append( time.time() - start ) yield log[-1] except WriteLog: writelog(log) g = logger() for i in [10,20,40,80,160]: testsuite(i) g.next() g.throw(WriteLog) There is no existing work-around for triggering an exception inside a generator. This is a true deficiency. It is the only case in Python where active code cannot be excepted to or through. Generator exception passing also helps address an intrinsic limitation on generators, the prohibition against their using try/finally to trigger clean-up code [1]. Without .throw(), the current work-around forces the resolution or clean-up code to be moved outside the generator. Note A: The name of the throw method was selected for several reasons. Raise is a keyword and so cannot be used as a method name. Unlike raise which immediately raises an exception from the current execution point, throw will first return to the generator and then raise the exception. The word throw is suggestive of putting the exception in another location. The word throw is already associated with exceptions in other languages. Alternative method names were considered: resolve(), signal(), genraise(), raiseinto(), and flush(). None of these seem to fit as well as throw(). Note B: The throw syntax should exactly match raise's syntax: throw([expression, [expression, [expression]]]) Accordingly, it should be implemented to handle all of the following: raise string g.throw(string) raise string, data g.throw(string,data) raise class, instance g.throw(class,instance) raise instance g.throw(instance) raise g.throw() Comments from GvR: I'm not convinced that the cleanup problem that this is trying to solve exists in practice. I've never felt the need to put yield inside a try/except. I think the PEP doesn't make enough of a case that this is useful. This one gets a big fat -1 until there's a good motivational section. Comments from Ka-Ping Yee: I agree that the exception issue needs to be resolved and [that] you have suggested a fine solution. Comments from Neil Schemenauer: The exception passing idea is one I hadn't thought of before and looks interesting. If we enable the passing of values back, then we should add this feature too. Comments for Magnus Lie Hetland: Even though I cannot speak for the ease of implementation, I vote +1 for the exception passing mechanism. Comments from the Community: The response has been mostly favorable. One negative comment from GvR is shown above. The other was from Martin von Loewis who was concerned that it could be difficult to implement and is withholding his support until a working patch is available. To probe Martin's comment, I checked with the implementers of the original generator PEP for an opinion on the ease of implementation. They felt that implementation would be straight-forward and could be grafted onto the existing implementation without disturbing its internals. Author response: When the sole use of generators is to simplify writing iterators for lazy producers, then the odds of needing generator exception passing are slim. If, on the other hand, generators are used to write lazy consumers, create coroutines, generate output streams, or simply for their marvelous capability for restarting a previously frozen state, THEN the need to raise exceptions will come up frequently. I'm no judge of what is truly Pythonic, but am still astonished that there can exist blocks of code that can't be excepted to or through, that the try/finally combination is blocked, and that the only work-around is to rewrite as a class and move the exception code out of the function or method being excepted. References [1] PEP 255 Simple Generators http://python.sourceforge.net/peps/pep-0255.html [2] PEP 234 Iterators http://python.sourceforge.net/peps/pep-0234.html [3] Dr. David Mertz's draft column for Charming Python. http://gnosis.cx/publish/programming/charming_python_b5.txt http://gnosis.cx/publish/programming/charming_python_b7.txt [4] PIL, the Python Imaging Library can be found at: http://www.pythonware.com/products/pil/ [5] A pure Python simulation of every feature in this PEP is at: http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17348&aid=513752 [6] The full, working source code for each of the examples in this PEP along with other examples and tests is at: http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17412&aid=513756 [7] PEP 279 Enhanced Generators http://python.sourceforge.net/peps/pep-0279.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil fill-column: 70 End: From nnorwitz@users.sourceforge.net Mon Apr 1 18:59:23 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Mon, 01 Apr 2002 10:59:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.124,1.125 test_file.py,1.7,1.8 test_mpz.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4080 Modified Files: test_descr.py test_file.py test_mpz.py Log Message: There is no TestError, use TestFailed appropriately Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** test_descr.py 28 Mar 2002 15:49:54 -0000 1.124 --- test_descr.py 1 Apr 2002 18:59:20 -0000 1.125 *************** *** 786,790 **** try: c() except TypeError: pass ! else: raise TestError, "calling object w/o call method should raise TypeError" def pymods(): --- 786,790 ---- try: c() except TypeError: pass ! else: raise TestFailed, "calling object w/o call method should raise TypeError" def pymods(): Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_file.py 1 Apr 2002 00:09:00 -0000 1.7 --- test_file.py 1 Apr 2002 18:59:20 -0000 1.8 *************** *** 2,6 **** from array import array ! from test_support import verify, TESTFN from UserList import UserList --- 2,6 ---- from array import array ! from test_support import verify, TESTFN, TestFailed from UserList import UserList *************** *** 71,80 **** f = open(TESTFN) if f.name != TESTFN: ! raise TestError, 'file.name should be "%s"' % TESTFN if f.isatty(): ! raise TestError, 'file.isatty() should be false' if f.closed: ! raise TestError, 'file.closed should be false' try: --- 71,80 ---- f = open(TESTFN) if f.name != TESTFN: ! raise TestFailed, 'file.name should be "%s"' % TESTFN if f.isatty(): ! raise TestFailed, 'file.isatty() should be false' if f.closed: ! raise TestFailed, 'file.closed should be false' try: *************** *** 83,91 **** pass else: ! raise TestError, 'file.readinto("") should raise a TypeError' f.close() if not f.closed: ! raise TestError, 'file.closed should be true' for methodname in ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines' ]: --- 83,91 ---- pass else: ! raise TestFailed, 'file.readinto("") should raise a TypeError' f.close() if not f.closed: ! raise TestFailed, 'file.closed should be true' for methodname in ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines' ]: *************** *** 96,100 **** pass else: ! raise TestError, 'file.%s() on a closed file should raise a ValueError' % methodname try: --- 96,100 ---- pass else: ! raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname try: *************** *** 103,107 **** pass else: ! raise TestError, 'file.writelines([]) on a closed file should raise a ValueError' os.unlink(TESTFN) --- 103,107 ---- pass else: ! raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError' os.unlink(TESTFN) Index: test_mpz.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mpz.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_mpz.py 1 Apr 2002 01:37:14 -0000 1.1 --- test_mpz.py 1 Apr 2002 18:59:20 -0000 1.2 *************** *** 1,5 **** import mpz ! from test_support import vereq def check_conversion(num): --- 1,5 ---- import mpz ! from test_support import vereq, TestFailed def check_conversion(num): From nnorwitz@users.sourceforge.net Mon Apr 1 19:00:53 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Mon, 01 Apr 2002 11:00:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_hmac.py,1.3,1.4 test_httplib.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4496 Modified Files: test_hmac.py test_httplib.py Log Message: Use attributes appropriately Index: test_hmac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hmac.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_hmac.py 13 Nov 2001 21:51:26 -0000 1.3 --- test_hmac.py 1 Apr 2002 19:00:50 -0000 1.4 *************** *** 64,68 **** h2 = h.copy() except: ! fail("Exception raised during normal usage of HMAC class.") class CopyTestCase(unittest.TestCase): --- 64,68 ---- h2 = h.copy() except: ! self.fail("Exception raised during normal usage of HMAC class.") class CopyTestCase(unittest.TestCase): Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_httplib.py 24 Mar 2002 16:54:16 -0000 1.3 --- test_httplib.py 1 Apr 2002 19:00:50 -0000 1.4 *************** *** 9,13 **** def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': ! raise UnimplementedFileMode() return StringIO.StringIO(self.text) --- 9,13 ---- def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': ! raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) From bwarsaw@users.sourceforge.net Mon Apr 1 16:10:03 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 08:10:03 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.171,1.172 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv23880 Modified Files: pep-0000.txt Log Message: PEP 288, Generators Attributes and Exceptions, Hettinger Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** pep-0000.txt 1 Apr 2002 15:57:26 -0000 1.171 --- pep-0000.txt 1 Apr 2002 16:09:59 -0000 1.172 *************** *** 151,154 **** --- 151,155 ---- SR 259 Omit printing newline after newline van Rossum SR 271 Prefixing sys.path by command line option Giacometti + SD 288 Generators Attributes and Exceptions Hettinger SR 666 Reject Foolish Indentation Creighton *************** *** 264,267 **** --- 265,269 ---- S 286 Enhanced Argument Tuples von Loewis S 287 reStructuredText Standard Docstring Format Goodger + SD 288 Generators Attributes and Exceptions Hettinger SR 666 Reject Foolish Indentation Creighton From tim_one@users.sourceforge.net Mon Apr 1 20:13:01 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 01 Apr 2002 12:13:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22589/python/Objects Modified Files: obmalloc.c Log Message: Fixed errors in two comments. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** obmalloc.c 1 Apr 2002 19:23:44 -0000 2.26 --- obmalloc.c 1 Apr 2002 20:12:59 -0000 2.27 *************** *** 1209,1213 **** ulong numfreeblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; ulong grandtotal; /* total # of allocated bytes */ ! ulong freegrandtotal; /* total # of available bytes in used blocks */ fprintf(stderr, "%u arenas * %d bytes/arena = %lu total bytes.\n", --- 1209,1213 ---- ulong numfreeblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; ulong grandtotal; /* total # of allocated bytes */ ! ulong freegrandtotal; /* total # of available bytes in used pools */ fprintf(stderr, "%u arenas * %d bytes/arena = %lu total bytes.\n", *************** *** 1221,1226 **** numpools[i] = numblocks[i] = numfreeblocks[i] = 0; ! /* Because empty pools aren't linked to from anything, it's easiest ! * to march over all the arenas. */ for (i = 0; i < narenas; ++i) { --- 1221,1227 ---- numpools[i] = numblocks[i] = numfreeblocks[i] = 0; ! /* Because full pools aren't linked to from anything, it's easiest ! * to march over all the arenas. If we're lucky, most of the memory ! * will be living in full pools -- would be a shame to miss them. */ for (i = 0; i < narenas; ++i) { From bwarsaw@users.sourceforge.net Mon Apr 1 16:01:55 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 08:01:55 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0216.txt,1.10,1.11 pep-0287.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv21796 Modified Files: pep-0216.txt pep-0287.txt Log Message: Fixed Replaces: and Replaced-By: lines. Index: pep-0216.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0216.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0216.txt 1 Apr 2002 15:57:27 -0000 1.10 --- pep-0216.txt 1 Apr 2002 16:01:53 -0000 1.11 *************** *** 6,10 **** Type: Informational Created: 31-Jul-2000 ! Replaced-By: PEP 287 Notice --- 6,10 ---- Type: Informational Created: 31-Jul-2000 ! Replaced-By: 287 Notice Index: pep-0287.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0287.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0287.txt 1 Apr 2002 15:57:27 -0000 1.1 --- pep-0287.txt 1 Apr 2002 16:01:53 -0000 1.2 *************** *** 9,13 **** Created: 25-Mar-2002 Post-History: ! Replaces: PEP 216 --- 9,13 ---- Created: 25-Mar-2002 Post-History: ! Replaces: 216 From bwarsaw@users.sourceforge.net Mon Apr 1 15:24:56 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 07:24:56 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0285.txt,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12035 Modified Files: pep-0285.txt Log Message: minor typo Index: pep-0285.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pep-0285.txt 1 Apr 2002 15:20:47 -0000 1.16 --- pep-0285.txt 1 Apr 2002 15:24:54 -0000 1.17 *************** *** 48,52 **** => Most reviewers prefer str(True) == "True" (which may mean that they don't appreciate the specific backwards compatibility ! issue brought up br Marc-Andre Lemburg :-). 3) Should the constants be called 'True' and 'False' --- 48,52 ---- => Most reviewers prefer str(True) == "True" (which may mean that they don't appreciate the specific backwards compatibility ! issue brought up by Marc-Andre Lemburg :-). 3) Should the constants be called 'True' and 'False' From akuchling@users.sourceforge.net Mon Apr 1 19:22:36 2002 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 01 Apr 2002 11:22:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/whatsnew whatsnew22.tex,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv9735 Modified Files: whatsnew22.tex Log Message: Mention 2.2.1 in intro and in bug/patch counts Fix two typos spotted by Joonas Paalasmaa Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** whatsnew22.tex 21 Dec 2001 04:39:11 -0000 1.54 --- whatsnew22.tex 1 Apr 2002 19:22:34 -0000 1.55 *************** *** 4,8 **** \title{What's New in Python 2.2} ! \release{1.00} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} --- 4,8 ---- \title{What's New in Python 2.2} ! \release{1.01} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} *************** *** 12,17 **** \section{Introduction} ! This article explains the new features in Python 2.2, released on ! December 21, 2001. Python 2.2 can be thought of as the "cleanup release". There are some --- 12,18 ---- \section{Introduction} ! This article explains the new features in Python 2.2.1, released on ! April 10, 2002. Python 2.2.1 is a bugfix release of Python 2.2, ! originally released on December 21, 2001. Python 2.2 can be thought of as the "cleanup release". There are some *************** *** 1064,1068 **** \item The \module{xmlrpclib} module was contributed to the standard ! library by Fredrik Lundh, provding support for writing XML-RPC clients. XML-RPC is a simple remote procedure call protocol built on top of HTTP and XML. For example, the following snippet retrieves a --- 1065,1069 ---- \item The \module{xmlrpclib} module was contributed to the standard ! library by Fredrik Lundh, providing support for writing XML-RPC clients. XML-RPC is a simple remote procedure call protocol built on top of HTTP and XML. For example, the following snippet retrieves a *************** *** 1114,1118 **** \item The Python profiler has been extensively reworked and various ! errors in its output have been corrected. (Contributed by Fred Fred~L. Drake, Jr. and Tim Peters.) --- 1115,1119 ---- \item The Python profiler has been extensively reworked and various ! errors in its output have been corrected. (Contributed by Fred~L. Drake, Jr. and Tim Peters.) *************** *** 1277,1283 **** As usual there were a bunch of other improvements and bugfixes scattered throughout the source tree. A search through the CVS change ! logs finds there were 527 patches applied, and 683 bugs fixed; both ! figures are likely to be underestimates. Some of the more notable ! changes are: \begin{itemize} --- 1278,1286 ---- As usual there were a bunch of other improvements and bugfixes scattered throughout the source tree. A search through the CVS change ! logs finds there were 527 patches applied and 683 bugs fixed between ! Python 2.1 and 2.2; 2.2.1 applied 139 patches and fixed 143 bugs. ! Both figures are likely to be underestimates. ! ! Some of the more notable changes are: \begin{itemize} From fdrake@users.sourceforge.net Mon Apr 1 16:11:29 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 08:11:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/html index.html.in,1.14,1.14.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv24786/html Modified Files: Tag: release22-maint index.html.in Log Message: Backport changes to integrate AMK's "What's New in Python X.Y" document. This incorporates the integration of several checkins from the trunk. Index: index.html.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/index.html.in,v retrieving revision 1.14 retrieving revision 1.14.22.1 diff -C2 -d -r1.14 -r1.14.22.1 *** index.html.in 6 Mar 2001 07:28:20 -0000 1.14 --- index.html.in 1 Apr 2002 16:11:27 -0000 1.14.22.1 *************** *** 2,12 **** Python @RELEASE@ Documentation - @DATE@ ! --- 2,16 ---- Python @RELEASE@ Documentation - @DATE@ ! + *************** *** 46,54 **** ! ' \ % (cgi.escape(k), v) print >> fo, '
  • Tutorial
    (start here) !
  • Global Module Index
    (for quick access to all documentation) --- 50,72 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ' \ ! % (cgi.escape(k), v) print >> fo, '
    ! ! !
    !   !
    • Global Module Index
      (for quick access to all documentation) *************** *** 64,70 **** Python Modules
      (for administrators)
    !  
     
     
      *************** *** 96,100 ****
     
      --- 115,119 ----
     
      From fdrake@users.sourceforge.net Mon Apr 1 16:11:29 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 08:11:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.235.2.1.2.5,1.235.2.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv24786 Modified Files: Tag: release22-maint Makefile Log Message: Backport changes to integrate AMK's "What's New in Python X.Y" document. This incorporates the integration of several checkins from the trunk. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.5 retrieving revision 1.235.2.1.2.6 diff -C2 -d -r1.235.2.1.2.5 -r1.235.2.1.2.6 *** Makefile 29 Mar 2002 21:32:25 -0000 1.235.2.1.2.5 --- Makefile 1 Apr 2002 16:11:26 -0000 1.235.2.1.2.6 *************** *** 89,92 **** --- 89,96 ---- HTMLBASE= file:`pwd` + # The end of this should reflect the major/minor version numbers of + # the release: + WHATSNEW=whatsnew22 + # what's what MANDVIFILES= paper-$(PAPER)/api.dvi paper-$(PAPER)/ext.dvi \ *************** *** 94,98 **** paper-$(PAPER)/ref.dvi paper-$(PAPER)/tut.dvi HOWTODVIFILES= paper-$(PAPER)/doc.dvi paper-$(PAPER)/inst.dvi \ ! paper-$(PAPER)/dist.dvi MANPDFFILES= paper-$(PAPER)/api.pdf paper-$(PAPER)/ext.pdf \ --- 98,102 ---- paper-$(PAPER)/ref.dvi paper-$(PAPER)/tut.dvi HOWTODVIFILES= paper-$(PAPER)/doc.dvi paper-$(PAPER)/inst.dvi \ ! paper-$(PAPER)/dist.dvi paper-$(PAPER)/$(WHATSNEW).dvi MANPDFFILES= paper-$(PAPER)/api.pdf paper-$(PAPER)/ext.pdf \ *************** *** 100,104 **** paper-$(PAPER)/ref.pdf paper-$(PAPER)/tut.pdf HOWTOPDFFILES= paper-$(PAPER)/doc.pdf paper-$(PAPER)/inst.pdf \ ! paper-$(PAPER)/dist.pdf MANPSFILES= paper-$(PAPER)/api.ps paper-$(PAPER)/ext.ps \ --- 104,108 ---- paper-$(PAPER)/ref.pdf paper-$(PAPER)/tut.pdf HOWTOPDFFILES= paper-$(PAPER)/doc.pdf paper-$(PAPER)/inst.pdf \ ! paper-$(PAPER)/dist.pdf paper-$(PAPER)/$(WHATSNEW).pdf MANPSFILES= paper-$(PAPER)/api.ps paper-$(PAPER)/ext.ps \ *************** *** 106,110 **** paper-$(PAPER)/ref.ps paper-$(PAPER)/tut.ps HOWTOPSFILES= paper-$(PAPER)/doc.ps paper-$(PAPER)/inst.ps \ ! paper-$(PAPER)/dist.ps DVIFILES= $(MANDVIFILES) $(HOWTODVIFILES) --- 110,114 ---- paper-$(PAPER)/ref.ps paper-$(PAPER)/tut.ps HOWTOPSFILES= paper-$(PAPER)/doc.ps paper-$(PAPER)/inst.ps \ ! paper-$(PAPER)/dist.ps paper-$(PAPER)/$(WHATSNEW).ps DVIFILES= $(MANDVIFILES) $(HOWTODVIFILES) *************** *** 142,146 **** html/tut/tut.html \ html/inst/inst.html \ ! html/dist/dist.html ALLHTMLFILES=$(INDEXFILES) html/index.html html/modindex.html html/acks.html --- 146,151 ---- html/tut/tut.html \ html/inst/inst.html \ ! html/dist/dist.html \ ! html/whatsnew/$(WHATSNEW).html ALLHTMLFILES=$(INDEXFILES) html/index.html html/modindex.html html/acks.html *************** *** 272,275 **** --- 277,287 ---- cd paper-$(PAPER) && $(MKPDF) ../tut/tut.tex + # What's New in Python X.Y + paper-$(PAPER)/$(WHATSNEW).dvi: + cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex + + paper-$(PAPER)/$(WHATSNEW).pdf: + cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex + # The remaining part of the Makefile is concerned with various # conversions, as described above. See also the README file. *************** *** 312,316 **** html/index.html: $(INDEXFILES) html/index.html: html/index.html.in $(BOILERPLATE) tools/rewrite.py ! $(PYTHON) tools/rewrite.py $(BOILERPLATE) RELEASE=$(RELEASE) \ <$< >$@ --- 324,329 ---- html/index.html: $(INDEXFILES) html/index.html: html/index.html.in $(BOILERPLATE) tools/rewrite.py ! $(PYTHON) tools/rewrite.py $(BOILERPLATE) \ ! RELEASE=$(RELEASE) WHATSNEW=$(WHATSNEW) \ <$< >$@ *************** *** 360,363 **** --- 373,380 ---- $(MKHTML) --dir html/dist --split 4 dist/dist.tex + whatsnew: html/whatsnew/$(WHATSNEW).html + html/whatsnew/$(WHATSNEW).html: whatsnew/$(WHATSNEW).tex + $(MKHTML) --dir html/whatsnew --split 4 whatsnew/$(WHATSNEW).tex + # The iSilo format is used by the iSilo document reader for PalmOS devices. *************** *** 371,375 **** isilo/tut/tut.html \ isilo/inst/inst.html \ ! isilo/dist/dist.html $(ISILOINDEXFILES): $(COMMONPERL) html/about.dat perl/isilo.perl --- 388,393 ---- isilo/tut/tut.html \ isilo/inst/inst.html \ ! isilo/dist/dist.html \ ! isilo/whatsnew/$(WHATSNEW).html $(ISILOINDEXFILES): $(COMMONPERL) html/about.dat perl/isilo.perl *************** *** 383,387 **** isilo/python-tut-$(RELEASE).pdb \ isilo/python-dist-$(RELEASE).pdb \ ! isilo/python-inst-$(RELEASE).pdb isilo/python-api-$(RELEASE).pdb: isilo/api/api.html isilo/api/api.css --- 401,406 ---- isilo/python-tut-$(RELEASE).pdb \ isilo/python-dist-$(RELEASE).pdb \ ! isilo/python-inst-$(RELEASE).pdb \ ! isilo/python-whatsnew-$(RELEASE).pdb isilo/python-api-$(RELEASE).pdb: isilo/api/api.html isilo/api/api.css *************** *** 421,424 **** --- 440,447 ---- isilo/inst/inst.html $@ + isilo/python-whatsnew-$(RELEASE).pdb: isilo/whatsnew/$(WHATSNEW).html isilo/whatsnew/$(WHATSNEW).css + $(MKISILO) "-iWhat's New in Python X.Y" \ + isilo/whatsnew/$(WHATSNEW).html $@ + isilo/api/api.html: $(APIFILES) $(MKISILOHTML) --dir isilo/api api/api.tex *************** *** 448,451 **** --- 471,477 ---- $(MKISILOHTML) --dir isilo/dist dist/dist.tex + isilo/whatsnew/$(WHATSNEW).html: whatsnew/$(WHATSNEW).tex + $(MKISILOHTML) --dir isilo/whatsnew whatsnew/$(WHATSNEW).tex + # These are useful if you need to transport the iSilo-ready HTML to # another machine to perform the conversion: *************** *** 473,476 **** --- 499,503 ---- $(WEBCHECKER) $(HTMLBASE)/dist/ $(WEBCHECKER) $(HTMLBASE)/inst/ + $(WEBCHECKER) $(HTMLBASE)/whatsnew/ fastwebcheck: $(ALLHTMLFILES) *************** *** 484,487 **** --- 511,515 ---- $(WEBCHECKER) -x $(HTMLBASE)/dist/ $(WEBCHECKER) -x $(HTMLBASE)/inst/ + $(WEBCHECKER) -x $(HTMLBASE)/whatsnew/ *************** *** 615,620 **** --- 643,650 ---- rm -rf html/api/ html/doc/ html/ext/ html/lib/ html/mac/ rm -rf html/ref/ html/tut/ html/inst/ html/dist/ + rm -rf html/whatsnew/ rm -rf isilo/api/ isilo/doc/ isilo/ext/ isilo/lib/ isilo/mac/ rm -rf isilo/ref/ isilo/tut/ isilo/inst/ isilo/dist/ + rm -rf isilo/whatsnew/ rm -f isilo/python-*-$(RELEASE).pdb isilo-$(RELEASE).zip From bwarsaw@users.sourceforge.net Mon Apr 1 16:04:30 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 01 Apr 2002 08:04:30 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0279.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv22571 Modified Files: pep-0279.txt Log Message: Raymond's latest update. Note Status is still Draft until confirmation of Accepted status comes from Guido. Index: pep-0279.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0279.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0279.txt 21 Mar 2002 05:54:14 -0000 1.8 --- pep-0279.txt 1 Apr 2002 16:04:27 -0000 1.9 *************** *** 13,17 **** Abstract ! This PEP introduces three orthogonal (not mutually exclusive) ideas for enhancing the generators introduced in Python version 2.2 [1]. The goal is to increase the convenience, utility, and power --- 13,17 ---- Abstract ! This PEP introduces two orthogonal (not mutually exclusive) ideas for enhancing the generators introduced in Python version 2.2 [1]. The goal is to increase the convenience, utility, and power *************** *** 50,54 **** The next steps in the evolution of generators are: ! 1. Add a new builtin function, indexed() which was made possible once iterators and generators became available. It provides all iterables with the same advantage that iteritems() affords --- 50,54 ---- The next steps in the evolution of generators are: ! 1. Add a new builtin function, iterindexed() which was made possible once iterators and generators became available. It provides all iterables with the same advantage that iteritems() affords *************** *** 59,75 **** a generator whenever memory issues arise. - 3. Add a generator method to enable exceptions to be passed to a - generator. Currently, there is no clean method for triggering - exceptions from outside the generator. Also, generator exception - passing helps mitigate the try/finally prohibition for generators. - All of the suggestions are designed to take advantage of the existing implementation and require little additional effort to incorporate. Each is backward compatible and requires no new ! keywords. The three generator tools go into Python 2.3 when generators become final and are not imported from __future__. Reference Implementation --- 59,81 ---- a generator whenever memory issues arise. All of the suggestions are designed to take advantage of the existing implementation and require little additional effort to incorporate. Each is backward compatible and requires no new ! keywords. The two generator tools go into Python 2.3 when generators become final and are not imported from __future__. + BDFL Pronouncements + + 1. The new built-in function is ACCEPTED. There needs to be further + discussion on the best name for the function. + + 2. Generator comprehensions are REJECTED. The rationale is that + the benefits are marginal since generators can already be coded directly + and the costs are high because implementation and maintenance require + major efforts with the parser. + + Reference Implementation *************** *** 92,104 **** ! Specification for a new builtin: ! def indexed(collection, start=0, stop=None): ! 'Generates an indexed series: (0,seqn[0]), (1,seqn[1]) ...' ! gen = iter(collection) ! cnt = start ! while stop is None or cnt Update of /cvsroot/python/python/nondist/sf-html In directory usw-pr-cvs1:/tmp/cvs-serv24871 Modified Files: index.html Log Message: Update links to development versions of the documentation. Index: index.html =================================================================== RCS file: /cvsroot/python/python/nondist/sf-html/index.html,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** index.html 7 Mar 2002 18:56:32 -0000 1.13 --- index.html 1 Apr 2002 20:21:35 -0000 1.14 *************** *** 36,45 ****
    • ! Maintenance version of the documentation - Built from Python's bug-fix branch.
    • ! Development version of the documentation - Straight from Fred's working files.
    • --- 36,47 ----
    • ! Maintenance version of the documentation - Built from Python's bug-fix branch.
    • ! Development version of the documentation - Straight from Fred's working files.
    • From loewis@users.sourceforge.net Mon Apr 1 17:40:13 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Mon, 01 Apr 2002 09:40:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.77,2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15405 Modified Files: cPickle.c Log Message: Reindent. Break long lines. Move comments before the statements. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -d -r2.77 -r2.78 *** cPickle.c 1 Apr 2002 12:34:33 -0000 2.77 --- cPickle.c 1 Apr 2002 17:40:08 -0000 2.78 *************** *** 150,174 **** typedef struct { ! PyObject_HEAD ! int length, size; ! PyObject **data; } Pdata; static void ! Pdata_dealloc(Pdata *self) { ! int i; [...8884 lines suppressed...] ! PyDict_SetItemString(d,"__version__", v = PyString_FromString(rev)); ! Py_XDECREF(v); ! /* Copy data from di. Waaa. */ ! for (i=0; PyDict_Next(di, &i, &k, &v); ) { ! if (PyObject_SetItem(d, k, v) < 0) { ! Py_DECREF(di); ! return; ! } ! } ! Py_DECREF(di); ! format_version = PyString_FromString("1.3"); ! compatible_formats = Py_BuildValue("[sss]", "1.0", "1.1", "1.2"); ! PyDict_SetItemString(d, "format_version", format_version); ! PyDict_SetItemString(d, "compatible_formats", compatible_formats); ! Py_XDECREF(format_version); ! Py_XDECREF(compatible_formats); } From fdrake@users.sourceforge.net Mon Apr 1 20:13:11 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 12:13:11 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.6.2.3,1.6.2.4 update-docs.sh,1.6.2.2,1.6.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv22681 Modified Files: Tag: release21-maint push-docs.sh update-docs.sh Log Message: Update to push the docs to python.org instead of python.sf.net. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -C2 -d -r1.6.2.3 -r1.6.2.4 *** push-docs.sh 10 Jan 2002 23:10:20 -0000 1.6.2.3 --- push-docs.sh 1 Apr 2002 20:13:08 -0000 1.6.2.4 *************** *** 4,8 **** # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/f/fd/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' --- 4,11 ---- # update-docs.sh script unpacks them into their final destination. ! TARGETHOST=www.python.org ! TARGETDIR=/usr/home/fdrake/tmp ! ! TARGET="$TARGETHOST:$TARGETDIR" ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' *************** *** 69,73 **** PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh python.sourceforge.net tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? if $ANNOUNCE ; then --- 72,76 ---- PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? if $ANNOUNCE ; then *************** *** 79,83 **** The $DOCLABEL version of the documentation has been updated: ! http://python.sourceforge.net/$DOCTYPE-docs/ $EXPLANATION --- 82,86 ---- The $DOCLABEL version of the documentation has been updated: ! http://$TARGETHOST/dev/doc/$DOCTYPE/ $EXPLANATION Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -C2 -d -r1.6.2.2 -r1.6.2.3 *** update-docs.sh 9 May 2001 16:26:36 -0000 1.6.2.2 --- update-docs.sh 1 Apr 2002 20:13:08 -0000 1.6.2.3 *************** *** 2,8 **** # Script which installs a development snapshot of the documentation ! # into the "Python @ SourceForge" website. # ! # The push-docs.sh script pushes this to the SourceForge when needed # and removes it when done. --- 2,8 ---- # Script which installs a development snapshot of the documentation ! # into the development website. # ! # The push-docs.sh script pushes this to the server when needed # and removes it when done. *************** *** 17,21 **** TMPDIR="$$-docs" ! cd /home/groups/p/py/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? --- 17,21 ---- TMPDIR="$$-docs" ! cd /ftp/ftp.python.org/pub/www.python.org/dev/doc/ || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? *************** *** 23,30 **** cd .. || exit $? ! if [ -d $DOCTYPE-docs ] ; then ! mv $DOCTYPE-docs $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE-docs rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? --- 23,30 ---- cd .. || exit $? ! if [ -d $DOCTYPE ] ; then ! mv $DOCTYPE $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? From gvanrossum@users.sourceforge.net Mon Apr 1 15:20:50 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 01 Apr 2002 07:20:50 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0285.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10878 Modified Files: pep-0285.txt Log Message: Finish incomplete sentence. Index: pep-0285.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pep-0285.txt 31 Mar 2002 23:02:27 -0000 1.15 --- pep-0285.txt 1 Apr 2002 15:20:47 -0000 1.16 *************** *** 47,51 **** => Most reviewers prefer str(True) == "True" (which may mean that ! they don't appreciate the specific 3) Should the constants be called 'True' and 'False' --- 47,52 ---- => Most reviewers prefer str(True) == "True" (which may mean that ! they don't appreciate the specific backwards compatibility ! issue brought up br Marc-Andre Lemburg :-). 3) Should the constants be called 'True' and 'False' From jhylton@users.sourceforge.net Mon Apr 1 18:53:38 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 01 Apr 2002 10:53:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv2515 Modified Files: ref3.tex Log Message: Update documentation of code objects. Split the description of co_flags into two paragraphs. The first describes the flags that are used for non-future purposes, where CO_GENERATOR was added. The second describes __future__'s use of co_flags and mentions the only one currently meaningful, CO_FUTURE_DIVISION. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** ref3.tex 1 Apr 2002 17:58:39 -0000 1.83 --- ref3.tex 1 Apr 2002 18:53:36 -0000 1.84 *************** *** 731,736 **** a tuple containing the names of local variables that are referenced by nested functions; \member{co_freevars} is a tuple containing the names ! of local variables that are neither local nor global; \member{co_code} ! is a string representing the sequence of bytecode instructions; \member{co_consts} is a tuple containing the literals used by the bytecode; \member{co_names} is a tuple containing the names used by --- 731,736 ---- a tuple containing the names of local variables that are referenced by nested functions; \member{co_freevars} is a tuple containing the names ! of free variables; \member{co_code} is a string representing the ! sequence of bytecode instructions; \member{co_consts} is a tuple containing the literals used by the bytecode; \member{co_names} is a tuple containing the names used by *************** *** 743,750 **** a number of flags for the interpreter. - The \member{co_cellvars} and \member{co_freevars} are present in - Python 2.1 when nested scopes are not enabled, but the code itself - does not use or create cells. - \withsubitem{(code object attribute)}{ \ttindex{co_argcount} --- 743,746 ---- *************** *** 767,774 **** to accept an arbitrary number of positional arguments; bit \code{0x08} is set if the function uses the \samp{**keywords} syntax ! to accept arbitrary keyword arguments; other bits are used internally ! or reserved for future use; bit \code{0x10} is set if the function was ! compiled with nested scopes enabled. If\index{documentation string} a ! code object represents a function, the first item in \member{co_consts} is the documentation string of the function, or \code{None} if undefined. --- 763,779 ---- to accept an arbitrary number of positional arguments; bit \code{0x08} is set if the function uses the \samp{**keywords} syntax ! to accept arbitrary keyword arguments; bit \code{0x20} is set if the ! function is a \obindex{generator}. ! ! Future feature declarations (\samp{from __future__ import division}) ! also use bits in \member{co_flags} to indicate whether a code object ! was compiled with a particular feature enabled: bit \code{0x2000} is ! set if the function was compiled with future division enabled; bits ! \code{0x10} and \code{0x1000} were used in earlier versions of Python. ! ! Other bits in \member{co_flags} are reserved for internal use. ! ! If\index{documentation string} a code object represents a function, ! the first item in \member{co_consts} is the documentation string of the function, or \code{None} if undefined. From jhylton@users.sourceforge.net Mon Apr 1 20:38:04 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 01 Apr 2002 12:38:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref4.tex,1.28,1.29 refa1.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv30232 Modified Files: ref4.tex refa1.tex Log Message: Update docs for nested scopes. Replace section 4.1 with section A.3. The new section 4.1 is titled "Naming and binding." It includes the text of section A.3 augmented with some of the detailed text from the old section 4.1. The \dfn, \index stuff is probably wrong, but I tried. Also update other parts of appendix A to mention that nested scopes and generators are standard features. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ref4.tex 23 Jun 2001 05:27:20 -0000 1.28 --- ref4.tex 1 Apr 2002 20:38:01 -0000 1.29 *************** *** 3,165 **** ! \section{Code blocks, execution frames, and namespaces \label{execframes}} ! \index{code block} \index{namespace} ! \indexii{execution}{frame} ! A \dfn{code block}\indexii{code}{block} is a piece ! of Python program text that can be executed as a unit, such as a ! module, a class definition or a function body. Some code blocks (like ! modules) are normally executed only once, others (like function ! bodies) may be executed many times. Code blocks may textually contain ! other code blocks. Code blocks may invoke other code blocks (that may ! or may not be textually contained in them) as part of their execution, ! e.g., by invoking (calling) a function. ! The following are code blocks: A module is a code block. A function ! body is a code block. A class definition is a code block. Each ! command typed interactively is a separate code block; a script file (a ! file given as standard input to the interpreter or specified on the ! interpreter command line the first argument) is a code block; a script ! command (a command specified on the interpreter command line with the ! `\strong{-c}' option) is a code block. The file read by the built-in ! function \function{execfile()} is a code block. The string argument ! passed to the built-in function \function{eval()} and to the ! \keyword{exec} statement is a code block. And finally, the expression ! read and evaluated by the built-in function \function{input()} is a ! code block. ! A code block is executed in an execution frame. An \dfn{execution ! frame}\indexii{execution}{frame} contains some administrative ! information (used for debugging), determines where and how execution ! continues after the code block's execution has completed, and (perhaps ! most importantly) defines two namespaces, the local and the global ! namespace, that affect execution of the code block. ! A \dfn{namespace}\index{namespace} is a mapping from names ! (identifiers) to objects. A particular namespace may be referenced by ! more than one execution frame, and from other places as well. Adding ! a name to a namespace is called \dfn{binding}\indexii{binding}{name} a ! name (to an object); changing the mapping of a name is called ! \dfn{rebinding}\indexii{rebinding}{name}; removing a name is ! \dfn{unbinding}\indexii{unbinding}{name}. Namespaces are functionally ! equivalent to dictionaries (and often implemented as dictionaries). ! The \dfn{local namespace}\indexii{local}{namespace} of an execution ! frame determines the default place where names are defined and ! searched. The ! \dfn{global namespace}\indexii{global}{namespace} determines the place ! where names listed in \keyword{global}\stindex{global} statements are ! defined and searched, and where names that are not bound anywhere in ! the current code block are searched. ! Whether a name is local or global in a code block is determined by ! static inspection of the source text for the code block: in the ! absence of \keyword{global} statements, a name that is bound anywhere ! in the code block is local in the entire code block; all other names ! are considered global. The \keyword{global} statement forces global ! interpretation of selected names throughout the code block. The ! following constructs bind names: formal parameters to functions, \keyword{import} statements, class and function definitions (these bind the class or function name in the defining block), and targets that are identifiers if occurring in an assignment, \keyword{for} loop header, or in the second position of an \keyword{except} clause ! header. Local names are searched only on the local namespace; global ! names are searched only in the global and built-in ! namespace.\footnote{ ! If the code block contains \keyword{exec} statements or the ! construct ``\samp{from \ldots import *}'', the semantics of local ! names change: local name lookup first searches the local namespace, ! then the global namespace and the built-in namespace.} A target occurring in a \keyword{del} statement is also considered bound ! for this purpose (though the actual semantics are to ``unbind'' the ! name). ! When a global name is not found in the global namespace, it is ! searched in the built-in namespace (which is actually the global ! namespace of the module ! \module{__builtin__}\refbimodindex{__builtin__}). The built-in ! namespace associated with the execution of a code block is actually ! found by looking up the name \code{__builtins__} in its global ! namespace; this should be a dictionary or a module (in the latter case ! its dictionary is used). Normally, the \code{__builtins__} namespace ! is the dictionary of the built-in module \module{__builtin__} (note: ! no `s'); if it isn't, restricted ! execution\indexii{restricted}{execution} mode is in effect. When a ! name is not found at all, a ! \exception{NameError}\withsubitem{(built-in ! exception)}{\ttindex{NameError}} exception is raised. ! \stindex{from} ! \stindex{exec} ! \stindex{global} ! The following table lists the meaning of the local and global ! namespace for various types of code blocks. The namespace for a ! particular module is automatically created when the module is first ! imported (i.e., when it is loaded). Note that in almost all cases, ! the global namespace is the namespace of the containing module --- ! scopes in Python do not nest! ! \begin{tableiv}{l|l|l|l}{textrm} ! {Code block type}{Global namespace}{Local namespace}{Notes} ! \lineiv{Module} ! {n.s. for this module} ! {same as global}{} ! \lineiv{Script (file or command)} ! {n.s. for \module{__main__}\refbimodindex{__main__}} ! {same as global}{(1)} ! \lineiv{Interactive command} ! {n.s. for \module{__main__}\refbimodindex{__main__}} ! {same as global}{} ! \lineiv{Class definition} ! {global n.s. of containing block} ! {new n.s.}{} ! \lineiv{Function body} ! {global n.s. of containing block} ! {new n.s.}{(2)} ! \lineiv{String passed to \keyword{exec} statement} ! {global n.s. of containing block} ! {local n.s. of containing block}{(2), (3)} ! \lineiv{String passed to \function{eval()}} ! {global n.s. of caller} ! {local n.s. of caller}{(2), (3)} ! \lineiv{File read by \function{execfile()}} ! {global n.s. of caller} ! {local n.s. of caller}{(2), (3)} ! \lineiv{Expression read by \function{input()}} ! {global n.s. of caller} ! {local n.s. of caller}{} ! \end{tableiv} ! Notes: ! \begin{description} ! \item[n.s.] means \emph{namespace} ! \item[(1)] The main module for a script is always called ! \module{__main__}; ``the filename don't enter into it.'' ! \item[(2)] The global and local namespace for these can be ! overridden with optional extra arguments. ! \item[(3)] The \keyword{exec} statement and the \function{eval()} and ! \function{execfile()} functions have optional arguments to override ! the global and local namespace. If only one namespace is specified, ! it is used for both. ! \end{description} ! The built-in functions \function{globals()} and \function{locals()} returns a ! dictionary representing the current global and local namespace, ! respectively. The effect of modifications to this dictionary on the ! namespace are undefined.\footnote{ ! The current implementations return the dictionary actually used to ! implement the namespace, \emph{except} for functions, where the ! optimizer may cause the local namespace to be implemented ! differently, and \function{locals()} returns a read-only ! dictionary.} \section{Exceptions \label{exceptions}} --- 3,146 ---- ! \section{Naming and binding \label{naming}} ! \indexii{code}{block} \index{namespace} ! \index{scope} ! \dfn{Names}\index{name} refer to objects. Names are introduced by ! name binding operations. Each occurrence of a name in the program ! text refers to the \dfn{binding}\indexii{binding}{name} of that name ! established in the innermost function block containing the use. ! A \dfn{block}\index{block} is a piece of Python program text that is ! executed as a unit. The following are blocks: a module, a function ! body, and a class definition. Each command typed interactively is a ! block. A script file (a file given as standard input to the ! interpreter or specified on the interpreter command line the first ! argument) is a code block. A script command (a command specified on ! the interpreter command line with the `\strong{-c}' option) is a code ! block. The file read by the built-in function \function{execfile()} ! is a code block. The string argument passed to the built-in function ! \function{eval()} and to the \keyword{exec} statement is a code block. ! The expression read and evaluated by the built-in function ! \function{input()} is a code block. ! A \dfn{scope}\index{scope} defines the visibility of a name within a ! block. If a local variable is defined in a block, it's scope includes ! that block. If the definition occurs in a function block, the scope ! extends to any blocks contained within the defining one, unless a ! contained block introduces a different binding for the name. The ! scope of names defined in a class block is limited to the class block; ! it does not extend to the code blocks of methods. ! When a name is used in a code block, it is resolved using the nearest ! enclosing scope. The set of all such scopes visible to a code block ! is called the block's \dfn{environment}\index{environment}. ! If a name is bound in a block, it is a local variable of that block. ! If a name is bound at the module level, it is a global variable. (The ! variables of the module code block are local and global.) If a ! variable is used in a code block but not defined there, it is a ! \dfn{free variable}\indexii{free}{variable}. ! When a name is not found at all, a ! \exception{NameError}\withsubitem{(built-in ! exception)}{\ttindex{NameError}} exception is raised. If the name ! refers to a local variable that has not been bound, a ! \exception{UnboundLocalError}\ttindex{UnboundLocalError} exception is ! raised. \exception{UnboundLocalError} is a subclass of ! \exception{NameError}. ! ! The following constructs bind names: formal parameters to functions, \keyword{import} statements, class and function definitions (these bind the class or function name in the defining block), and targets that are identifiers if occurring in an assignment, \keyword{for} loop header, or in the second position of an \keyword{except} clause ! header. The \keyword{import} statement of the form ``\samp{from ! \ldots import *}''\stindex{from} binds all names defined in the ! imported module, except those beginning with an underscore. This form ! may only be used at the module level. A target occurring in a \keyword{del} statement is also considered bound ! for this purpose (though the actual semantics are to unbind the ! name). It is illegal to unbind a name that is referenced by an ! enclosing scope; the compiler will report a \exception{SyntaxError}. ! Each assignment or import statement occurs within a block defined by a ! class or function definition or at the module level (the top-level ! code block). ! If a name binding operation occurs anywhere within a code block, all ! uses of the name within the block are treated as references to the ! current block. This can lead to errors when a name is used within a ! block before it is bound. ! The previous rule is a subtle. Python lacks declarations and allows ! name binding operations to occur anywhere within a code block. The ! local variables of a code block can be determined by scanning the ! entire text of the block for name binding operations. ! If the global statement occurs within a block, all uses of the name ! specified in the statement refer to the binding of that name in the ! top-level namespace. Names are resolved in the top-level namespace by ! searching the global namespace, i.e. the namespace of the module ! containing the code block, and the builtin namespace, the namespace of ! the module \module{__builtin__}. The global namespace is searched ! first. If the name is not found there, the builtin namespace is ! searched. The global statement must precede all uses of the name. ! The built-in namespace associated with the execution of a code block ! is actually found by looking up the name \code{__builtins__} in its ! global namespace; this should be a dictionary or a module (in the ! latter case the module's dictionary is used). Normally, the ! \code{__builtins__} namespace is the dictionary of the built-in module ! \module{__builtin__} (note: no `s'). If it isn't, restricted ! execution\indexii{restricted}{execution} mode is in effect. ! The namespace for a module is automatically created the first time a ! module is imported. The main module for a script is always called ! \module{__main__}\refbimodindex{__main__}. ! The global statement has the same scope as a name binding operation ! in the same block. If the nearest enclosing scope for a free variable ! contains a global statement, the free variable is treated as a global. ! A class definition is an executable statement that may use and define ! names. These references follow the normal rules for name resolution. ! The namespace of the class definition becomes the attribute dictionary ! of the class. Names defined at the class scope are not visible in ! methods. ! \subsection{Interaction with dynamic features \label{dynamic-features}} ! There are several cases where Python statements are illegal when ! used in conjunction with nested scopes that contain free ! variables. ! If a variable is referenced in an enclosing scope, it is illegal ! to delete the name. An error will be reported at compile time. ! ! If the wild card form of import --- \samp{import *} --- is used in a ! function and the function contains or is a nested block with free ! variables, the compiler will raise a SyntaxError. + If \keyword{exec} is used in a function and the function contains or + is a nested block with free variables, the compiler will raise a + \exception{SyntaxError} unless the exec explicitly specifies the local + namespace for the \keyword{exec}. (In other words, \samp{exec obj} + would be illegal, but \samp{exec obj in ns} would be legal.) + + The \function{eval()}, \function{execfile()}, and \function{input()} + functions and the \keyword{exec} statement do not have access to the + full environment for resolving names. Names may be resolved in the + local and global namespaces of the caller. Free variables are not + resolved in the nearest enclosing namespace, but in the global + namespace.\footnote{This limitation occurs because the code that is + executed by these operations is not available at the time the + module is compiled.} + The \keyword{exec} statement and the \function{eval()} and + \function{execfile()} functions have optional arguments to override + the global and local namespace. If only one namespace is specified, + it is used for both. \section{Exceptions \label{exceptions}} Index: refa1.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/refa1.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** refa1.tex 15 Mar 2002 23:21:37 -0000 1.11 --- refa1.tex 1 Apr 2002 20:38:01 -0000 1.12 *************** *** 41,47 **** \end{itemize} ! The features recognized by Python 2.2 are \samp{generators}, ! \samp{division} and \samp{nested_scopes}. \samp{nested_scopes} ! is redundant in 2.2 as the nested scopes feature is active by default. A future statement is recognized and treated specially at compile --- 41,48 ---- \end{itemize} ! The features recognized by Python 2.3 are \samp{generators}, ! \samp{division} and \samp{nested_scopes}. \samp{generators} and ! \samp{nested_scopes} are redundant in 2.3 because they are always ! enabled. A future statement is recognized and treated specially at compile *************** *** 158,264 **** No feature description will ever be deleted from \module{__future__}. - \section{Nested scopes \label{nested-scopes}} - \indexii{nested}{scopes} - - This section defines the new scoping semantics that will be introduced - in Python 2.2. They are available in Python 2.1 by using the future - statement \samp{nested_scopes}. This section begins with a bit of - terminology. - - \subsection{Definitions and rules \label{definitions}} - - \dfn{Names} refer to objects. Names are introduced by name binding - operations. Each occurrence of a name in the program text refers to - the binding of that name established in the innermost function block - containing the use. - - A \dfn{block} is a piece of Python program text that is executed as - a unit. The following are blocks: a module, a function body, and a - class definition. - - A \dfn{scope} defines the visibility of a name within a block. If a - local variable is defined in a block, it's scope includes that block. - If the definition occurs in a function block, the scope extends to any - blocks contained within the defining one, unless a contained block - introduces a different binding for the name. The scope of names - defined in a class block is limited to the class block; it does not - extend to the code blocks of methods. - - When a name is used in a code block, it is resolved using the nearest - enclosing scope. The set of all such scopes visible to a code block - is called the block's \dfn{environment}. - - If a name is bound in a block, it is a local variable of that block. - If a name is bound at the module level, it is a global variable. (The - variables of the module code block are local and global.) If a - variable is used in a code block but not defined there, it is a - \dfn{free variable}. - - The name binding operations are assignment, class and function - definition, import statements, for statements, and except statements. - Each assignment or import statement occurs within a block defined by a - class or function definition or at the module level (the top-level - code block). - - If a name binding operation occurs anywhere within a code block, all - uses of the name within the block are treated as references to the - current block. This can lead to errors when a name is used within a - block before it is bound. - - The previous rule is a subtle. Python lacks declarations and allows - name binding operations to occur anywhere within a code block. The - local variables of a code block can be determined by scanning the - entire text of the block for name binding operations. - - If the global statement occurs within a block, all uses of the name - specified in the statement refer to the binding of that name in the - top-level namespace. Names are resolved in the top-level namespace by - searching the global namespace, i.e. the namespace of the module - containing the code block, and the builtin namespace, the namespace of - the module \module{__builtin__}. The global namespace is searched - first. If the name is not found there, the builtin namespace is - searched. The global statement must precede all uses of the name. - - The global statement has the same scope as a name binding operation - in the same block. If the nearest enclosing scope for a free variable - contains a global statement, the free variable is treated as a global. - - A class definition is an executable statement that may use and define - names. These references follow the normal rules for name resolution. - The namespace of the class definition becomes the attribute dictionary - of the class. Names defined at the class scope are not visible in - methods. - - \subsection{Interaction with dynamic features \label{dynamic-features}} - - There are several cases where Python statements are illegal when - used in conjunction with nested scopes that contain free - variables. - - If a variable is referenced in an enclosing scope, it is illegal - to delete the name. An error will be reported at compile time. - - If the wild card form of import --- \samp{import *} --- is used in a - function and the function contains or is a nested block with free - variables, the compiler will raise a SyntaxError. - - If exec is used in a function and the function contains or is a nested - block with free variables, the compiler will raise a SyntaxError - unless the exec explicitly specifies the local namespace for the exec. - (In other words, "exec obj" would be illegal, but "exec obj in ns" - would be legal.) - - The builtin functions \function{eval()} and \function{input()} can not - access free variables unless the variables are also referenced by the - program text of the block that contains the call to \function{eval()} - or \function{input()}. - - \emph{Compatibility note}: The compiler for Python 2.1 will issue - warnings for uses of nested functions that will behave differently - with nested scopes. The warnings will not be issued if nested scopes - are enabled via a future statement. If a name bound in a function - scope and the function contains a nested function scope that uses the - name, the compiler will issue a warning. The name resolution rules - will result in different bindings under Python 2.1 than under Python - 2.2. The warning indicates that the program may not run correctly - with all versions of Python. --- 159,160 ---- From jhylton@users.sourceforge.net Mon Apr 1 17:58:43 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 01 Apr 2002 09:58:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv20297 Modified Files: ref3.tex Log Message: Small fixes for description of function attributes. func_closure is a readonly attribute. Add \ttindex{} for func_closure. Remove discussion of func_closure specific to 2.1. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** ref3.tex 14 Dec 2001 22:52:41 -0000 1.82 --- ref3.tex 1 Apr 2002 17:58:39 -0000 1.83 *************** *** 415,421 **** namespace supporting arbitrary function attributes; \member{func_closure} is \code{None} or a tuple of cells that contain ! binding for the function's free variables. ! Of these, \member{func_code}, \member{func_defaults}, \member{func_closure}, \member{func_doc}/\member{__doc__}, and \member{func_dict}/\member{__dict__} may be writable; the --- 415,421 ---- namespace supporting arbitrary function attributes; \member{func_closure} is \code{None} or a tuple of cells that contain ! bindings for the function's free variables. ! Of these, \member{func_code}, \member{func_defaults}, \member{func_doc}/\member{__doc__}, and \member{func_dict}/\member{__dict__} may be writable; the *************** *** 424,430 **** description of internal types below. - In Python 2.1, the \member{func_closure} slot is always \code{None} - unless nested scopes are enabled. (See the appendix.) - \withsubitem{(function attribute)}{ \ttindex{func_doc} --- 424,427 ---- *************** *** 433,436 **** --- 430,434 ---- \ttindex{__dict__} \ttindex{func_defaults} + \ttindex{func_closure} \ttindex{func_code} \ttindex{func_globals} From fdrake@users.sourceforge.net Mon Apr 1 20:15:07 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 12:15:07 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.13,1.14 update-docs.sh,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv23166 Modified Files: push-docs.sh update-docs.sh Log Message: Update to push the docs to python.org instead of python.sf.net. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** push-docs.sh 25 Oct 2001 15:13:30 -0000 1.13 --- push-docs.sh 1 Apr 2002 20:15:05 -0000 1.14 *************** *** 4,8 **** # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/f/fd/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' --- 4,11 ---- # update-docs.sh script unpacks them into their final destination. ! TARGETHOST=www.python.org ! TARGETDIR=/usr/home/fdrake/tmp ! ! TARGET="$TARGETHOST:$TARGETDIR" ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' *************** *** 69,73 **** PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh python.sourceforge.net tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? if $ANNOUNCE ; then --- 72,76 ---- PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? if $ANNOUNCE ; then *************** *** 79,83 **** The $DOCLABEL version of the documentation has been updated: ! http://python.sourceforge.net/$DOCTYPE-docs/ $EXPLANATION --- 82,86 ---- The $DOCLABEL version of the documentation has been updated: ! http://$TARGETHOST/dev/doc/$DOCTYPE/ $EXPLANATION Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** update-docs.sh 9 May 2001 16:33:34 -0000 1.8 --- update-docs.sh 1 Apr 2002 20:15:05 -0000 1.9 *************** *** 2,8 **** # Script which installs a development snapshot of the documentation ! # into the "Python @ SourceForge" website. # ! # The push-docs.sh script pushes this to the SourceForge when needed # and removes it when done. --- 2,8 ---- # Script which installs a development snapshot of the documentation ! # into the development website. # ! # The push-docs.sh script pushes this to the server when needed # and removes it when done. *************** *** 17,21 **** TMPDIR="$$-docs" ! cd /home/groups/p/py/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? --- 17,21 ---- TMPDIR="$$-docs" ! cd /ftp/ftp.python.org/pub/www.python.org/dev/doc/ || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? *************** *** 23,30 **** cd .. || exit $? ! if [ -d $DOCTYPE-docs ] ; then ! mv $DOCTYPE-docs $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE-docs rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? --- 23,30 ---- cd .. || exit $? ! if [ -d $DOCTYPE ] ; then ! mv $DOCTYPE $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? From fdrake@users.sourceforge.net Mon Apr 1 20:13:53 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 12:13:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.13,1.13.8.1 update-docs.sh,1.8,1.8.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv22869 Modified Files: Tag: release22-maint push-docs.sh update-docs.sh Log Message: Update to push the docs to python.org instead of python.sf.net. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.13 retrieving revision 1.13.8.1 diff -C2 -d -r1.13 -r1.13.8.1 *** push-docs.sh 25 Oct 2001 15:13:30 -0000 1.13 --- push-docs.sh 1 Apr 2002 20:13:50 -0000 1.13.8.1 *************** *** 4,8 **** # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/f/fd/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' --- 4,11 ---- # update-docs.sh script unpacks them into their final destination. ! TARGETHOST=www.python.org ! TARGETDIR=/usr/home/fdrake/tmp ! ! TARGET="$TARGETHOST:$TARGETDIR" ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' *************** *** 69,73 **** PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh python.sourceforge.net tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? if $ANNOUNCE ; then --- 72,76 ---- PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ! ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? if $ANNOUNCE ; then *************** *** 79,83 **** The $DOCLABEL version of the documentation has been updated: ! http://python.sourceforge.net/$DOCTYPE-docs/ $EXPLANATION --- 82,86 ---- The $DOCLABEL version of the documentation has been updated: ! http://$TARGETHOST/dev/doc/$DOCTYPE/ $EXPLANATION Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.8 retrieving revision 1.8.18.1 diff -C2 -d -r1.8 -r1.8.18.1 *** update-docs.sh 9 May 2001 16:33:34 -0000 1.8 --- update-docs.sh 1 Apr 2002 20:13:50 -0000 1.8.18.1 *************** *** 2,8 **** # Script which installs a development snapshot of the documentation ! # into the "Python @ SourceForge" website. # ! # The push-docs.sh script pushes this to the SourceForge when needed # and removes it when done. --- 2,8 ---- # Script which installs a development snapshot of the documentation ! # into the development website. # ! # The push-docs.sh script pushes this to the server when needed # and removes it when done. *************** *** 17,21 **** TMPDIR="$$-docs" ! cd /home/groups/p/py/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? --- 17,21 ---- TMPDIR="$$-docs" ! cd /ftp/ftp.python.org/pub/www.python.org/dev/doc/ || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? *************** *** 23,30 **** cd .. || exit $? ! if [ -d $DOCTYPE-docs ] ; then ! mv $DOCTYPE-docs $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE-docs rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? --- 23,30 ---- cd .. || exit $? ! if [ -d $DOCTYPE ] ; then ! mv $DOCTYPE $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? From jhylton@users.sourceforge.net Mon Apr 1 20:52:26 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 01 Apr 2002 12:52:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv1508 Modified Files: ref5.tex Log Message: Update / simplify Identifiers section for nested scopes. How do I create a cross reference to section 4.1? Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** ref5.tex 18 Mar 2002 16:47:14 -0000 1.56 --- ref5.tex 1 Apr 2002 20:52:24 -0000 1.57 *************** *** 64,85 **** \index{identifier} ! An identifier occurring as an atom is a reference to a local, global ! or built-in name binding. If a name is assigned to anywhere in a code ! block (even in unreachable code), and is not mentioned in a ! \keyword{global} statement in that code block, then it refers to a local ! name throughout that code block. When it is not assigned to anywhere ! in the block, or when it is assigned to but also explicitly listed in ! a \keyword{global} statement, it refers to a global name if one exists, ! else to a built-in name (and this binding may dynamically ! change).\footnote{The Python interpreter provides a useful set of ! predefined built-in functions. It is not recommended to reuse ! (hide) these names with self defined objects. See the ! \citetitle[../lib/built-in-funcs.html]{Python Library Reference} for ! the descriptions of built-in functions and methods.} ! \indexii{name}{binding} ! \index{code block} ! \stindex{global} ! \indexii{built-in}{name} ! \indexii{global}{name} When the name is bound to an object, evaluation of the atom yields --- 64,69 ---- \index{identifier} ! An identifier occurring as an atom is a name. See Section 4.1 for ! documentation of naming and binding. When the name is bound to an object, evaluation of the atom yields From fdrake@users.sourceforge.net Mon Apr 1 18:59:26 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 10:59:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.88.4.2,1.88.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv4106/texinputs Modified Files: Tag: release22-maint python.sty Log Message: Update from trunk: - make \url force horizontal mode (so it works at the start of a line) - make \verbatiminput produce results that look like a verbatim environment Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.88.4.2 retrieving revision 1.88.4.3 diff -C2 -d -r1.88.4.2 -r1.88.4.3 *** python.sty 16 Mar 2002 04:52:55 -0000 1.88.4.2 --- python.sty 1 Apr 2002 18:59:24 -0000 1.88.4.3 *************** *** 176,179 **** --- 176,180 ---- \let\py@OldEndVerbatim=\endverbatim \RequirePackage{verbatim} + \let\py@OldVerbatimInput=\verbatiminput % Variable used by begin code command *************** *** 181,197 **** \renewcommand{\verbatim}{% ! \setlength{\parindent}{1cm}% ! % Calculate the text width for the minipage: ! \setlength{\py@codewidth}{\linewidth}% ! \addtolength{\py@codewidth}{-\parindent}% ! % ! \par\indent% ! \begin{minipage}[t]{\py@codewidth}% ! \small% \py@OldVerbatim% } \renewcommand{\endverbatim}{% \py@OldEndVerbatim% ! \end{minipage}% } --- 182,203 ---- \renewcommand{\verbatim}{% ! \begingroup% ! \small% ! \begin{list}{}{\setlength{\leftmargin}{1cm}} ! \item% \py@OldVerbatim% } \renewcommand{\endverbatim}{% \py@OldEndVerbatim% ! \end{list}% ! \endgroup ! } ! \renewcommand{\verbatiminput}[1]{% ! {\small% ! \begin{list}{}{\setlength{\leftmargin}{1cm}} ! \item% ! \py@OldVerbatimInput{#1}% ! \end{list} ! }% } *************** *** 797,800 **** --- 803,807 ---- \ifpdf \newcommand{\url}[1]{{% + \noindent% \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% \py@LinkColor% color of the link text From loewis@users.sourceforge.net Mon Apr 1 16:45:54 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Mon, 01 Apr 2002 08:45:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules mpzmodule.c,2.36,2.36.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1201 Modified Files: Tag: release21-maint mpzmodule.c Log Message: backport gvanrossum's checkin of revision 2.40 of mpzmodule.c SF patch 517245 by Marc Recht. Support GMP version >= 2. Index: mpzmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v retrieving revision 2.36 retrieving revision 2.36.4.1 diff -C2 -d -r2.36 -r2.36.4.1 *** mpzmodule.c 12 Feb 2001 16:48:13 -0000 2.36 --- mpzmodule.c 1 Apr 2002 16:45:51 -0000 2.36.4.1 *************** *** 64,68 **** #include "gmp.h" ! #if __GNU_MP__ + 0 == 2 #define GMP2 #define BITS_PER_MP_LIMB mp_bits_per_limb --- 64,68 ---- #include "gmp.h" ! #if __GNU_MP__ + 0 >= 2 #define GMP2 #define BITS_PER_MP_LIMB mp_bits_per_limb From fdrake@users.sourceforge.net Mon Apr 1 18:49:48 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 01 Apr 2002 10:49:48 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/html index.html.in,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv1549/html Modified Files: index.html.in Log Message: Minor adjustments. Index: index.html.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/index.html.in,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** index.html.in 26 Mar 2002 20:29:11 -0000 1.15 --- index.html.in 1 Apr 2002 18:49:45 -0000 1.16 *************** *** 2,9 **** Python @RELEASE@ Documentation - @DATE@ ! ' print >> fo, '' # body ! print >> fo, '' ! print >> fo, '> fo, ' width="100%" border="0">' ! print >> fo, '' ! print >> fo, '' print >> fo, '
      \n' for k, v in header: *************** *** 181,189 **** else: v = cgi.escape(v) ! print >> fo, ' ' % ( ! cgi.escape(k), v) print >> fo, '
      %s:%s
      ' print >> fo, '
      ' print >> fo, '
      ' print >> fo, '
      '
            while 1:
      --- 193,202 ----
                else:
                    v = cgi.escape(v)
      !         print >> fo, '  
    %s: %s
    ' print >> fo, '' print >> fo, '
    ' + print >> fo, '
    ' print >> fo, '
    '
          while 1:
    ***************
    *** 222,225 ****
    --- 235,239 ----
                  fo.write(line)
          print >> fo, '
    ' + print >> fo, '
    ' print >> fo, '' print >> fo, '' Index: style.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/style.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** style.css 27 Jul 2000 18:44:44 -0000 1.1 --- style.css 2 Apr 2002 23:07:13 -0000 1.2 *************** *** 1,7 **** ! .navigation { background: #99ccff; ! border: thin solid #ffffff; ! width: 100%; ! padding: 4pt; ! } ! .header th:after { content: " " } --- 1,15 ---- ! .navigation { width: 100%; ! background: #99ccff; } ! .navigation .navicon { width: 150px; ! height: 35; } ! .navigation .textlinks { padding-left: 1em; ! text-align: left; } ! ! .header, .content { margin-left: 1em; ! margin-right: 1em; ! padding-left: 1em; ! padding-right: 1em; } ! ! body { margin: 0px; ! padding: 0px; } From gvanrossum@users.sourceforge.net Tue Apr 2 17:53:49 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 02 Apr 2002 09:53:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21076/Lib/test Modified Files: test_descr.py Log Message: SF patch 537536 by Phillip J. Eby, fix for SF bug 535444, super() broken w/ classmethods. Bugfix candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** test_descr.py 1 Apr 2002 18:59:20 -0000 1.125 --- test_descr.py 2 Apr 2002 17:53:47 -0000 1.126 *************** *** 1215,1218 **** --- 1215,1226 ---- vereq(ff.__get__(0)(42), (int, 42)) + # Test super() with classmethods (SF bug 535444) + veris(C.goo.im_self, C) + veris(D.goo.im_self, D) + veris(super(D,D).goo.im_self, D) + veris(super(D,d).goo.im_self, D) + vereq(super(D,D).goo(), (D,)) + vereq(super(D,d).goo(), (D,)) + def classmethods_in_c(): if verbose: print "Testing C-based class methods..." From gvanrossum@users.sourceforge.net Tue Apr 2 17:53:49 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 02 Apr 2002 09:53:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.132,2.133 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21076/Objects Modified Files: typeobject.c Log Message: SF patch 537536 by Phillip J. Eby, fix for SF bug 535444, super() broken w/ classmethods. Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.132 retrieving revision 2.133 diff -C2 -d -r2.132 -r2.133 *** typeobject.c 31 Mar 2002 16:06:11 -0000 2.132 --- typeobject.c 2 Apr 2002 17:53:47 -0000 2.133 *************** *** 4022,4029 **** if (su->obj != NULL) { PyObject *mro, *res, *tmp, *dict; descrgetfunc f; int i, n; ! mro = su->obj->ob_type->tp_mro; if (mro == NULL) n = 0; --- 4022,4032 ---- if (su->obj != NULL) { PyObject *mro, *res, *tmp, *dict; + PyTypeObject *starttype; descrgetfunc f; int i, n; ! starttype = su->obj->ob_type; ! mro = starttype->tp_mro; ! if (mro == NULL) n = 0; *************** *** 4037,4041 **** } if (i >= n && PyType_Check(su->obj)) { ! mro = ((PyTypeObject *)(su->obj))->tp_mro; if (mro == NULL) n = 0; --- 4040,4045 ---- } if (i >= n && PyType_Check(su->obj)) { ! starttype = (PyTypeObject *)(su->obj); ! mro = starttype->tp_mro; if (mro == NULL) n = 0; *************** *** 4065,4069 **** f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, res); Py_DECREF(res); res = tmp; --- 4069,4073 ---- f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, (PyObject *)starttype); Py_DECREF(res); res = tmp; From nnorwitz@users.sourceforge.net Tue Apr 2 18:26:35 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Tue, 02 Apr 2002 10:26:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules sgimodule.c,1.18,1.19 imageop.c,2.26,2.27 clmodule.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30763 Modified Files: sgimodule.c imageop.c clmodule.c Log Message: Convert more METH_OLDARGS & PyArg_Parse() Please review. Index: sgimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sgimodule.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** sgimodule.c 17 Jan 2002 23:15:58 -0000 1.18 --- sgimodule.c 2 Apr 2002 18:26:33 -0000 1.19 *************** *** 12,16 **** { long ticks; ! if (!PyArg_Parse(args, "l", &ticks)) return NULL; Py_BEGIN_ALLOW_THREADS --- 12,16 ---- { long ticks; ! if (!PyArg_ParseTuple(args, "l:nap", &ticks)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 31,35 **** char *name; int fildes; ! if (!PyArg_Parse(args, "(iii)", &oflag, &mode, &nofork)) return NULL; errno = 0; --- 31,35 ---- char *name; int fildes; ! if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork)) return NULL; errno = 0; *************** *** 43,48 **** static PyMethodDef sgi_methods[] = { ! {"nap", sgi_nap, METH_OLDARGS}, ! {"_getpty", sgi__getpty, METH_OLDARGS}, {NULL, NULL} /* sentinel */ }; --- 43,48 ---- static PyMethodDef sgi_methods[] = { ! {"nap", sgi_nap, METH_VARARGS}, ! {"_getpty", sgi__getpty, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; Index: imageop.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/imageop.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** imageop.c 17 Jan 2002 23:15:58 -0000 2.26 --- imageop.c 2 Apr 2002 18:26:33 -0000 2.27 *************** *** 36,40 **** PyObject *rv; ! if ( !PyArg_Parse(args, "(s#iiiiiii)", &cp, &len, &size, &x, &y, &newx1, &newy1, &newx2, &newy2) ) return 0; --- 36,40 ---- PyObject *rv; ! if ( !PyArg_ParseTuple(args, "s#iiiiiii", &cp, &len, &size, &x, &y, &newx1, &newy1, &newx2, &newy2) ) return 0; *************** *** 91,95 **** PyObject *rv; ! if ( !PyArg_Parse(args, "(s#iiiii)", &cp, &len, &size, &x, &y, &newx, &newy) ) return 0; --- 91,95 ---- PyObject *rv; ! if ( !PyArg_ParseTuple(args, "s#iiiii", &cp, &len, &size, &x, &y, &newx, &newy) ) return 0; *************** *** 137,141 **** ! if ( !PyArg_Parse(args, "(s#iii)", &cp, &len, &width, &maxx, &maxy) ) return 0; --- 137,141 ---- ! if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &width, &maxx, &maxy) ) return 0; *************** *** 191,195 **** ! if ( !PyArg_Parse(args, "(s#iii)", &cp, &len, &x, &y, &tres) ) return 0; --- 191,195 ---- ! if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) ) return 0; *************** *** 232,236 **** ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 232,236 ---- ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 271,275 **** ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 271,275 ---- ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 309,313 **** ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 309,313 ---- ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 355,359 **** ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 355,359 ---- ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 394,398 **** int i, bit; ! if ( !PyArg_Parse(args, "(s#iiii)", &cp, &len, &x, &y, &v0, &v1) ) return 0; --- 394,398 ---- int i, bit; ! if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) ) return 0; *************** *** 431,435 **** int i, pos, value = 0, nvalue; ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 431,435 ---- int i, pos, value = 0, nvalue; ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 467,471 **** int i, pos, value = 0, nvalue; ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 467,471 ---- int i, pos, value = 0, nvalue; ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 504,508 **** Py_UInt32 value, nvalue; ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 504,508 ---- Py_UInt32 value, nvalue; ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 546,550 **** Py_UInt32 value, nvalue; ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 546,550 ---- Py_UInt32 value, nvalue; ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 587,591 **** Py_UInt32 value, nvalue; ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 587,591 ---- Py_UInt32 value, nvalue; ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 623,627 **** Py_UInt32 value; ! if ( !PyArg_Parse(args, "(s#ii)", &cp, &len, &x, &y) ) return 0; --- 623,627 ---- Py_UInt32 value; ! if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; *************** *** 678,696 **** static PyMethodDef imageop_methods[] = { ! { "crop", imageop_crop, METH_OLDARGS }, ! { "scale", imageop_scale, METH_OLDARGS }, ! { "grey2mono", imageop_grey2mono, METH_OLDARGS }, ! { "grey2grey2", imageop_grey2grey2, METH_OLDARGS }, ! { "grey2grey4", imageop_grey2grey4, METH_OLDARGS }, ! { "dither2mono", imageop_dither2mono, METH_OLDARGS }, ! { "dither2grey2", imageop_dither2grey2, METH_OLDARGS }, ! { "mono2grey", imageop_mono2grey, METH_OLDARGS }, ! { "grey22grey", imageop_grey22grey, METH_OLDARGS }, ! { "grey42grey", imageop_grey42grey, METH_OLDARGS }, ! { "tovideo", imageop_tovideo, METH_OLDARGS }, ! { "rgb2rgb8", imageop_rgb2rgb8, METH_OLDARGS }, ! { "rgb82rgb", imageop_rgb82rgb, METH_OLDARGS }, ! { "rgb2grey", imageop_rgb2grey, METH_OLDARGS }, ! { "grey2rgb", imageop_grey2rgb, METH_OLDARGS }, { 0, 0 } }; --- 678,696 ---- static PyMethodDef imageop_methods[] = { ! { "crop", imageop_crop, METH_VARARGS }, ! { "scale", imageop_scale, METH_VARARGS }, ! { "grey2mono", imageop_grey2mono, METH_VARARGS }, ! { "grey2grey2", imageop_grey2grey2, METH_VARARGS }, ! { "grey2grey4", imageop_grey2grey4, METH_VARARGS }, ! { "dither2mono", imageop_dither2mono, METH_VARARGS }, ! { "dither2grey2", imageop_dither2grey2, METH_VARARGS }, ! { "mono2grey", imageop_mono2grey, METH_VARARGS }, ! { "grey22grey", imageop_grey22grey, METH_VARARGS }, ! { "grey42grey", imageop_grey42grey, METH_VARARGS }, ! { "tovideo", imageop_tovideo, METH_VARARGS }, ! { "rgb2rgb8", imageop_rgb2rgb8, METH_VARARGS }, ! { "rgb82rgb", imageop_rgb82rgb, METH_VARARGS }, ! { "rgb2grey", imageop_rgb2grey, METH_VARARGS }, ! { "grey2rgb", imageop_grey2rgb, METH_VARARGS }, { 0, 0 } }; Index: clmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/clmodule.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** clmodule.c 31 Mar 2002 14:57:24 -0000 2.27 --- clmodule.c 2 Apr 2002 18:26:33 -0000 2.28 *************** *** 105,109 **** PyObject *compressedBuffer; ! if (!PyArg_Parse(args, "(iiiifs#)", &compressionScheme, &width, &height, &originalFormat, &compressionRatio, &frameBuffer, --- 105,109 ---- PyObject *compressedBuffer; ! if (!PyArg_ParseTuple(args, "iiiifs#", &compressionScheme, &width, &height, &originalFormat, &compressionRatio, &frameBuffer, *************** *** 150,154 **** PyObject *frameBuffer; ! if (!PyArg_Parse(args, "(iiiis#)", &compressionScheme, &width, &height, &originalFormat, &compressedBuffer, &compressedBufferSize)) --- 150,154 ---- PyObject *frameBuffer; ! if (!PyArg_ParseTuple(args, "iiiis#", &compressionScheme, &width, &height, &originalFormat, &compressedBuffer, &compressedBufferSize)) *************** *** 671,675 **** clobject *new; ! if (!PyArg_Parse(args, "i", &scheme)) return NULL; --- 671,675 ---- clobject *new; ! if (!PyArg_ParseTuple(args, "i", &scheme)) return NULL; *************** *** 712,716 **** int scheme; ! if (!PyArg_Parse(args, "s#", &header, &headerlen)) return NULL; --- 712,716 ---- int scheme; ! if (!PyArg_ParseTuple(args, "s#", &header, &headerlen)) return NULL; *************** *** 729,733 **** int scheme; ! if (!PyArg_Parse(args, "i", &scheme)) return NULL; --- 729,733 ---- int scheme; ! if (!PyArg_ParseTuple(args, "i", &scheme)) return NULL; *************** *** 744,748 **** int i; ! if (!PyArg_Parse(args, "i", &algorithmMediaType)) return NULL; --- 744,748 ---- int i; ! if (!PyArg_ParseTuple(args, "i", &algorithmMediaType)) return NULL; *************** *** 792,796 **** int scheme; ! if (!PyArg_Parse(args, "(is)", &algorithmMediaType, &name)) return NULL; --- 792,796 ---- int scheme; ! if (!PyArg_ParseTuple(args, "is", &algorithmMediaType, &name)) return NULL; *************** *** 811,815 **** char *name; ! if (!PyArg_Parse(args, "i", &scheme)) return NULL; --- 811,815 ---- char *name; ! if (!PyArg_ParseTuple(args, "i", &scheme)) return NULL; *************** *** 830,836 **** int is_float = 0; ! if (!PyArg_Parse(args, "(iii)", &scheme, ¶mID, &value)) { PyErr_Clear(); ! if (!PyArg_Parse(args, "(iif)", &scheme, ¶mID, &fvalue)) { PyErr_Clear(); PyErr_SetString(PyExc_TypeError, --- 830,836 ---- int is_float = 0; ! if (!PyArg_ParseTuple(args, "iii", &scheme, ¶mID, &value)) { PyErr_Clear(); ! if (!PyArg_ParseTuple(args, "iif", &scheme, ¶mID, &fvalue)) { PyErr_Clear(); PyErr_SetString(PyExc_TypeError, *************** *** 885,889 **** { \ int x; \ ! if (!PyArg_Parse(args, "i", &x)) return NULL; \ return Py##handler(CL_##name(x)); \ } --- 885,889 ---- { \ int x; \ ! if (!PyArg_ParseTuple(args, "i", &x)) return NULL; \ return Py##handler(CL_##name(x)); \ } *************** *** 893,897 **** { \ int a1, a2; \ ! if (!PyArg_Parse(args, "(ii)", &a1, &a2)) return NULL; \ return Py##handler(CL_##name(a1, a2)); \ } --- 893,897 ---- { \ int a1, a2; \ ! if (!PyArg_ParseTuple(args, "ii", &a1, &a2)) return NULL; \ return Py##handler(CL_##name(a1, a2)); \ } *************** *** 927,954 **** static PyMethodDef cl_methods[] = { ! {"CompressImage", cl_CompressImage, METH_OLDARGS}, ! {"DecompressImage", cl_DecompressImage, METH_OLDARGS}, ! {"GetAlgorithmName", cl_GetAlgorithmName, METH_OLDARGS}, ! {"OpenCompressor", cl_OpenCompressor, METH_OLDARGS}, ! {"OpenDecompressor", cl_OpenDecompressor, METH_OLDARGS}, ! {"QueryAlgorithms", cl_QueryAlgorithms, METH_OLDARGS}, ! {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_OLDARGS}, ! {"QueryScheme", cl_QueryScheme, METH_OLDARGS}, ! {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_OLDARGS}, ! {"SetDefault", cl_SetDefault, METH_OLDARGS}, ! {"SetMax", cl_SetMax, METH_OLDARGS}, ! {"SetMin", cl_SetMin, METH_OLDARGS}, ! {"BytesPerSample", cl_BytesPerSample, METH_OLDARGS}, ! {"BytesPerPixel", cl_BytesPerPixel, METH_OLDARGS}, ! {"AudioFormatName", cl_AudioFormatName, METH_OLDARGS}, ! {"VideoFormatName", cl_VideoFormatName, METH_OLDARGS}, ! {"AlgorithmNumber", cl_AlgorithmNumber, METH_OLDARGS}, ! {"AlgorithmType", cl_AlgorithmType, METH_OLDARGS}, ! {"Algorithm", cl_Algorithm, METH_OLDARGS}, ! {"ParamNumber", cl_ParamNumber, METH_OLDARGS}, ! {"ParamType", cl_ParamType, METH_OLDARGS}, ! {"ParamID", cl_ParamID, METH_OLDARGS}, #ifdef CLDEBUG ! {"cvt_type", cvt_type, METH_OLDARGS}, #endif {NULL, NULL} /* Sentinel */ --- 927,954 ---- static PyMethodDef cl_methods[] = { ! {"CompressImage", cl_CompressImage, METH_VARARGS}, ! {"DecompressImage", cl_DecompressImage, METH_VARARGS}, ! {"GetAlgorithmName", cl_GetAlgorithmName, METH_VARARGS}, ! {"OpenCompressor", cl_OpenCompressor, METH_VARARGS}, ! {"OpenDecompressor", cl_OpenDecompressor, METH_VARARGS}, ! {"QueryAlgorithms", cl_QueryAlgorithms, METH_VARARGS}, ! {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_VARARGS}, ! {"QueryScheme", cl_QueryScheme, METH_VARARGS}, ! {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_VARARGS}, ! {"SetDefault", cl_SetDefault, METH_VARARGS}, ! {"SetMax", cl_SetMax, METH_VARARGS}, ! {"SetMin", cl_SetMin, METH_VARARGS}, ! {"BytesPerSample", cl_BytesPerSample, METH_VARARGS}, ! {"BytesPerPixel", cl_BytesPerPixel, METH_VARARGS}, ! {"AudioFormatName", cl_AudioFormatName, METH_VARARGS}, ! {"VideoFormatName", cl_VideoFormatName, METH_VARARGS}, ! {"AlgorithmNumber", cl_AlgorithmNumber, METH_VARARGS}, ! {"AlgorithmType", cl_AlgorithmType, METH_VARARGS}, ! {"Algorithm", cl_Algorithm, METH_VARARGS}, ! {"ParamNumber", cl_ParamNumber, METH_VARARGS}, ! {"ParamType", cl_ParamType, METH_VARARGS}, ! {"ParamID", cl_ParamID, METH_VARARGS}, #ifdef CLDEBUG ! {"cvt_type", cvt_type, METH_VARARGS}, #endif {NULL, NULL} /* Sentinel */ From nnorwitz@users.sourceforge.net Tue Apr 2 18:18:00 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Tue, 02 Apr 2002 10:18:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules structmodule.c,2.53,2.54 stropmodule.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv28376 Modified Files: structmodule.c stropmodule.c Log Message: Get rid of more PyArg_Parse & METH_OLDARGS. PyArg_Parse( "s" ) -> PyString_AsString PyArg_Parse( "t#" ) -> PyString_AsStringAndSize Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** structmodule.c 14 Feb 2002 07:16:30 -0000 2.53 --- structmodule.c 2 Apr 2002 18:17:55 -0000 2.54 *************** *** 1274,1278 **** } format = PyTuple_GetItem(args, 0); ! if (!PyArg_Parse(format, "s", &fmt)) return NULL; f = whichtable(&fmt); --- 1274,1279 ---- } format = PyTuple_GetItem(args, 0); ! fmt = PyString_AsString(format); ! if (!fmt) return NULL; f = whichtable(&fmt); Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -d -r2.86 -r2.87 *** stropmodule.c 1 Apr 2002 14:53:37 -0000 2.86 --- stropmodule.c 2 Apr 2002 18:17:57 -0000 2.87 *************** *** 377,381 **** ! if (!PyArg_Parse(args, "t#", &s, &len)) return NULL; --- 377,381 ---- ! if (PyString_AsStringAndSize(args, &s, &len)) return NULL; *************** *** 458,462 **** WARN; ! if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); --- 458,462 ---- WARN; ! if (PyString_AsStringAndSize(args, &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); *************** *** 497,501 **** WARN; ! if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); --- 497,501 ---- WARN; ! if (PyString_AsStringAndSize(args, &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); *************** *** 537,541 **** WARN; ! if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); --- 537,541 ---- WARN; ! if (PyString_AsStringAndSize(args, &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); *************** *** 703,707 **** WARN; ! if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); --- 703,707 ---- WARN; ! if (PyString_AsStringAndSize(args, &s, &n)) return NULL; new = PyString_FromStringAndSize(NULL, n); *************** *** 1191,1195 **** {"atoi", strop_atoi, METH_VARARGS, atoi__doc__}, {"atol", strop_atol, METH_VARARGS, atol__doc__}, ! {"capitalize", strop_capitalize, METH_OLDARGS, capitalize__doc__}, {"count", strop_count, METH_VARARGS, count__doc__}, {"expandtabs", strop_expandtabs, METH_VARARGS, expandtabs__doc__}, --- 1191,1195 ---- {"atoi", strop_atoi, METH_VARARGS, atoi__doc__}, {"atol", strop_atol, METH_VARARGS, atol__doc__}, ! {"capitalize", strop_capitalize, METH_O, capitalize__doc__}, {"count", strop_count, METH_VARARGS, count__doc__}, {"expandtabs", strop_expandtabs, METH_VARARGS, expandtabs__doc__}, *************** *** 1197,1212 **** {"join", strop_joinfields, METH_VARARGS, joinfields__doc__}, {"joinfields", strop_joinfields, METH_VARARGS, joinfields__doc__}, ! {"lstrip", strop_lstrip, METH_OLDARGS, lstrip__doc__}, ! {"lower", strop_lower, METH_OLDARGS, lower__doc__}, {"maketrans", strop_maketrans, METH_VARARGS, maketrans__doc__}, {"replace", strop_replace, METH_VARARGS, replace__doc__}, {"rfind", strop_rfind, METH_VARARGS, rfind__doc__}, ! {"rstrip", strop_rstrip, METH_OLDARGS, rstrip__doc__}, {"split", strop_splitfields, METH_VARARGS, splitfields__doc__}, {"splitfields", strop_splitfields, METH_VARARGS, splitfields__doc__}, ! {"strip", strop_strip, METH_OLDARGS, strip__doc__}, ! {"swapcase", strop_swapcase, METH_OLDARGS, swapcase__doc__}, {"translate", strop_translate, METH_VARARGS, translate__doc__}, ! {"upper", strop_upper, METH_OLDARGS, upper__doc__}, {NULL, NULL} /* sentinel */ }; --- 1197,1212 ---- {"join", strop_joinfields, METH_VARARGS, joinfields__doc__}, {"joinfields", strop_joinfields, METH_VARARGS, joinfields__doc__}, ! {"lstrip", strop_lstrip, METH_O, lstrip__doc__}, ! {"lower", strop_lower, METH_O, lower__doc__}, {"maketrans", strop_maketrans, METH_VARARGS, maketrans__doc__}, {"replace", strop_replace, METH_VARARGS, replace__doc__}, {"rfind", strop_rfind, METH_VARARGS, rfind__doc__}, ! {"rstrip", strop_rstrip, METH_O, rstrip__doc__}, {"split", strop_splitfields, METH_VARARGS, splitfields__doc__}, {"splitfields", strop_splitfields, METH_VARARGS, splitfields__doc__}, ! {"strip", strop_strip, METH_O, strip__doc__}, ! {"swapcase", strop_swapcase, METH_O, swapcase__doc__}, {"translate", strop_translate, METH_VARARGS, translate__doc__}, ! {"upper", strop_upper, METH_O, upper__doc__}, {NULL, NULL} /* sentinel */ }; From gvanrossum@users.sourceforge.net Tue Apr 2 23:13:11 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 02 Apr 2002 15:13:11 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0042.txt,1.57,1.58 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19779 Modified Files: pep-0042.txt Log Message: - Add proposal for categorization according to Laura. - Use sf redirector URLs. Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** pep-0042.txt 14 Nov 2001 05:57:34 -0000 1.57 --- pep-0042.txt 2 Apr 2002 23:13:08 -0000 1.58 *************** *** 27,30 **** --- 27,53 ---- database to a separate PEP. + This PEP should really be separated into four different categories + (categories due to Laura Creighton): + + 1. BDFL rejects as a bad idea. Don't come back with it. + + 2. BDFL will put in if somebody writes the code. (Or at any rate, + BDFL will say 'change this and I will put it in' if you show up + with code.) + + (possibly divided into: + + 2a) BDFL would really like to see some code! + + 2b) BDFL is never going to be enthusiastic about this, but + will work it in when it's easy. + ) + + 3. If you show up with code, BDFL will make a pronouncement. It + might be ICK. + + 4. This is too vague. This is rejected, but only on the grounds + of vagueness. If you like this enhancement, make a new PEP. + Core Language / Builtins *************** *** 34,38 **** returns the size of the object struct itself. ! http://sf.net/bugs/?func=detailbug&bug_id=110835&group_id=5470 - Add C API functions to help Windows users who are building --- 57,61 ---- returns the size of the object struct itself. ! http://www.python.org/sf/210835 - Add C API functions to help Windows users who are building *************** *** 40,44 **** the FILE * the interpreter was compiled with. ! http://sf.net/bugs/?func=detailbug&bug_id=110821&group_id=5470 See this bug report for a specific suggestion that will allow a --- 63,67 ---- the FILE * the interpreter was compiled with. ! http://www.python.org/sf/210821 See this bug report for a specific suggestion that will allow a *************** *** 54,58 **** deep. ! http://sf.net/bugs/?func=detailbug&bug_id=115555&group_id=5470 - Non-accidental IEEE-754 support (Infs, NaNs, settable traps, etc). --- 77,81 ---- deep. ! http://www.python.org/sf/215555 - Non-accidental IEEE-754 support (Infs, NaNs, settable traps, etc). *************** *** 60,64 **** pickle lacks float('inf') ! http://sf.net/tracker/index.php?func=detail&aid=445484&group_id=5470&atid=355470 - Windows: Trying to create (or even access) files with certain magic --- 83,87 ---- pickle lacks float('inf') ! http://www.python.org/sf/445484 - Windows: Trying to create (or even access) files with certain magic *************** *** 68,72 **** Hang using files named prn.txt, etc ! http://sf.net/tracker/index.php?func=detail&aid=481171&group_id=5470&atid=355470 --- 91,95 ---- Hang using files named prn.txt, etc ! http://www.python.org/sf/481171 *************** *** 77,86 **** needed. ! http://sf.net/bugs/?func=detailbug&group_id=5470&bug_id=110819 - The urllib module should support proxies which require authenication. See SourceForge bug #110619 for information: ! http://sf.net/bugs/?func=detailbug&bug_id=110619&group_id=5470 - Use objects with attributes in place of tuples of values for --- 100,109 ---- needed. ! http://www.python.org/sf/210819 - The urllib module should support proxies which require authenication. See SourceForge bug #110619 for information: ! http://www.python.org/sf/210619 - Use objects with attributes in place of tuples of values for *************** *** 89,93 **** os.statvfs(); see SourceForge bug #111481: ! http://sf.net/bugs/?func=detailbug&bug_id=111481&group_id=5470 which shows very specifically why this approach is better than --- 112,116 ---- os.statvfs(); see SourceForge bug #111481: ! http://www.python.org/sf/211481 which shows very specifically why this approach is better than *************** *** 100,104 **** Linux is one system that requires this treatment. ! http://sf.net/bugs/?func=detailbug&bug_id=112317&group_id=5470 - signal handling doesn't always work as expected. E.g. if --- 123,127 ---- Linux is one system that requires this treatment. ! http://www.python.org/sf/212317 - signal handling doesn't always work as expected. E.g. if *************** *** 109,113 **** interruptable I/O. So it's a big project. ! http://sf.net/bugs/?func=detailbug&bug_id=110599&group_id=5470 - Ensure that all .py files in the std library use 4-space indents and --- 132,136 ---- interruptable I/O. So it's a big project. ! http://www.python.org/sf/210599 - Ensure that all .py files in the std library use 4-space indents and *************** *** 117,147 **** 250 files are affected, will wait until after 2.0final is released. ! http://sf.net/bugs/?func=detailbug&bug_id=114557&group_id=5470 - Port the Python SSL code to Windows. ! http://sf.net/bugs/?func=detailbug&bug_id=110683&group_id=5470 - Extend Windows utime to accept directory paths. ! http://sf.net/bugs/?func=detailbug&bug_id=114245&group_id=5470 - Extend copy.py to class, module & function types. ! http://sf.net/bugs/?func=detailbug&bug_id=114553&group_id=5470 - Better checking for bad input to marshal.load*(). ! http://sf.net/bugs/?func=detailbug&bug_id=114754&group_id=5470 - Generalize eval to accept any mapping objects for locals and globals. ! http://sf.net/bugs/?func=detailbug&bug_id=115126&group_id=5470 - Add a portable implementation of time.strptime() that works in clearly defined ways on all platforms. ! http://sf.net/bugs/?func=detailbug&bug_id=115146&group_id=5470 ! http://sf.net/bugs/?func=detailbug&bug_id=112244&group_id=5470 - rfc822.py should be more lenient than the spec in the types of --- 140,170 ---- 250 files are affected, will wait until after 2.0final is released. ! http://www.python.org/sf/214557 - Port the Python SSL code to Windows. ! http://www.python.org/sf/210683 - Extend Windows utime to accept directory paths. ! http://www.python.org/sf/214245 - Extend copy.py to class, module & function types. ! http://www.python.org/sf/214553 - Better checking for bad input to marshal.load*(). ! http://www.python.org/sf/214754 - Generalize eval to accept any mapping objects for locals and globals. ! http://www.python.org/sf/215126 - Add a portable implementation of time.strptime() that works in clearly defined ways on all platforms. ! http://www.python.org/sf/215146 ! http://www.python.org/sf/212244 - rfc822.py should be more lenient than the spec in the types of *************** *** 150,159 **** be parsed correctly. ! http://sf.net/bugs/?func=detailbug&bug_id=110678&group_id=5470 - cgi.py's FieldStorage class should be more conservative with memory in the face of large binary file uploads. ! http://sf.net/bugs/?func=detailbug&bug_id=110674&group_id=5470 There are two issues here: first, because --- 173,182 ---- be parsed correctly. ! http://www.python.org/sf/210678 - cgi.py's FieldStorage class should be more conservative with memory in the face of large binary file uploads. ! http://www.python.org/sf/210674 There are two issues here: first, because *************** *** 167,181 **** was removed in revision 1.56 of cgi.py (see also): ! http://sf.net/bugs/?func=detailbug&bug_id=119806&group_id=5470 - urllib should support proxy definitions that contain just the host and port ! http://sf.net/bugs/?func=detailbug&bug_id=110849&group_id=5470 - urlparse should be updated to comply with RFC 2396, which defines optional parameters for each segment of the page. ! http://sf.net/bugs/?func=detailbug&bug_id=110834&group_id=5470 - The exceptions raised by pickle and cPickle are currently --- 190,204 ---- was removed in revision 1.56 of cgi.py (see also): ! http://www.python.org/sf/219806 - urllib should support proxy definitions that contain just the host and port ! http://www.python.org/sf/210849 - urlparse should be updated to comply with RFC 2396, which defines optional parameters for each segment of the page. ! http://www.python.org/sf/210834 - The exceptions raised by pickle and cPickle are currently *************** *** 189,193 **** one! ! http://sf.net/bugs/?func=detailbug&bug_id=116716&group_id=5470 - There should be a way to say that you don't mind if str() or --- 212,216 ---- one! ! http://www.python.org/sf/216716 - There should be a way to say that you don't mind if str() or *************** *** 205,222 **** signal. Or maybe raising an asynchronous exception. ! http://sf.net/bugs/?func=detailbug&bug_id=121115&group_id=5470 - The debugger (pdb) should understand packages. ! http://sf.net/bugs/?func=detailbug&bug_id=110631&group_id=5470 - The cmath library should be rewritten in Python. ! http://sf.net/bugs/?func=detailbug&bug_id=110838&group_id=5470 - Could use a more comprehensive email module. (But then again, that may be better done as a 3rd party project.) ! http://sf.net/bugs/?func=detailbug&bug_id=121208&group_id=5470 - every built-in function or method (including all core --- 228,245 ---- signal. Or maybe raising an asynchronous exception. ! http://www.python.org/sf/221115 - The debugger (pdb) should understand packages. ! http://www.python.org/sf/210631 - The cmath library should be rewritten in Python. ! http://www.python.org/sf/210838 - Could use a more comprehensive email module. (But then again, that may be better done as a 3rd party project.) ! http://www.python.org/sf/221208 - every built-in function or method (including all core *************** *** 225,237 **** should more generally accept all mappings, all sequences.) ! http://sf.net/bugs/?func=detailbug&bug_id=132493&group_id=5470 - Fatter math module docs and docstrings. ! http://sf.net/tracker/?func=detail&aid=426539&group_id=5470&atid=105470 - New math module radians() and degrees() functions. ! http://sf.net/tracker/?func=detail&aid=426539&group_id=5470&atid=105470 - Jim Fulton suggested the following: --- 248,260 ---- should more generally accept all mappings, all sequences.) ! http://www.python.org/sf/232493 - Fatter math module docs and docstrings. ! http://www.python.org/sf/426539 - New math module radians() and degrees() functions. ! http://www.python.org/sf/426539 - Jim Fulton suggested the following: *************** *** 247,251 **** uniform way. ! http://sf.net/tracker/?func=detail&aid=415692&group_id=5470&atid=355470 - Jim Fulton pointed out that binascii's b2a_base64() function --- 270,274 ---- uniform way. ! http://www.python.org/sf/415692 - Jim Fulton pointed out that binascii's b2a_base64() function *************** *** 265,269 **** adding the pad bytes too??? ! http://sf.net/tracker/?func=detail&aid=415694&group_id=5470&atid=355470 --- 288,292 ---- adding the pad bytes too??? ! http://www.python.org/sf/415694 *************** *** 274,291 **** process. ! http://sf.net/bugs/?func=detailbug&bug_id=110841&group_id=5470 - Python could use a GUI builder. ! http://sf.net/bugs/?func=detailbug&bug_id=110820&group_id=5470 - IDLE's key bindings should be revised. Some of the advertised bindings don't even work! ! http://sf.net/bugs/?func=detailbug&bug_id=110659&group_id=5470 - IDLE has deep problems running threaded programs. Re-architect. ! http://sf.net/bugs/?func=detailbug&bug_id=121963&group_id=5470 - Would be nice if IDLE showed which structure was being closed upon --- 297,314 ---- process. ! http://www.python.org/sf/210841 - Python could use a GUI builder. ! http://www.python.org/sf/210820 - IDLE's key bindings should be revised. Some of the advertised bindings don't even work! ! http://www.python.org/sf/210659 - IDLE has deep problems running threaded programs. Re-architect. ! http://www.python.org/sf/221963 - Would be nice if IDLE showed which structure was being closed upon *************** *** 293,297 **** The bug report also says something about TAB I didn't grok. ! http://sf.net/tracker/?func=detail&aid=404444&group_id=5470&atid=105470 --- 316,320 ---- The bug report also says something about TAB I didn't grok. ! http://www.python.org/sf/404444 *************** *** 301,305 **** cross-compiler. ! http://sf.net/bugs/?func=detailbug&bug_id=110836&group_id=5470 - Modules/makesetup should make sure the 'config.c' file it --- 324,328 ---- cross-compiler. ! http://www.python.org/sf/210836 - Modules/makesetup should make sure the 'config.c' file it *************** *** 308,312 **** Python or C identifiers. ! http://sf.net/bugs/?func=detailbug&bug_id=116326&group_id=5470 - There's a name conflict on case insensitive filesystems (in --- 331,335 ---- Python or C identifiers. ! http://www.python.org/sf/216326 - There's a name conflict on case insensitive filesystems (in *************** *** 317,321 **** be the solution? ! http://sf.net/bugs/?func=detailbug&bug_id=122215&group_id=5470 - Building from source should not attempt to overwrite the --- 340,344 ---- be the solution? ! http://www.python.org/sf/222215 - Building from source should not attempt to overwrite the *************** *** 325,334 **** environments. ! http://sf.net/bugs/?func=detailbug&bug_id=119221&group_id=5470 - There should be at least an option to build Python as a shared library. ! http://sf.net/tracker/index.php?func=detail&aid=400938&group_id=5470&atid=305470 --- 348,357 ---- environments. ! http://www.python.org/sf/219221 - There should be at least an option to build Python as a shared library. ! http://www.python.org/sf/400938 From gvanrossum@users.sourceforge.net Wed Apr 3 00:58:04 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 02 Apr 2002 16:58:04 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0285.txt,1.17,1.18 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14827 Modified Files: pep-0285.txt Log Message: Clarify once more that "if []" will remain valid Python forever. Index: pep-0285.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pep-0285.txt 1 Apr 2002 15:24:54 -0000 1.17 --- pep-0285.txt 3 Apr 2002 00:58:01 -0000 1.18 *************** *** 116,119 **** --- 116,131 ---- is considered false and a non-empty one is considered true." + 8) Should we strive to require that Boolean operations (like "if", + "and", "not") have a bool as an argument in the future, so that + for example "if []:" would become illegal and would have to be + writen as "if bool([]):" ??? + + => No!!! Some people believe that this is how a language with a + Boolean type should behave. Because it was brought up, others + have worried that I might agree with this position. Let me + make my position on this quite clear. This is not part of the + PEP's motivation and I don't intend to make this change. (See + also the section "Clarification" below.) + Rationale From gvanrossum@users.sourceforge.net Wed Apr 3 01:31:31 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 02 Apr 2002 17:31:31 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0285.txt,1.18,1.19 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24108 Modified Files: pep-0285.txt Log Message: Specify that pickle and marshal roundtrip. Index: pep-0285.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pep-0285.txt 3 Apr 2002 00:58:01 -0000 1.18 --- pep-0285.txt 3 Apr 2002 01:31:29 -0000 1.19 *************** *** 128,131 **** --- 128,136 ---- also the section "Clarification" below.) + 9) What about pickle and marshal? + + => I've added a paragraph to the specification requiring that + bool values roundtrip when pickled or marshalled. + Rationale *************** *** 254,257 **** --- 259,266 ---- created. At the C level, the existing globals Py_False and Py_True will be appropriated to refer to False and True. + + True and False will properly round-trip through pickling and + marshalling; for example pickle.loads(pickle.dumps(True)) will + return True. All built-in operations that are defined to return a Boolean From mhammond@users.sourceforge.net Wed Apr 3 01:47:02 2002 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Tue, 02 Apr 2002 17:47:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_popen,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv27599/Lib/test/output Added Files: test_popen Log Message: Fix bugs: 457466: popenx() argument mangling hangs python 226766: popen('python -c"...."') tends to hang Fixes argument quoting in w9xpopen.exe for Windows 9x. w9xpopen.exe also never attempts to display a MessageBox when not executed interactively. Added test_popen() test. This test currently just executes "python -c ..." as a child process, and checks that the expected arguments were all recieved correctly by the child process. This test succeeds for me on Win9x, win2k and Linux, and I hope it does for other popen supported platforms too :) --- NEW FILE: test_popen --- test_popen Test popen: popen seemed to process the command-line correctly From mhammond@users.sourceforge.net Wed Apr 3 01:47:02 2002 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Tue, 02 Apr 2002 17:47:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_popen.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27599/Lib/test Added Files: test_popen.py Log Message: Fix bugs: 457466: popenx() argument mangling hangs python 226766: popen('python -c"...."') tends to hang Fixes argument quoting in w9xpopen.exe for Windows 9x. w9xpopen.exe also never attempts to display a MessageBox when not executed interactively. Added test_popen() test. This test currently just executes "python -c ..." as a child process, and checks that the expected arguments were all recieved correctly by the child process. This test succeeds for me on Win9x, win2k and Linux, and I hope it does for other popen supported platforms too :) --- NEW FILE: test_popen.py --- #! /usr/bin/env python """Basic tests for os.popen() Particularly useful for platforms that fake popen. """ import os import sys from test_support import TestSkipped from os import popen # Test that command-lines get down as we expect. # To do this we execute: # python -c "import sys;print sys.argv" {rest_of_commandline} # This results in Python being spawned and printing the sys.argv list. # We can then eval() the result of this, and see what each argv was. def _do_test_commandline(cmdline, expected): cmd = 'python -c "import sys;print sys.argv" %s' % (cmdline,) data = popen(cmd).read() got = eval(data)[1:] # strip off argv[0] if got != expected: print "Error in popen commandline handling." print " executed '%s', expected '%r', but got '%r'" \ % (cmdline, expected, got) def _test_commandline(): _do_test_commandline("foo bar", ["foo", "bar"]) _do_test_commandline('foo "spam and eggs" "silly walk"', ["foo", "spam and eggs", "silly walk"]) _do_test_commandline('foo "a \\"quoted\\" arg" bar', ["foo", 'a "quoted" arg', "bar"]) print "popen seemed to process the command-line correctly" def main(): print "Test popen:" _test_commandline() main() From mhammond@users.sourceforge.net Wed Apr 3 01:47:02 2002 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Tue, 02 Apr 2002 17:47:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.226,2.227 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27599/Modules Modified Files: posixmodule.c Log Message: Fix bugs: 457466: popenx() argument mangling hangs python 226766: popen('python -c"...."') tends to hang Fixes argument quoting in w9xpopen.exe for Windows 9x. w9xpopen.exe also never attempts to display a MessageBox when not executed interactively. Added test_popen() test. This test currently just executes "python -c ..." as a child process, and checks that the expected arguments were all recieved correctly by the child process. This test succeeds for me on Win9x, win2k and Linux, and I hope it does for other popen supported platforms too :) Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.226 retrieving revision 2.227 diff -C2 -d -r2.226 -r2.227 *** posixmodule.c 22 Mar 2002 20:51:58 -0000 2.226 --- posixmodule.c 3 Apr 2002 01:47:00 -0000 2.227 *************** *** 3286,3292 **** s2 = (char *)_alloca(x); ZeroMemory(s2, x); PyOS_snprintf( s2, x, ! "%s \"%s%s%s\"", modulepath, s1, --- 3286,3298 ---- s2 = (char *)_alloca(x); ZeroMemory(s2, x); + /* To maintain correct argument passing semantics, + we pass the command-line as it stands, and allow + quoting to be applied. w9xpopen.exe will then + use its argv vector, and re-quote the necessary + args for the ultimate child process. + */ PyOS_snprintf( s2, x, ! "\"%s\" %s%s%s", modulepath, s1, From mhammond@users.sourceforge.net Wed Apr 3 01:47:02 2002 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Tue, 02 Apr 2002 17:47:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/PC w9xpopen.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv27599/PC Modified Files: w9xpopen.c Log Message: Fix bugs: 457466: popenx() argument mangling hangs python 226766: popen('python -c"...."') tends to hang Fixes argument quoting in w9xpopen.exe for Windows 9x. w9xpopen.exe also never attempts to display a MessageBox when not executed interactively. Added test_popen() test. This test currently just executes "python -c ..." as a child process, and checks that the expected arguments were all recieved correctly by the child process. This test succeeds for me on Win9x, win2k and Linux, and I hope it does for other popen supported platforms too :) Index: w9xpopen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/w9xpopen.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** w9xpopen.c 14 Aug 2000 05:04:28 -0000 1.2 --- w9xpopen.c 3 Apr 2002 01:47:00 -0000 1.3 *************** *** 17,23 **** #define WINDOWS_LEAN_AND_MEAN #include const char *usage = ! "This program is used by Python's os.pipe function to\n" "to work around a limitation in Windows 95/98. It is\n" "not designed to be used as stand-alone program."; --- 17,24 ---- #define WINDOWS_LEAN_AND_MEAN #include + #include const char *usage = ! "This program is used by Python's os.popen function to\n" "to work around a limitation in Windows 95/98. It is\n" "not designed to be used as stand-alone program."; *************** *** 29,37 **** PROCESS_INFORMATION pi; DWORD exit_code=0; ! if (argc != 2) { ! MessageBox(NULL, usage, argv[0], MB_OK); return 1; } /* Make child process use this app's standard files. */ --- 30,83 ---- PROCESS_INFORMATION pi; DWORD exit_code=0; + int cmdlen = 0; + int i; + char *cmdline, *cmdlinefill; ! if (argc < 2) { ! if (GetFileType(GetStdHandle(STD_INPUT_HANDLE))==FILE_TYPE_CHAR) ! /* Attached to a console, and therefore not executed by Python ! Display a message box for the inquisitive user ! */ ! MessageBox(NULL, usage, argv[0], MB_OK); ! else { ! /* Eeek - executed by Python, but args are screwed! ! Write an error message to stdout so there is at ! least some clue for the end user when it appears ! in their output. ! A message box would be hidden and blocks the app. ! */ ! fprintf(stdout, "Internal popen error - no args specified\n%s\n", usage); ! } return 1; } + /* Build up the command-line from the args. + Args with a space are quoted, existing quotes are escaped. + To keep things simple calculating the buffer size, we assume + every character is a quote - ie, we allocate double what we need + in the worst case. As this is only double the command line passed + to us, there is a good chance this is reasonably small, so the total + allocation will almost always be < 512 bytes. + */ + for (i=1;i Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4136 Modified Files: typeobject.c Log Message: Fold some long lines. Delete blank initial line. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.133 retrieving revision 2.134 diff -C2 -d -r2.133 -r2.134 *** typeobject.c 2 Apr 2002 17:53:47 -0000 2.133 --- typeobject.c 3 Apr 2002 02:13:37 -0000 2.134 *************** *** 1,3 **** - /* Type object implementation */ --- 1,2 ---- *************** *** 2112,2116 **** Py_DECREF(doc); } else { ! PyDict_SetItemString(type->tp_dict, "__doc__", Py_None); } } --- 2111,2116 ---- Py_DECREF(doc); } else { ! PyDict_SetItemString(type->tp_dict, ! "__doc__", Py_None); } } *************** *** 3365,3369 **** func = lookup_method(self, "__getitem__", &getitem_str); if (func == NULL) { ! PyErr_SetString(PyExc_TypeError, "iteration over non-sequence"); return NULL; } --- 3365,3370 ---- func = lookup_method(self, "__getitem__", &getitem_str); if (func == NULL) { ! PyErr_SetString(PyExc_TypeError, ! "iteration over non-sequence"); return NULL; } *************** *** 4069,4073 **** f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, (PyObject *)starttype); Py_DECREF(res); res = tmp; --- 4070,4075 ---- f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, ! (PyObject *)starttype); Py_DECREF(res); res = tmp; From fdrake@users.sourceforge.net Wed Apr 3 02:46:19 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 02 Apr 2002 18:46:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.116.4.2,1.116.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv12992/perl Modified Files: Tag: release22-maint python.perl Log Message: Update the PEP URL format to point to python.org. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.116.4.2 retrieving revision 1.116.4.3 diff -C2 -d -r1.116.4.2 -r1.116.4.3 *** python.perl 15 Mar 2002 23:18:05 -0000 1.116.4.2 --- python.perl 3 Apr 2002 02:46:17 -0000 1.116.4.3 *************** *** 323,327 **** } ! $PEP_FORMAT = "http://python.sourceforge.net/peps/pep-%04d.html"; #$RFC_FORMAT = "http://www.ietf.org/rfc/rfc%04d.txt"; $RFC_FORMAT = "http://www.faqs.org/rfcs/rfc%d.html"; --- 323,327 ---- } ! $PEP_FORMAT = "http://www.python.org/peps/pep-%04d.html"; #$RFC_FORMAT = "http://www.ietf.org/rfc/rfc%04d.txt"; $RFC_FORMAT = "http://www.faqs.org/rfcs/rfc%d.html"; From fdrake@users.sourceforge.net Wed Apr 3 02:47:16 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 02 Apr 2002 18:47:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv13335/perl Modified Files: python.perl Log Message: Update the PEP URL format to point to python.org. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** python.perl 15 Mar 2002 23:21:37 -0000 1.119 --- python.perl 3 Apr 2002 02:47:14 -0000 1.120 *************** *** 325,329 **** } ! $PEP_FORMAT = "http://python.sourceforge.net/peps/pep-%04d.html"; #$RFC_FORMAT = "http://www.ietf.org/rfc/rfc%04d.txt"; $RFC_FORMAT = "http://www.faqs.org/rfcs/rfc%d.html"; --- 325,329 ---- } ! $PEP_FORMAT = "http://www.python.org/peps/pep-%04d.html"; #$RFC_FORMAT = "http://www.ietf.org/rfc/rfc%04d.txt"; $RFC_FORMAT = "http://www.faqs.org/rfcs/rfc%d.html"; From fdrake@users.sourceforge.net Wed Apr 3 02:52:52 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 02 Apr 2002 18:52:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/whatsnew whatsnew20.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv14449/whatsnew Modified Files: whatsnew20.tex Log Message: Updated PEP link to point to the now-canonical site. Index: whatsnew20.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew20.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** whatsnew20.tex 5 Nov 2001 21:25:42 -0000 1.42 --- whatsnew20.tex 3 Apr 2002 02:52:50 -0000 1.43 *************** *** 139,143 **** SourceForge, though they're not part of the Python 2.0 distribution, and are also available in HTML form from ! \url{http://python.sourceforge.net/peps/}. As of September 2000, there are 25 PEPS, ranging from PEP 201, ``Lockstep Iteration'', to PEP 225, ``Elementwise/Objectwise Operators''. --- 139,143 ---- SourceForge, though they're not part of the Python 2.0 distribution, and are also available in HTML form from ! \url{http://www.python.org/peps/}. As of September 2000, there are 25 PEPS, ranging from PEP 201, ``Lockstep Iteration'', to PEP 225, ``Elementwise/Objectwise Operators''. From fdrake@users.sourceforge.net Wed Apr 3 03:36:50 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 02 Apr 2002 19:36:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.98.2.4,1.98.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv22765/perl Modified Files: Tag: release21-maint python.perl Log Message: Update the PEP URL format to point to python.org. (This affects exactly one link on the release21-maint branch.) Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.98.2.4 retrieving revision 1.98.2.5 diff -C2 -d -r1.98.2.4 -r1.98.2.5 *** python.perl 13 Mar 2002 02:46:17 -0000 1.98.2.4 --- python.perl 3 Apr 2002 03:36:47 -0000 1.98.2.5 *************** *** 287,291 **** } ! $PEP_FORMAT = "http://python.sourceforge.net/peps/pep-XXXX.html"; $RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt"; --- 287,291 ---- } ! $PEP_FORMAT = "http://www.python.org/peps/pep-XXXX.html"; $RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt"; From fdrake@users.sourceforge.net Wed Apr 3 04:26:46 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 02 Apr 2002 20:26:46 -0800 Subject: [Python-checkins] CVS: python/nondist/peps update.sh,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32331 Added Files: update.sh Log Message: Script that gets run by cron on www.python.org to update the online PEPs from CVS. --- NEW FILE: update.sh --- #! /bin/sh # This script is meant to be run by cron regularly on the # www.python.org server to avoid letting the online PEPs get stale. # Before using it, the user whose account it is run under needs to use # the "cvs login" command to log into the Python CVS server as # anonymous. TMPDIR="$HOME/tmp" WORKDIR="peps-$$" TARGETDIR='/ftp/ftp.python.org/pub/www.python.org/peps' CVSROOT=':pserver:anonymous@cvs.python.sourceforge.net:/cvsroot/python' export CVSROOT cd "$TMPDIR" || exit $? cvs -Q checkout -d "$WORKDIR" python/nondist/peps || exit $? cd "$WORKDIR" || exit $? python ./pep2html.py -q || exit $? # This loop avoids modifying the files for an unchanged PEP. # The HTML file is treated a little strangely since it contains the # (pseudo-)random selection of the corner logo. for FILE in *.txt ; do HTML="${FILE%txt}html" if [ -e "$TARGETDIR/$FILE" ] ; then if cmp -s "$FILE" "$TARGETDIR/$FILE" ; then true else cp "$FILE" "$TARGETDIR/" || exit $? cp "$HTML" "$TARGETDIR/" || exit $? fi else cp "$HTML" "$TARGETDIR/" || exit $? fi done cd "$TMPDIR" || exit $? rm -r "$WORKDIR" || exit $? From gvanrossum@users.sourceforge.net Wed Apr 3 14:07:34 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 06:07:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules gcmodule.c,2.33.6.2,2.33.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1340 Modified Files: Tag: release22-maint gcmodule.c Log Message: The body of_PyObject_GC_UnTrack() should only be compiled #ifdef WITH_CYCLE_GC. (Neil pointed this out before the weekend, and I fixed it right away, but forgot to check it in.) Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.2 retrieving revision 2.33.6.3 diff -C2 -d -r2.33.6.2 -r2.33.6.3 *** gcmodule.c 28 Mar 2002 20:36:49 -0000 2.33.6.2 --- gcmodule.c 3 Apr 2002 14:07:32 -0000 2.33.6.3 *************** *** 820,826 **** --- 820,828 ---- _PyObject_GC_UnTrack(PyObject *op) { + #ifdef WITH_CYCLE_GC PyGC_Head *gc = AS_GC(op); if (gc->gc.gc_next != NULL) _PyObject_GC_UNTRACK(op); + #endif } From bwarsaw@users.sourceforge.net Wed Apr 3 18:58:20 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 03 Apr 2002 10:58:20 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.172,1.173 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24831 Modified Files: pep-0000.txt Log Message: Update David Goodger's email address Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -d -r1.172 -r1.173 *** pep-0000.txt 1 Apr 2002 16:09:59 -0000 1.172 --- pep-0000.txt 3 Apr 2002 18:58:17 -0000 1.173 *************** *** 297,301 **** Faassen, Martijn faassen@infrae.com Giacometti, Frédéric B. fred@arakne.com ! Goodger, David dgoodger@bigfoot.com Griffin, Grant g2@iowegian.com Hetland, Magnus Lie magnus@hetland.org --- 297,301 ---- Faassen, Martijn faassen@infrae.com Giacometti, Frédéric B. fred@arakne.com ! Goodger, David goodger@users.sourceforge.net Griffin, Grant g2@iowegian.com Hetland, Magnus Lie magnus@hetland.org From jackjansen@users.sourceforge.net Wed Apr 3 21:28:04 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Wed, 03 Apr 2002 13:28:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wminiapp.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv9696 Modified Files: Wminiapp.py Log Message: Got the example program to work in MachoPython. Index: Wminiapp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wminiapp.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Wminiapp.py 25 Aug 2001 12:14:26 -0000 1.2 --- Wminiapp.py 3 Apr 2002 21:28:02 -0000 1.3 *************** *** 2,5 **** --- 2,7 ---- import Wapplication + import macresource + import os class TestApp(Wapplication.Application): *************** *** 7,13 **** def __init__(self): from Carbon import Res ! Res.FSpOpenResFile("Widgets.rsrc", 1) self._menustocheck = [] ! self.preffilepath = ":Python:PythonIDE preferences" Wapplication.Application.__init__(self, 'Pyth') # open a new text editor --- 9,15 ---- def __init__(self): from Carbon import Res ! macresource.open_pathname("Widgets.rsrc") self._menustocheck = [] ! self.preffilepath = os.path.join("Python", "PythonIDE preferences") Wapplication.Application.__init__(self, 'Pyth') # open a new text editor From fdrake@users.sourceforge.net Wed Apr 3 21:39:29 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 13:39:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules unicodedata.c,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13215/Modules Modified Files: unicodedata.c Log Message: Remove direct manipulation of the module dict. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** unicodedata.c 3 Mar 2002 02:59:16 -0000 2.15 --- unicodedata.c 3 Apr 2002 21:39:26 -0000 2.16 *************** *** 464,468 **** initunicodedata(void) { ! PyObject *m, *d, *v; m = Py_InitModule3( --- 464,468 ---- initunicodedata(void) { ! PyObject *m, *v; m = Py_InitModule3( *************** *** 471,483 **** return; - d = PyModule_GetDict(m); - if (!d) - return; - /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); ! if (v != NULL) { ! PyDict_SetItemString(d, "ucnhash_CAPI", v); ! Py_DECREF(v); ! } } --- 471,477 ---- return; /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); ! if (v != NULL) ! PyModule_AddObject(m, "ucnhash_CAPI", v); } From fdrake@users.sourceforge.net Wed Apr 3 21:42:47 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 13:42:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects funcobject.c,2.51,2.52 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14221/Objects Modified Files: funcobject.c Log Message: Fix the names of the classmethod and staticmethod constructors as passed to PyArg_ParseTuple() as part of the format string. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** funcobject.c 18 Mar 2002 03:09:06 -0000 2.51 --- funcobject.c 3 Apr 2002 21:42:45 -0000 2.52 *************** *** 487,491 **** PyObject *callable; ! if (!PyArg_ParseTuple(args, "O:callable", &callable)) return -1; Py_INCREF(callable); --- 487,491 ---- PyObject *callable; ! if (!PyArg_ParseTuple(args, "O:classmethod", &callable)) return -1; Py_INCREF(callable); *************** *** 619,623 **** PyObject *callable; ! if (!PyArg_ParseTuple(args, "O:callable", &callable)) return -1; Py_INCREF(callable); --- 619,623 ---- PyObject *callable; ! if (!PyArg_ParseTuple(args, "O:staticmethod", &callable)) return -1; Py_INCREF(callable); From fdrake@users.sourceforge.net Wed Apr 3 21:47:49 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 13:47:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Demo/xmlrpc xmlrpc_handler.py,1.1,1.2 xmlrpcserver.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/xmlrpc In directory usw-pr-cvs1:/tmp/cvs-serv15887 Modified Files: xmlrpc_handler.py xmlrpcserver.py Log Message: Slight modernization. Index: xmlrpc_handler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/xmlrpc/xmlrpc_handler.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xmlrpc_handler.py 11 Jul 2001 17:42:21 -0000 1.1 --- xmlrpc_handler.py 3 Apr 2002 21:47:47 -0000 1.2 *************** *** 13,18 **** import xmlrpclib - import regex - import string import sys --- 13,16 ---- *************** *** 44,48 **** # report exception back to server response = xmlrpclib.dumps ( ! xmlrpclib.Fault (1, "%s:%s" % (sys.exc_type, sys.exc_value)) ) else: --- 42,46 ---- # report exception back to server response = xmlrpclib.dumps ( ! xmlrpclib.Fault (1, "%s:%s" % sys.exc_info()[:2]) ) else: *************** *** 77,81 **** request.error (411) else: ! cl = string.atoi (cl) # using a 'numeric' terminator self.request.channel.set_terminator (cl) --- 75,79 ---- request.error (411) else: ! cl = int (cl) # using a 'numeric' terminator self.request.channel.set_terminator (cl) Index: xmlrpcserver.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/xmlrpc/xmlrpcserver.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xmlrpcserver.py 11 Jul 2001 17:42:21 -0000 1.1 --- xmlrpcserver.py 3 Apr 2002 21:47:47 -0000 1.2 *************** *** 43,47 **** # report exception back to server response = xmlrpclib.dumps( ! xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)) ) else: --- 43,47 ---- # report exception back to server response = xmlrpclib.dumps( ! xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]) ) else: From jackjansen@users.sourceforge.net Wed Apr 3 21:52:13 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Wed, 03 Apr 2002 13:52:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wapplication.py,1.17,1.18 Wminiapp.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv17168 Modified Files: Wapplication.py Wminiapp.py Log Message: e macresource.need() to open the W resource file in the application init code (if it isn't open already). PythonIDE still opens the resource file "manually" because it also uses presence of the CURS resource to determine whether it needs to adjust sys.path. Index: Wapplication.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Wapplication.py 21 Mar 2002 22:36:57 -0000 1.17 --- Wapplication.py 3 Apr 2002 21:52:10 -0000 1.18 *************** *** 8,11 **** --- 8,12 ---- from types import * from Carbon import Menu; MenuToolbox = Menu; del Menu + import macresource if hasattr(Win, "FrontNonFloatingWindow"): *************** *** 20,23 **** --- 21,26 ---- def __init__(self, signature='Pyth'): + # Open our resource file, if it is not open yet + macresource.need('CURS', 468, "Widgets.rsrc") import W W.setapplication(self, signature) Index: Wminiapp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wminiapp.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Wminiapp.py 3 Apr 2002 21:28:02 -0000 1.3 --- Wminiapp.py 3 Apr 2002 21:52:10 -0000 1.4 *************** *** 9,13 **** def __init__(self): from Carbon import Res ! macresource.open_pathname("Widgets.rsrc") self._menustocheck = [] self.preffilepath = os.path.join("Python", "PythonIDE preferences") --- 9,13 ---- def __init__(self): from Carbon import Res ! # macresource.open_pathname("Widgets.rsrc") self._menustocheck = [] self.preffilepath = os.path.join("Python", "PythonIDE preferences") From gvanrossum@users.sourceforge.net Wed Apr 3 22:11:07 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:11:07 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0285.txt,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv23427 Modified Files: pep-0285.txt Log Message: Accepted, closed the review period, pronounced all open issues, and added clarification and extra opinions to various spots. Will post once more. Index: pep-0285.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pep-0285.txt 3 Apr 2002 01:31:29 -0000 1.19 --- pep-0285.txt 3 Apr 2002 22:11:05 -0000 1.20 *************** *** 4,12 **** Last-Modified: $Date$ Author: guido@python.org (Guido van Rossum) ! Status: Draft Type: Standards Track Created: 8-Mar-2002 Python-Version: 2.3 ! Post-History: 8-Mar-2002, 30-Mar-2002 --- 4,12 ---- Last-Modified: $Date$ Author: guido@python.org (Guido van Rossum) ! Status: Accepted Type: Standards Track Created: 8-Mar-2002 Python-Version: 2.3 ! Post-History: 8-Mar-2002, 30-Mar-2002, 3-Apr-2002 *************** *** 26,114 **** Review ! Dear reviewers: ! I'm particularly interested in hearing your opinion about the ! following three issues: ! 1) Should this PEP be accepted at all. ! => The majority of reviewers so far are in favor, ranging from +0 ! (don't hate it) to 1 (yes please). Votes against are mixed: ! some are against all change, some think it's not needed, some ! think it will just add more confusion or complexity, some have ! irrational fears about code breakage based on misunderstanding ! the PEP (believing it adds reserved words, or believing it will ! require you to write "if bool(x):" where previously "if x:" ! worked; neither belief is true). ! 2) Should str(True) return "True" or "1": "1" might reduce ! backwards compatibility problems, but looks strange to me. (repr(True) would always return "True".) ! => Most reviewers prefer str(True) == "True" (which may mean that ! they don't appreciate the specific backwards compatibility ! issue brought up by Marc-Andre Lemburg :-). ! 3) Should the constants be called 'True' and 'False' ! (corresponding to None) or 'true' and 'false' (as in C++, Java ! and C99). ! => There's no clear preference either way here, so I'll break the ! tie by pronouncing False and True. ! Most other details of the proposal are pretty much forced by the ! backwards compatibility requirement; for example, True == 1 and ! True+1 == 2 must hold, else reams of existing code would break. ! Minor additional issues: 4) Should we strive to eliminate non-Boolean operations on bools in the future, through suitable warnings, so that for example ! True+1 would eventually (in Python 3000) be illegal. ! Personally, I think we shouldn't; 28+isleap(y) seems totally ! reasonable to me. ! => Most reviewers agree with me. ! 5) Should operator.truth(x) return an int or a bool. Tim Peters ! believes it should return an int because it's been documented ! as such. I think it should return a bool; most other standard ! predicates (like issubtype()) have also been documented as ! returning 0 or 1, and it's obvious that we want to change those ! to return a bool. ! => Most reviewers agree with me. My take: operator.truth() exists ! to force a Boolean context on its argument (it calls the C API ! PyObject_IsTrue()). Whether the outcome is reported as int or ! bool is secondary; if bool exists there's no reason not to use ! it. ! New issues brought up during the review: 6) Should bool inherit from int? ! => My take: in an ideal world, bool might be better implemented as ! a separate integer type that knows how to perform mixed-mode arithmetic. However, inheriting bool from int eases the implementation enormously (in part since all C code that calls PyInt_Check() will continue to work -- this returns true for ! subclasses of int). Also, I believe in terms of ! substitutability, this is right: code that requires an int can ! be fed a bool and it will behave the same as 0 or 1. Code that ! requires a bool may not work when it is given an int; for ! example, 3 & 4 is 0, but both 3 and 4 are true when considered ! as truth values. 7) Should the name 'bool' be changed? ! => Some reviewers argue for boolean instead of bool, because this ! would be easier to understand (novices may have heard of Boolean algebra but may not make the connection with bool) or because they hate abbreviations. My take: Python uses abbreviations judiciously (like 'def', 'int', 'dict') and I ! don't think these are a burden to understanding. ! One reviewer argues to make the name 'truth'. I find this an ! unattractive name, and would actually prefer to reserve this term (in documentation) for the more abstract concept of truth values that already exists in Python. For example: "when a --- 26,120 ---- Review ! I've collected enough feedback to last me a lifetime, so I declare ! the review period officially OVER. I had Chinese food today; my ! fortune cookie said "Strong and bitter words indicate a weak ! cause." It reminded me of some of the posts against this ! PEP... :-) ! Anyway, here are my BDFL pronouncements. (Executive summary: I'm ! not changing a thing; all variants are rejected.) ! 1) Should this PEP be accepted? ! => Yes. ! There have been many arguments against the PEP. Many of them ! were based on misunderstandings. I've tried to clarify some of ! the most common misunderstandings below in the main text of the ! PEP. The only issue that weighs at all for me is the tendency ! of newbies to write "if x == True" where "if x" would suffice. ! More about that below too. I think this is not a sufficient ! reason to reject the PEP. ! ! 2) Should str(True) return "True" or "1"? "1" might reduce ! backwards compatibility problems, but looks strange. (repr(True) would always return "True".) ! => "True". ! Almost all reviewers agree with this. ! 3) Should the constants be called 'True' and 'False' (similar to ! None) or 'true' and 'false' (as in C++, Java and C99)? ! => True and False. ! Most reviewers agree that consistency within Python is more ! important than consistency with other languages. 4) Should we strive to eliminate non-Boolean operations on bools in the future, through suitable warnings, so that for example ! True+1 would eventually (in Python 3000) be illegal? ! => No. ! There's a small but vocal minority that would prefer to see ! "textbook" bools that don't support arithmetic operations at ! all, but most reviewers agree with me that bools should always ! allow arithmetic operations. ! 5) Should operator.truth(x) return an int or a bool? ! => bool. ! ! Tim Peters believes it should return an int, but almost all ! other reviewers agree that it should return a bool. My ! rationale: operator.truth() exists to force a Boolean context ! on its argument (it calls the C API PyObject_IsTrue()). ! Whether the outcome is reported as int or bool is secondary; if ! bool exists there's no reason not to use it. (Under the PEP, ! operator.truth() now becomes an alias for bool(); that's fine.) 6) Should bool inherit from int? ! => Yes. ! ! In an ideal world, bool might be better implemented as a ! separate integer type that knows how to perform mixed-mode arithmetic. However, inheriting bool from int eases the implementation enormously (in part since all C code that calls PyInt_Check() will continue to work -- this returns true for ! subclasses of int). Also, I believe this is right in terms of ! substitutability: code that requires an int can be fed a bool ! and it will behave the same as 0 or 1. Code that requires a ! bool may not work when it is given an int; for example, 3 & 4 ! is 0, but both 3 and 4 are true when considered as truth ! values. 7) Should the name 'bool' be changed? ! => No. ! ! Some reviewers have argued for boolean instead of bool, because ! this would be easier to understand (novices may have heard of Boolean algebra but may not make the connection with bool) or because they hate abbreviations. My take: Python uses abbreviations judiciously (like 'def', 'int', 'dict') and I ! don't think these are a burden to understanding. To a newbie, ! it doesn't matter whether it's called a waffle or a bool; it's ! a new word, and they learn quickly what it means. ! One reviewer has argued to make the name 'truth'. I find this ! an unattractive name, and would actually prefer to reserve this term (in documentation) for the more abstract concept of truth values that already exists in Python. For example: "when a *************** *** 121,125 **** writen as "if bool([]):" ??? ! => No!!! Some people believe that this is how a language with a Boolean type should behave. Because it was brought up, others have worried that I might agree with this position. Let me --- 127,133 ---- writen as "if bool([]):" ??? ! => No!!! ! ! Some people believe that this is how a language with a textbook Boolean type should behave. Because it was brought up, others have worried that I might agree with this position. Let me *************** *** 128,136 **** also the section "Clarification" below.) - 9) What about pickle and marshal? - - => I've added a paragraph to the specification requiring that - bool values roundtrip when pickled or marshalled. - Rationale --- 136,139 ---- *************** *** 186,195 **** >>> ! it would require one millisecond less thinking each time a 0 or 1 was printed. ! There's also the issue (which I've seen puzzling even experienced ! Pythonistas who had been away from the language for a while) that if ! you see: >>> cmp(a, b) --- 189,198 ---- >>> ! it would require a millisecond less thinking each time a 0 or 1 was printed. ! There's also the issue (which I've seen baffling even experienced ! Pythonistas who had been away from the language for a while) that ! if you see: >>> cmp(a, b) *************** *** 200,206 **** you might be tempted to believe that cmp() also returned a truth ! value. If ints are not (normally) used for Booleans results, this ! would stand out much more clearly as something completely ! different. --- 203,210 ---- you might be tempted to believe that cmp() also returned a truth ! value, whereas in reality it can return three different values ! (-1, 0, 1). If ints were not (normally) used to represent ! Booleans results, this would stand out much more clearly as ! something completely different. *************** *** 255,266 **** True = int.__new__(bool, 1) ! The values False and True will be singletons, like None; the C ! implementation will not allow other instances of bool to be ! created. At the C level, the existing globals Py_False and ! Py_True will be appropriated to refer to False and True. True and False will properly round-trip through pickling and marshalling; for example pickle.loads(pickle.dumps(True)) will ! return True. All built-in operations that are defined to return a Boolean --- 259,270 ---- True = int.__new__(bool, 1) ! The values False and True will be singletons, like None. Because ! the type has two values, perhaps these should be called ! "doubletons"? The real implementation will not allow other ! instances of bool to be created. True and False will properly round-trip through pickling and marshalling; for example pickle.loads(pickle.dumps(True)) will ! return True, and so will marshal.loads(marshal.dumps(True)). All built-in operations that are defined to return a Boolean *************** *** 273,277 **** istitle(), isupper(), and startswith(), the unicode methods isdecimal() and isnumeric(), and the 'closed' attribute of file ! objects. Because bool inherits from int, True+1 is valid and equals 2, and --- 277,282 ---- istitle(), isupper(), and startswith(), the unicode methods isdecimal() and isnumeric(), and the 'closed' attribute of file ! objects. The predicates in the operator module are also changed ! to return a bool, including operator.truth(). Because bool inherits from int, True+1 is valid and equals 2, and *************** *** 288,291 **** --- 293,319 ---- + C API + + The header file "boolobject.h" defines the C API for the bool + type. It is included by "Python.h" so there is no need to include + it directly. + + The existing names Py_False and Py_True reference the unique bool + objects False and True (previously these referenced static int + objects with values 0 and 1, which were not unique amongst int + values). + + A new API, PyObject *PyBool_FromLong(long), takes a C long int + argument and returns a new reference to either Py_False (when the + argument is zero) or Py_True (when it is nonzero). + + To check whether an object is a bool, the macro PyBool_Check() can + be used. + + The type of bool instances is PyBoolObject *. + + The bool type object is available as PyBool_Type. + + Clarification *************** *** 311,316 **** I don't see this as a problem, and I don't want evolve the ! language in this direction either; I don't believe that a stricter ! interpretation of "Booleanness" makes the language any clearer. Another consequence of the compatibility requirement is that the --- 339,345 ---- I don't see this as a problem, and I don't want evolve the ! language in this direction either. I don't believe that a ! stricter interpretation of "Booleanness" makes the language any ! clearer. Another consequence of the compatibility requirement is that the *************** *** 321,366 **** don't force the outcome to be a bool. Of course, if both arguments are bools, the outcome is always a bool. It can also ! easily be coerced into being a bool by writing for example ! "bool(x and y)". ! Issues ! Because the repr() or str() of a bool value is different from an ! int value, some code (for example doctest-based unit tests, and ! possibly database code that relies on things like "%s" % truth) ! may fail. How much of a backwards compatibility problem this will ! be, I don't know. If this turns out to be a real problem, we ! could changes the rules so that str() of a bool returns "0" or ! "1", while repr() of a bool still returns "False" or "True". ! Other languages (C99, C++, Java) name the constants "false" and ! "true", in all lowercase. In Python, I prefer to stick with the ! example set by the existing built-in constants, which all use ! CapitalizedWords: None, Ellipsis, NotImplemented (as well as all ! built-in exceptions). Python's built-in module uses all lowercase ! for functions and types only. But I'm willing to consider the ! lowercase alternatives if enough people think it looks better. ! It has been suggested that, in order to satisfy user expectations, ! for every x that is considered true in a Boolean context, the ! expression x == True should be true, and likewise if x is ! considered false, x == False should be true. This is of course ! impossible; it would mean that for example 6 == True and 7 == ! True, from which one could infer 6 == 7. Similarly, [] == False ! == None would be true, and one could infer [] == None, which is ! not the case. I'm not sure where this suggestion came from; it ! was made several times during the first review period. For truth ! testing, one should use "if", as in "if x: print 'Yes'", not ! comparison to a truth value; "if x == True: print 'Yes'" is not ! only wrong, it is also strangely redundant. Implementation ! An experimental, but fairly complete implementation in C has been ! uploaded to the SourceForge patch manager: ! http://python.org/sf/528022 --- 350,430 ---- don't force the outcome to be a bool. Of course, if both arguments are bools, the outcome is always a bool. It can also ! easily be coerced into being a bool by writing for example "bool(x ! and y)". ! Resolved Issues ! (See also the Review section above.) ! - Because the repr() or str() of a bool value is different from an ! int value, some code (for example doctest-based unit tests, and ! possibly database code that relies on things like "%s" % truth) ! may fail. It is easy to work around this (without explicitly ! referencing the bool type), and it is expected that this only ! affects a very small amount of code that can easily be fixed. ! - Other languages (C99, C++, Java) name the constants "false" and ! "true", in all lowercase. For Python, I prefer to stick with ! the example set by the existing built-in constants, which all ! use CapitalizedWords: None, Ellipsis, NotImplemented (as well as ! all built-in exceptions). Python's built-in namespace uses all ! lowercase for functions and types only. ! ! - It has been suggested that, in order to satisfy user ! expectations, for every x that is considered true in a Boolean ! context, the expression x == True should be true, and likewise ! if x is considered false, x == False should be true. In ! particular newbies who have only just learned about Boolean ! variables are likely to write ! ! if x == True: ... ! ! instead of the correct form, ! ! if x: ... ! ! There seem to be strong psychological and linguistic reasons why ! many people are at first uncomfortable with the latter form, but ! I believe that the solution should be in education rather than ! in crippling the language. After all, == is general seen as a ! transitive operator, meaning that from a==b and b==c we can ! deduce a==c. But if any comparison to True were to report ! equality when the other operand was a true value of any type, ! atrocities like 6==True==7 would hold true, from which one could ! infer the falsehood 6==7. That's unacceptable. (In addition, ! it would break backwards compatibility. But even if it didn't, ! I'd still be against this, for the stated reasons.) ! ! Newbies should also be reminded that there's never a reason to ! write ! ! if bool(x): ... ! ! since the bool is implicit in the "if". Explicit is *not* ! better than implicit here, since the added verbiage impairs ! redability and there's no other interpretation possible. There ! is, however, sometimes a reason to write ! ! b = bool(x) ! ! This is useful when it is unattractive to keep a reference to an ! arbitrary object x, or when normalization is required for some ! other reason. It is also sometimes appropriate to write ! ! i = int(bool(x)) ! ! which converts the bool to an int with the value 0 or 1. This ! conveys the intention to henceforth use the value as an int. Implementation ! A complete implementation in C has been uploaded to the ! SourceForge patch manager: ! http://python.org/sf/528022 ! ! This will soon be checked into CVS for python 2.3a0. From gvanrossum@users.sourceforge.net Wed Apr 3 22:11:28 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:11:28 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.173,1.174 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv23509 Modified Files: pep-0000.txt Log Message: Accept PEP 285. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -d -r1.173 -r1.174 *** pep-0000.txt 3 Apr 2002 18:58:17 -0000 1.173 --- pep-0000.txt 3 Apr 2002 22:11:23 -0000 1.174 *************** *** 54,57 **** --- 54,58 ---- S 252 Making Types Look More Like Classes van Rossum S 253 Subtyping Built-in Types van Rossum + S 285 Adding a bool type van Rossum Open PEPs (under consideration) *************** *** 92,96 **** S 282 A Logging System Mick S 284 Integer for-loops Eppstein, Ewing - S 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis S 287 reStructuredText Standard Docstring Format Goodger --- 93,96 ---- From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv31419 Modified Files: Makefile.pre.in Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Makefile.pre.in 29 Mar 2002 16:28:30 -0000 1.78 --- Makefile.pre.in 3 Apr 2002 22:41:49 -0000 1.79 *************** *** 250,253 **** --- 250,254 ---- OBJECT_OBJS= \ Objects/abstract.o \ + Objects/boolobject.o \ Objects/bufferobject.o \ Objects/cellobject.o \ *************** *** 432,435 **** --- 433,437 ---- Include/Python.h \ Include/abstract.h \ + Include/boolobject.h \ Include/bufferobject.h \ Include/ceval.h \ From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv31419/Doc/ref Modified Files: ref3.tex Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** ref3.tex 1 Apr 2002 18:53:36 -0000 1.84 --- ref3.tex 3 Apr 2002 22:41:50 -0000 1.85 *************** *** 163,167 **** \obindex{integer} ! There are two types of integers: \begin{description} --- 163,167 ---- \obindex{integer} ! There are three types of integers: \begin{description} *************** *** 188,191 **** --- 188,202 ---- \obindex{long integer} + \item[Booleans] + These represent the truth values False and True. The two objects + representing the values False and True are the only Boolean objects. + The Boolean type is a subtype of plain integers, and Boolean values + behave like the values 0 and 1, respectively, in almost all contexts, + the exception being that when converted to a string, the strings + \code{"False"} or \code{"True"} are returned, respectively. + \obindex{Boolean} + \ttindex{False} + \ttindex{True} + \end{description} % Integers *************** *** 223,226 **** --- 234,238 ---- \end{description} % Numbers + \item[Sequences] These represent finite ordered sets indexed by non-negative numbers. *************** *** 1075,1080 **** \begin{methoddesc}[object]{__nonzero__}{self} ! Called to implement truth value testing; should return \code{0} or ! \code{1}. When this method is not defined, \method{__len__()} is called, if it is defined (see below). If a class defines neither \method{__len__()} nor \method{__nonzero__()}, all its instances are --- 1087,1094 ---- \begin{methoddesc}[object]{__nonzero__}{self} ! Called to implement truth value testing, and the built-in operation ! \code{bool()}; should return \code{False} or \code{True}, or their ! integer equivalents \code{0} or \code{1}. ! When this method is not defined, \method{__len__()} is called, if it is defined (see below). If a class defines neither \method{__len__()} nor \method{__nonzero__()}, all its instances are From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfuncs.tex,1.102,1.103 libstdtypes.tex,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31419/Doc/lib Modified Files: libfuncs.tex libstdtypes.tex Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** libfuncs.tex 6 Mar 2002 02:29:30 -0000 1.102 --- libfuncs.tex 3 Apr 2002 22:41:50 -0000 1.103 *************** *** 78,81 **** --- 78,91 ---- \end{funcdesc} + \begin{funcdesc}{bool}{x} + Convert a value to a Boolean, using the standard truth testing + procedure. If \code{x} is false, this returns \code{False}; + otherwise it returns \code{True}. \code{bool} is also a class, + which is a subclass of \code{int}. Class \code{bool} cannot be + subclassed further. Its only instances are \code{False} and + \code{True}. + \indexii{Boolean}{type} + \end{funcdesc} + \begin{funcdesc}{buffer}{object\optional{, offset\optional{, size}}} The \var{object} argument must be an object that supports the buffer Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** libstdtypes.tex 12 Mar 2002 03:04:44 -0000 1.83 --- libstdtypes.tex 3 Apr 2002 22:41:50 -0000 1.84 *************** *** 3,10 **** The following sections describe the standard types that are built into the interpreter. These are the numeric types, sequence types, and ! several others, including types themselves. There is no explicit ! Boolean type; use integers instead. \indexii{built-in}{types} - \indexii{Boolean}{type} Some operations are supported by several object types; in particular, --- 3,8 ---- The following sections describe the standard types that are built into the interpreter. These are the numeric types, sequence types, and ! several others, including types themselves. \indexii{built-in}{types} Some operations are supported by several object types; in particular, *************** *** 31,34 **** --- 29,35 ---- \withsubitem{(Built-in object)}{\ttindex{None}} + \item \code{False} + \withsubitem{(Built-in object)}{\ttindex{False}} + \item zero of any numeric type, for example, \code{0}, \code{0L}, \code{0.0}, \code{0j}. *************** *** 51,59 **** Operations and built-in functions that have a Boolean result always ! return \code{0} for false and \code{1} for true, unless otherwise ! stated. (Important exception: the Boolean operations ! \samp{or}\opindex{or} and \samp{and}\opindex{and} always return one of ! their operands.) ! \subsection{Boolean Operations \label{boolean}} --- 52,61 ---- Operations and built-in functions that have a Boolean result always ! return \code{0} or \code{False} for false and \code{1} or \code{True} ! for true, unless otherwise stated. (Important exception: the Boolean ! operations \samp{or}\opindex{or} and \samp{and}\opindex{and} always ! return one of their operands.) ! \index{False} ! \index{True} \subsection{Boolean Operations \label{boolean}} *************** *** 69,73 **** \hline \lineiii{not \var{x}} ! {if \var{x} is false, then \code{1}, else \code{0}}{(2)} \end{tableiii} \opindex{and} --- 71,75 ---- \hline \lineiii{not \var{x}} ! {if \var{x} is false, then \code{True}, else \code{False}}{(2)} \end{tableiii} \opindex{and} *************** *** 162,167 **** \subsection{Numeric Types \label{typesnumeric}} ! There are four numeric types: \dfn{plain integers}, \dfn{long integers}, \dfn{floating point numbers}, and \dfn{complex numbers}. Plain integers (also just called \dfn{integers}) are implemented using \ctype{long} in C, which gives them at least 32 --- 164,171 ---- \subsection{Numeric Types \label{typesnumeric}} ! There are four distinct numeric types: \dfn{plain integers}, ! \dfn{long integers}, \dfn{floating point numbers}, and \dfn{complex numbers}. + In addition, Booleans are a subtype of plain integers. Plain integers (also just called \dfn{integers}) are implemented using \ctype{long} in C, which gives them at least 32 *************** *** 171,174 **** --- 175,179 ---- working with. \obindex{numeric} + \obindex{Boolean} \obindex{integer} \obindex{long integer} *************** *** 1389,1392 **** --- 1394,1413 ---- It is written as \code{Ellipsis}. + + \subsubsection{Boolean Values} + + Boolean values are the two constant objects \code{False} and + \code{True}. They are used to represent truth values (although other + values can also be considered false or true). In numeric contexts + (for example when used as the argument to an arithmetic operator), + they behave like the integers 0 and 1, respectively. The built-in + function \function{bool()} can be used to cast any value to a Boolean, + if the value can be interpreted as a truth value (see section Truth + Value Testing above). + + They are written as \code{False} and \code{True}, respectively. + \index{False} + \index{True} + \indexii{Boolean}{values} From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:53 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.78,2.79 operator.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31419/Modules Modified Files: cPickle.c operator.c Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -d -r2.78 -r2.79 *** cPickle.c 1 Apr 2002 17:40:08 -0000 2.78 --- cPickle.c 3 Apr 2002 22:41:50 -0000 2.79 *************** *** 126,129 **** --- 126,132 ---- #define EMPTY_TUPLE ')' #define SETITEMS 'u' + #define TRUE 'Z' + #define FALSE 'z' + static char MARKv = MARK; *************** *** 979,982 **** --- 982,996 ---- } + static int + save_bool(Picklerobject *self, PyObject *args) + { + static char buf[2] = {FALSE, TRUE}; + long l = PyInt_AS_LONG((PyIntObject *)args); + + if ((*self->write_func)(self, buf + l, 1) < 0) + return -1; + + return 0; + } static int *************** *** 1922,1925 **** --- 1936,1945 ---- switch (type->tp_name[0]) { + case 'b': + if (args == Py_False || args == Py_True) { + res = save_bool(self, args); + goto finally; + } + break; case 'i': if (type == &PyInt_Type) { *************** *** 2637,2640 **** --- 2657,2674 ---- static int + load_false(Unpicklerobject *self) + { + PDATA_APPEND(self->stack, Py_False, -1); + return 0; + } + + static int + load_true(Unpicklerobject *self) + { + PDATA_APPEND(self->stack, Py_True, -1); + return 0; + } + + static int bad_readline(void) { *************** *** 3775,3778 **** --- 3809,3822 ---- case NONE: if (load_none(self) < 0) + break; + continue; + + case FALSE: + if (load_false(self) < 0) + break; + continue; + + case TRUE: + if (load_true(self) < 0) break; continue; Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** operator.c 9 Aug 2001 20:14:34 -0000 2.18 --- operator.c 3 Apr 2002 22:41:50 -0000 2.19 *************** *** 103,107 **** if(! PyArg_ParseTuple(a,"O:" #OP,&a1)) return NULL; \ if(-1 == (r=AOP(a1))) return NULL; \ ! return PyInt_FromLong(r); } #define spami2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ --- 103,107 ---- if(! PyArg_ParseTuple(a,"O:" #OP,&a1)) return NULL; \ if(-1 == (r=AOP(a1))) return NULL; \ ! return PyBool_FromLong(r); } #define spami2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ *************** *** 111,114 **** --- 111,120 ---- return PyInt_FromLong(r); } + #define spami2b(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ + PyObject *a1, *a2; long r; \ + if(! PyArg_ParseTuple(a,"OO:" #OP,&a1,&a2)) return NULL; \ + if(-1 == (r=AOP(a1,a2))) return NULL; \ + return PyBool_FromLong(r); } + #define spamrc(OP,A) static PyObject *OP(PyObject *s, PyObject *a) { \ PyObject *a1, *a2; \ *************** *** 140,145 **** spam2(op_concat , PySequence_Concat) spamoi(op_repeat , PySequence_Repeat) ! spami2(op_contains , PySequence_Contains) ! spami2(sequenceIncludes, PySequence_Contains) spami2(indexOf , PySequence_Index) spami2(countOf , PySequence_Count) --- 146,151 ---- spam2(op_concat , PySequence_Concat) spamoi(op_repeat , PySequence_Repeat) ! spami2b(op_contains , PySequence_Contains) ! spami2b(sequenceIncludes, PySequence_Contains) spami2(indexOf , PySequence_Index) spami2(countOf , PySequence_Count) *************** *** 209,217 **** "isCallable(a) -- Same as callable(a).") spam1(isNumberType, ! "isNumberType(a) -- Return 1 if a has a numeric type, and zero otherwise.") spam1(isSequenceType, ! "isSequenceType(a) -- Return 1 if a has a sequence type, and zero otherwise.") spam1(truth, ! "truth(a) -- Return 1 if a is true, and 0 otherwise.") spam2(contains,__contains__, "contains(a, b) -- Same as b in a (note reversed operands).") --- 215,223 ---- "isCallable(a) -- Same as callable(a).") spam1(isNumberType, ! "isNumberType(a) -- Return True if a has a numeric type, False otherwise.") spam1(isSequenceType, ! "isSequenceType(a) -- Return True if a has a sequence type, False otherwise.") spam1(truth, ! "truth(a) -- Return True if a is true, False otherwise.") spam2(contains,__contains__, "contains(a, b) -- Same as b in a (note reversed operands).") *************** *** 223,227 **** "countOf(a, b) -- Return the number of times b occurs in a.") spam1(isMappingType, ! "isMappingType(a) -- Return 1 if a has a mapping type, and zero otherwise.") spam2(add,__add__, "add(a, b) -- Same as a + b.") --- 229,233 ---- "countOf(a, b) -- Return the number of times b occurs in a.") spam1(isMappingType, ! "isMappingType(a) -- Return True if a has a mapping type, False otherwise.") spam2(add,__add__, "add(a, b) -- Same as a + b.") From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:53 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.249,2.250 marshal.c,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31419/Python Modified Files: bltinmodule.c marshal.c Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.249 retrieving revision 2.250 diff -C2 -d -r2.249 -r2.250 *** bltinmodule.c 9 Mar 2002 12:07:51 -0000 2.249 --- bltinmodule.c 3 Apr 2002 22:41:51 -0000 2.250 *************** *** 131,139 **** builtin_callable(PyObject *self, PyObject *v) { ! return PyInt_FromLong((long)PyCallable_Check(v)); } static char callable_doc[] = ! "callable(object) -> Boolean\n\ \n\ Return whether the object is callable (i.e., some kind of function).\n\ --- 131,139 ---- builtin_callable(PyObject *self, PyObject *v) { ! return PyBool_FromLong((long)PyCallable_Check(v)); } static char callable_doc[] = ! "callable(object) -> bool\n\ \n\ Return whether the object is callable (i.e., some kind of function).\n\ *************** *** 714,718 **** static char hasattr_doc[] = ! "hasattr(object, name) -> Boolean\n\ \n\ Return whether the object has an attribute with the given name.\n\ --- 714,718 ---- static char hasattr_doc[] = ! "hasattr(object, name) -> bool\n\ \n\ Return whether the object has an attribute with the given name.\n\ *************** *** 1667,1675 **** if (retval < 0) return NULL; ! return PyInt_FromLong(retval); } static char isinstance_doc[] = ! "isinstance(object, class-or-type-or-tuple) -> Boolean\n\ \n\ Return whether an object is an instance of a class or of a subclass thereof.\n\ --- 1667,1675 ---- if (retval < 0) return NULL; ! return PyBool_FromLong(retval); } static char isinstance_doc[] = ! "isinstance(object, class-or-type-or-tuple) -> bool\n\ \n\ Return whether an object is an instance of a class or of a subclass thereof.\n\ *************** *** 1692,1700 **** if (retval < 0) return NULL; ! return PyInt_FromLong(retval); } static char issubclass_doc[] = ! "issubclass(C, B) -> Boolean\n\ \n\ Return whether class C is a subclass (i.e., a derived class) of class B."; --- 1692,1700 ---- if (retval < 0) return NULL; ! return PyBool_FromLong(retval); } static char issubclass_doc[] = ! "issubclass(C, B) -> bool\n\ \n\ Return whether class C is a subclass (i.e., a derived class) of class B."; *************** *** 1857,1860 **** --- 1857,1863 ---- SETBUILTIN("Ellipsis", Py_Ellipsis); SETBUILTIN("NotImplemented", Py_NotImplemented); + SETBUILTIN("False", Py_False); + SETBUILTIN("True", Py_True); + SETBUILTIN("bool", &PyBool_Type); SETBUILTIN("classmethod", &PyClassMethod_Type); #ifndef WITHOUT_COMPLEX *************** *** 1880,1884 **** SETBUILTIN("unicode", &PyUnicode_Type); #endif ! debug = PyInt_FromLong(Py_OptimizeFlag == 0); if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { Py_XDECREF(debug); --- 1883,1887 ---- SETBUILTIN("unicode", &PyUnicode_Type); #endif ! debug = PyBool_FromLong(Py_OptimizeFlag == 0); if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { Py_XDECREF(debug); Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** marshal.c 31 Mar 2002 14:37:44 -0000 1.70 --- marshal.c 3 Apr 2002 22:41:51 -0000 1.71 *************** *** 18,21 **** --- 18,23 ---- #define TYPE_NULL '0' #define TYPE_NONE 'N' + #define TYPE_FALSE 'F' + #define TYPE_TRUE 'T' #define TYPE_STOPITER 'S' #define TYPE_ELLIPSIS '.' *************** *** 127,130 **** --- 129,138 ---- w_byte(TYPE_ELLIPSIS, p); } + else if (v == Py_False) { + w_byte(TYPE_FALSE, p); + } + else if (v == Py_True) { + w_byte(TYPE_TRUE, p); + } else if (PyInt_Check(v)) { long x = PyInt_AS_LONG((PyIntObject *)v); *************** *** 398,401 **** --- 406,417 ---- Py_INCREF(Py_Ellipsis); return Py_Ellipsis; + + case TYPE_FALSE: + Py_INCREF(Py_False); + return Py_False; + + case TYPE_TRUE: + Py_INCREF(Py_True); + return Py_True; case TYPE_INT: From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include Python.h,2.44,2.45 intobject.h,2.24,2.25 object.h,2.99,2.100 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv31419/Include Modified Files: Python.h intobject.h object.h Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** Python.h 25 Mar 2002 22:21:58 -0000 2.44 --- Python.h 3 Apr 2002 22:41:50 -0000 2.45 *************** *** 80,83 **** --- 80,84 ---- #include "unicodeobject.h" #include "intobject.h" + #include "boolobject.h" #include "longobject.h" #include "floatobject.h" Index: intobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/intobject.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** intobject.h 10 Sep 2001 20:52:47 -0000 2.24 --- intobject.h 3 Apr 2002 22:41:50 -0000 2.25 *************** *** 39,57 **** extern DL_IMPORT(long) PyInt_GetMax(void); - - /* - False and True are special intobjects used by Boolean expressions. - All values of type Boolean must point to either of these; but in - contexts where integers are required they are integers (valued 0 and 1). - Hope these macros don't conflict with other people's. - - Don't forget to apply Py_INCREF() when returning True or False!!! - */ - - extern DL_IMPORT(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; /* Don't use these directly */ - - #define Py_False ((PyObject *) &_Py_ZeroStruct) - #define Py_True ((PyObject *) &_Py_TrueStruct) - /* Macro, trading safety for speed */ #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) --- 39,42 ---- Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.99 retrieving revision 2.100 diff -C2 -d -r2.99 -r2.100 *** object.h 8 Dec 2001 18:02:50 -0000 2.99 --- object.h 3 Apr 2002 22:41:50 -0000 2.100 *************** *** 532,537 **** if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \ else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \ ! else (void)fprintf( stderr, "%s:%i negative ref count %i\n", \ ! __FILE__, __LINE__, (op)->ob_refcnt) #else /* !Py_REF_DEBUG */ --- 532,537 ---- if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \ else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \ ! else ((void)fprintf( stderr, "%s:%i negative ref count %i\n", \ ! __FILE__, __LINE__, (op)->ob_refcnt), abort()) #else /* !Py_REF_DEBUG */ From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib difflib.py,1.7,1.8 doctest.py,1.22,1.23 pickle.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31419/Lib Modified Files: difflib.py doctest.py pickle.py Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** difflib.py 1 Apr 2002 00:28:59 -0000 1.7 --- difflib.py 3 Apr 2002 22:41:50 -0000 1.8 *************** *** 977,985 **** >>> IS_LINE_JUNK('\n') ! 1 >>> IS_LINE_JUNK(' # \n') ! 1 >>> IS_LINE_JUNK('hello\n') ! 0 """ --- 977,985 ---- >>> IS_LINE_JUNK('\n') ! True >>> IS_LINE_JUNK(' # \n') ! True >>> IS_LINE_JUNK('hello\n') ! False """ *************** *** 993,1003 **** >>> IS_CHARACTER_JUNK(' ') ! 1 >>> IS_CHARACTER_JUNK('\t') ! 1 >>> IS_CHARACTER_JUNK('\n') ! 0 >>> IS_CHARACTER_JUNK('x') ! 0 """ --- 993,1003 ---- >>> IS_CHARACTER_JUNK(' ') ! True >>> IS_CHARACTER_JUNK('\t') ! True >>> IS_CHARACTER_JUNK('\n') ! False >>> IS_CHARACTER_JUNK('x') ! False """ Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** doctest.py 20 Mar 2002 19:32:03 -0000 1.22 --- doctest.py 3 Apr 2002 22:41:50 -0000 1.23 *************** *** 546,562 **** >>> is_private("a.b", "my_func") ! 0 >>> is_private("____", "_my_func") ! 1 >>> is_private("someclass", "__init__") ! 0 >>> is_private("sometypo", "__init_") ! 1 >>> is_private("x.y.z", "_") ! 1 >>> is_private("_x.y.z", "__") ! 0 >>> is_private("", "") # senseless but consistent ! 0 """ --- 546,562 ---- >>> is_private("a.b", "my_func") ! False >>> is_private("____", "_my_func") ! True >>> is_private("someclass", "__init__") ! False >>> is_private("sometypo", "__init_") ! True >>> is_private("x.y.z", "_") ! True >>> is_private("_x.y.z", "__") ! False >>> is_private("", "") # senseless but consistent ! False """ Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** pickle.py 26 Mar 2002 00:51:56 -0000 1.58 --- pickle.py 3 Apr 2002 22:41:50 -0000 1.59 *************** *** 102,105 **** --- 102,108 ---- SETITEMS = 'u' BINFLOAT = 'G' + TRUE = 'Z' + FALSE = 'z' + __all__.extend([x for x in dir() if re.match("[A-Z][A-Z0-9_]+$",x)]) *************** *** 257,260 **** --- 260,270 ---- dispatch[NoneType] = save_none + def save_bool(self, object): + if object: + self.write(TRUE) + else: + self.write(FALSE) + dispatch[bool] = save_bool + def save_int(self, object): if self.bin: *************** *** 629,632 **** --- 639,650 ---- self.append(None) dispatch[NONE] = load_none + + def load_false(self): + self.append(False) + dispatch[FALSE] = load_false + + def load_true(self): + self.append(True) + dispatch[TRUE] = load_true def load_int(self): From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_augassign,1.2,1.3 test_extcall,1.12,1.13 test_gettext,1.3,1.4 test_grammar,1.18,1.19 test_richcmp,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv31419/Lib/test/output Modified Files: test_augassign test_extcall test_gettext test_grammar test_richcmp Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: test_augassign =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_augassign,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_augassign 29 Aug 2001 17:50:27 -0000 1.2 --- test_augassign 3 Apr 2002 22:41:50 -0000 1.3 *************** *** 5,16 **** [1, 2, 3, 4, 1, 2, 3, 4] [1, 2, 1, 2, 3] ! 1 ! 1 ! 1 11 ! 1 12 ! 1 ! 1 13 __add__ called --- 5,16 ---- [1, 2, 3, 4, 1, 2, 3, 4] [1, 2, 1, 2, 3] ! True ! True ! True 11 ! True 12 ! True ! True 13 __add__ called Index: test_extcall =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_extcall,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_extcall 24 Aug 2001 19:46:21 -0000 1.12 --- test_extcall 3 Apr 2002 22:41:50 -0000 1.13 *************** *** 32,36 **** NoneType object argument after ** must be a dictionary dir() got multiple values for keyword argument 'b' ! 3 512 1 3 3 --- 32,36 ---- NoneType object argument after ** must be a dictionary dir() got multiple values for keyword argument 'b' ! 3 512 True 3 3 Index: test_gettext =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_gettext,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_gettext 30 Aug 2000 03:32:07 -0000 1.3 --- test_gettext 3 Apr 2002 22:41:50 -0000 1.4 *************** *** 24,28 **** bacon test api 2 ! 1 gettext albatross --- 24,28 ---- bacon test api 2 ! True gettext albatross Index: test_grammar =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_grammar,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_grammar 26 Sep 2001 12:43:39 -0000 1.18 --- test_grammar 3 Apr 2002 22:41:50 -0000 1.19 *************** *** 61,65 **** [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] ! [0, 0, 0] [[1, 2], [3, 4], [5, 6]] [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] --- 61,65 ---- [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] ! [False, False, False] [[1, 2], [3, 4], [5, 6]] [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] Index: test_richcmp =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_richcmp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_richcmp 18 Jan 2001 15:48:05 -0000 1.1 --- test_richcmp 3 Apr 2002 22:41:50 -0000 1.2 *************** *** 5,11 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | 0 | 1 | 1 | ! Number(1) | 0 | 0 | 1 | ! Number(2) | 0 | 0 | 0 | ----------+-----------+-----------+-----------+- --- 5,11 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | False | True | True | ! Number(1) | False | False | True | ! Number(2) | False | False | False | ----------+-----------+-----------+-----------+- *************** *** 14,20 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | 1 | 1 | 1 | ! Number(1) | 0 | 1 | 1 | ! Number(2) | 0 | 0 | 1 | ----------+-----------+-----------+-----------+- --- 14,20 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | True | True | True | ! Number(1) | False | True | True | ! Number(2) | False | False | True | ----------+-----------+-----------+-----------+- *************** *** 23,29 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | 1 | 0 | 0 | ! Number(1) | 0 | 1 | 0 | ! Number(2) | 0 | 0 | 1 | ----------+-----------+-----------+-----------+- --- 23,29 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | True | False | False | ! Number(1) | False | True | False | ! Number(2) | False | False | True | ----------+-----------+-----------+-----------+- *************** *** 32,38 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | 0 | 1 | 1 | ! Number(1) | 1 | 0 | 1 | ! Number(2) | 1 | 1 | 0 | ----------+-----------+-----------+-----------+- --- 32,38 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | False | True | True | ! Number(1) | True | False | True | ! Number(2) | True | True | False | ----------+-----------+-----------+-----------+- *************** *** 41,47 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | 0 | 0 | 0 | ! Number(1) | 1 | 0 | 0 | ! Number(2) | 1 | 1 | 0 | ----------+-----------+-----------+-----------+- --- 41,47 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | False | False | False | ! Number(1) | True | False | False | ! Number(2) | True | True | False | ----------+-----------+-----------+-----------+- *************** *** 50,56 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | 1 | 0 | 0 | ! Number(1) | 1 | 1 | 0 | ! Number(2) | 1 | 1 | 1 | ----------+-----------+-----------+-----------+- --- 50,56 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! Number(0) | True | False | False | ! Number(1) | True | True | False | ! Number(2) | True | True | True | ----------+-----------+-----------+-----------+- *************** *** 61,67 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | 0 | 1 | 1 | ! 1 | 0 | 0 | 1 | ! 2 | 0 | 0 | 0 | ----------+-----------+-----------+-----------+- --- 61,67 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | False | True | True | ! 1 | False | False | True | ! 2 | False | False | False | ----------+-----------+-----------+-----------+- *************** *** 70,76 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | 1 | 1 | 1 | ! 1 | 0 | 1 | 1 | ! 2 | 0 | 0 | 1 | ----------+-----------+-----------+-----------+- --- 70,76 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | True | True | True | ! 1 | False | True | True | ! 2 | False | False | True | ----------+-----------+-----------+-----------+- *************** *** 79,85 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | 1 | 0 | 0 | ! 1 | 0 | 1 | 0 | ! 2 | 0 | 0 | 1 | ----------+-----------+-----------+-----------+- --- 79,85 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | True | False | False | ! 1 | False | True | False | ! 2 | False | False | True | ----------+-----------+-----------+-----------+- *************** *** 88,94 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | 0 | 1 | 1 | ! 1 | 1 | 0 | 1 | ! 2 | 1 | 1 | 0 | ----------+-----------+-----------+-----------+- --- 88,94 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | False | True | True | ! 1 | True | False | True | ! 2 | True | True | False | ----------+-----------+-----------+-----------+- *************** *** 97,103 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | 0 | 0 | 0 | ! 1 | 1 | 0 | 0 | ! 2 | 1 | 1 | 0 | ----------+-----------+-----------+-----------+- --- 97,103 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | False | False | False | ! 1 | True | False | False | ! 2 | True | True | False | ----------+-----------+-----------+-----------+- *************** *** 106,112 **** | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | 1 | 0 | 0 | ! 1 | 1 | 1 | 0 | ! 2 | 1 | 1 | 1 | ----------+-----------+-----------+-----------+- --- 106,112 ---- | Number(0) | Number(1) | Number(2) | ----------+-----------+-----------+-----------+- ! 0 | True | False | False | ! 1 | True | True | False | ! 2 | True | True | True | ----------+-----------+-----------+-----------+- *************** *** 117,123 **** | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | 0 | 1 | 1 | ! Number(1) | 0 | 0 | 1 | ! Number(2) | 0 | 0 | 0 | ----------+-----------+-----------+-----------+- --- 117,123 ---- | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | False | True | True | ! Number(1) | False | False | True | ! Number(2) | False | False | False | ----------+-----------+-----------+-----------+- *************** *** 126,132 **** | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | 1 | 1 | 1 | ! Number(1) | 0 | 1 | 1 | ! Number(2) | 0 | 0 | 1 | ----------+-----------+-----------+-----------+- --- 126,132 ---- | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | True | True | True | ! Number(1) | False | True | True | ! Number(2) | False | False | True | ----------+-----------+-----------+-----------+- *************** *** 135,141 **** | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | 1 | 0 | 0 | ! Number(1) | 0 | 1 | 0 | ! Number(2) | 0 | 0 | 1 | ----------+-----------+-----------+-----------+- --- 135,141 ---- | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | True | False | False | ! Number(1) | False | True | False | ! Number(2) | False | False | True | ----------+-----------+-----------+-----------+- *************** *** 144,150 **** | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | 0 | 1 | 1 | ! Number(1) | 1 | 0 | 1 | ! Number(2) | 1 | 1 | 0 | ----------+-----------+-----------+-----------+- --- 144,150 ---- | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | False | True | True | ! Number(1) | True | False | True | ! Number(2) | True | True | False | ----------+-----------+-----------+-----------+- *************** *** 153,159 **** | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | 0 | 0 | 0 | ! Number(1) | 1 | 0 | 0 | ! Number(2) | 1 | 1 | 0 | ----------+-----------+-----------+-----------+- --- 153,159 ---- | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | False | False | False | ! Number(1) | True | False | False | ! Number(2) | True | True | False | ----------+-----------+-----------+-----------+- *************** *** 162,187 **** | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | 1 | 0 | 0 | ! Number(1) | 1 | 1 | 0 | ! Number(2) | 1 | 1 | 1 | ----------+-----------+-----------+-----------+- ************************************************** ! Vector([0, 1, 2, 3, 4]) < Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 0, 0]) ! Vector([0, 1, 2, 3, 4]) < [2, 2, 2, 2, 2] -> Vector([1, 1, 0, 0, 0]) ! [0, 1, 2, 3, 4] < Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 0, 0]) ! Vector([0, 1, 2, 3, 4]) <= Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 1, 0, 0]) ! Vector([0, 1, 2, 3, 4]) <= [2, 2, 2, 2, 2] -> Vector([1, 1, 1, 0, 0]) ! [0, 1, 2, 3, 4] <= Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 1, 0, 0]) ! Vector([0, 1, 2, 3, 4]) == Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 0, 0]) ! Vector([0, 1, 2, 3, 4]) == [2, 2, 2, 2, 2] -> Vector([0, 0, 1, 0, 0]) ! [0, 1, 2, 3, 4] == Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 0, 0]) ! Vector([0, 1, 2, 3, 4]) != Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 1, 1]) ! Vector([0, 1, 2, 3, 4]) != [2, 2, 2, 2, 2] -> Vector([1, 1, 0, 1, 1]) ! [0, 1, 2, 3, 4] != Vector([2, 2, 2, 2, 2]) -> Vector([1, 1, 0, 1, 1]) ! Vector([0, 1, 2, 3, 4]) > Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 0, 1, 1]) ! Vector([0, 1, 2, 3, 4]) > [2, 2, 2, 2, 2] -> Vector([0, 0, 0, 1, 1]) ! [0, 1, 2, 3, 4] > Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 0, 1, 1]) ! Vector([0, 1, 2, 3, 4]) >= Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 1, 1]) ! Vector([0, 1, 2, 3, 4]) >= [2, 2, 2, 2, 2] -> Vector([0, 0, 1, 1, 1]) ! [0, 1, 2, 3, 4] >= Vector([2, 2, 2, 2, 2]) -> Vector([0, 0, 1, 1, 1]) --- 162,187 ---- | 0 | 1 | 2 | ----------+-----------+-----------+-----------+- ! Number(0) | True | False | False | ! Number(1) | True | True | False | ! Number(2) | True | True | True | ----------+-----------+-----------+-----------+- ************************************************** ! Vector([0, 1, 2, 3, 4]) < Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, False, False]) ! Vector([0, 1, 2, 3, 4]) < [2, 2, 2, 2, 2] -> Vector([True, True, False, False, False]) ! [0, 1, 2, 3, 4] < Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, False, False]) ! Vector([0, 1, 2, 3, 4]) <= Vector([2, 2, 2, 2, 2]) -> Vector([True, True, True, False, False]) ! Vector([0, 1, 2, 3, 4]) <= [2, 2, 2, 2, 2] -> Vector([True, True, True, False, False]) ! [0, 1, 2, 3, 4] <= Vector([2, 2, 2, 2, 2]) -> Vector([True, True, True, False, False]) ! Vector([0, 1, 2, 3, 4]) == Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, False, False]) ! Vector([0, 1, 2, 3, 4]) == [2, 2, 2, 2, 2] -> Vector([False, False, True, False, False]) ! [0, 1, 2, 3, 4] == Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, False, False]) ! Vector([0, 1, 2, 3, 4]) != Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, True, True]) ! Vector([0, 1, 2, 3, 4]) != [2, 2, 2, 2, 2] -> Vector([True, True, False, True, True]) ! [0, 1, 2, 3, 4] != Vector([2, 2, 2, 2, 2]) -> Vector([True, True, False, True, True]) ! Vector([0, 1, 2, 3, 4]) > Vector([2, 2, 2, 2, 2]) -> Vector([False, False, False, True, True]) ! Vector([0, 1, 2, 3, 4]) > [2, 2, 2, 2, 2] -> Vector([False, False, False, True, True]) ! [0, 1, 2, 3, 4] > Vector([2, 2, 2, 2, 2]) -> Vector([False, False, False, True, True]) ! Vector([0, 1, 2, 3, 4]) >= Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, True, True]) ! Vector([0, 1, 2, 3, 4]) >= [2, 2, 2, 2, 2] -> Vector([False, False, True, True, True]) ! [0, 1, 2, 3, 4] >= Vector([2, 2, 2, 2, 2]) -> Vector([False, False, True, True, True]) From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.126,1.127 test_descrtut.py,1.11,1.12 test_generators.py,1.32,1.33 test_unicode.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31419/Lib/test Modified Files: test_descr.py test_descrtut.py test_generators.py test_unicode.py Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** test_descr.py 2 Apr 2002 17:53:47 -0000 1.126 --- test_descr.py 3 Apr 2002 22:41:50 -0000 1.127 *************** *** 2330,2334 **** def check(descr, what): vereq(descr.__doc__, what) ! check(file.closed, "flag set if the file is closed") # getset descriptor check(file.name, "file name") # member descriptor --- 2330,2334 ---- def check(descr, what): vereq(descr.__doc__, what) ! check(file.closed, "True if the file is closed") # getset descriptor check(file.name, "file name") # member descriptor Index: test_descrtut.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descrtut.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_descrtut.py 19 Feb 2002 04:25:19 -0000 1.11 --- test_descrtut.py 3 Apr 2002 22:41:50 -0000 1.12 *************** *** 49,53 **** >>> print type(a) is a.__class__ # its type is its class ! 1 >>> a[1] = 3.25 # modify the instance >>> print a # show the new value --- 49,53 ---- >>> print type(a) is a.__class__ # its type is its class ! True >>> a[1] = 3.25 # modify the instance >>> print a # show the new value *************** *** 99,103 **** -1000 >>> 'default' in dir(a) ! 1 >>> a.x1 = 100 >>> a.x2 = 200 --- 99,103 ---- -1000 >>> 'default' in dir(a) ! True >>> a.x1 = 100 >>> a.x2 = 200 *************** *** 106,110 **** >>> d = dir(a) >>> 'default' in d and 'x1' in d and 'x2' in d ! 1 >>> print a.__dict__ {'default': -1000, 'x2': 200, 'x1': 100} --- 106,110 ---- >>> d = dir(a) >>> 'default' in d and 'x1' in d and 'x2' in d ! True >>> print a.__dict__ {'default': -1000, 'x2': 200, 'x1': 100} *************** *** 168,176 **** >>> isinstance([], list) ! 1 >>> isinstance([], dict) ! 0 >>> isinstance([], object) ! 1 >>> --- 168,176 ---- >>> isinstance([], list) ! True >>> isinstance([], dict) ! False >>> isinstance([], object) ! True >>> Index: test_generators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_generators.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** test_generators.py 1 Apr 2002 00:28:59 -0000 1.32 --- test_generators.py 3 Apr 2002 22:41:50 -0000 1.33 *************** *** 387,394 **** x.next() -> the next value, or raise StopIteration >>> iter(i) is i ! 1 >>> import types >>> isinstance(i, types.GeneratorType) ! 1 And more, added later. --- 387,394 ---- x.next() -> the next value, or raise StopIteration >>> iter(i) is i ! True >>> import types >>> isinstance(i, types.GeneratorType) ! True And more, added later. *************** *** 1219,1232 **** ... all = list(gencopy(conjoin([lambda: iter((0, 1))] * n))) ... print n, len(all), all[0] == [0] * n, all[-1] == [1] * n ! 0 1 1 1 ! 1 2 1 1 ! 2 4 1 1 ! 3 8 1 1 ! 4 16 1 1 ! 5 32 1 1 ! 6 64 1 1 ! 7 128 1 1 ! 8 256 1 1 ! 9 512 1 1 And run an 8-queens solver. --- 1219,1232 ---- ... all = list(gencopy(conjoin([lambda: iter((0, 1))] * n))) ... print n, len(all), all[0] == [0] * n, all[-1] == [1] * n ! 0 1 True True ! 1 2 True True ! 2 4 True True ! 3 8 True True ! 4 16 True True ! 5 32 True True ! 6 64 True True ! 7 128 True True ! 8 256 True True ! 9 512 True True And run an 8-queens solver. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** test_unicode.py 29 Mar 2002 16:21:44 -0000 1.51 --- test_unicode.py 3 Apr 2002 22:41:50 -0000 1.52 *************** *** 168,199 **** test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2) ! test('startswith', u'hello', 1, u'he') ! test('startswith', u'hello', 1, u'hello') ! test('startswith', u'hello', 0, u'hello world') ! test('startswith', u'hello', 1, u'') ! test('startswith', u'hello', 0, u'ello') ! test('startswith', u'hello', 1, u'ello', 1) ! test('startswith', u'hello', 1, u'o', 4) ! test('startswith', u'hello', 0, u'o', 5) ! test('startswith', u'hello', 1, u'', 5) ! test('startswith', u'hello', 0, u'lo', 6) ! test('startswith', u'helloworld', 1, u'lowo', 3) ! test('startswith', u'helloworld', 1, u'lowo', 3, 7) ! test('startswith', u'helloworld', 0, u'lowo', 3, 6) ! test('endswith', u'hello', 1, u'lo') ! test('endswith', u'hello', 0, u'he') ! test('endswith', u'hello', 1, u'') ! test('endswith', u'hello', 0, u'hello world') ! test('endswith', u'helloworld', 0, u'worl') ! test('endswith', u'helloworld', 1, u'worl', 3, 9) ! test('endswith', u'helloworld', 1, u'world', 3, 12) ! test('endswith', u'helloworld', 1, u'lowo', 1, 7) ! test('endswith', u'helloworld', 1, u'lowo', 2, 7) ! test('endswith', u'helloworld', 1, u'lowo', 3, 7) ! test('endswith', u'helloworld', 0, u'lowo', 4, 7) ! test('endswith', u'helloworld', 0, u'lowo', 3, 8) ! test('endswith', u'ab', 0, u'ab', 0, 1) ! test('endswith', u'ab', 0, u'ab', 0, 0) test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') --- 168,199 ---- test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2) ! test('startswith', u'hello', True, u'he') ! test('startswith', u'hello', True, u'hello') ! test('startswith', u'hello', False, u'hello world') ! test('startswith', u'hello', True, u'') ! test('startswith', u'hello', False, u'ello') ! test('startswith', u'hello', True, u'ello', 1) ! test('startswith', u'hello', True, u'o', 4) ! test('startswith', u'hello', False, u'o', 5) ! test('startswith', u'hello', True, u'', 5) ! test('startswith', u'hello', False, u'lo', 6) ! test('startswith', u'helloworld', True, u'lowo', 3) ! test('startswith', u'helloworld', True, u'lowo', 3, 7) ! test('startswith', u'helloworld', False, u'lowo', 3, 6) ! test('endswith', u'hello', True, u'lo') ! test('endswith', u'hello', False, u'he') ! test('endswith', u'hello', True, u'') ! test('endswith', u'hello', False, u'hello world') ! test('endswith', u'helloworld', False, u'worl') ! test('endswith', u'helloworld', True, u'worl', 3, 9) ! test('endswith', u'helloworld', True, u'world', 3, 12) ! test('endswith', u'helloworld', True, u'lowo', 1, 7) ! test('endswith', u'helloworld', True, u'lowo', 2, 7) ! test('endswith', u'helloworld', True, u'lowo', 3, 7) ! test('endswith', u'helloworld', False, u'lowo', 4, 7) ! test('endswith', u'helloworld', False, u'lowo', 3, 8) ! test('endswith', u'ab', False, u'ab', 0, 1) ! test('endswith', u'ab', False, u'ab', 0, 0) test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') *************** *** 287,334 **** test('center', u'abc', u'abc', 2) ! test('islower', u'a', 1) ! test('islower', u'A', 0) ! test('islower', u'\n', 0) ! test('islower', u'\u1FFc', 0) ! test('islower', u'abc', 1) ! test('islower', u'aBc', 0) ! test('islower', u'abc\n', 1) ! test('isupper', u'a', 0) ! test('isupper', u'A', 1) ! test('isupper', u'\n', 0) if sys.platform[:4] != 'java': ! test('isupper', u'\u1FFc', 0) ! test('isupper', u'ABC', 1) ! test('isupper', u'AbC', 0) ! test('isupper', u'ABC\n', 1) ! test('istitle', u'a', 0) ! test('istitle', u'A', 1) ! test('istitle', u'\n', 0) ! test('istitle', u'\u1FFc', 1) ! test('istitle', u'A Titlecased Line', 1) ! test('istitle', u'A\nTitlecased Line', 1) ! test('istitle', u'A Titlecased, Line', 1) ! test('istitle', u'Greek \u1FFcitlecases ...', 1) ! test('istitle', u'Not a capitalized String', 0) ! test('istitle', u'Not\ta Titlecase String', 0) ! test('istitle', u'Not--a Titlecase String', 0) ! test('isalpha', u'a', 1) ! test('isalpha', u'A', 1) ! test('isalpha', u'\n', 0) ! test('isalpha', u'\u1FFc', 1) ! test('isalpha', u'abc', 1) ! test('isalpha', u'aBc123', 0) ! test('isalpha', u'abc\n', 0) ! test('isalnum', u'a', 1) ! test('isalnum', u'A', 1) ! test('isalnum', u'\n', 0) ! test('isalnum', u'123abc456', 1) ! test('isalnum', u'a1b3c', 1) ! test('isalnum', u'aBc000 ', 0) ! test('isalnum', u'abc\n', 0) test('splitlines', u"abc\ndef\n\rghi", [u'abc', u'def', u'', u'ghi']) --- 287,334 ---- test('center', u'abc', u'abc', 2) ! test('islower', u'a', True) ! test('islower', u'A', False) ! test('islower', u'\n', False) ! test('islower', u'\u1FFc', False) ! test('islower', u'abc', True) ! test('islower', u'aBc', False) ! test('islower', u'abc\n', True) ! test('isupper', u'a', False) ! test('isupper', u'A', True) ! test('isupper', u'\n', False) if sys.platform[:4] != 'java': ! test('isupper', u'\u1FFc', False) ! test('isupper', u'ABC', True) ! test('isupper', u'AbC', False) ! test('isupper', u'ABC\n', True) ! test('istitle', u'a', False) ! test('istitle', u'A', True) ! test('istitle', u'\n', False) ! test('istitle', u'\u1FFc', True) ! test('istitle', u'A Titlecased Line', True) ! test('istitle', u'A\nTitlecased Line', True) ! test('istitle', u'A Titlecased, Line', True) ! test('istitle', u'Greek \u1FFcitlecases ...', True) ! test('istitle', u'Not a capitalized String', False) ! test('istitle', u'Not\ta Titlecase String', False) ! test('istitle', u'Not--a Titlecase String', False) ! test('isalpha', u'a', True) ! test('isalpha', u'A', True) ! test('isalpha', u'\n', False) ! test('isalpha', u'\u1FFc', True) ! test('isalpha', u'abc', True) ! test('isalpha', u'aBc123', False) ! test('isalpha', u'abc\n', False) ! test('isalnum', u'a', True) ! test('isalnum', u'A', True) ! test('isalnum', u'\n', False) ! test('isalnum', u'123abc456', True) ! test('isalnum', u'a1b3c', True) ! test('isalnum', u'aBc000 ', False) ! test('isalnum', u'abc\n', False) test('splitlines', u"abc\ndef\n\rghi", [u'abc', u'def', u'', u'ghi']) *************** *** 338,342 **** test('splitlines', u"abc\ndef\r\nghi\n\r", [u'abc', u'def', u'ghi', u'']) test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'', u'abc', u'def', u'ghi', u'']) ! test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'\n', u'abc\n', u'def\r\n', u'ghi\n', u'\r'], 1) test('translate', u"abababc", u'bbbc', {ord('a'):None}) --- 338,342 ---- test('splitlines', u"abc\ndef\r\nghi\n\r", [u'abc', u'def', u'ghi', u'']) test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'', u'abc', u'def', u'ghi', u'']) ! test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'\n', u'abc\n', u'def\r\n', u'ghi\n', u'\r'], True) test('translate', u"abababc", u'bbbc', {ord('a'):None}) From gvanrossum@users.sourceforge.net Wed Apr 3 22:41:53 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 14:41:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.122,2.123 fileobject.c,2.153,2.154 intobject.c,2.80,2.81 object.c,2.169,2.170 stringobject.c,2.153,2.154 unicodeobject.c,2.133,2.134 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31419/Objects Modified Files: dictobject.c fileobject.c intobject.c object.c stringobject.c unicodeobject.c Log Message: Add the 'bool' type and its values 'False' and 'True', as described in PEP 285. Everything described in the PEP is here, and there is even some documentation. I had to fix 12 unit tests; all but one of these were printing Boolean outcomes that changed from 0/1 to False/True. (The exception is test_unicode.py, which did a type(x) == type(y) style comparison. I could've fixed that with a single line using issubtype(x, type(y)), but instead chose to be explicit about those places where a bool is expected. Still to do: perhaps more documentation; change standard library modules to return False/True from predicates. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.122 retrieving revision 2.123 diff -C2 -d -r2.122 -r2.123 *** dictobject.c 29 Mar 2002 03:29:07 -0000 2.122 --- dictobject.c 3 Apr 2002 22:41:51 -0000 2.123 *************** *** 1430,1434 **** } ok = (mp->ma_lookup)(mp, key, hash)->me_value != NULL; ! return PyInt_FromLong(ok); } --- 1430,1434 ---- } ok = (mp->ma_lookup)(mp, key, hash)->me_value != NULL; ! return PyBool_FromLong(ok); } Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.153 retrieving revision 2.154 diff -C2 -d -r2.153 -r2.154 *** fileobject.c 1 Apr 2002 00:08:59 -0000 2.153 --- fileobject.c 3 Apr 2002 22:41:51 -0000 2.154 *************** *** 1445,1449 **** "close() -> None or (perhaps) an integer. Close the file.\n" "\n" ! "Sets data attribute .closed to true. A closed file cannot be used for\n" "further I/O operations. close() may be called more than once without\n" "error. Some kinds of file objects (for example, opened by popen())\n" --- 1445,1449 ---- "close() -> None or (perhaps) an integer. Close the file.\n" "\n" ! "Sets data attribute .closed to True. A closed file cannot be used for\n" "further I/O operations. close() may be called more than once without\n" "error. Some kinds of file objects (for example, opened by popen())\n" *************** *** 1489,1497 **** get_closed(PyFileObject *f, void *closure) { ! return PyInt_FromLong((long)(f->f_fp == 0)); } static PyGetSetDef file_getsetlist[] = { ! {"closed", (getter)get_closed, NULL, "flag set if the file is closed"}, {0}, }; --- 1489,1497 ---- get_closed(PyFileObject *f, void *closure) { ! return PyBool_FromLong((long)(f->f_fp == 0)); } static PyGetSetDef file_getsetlist[] = { ! {"closed", (getter)get_closed, NULL, "True if the file is closed"}, {0}, }; Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -d -r2.80 -r2.81 *** intobject.c 1 Feb 2002 15:34:10 -0000 2.80 --- intobject.c 3 Apr 2002 22:41:51 -0000 2.81 *************** *** 11,26 **** } - /* Standard Booleans */ - - PyIntObject _Py_ZeroStruct = { - PyObject_HEAD_INIT(&PyInt_Type) - 0 - }; - - PyIntObject _Py_TrueStruct = { - PyObject_HEAD_INIT(&PyInt_Type) - 1 - }; - /* Return 1 if exception raised, 0 if caller should retry using longs */ static int --- 11,14 ---- Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** object.c 29 Mar 2002 03:05:54 -0000 2.169 --- object.c 3 Apr 2002 22:41:51 -0000 2.170 *************** *** 1764,1767 **** --- 1764,1770 ---- Py_FatalError("Can't initialize 'type'"); + if (PyType_Ready(&PyBool_Type) < 0) + Py_FatalError("Can't initialize 'bool'"); + if (PyType_Ready(&PyList_Type) < 0) Py_FatalError("Can't initialize 'list'"); Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.153 retrieving revision 2.154 diff -C2 -d -r2.153 -r2.154 *** stringobject.c 30 Mar 2002 10:06:07 -0000 2.153 --- stringobject.c 3 Apr 2002 22:41:51 -0000 2.154 *************** *** 2001,2007 **** static char startswith__doc__[] = ! "S.startswith(prefix[, start[, end]]) -> int\n\ \n\ ! Return 1 if S starts with the specified prefix, otherwise return 0. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; --- 2001,2007 ---- static char startswith__doc__[] = ! "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; *************** *** 2033,2037 **** return NULL; else ! return PyInt_FromLong((long) rc); } #endif --- 2033,2037 ---- return NULL; else ! return PyBool_FromLong((long) rc); } #endif *************** *** 2044,2066 **** */ if (start < 0 || start+plen > len) ! return PyInt_FromLong(0); if (!memcmp(str+start, prefix, plen)) { /* did the match end after the specified end? */ if (end < 0) ! return PyInt_FromLong(1); else if (end - start < plen) ! return PyInt_FromLong(0); else ! return PyInt_FromLong(1); } ! else return PyInt_FromLong(0); } static char endswith__doc__[] = ! "S.endswith(suffix[, start[, end]]) -> int\n\ \n\ ! Return 1 if S ends with the specified suffix, otherwise return 0. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; --- 2044,2066 ---- */ if (start < 0 || start+plen > len) ! return PyBool_FromLong(0); if (!memcmp(str+start, prefix, plen)) { /* did the match end after the specified end? */ if (end < 0) ! return PyBool_FromLong(1); else if (end - start < plen) ! return PyBool_FromLong(0); else ! return PyBool_FromLong(1); } ! else return PyBool_FromLong(0); } static char endswith__doc__[] = ! "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; *************** *** 2093,2097 **** return NULL; else ! return PyInt_FromLong((long) rc); } #endif --- 2093,2097 ---- return NULL; else ! return PyBool_FromLong((long) rc); } #endif *************** *** 2100,2104 **** if (start < 0 || start > len || slen > len) ! return PyInt_FromLong(0); upper = (end >= 0 && end <= len) ? end : len; --- 2100,2104 ---- if (start < 0 || start > len || slen > len) ! return PyBool_FromLong(0); upper = (end >= 0 && end <= len) ? end : len; *************** *** 2106,2111 **** if (upper-lower >= slen && !memcmp(str+lower, suffix, slen)) ! return PyInt_FromLong(1); ! else return PyInt_FromLong(0); } --- 2106,2111 ---- if (upper-lower >= slen && !memcmp(str+lower, suffix, slen)) ! return PyBool_FromLong(1); ! else return PyBool_FromLong(0); } *************** *** 2312,2319 **** static char isspace__doc__[] = ! "S.isspace() -> int\n" "\n" ! "Return 1 if there are only whitespace characters in S,\n" ! "0 otherwise."; static PyObject* --- 2312,2319 ---- static char isspace__doc__[] = ! "S.isspace() -> bool\n" "\n" ! "Return True if there are only whitespace characters in S,\n" ! "False otherwise."; static PyObject* *************** *** 2327,2350 **** if (PyString_GET_SIZE(self) == 1 && isspace(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isspace(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isalpha__doc__[] = ! "S.isalpha() -> int\n\ \n\ ! Return 1 if all characters in S are alphabetic\n\ ! and there is at least one character in S, 0 otherwise."; static PyObject* --- 2327,2350 ---- if (PyString_GET_SIZE(self) == 1 && isspace(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isspace(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isalpha__doc__[] = ! "S.isalpha() -> bool\n\ \n\ ! Return True if all characters in S are alphabetic\n\ ! and there is at least one character in S, False otherwise."; static PyObject* *************** *** 2358,2381 **** if (PyString_GET_SIZE(self) == 1 && isalpha(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isalpha(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isalnum__doc__[] = ! "S.isalnum() -> int\n\ \n\ ! Return 1 if all characters in S are alphanumeric\n\ ! and there is at least one character in S, 0 otherwise."; static PyObject* --- 2358,2381 ---- if (PyString_GET_SIZE(self) == 1 && isalpha(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isalpha(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isalnum__doc__[] = ! "S.isalnum() -> bool\n\ \n\ ! Return True if all characters in S are alphanumeric\n\ ! and there is at least one character in S, False otherwise."; static PyObject* *************** *** 2389,2412 **** if (PyString_GET_SIZE(self) == 1 && isalnum(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isalnum(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isdigit__doc__[] = ! "S.isdigit() -> int\n\ \n\ ! Return 1 if there are only digit characters in S,\n\ ! 0 otherwise."; static PyObject* --- 2389,2412 ---- if (PyString_GET_SIZE(self) == 1 && isalnum(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isalnum(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isdigit__doc__[] = ! "S.isdigit() -> bool\n\ \n\ ! Return True if there are only digit characters in S,\n\ ! False otherwise."; static PyObject* *************** *** 2420,2443 **** if (PyString_GET_SIZE(self) == 1 && isdigit(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isdigit(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char islower__doc__[] = ! "S.islower() -> int\n\ \n\ ! Return 1 if all cased characters in S are lowercase and there is\n\ ! at least one cased character in S, 0 otherwise."; static PyObject* --- 2420,2443 ---- if (PyString_GET_SIZE(self) == 1 && isdigit(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isdigit(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char islower__doc__[] = ! "S.islower() -> bool\n\ \n\ ! Return True if all cased characters in S are lowercase and there is\n\ ! at least one cased character in S, False otherwise."; static PyObject* *************** *** 2451,2459 **** /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) ! return PyInt_FromLong(islower(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); --- 2451,2459 ---- /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) ! return PyBool_FromLong(islower(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); *************** *** 2461,2477 **** for (; p < e; p++) { if (isupper(*p)) ! return PyInt_FromLong(0); else if (!cased && islower(*p)) cased = 1; } ! return PyInt_FromLong(cased); } static char isupper__doc__[] = ! "S.isupper() -> int\n\ \n\ ! Return 1 if all cased characters in S are uppercase and there is\n\ ! at least one cased character in S, 0 otherwise."; static PyObject* --- 2461,2477 ---- for (; p < e; p++) { if (isupper(*p)) ! return PyBool_FromLong(0); else if (!cased && islower(*p)) cased = 1; } ! return PyBool_FromLong(cased); } static char isupper__doc__[] = ! "S.isupper() -> bool\n\ \n\ ! Return True if all cased characters in S are uppercase and there is\n\ ! at least one cased character in S, False otherwise."; static PyObject* *************** *** 2485,2493 **** /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) ! return PyInt_FromLong(isupper(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); --- 2485,2493 ---- /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) ! return PyBool_FromLong(isupper(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); *************** *** 2495,2512 **** for (; p < e; p++) { if (islower(*p)) ! return PyInt_FromLong(0); else if (!cased && isupper(*p)) cased = 1; } ! return PyInt_FromLong(cased); } static char istitle__doc__[] = ! "S.istitle() -> int\n\ \n\ ! Return 1 if S is a titlecased string, i.e. uppercase characters\n\ may only follow uncased characters and lowercase characters only cased\n\ ! ones. Return 0 otherwise."; static PyObject* --- 2495,2512 ---- for (; p < e; p++) { if (islower(*p)) ! return PyBool_FromLong(0); else if (!cased && isupper(*p)) cased = 1; } ! return PyBool_FromLong(cased); } static char istitle__doc__[] = ! "S.istitle() -> bool\n\ \n\ ! Return True if S is a titlecased string, i.e. uppercase characters\n\ may only follow uncased characters and lowercase characters only cased\n\ ! ones. Return False otherwise."; static PyObject* *************** *** 2520,2528 **** /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) ! return PyInt_FromLong(isupper(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyString_GET_SIZE(self); --- 2520,2528 ---- /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) ! return PyBool_FromLong(isupper(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); *************** *** 2534,2538 **** if (isupper(ch)) { if (previous_is_cased) ! return PyInt_FromLong(0); previous_is_cased = 1; cased = 1; --- 2534,2538 ---- if (isupper(ch)) { if (previous_is_cased) ! return PyBool_FromLong(0); previous_is_cased = 1; cased = 1; *************** *** 2540,2544 **** else if (islower(ch)) { if (!previous_is_cased) ! return PyInt_FromLong(0); previous_is_cased = 1; cased = 1; --- 2540,2544 ---- else if (islower(ch)) { if (!previous_is_cased) ! return PyBool_FromLong(0); previous_is_cased = 1; cased = 1; *************** *** 2547,2551 **** previous_is_cased = 0; } ! return PyInt_FromLong(cased); } --- 2547,2551 ---- previous_is_cased = 0; } ! return PyBool_FromLong(cased); } Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.133 retrieving revision 2.134 diff -C2 -d -r2.133 -r2.134 *** unicodeobject.c 25 Mar 2002 11:16:18 -0000 2.133 --- unicodeobject.c 3 Apr 2002 22:41:51 -0000 2.134 *************** *** 4110,4117 **** static char islower__doc__[] = ! "S.islower() -> int\n\ \n\ ! Return 1 if all cased characters in S are lowercase and there is\n\ ! at least one cased character in S, 0 otherwise."; static PyObject* --- 4110,4117 ---- static char islower__doc__[] = ! "S.islower() -> bool\n\ \n\ ! Return True if all cased characters in S are lowercase and there is\n\ ! at least one cased character in S, False otherwise."; static PyObject* *************** *** 4124,4132 **** /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) ! return PyInt_FromLong(Py_UNICODE_ISLOWER(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); --- 4124,4132 ---- /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) ! return PyBool_FromLong(Py_UNICODE_ISLOWER(*p)); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); *************** *** 4136,4151 **** if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) ! return PyInt_FromLong(0); else if (!cased && Py_UNICODE_ISLOWER(ch)) cased = 1; } ! return PyInt_FromLong(cased); } static char isupper__doc__[] = ! "S.isupper() -> int\n\ \n\ ! Return 1 if all cased characters in S are uppercase and there is\n\ ! at least one cased character in S, 0 otherwise."; static PyObject* --- 4136,4151 ---- if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) ! return PyBool_FromLong(0); else if (!cased && Py_UNICODE_ISLOWER(ch)) cased = 1; } ! return PyBool_FromLong(cased); } static char isupper__doc__[] = ! "S.isupper() -> bool\n\ \n\ ! Return True if all cased characters in S are uppercase and there is\n\ ! at least one cased character in S, False otherwise."; static PyObject* *************** *** 4158,4166 **** /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) ! return PyInt_FromLong(Py_UNICODE_ISUPPER(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); --- 4158,4166 ---- /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) ! return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); *************** *** 4170,4186 **** if (Py_UNICODE_ISLOWER(ch) || Py_UNICODE_ISTITLE(ch)) ! return PyInt_FromLong(0); else if (!cased && Py_UNICODE_ISUPPER(ch)) cased = 1; } ! return PyInt_FromLong(cased); } static char istitle__doc__[] = ! "S.istitle() -> int\n\ \n\ ! Return 1 if S is a titlecased string, i.e. upper- and titlecase characters\n\ ! may only follow uncased characters and lowercase characters only cased\n\ ! ones. Return 0 otherwise."; static PyObject* --- 4170,4186 ---- if (Py_UNICODE_ISLOWER(ch) || Py_UNICODE_ISTITLE(ch)) ! return PyBool_FromLong(0); else if (!cased && Py_UNICODE_ISUPPER(ch)) cased = 1; } ! return PyBool_FromLong(cased); } static char istitle__doc__[] = ! "S.istitle() -> bool\n\ \n\ ! Return True if S is a titlecased string, i.e. upper- and titlecase\n\ ! characters may only follow uncased characters and lowercase characters\n\ ! only cased ones. Return False otherwise."; static PyObject* *************** *** 4193,4202 **** /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) ! return PyInt_FromLong((Py_UNICODE_ISTITLE(*p) != 0) || ! (Py_UNICODE_ISUPPER(*p) != 0)); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); --- 4193,4202 ---- /* Shortcut for single character strings */ if (PyUnicode_GET_SIZE(self) == 1) ! return PyBool_FromLong((Py_UNICODE_ISTITLE(*p) != 0) || ! (Py_UNICODE_ISUPPER(*p) != 0)); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); *************** *** 4208,4212 **** if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) { if (previous_is_cased) ! return PyInt_FromLong(0); previous_is_cased = 1; cased = 1; --- 4208,4212 ---- if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) { if (previous_is_cased) ! return PyBool_FromLong(0); previous_is_cased = 1; cased = 1; *************** *** 4214,4218 **** else if (Py_UNICODE_ISLOWER(ch)) { if (!previous_is_cased) ! return PyInt_FromLong(0); previous_is_cased = 1; cased = 1; --- 4214,4218 ---- else if (Py_UNICODE_ISLOWER(ch)) { if (!previous_is_cased) ! return PyBool_FromLong(0); previous_is_cased = 1; cased = 1; *************** *** 4221,4232 **** previous_is_cased = 0; } ! return PyInt_FromLong(cased); } static char isspace__doc__[] = ! "S.isspace() -> int\n\ \n\ ! Return 1 if there are only whitespace characters in S,\n\ ! 0 otherwise."; static PyObject* --- 4221,4232 ---- previous_is_cased = 0; } ! return PyBool_FromLong(cased); } static char isspace__doc__[] = ! "S.isspace() -> bool\n\ \n\ ! Return True if there are only whitespace characters in S,\n\ ! False otherwise."; static PyObject* *************** *** 4239,4261 **** if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISSPACE(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISSPACE(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isalpha__doc__[] = ! "S.isalpha() -> int\n\ \n\ ! Return 1 if all characters in S are alphabetic\n\ ! and there is at least one character in S, 0 otherwise."; static PyObject* --- 4239,4261 ---- if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISSPACE(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISSPACE(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isalpha__doc__[] = ! "S.isalpha() -> bool\n\ \n\ ! Return True if all characters in S are alphabetic\n\ ! and there is at least one character in S, False otherwise."; static PyObject* *************** *** 4268,4290 **** if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISALPHA(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISALPHA(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isalnum__doc__[] = ! "S.isalnum() -> int\n\ \n\ ! Return 1 if all characters in S are alphanumeric\n\ ! and there is at least one character in S, 0 otherwise."; static PyObject* --- 4268,4290 ---- if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISALPHA(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISALPHA(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isalnum__doc__[] = ! "S.isalnum() -> bool\n\ \n\ ! Return True if all characters in S are alphanumeric\n\ ! and there is at least one character in S, False otherwise."; static PyObject* *************** *** 4297,4319 **** if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISALNUM(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISALNUM(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isdecimal__doc__[] = ! "S.isdecimal() -> int\n\ \n\ ! Return 1 if there are only decimal characters in S,\n\ ! 0 otherwise."; static PyObject* --- 4297,4319 ---- if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISALNUM(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISALNUM(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isdecimal__doc__[] = ! "S.isdecimal() -> bool\n\ \n\ ! Return True if there are only decimal characters in S,\n\ ! False otherwise."; static PyObject* *************** *** 4326,4348 **** if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISDECIMAL(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISDECIMAL(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isdigit__doc__[] = ! "S.isdigit() -> int\n\ \n\ ! Return 1 if there are only digit characters in S,\n\ ! 0 otherwise."; static PyObject* --- 4326,4348 ---- if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISDECIMAL(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISDECIMAL(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isdigit__doc__[] = ! "S.isdigit() -> bool\n\ \n\ ! Return True if there are only digit characters in S,\n\ ! False otherwise."; static PyObject* *************** *** 4355,4377 **** if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISDIGIT(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISDIGIT(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } static char isnumeric__doc__[] = ! "S.isnumeric() -> int\n\ \n\ ! Return 1 if there are only numeric characters in S,\n\ ! 0 otherwise."; static PyObject* --- 4355,4377 ---- if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISDIGIT(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISDIGIT(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } static char isnumeric__doc__[] = ! "S.isnumeric() -> bool\n\ \n\ ! Return True if there are only numeric characters in S,\n\ ! False otherwise."; static PyObject* *************** *** 4384,4399 **** if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISNUMERIC(*p)) ! return PyInt_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyInt_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISNUMERIC(*p)) ! return PyInt_FromLong(0); } ! return PyInt_FromLong(1); } --- 4384,4399 ---- if (PyUnicode_GET_SIZE(self) == 1 && Py_UNICODE_ISNUMERIC(*p)) ! return PyBool_FromLong(1); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) ! return PyBool_FromLong(0); e = p + PyUnicode_GET_SIZE(self); for (; p < e; p++) { if (!Py_UNICODE_ISNUMERIC(*p)) ! return PyBool_FromLong(0); } ! return PyBool_FromLong(1); } *************** *** 4863,4869 **** static char startswith__doc__[] = ! "S.startswith(prefix[, start[, end]]) -> int\n\ \n\ ! Return 1 if S starts with the specified prefix, otherwise return 0. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; --- 4863,4869 ---- static char startswith__doc__[] = ! "S.startswith(prefix[, start[, end]]) -> bool\n\ \n\ ! Return True if S starts with the specified prefix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; *************** *** 4886,4890 **** return NULL; ! result = PyInt_FromLong(tailmatch(self, substring, start, end, -1)); Py_DECREF(substring); --- 4886,4890 ---- return NULL; ! result = PyBool_FromLong(tailmatch(self, substring, start, end, -1)); Py_DECREF(substring); *************** *** 4894,4900 **** static char endswith__doc__[] = ! "S.endswith(suffix[, start[, end]]) -> int\n\ \n\ ! Return 1 if S ends with the specified suffix, otherwise return 0. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; --- 4894,4900 ---- static char endswith__doc__[] = ! "S.endswith(suffix[, start[, end]]) -> bool\n\ \n\ ! Return True if S ends with the specified suffix, False otherwise. With\n\ optional start, test S beginning at that position. With optional end, stop\n\ comparing S at that position."; *************** *** 4917,4921 **** return NULL; ! result = PyInt_FromLong(tailmatch(self, substring, start, end, +1)); Py_DECREF(substring); --- 4917,4921 ---- return NULL; ! result = PyBool_FromLong(tailmatch(self, substring, start, end, +1)); Py_DECREF(substring); From akuchling@users.sourceforge.net Wed Apr 3 22:44:49 2002 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 03 Apr 2002 14:44:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/whatsnew whatsnew23.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv565 Modified Files: whatsnew23.tex Log Message: Add empty section for bool Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** whatsnew23.tex 2 Apr 2002 14:25:25 -0000 1.4 --- whatsnew23.tex 3 Apr 2002 22:44:47 -0000 1.5 *************** *** 183,186 **** --- 183,198 ---- %====================================================================== + \section{PEP 285: The \class{bool} Type} + + XXX write this section + + \begin{seealso} + + \seepep{285}{Adding a bool type}{Written and implemented by GvR.} + + \end{seealso} + + + %====================================================================== \section{New and Improved Modules} From gvanrossum@users.sourceforge.net Wed Apr 3 23:01:47 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 15:01:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include boolobject.h,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv5093/Include Added Files: boolobject.h Log Message: Oops. Here are the new files. My apologies. --- NEW FILE: boolobject.h --- /* Boolean object interface */ typedef PyIntObject PyBoolObject; extern DL_IMPORT(PyTypeObject) PyBool_Type; #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type) /* Py_False and Py_True are the only two bools in existence. Don't forget to apply Py_INCREF() when returning either!!! */ /* Don't use these directly */ extern DL_IMPORT(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; /* Use these macros */ #define Py_False ((PyObject *) &_Py_ZeroStruct) #define Py_True ((PyObject *) &_Py_TrueStruct) /* Function to return a bool from a C long */ PyObject *PyBool_FromLong(long); From gvanrossum@users.sourceforge.net Wed Apr 3 23:01:47 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 15:01:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects boolobject.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5093/Objects Added Files: boolobject.c Log Message: Oops. Here are the new files. My apologies. --- NEW FILE: boolobject.c --- /* Boolean type, a subtype of int */ #include "Python.h" /* We need to define bool_print to override int_print */ static int bool_print(PyBoolObject *self, FILE *fp, int flags) { if (flags & Py_PRINT_RAW) { if (self->ob_ival == 0) fputs("False", fp); else fputs("True", fp); } else { if (self->ob_ival == 0) fputs("False", fp); else fputs("True", fp); } return 0; } /* We define bool_repr to return "False" or "True" */ static PyObject *false_str = NULL; static PyObject *true_str = NULL; PyObject * bool_repr(PyBoolObject *self) { PyObject *s; if (self->ob_ival) s = true_str ? true_str : (true_str = PyString_InternFromString("True")); else s = false_str ? false_str : (false_str = PyString_InternFromString("False")); Py_XINCREF(s); return s; } /* Function to return a bool from a C long */ PyObject *PyBool_FromLong(long ok) { PyObject *result; if (ok) result = Py_True; else result = Py_False; Py_INCREF(result); return result; } /* We define bool_new to always return either Py_True or Py_False */ PyObject * bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"x", 0}; PyObject *x; long ok; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:bool", kwlist, &x)) return NULL; ok = PyObject_IsTrue(x); if (ok < 0) return NULL; return PyBool_FromLong(ok); } /* Arithmetic operations redefined to return bool if both args are bool. */ static PyObject * bool_and(PyObject *a, PyObject *b) { if (!PyBool_Check(a) || !PyBool_Check(b)) return PyInt_Type.tp_as_number->nb_and(a, b); return PyBool_FromLong( ((PyBoolObject *)a)->ob_ival & ((PyBoolObject *)b)->ob_ival); } static PyObject * bool_or(PyObject *a, PyObject *b) { if (!PyBool_Check(a) || !PyBool_Check(b)) return PyInt_Type.tp_as_number->nb_or(a, b); return PyBool_FromLong( ((PyBoolObject *)a)->ob_ival | ((PyBoolObject *)b)->ob_ival); } static PyObject * bool_xor(PyObject *a, PyObject *b) { if (!PyBool_Check(a) || !PyBool_Check(b)) return PyInt_Type.tp_as_number->nb_xor(a, b); return PyBool_FromLong( ((PyBoolObject *)a)->ob_ival ^ ((PyBoolObject *)b)->ob_ival); } /* Doc string */ static char bool_doc[] = "bool(x) -> bool\n\ \n\ Returns True when the argument x is true, False otherwise.\n\ The builtins True and False are the only two instances of the class bool.\n\ The class bool is a subclass of the class int, and cannot be subclassed."; /* Arithmetic methods -- only so we can override &, |, ^. */ static PyNumberMethods bool_as_number = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ 0, /*nb_divide*/ 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ (binaryfunc)bool_and, /*nb_and*/ (binaryfunc)bool_xor, /*nb_xor*/ (binaryfunc)bool_or, /*nb_or*/ 0, /*nb_coerce*/ 0, /*nb_int*/ 0, /*nb_long*/ 0, /*nb_float*/ 0, /*nb_oct*/ 0, /*nb_hex*/ 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /* nb_floor_divide */ 0, /* nb_true_divide */ 0, /* nb_inplace_floor_divide */ 0, /* nb_inplace_true_divide */ }; /* The type object for bool. Note that this cannot be subclassed! */ PyTypeObject PyBool_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "bool", sizeof(PyIntObject), 0, 0, /* tp_dealloc */ (printfunc)bool_print, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ (reprfunc)bool_repr, /* tp_repr */ &bool_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ (reprfunc)bool_repr, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ bool_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyInt_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ bool_new, /* tp_new */ }; /* The objects representing bool values False and True */ /* Named Zero for link-level compatibility */ PyIntObject _Py_ZeroStruct = { PyObject_HEAD_INIT(&PyBool_Type) 0 }; PyIntObject _Py_TrueStruct = { PyObject_HEAD_INIT(&PyBool_Type) 1 }; From gvanrossum@users.sourceforge.net Wed Apr 3 23:01:47 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 15:01:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_bool.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5093/Lib/test Added Files: test_bool.py Log Message: Oops. Here are the new files. My apologies. --- NEW FILE: test_bool.py --- # Test properties of bool promised by PEP 285 from test_support import verbose, TestFailed, TESTFN, vereq def veris(a, b): if a is not b: raise TestFailed, "%r is %r" % (a, b) def verisnot(a, b): if a is b: raise TestFailed, "%r is %r" % (a, b) try: class C(bool): pass except TypeError: pass else: raise TestFailed, "bool should not be subclassable" try: int.__new__(bool, 0) except TypeError: pass else: raise TestFailed, "should not be able to create new bool instances" vereq(int(False), 0) verisnot(int(False), False) vereq(int(True), 1) verisnot(int(True), True) vereq(+False, 0) verisnot(+False, False) vereq(-False, 0) verisnot(-False, False) vereq(abs(False), 0) verisnot(abs(False), False) vereq(+True, 1) verisnot(+True, True) vereq(-True, -1) vereq(abs(True), 1) verisnot(abs(True), True) vereq(~False, -1) vereq(~True, -2) vereq(False+2, 2) vereq(True+2, 3) vereq(2+False, 2) vereq(2+True, 3) vereq(False+False, 0) verisnot(False+False, False) vereq(False+True, 1) verisnot(False+True, True) vereq(True+False, 1) verisnot(True+False, True) vereq(True+True, 2) vereq(True-True, 0) verisnot(True-True, False) vereq(False-False, 0) verisnot(False-False, False) vereq(True-False, 1) verisnot(True-False, True) vereq(False-True, -1) vereq(True*1, 1) vereq(False*1, 0) verisnot(False*1, False) vereq(True/1, 1) verisnot(True/1, True) vereq(False/1, 0) verisnot(False/1, False) for b in False, True: for i in 0, 1, 2: vereq(b**i, int(b)**i) verisnot(b**i, bool(int(b)**i)) for a in False, True: for b in False, True: veris(a&b, bool(int(a)&int(b))) veris(a|b, bool(int(a)|int(b))) veris(a^b, bool(int(a)^int(b))) vereq(a&int(b), int(a)&int(b)) verisnot(a&int(b), bool(int(a)&int(b))) vereq(a|int(b), int(a)|int(b)) verisnot(a|int(b), bool(int(a)|int(b))) vereq(a^int(b), int(a)^int(b)) verisnot(a^int(b), bool(int(a)^int(b))) vereq(int(a)&b, int(a)&int(b)) verisnot(int(a)&b, bool(int(a)&int(b))) vereq(int(a)|b, int(a)|int(b)) verisnot(int(a)|b, bool(int(a)|int(b))) vereq(int(a)^b, int(a)^int(b)) verisnot(int(a)^b, bool(int(a)^int(b))) veris(1==1, True) veris(1==0, False) # XXX <, <=, >, >=, != x = [1] veris(x is x, True) veris(x is not x, False) veris(1 in x, True) veris(0 in x, False) veris(1 not in x, False) veris(0 not in x, True) veris(not True, False) veris(not False, True) veris(bool(10), True) veris(bool(1), True) veris(bool(-1), True) veris(bool(0), False) veris(bool("hello"), True) veris(bool(""), False) veris(hasattr([], "append"), True) veris(hasattr([], "wobble"), False) veris(callable(len), True) veris(callable(1), False) veris(isinstance(True, bool), True) veris(isinstance(False, bool), True) veris(isinstance(True, int), True) veris(isinstance(False, int), True) veris(isinstance(1, bool), False) veris(isinstance(0, bool), False) veris(issubclass(bool, int), True) veris(issubclass(int, bool), False) veris({}.has_key(1), False) veris({1:1}.has_key(1), True) veris("xyz".endswith("z"), True) veris("xyz".endswith("x"), False) veris("xyz0123".isalnum(), True) veris("@#$%".isalnum(), False) veris("xyz".isalpha(), True) veris("@#$%".isalpha(), False) veris("0123".isdigit(), True) veris("xyz".isdigit(), False) veris("xyz".islower(), True) veris("XYZ".islower(), False) veris(" ".isspace(), True) veris("XYZ".isspace(), False) veris("X".istitle(), True) veris("x".istitle(), False) veris("XYZ".isupper(), True) veris("xyz".isupper(), False) veris("xyz".startswith("x"), True) veris("xyz".startswith("z"), False) veris(u"xyz".endswith(u"z"), True) veris(u"xyz".endswith(u"x"), False) veris(u"xyz0123".isalnum(), True) veris(u"@#$%".isalnum(), False) veris(u"xyz".isalpha(), True) veris(u"@#$%".isalpha(), False) veris(u"0123".isdecimal(), True) veris(u"xyz".isdecimal(), False) veris(u"0123".isdigit(), True) veris(u"xyz".isdigit(), False) veris(u"xyz".islower(), True) veris(u"XYZ".islower(), False) veris(u"0123".isnumeric(), True) veris(u"xyz".isnumeric(), False) veris(u" ".isspace(), True) veris(u"XYZ".isspace(), False) veris(u"X".istitle(), True) veris(u"x".istitle(), False) veris(u"XYZ".isupper(), True) veris(u"xyz".isupper(), False) veris(u"xyz".startswith(u"x"), True) veris(u"xyz".startswith(u"z"), False) f = file(TESTFN, "w") veris(f.closed, False) f.close() veris(f.closed, True) import os os.remove(TESTFN) import operator veris(operator.truth(0), False) veris(operator.truth(1), True) veris(operator.isCallable(0), False) veris(operator.isCallable(len), True) veris(operator.isNumberType(None), False) veris(operator.isNumberType(0), True) veris(operator.not_(1), False) veris(operator.not_(0), True) veris(operator.isSequenceType(0), False) veris(operator.isSequenceType([]), True) veris(operator.contains([], 1), False) veris(operator.contains([1], 1), True) veris(operator.isMappingType([]), False) veris(operator.isMappingType({}), True) veris(operator.lt(0, 0), False) veris(operator.lt(0, 1), True) import marshal veris(marshal.loads(marshal.dumps(True)), True) veris(marshal.loads(marshal.dumps(False)), False) import pickle veris(pickle.loads(pickle.dumps(True)), True) veris(pickle.loads(pickle.dumps(False)), False) import cPickle veris(cPickle.loads(cPickle.dumps(True)), True) veris(cPickle.loads(cPickle.dumps(False)), False) veris(pickle.loads(cPickle.dumps(True)), True) veris(pickle.loads(cPickle.dumps(False)), False) veris(cPickle.loads(pickle.dumps(True)), True) veris(cPickle.loads(pickle.dumps(False)), False) if verbose: print "All OK" From neal@metaslash.com Wed Apr 3 23:34:09 2002 From: neal@metaslash.com (Neal Norwitz) Date: Wed, 03 Apr 2002 18:34:09 -0500 Subject: [Python-checkins] CVS: python/dist/src/Objects boolobject.c,NONE,1.1 References: Message-ID: <3CAB9171.2BC937D6@metaslash.com> > --- NEW FILE: boolobject.c --- > /* Boolean type, a subtype of int */ > > #include "Python.h" > > /* We need to define bool_print to override int_print */ > > static int > bool_print(PyBoolObject *self, FILE *fp, int flags) > { > if (flags & Py_PRINT_RAW) { > if (self->ob_ival == 0) > fputs("False", fp); > else > fputs("True", fp); > } > else { > if (self->ob_ival == 0) > fputs("False", fp); > else > fputs("True", fp); > } > return 0; > } Am I missing something or does the body collapse to: { fputs(self->ob_ival == 0 ? "False" : "True", fp); return 0; } Neal From tim_one@users.sourceforge.net Thu Apr 4 00:02:04 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 03 Apr 2002 16:02:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild pythoncore.dsp,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv19957/python/PCbuild Modified Files: pythoncore.dsp Log Message: Repair the Windows build (needs to compile in the new boolobject code). Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pythoncore.dsp 23 Mar 2002 00:20:15 -0000 1.32 --- pythoncore.dsp 4 Apr 2002 00:02:02 -0000 1.33 *************** *** 331,334 **** --- 331,349 ---- # Begin Source File + SOURCE=..\Objects\boolobject.c + + !IF "$(CFG)" == "pythoncore - Win32 Release" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Objects\bufferobject.c From gvanrossum@users.sourceforge.net Thu Apr 4 01:00:44 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 03 Apr 2002 17:00:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects boolobject.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2229 Modified Files: boolobject.c Log Message: As Neal pointed out, bool_print was an order of magnitude too complex. Index: boolobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/boolobject.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** boolobject.c 3 Apr 2002 23:01:45 -0000 1.1 --- boolobject.c 4 Apr 2002 01:00:42 -0000 1.2 *************** *** 8,23 **** bool_print(PyBoolObject *self, FILE *fp, int flags) { ! if (flags & Py_PRINT_RAW) { ! if (self->ob_ival == 0) ! fputs("False", fp); ! else ! fputs("True", fp); ! } ! else { ! if (self->ob_ival == 0) ! fputs("False", fp); ! else ! fputs("True", fp); ! } return 0; } --- 8,12 ---- bool_print(PyBoolObject *self, FILE *fp, int flags) { ! fputs(self->ob_ival == 0 ? "False" : "True", fp); return 0; } From fdrake@users.sourceforge.net Thu Apr 4 04:07:45 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 20:07:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/html .cvsignore,1.9,1.9.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv11574/html Modified Files: Tag: release22-maint .cvsignore Log Message: Add another output directory to the ignored list. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/.cvsignore,v retrieving revision 1.9 retrieving revision 1.9.24.1 diff -C2 -d -r1.9 -r1.9.24.1 *** .cvsignore 5 Oct 2000 05:16:12 -0000 1.9 --- .cvsignore 4 Apr 2002 04:07:43 -0000 1.9.24.1 *************** *** 8,11 **** --- 8,12 ---- dist inst + whatsnew acks.html index.html From fdrake@users.sourceforge.net Thu Apr 4 04:10:38 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 20:10:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api abstract.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv12433/api Modified Files: abstract.tex Log Message: Correct the descriptions of the PyObject_As*Buffer() return values. This closes SF bug #539081. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** abstract.tex 11 Mar 2002 18:46:29 -0000 1.10 --- abstract.tex 4 Apr 2002 04:10:36 -0000 1.11 *************** *** 896,902 **** Returns a pointer to a read-only memory location useable as character- based input. The \var{obj} argument must support the single-segment ! character buffer interface. On success, returns \code{1}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer ! length. Returns \code{0} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} --- 896,902 ---- Returns a pointer to a read-only memory location useable as character- based input. The \var{obj} argument must support the single-segment ! character buffer interface. On success, returns \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer ! length. Returns \code{-1} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} *************** *** 908,913 **** arbitrary data. The \var{obj} argument must support the single-segment readable buffer interface. On success, returns ! \code{1}, sets \var{buffer} to the memory location and \var{buffer_len} ! to the buffer length. Returns \code{0} and sets a \exception{TypeError} on error. \versionadded{1.6} --- 908,913 ---- arbitrary data. The \var{obj} argument must support the single-segment readable buffer interface. On success, returns ! \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} ! to the buffer length. Returns \code{-1} and sets a \exception{TypeError} on error. \versionadded{1.6} *************** *** 925,931 **** Returns a pointer to a writeable memory location. The \var{obj} argument must support the single-segment, character buffer ! interface. On success, returns \code{1}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer length. Returns ! \code{0} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} --- 925,931 ---- Returns a pointer to a writeable memory location. The \var{obj} argument must support the single-segment, character buffer ! interface. On success, returns \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer length. Returns ! \code{-1} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} From fdrake@users.sourceforge.net Thu Apr 4 04:11:50 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 20:11:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api abstract.tex,1.8.6.2,1.8.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv12738/api Modified Files: Tag: release22-maint abstract.tex Log Message: Correct the descriptions of the PyObject_As*Buffer() return values. This closes SF bug #539081. Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.8.6.2 retrieving revision 1.8.6.3 diff -C2 -d -r1.8.6.2 -r1.8.6.3 *** abstract.tex 11 Mar 2002 19:01:58 -0000 1.8.6.2 --- abstract.tex 4 Apr 2002 04:11:48 -0000 1.8.6.3 *************** *** 896,902 **** Returns a pointer to a read-only memory location useable as character- based input. The \var{obj} argument must support the single-segment ! character buffer interface. On success, returns \code{1}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer ! length. Returns \code{0} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} --- 896,902 ---- Returns a pointer to a read-only memory location useable as character- based input. The \var{obj} argument must support the single-segment ! character buffer interface. On success, returns \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer ! length. Returns \code{-1} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} *************** *** 908,913 **** arbitrary data. The \var{obj} argument must support the single-segment readable buffer interface. On success, returns ! \code{1}, sets \var{buffer} to the memory location and \var{buffer_len} ! to the buffer length. Returns \code{0} and sets a \exception{TypeError} on error. \versionadded{1.6} --- 908,913 ---- arbitrary data. The \var{obj} argument must support the single-segment readable buffer interface. On success, returns ! \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} ! to the buffer length. Returns \code{-1} and sets a \exception{TypeError} on error. \versionadded{1.6} *************** *** 925,931 **** Returns a pointer to a writeable memory location. The \var{obj} argument must support the single-segment, character buffer ! interface. On success, returns \code{1}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer length. Returns ! \code{0} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} --- 925,931 ---- Returns a pointer to a writeable memory location. The \var{obj} argument must support the single-segment, character buffer ! interface. On success, returns \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} to the buffer length. Returns ! \code{-1} and sets a \exception{TypeError} on error. \versionadded{1.6} \end{cfuncdesc} From fdrake@users.sourceforge.net Thu Apr 4 04:21:25 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 03 Apr 2002 20:21:25 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.117.2.12,1.117.2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv15075/api Modified Files: Tag: release21-maint api.tex Log Message: Add the PyObject_As*Buffer() functions that apply, now that the docs have been corrected and I'm dealing with them anyway. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.117.2.12 retrieving revision 1.117.2.13 diff -C2 -d -r1.117.2.12 -r1.117.2.13 *** api.tex 12 Mar 2002 20:18:01 -0000 1.117.2.12 --- api.tex 4 Apr 2002 04:21:23 -0000 1.117.2.13 *************** *** 2118,2121 **** --- 2118,2158 ---- + \section{Buffer Protocol \label{abstract-buffer}} + + \begin{cfuncdesc}{int}{PyObject_AsCharBuffer}{PyObject *obj, + const char **buffer, + int *buffer_len} + Returns a pointer to a read-only memory location useable as character- + based input. The \var{obj} argument must support the single-segment + character buffer interface. On success, returns \code{0}, sets + \var{buffer} to the memory location and \var{buffer_len} to the buffer + length. Returns \code{-1} and sets a \exception{TypeError} on error. + \versionadded{1.6} + \end{cfuncdesc} + + \begin{cfuncdesc}{int}{PyObject_AsReadBuffer}{PyObject *obj, + const char **buffer, + int *buffer_len} + Returns a pointer to a read-only memory location containing + arbitrary data. The \var{obj} argument must support the + single-segment readable buffer interface. On success, returns + \code{0}, sets \var{buffer} to the memory location and \var{buffer_len} + to the buffer length. Returns \code{-1} and sets a + \exception{TypeError} on error. + \versionadded{1.6} + \end{cfuncdesc} + + \begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj, + const char **buffer, + int *buffer_len} + Returns a pointer to a writeable memory location. The \var{obj} + argument must support the single-segment, character buffer + interface. On success, returns \code{0}, sets \var{buffer} to the + memory location and \var{buffer_len} to the buffer length. Returns + \code{-1} and sets a \exception{TypeError} on error. + \versionadded{1.6} + \end{cfuncdesc} + + \chapter{Concrete Objects Layer \label{concrete}} From tim_one@users.sourceforge.net Thu Apr 4 04:44:34 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 03 Apr 2002 20:44:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16697/python/Objects Modified Files: obmalloc.c Log Message: _PyMalloc_{Malloc, Realloc}: Strive to meet the doc's promises about what these do given a 0 size argument. This is so that when pymalloc is enabled, we don't need to wrap pymalloc calls in goofy little routines special-casing 0. Note that it's virtually impossible to meet the doc's promise that malloc(0) will never return NULL; this makes a best effort, but not an insane effort. The code does promise that realloc(not-NULL, 0) will never return NULL (malloc(0) is much harder). _PyMalloc_Realloc: Changed to take over all requests for 0 bytes, and rearranged to be a little quicker in expected cases. All over the place: when resorting to the platform allocator, call free/malloc/realloc directly, without indirecting thru macros. This should avoid needing a nightmarish pile of #ifdef-ery if PYMALLOC_DEBUG is changed so that pymalloc takes over all Py(Mem, Object} memory operations (which would add useful debugging info to PyMem_xyz allocations too). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** obmalloc.c 1 Apr 2002 20:12:59 -0000 2.27 --- obmalloc.c 4 Apr 2002 04:44:32 -0000 2.28 *************** *** 443,447 **** { uint excess; /* number of bytes above pool alignment */ ! block *bp = (block *)PyMem_MALLOC(ARENA_SIZE); if (bp == NULL) return NULL; --- 443,447 ---- { uint excess; /* number of bytes above pool alignment */ ! block *bp = (block *)malloc(ARENA_SIZE); if (bp == NULL) return NULL; *************** *** 461,465 **** if (arenas == NULL) { assert(narenas == 0 && maxarenas == 0); ! arenas = (uptr *)PyMem_MALLOC(16 * sizeof(*arenas)); if (arenas == NULL) goto error; --- 461,465 ---- if (arenas == NULL) { assert(narenas == 0 && maxarenas == 0); ! arenas = (uptr *)malloc(16 * sizeof(*arenas)); if (arenas == NULL) goto error; *************** *** 510,514 **** if (newmax <= maxarenas) /* overflow */ goto error; ! p = (uptr *)PyMem_MALLOC(newmax * sizeof(*arenas)); if (p == NULL) goto error; --- 510,514 ---- if (newmax <= maxarenas) /* overflow */ goto error; ! p = (uptr *)malloc(newmax * sizeof(*arenas)); if (p == NULL) goto error; *************** *** 526,530 **** error: ! PyMem_FREE(bp); nfreepools = 0; return NULL; --- 526,530 ---- error: ! free(bp); nfreepools = 0; return NULL; *************** *** 553,557 **** /*==========================================================================*/ ! /* malloc */ /* --- 553,559 ---- /*==========================================================================*/ ! /* malloc. Note that nbytes==0 tries to return a non-NULL pointer, distinct ! * from all other currently live pointers. This may not be possible. ! */ /* *************** *** 572,576 **** /* ! * This implicitly redirects malloc(0) */ if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) { --- 574,578 ---- /* ! * This implicitly redirects malloc(0). */ if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) { *************** *** 699,703 **** * has been reached. */ ! return (void *)PyMem_MALLOC(nbytes); } --- 701,705 ---- * has been reached. */ ! return (void *)malloc(nbytes ? nbytes : 1); } *************** *** 783,795 **** /* We didn't allocate this address. */ INCTHEIRS; ! PyMem_FREE(p); } ! /* realloc */ void * _PyMalloc_Realloc(void *p, size_t nbytes) { ! block *bp; poolp pool; uint size; --- 785,800 ---- /* We didn't allocate this address. */ INCTHEIRS; ! free(p); } ! /* realloc. If p is NULL, this acts like malloc(nbytes). Else if nbytes==0, ! * then as the Python docs promise, we do not treat this like free(p), and ! * return a non-NULL result. ! */ void * _PyMalloc_Realloc(void *p, size_t nbytes) { ! void *bp; poolp pool; uint size; *************** *** 798,802 **** return _PyMalloc_Malloc(nbytes); - /* realloc(p, 0) on big blocks is redirected. */ pool = POOL_ADDR(p); if (ADDRESS_IN_RANGE(p, pool->arenaindex)) { --- 803,806 ---- *************** *** 804,843 **** INCMINE; size = (pool->szidx + 1) << ALIGNMENT_SHIFT; /* block size */ ! if (size >= nbytes) { ! /* Don't bother if a smaller size was requested ! except for realloc(p, 0) == free(p), ret NULL */ ! /* XXX but Python guarantees that *its* flavor of ! resize(p, 0) will not do a free or return NULL */ ! if (nbytes == 0) { ! _PyMalloc_Free(p); ! bp = NULL; ! } ! else ! bp = (block *)p; } ! else { ! bp = (block *)_PyMalloc_Malloc(nbytes); ! if (bp != NULL) { ! memcpy(bp, p, size); ! _PyMalloc_Free(p); ! } } } else { ! /* We haven't allocated this block */ ! INCTHEIRS; ! if (nbytes <= SMALL_REQUEST_THRESHOLD && nbytes) { ! /* small request */ ! size = nbytes; ! bp = (block *)_PyMalloc_Malloc(nbytes); ! if (bp != NULL) { ! memcpy(bp, p, size); ! _PyMalloc_Free(p); ! } ! } ! else ! bp = (block *)PyMem_REALLOC(p, nbytes); } ! return (void *)bp; } --- 808,845 ---- INCMINE; size = (pool->szidx + 1) << ALIGNMENT_SHIFT; /* block size */ ! if (size >= nbytes) ! /* Don't bother if a smaller size was requested. */ ! return p; ! /* We need more memory. */ ! assert(nbytes != 0); ! bp = (block *)_PyMalloc_Malloc(nbytes); ! if (bp != NULL) { ! memcpy(bp, p, size); ! _PyMalloc_Free(p); } ! return bp; ! } ! /* We're not managing this block. */ ! INCTHEIRS; ! if (nbytes <= SMALL_REQUEST_THRESHOLD) { ! /* Take over this block. */ ! bp = _PyMalloc_Malloc(nbytes ? nbytes : 1); ! if (bp != NULL) { ! memcpy(bp, p, nbytes); ! free(p); } + else if (nbytes == 0) { + /* Meet the doc's promise that nbytes==0 will + * never return a NULL pointer when p isn't NULL. + */ + bp = p; + } + } else { ! assert(nbytes != 0); ! bp = realloc(p, nbytes); } ! return bp; } From tim_one@users.sourceforge.net Thu Apr 4 05:08:33 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 03 Apr 2002 21:08:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24100/python/Objects Modified Files: obmalloc.c Log Message: _PyMalloc_Realloc(): removed a now-pointless cast. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** obmalloc.c 4 Apr 2002 04:44:32 -0000 2.28 --- obmalloc.c 4 Apr 2002 05:08:31 -0000 2.29 *************** *** 813,817 **** /* We need more memory. */ assert(nbytes != 0); ! bp = (block *)_PyMalloc_Malloc(nbytes); if (bp != NULL) { memcpy(bp, p, size); --- 813,817 ---- /* We need more memory. */ assert(nbytes != 0); ! bp = _PyMalloc_Malloc(nbytes); if (bp != NULL) { memcpy(bp, p, size); From gvanrossum@users.sourceforge.net Thu Apr 4 15:21:35 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 07:21:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.373,1.374 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31981 Modified Files: NEWS Log Message: Add a note about bool. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.373 retrieving revision 1.374 diff -C2 -d -r1.373 -r1.374 *** NEWS 30 Mar 2002 10:06:07 -0000 1.373 --- NEWS 4 Apr 2002 15:21:33 -0000 1.374 *************** *** 7,10 **** --- 7,16 ---- Core and builtins + - A new built-in type, bool, has been added, as well as built-in + names for its two values, True and False. Comparisons and sundry + other operations that return a truth value have been changed to + return a bool instead. Read PEP 285 for an explanantion of why this + is backward compatible. + - Fixed two bugs reported as SF #535905: under certain conditions, deallocating a deeply nested structure could cause a segfault in the From nnorwitz@users.sourceforge.net Thu Apr 4 14:02:50 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Thu, 04 Apr 2002 06:02:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libarray.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6512/Doc/lib Modified Files: libarray.tex Log Message: SF 539024, Fix broken link to numpy Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** libarray.tex 1 Apr 2002 23:05:10 -0000 1.33 --- libarray.tex 4 Apr 2002 14:02:45 -0000 1.34 *************** *** 224,228 **** Representation (XDR) data as used in some remote procedure call systems.} ! \seetitle[http://numpy.sourceforge.net/numdoc/HTML/numdoc.html]{The Numerical Python Manual}{The Numeric Python extension (NumPy) defines another array type; see --- 224,228 ---- Representation (XDR) data as used in some remote procedure call systems.} ! \seetitle[http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm]{The Numerical Python Manual}{The Numeric Python extension (NumPy) defines another array type; see From nnorwitz@users.sourceforge.net Thu Apr 4 14:04:06 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Thu, 04 Apr 2002 06:04:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libarray.tex,1.31.8.1,1.31.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7009/Doc/lib Modified Files: Tag: release22-maint libarray.tex Log Message: SF 539024, Fix broken link to numpy Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.31.8.1 retrieving revision 1.31.8.2 diff -C2 -d -r1.31.8.1 -r1.31.8.2 *** libarray.tex 1 Apr 2002 23:02:28 -0000 1.31.8.1 --- libarray.tex 4 Apr 2002 14:04:03 -0000 1.31.8.2 *************** *** 208,212 **** Representation (XDR) data as used in some remote procedure call systems.} ! \seetitle[http://numpy.sourceforge.net/numdoc/HTML/numdoc.html]{The Numerical Python Manual}{The Numeric Python extension (NumPy) defines another array type; see --- 208,212 ---- Representation (XDR) data as used in some remote procedure call systems.} ! \seetitle[http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm]{The Numerical Python Manual}{The Numeric Python extension (NumPy) defines another array type; see From fdrake@users.sourceforge.net Thu Apr 4 15:42:23 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 07:42:23 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep2html.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9369 Modified Files: pep2html.py Log Message: Do not open
     sections until we need them; this avoids empty 
    elements at the top of the content and removes leading blank lines inside
    
     sections.
    
    
    Index: pep2html.py
    ===================================================================
    RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v
    retrieving revision 1.34
    retrieving revision 1.35
    diff -C2 -d -r1.34 -r1.35
    *** pep2html.py	2 Apr 2002 23:07:13 -0000	1.34
    --- pep2html.py	4 Apr 2002 15:42:20 -0000	1.35
    ***************
    *** 199,203 ****
          print >> fo, '
    ' print >> fo, '
    ' ! print >> fo, '
    '
          while 1:
              line = fi.readline()
    --- 199,203 ----
          print >> fo, '
    ' print >> fo, '
    ' ! need_pre = 1 while 1: line = fi.readline() *************** *** 211,217 **** if line.strip() == LOCALVARS: break ! print >> fo, '
    ' print >> fo, '

    %s

    ' % line.strip() ! print >> fo, '
    ',
              else:
                  # PEP 0 has some special treatment
    --- 211,220 ----
                  if line.strip() == LOCALVARS:
                      break
    !             if not need_pre:
    !                 print >> fo, '
    ' print >> fo, '

    %s

    ' % line.strip() ! need_pre = 1 ! elif not line.strip() and need_pre: ! continue else: # PEP 0 has some special treatment *************** *** 221,224 **** --- 224,230 ---- # This is a PEP summary line, which we need to hyperlink url = PEPURL % int(parts[1]) + if need_pre: + print >> fo, '
    '
    +                         need_pre = 0
                          print >> fo, re.sub(
                              parts[1],
    ***************
    *** 229,238 ****
                          # This is a pep email address line, so hyperlink it
                          url = '%s' % (parts[-1], parts[-1])
                          print >> fo, re.sub(
                              parts[-1], url, line, 1),
                          continue
                  line = fixpat.sub(lambda x, c=infile: fixanchor(c, x), line)
                  fo.write(line)
    !     print >> fo, '
    ' print >> fo, '
    ' print >> fo, '' --- 235,251 ---- # This is a pep email address line, so hyperlink it url = '%s' % (parts[-1], parts[-1]) + if need_pre: + print >> fo, '
    '
    +                         need_pre = 0
                          print >> fo, re.sub(
                              parts[-1], url, line, 1),
                          continue
                  line = fixpat.sub(lambda x, c=infile: fixanchor(c, x), line)
    +             if need_pre:
    +                 print >> fo, '
    '
    +                 need_pre = 0
                  fo.write(line)
    !     if not need_pre:
    !         print >> fo, '
    ' print >> fo, '' print >> fo, '' From fdrake@users.sourceforge.net Thu Apr 4 15:40:20 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 07:40:20 -0800 Subject: [Python-checkins] CVS: python/nondist/peps style.css,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8493 Modified Files: style.css Log Message: Organize things a bit, clean up the presentation. Index: style.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/style.css,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** style.css 2 Apr 2002 23:07:13 -0000 1.2 --- style.css 4 Apr 2002 15:40:17 -0000 1.3 *************** *** 1,15 **** ! .navigation { width: 100%; ! background: #99ccff; } ! ! .navigation .navicon { width: 150px; ! height: 35; } .navigation .textlinks { padding-left: 1em; text-align: left; } ! .header, .content { margin-left: 1em; ! margin-right: 1em; ! padding-left: 1em; ! padding-right: 1em; } ! ! body { margin: 0px; ! padding: 0px; } --- 1,12 ---- ! body { margin: 0px; ! padding: 0px; } ! .navigation { width: 100%; ! background: #99ccff; } ! .navigation .navicon { width: 150px; ! height: 35; } .navigation .textlinks { padding-left: 1em; text-align: left; } ! .header { margin-top: 0.5em; } ! .header, .content { margin-left: 1em; ! margin-right: 1em; } From fdrake@users.sourceforge.net Thu Apr 4 16:11:05 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 08:11:05 -0800 Subject: [Python-checkins] CVS: python/nondist/peps style.css,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31186 Modified Files: style.css Log Message: Move more style information into the style sheets. Index: style.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/style.css,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** style.css 4 Apr 2002 15:40:17 -0000 1.3 --- style.css 4 Apr 2002 16:11:03 -0000 1.4 *************** *** 11,12 **** --- 11,19 ---- .header, .content { margin-left: 1em; margin-right: 1em; } + + .header table td { text-align: left; } + .header table th { text-align: right; + font-family: sans-serif; + padding-right: 0.5em; } + + h3 { font-family: sans-serif; } From fdrake@users.sourceforge.net Thu Apr 4 16:13:34 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 08:13:34 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep2html.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv953 Modified Files: pep2html.py Log Message: Link to the stylesheet instead of embedding it; even NS4 doesn't require that! Allow the stylesheet to take care of alignment in the headers table. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** pep2html.py 4 Apr 2002 15:42:20 -0000 1.35 --- pep2html.py 4 Apr 2002 16:13:32 -0000 1.36 *************** *** 142,149 **** if title: print >> fo, ' %s' % cgi.escape(title) ! print >> fo, ' ' print >> fo, '' # body --- 142,146 ---- if title: print >> fo, ' %s' % cgi.escape(title) ! print >> fo, ' ' print >> fo, '' # body *************** *** 193,197 **** else: v = cgi.escape(v) ! print >> fo, '
%s: %s
' --- 190,194 ---- else: v = cgi.escape(v) ! print >> fo, ' %s: %s' \ % (cgi.escape(k), v) print >> fo, '' From lemburg@users.sourceforge.net Thu Apr 4 16:15:43 2002 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Thu, 04 Apr 2002 08:15:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/freeze freeze.py,1.40,1.41 makeconfig.py,1.5,1.6 makefreeze.py,1.12,1.13 makemakefile.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory usw-pr-cvs1:/tmp/cvs-serv1419/Tools/freeze Modified Files: freeze.py makeconfig.py makefreeze.py makemakefile.py Log Message: Updated freeze.py to the new Makefile symbol layout. Fixed a few compiler warnings. freeze.py now produces binaries which can import shared modules (unlike before). Index: freeze.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** freeze.py 18 Oct 2001 19:15:31 -0000 1.40 --- freeze.py 4 Apr 2002 16:15:41 -0000 1.41 *************** *** 465,469 **** somevars['CFLAGS'] = string.join(cflags) # override somevars['CPPFLAGS'] = string.join(cppflags) # override ! files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ files + supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] --- 465,469 ---- somevars['CFLAGS'] = string.join(cflags) # override somevars['CPPFLAGS'] = string.join(cppflags) # override ! files = [base_config_c, base_frozen_c] + \ files + supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] Index: makeconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makeconfig.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** makeconfig.py 21 Mar 2001 06:58:25 -0000 1.5 --- makeconfig.py 4 Apr 2002 16:15:41 -0000 1.6 *************** *** 20,24 **** if with_ifdef: outfp.write("#ifndef init%s\n"%mod) ! outfp.write('extern void init%s();\n' % mod) if with_ifdef: outfp.write("#endif\n") --- 20,24 ---- if with_ifdef: outfp.write("#ifndef init%s\n"%mod) ! outfp.write('extern void init%s(void);\n' % mod) if with_ifdef: outfp.write("#endif\n") Index: makefreeze.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makefreeze.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** makefreeze.py 18 Oct 2001 19:15:32 -0000 1.12 --- makefreeze.py 4 Apr 2002 16:15:41 -0000 1.13 *************** *** 19,25 **** default_entry_point = """ int ! main(argc, argv) ! int argc; ! char **argv; { extern int Py_FrozenMain(int, char **); --- 19,23 ---- default_entry_point = """ int ! main(int argc, char **argv) { extern int Py_FrozenMain(int, char **); Index: makemakefile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makemakefile.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** makemakefile.py 2 Jun 2001 06:16:02 -0000 1.5 --- makemakefile.py 4 Apr 2002 16:15:41 -0000 1.6 *************** *** 25,29 **** outfp.write("\n%s: %s\n" % (target, string.join(deps))) ! outfp.write("\t$(CC) %s -o %s $(LDLAST)\n" % (string.join(files), target)) --- 25,29 ---- outfp.write("\n%s: %s\n" % (target, string.join(deps))) ! outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" % (string.join(files), target)) From lemburg@users.sourceforge.net Thu Apr 4 16:17:13 2002 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Thu, 04 Apr 2002 08:17:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.374,1.375 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2014/Misc Modified Files: NEWS Log Message: Added note about updated freeze.py Tool. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.374 retrieving revision 1.375 diff -C2 -d -r1.374 -r1.375 *** NEWS 4 Apr 2002 15:21:33 -0000 1.374 --- NEWS 4 Apr 2002 16:17:11 -0000 1.375 *************** *** 94,97 **** --- 94,101 ---- Tools/Demos + - freeze.py now produces binaries which can import shared modules, + unlike before when this failed due to missing symbol exports in + the generated binary. + Build From gvanrossum@users.sourceforge.net Thu Apr 4 16:22:32 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 08:22:32 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.91,2.92 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv3980 Modified Files: getargs.c Log Message: Fix by Greg Chapman from SF bug 534347: Potential AV in vgetargskeywords. Bugfix candidate. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -d -r2.91 -r2.92 *** getargs.c 9 Jan 2002 16:21:27 -0000 2.91 --- getargs.c 4 Apr 2002 16:22:30 -0000 2.92 *************** *** 1217,1221 **** while (PyDict_Next(keywords, &pos, &key, &value)) { int match = 0; ! char *ks = PyString_AsString(key); for (i = 0; i < max; i++) { if (!strcmp(ks, kwlist[i])) { --- 1217,1227 ---- while (PyDict_Next(keywords, &pos, &key, &value)) { int match = 0; ! char *ks; ! if (!PyString_Check(key)) { ! PyErr_SetString(PyExc_TypeError, ! "keywords must be strings"); ! return 0; ! } ! ks = PyString_AsString(key); for (i = 0; i < max; i++) { if (!strcmp(ks, kwlist[i])) { From fdrake@users.sourceforge.net Thu Apr 4 16:24:33 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 08:24:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libarray.tex,1.28,1.28.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv4802 Modified Files: Tag: release21-maint libarray.tex Log Message: Back-port Neal Norwitz's patch: libarray.tex 1.31.8.2 SF 539024, Fix broken link to numpy Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.28 retrieving revision 1.28.4.1 diff -C2 -d -r1.28 -r1.28.4.1 *** libarray.tex 11 Dec 2000 20:57:13 -0000 1.28 --- libarray.tex 4 Apr 2002 16:24:31 -0000 1.28.4.1 *************** *** 190,194 **** Representation (XDR) data as used in some remote procedure call systems.} ! \seetitle[http://numpy.sourceforge.net/numdoc/HTML/numdoc.html]{The Numerical Python Manual}{The Numeric Python extension (NumPy) defines another array type; see --- 190,194 ---- Representation (XDR) data as used in some remote procedure call systems.} ! \seetitle[http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm]{The Numerical Python Manual}{The Numeric Python extension (NumPy) defines another array type; see From gvanrossum@users.sourceforge.net Thu Apr 4 16:27:06 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 08:27:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_binascii.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5697 Modified Files: test_binascii.py Log Message: Add test case for SF bug 534347. Index: test_binascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_binascii.py 18 Oct 2001 21:57:37 -0000 1.11 --- test_binascii.py 4 Apr 2002 16:27:04 -0000 1.12 *************** *** 114,115 **** --- 114,123 ---- # Verify the treatment of Unicode strings verify(binascii.hexlify(u'a') == '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" From gvanrossum@users.sourceforge.net Thu Apr 4 17:50:59 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:50:59 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.134,2.135 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7166 Modified Files: typeobject.c Log Message: Clarifying code rearrangement and comments by David Abrahams. I've got to admit that I haven't reviewed this carefully, but it looks okay from 30,000 views, and doesn't break anything. (SF patch 536407.) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.134 retrieving revision 2.135 diff -C2 -d -r2.134 -r2.135 *** typeobject.c 3 Apr 2002 02:13:37 -0000 2.134 --- typeobject.c 4 Apr 2002 17:50:54 -0000 2.135 *************** *** 1237,1242 **** { PyTypeObject *metatype = type->ob_type; ! PyObject *descr, *res; ! descrgetfunc f; /* Initialize this type (we'll assume the metatype is initialized) */ --- 1237,1242 ---- { PyTypeObject *metatype = type->ob_type; ! PyObject *meta_attribute, *attribute; ! descrgetfunc meta_get; /* Initialize this type (we'll assume the metatype is initialized) */ *************** *** 1246,1283 **** } ! /* Get a descriptor from the metatype */ ! descr = _PyType_Lookup(metatype, name); ! f = NULL; ! if (descr != NULL) { ! f = descr->ob_type->tp_descr_get; ! if (f != NULL && PyDescr_IsData(descr)) ! return f(descr, ! (PyObject *)type, (PyObject *)metatype); ! } ! /* Look in tp_dict of this type and its bases */ ! res = _PyType_Lookup(type, name); ! if (res != NULL) { ! f = res->ob_type->tp_descr_get; ! if (f != NULL) ! return f(res, (PyObject *)NULL, (PyObject *)type); ! Py_INCREF(res); ! return res; } ! /* Use the descriptor from the metatype */ ! if (f != NULL) { ! res = f(descr, (PyObject *)type, (PyObject *)metatype); ! return res; } ! if (descr != NULL) { ! Py_INCREF(descr); ! return descr; } /* Give up */ PyErr_Format(PyExc_AttributeError, ! "type object '%.50s' has no attribute '%.400s'", ! type->tp_name, PyString_AS_STRING(name)); return NULL; } --- 1246,1301 ---- } ! /* No readable descriptor found yet */ ! meta_get = NULL; ! ! /* Look for the attribute in the metatype */ ! meta_attribute = _PyType_Lookup(metatype, name); ! if (meta_attribute != NULL) { ! meta_get = meta_attribute->ob_type->tp_descr_get; ! ! if (meta_get != NULL && PyDescr_IsData(meta_attribute)) { ! /* Data descriptors implement tp_descr_set to intercept ! * writes. Assume the attribute is not overridden in ! * type's tp_dict (and bases): call the descriptor now. ! */ ! return meta_get(meta_attribute, (PyObject *)type, ! (PyObject *)metatype); ! } } ! /* No data descriptor found on metatype. Look in tp_dict of this ! * type and its bases */ ! attribute = _PyType_Lookup(type, name); ! if (attribute != NULL) { ! /* Implement descriptor functionality, if any */ ! descrgetfunc local_get = attribute->ob_type->tp_descr_get; ! if (local_get != NULL) { ! /* NULL 2nd argument indicates the descriptor was ! * found on the target object itself (or a base) */ ! return local_get(attribute, (PyObject *)NULL, ! (PyObject *)type); ! } ! ! Py_INCREF(attribute); ! return attribute; } ! ! /* No attribute found in local __dict__ (or bases): use the ! * descriptor from the metatype, if any */ ! if (meta_get != NULL) ! return meta_get(meta_attribute, (PyObject *)type, ! (PyObject *)metatype); ! ! /* If an ordinary attribute was found on the metatype, return it now */ ! if (meta_attribute != NULL) { ! Py_INCREF(meta_attribute); ! return meta_attribute; } /* Give up */ PyErr_Format(PyExc_AttributeError, ! "type object '%.50s' has no attribute '%.400s'", ! type->tp_name, PyString_AS_STRING(name)); return NULL; } From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib site.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7804/Lib Modified Files: site.py Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** site.py 24 Feb 2002 05:32:32 -0000 1.41 --- site.py 4 Apr 2002 17:52:50 -0000 1.42 *************** *** 262,266 **** else: __builtin__.credits = _Printer("credits", """\ ! Thanks to CWI, CNRI, BeOpen.com, Digital Creations and a cast of thousands for supporting Python development. See www.python.org for more information.""") here = os.path.dirname(os.__file__) --- 262,266 ---- else: __builtin__.credits = _Printer("credits", """\ ! Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information.""") here = os.path.dirname(os.__file__) From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs license.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv7804/Doc/texinputs Modified Files: license.tex Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/license.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** license.tex 27 Feb 2002 13:29:46 -0000 1.5 --- license.tex 4 Apr 2002 17:52:49 -0000 1.6 *************** *** 13,21 **** In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Zope Corporation (then Digital ! Creations; see \url{http://www.zope.com/}). In 2001, the Python Software Foundation (PSF, see \url{http://www.python.org/psf/}) was formed, a non-profit organization created specifically to own ! Python-related Intellectual Property. Digital Creations is a sponsoring member of the PSF. --- 13,21 ---- In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations (now Zope ! Corporation; see \url{http://www.zope.com/}). In 2001, the Python Software Foundation (PSF, see \url{http://www.python.org/psf/}) was formed, a non-profit organization created specifically to own ! Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF. From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:52 -0800 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.19,1.20 setup.py,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7804 Modified Files: LICENSE setup.py Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** LICENSE 27 Feb 2002 13:29:45 -0000 1.19 --- LICENSE 4 Apr 2002 17:52:49 -0000 1.20 *************** *** 14,22 **** In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations (see ! http://www.digicool.com). In 2001, the Python Software Foundation ! (PSF, see http://www.python.org/psf/) was formed, a non-profit ! organization created specifically to own Python-related Intellectual ! Property. Digital Creations is a sponsoring member of the PSF. All Python releases are Open Source (see http://www.opensource.org for --- 14,23 ---- In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations (now Zope ! Corporation, see http://www.zope.com). In 2001, the Python Software ! Foundation (PSF, see http://www.python.org/psf/) was formed, a ! non-profit organization created specifically to own Python-related ! Intellectual Property. Zope Corporation is a sponsoring member of ! the PSF. All Python releases are Open Source (see http://www.opensource.org for Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** setup.py 25 Mar 2002 14:20:09 -0000 1.85 --- setup.py 4 Apr 2002 17:52:49 -0000 1.86 *************** *** 313,317 **** exts.append( Extension('parser', ['parsermodule.c']) ) ! # Digital Creations' cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) --- 313,317 ---- exts.append( Extension('parser', ['parsermodule.c']) ) ! # cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc BeOS-setup.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv7804/Misc Modified Files: BeOS-setup.py Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: BeOS-setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/BeOS-setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BeOS-setup.py 10 Apr 2001 21:50:09 -0000 1.1 --- BeOS-setup.py 4 Apr 2002 17:52:50 -0000 1.2 *************** *** 243,247 **** exts.append( Extension('parser', ['parsermodule.c']) ) ! # Digital Creations' cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) --- 243,247 ---- exts.append( Extension('parser', ['parsermodule.c']) ) ! # cStringIO and cPickle exts.append( Extension('cStringIO', ['cStringIO.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) ) From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:52 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include cStringIO.h,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv7804/Include Modified Files: cStringIO.h Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: cStringIO.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/cStringIO.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** cStringIO.h 30 Mar 2002 08:57:12 -0000 2.16 --- cStringIO.h 4 Apr 2002 17:52:50 -0000 2.17 *************** *** 6,64 **** /* - cStringIO.h,v 1.4 1997/12/07 14:27:00 jim Exp - - cStringIO C API - - Copyright - - Copyright 1996 Digital Creations, L.C., 910 Princess Anne - Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All - rights reserved. Copyright in this software is owned by DCLC, - unless otherwise indicated. Permission to use, copy and - distribute this software is hereby granted, provided that the - above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear. Note that - any product, process or technology described in this software - may be the subject of other Intellectual Property rights - reserved by Digital Creations, L.C. and are not licensed - hereunder. - - Trademarks - - Digital Creations & DCLC, are trademarks of Digital Creations, L.C.. - All other trademarks are owned by their respective companies. - - No Warranty - - The software is provided "as is" without warranty of any kind, - either express or implied, including, but not limited to, the - implied warranties of merchantability, fitness for a particular - purpose, or non-infringement. This software could include - technical inaccuracies or typographical errors. Changes are - periodically made to the software; these changes will be - incorporated in new editions of the software. DCLC may make - improvements and/or changes in this software at any time - without notice. - - Limitation Of Liability - - In no event will DCLC be liable for direct, indirect, special, - incidental, economic, cover, or consequential damages arising - out of the use of or inability to use this software even if - advised of the possibility of such damages. Some states do not - allow the exclusion or limitation of implied warranties or - limitation of liability for incidental or consequential - damages, so the above limitation or exclusion may not apply to - you. - - If you have questions regarding this software, - contact: - - info@digicool.com - Digital Creations L.C. - - (540) 371-6909 - - This header provides access to cStringIO objects from C. Functions are provided for calling cStringIO objects and --- 6,9 ---- From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:53 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python.iss,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv7804/PCbuild Modified Files: python.iss Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: python.iss =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python.iss,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** python.iss 8 Aug 2001 19:32:25 -0000 1.5 --- python.iss 4 Apr 2002 17:52:50 -0000 1.6 *************** *** 66,70 **** OutputBaseFilename=Python-2.2a1 ! AppPublisher=PythonLabs at Digital Creations AppPublisherURL=http://www.python.org AppSupportURL=http://www.python.org --- 66,70 ---- OutputBaseFilename=Python-2.2a1 ! AppPublisher=PythonLabs at Zope Corporation AppPublisherURL=http://www.python.org AppSupportURL=http://www.python.org From gvanrossum@users.sourceforge.net Thu Apr 4 17:52:53 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 09:52:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules Setup.dist,1.25,1.26 cPickle.c,2.79,2.80 cStringIO.c,2.33,2.34 operator.c,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7804/Modules Modified Files: Setup.dist cPickle.c cStringIO.c operator.c Log Message: Removed old Digital Creations copyright/license notices (with permission from Paul Everitt). Also removed a few other references to Digital Creations and changed the remaining ones to Zope Corporation. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Setup.dist 16 Feb 2002 18:23:30 -0000 1.25 --- Setup.dist 4 Apr 2002 17:52:50 -0000 1.26 *************** *** 411,415 **** #parser parsermodule.c ! # Digital Creations' cStringIO and cPickle #cStringIO cStringIO.c #cPickle cPickle.c --- 411,415 ---- #parser parsermodule.c ! # cStringIO and cPickle #cStringIO cStringIO.c #cPickle cPickle.c Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.79 retrieving revision 2.80 diff -C2 -d -r2.79 -r2.80 *** cPickle.c 3 Apr 2002 22:41:50 -0000 2.79 --- cPickle.c 4 Apr 2002 17:52:50 -0000 2.80 *************** *** 1,50 **** - /* - * cPickle.c,v 1.71 1999/07/11 13:30:34 jim Exp - * - * Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the disclaimer that follows. - * - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions, and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * o Neither the name of Digital Creations nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS - * IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL - * CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - # - # If you have questions regarding this software, contact: - # - # Digital Creations, L.C. - # 910 Princess Ann Street - # Fredericksburge, Virginia 22401 - # - # info@digicool.com - # - # (540) 371-6909 - */ - static char cPickle_module_documentation[] = "C implementation and optimization of the Python pickle module\n" --- 1,2 ---- Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -d -r2.33 -r2.34 *** cStringIO.c 8 Mar 2002 17:17:33 -0000 2.33 --- cStringIO.c 4 Apr 2002 17:52:50 -0000 2.34 *************** *** 1,55 **** - /* - * cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp - * - * Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the disclaimer that follows. - * - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions, and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * o All advertising materials mentioning features or use of this - * software must display the following acknowledgement: - * - * This product includes software developed by Digital Creations - * and its contributors. - * - * o Neither the name of Digital Creations nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS - * IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL - * CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - # - # If you have questions regarding this software, contact: - # - # Digital Creations, L.C. - # 910 Princess Ann Street - # Fredericksburge, Virginia 22401 - # - # info@digicool.com - # - # (540) 371-6909 - */ static char cStringIO_module_documentation[] = "A simple fast partial StringIO replacement.\n" --- 1,2 ---- Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** operator.c 3 Apr 2002 22:41:50 -0000 2.19 --- operator.c 4 Apr 2002 17:52:50 -0000 2.20 *************** *** 9,71 **** "; - /* - - Copyright - - Copyright 1996 Digital Creations, L.C., 910 Princess Anne - Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All - rights reserved. Copyright in this software is owned by DCLC, - unless otherwise indicated. Permission to use, copy and - distribute this software is hereby granted, provided that the - above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear. Note that - any product, process or technology described in this software - may be the subject of other Intellectual Property rights - reserved by Digital Creations, L.C. and are not licensed - hereunder. - - Trademarks - - Digital Creations & DCLC, are trademarks of Digital Creations, L.C.. - All other trademarks are owned by their respective companies. - - No Warranty - - The software is provided "as is" without warranty of any kind, - either express or implied, including, but not limited to, the - implied warranties of merchantability, fitness for a particular - purpose, or non-infringement. This software could include - technical inaccuracies or typographical errors. Changes are - periodically made to the software; these changes will be - incorporated in new editions of the software. DCLC may make - improvements and/or changes in this software at any time - without notice. - - Limitation Of Liability - - In no event will DCLC be liable for direct, indirect, special, - incidental, economic, cover, or consequential damages arising - out of the use of or inability to use this software even if - advised of the possibility of such damages. Some states do not - allow the exclusion or limitation of implied warranties or - limitation of liability for incidental or consequential - damages, so the above limitation or exclusion may not apply to - you. - - - If you have questions regarding this software, - contact: - - Jim Fulton, jim@digicool.com - Digital Creations L.C. - - (540) 371-6909 - - Modifications - - Renamed and slightly rearranged by Guido van Rossum - - */ - #include "Python.h" --- 9,12 ---- From fdrake@users.sourceforge.net Thu Apr 4 17:57:10 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 09:57:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv9727/Lib/xml/sax Modified Files: expatreader.py Log Message: Avoid creating circular references between the ExpatParser and the ContentHandler. While GC will eventually clean up, it can take longer than normal for applications that create a lot of strings (or other immutables) rather without creating many containers. This closes SF bug #535474. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** expatreader.py 30 Jul 2001 22:41:23 -0000 1.25 --- expatreader.py 4 Apr 2002 17:57:08 -0000 1.26 *************** *** 27,30 **** --- 27,67 ---- import string + import weakref + + # --- ExpatLocator + + class ExpatLocator(xmlreader.Locator): + """Locator for use with the ExpatParser class. + + This uses a weak reference to the parser object to avoid creating + a circular reference between the parser and the content handler. + """ + def __init__(self, parser): + self._ref = weakref.ref(parser) + + def getColumnNumber(self): + parser = self._ref() + if parser is None or parser._parser is None: + return None + return parser._parser.ErrorColumnNumber + + def getLineNumber(self): + parser = self._ref() + if parser is None or parser._parser is None: + return 1 + return self._parser.ErrorLineNumber + + def getPublicId(self): + parser = self._ref() + if parser is None: + return None + return parser._source.getPublicId() + + def getSystemId(self): + parser = self._ref() + if parser is None: + return None + return parser._source.getSystemId() + # --- ExpatParser *************** *** 50,54 **** self._source = source self.reset() ! self._cont_handler.setDocumentLocator(self) xmlreader.IncrementalParser.parse(self, source) --- 87,91 ---- self._source = source self.reset() ! self._cont_handler.setDocumentLocator(ExpatLocator(self)) xmlreader.IncrementalParser.parse(self, source) From fdrake@users.sourceforge.net Thu Apr 4 17:58:58 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 09:58:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.25,1.25.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv10291/Lib/xml/sax Modified Files: Tag: release22-maint expatreader.py Log Message: Avoid creating circular references between the ExpatParser and the ContentHandler. While GC will eventually clean up, it can take longer than normal for applications that create a lot of strings (or other immutables) rather without creating many containers. This closes SF bug #535474. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.25 retrieving revision 1.25.16.1 diff -C2 -d -r1.25 -r1.25.16.1 *** expatreader.py 30 Jul 2001 22:41:23 -0000 1.25 --- expatreader.py 4 Apr 2002 17:58:53 -0000 1.25.16.1 *************** *** 27,30 **** --- 27,67 ---- import string + import weakref + + # --- ExpatLocator + + class ExpatLocator(xmlreader.Locator): + """Locator for use with the ExpatParser class. + + This uses a weak reference to the parser object to avoid creating + a circular reference between the parser and the content handler. + """ + def __init__(self, parser): + self._ref = weakref.ref(parser) + + def getColumnNumber(self): + parser = self._ref() + if parser is None or parser._parser is None: + return None + return parser._parser.ErrorColumnNumber + + def getLineNumber(self): + parser = self._ref() + if parser is None or parser._parser is None: + return 1 + return self._parser.ErrorLineNumber + + def getPublicId(self): + parser = self._ref() + if parser is None: + return None + return parser._source.getPublicId() + + def getSystemId(self): + parser = self._ref() + if parser is None: + return None + return parser._source.getSystemId() + # --- ExpatParser *************** *** 50,54 **** self._source = source self.reset() ! self._cont_handler.setDocumentLocator(self) xmlreader.IncrementalParser.parse(self, source) --- 87,91 ---- self._source = source self.reset() ! self._cont_handler.setDocumentLocator(ExpatLocator(self)) xmlreader.IncrementalParser.parse(self, source) From fdrake@users.sourceforge.net Thu Apr 4 17:59:28 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 09:59:28 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.22,1.22.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv10503/Lib/xml/sax Modified Files: Tag: release21-maint expatreader.py Log Message: Avoid creating circular references between the ExpatParser and the ContentHandler. While GC will eventually clean up, it can take longer than normal for applications that create a lot of strings (or other immutables) rather without creating many containers. This closes SF bug #535474. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.22 retrieving revision 1.22.4.1 diff -C2 -d -r1.22 -r1.22.4.1 *** expatreader.py 27 Jan 2001 09:01:20 -0000 1.22 --- expatreader.py 4 Apr 2002 17:59:25 -0000 1.22.4.1 *************** *** 17,20 **** --- 17,57 ---- import string + import weakref + + # --- ExpatLocator + + class ExpatLocator(xmlreader.Locator): + """Locator for use with the ExpatParser class. + + This uses a weak reference to the parser object to avoid creating + a circular reference between the parser and the content handler. + """ + def __init__(self, parser): + self._ref = weakref.ref(parser) + + def getColumnNumber(self): + parser = self._ref() + if parser is None or parser._parser is None: + return None + return parser._parser.ErrorColumnNumber + + def getLineNumber(self): + parser = self._ref() + if parser is None or parser._parser is None: + return 1 + return self._parser.ErrorLineNumber + + def getPublicId(self): + parser = self._ref() + if parser is None: + return None + return parser._source.getPublicId() + + def getSystemId(self): + parser = self._ref() + if parser is None: + return None + return parser._source.getSystemId() + # --- ExpatParser *************** *** 40,44 **** self._source = source self.reset() ! self._cont_handler.setDocumentLocator(self) xmlreader.IncrementalParser.parse(self, source) --- 77,81 ---- self._source = source self.reset() ! self._cont_handler.setDocumentLocator(ExpatLocator(self)) xmlreader.IncrementalParser.parse(self, source) From fdrake@users.sourceforge.net Thu Apr 4 18:04:33 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 10:04:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.6.2.4,1.6.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv12393 Modified Files: Tag: release21-maint push-docs.sh Log Message: Mark the notice about the new development version of the docs as not needing to be archived. Most of these are pretty bland. ;-) Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -C2 -d -r1.6.2.4 -r1.6.2.5 *** push-docs.sh 1 Apr 2002 20:13:08 -0000 1.6.2.4 --- push-docs.sh 4 Apr 2002 18:04:31 -0000 1.6.2.5 *************** *** 79,82 **** --- 79,83 ---- From: "Fred L. Drake" Subject: [$DOCLABEL doc updates] + X-No-Archive: yes The $DOCLABEL version of the documentation has been updated: From fdrake@users.sourceforge.net Thu Apr 4 18:05:21 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 10:05:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.13.8.1,1.13.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv12671 Modified Files: Tag: release22-maint push-docs.sh Log Message: Mark the notice about the new development version of the docs as not needing to be archived. Most of these are pretty bland. ;-) Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.13.8.1 retrieving revision 1.13.8.2 diff -C2 -d -r1.13.8.1 -r1.13.8.2 *** push-docs.sh 1 Apr 2002 20:13:50 -0000 1.13.8.1 --- push-docs.sh 4 Apr 2002 18:05:19 -0000 1.13.8.2 *************** *** 79,82 **** --- 79,83 ---- From: "Fred L. Drake" Subject: [$DOCLABEL doc updates] + X-No-Archive: yes The $DOCLABEL version of the documentation has been updated: From fdrake@users.sourceforge.net Thu Apr 4 18:06:08 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 10:06:08 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv12900 Modified Files: push-docs.sh Log Message: Mark the notice about the new development version of the docs as not needing to be archived. Most of these are pretty bland. ;-) Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** push-docs.sh 1 Apr 2002 20:15:05 -0000 1.14 --- push-docs.sh 4 Apr 2002 18:06:06 -0000 1.15 *************** *** 79,82 **** --- 79,83 ---- From: "Fred L. Drake" Subject: [$DOCLABEL doc updates] + X-No-Archive: yes The $DOCLABEL version of the documentation has been updated: From fdrake@users.sourceforge.net Thu Apr 4 19:12:33 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 11:12:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv4655/Lib/xml/sax Modified Files: expatreader.py Log Message: Not sure why the regression test missed this, but the PyXML tests caught it. We should get attributes from the right object. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** expatreader.py 4 Apr 2002 17:57:08 -0000 1.26 --- expatreader.py 4 Apr 2002 19:12:31 -0000 1.27 *************** *** 50,54 **** if parser is None or parser._parser is None: return 1 ! return self._parser.ErrorLineNumber def getPublicId(self): --- 50,54 ---- if parser is None or parser._parser is None: return 1 ! return parser._parser.ErrorLineNumber def getPublicId(self): From fdrake@users.sourceforge.net Thu Apr 4 19:12:52 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 11:12:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.25.16.1,1.25.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv4783/Lib/xml/sax Modified Files: Tag: release22-maint expatreader.py Log Message: Not sure why the regression test missed this, but the PyXML tests caught it. We should get attributes from the right object. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.25.16.1 retrieving revision 1.25.16.2 diff -C2 -d -r1.25.16.1 -r1.25.16.2 *** expatreader.py 4 Apr 2002 17:58:53 -0000 1.25.16.1 --- expatreader.py 4 Apr 2002 19:12:50 -0000 1.25.16.2 *************** *** 50,54 **** if parser is None or parser._parser is None: return 1 ! return self._parser.ErrorLineNumber def getPublicId(self): --- 50,54 ---- if parser is None or parser._parser is None: return 1 ! return parser._parser.ErrorLineNumber def getPublicId(self): From fdrake@users.sourceforge.net Thu Apr 4 19:13:20 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 11:13:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.22.4.1,1.22.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv4942/Lib/xml/sax Modified Files: Tag: release21-maint expatreader.py Log Message: Not sure why the regression test missed this, but the PyXML tests caught it. We should get attributes from the right object. Index: expatreader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v retrieving revision 1.22.4.1 retrieving revision 1.22.4.2 diff -C2 -d -r1.22.4.1 -r1.22.4.2 *** expatreader.py 4 Apr 2002 17:59:25 -0000 1.22.4.1 --- expatreader.py 4 Apr 2002 19:13:18 -0000 1.22.4.2 *************** *** 40,44 **** if parser is None or parser._parser is None: return 1 ! return self._parser.ErrorLineNumber def getPublicId(self): --- 40,44 ---- if parser is None or parser._parser is None: return 1 ! return parser._parser.ErrorLineNumber def getPublicId(self): From tim_one@users.sourceforge.net Thu Apr 4 19:29:57 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 11:29:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.337.2.4.2.13,1.337.2.4.2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11289/Misc Modified Files: Tag: release22-maint NEWS Log Message: SF bug 497854: Short-cuts missing for All Users. Fixing a Windows-specific installer glitch. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.13 retrieving revision 1.337.2.4.2.14 diff -C2 -d -r1.337.2.4.2.13 -r1.337.2.4.2.14 *** NEWS 29 Mar 2002 01:05:09 -0000 1.337.2.4.2.13 --- NEWS 4 Apr 2002 19:29:55 -0000 1.337.2.4.2.14 *************** *** 11,14 **** --- 11,19 ---- could access a pointer to freed memory. + Windows + + - The installer now installs Start menu shortcuts under (the local + equivalent of) "All Users" when doing an Admin install. + What's New in Python 2.2.1c2? *************** *** 19,23 **** including: ! - I remembered to run autoconf before cutting the release tarball. Core and builtins --- 24,28 ---- including: ! - I remembered to run autoconf before cutting the release tarball. Core and builtins From tim_one@users.sourceforge.net Thu Apr 4 19:29:57 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 11:29:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.98.4.3,1.98.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv11289/PCbuild Modified Files: Tag: release22-maint python20.wse Log Message: SF bug 497854: Short-cuts missing for All Users. Fixing a Windows-specific installer glitch. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.3 retrieving revision 1.98.4.4 diff -C2 -d -r1.98.4.3 -r1.98.4.4 *** python20.wse 25 Mar 2002 20:17:19 -0000 1.98.4.3 --- python20.wse 4 Apr 2002 19:29:55 -0000 1.98.4.4 *************** *** 1513,1524 **** Flags=00000100 end - item: Set Variable - Variable=CGROUP_SAVE - Value=%GROUP% - end - item: Set Variable - Variable=GROUP - Value=%GROUPDIR%\%GROUP% - end item: Else Statement end --- 1513,1516 ---- *************** *** 1557,1567 **** item: Remark end item: If/While Statement ! Variable=TASKS ! Value=B ! Flags=00000011 end item: Set Variable Variable=GROUP end item: End Block --- 1549,1569 ---- item: Remark end + item: Set Variable + Variable=CGROUP_SAVE + Value=%GROUP% + end item: If/While Statement ! Variable=DOADMIN ! Value=1 ! end ! item: Set Variable ! Variable=GROUP ! Value=%CGROUPDIR%\%GROUP% ! end ! item: Else Statement end item: Set Variable Variable=GROUP + Value=%GROUPDIR%\%GROUP% end item: End Block From fdrake@users.sourceforge.net Thu Apr 4 19:36:18 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 11:36:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.375,1.376 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv14149/Misc Modified Files: NEWS Log Message: Add note about changes in xml.sax.expatreader. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.375 retrieving revision 1.376 diff -C2 -d -r1.375 -r1.376 *** NEWS 4 Apr 2002 16:17:11 -0000 1.375 --- NEWS 4 Apr 2002 19:36:15 -0000 1.376 *************** *** 92,95 **** --- 92,99 ---- - warnings.warn now accepts a Warning instance as first argument. + - The xml.sax.expatreader.ExpatParser class will no longer create + circular references by using itself as the locator that gets passed + to the content handler implementation. [SF bug #535474] + Tools/Demos From fdrake@users.sourceforge.net Thu Apr 4 19:43:49 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 11:43:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.337.2.4.2.14,1.337.2.4.2.15 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17210/Misc Modified Files: Tag: release22-maint NEWS Log Message: Add note about changes in xml.sax.expatreader. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.14 retrieving revision 1.337.2.4.2.15 diff -C2 -d -r1.337.2.4.2.14 -r1.337.2.4.2.15 *** NEWS 4 Apr 2002 19:29:55 -0000 1.337.2.4.2.14 --- NEWS 4 Apr 2002 19:43:47 -0000 1.337.2.4.2.15 *************** *** 11,14 **** --- 11,20 ---- could access a pointer to freed memory. + Library + + - The xml.sax.expatreader.ExpatParser class will no longer create + circular references by using itself as the locator that gets passed + to the content handler implementation. [SF bug #535474] + Windows From fdrake@users.sourceforge.net Thu Apr 4 19:45:04 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 11:45:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.146.2.10,1.146.2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17690/Misc Modified Files: Tag: release21-maint NEWS Log Message: Add note about changes in xml.sax.expatreader. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.10 retrieving revision 1.146.2.11 diff -C2 -d -r1.146.2.10 -r1.146.2.11 *** NEWS 29 Mar 2002 01:06:35 -0000 1.146.2.10 --- NEWS 4 Apr 2002 19:45:01 -0000 1.146.2.11 *************** *** 11,14 **** --- 11,20 ---- could access a pointer to freed memory. + Library + + - The xml.sax.expatreader.ExpatParser class will no longer create + circular references by using itself as the locator that gets passed + to the content handler implementation. [SF bug #535474] + What's New in Python 2.1.2 (final)? From tim_one@users.sourceforge.net Thu Apr 4 20:02:06 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 12:02:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv23687/python/PCbuild Modified Files: python20.wse Log Message: SF bug 497854: Short-cuts missing for All Users Fix Windows-specific install glitch. Tested on Win2K, but I can't test on XP. Already checked in to the release22-maint branch. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** python20.wse 13 Feb 2002 23:56:46 -0000 1.100 --- python20.wse 4 Apr 2002 20:02:04 -0000 1.101 *************** *** 1513,1524 **** Flags=00000100 end - item: Set Variable - Variable=CGROUP_SAVE - Value=%GROUP% - end - item: Set Variable - Variable=GROUP - Value=%GROUPDIR%\%GROUP% - end item: Else Statement end --- 1513,1516 ---- *************** *** 1557,1567 **** item: Remark end item: If/While Statement Variable=TASKS Value=B ! Flags=00000011 end item: Set Variable Variable=GROUP end item: End Block --- 1549,1576 ---- item: Remark end + item: Set Variable + Variable=CGROUP_SAVE + Value=%GROUP% + end item: If/While Statement Variable=TASKS Value=B ! Flags=00000010 ! end ! item: If/While Statement ! Variable=DOADMIN ! Value=1 end item: Set Variable Variable=GROUP + Value=%CGROUPDIR%\%GROUP% + end + item: Else Statement + end + item: Set Variable + Variable=GROUP + Value=%GROUPDIR%\%GROUP% + end + item: End Block end item: End Block From tim_one@users.sourceforge.net Thu Apr 4 20:02:06 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 12:02:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.376,1.377 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23687/python/Misc Modified Files: NEWS Log Message: SF bug 497854: Short-cuts missing for All Users Fix Windows-specific install glitch. Tested on Win2K, but I can't test on XP. Already checked in to the release22-maint branch. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.376 retrieving revision 1.377 diff -C2 -d -r1.376 -r1.377 *** NEWS 4 Apr 2002 19:36:15 -0000 1.376 --- NEWS 4 Apr 2002 20:02:03 -0000 1.377 *************** *** 143,146 **** --- 143,149 ---- Windows + - The installer now installs Start menu shortcuts under (the local + equivalent of) "All Users" when doing an Admin install. + - file.truncate([newsize]) now works on Windows for all newsize values. It used to fail if newsize didn't fit in 32 bits, reflecting a *************** *** 152,156 **** a specific process whose pid was obtained from one of the spawn() functions, the same Python os.waitpid() code works across platforms. ! See the docs for details. - New tempfile.TemporaryFile implementation for Windows: this doesn't --- 155,161 ---- a specific process whose pid was obtained from one of the spawn() functions, the same Python os.waitpid() code works across platforms. ! See the docs for details. The docs were changed to clarify that ! spawn functions return, and waitpid requires, a process handle on ! Windows (not the same thing as a Windows process id). - New tempfile.TemporaryFile implementation for Windows: this doesn't From fdrake@users.sourceforge.net Thu Apr 4 20:09:52 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 12:09:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27498/lib Modified Files: liburllib.tex Log Message: Documentation for manual proxy configuration, by Andy Gimblett. This closes SF patch #523415. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** liburllib.tex 20 Oct 2001 04:24:09 -0000 1.40 --- liburllib.tex 4 Apr 2002 20:09:50 -0000 1.41 *************** *** 78,84 **** --- 78,92 ---- \end{verbatim} + In a Windows environment, if no proxy envvironment variables are set, + proxy settings are obtained from the registry's Internet Settings + section. + In a Macintosh environment, \function{urlopen()} will retrieve proxy information from Internet\index{Internet Config} Config. + The \function{urlopen()} function does not support explicit proxy + specification. If you need to override environmental proxy settings, + use \class{URLopener}, or a subclass such as \class{FancyURLopener}. + Proxies which require authentication for use are not currently supported; this is considered an implementation limitation. *************** *** 196,199 **** --- 204,213 ---- \method{open()} method is called. + The optional \var{proxies} parameter should be a dictionary mapping + scheme names to proxy URLs, where an empty dictionary turns proxies + off completely. Its default value is None, in which case + environmental proxy settings will be used if present, as discussed in + the definition of \function{urlopen()}, above. + Additional keyword parameters, collected in \var{x509}, are used for authentication with the \file{https:} scheme. The keywords *************** *** 360,362 **** --- 374,397 ---- >>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params) >>> print f.read() + \end{verbatim} + + The following example uses an explicitly specified HTTP proxy, + overriding environment settings: + + \begin{verbatim} + >>> import urllib + >>> proxies = {'http': 'http://proxy.example.com:8080/'} + >>> opener = urllib.FancyURLopener(proxies) + >>> f = opener.open("http://www.python.org") + >>> f.read() + \end{verbatim} + + The following example uses no proxies at all, overriding environment + settings: + + \begin{verbatim} + >>> import urllib + >>> opener = urllib.FancyURLopener({}) + >>> f = opener.open("http://www.python.org/") + >>> f.read() \end{verbatim} From fdrake@users.sourceforge.net Thu Apr 4 20:34:39 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 12:34:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3997 Modified Files: liburllib.tex Log Message: The rest of the documentation for manual proxy configuration for a basic urlopen(). This is part of SF patch #523415. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** liburllib.tex 4 Apr 2002 20:09:50 -0000 1.41 --- liburllib.tex 4 Apr 2002 20:34:36 -0000 1.42 *************** *** 19,23 **** It defines the following public functions: ! \begin{funcdesc}{urlopen}{url\optional{, data}} Open a network object denoted by a URL for reading. If the URL does not have a scheme identifier, or if it has \file{file:} as its scheme --- 19,23 ---- It defines the following public functions: ! \begin{funcdesc}{urlopen}{url\optional{, data\optional{, proxies}}} Open a network object denoted by a URL for reading. If the URL does not have a scheme identifier, or if it has \file{file:} as its scheme *************** *** 85,88 **** --- 85,105 ---- information from Internet\index{Internet Config} Config. + Alternatively, the optional \var{proxies} argument may be used to + explicitly specify proxies. It must be a dictionary mapping scheme + names to proxy URLs, where an empty dictionary causes no proxies to be + used, and \code{None} (the default value) causes environmental proxy + settings to be used as discussed above. For example: + + \begin{verbatim} + # Use http://www.someproxy.com:3128 for http proxying + proxies = proxies={'http': 'http://www.someproxy.com:3128'} + filehandle = urllib.urlopen(some_url, proxies=proxies) + # Don't use any proxies + filehandle = urllib.urlopen(some_url, proxies={}) + # Use proxies from environment - both versions are equivalent + filehandle = urllib.urlopen(some_url, proxies=None) + filehandle = urllib.urlopen(some_url) + \end{verbatim} + The \function{urlopen()} function does not support explicit proxy specification. If you need to override environmental proxy settings, *************** *** 206,210 **** The optional \var{proxies} parameter should be a dictionary mapping scheme names to proxy URLs, where an empty dictionary turns proxies ! off completely. Its default value is None, in which case environmental proxy settings will be used if present, as discussed in the definition of \function{urlopen()}, above. --- 223,227 ---- The optional \var{proxies} parameter should be a dictionary mapping scheme names to proxy URLs, where an empty dictionary turns proxies ! off completely. Its default value is \code{None}, in which case environmental proxy settings will be used if present, as discussed in the definition of \function{urlopen()}, above. *************** *** 315,319 **** return value is a tuple consisting of a local filename and either a \class{mimetools.Message} object containing the response headers (for remote ! URLs) or None (for local URLs). The caller must then open and read the contents of \var{filename}. If \var{filename} is not given and the URL refers to a local file, the input filename is returned. If the URL is --- 332,336 ---- return value is a tuple consisting of a local filename and either a \class{mimetools.Message} object containing the response headers (for remote ! URLs) or \code{None} (for local URLs). The caller must then open and read the contents of \var{filename}. If \var{filename} is not given and the URL refers to a local file, the input filename is returned. If the URL is From fdrake@users.sourceforge.net Thu Apr 4 20:41:37 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 12:41:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.141,1.142 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6623/Lib Modified Files: urllib.py Log Message: Support manual proxy configuration for simple urlopen() operations. This change is similar to the supplied patch, but does not save the opener when a proxy configuration is specified. This closes SF patch #523415. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** urllib.py 2 Apr 2002 14:38:16 -0000 1.141 --- urllib.py 4 Apr 2002 20:41:34 -0000 1.142 *************** *** 64,76 **** # Shortcut for basic usage _urlopener = None ! def urlopen(url, data=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener ! if not _urlopener: ! _urlopener = FancyURLopener() if data is None: ! return _urlopener.open(url) else: ! return _urlopener.open(url, data) def urlretrieve(url, filename=None, reporthook=None, data=None): global _urlopener --- 64,81 ---- # Shortcut for basic usage _urlopener = None ! def urlopen(url, data=None, proxies=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener ! if proxies is not None: ! opener = FancyURLopener(proxies=proxies) ! elif not _urlopener: ! opener = FancyURLopener() ! _urlopener = opener ! else: ! opener = _urlopener if data is None: ! return opener.open(url) else: ! return opener.open(url, data) def urlretrieve(url, filename=None, reporthook=None, data=None): global _urlopener From fdrake@users.sourceforge.net Thu Apr 4 20:58:04 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 12:58:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12227/lib Modified Files: liburllib.tex Log Message: Add a version annotation regarding the urlopen(proxies={...}). Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** liburllib.tex 4 Apr 2002 20:34:36 -0000 1.42 --- liburllib.tex 4 Apr 2002 20:58:02 -0000 1.43 *************** *** 108,111 **** --- 108,113 ---- Proxies which require authentication for use are not currently supported; this is considered an implementation limitation. + + \versionchanged[Added the \var{proxies} support]{2.3} \end{funcdesc} From jhylton@users.sourceforge.net Thu Apr 4 21:02:27 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 04 Apr 2002 13:02:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib asyncore.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14286 Modified Files: asyncore.py Log Message: Replace use of apply() with extended call syntax. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** asyncore.py 14 Mar 2002 23:48:18 -0000 1.30 --- asyncore.py 4 Apr 2002 21:02:24 -0000 1.31 *************** *** 320,323 **** --- 320,324 ---- def accept (self): + # XXX can return either an address pair or None try: conn, addr = self.socket.accept() *************** *** 522,529 **** def recv (self, *args): ! return apply (os.read, (self.fd,)+args) def send (self, *args): ! return apply (os.write, (self.fd,)+args) read = recv --- 523,530 ---- def recv (self, *args): ! return os.read(self.fd, *args) def send (self, *args): ! return os.write(self.fd, *args) read = recv From fdrake@users.sourceforge.net Thu Apr 4 21:39:44 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 13:39:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv conversion.xml,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv26710/tools/sgmlconv Modified Files: conversion.xml Log Message: Add support for \textgreater, \textless. Updated productionlist environment. Index: conversion.xml =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/conversion.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** conversion.xml 15 Dec 2001 22:24:06 -0000 1.25 --- conversion.xml 4 Apr 2002 21:39:42 -0000 1.26 *************** *** 691,704 **** ! ! ! - --- 691,703 ---- ! ! ! *************** *** 876,879 **** --- 875,884 ---- | + + + > + + + < From tim_one@users.sourceforge.net Thu Apr 4 21:47:51 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 13:47:51 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.60.2.1.2.4,2.60.2.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv29198/Include Modified Files: Tag: release22-maint patchlevel.h Log Message: Update patch level and Windows build number for 2.2.1 final. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.60.2.1.2.4 retrieving revision 2.60.2.1.2.5 diff -C2 -d -r2.60.2.1.2.4 -r2.60.2.1.2.5 *** patchlevel.h 25 Mar 2002 19:28:43 -0000 2.60.2.1.2.4 --- patchlevel.h 4 Apr 2002 21:47:49 -0000 2.60.2.1.2.5 *************** *** 23,31 **** #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 1 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.2.1c2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,31 ---- #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 1 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.2.1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tim_one@users.sourceforge.net Thu Apr 4 21:47:51 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 13:47:51 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.26.4.5,1.26.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv29198/PCbuild Modified Files: Tag: release22-maint BUILDno.txt Log Message: Update patch level and Windows build number for 2.2.1 final. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.26.4.5 retrieving revision 1.26.4.6 diff -C2 -d -r1.26.4.5 -r1.26.4.6 *** BUILDno.txt 25 Mar 2002 19:30:40 -0000 1.26.4.5 --- BUILDno.txt 4 Apr 2002 21:47:49 -0000 1.26.4.6 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 34 2.2.1 (final) + 9-Apr-2002 33 2.2.1c2 26-Mar-2002 From tim_one@users.sourceforge.net Thu Apr 4 21:49:10 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 13:49:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv29708/python/PCbuild Modified Files: BUILDno.txt Log Message: Record Windows build number for 2.2.1 final. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** BUILDno.txt 25 Mar 2002 19:35:58 -0000 1.34 --- BUILDno.txt 4 Apr 2002 21:49:08 -0000 1.35 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 34 2.2.1 (final) + 9-Apr-2002 33 2.2.1c2 26-Mar-2002 From tim_one@users.sourceforge.net Thu Apr 4 21:49:30 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 13:49:30 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild pythoncore.dsp,1.30.4.2,1.30.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv29816/221/PCbuild Modified Files: Tag: release22-maint pythoncore.dsp Log Message: Fiddle Windows build number for 2.2.1 final. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.30.4.2 retrieving revision 1.30.4.3 diff -C2 -d -r1.30.4.2 -r1.30.4.3 *** pythoncore.dsp 25 Mar 2002 19:30:40 -0000 1.30.4.2 --- pythoncore.dsp 4 Apr 2002 21:49:28 -0000 1.30.4.3 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=33 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=33 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=34 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=34 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From tim_one@users.sourceforge.net Thu Apr 4 21:53:09 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 13:53:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.98.4.4,1.98.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv31037/221/PCbuild Modified Files: Tag: release22-maint python20.wse Log Message: Change Windows installer strings and resources for 2.2.1 final. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.4 retrieving revision 1.98.4.5 diff -C2 -d -r1.98.4.4 -r1.98.4.5 *** python20.wse 4 Apr 2002 19:29:55 -0000 1.98.4.4 --- python20.wse 4 Apr 2002 21:53:07 -0000 1.98.4.5 *************** *** 2,6 **** item: Global Version=8.14 ! Title=Python 2.2.1 release candidate 2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=8.14 ! Title=Python 2.2.1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 19,25 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.1c2.exe Dialogs Version=8 ! Version File=2.2.1c2 Version Description=Python Programming Language Version Copyright=©2002 Python Software Foundation --- 19,25 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.1.exe Dialogs Version=8 ! Version File=2.2.1 Version Description=Python Programming Language Version Copyright=©2002 Python Software Foundation *************** *** 65,69 **** item: Set Variable Variable=PYVER_STRING ! Value=2.2.1c2 end item: Remark --- 65,69 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.2.1 end item: Remark From tim_one@users.sourceforge.net Thu Apr 4 22:56:00 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 14:56:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Demo/pdist cvslib.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/pdist In directory usw-pr-cvs1:/tmp/cvs-serv18060/python/Demo/pdist Modified Files: cvslib.py Log Message: Convert a pile of obvious "yes/no" functions to return bool. Index: cvslib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/cvslib.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cvslib.py 7 Oct 1995 19:25:25 -0000 1.10 --- cvslib.py 4 Apr 2002 22:55:57 -0000 1.11 *************** *** 290,297 **** def ignored(self, file): ! if os.path.isdir(file): return 1 for pat in self.IgnoreList: ! if fnmatch.fnmatch(file, pat): return 1 ! return 0 --- 290,297 ---- def ignored(self, file): ! if os.path.isdir(file): return True for pat in self.IgnoreList: ! if fnmatch.fnmatch(file, pat): return True ! return Falso From tim_one@users.sourceforge.net Thu Apr 4 22:56:00 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 14:56:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command build_py.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv18060/python/Lib/distutils/command Modified Files: build_py.py Log Message: Convert a pile of obvious "yes/no" functions to return bool. Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** build_py.py 1 Feb 2002 09:44:09 -0000 1.35 --- build_py.py 4 Apr 2002 22:55:58 -0000 1.36 *************** *** 191,197 **** self.warn("file %s (for module %s) not found" % (module_file, module)) ! return 0 else: ! return 1 # check_module () --- 191,197 ---- self.warn("file %s (for module %s) not found" % (module_file, module)) ! return False else: ! return True # check_module () From tim_one@users.sourceforge.net Thu Apr 4 22:56:00 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 14:56:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle EditorWindow.py,1.39,1.40 IOBinding.py,1.4,1.5 ObjectBrowser.py,1.3,1.4 PyShell.py,1.35,1.36 ReplaceDialog.py,1.4,1.5 SearchDialog.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv18060/python/Tools/idle Modified Files: EditorWindow.py IOBinding.py ObjectBrowser.py PyShell.py ReplaceDialog.py SearchDialog.py Log Message: Convert a pile of obvious "yes/no" functions to return bool. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** EditorWindow.py 23 Jan 2002 15:15:13 -0000 1.39 --- EditorWindow.py 4 Apr 2002 22:55:58 -0000 1.40 *************** *** 376,383 **** def ispythonsource(self, filename): if not filename: ! return 1 base, ext = os.path.splitext(os.path.basename(filename)) if os.path.normcase(ext) in (".py", ".pyw"): ! return 1 try: f = open(filename) --- 376,383 ---- def ispythonsource(self, filename): if not filename: ! return True base, ext = os.path.splitext(os.path.basename(filename)) if os.path.normcase(ext) in (".py", ".pyw"): ! return True try: f = open(filename) *************** *** 385,389 **** f.close() except IOError: ! return 0 return line[:2] == '#!' and string.find(line, 'python') >= 0 --- 385,389 ---- f.close() except IOError: ! return False return line[:2] == '#!' and string.find(line, 'python') >= 0 Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IOBinding.py 2 Feb 2001 20:07:46 -0000 1.4 --- IOBinding.py 4 Apr 2002 22:55:58 -0000 1.5 *************** *** 93,97 **** except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) ! return 0 self.text.delete("1.0", "end") self.set_filename(None) --- 93,97 ---- except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) ! return False self.text.delete("1.0", "end") self.set_filename(None) *************** *** 101,105 **** self.text.mark_set("insert", "1.0") self.text.see("insert") ! return 1 def maybesave(self): --- 101,105 ---- self.text.mark_set("insert", "1.0") self.text.see("insert") ! return True def maybesave(self): *************** *** 155,163 **** f.close() ## print "saved to", `filename` ! return 1 except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) ! return 0 def fixlastline(self): --- 155,163 ---- f.close() ## print "saved to", `filename` ! return True except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) ! return False def fixlastline(self): Index: ObjectBrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ObjectBrowser.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ObjectBrowser.py 2 Jan 2001 21:22:03 -0000 1.3 --- ObjectBrowser.py 4 Apr 2002 22:55:58 -0000 1.4 *************** *** 60,64 **** class InstanceTreeItem(ObjectTreeItem): def IsExpandable(self): ! return 1 def GetSubList(self): sublist = ObjectTreeItem.GetSubList(self) --- 60,64 ---- class InstanceTreeItem(ObjectTreeItem): def IsExpandable(self): ! return True def GetSubList(self): sublist = ObjectTreeItem.GetSubList(self) *************** *** 69,73 **** class ClassTreeItem(ObjectTreeItem): def IsExpandable(self): ! return 1 def GetSubList(self): sublist = ObjectTreeItem.GetSubList(self) --- 69,73 ---- class ClassTreeItem(ObjectTreeItem): def IsExpandable(self): ! return True def GetSubList(self): sublist = ObjectTreeItem.GetSubList(self) Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** PyShell.py 20 Jul 2001 18:58:42 -0000 1.35 --- PyShell.py 4 Apr 2002 22:55:58 -0000 1.36 *************** *** 440,444 **** def ispythonsource(self, filename): # Override this so EditorWindow never removes the colorizer ! return 1 def short_title(self): --- 440,444 ---- def ispythonsource(self, filename): # Override this so EditorWindow never removes the colorizer ! return True def short_title(self): *************** *** 483,487 **** def isatty(self): ! return 1 def cancel_callback(self, event): --- 483,487 ---- def isatty(self): ! return True def cancel_callback(self, event): *************** *** 686,690 **** def isatty(self): ! return 1 --- 686,690 ---- def isatty(self): ! return True Index: ReplaceDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ReplaceDialog.py 19 Sep 2000 20:51:17 -0000 1.4 --- ReplaceDialog.py 4 Apr 2002 22:55:58 -0000 1.5 *************** *** 112,121 **** def do_find(self, ok=0): if not self.engine.getprog(): ! return 0 text = self.text res = self.engine.search_text(text, None, ok) if not res: text.bell() ! return 0 line, m = res i, j = m.span() --- 112,121 ---- def do_find(self, ok=0): if not self.engine.getprog(): ! return False text = self.text res = self.engine.search_text(text, None, ok) if not res: text.bell() ! return False line, m = res i, j = m.span() *************** *** 124,133 **** self.show_hit(first, last) self.ok = 1 ! return 1 def do_replace(self): prog = self.engine.getprog() if not prog: ! return 0 text = self.text try: --- 124,133 ---- self.show_hit(first, last) self.ok = 1 ! return True def do_replace(self): prog = self.engine.getprog() if not prog: ! return False text = self.text try: *************** *** 142,146 **** m = prog.match(chars, col) if not prog: ! return 0 new = self._expand(m, self.replvar.get()) text.mark_set("insert", first) --- 142,146 ---- m = prog.match(chars, col) if not prog: ! return False new = self._expand(m, self.replvar.get()) text.mark_set("insert", first) *************** *** 153,157 **** self.show_hit(first, text.index("insert")) self.ok = 0 ! return 1 def _expand(self, m, template): --- 153,157 ---- self.show_hit(first, text.index("insert")) self.ok = 0 ! return True def _expand(self, m, template): Index: SearchDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/SearchDialog.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SearchDialog.py 28 Jan 1999 19:04:01 -0000 1.2 --- SearchDialog.py 4 Apr 2002 22:55:58 -0000 1.3 *************** *** 35,41 **** if not self.engine.getpat(): self.open(text) ! return 0 if not self.engine.getprog(): ! return 0 res = self.engine.search_text(text) if res: --- 35,41 ---- if not self.engine.getpat(): self.open(text) ! return False if not self.engine.getprog(): ! return False res = self.engine.search_text(text) if res: *************** *** 49,53 **** if selfirst == first and sellast == last: text.bell() ! return 0 except TclError: pass --- 49,53 ---- if selfirst == first and sellast == last: text.bell() ! return False except TclError: pass *************** *** 56,63 **** text.mark_set("insert", self.engine.isback() and first or last) text.see("insert") ! return 1 else: text.bell() ! return 0 def find_selection(self, text): --- 56,63 ---- text.mark_set("insert", self.engine.isback() and first or last) text.see("insert") ! return True else: text.bell() ! return False def find_selection(self, text): From tim_one@users.sourceforge.net Thu Apr 4 22:56:00 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 14:56:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cgen.py,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18060/python/Modules Modified Files: cgen.py Log Message: Convert a pile of obvious "yes/no" functions to return bool. Index: cgen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cgen.py,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** cgen.py 1 Jul 2000 00:16:13 -0000 2.15 --- cgen.py 4 Apr 2002 22:55:58 -0000 2.16 *************** *** 57,64 **** # def isnum(s): ! if not s: return 0 for c in s: ! if not c in digits: return 0 ! return 1 --- 57,64 ---- # def isnum(s): ! if not s: return False for c in s: ! if not c in digits: return False ! return True From tim_one@users.sourceforge.net Thu Apr 4 22:56:00 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 14:56:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib BaseHTTPServer.py,1.19,1.20 CGIHTTPServer.py,1.22,1.23 ConfigParser.py,1.39,1.40 SocketServer.py,1.29,1.30 asyncore.py,1.31,1.32 bdb.py,1.37,1.38 cgi.py,1.70,1.71 code.py,1.20,1.21 dospath.py,1.25,1.26 filecmp.py,1.10,1.11 getopt.py,1.16,1.17 macpath.py,1.33,1.34 mailbox.py,1.35,1.36 mhlib.py,1.28,1.29 mutex.py,1.9,1.10 ntpath.py,1.45,1.46 os.py,1.54,1.55 os2emxpath.py,1.1,1.2 posixpath.py,1.46,1.47 pydoc.py,1.60,1.61 robotparser.py,1.13,1.14 symtable.py,1.5,1.6 tabnanny.py,1.17,1.18 threading.py,1.21,1.22 webbrowser.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18060/python/Lib Modified Files: BaseHTTPServer.py CGIHTTPServer.py ConfigParser.py SocketServer.py asyncore.py bdb.py cgi.py code.py dospath.py filecmp.py getopt.py macpath.py mailbox.py mhlib.py mutex.py ntpath.py os.py os2emxpath.py posixpath.py pydoc.py robotparser.py symtable.py tabnanny.py threading.py webbrowser.py Log Message: Convert a pile of obvious "yes/no" functions to return bool. Index: BaseHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/BaseHTTPServer.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** BaseHTTPServer.py 17 Mar 2002 18:37:22 -0000 1.19 --- BaseHTTPServer.py 4 Apr 2002 22:55:58 -0000 1.20 *************** *** 223,227 **** self.headers. ! Return value is 1 for success, 0 for failure; on failure, an error is sent back. --- 223,227 ---- self.headers. ! Return True for success, False for failure; on failure, an error is sent back. *************** *** 240,249 **** if version[:5] != 'HTTP/': self.send_error(400, "Bad request version (%s)" % `version`) ! return 0 try: version_number = float(version.split('/', 1)[1]) except ValueError: self.send_error(400, "Bad request version (%s)" % `version`) ! return 0 if version_number >= 1.1 and self.protocol_version >= "HTTP/1.1": self.close_connection = 0 --- 240,249 ---- if version[:5] != 'HTTP/': self.send_error(400, "Bad request version (%s)" % `version`) ! return False try: version_number = float(version.split('/', 1)[1]) except ValueError: self.send_error(400, "Bad request version (%s)" % `version`) ! return False if version_number >= 1.1 and self.protocol_version >= "HTTP/1.1": self.close_connection = 0 *************** *** 251,255 **** self.send_error(505, "Invalid HTTP Version (%f)" % version_number) ! return 0 elif len(words) == 2: [command, path] = words --- 251,255 ---- self.send_error(505, "Invalid HTTP Version (%f)" % version_number) ! return False elif len(words) == 2: [command, path] = words *************** *** 258,267 **** self.send_error(400, "Bad HTTP/0.9 request type (%s)" % `command`) ! return 0 elif not words: ! return 0 else: self.send_error(400, "Bad request syntax (%s)" % `requestline`) ! return 0 self.command, self.path, self.request_version = command, path, version --- 258,267 ---- self.send_error(400, "Bad HTTP/0.9 request type (%s)" % `command`) ! return False elif not words: ! return False else: self.send_error(400, "Bad request syntax (%s)" % `requestline`) ! return False self.command, self.path, self.request_version = command, path, version *************** *** 284,288 **** self.protocol_version >= "HTTP/1.1"): self.close_connection = 0 ! return 1 def handle_one_request(self): --- 284,288 ---- self.protocol_version >= "HTTP/1.1"): self.close_connection = 0 ! return True def handle_one_request(self): Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CGIHTTPServer.py 23 Mar 2002 05:47:31 -0000 1.22 --- CGIHTTPServer.py 4 Apr 2002 22:55:58 -0000 1.23 *************** *** 87,92 **** if path[:i] == x and (not path[i:] or path[i] == '/'): self.cgi_info = path[:i], path[i+1:] ! return 1 ! return 0 cgi_directories = ['/cgi-bin', '/htbin'] --- 87,92 ---- if path[:i] == x and (not path[i:] or path[i] == '/'): self.cgi_info = path[:i], path[i+1:] ! return True ! return False cgi_directories = ['/cgi-bin', '/htbin'] Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** ConfigParser.py 8 Mar 2002 18:08:47 -0000 1.39 --- ConfigParser.py 4 Apr 2002 22:55:58 -0000 1.40 *************** *** 375,381 **** if self.__sections.has_key(section): del self.__sections[section] ! return 1 else: ! return 0 # --- 375,381 ---- if self.__sections.has_key(section): del self.__sections[section] ! return True else: ! return False # Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SocketServer.py 23 Oct 2001 21:42:45 -0000 1.29 --- SocketServer.py 4 Apr 2002 22:55:58 -0000 1.30 *************** *** 227,234 **** """Verify the request. May be overridden. ! Return true if we should proceed with this request. """ ! return 1 def process_request(self, request, client_address): --- 227,234 ---- """Verify the request. May be overridden. ! Return True if we should proceed with this request. """ ! return True def process_request(self, request, client_address): Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** asyncore.py 4 Apr 2002 21:02:24 -0000 1.31 --- asyncore.py 4 Apr 2002 22:55:58 -0000 1.32 *************** *** 282,286 **** def readable (self): ! return 1 if os.name == 'mac': --- 282,286 ---- def readable (self): ! return True if os.name == 'mac': *************** *** 291,295 **** else: def writable (self): ! return 1 # ================================================== --- 291,295 ---- else: def writable (self): ! return True # ================================================== Index: bdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bdb.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** bdb.py 31 Mar 2002 14:06:41 -0000 1.37 --- bdb.py 4 Apr 2002 22:55:58 -0000 1.38 *************** *** 93,112 **** def stop_here(self, frame): if self.stopframe is None: ! return 1 if frame is self.stopframe: ! return 1 while frame is not None and frame is not self.stopframe: if frame is self.botframe: ! return 1 frame = frame.f_back ! return 0 def break_here(self, frame): filename = self.canonic(frame.f_code.co_filename) if not self.breaks.has_key(filename): ! return 0 lineno = frame.f_lineno if not lineno in self.breaks[filename]: ! return 0 # flag says ok to delete temp. bp (bp, flag) = effective(filename, lineno, frame) --- 93,112 ---- def stop_here(self, frame): if self.stopframe is None: ! return True if frame is self.stopframe: ! return True while frame is not None and frame is not self.stopframe: if frame is self.botframe: ! return True frame = frame.f_back ! return False def break_here(self, frame): filename = self.canonic(frame.f_code.co_filename) if not self.breaks.has_key(filename): ! return False lineno = frame.f_lineno if not lineno in self.breaks[filename]: ! return False # flag says ok to delete temp. bp (bp, flag) = effective(filename, lineno, frame) *************** *** 115,121 **** if (flag and bp.temporary): self.do_clear(str(bp.number)) ! return 1 else: ! return 0 def do_clear(self, arg): --- 115,121 ---- if (flag and bp.temporary): self.do_clear(str(bp.number)) ! return True else: ! return False def do_clear(self, arg): Index: cgi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** cgi.py 23 Mar 2002 05:50:17 -0000 1.70 --- cgi.py 4 Apr 2002 22:55:58 -0000 1.71 *************** *** 601,606 **** raise TypeError, "not indexable" for item in self.list: ! if item.name == key: return 1 ! return 0 def __len__(self): --- 601,606 ---- raise TypeError, "not indexable" for item in self.list: ! if item.name == key: return True ! return False def __len__(self): Index: code.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/code.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** code.py 25 Mar 2002 22:04:23 -0000 1.20 --- code.py 4 Apr 2002 22:55:58 -0000 1.21 *************** *** 67,71 **** also handles run-time exceptions, except for SystemExit). ! The return value is 1 in case 2, 0 in the other cases (unless an exception is raised). The return value can be used to decide whether to use sys.ps1 or sys.ps2 to prompt the next --- 67,71 ---- also handles run-time exceptions, except for SystemExit). ! The return value is True in case 2, False in the other cases (unless an exception is raised). The return value can be used to decide whether to use sys.ps1 or sys.ps2 to prompt the next *************** *** 78,90 **** # Case 1 self.showsyntaxerror(filename) ! return 0 if code is None: # Case 2 ! return 1 # Case 3 self.runcode(code) ! return 0 def runcode(self, code): --- 78,90 ---- # Case 1 self.showsyntaxerror(filename) ! return False if code is None: # Case 2 ! return True # Case 3 self.runcode(code) ! return False def runcode(self, code): Index: dospath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dospath.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dospath.py 10 Oct 2001 04:16:20 -0000 1.25 --- dospath.py 4 Apr 2002 22:55:58 -0000 1.26 *************** *** 152,157 **** st = os.stat(path) except os.error: ! return 0 ! return 1 --- 152,157 ---- st = os.stat(path) except os.error: ! return False ! return True *************** *** 162,166 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISDIR(st[stat.ST_MODE]) --- 162,166 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISDIR(st[stat.ST_MODE]) *************** *** 172,176 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISREG(st[stat.ST_MODE]) --- 172,176 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISREG(st[stat.ST_MODE]) Index: filecmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/filecmp.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** filecmp.py 20 Jan 2001 23:34:12 -0000 1.10 --- filecmp.py 4 Apr 2002 22:55:58 -0000 1.11 *************** *** 36,40 **** Return value: ! integer -- 1 if the files are the same, 0 otherwise. This function uses a cache for past comparisons and the results, --- 36,40 ---- Return value: ! True if the files are the same, False otherwise. This function uses a cache for past comparisons and the results, *************** *** 51,59 **** s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: ! return 0 if shallow and s1 == s2: ! return 1 if s1[1] != s2[1]: ! return 0 result = _cache.get((f1, f2)) --- 51,59 ---- s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: ! return False if shallow and s1 == s2: ! return True if s1[1] != s2[1]: ! return False result = _cache.get((f1, f2)) Index: getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getopt.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** getopt.py 12 Dec 2001 06:20:34 -0000 1.16 --- getopt.py 4 Apr 2002 22:55:58 -0000 1.17 *************** *** 104,110 **** # Is there an exact match? if opt in possibilities: ! return 0, opt elif opt + '=' in possibilities: ! return 1, opt # No exact match, so better be unique. if len(possibilities) > 1: --- 104,110 ---- # Is there an exact match? if opt in possibilities: ! return False, opt elif opt + '=' in possibilities: ! return True, opt # No exact match, so better be unique. if len(possibilities) > 1: Index: macpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** macpath.py 31 Mar 2002 14:06:41 -0000 1.33 --- macpath.py 4 Apr 2002 22:55:58 -0000 1.34 *************** *** 140,150 **** def exists(s): ! """Return true if the pathname refers to an existing file or directory.""" try: st = os.stat(s) except os.error: ! return 0 ! return 1 # Return the longest prefix of all list elements. --- 140,150 ---- def exists(s): ! """Return True if the pathname refers to an existing file or directory.""" try: st = os.stat(s) except os.error: ! return False ! return True # Return the longest prefix of all list elements. Index: mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** mailbox.py 24 Mar 2002 01:38:38 -0000 1.35 --- mailbox.py 4 Apr 2002 22:55:58 -0000 1.36 *************** *** 152,156 **** def _portable_isrealfromline(self, line): ! return 1 _isrealfromline = _strict_isrealfromline --- 152,156 ---- def _portable_isrealfromline(self, line): ! return True _isrealfromline = _strict_isrealfromline Index: mhlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mhlib.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mhlib.py 17 Oct 2001 05:59:26 -0000 1.28 --- mhlib.py 4 Apr 2002 22:55:58 -0000 1.29 *************** *** 851,856 **** def contains(self, x): for lo, hi in self.pairs: ! if lo <= x <= hi: return 1 ! return 0 def append(self, x): --- 851,856 ---- def contains(self, x): for lo, hi in self.pairs: ! if lo <= x <= hi: return True ! return False def append(self, x): Index: mutex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mutex.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mutex.py 18 Feb 2001 03:30:53 -0000 1.9 --- mutex.py 4 Apr 2002 22:55:58 -0000 1.10 *************** *** 25,34 **** def testandset(self): """Atomic test-and-set -- grab the lock if it is not set, ! return true if it succeeded.""" if not self.locked: self.locked = 1 ! return 1 else: ! return 0 def lock(self, function, argument): --- 25,34 ---- def testandset(self): """Atomic test-and-set -- grab the lock if it is not set, ! return True if it succeeded.""" if not self.locked: self.locked = 1 ! return True else: ! return False def lock(self, function, argument): Index: ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** ntpath.py 17 Jan 2002 00:44:26 -0000 1.45 --- ntpath.py 4 Apr 2002 22:55:58 -0000 1.46 *************** *** 247,252 **** st = os.stat(path) except os.error: ! return 0 ! return 1 --- 247,252 ---- st = os.stat(path) except os.error: ! return False ! return True Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** os.py 15 Mar 2002 10:21:59 -0000 1.54 --- os.py 4 Apr 2002 22:55:58 -0000 1.55 *************** *** 446,452 **** try: eval(name) ! return 1 except NameError: ! return 0 # Supply spawn*() (probably only for Unix) --- 446,452 ---- try: eval(name) ! return True except NameError: ! return False # Supply spawn*() (probably only for Unix) Index: os2emxpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os2emxpath.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** os2emxpath.py 24 Feb 2002 05:32:32 -0000 1.1 --- os2emxpath.py 4 Apr 2002 22:55:58 -0000 1.2 *************** *** 206,211 **** st = os.stat(path) except os.error: ! return 0 ! return 1 --- 206,211 ---- st = os.stat(path) except os.error: ! return False ! return True Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** posixpath.py 10 Oct 2001 04:16:20 -0000 1.46 --- posixpath.py 4 Apr 2002 22:55:58 -0000 1.47 *************** *** 167,176 **** def exists(path): ! """Test whether a path exists. Returns false for broken symbolic links""" try: st = os.stat(path) except os.error: ! return 0 ! return 1 --- 167,176 ---- def exists(path): ! """Test whether a path exists. Returns False for broken symbolic links""" try: st = os.stat(path) except os.error: ! return False ! return True *************** *** 238,251 **** s2 = os.stat(join(path, '..')) except os.error: ! return 0 # It doesn't exist -- so not a mount point :-) dev1 = s1[stat.ST_DEV] dev2 = s2[stat.ST_DEV] if dev1 != dev2: ! return 1 # path/.. on a different device as path ino1 = s1[stat.ST_INO] ino2 = s2[stat.ST_INO] if ino1 == ino2: ! return 1 # path/.. is the same i-node as path ! return 0 --- 238,251 ---- s2 = os.stat(join(path, '..')) except os.error: ! return False # It doesn't exist -- so not a mount point :-) dev1 = s1[stat.ST_DEV] dev2 = s2[stat.ST_DEV] if dev1 != dev2: ! return True # path/.. on a different device as path ino1 = s1[stat.ST_INO] ino2 = s2[stat.ST_INO] if ino1 == ino2: ! return True # path/.. is the same i-node as path ! return False Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** pydoc.py 24 Mar 2002 23:11:21 -0000 1.60 --- pydoc.py 4 Apr 2002 22:55:58 -0000 1.61 *************** *** 149,153 **** for ext in ['.py', '.pyc', '.pyo']: if os.path.isfile(os.path.join(path, '__init__' + ext)): ! return 1 def synopsis(filename, cache={}): --- 149,154 ---- for ext in ['.py', '.pyc', '.pyo']: if os.path.isfile(os.path.join(path, '__init__' + ext)): ! return True ! return False def synopsis(filename, cache={}): Index: robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** robotparser.py 18 Mar 2002 10:43:18 -0000 1.13 --- robotparser.py 4 Apr 2002 22:55:58 -0000 1.14 *************** *** 135,141 **** (useragent, url)) if self.disallow_all: ! return 0 if self.allow_all: ! return 1 # search for given user agent matches # the first match counts --- 135,141 ---- (useragent, url)) if self.disallow_all: ! return False if self.allow_all: ! return True # search for given user agent matches # the first match counts *************** *** 148,152 **** return self.default_entry.allowance(url) # agent not found ==> access granted ! return 1 --- 148,152 ---- return self.default_entry.allowance(url) # agent not found ==> access granted ! return True *************** *** 196,204 **** if agent=='*': # we have the catch-all agent ! return 1 agent = agent.lower() if useragent.find(agent) != -1: ! return 1 ! return 0 def allowance(self, filename): --- 196,204 ---- if agent=='*': # we have the catch-all agent ! return True agent = agent.lower() if useragent.find(agent) != -1: ! return True ! return False def allowance(self, filename): Index: symtable.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/symtable.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** symtable.py 12 Jul 2001 22:36:02 -0000 1.5 --- symtable.py 4 Apr 2002 22:55:58 -0000 1.6 *************** *** 36,52 **** newSymbolTable = SymbolTableFactory() - def bool(x): - """Helper to force boolean result to 1 or 0""" - if x: - return 1 - return 0 - def is_free(flags): if (flags & (USE | DEF_FREE)) \ and (flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)): ! return 1 if flags & DEF_FREE_CLASS: ! return 1 ! return 0 class SymbolTable: --- 36,46 ---- newSymbolTable = SymbolTableFactory() def is_free(flags): if (flags & (USE | DEF_FREE)) \ and (flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)): ! return True if flags & DEF_FREE_CLASS: ! return True ! return False class SymbolTable: *************** *** 207,214 **** if (self.__flags & (USE | DEF_FREE)) \ and (self.__flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)): ! return 1 if self.__flags & DEF_FREE_CLASS: ! return 1 ! return 0 def is_imported(self): --- 201,208 ---- if (self.__flags & (USE | DEF_FREE)) \ and (self.__flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)): ! return True if self.__flags & DEF_FREE_CLASS: ! return True ! return False def is_imported(self): Index: tabnanny.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tabnanny.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tabnanny.py 31 Mar 2002 13:59:18 -0000 1.17 --- tabnanny.py 4 Apr 2002 22:55:58 -0000 1.18 *************** *** 197,201 **** return a ! # Return true iff self.indent_level(t) < other.indent_level(t) # for all t >= 1. # The algorithm is due to Vincent Broman. --- 197,201 ---- return a ! # Return True iff self.indent_level(t) < other.indent_level(t) # for all t >= 1. # The algorithm is due to Vincent Broman. *************** *** 212,216 **** def less(self, other): if self.n >= other.n: ! return 0 if self.is_simple and other.is_simple: return self.nt <= other.nt --- 212,216 ---- def less(self, other): if self.n >= other.n: ! return False if self.is_simple and other.is_simple: return self.nt <= other.nt *************** *** 220,225 **** for ts in range(2, n+1): if self.indent_level(ts) >= other.indent_level(ts): ! return 0 ! return 1 # return a list of tuples (ts, i1, i2) such that --- 220,225 ---- for ts in range(2, n+1): if self.indent_level(ts) >= other.indent_level(ts): ! return False ! return True # return a list of tuples (ts, i1, i2) such that Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** threading.py 19 Feb 2002 03:01:36 -0000 1.21 --- threading.py 4 Apr 2002 22:55:58 -0000 1.22 *************** *** 175,181 **** if self.__lock.acquire(0): self.__lock.release() ! return 0 else: ! return 1 def wait(self, timeout=None): --- 175,181 ---- if self.__lock.acquire(0): self.__lock.release() ! return False else: ! return True def wait(self, timeout=None): Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** webbrowser.py 15 Mar 2002 13:47:32 -0000 1.29 --- webbrowser.py 4 Apr 2002 22:55:58 -0000 1.30 *************** *** 79,91 **** def _iscommand(cmd): ! """Return true if cmd can be found on the executable search path.""" path = os.environ.get("PATH") if not path: ! return 0 for d in path.split(os.pathsep): exe = os.path.join(d, cmd) if os.path.isfile(exe): ! return 1 ! return 0 --- 79,91 ---- def _iscommand(cmd): ! """Return True if cmd can be found on the executable search path.""" path = os.environ.get("PATH") if not path: ! return False for d in path.split(os.pathsep): exe = os.path.join(d, cmd) if os.path.isfile(exe): ! return True ! return False From fdrake@users.sourceforge.net Thu Apr 4 22:57:00 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 04 Apr 2002 14:57:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/html style.css,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv18601/html Modified Files: style.css Log Message: Minor style change. Index: style.css =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/style.css,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** style.css 26 Nov 2001 21:46:53 -0000 1.19 --- style.css 4 Apr 2002 22:56:57 -0000 1.20 *************** *** 40,43 **** --- 40,44 ---- a:active { color: #ff0000; } + a:hover { background-color: #bbeeff; } a:visited { color: #551a8b; } a:link { color: #0000bb; } *************** *** 73,76 **** --- 74,78 ---- padding: 0.05in; } .productions { background-color: #bbeeff; } + .productions a:hover { background-color: #99ccff; } .productions table { vertical-align: baseline; } .grammar-footer { padding: 0.05in; From gvanrossum@users.sourceforge.net Thu Apr 4 23:03:49 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 15:03:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Demo/pdist cvslib.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/pdist In directory usw-pr-cvs1:/tmp/cvs-serv20802 Modified Files: cvslib.py Log Message: Fix a typo in Tim's fix. Index: cvslib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/cvslib.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** cvslib.py 4 Apr 2002 22:55:57 -0000 1.11 --- cvslib.py 4 Apr 2002 23:03:47 -0000 1.12 *************** *** 293,297 **** for pat in self.IgnoreList: if fnmatch.fnmatch(file, pat): return True ! return Falso --- 293,297 ---- for pat in self.IgnoreList: if fnmatch.fnmatch(file, pat): return True ! return False From tim_one@users.sourceforge.net Thu Apr 4 23:17:33 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 15:17:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command build_py.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv23987 Modified Files: build_py.py Log Message: Revert 0/1 -> False/True change; I didn't intend to muck w/ distutils. Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** build_py.py 4 Apr 2002 22:55:58 -0000 1.36 --- build_py.py 4 Apr 2002 23:17:31 -0000 1.37 *************** *** 191,197 **** self.warn("file %s (for module %s) not found" % (module_file, module)) ! return False else: ! return True # check_module () --- 191,197 ---- self.warn("file %s (for module %s) not found" % (module_file, module)) ! return 0 else: ! return 1 # check_module () From gvanrossum@users.sourceforge.net Thu Apr 4 23:44:49 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 04 Apr 2002 15:44:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.135,2.136 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30081 Modified Files: typeobject.c Log Message: A much revised version of SF patch 514662, by Naofumi Honda. This speeds up __getitem__ and __setitem__ in subclasses of built-in sequences. It's much revised because I took the opportunity to refactor the code somewhat (moving a large section of duplicated code to a helper function) and added comments to a series of functions. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.135 retrieving revision 2.136 diff -C2 -d -r2.135 -r2.136 *** typeobject.c 4 Apr 2002 17:50:54 -0000 2.135 --- typeobject.c 4 Apr 2002 23:44:47 -0000 2.136 *************** *** 3240,3246 **** - slot_tp_getattr_hook() is used when a __getattr__ hook is present. ! The code in update_slot() and fixup_slot_dispatchers() always installs ! slot_tp_getattr_hook(); this detects the absence of __getattr__ and then ! installs the simpler slot if necessary. */ static PyObject * --- 3240,3246 ---- - slot_tp_getattr_hook() is used when a __getattr__ hook is present. ! The code in update_one_slot() always installs slot_tp_getattr_hook(); this ! detects the absence of __getattr__ and then installs the simpler slot if ! necessary. */ static PyObject * *************** *** 3493,3497 **** mappings. Note that multiple names may map to the same slot (e.g. __eq__, __ne__ etc. all map to tp_richcompare) and one name may map to multiple ! slots (e.g. __str__ affects tp_str as well as tp_repr). */ typedef struct wrapperbase slotdef; --- 3493,3499 ---- mappings. Note that multiple names may map to the same slot (e.g. __eq__, __ne__ etc. all map to tp_richcompare) and one name may map to multiple ! slots (e.g. __str__ affects tp_str as well as tp_repr). The table is ! terminated with an all-zero entry. (This table is further initialized and ! sorted in init_slotdefs() below.) */ typedef struct wrapperbase slotdef; *************** *** 3714,3717 **** --- 3716,3724 ---- }; + /* Given a type pointer and an offset gotten from a slotdef entry, return a + pointer to the actual slot. This is not quite the same as simply adding + the offset to the type pointer, since it takes care to indirect through the + proper indirection pointer (as_buffer, etc.); it returns NULL if the + indirection pointer is NULL. */ static void ** slotptr(PyTypeObject *type, int offset) *************** *** 3741,3747 **** --- 3748,3853 ---- } + /* Length of array of slotdef pointers used to store slots with the + same __name__. There should be at most MAX_EQUIV-1 slotdef entries with + the same __name__, for any __name__. Since that's a static property, it is + appropriate to declare fixed-size arrays for this. */ + #define MAX_EQUIV 10 + + /* Return a slot pointer for a given name, but ONLY if the attribute has + exactly one slot function. The name must be an interned string. */ + static void ** + resolve_slotdups(PyTypeObject *type, PyObject *name) + { + /* XXX Maybe this could be optimized more -- but is it worth it? */ + + /* pname and ptrs act as a little cache */ + static PyObject *pname; + static slotdef *ptrs[MAX_EQUIV]; + slotdef *p, **pp; + void **res, **ptr; + + if (pname != name) { + /* Collect all slotdefs that match name into ptrs. */ + pname = name; + pp = ptrs; + for (p = slotdefs; p->name_strobj; p++) { + if (p->name_strobj == name) + *pp++ = p; + } + *pp = NULL; + } + + /* Look in all matching slots of the type; if exactly one of these has + a filled-in slot, return its value. Otherwise return NULL. */ + res = NULL; + for (pp = ptrs; *pp; pp++) { + ptr = slotptr(type, (*pp)->offset); + if (ptr == NULL || *ptr == NULL) + continue; + if (res != NULL) + return NULL; + res = ptr; + } + return res; + } + + /* Common code for update_these_slots() and fixup_slot_dispatchers(). This + does some incredibly complex thinking and then sticks something into the + slot. (It sees if the adjacent slotdefs for the same slot have conflicting + interests, and then stores a generic wrapper or a specific function into + the slot.) Return a pointer to the next slotdef with a different offset, + because that's convenient for fixup_slot_dispatchers(). */ + static slotdef * + update_one_slot(PyTypeObject *type, slotdef *p) + { + PyObject *descr; + PyWrapperDescrObject *d; + void *generic = NULL, *specific = NULL; + int use_generic = 0; + int offset = p->offset; + void **ptr = slotptr(type, offset); + + if (ptr == NULL) { + do { + ++p; + } while (p->offset == offset); + return p; + } + do { + descr = _PyType_Lookup(type, p->name_strobj); + if (descr == NULL) + continue; + if (descr->ob_type == &PyWrapperDescr_Type) { + void **tptr = resolve_slotdups(type, p->name_strobj); + if (tptr == NULL || tptr == ptr) + generic = p->function; + d = (PyWrapperDescrObject *)descr; + if (d->d_base->wrapper == p->wrapper && + PyType_IsSubtype(type, d->d_type)) + { + if (specific == NULL || + specific == d->d_wrapped) + specific = d->d_wrapped; + else + use_generic = 1; + } + } + else { + use_generic = 1; + generic = p->function; + } + } while ((++p)->offset == offset); + if (specific && !use_generic) + *ptr = specific; + else + *ptr = generic; + return p; + } + staticforward int recurse_down_subclasses(PyTypeObject *type, slotdef **pp, PyObject *name); + /* In the type, update the slots whose slotdefs are gathered in the pp0 array, + and then do the same for all this type's subtypes. */ static int update_these_slots(PyTypeObject *type, slotdef **pp0, PyObject *name) *************** *** 3749,3789 **** slotdef **pp; ! for (pp = pp0; *pp; pp++) { ! slotdef *p = *pp; ! PyObject *descr; ! PyWrapperDescrObject *d; ! void *generic = NULL, *specific = NULL; ! int use_generic = 0; ! int offset = p->offset; ! void **ptr = slotptr(type, offset); ! if (ptr == NULL) ! continue; ! do { ! descr = _PyType_Lookup(type, p->name_strobj); ! if (descr == NULL) ! continue; ! generic = p->function; ! if (descr->ob_type == &PyWrapperDescr_Type) { ! d = (PyWrapperDescrObject *)descr; ! if (d->d_base->wrapper == p->wrapper && ! PyType_IsSubtype(type, d->d_type)) { ! if (specific == NULL || ! specific == d->d_wrapped) ! specific = d->d_wrapped; ! else ! use_generic = 1; ! } ! } ! else ! use_generic = 1; ! } while ((++p)->offset == offset); ! if (specific && !use_generic) ! *ptr = specific; ! else ! *ptr = generic; ! } return recurse_down_subclasses(type, pp0, name); } static int recurse_down_subclasses(PyTypeObject *type, slotdef **pp, PyObject *name) --- 3855,3865 ---- slotdef **pp; ! for (pp = pp0; *pp; pp++) ! update_one_slot(type, *pp); return recurse_down_subclasses(type, pp0, name); } + /* Update the slots whose slotdefs are gathered in the pp array in all (direct + or indirect) subclasses of type. */ static int recurse_down_subclasses(PyTypeObject *type, slotdef **pp, PyObject *name) *************** *** 3816,3819 **** --- 3892,3897 ---- } + /* Comparison function for qsort() to compare slotdefs by their offset, and + for equal offset by their address (to force a stable sort). */ static int slotdef_cmp(const void *aa, const void *bb) *************** *** 3827,3830 **** --- 3905,3910 ---- } + /* Initialize the slotdefs table by adding interned string objects for the + names and sorting the entries. */ static void init_slotdefs(void) *************** *** 3838,3842 **** p->name_strobj = PyString_InternFromString(p->name); if (!p->name_strobj) ! Py_FatalError("XXX ouch"); } qsort((void *)slotdefs, (size_t)(p-slotdefs), sizeof(slotdef), --- 3918,3922 ---- p->name_strobj = PyString_InternFromString(p->name); if (!p->name_strobj) ! Py_FatalError("Out of memory interning slotdef names"); } qsort((void *)slotdefs, (size_t)(p-slotdefs), sizeof(slotdef), *************** *** 3845,3852 **** } static int update_slot(PyTypeObject *type, PyObject *name) { ! slotdef *ptrs[10]; slotdef *p; slotdef **pp; --- 3925,3933 ---- } + /* Update the slots after assignment to a class (type) attribute. */ static int update_slot(PyTypeObject *type, PyObject *name) { ! slotdef *ptrs[MAX_EQUIV]; slotdef *p; slotdef **pp; *************** *** 3868,3939 **** *pp = p; } return update_these_slots(type, ptrs, name); } static void fixup_slot_dispatchers(PyTypeObject *type) { slotdef *p; - PyObject *mro, *descr; - PyWrapperDescrObject *d; - int i, n, offset; - void **ptr; - void *generic, *specific; - int use_generic; init_slotdefs(); ! mro = type->tp_mro; ! assert(PyTuple_Check(mro)); ! n = PyTuple_GET_SIZE(mro); ! for (p = slotdefs; p->name; ) { ! offset = p->offset; ! ptr = slotptr(type, offset); ! if (!ptr) { ! do { ! ++p; ! } while (p->offset == offset); ! continue; ! } ! generic = specific = NULL; ! use_generic = 0; ! do { ! descr = NULL; ! for (i = 0; i < n; i++) { ! PyObject *b = PyTuple_GET_ITEM(mro, i); ! PyObject *dict = NULL; ! if (PyType_Check(b)) ! dict = ((PyTypeObject *)b)->tp_dict; ! else if (PyClass_Check(b)) ! dict = ((PyClassObject *)b)->cl_dict; ! if (dict != NULL) { ! descr = PyDict_GetItem( ! dict, p->name_strobj); ! if (descr != NULL) ! break; ! } ! } ! if (descr == NULL) ! continue; ! generic = p->function; ! if (descr->ob_type == &PyWrapperDescr_Type) { ! d = (PyWrapperDescrObject *)descr; ! if (d->d_base->wrapper == p->wrapper && ! PyType_IsSubtype(type, d->d_type)) ! { ! if (specific == NULL || ! specific == d->d_wrapped) ! specific = d->d_wrapped; ! else ! use_generic = 1; ! } ! } ! else ! use_generic = 1; ! } while ((++p)->offset == offset); ! if (specific && !use_generic) ! *ptr = specific; ! else ! *ptr = generic; ! } } --- 3949,3968 ---- *pp = p; } + if (ptrs[0] == NULL) + return 0; /* Not an attribute that affects any slots */ return update_these_slots(type, ptrs, name); } + /* Store the proper functions in the slot dispatches at class (type) + definition time, based upon which operations the class overrides in its + dict. */ static void fixup_slot_dispatchers(PyTypeObject *type) { slotdef *p; init_slotdefs(); ! for (p = slotdefs; p->name; ) ! p = update_one_slot(type, p); } From nnorwitz@users.sourceforge.net Fri Apr 5 02:21:12 2002 From: nnorwitz@users.sourceforge.net (Neal Norwitz) Date: Thu, 04 Apr 2002 18:21:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libasyncore.tex,1.11,1.12 libcfgparser.tex,1.21,1.22 libcode.tex,1.13,1.14 libfilecmp.tex,1.6,1.7 libmutex.tex,1.5,1.6 libposixpath.tex,1.22,1.23 librobotparser.tex,1.4,1.5 libtabnanny.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31876/Doc/lib Modified Files: libasyncore.tex libcfgparser.tex libcode.tex libfilecmp.tex libmutex.tex libposixpath.tex librobotparser.tex libtabnanny.tex Log Message: Update doc to reflect Tim's changes to bool. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libasyncore.tex 31 Jan 2002 17:32:24 -0000 1.11 --- libasyncore.tex 5 Apr 2002 02:21:09 -0000 1.12 *************** *** 119,123 **** Each time through the \method{select()} loop, the set of sockets is scanned, and this method is called to see if there is any ! interest in reading. The default method simply returns \code{1}, indicating that by default, all channels will be interested. \end{methoddesc} --- 119,123 ---- Each time through the \method{select()} loop, the set of sockets is scanned, and this method is called to see if there is any ! interest in reading. The default method simply returns \code{True}, indicating that by default, all channels will be interested. \end{methoddesc} *************** *** 126,130 **** Each time through the \method{select()} loop, the set of sockets is scanned, and this method is called to see if there is any ! interest in writing. The default method simply returns \code{1}, indicating that by default, all channels will be interested. \end{methoddesc} --- 126,130 ---- Each time through the \method{select()} loop, the set of sockets is scanned, and this method is called to see if there is any ! interest in writing. The default method simply returns \code{True}, indicating that by default, all channels will be interested. \end{methoddesc} Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libcfgparser.tex 7 Dec 2001 21:35:57 -0000 1.21 --- libcfgparser.tex 5 Apr 2002 02:21:09 -0000 1.22 *************** *** 212,216 **** \begin{methoddesc}{remove_section}{section} Remove the specified \var{section} from the configuration. ! If the section in fact existed, return 1. Otherwise return 0. \end{methoddesc} --- 212,217 ---- \begin{methoddesc}{remove_section}{section} Remove the specified \var{section} from the configuration. ! If the section in fact existed, return \code{True}. ! Otherwise return \code{False}. \end{methoddesc} Index: libcode.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcode.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libcode.tex 27 Aug 2001 20:02:16 -0000 1.13 --- libcode.tex 5 Apr 2002 02:21:09 -0000 1.14 *************** *** 81,90 **** syntax traceback will be printed by calling the \method{showsyntaxerror()} method. \method{runsource()} returns ! \code{0}. \item The input is incomplete, and more input is required; \function{compile_command()} returned \code{None}. ! \method{runsource()} returns \code{1}. \item --- 81,90 ---- syntax traceback will be printed by calling the \method{showsyntaxerror()} method. \method{runsource()} returns ! \code{False}. \item The input is incomplete, and more input is required; \function{compile_command()} returned \code{None}. ! \method{runsource()} returns \code{True}. \item *************** *** 92,96 **** object. The code is executed by calling the \method{runcode()} (which also handles run-time exceptions, except for \exception{SystemExit}). ! \method{runsource()} returns \code{0}. \end{itemize} --- 92,96 ---- object. The code is executed by calling the \method{runcode()} (which also handles run-time exceptions, except for \exception{SystemExit}). ! \method{runsource()} returns \code{False}. \end{itemize} *************** *** 156,161 **** executed or invalid, the buffer is reset; otherwise, the command is incomplete, and the buffer is left as it was after the line was ! appended. The return value is \code{1} if more input is required, ! \code{0} if the line was dealt with in some way (this is the same as \method{runsource()}). \end{methoddesc} --- 156,161 ---- executed or invalid, the buffer is reset; otherwise, the command is incomplete, and the buffer is left as it was after the line was ! appended. The return value is \code{True} if more input is required, ! \code{False} if the line was dealt with in some way (this is the same as \method{runsource()}). \end{methoddesc} Index: libfilecmp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfilecmp.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libfilecmp.tex 20 Mar 2002 18:55:09 -0000 1.6 --- libfilecmp.tex 5 Apr 2002 02:21:09 -0000 1.7 *************** *** 13,18 **** \begin{funcdesc}{cmp}{f1, f2\optional{, shallow\optional{, use_statcache}}} ! Compare the files named \var{f1} and \var{f2}, returning \code{1} if ! they seem equal, \code{0} otherwise. Unless \var{shallow} is given and is false, files with identical --- 13,18 ---- \begin{funcdesc}{cmp}{f1, f2\optional{, shallow\optional{, use_statcache}}} ! Compare the files named \var{f1} and \var{f2}, returning \code{True} if ! they seem equal, \code{False} otherwise. Unless \var{shallow} is given and is false, files with identical *************** *** 52,58 **** >>> import filecmp >>> filecmp.cmp('libundoc.tex', 'libundoc.tex') ! 1 >>> filecmp.cmp('libundoc.tex', 'lib.tex') ! 0 \end{verbatim} --- 52,58 ---- >>> import filecmp >>> filecmp.cmp('libundoc.tex', 'libundoc.tex') ! True >>> filecmp.cmp('libundoc.tex', 'lib.tex') ! False \end{verbatim} Index: libmutex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmutex.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libmutex.tex 9 Jan 2001 20:54:15 -0000 1.5 --- libmutex.tex 5 Apr 2002 02:21:09 -0000 1.6 *************** *** 42,46 **** \begin{methoddesc}{testandset}{} ``Atomic'' test-and-set, grab the lock if it is not set, ! and return true, otherwise, return false. \end{methoddesc} --- 42,46 ---- \begin{methoddesc}{testandset}{} ``Atomic'' test-and-set, grab the lock if it is not set, ! and return \code{True}, otherwise, return \code{False}. \end{methoddesc} Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** libposixpath.tex 28 Nov 2001 07:26:15 -0000 1.22 --- libposixpath.tex 5 Apr 2002 02:21:09 -0000 1.23 *************** *** 43,47 **** \begin{funcdesc}{exists}{path} ! Return true if \var{path} refers to an existing path. \end{funcdesc} --- 43,47 ---- \begin{funcdesc}{exists}{path} ! Return \code{True} if \var{path} refers to an existing path. \end{funcdesc} *************** *** 89,98 **** \begin{funcdesc}{isabs}{path} ! Return true if \var{path} is an absolute pathname (begins with a slash). \end{funcdesc} \begin{funcdesc}{isfile}{path} ! Return true if \var{path} is an existing regular file. This follows symbolic links, so both \function{islink()} and \function{isfile()} can be true for the same path. --- 89,98 ---- \begin{funcdesc}{isabs}{path} ! Return \code{True} if \var{path} is an absolute pathname (begins with a slash). \end{funcdesc} \begin{funcdesc}{isfile}{path} ! Return \code{True} if \var{path} is an existing regular file. This follows symbolic links, so both \function{islink()} and \function{isfile()} can be true for the same path. *************** *** 100,104 **** \begin{funcdesc}{isdir}{path} ! Return true if \var{path} is an existing directory. This follows symbolic links, so both \function{islink()} and \function{isdir()} can be true for the same path. --- 100,104 ---- \begin{funcdesc}{isdir}{path} ! Return \code{True} if \var{path} is an existing directory. This follows symbolic links, so both \function{islink()} and \function{isdir()} can be true for the same path. *************** *** 106,115 **** \begin{funcdesc}{islink}{path} ! Return true if \var{path} refers to a directory entry that is a ! symbolic link. Always false if symbolic links are not supported. \end{funcdesc} \begin{funcdesc}{ismount}{path} ! Return true if pathname \var{path} is a \dfn{mount point}: a point in a file system where a different file system has been mounted. The function checks whether \var{path}'s parent, \file{\var{path}/..}, is --- 106,115 ---- \begin{funcdesc}{islink}{path} ! Return \code{True} if \var{path} refers to a directory entry that is a ! symbolic link. Always \code{False} if symbolic links are not supported. \end{funcdesc} \begin{funcdesc}{ismount}{path} ! Return \code{True} if pathname \var{path} is a \dfn{mount point}: a point in a file system where a different file system has been mounted. The function checks whether \var{path}'s parent, \file{\var{path}/..}, is *************** *** 150,154 **** \begin{funcdesc}{samefile}{path1, path2} ! Return true if both pathname arguments refer to the same file or directory (as indicated by device number and i-node number). Raise an exception if a \function{os.stat()} call on either pathname --- 150,154 ---- \begin{funcdesc}{samefile}{path1, path2} ! Return \code{True} if both pathname arguments refer to the same file or directory (as indicated by device number and i-node number). Raise an exception if a \function{os.stat()} call on either pathname *************** *** 158,162 **** \begin{funcdesc}{sameopenfile}{fp1, fp2} ! Return true if the file objects \var{fp1} and \var{fp2} refer to the same file. The two file objects may represent different file descriptors. --- 158,162 ---- \begin{funcdesc}{sameopenfile}{fp1, fp2} ! Return \code{True} if the file objects \var{fp1} and \var{fp2} refer to the same file. The two file objects may represent different file descriptors. *************** *** 165,169 **** \begin{funcdesc}{samestat}{stat1, stat2} ! Return true if the stat tuples \var{stat1} and \var{stat2} refer to the same file. These structures may have been returned by \function{fstat()}, \function{lstat()}, or \function{stat()}. This --- 165,169 ---- \begin{funcdesc}{samestat}{stat1, stat2} ! Return \code{True} if the stat tuples \var{stat1} and \var{stat2} refer to the same file. These structures may have been returned by \function{fstat()}, \function{lstat()}, or \function{stat()}. This Index: librobotparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librobotparser.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** librobotparser.tex 6 Nov 2001 22:14:35 -0000 1.4 --- librobotparser.tex 5 Apr 2002 02:21:09 -0000 1.5 *************** *** 36,40 **** \begin{methoddesc}{can_fetch}{useragent, url} ! Returns true if the \var{useragent} is allowed to fetch the \var{url} according to the rules contained in the parsed \file{robots.txt} file. \end{methoddesc} --- 36,40 ---- \begin{methoddesc}{can_fetch}{useragent, url} ! Returns \code{True} if the \var{useragent} is allowed to fetch the \var{url} according to the rules contained in the parsed \file{robots.txt} file. \end{methoddesc} *************** *** 61,66 **** >>> rp.read() >>> rp.can_fetch("*", "http://www.musi-cal.com/cgi-bin/search?city=San+Francisco") ! 0 >>> rp.can_fetch("*", "http://www.musi-cal.com/") ! 1 \end{verbatim} --- 61,66 ---- >>> rp.read() >>> rp.can_fetch("*", "http://www.musi-cal.com/cgi-bin/search?city=San+Francisco") ! False >>> rp.can_fetch("*", "http://www.musi-cal.com/") ! True \end{verbatim} Index: libtabnanny.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtabnanny.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libtabnanny.tex 20 Oct 2001 04:24:09 -0000 1.2 --- libtabnanny.tex 5 Apr 2002 02:21:09 -0000 1.3 *************** *** 30,34 **** \begin{datadesc}{verbose} Flag indicating whether to print verbose messages. ! This is set to true by the \code{-v} option if called as a script. \end{datadesc} --- 30,34 ---- \begin{datadesc}{verbose} Flag indicating whether to print verbose messages. ! This is incremented by the \code{-v} option if called as a script. \end{datadesc} From tim_one@users.sourceforge.net Fri Apr 5 04:32:31 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 20:32:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24020/python/Objects Modified Files: obmalloc.c Log Message: Widespread, but mostly in _PyMalloc_Malloc: optimize away all expensive runtime multiplications and divisions, via the scheme developed with Vladimir Marangozov on Python-Dev. The pool_header struct loses its capacity member, but gains nextoffset and maxnextoffset members; this still leaves it at 32 bytes on a 32-bit box (it has to be padded to a multiple of 8 bytes). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** obmalloc.c 4 Apr 2002 05:08:31 -0000 2.29 --- obmalloc.c 5 Apr 2002 04:32:29 -0000 2.30 *************** *** 117,120 **** --- 117,123 ---- #define ALIGNMENT_MASK (ALIGNMENT - 1) + /* Return the number of bytes in size class I, as a uint. */ + #define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT) + /* * Max size threshold below which malloc requests are considered to be *************** *** 226,230 **** typedef uchar block; ! /* Pool for small blocks */ struct pool_header { union { block *_padding; --- 229,233 ---- typedef uchar block; ! /* Pool for small blocks. */ struct pool_header { union { block *_padding; *************** *** 235,239 **** uint arenaindex; /* index into arenas of base adr */ uint szidx; /* block size class index */ ! uint capacity; /* pool capacity in # of blocks */ }; --- 238,243 ---- uint arenaindex; /* index into arenas of base adr */ uint szidx; /* block size class index */ ! uint nextoffset; /* bytes to virgin block */ ! uint maxnextoffset; /* largest valid nextoffset */ }; *************** *** 247,252 **** /* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ ! #define POOL_ADDR(P) \ ! ((poolp)((uptr)(P) & ~(uptr)POOL_SIZE_MASK)) /*==========================================================================*/ --- 251,259 ---- /* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ ! #define POOL_ADDR(P) ((poolp)((uptr)(P) & ~(uptr)POOL_SIZE_MASK)) ! ! /* Return total number of blocks in poolp P, as a uint. */ ! #define NUMBLOCKS(P) \ ! ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE((P)->szidx)) /*==========================================================================*/ *************** *** 300,311 **** an empty list in usedpools[], it takes the first pool off of freepools. If the size class needed happens to be the same as the size class the pool ! last had, some expensive initialization can be skipped (including an ! integer division -- XXX since the value ! ! pool->capacity = (POOL_SIZE - POOL_OVERHEAD) / size; ! ! is invariant across all pools of a given size class, it may make more ! sense to compute those at compile-time into a const vector indexed by ! size class, and lose the pool->capacity member and the runtime divisions). --- 307,311 ---- an empty list in usedpools[], it takes the first pool off of freepools. If the size class needed happens to be the same as the size class the pool ! last had, some pool initialization can be skipped. *************** *** 316,331 **** block is freed, it's inserted at the front of its pool's freeblock list. Note that the available blocks in a pool are *not* linked all together when a pool ! is initialized. Instead only "the first" (lowest address) block is set up, ! setting pool->freeblock to NULL. This is consistent with that pymalloc ! strives at all levels (arena, pool, and block) never to touch a piece of ! memory until it's actually needed. So long as a pool is in the used state, ! we're certain there *is* a block available for allocating. If pool->freeblock ! is NULL then, that means we simply haven't yet gotten to one of the higher- ! address blocks. The address of "the next" available block can be computed ! then from pool->ref.count (the number of currently allocated blocks). This ! computation can be expensive, because it requires an integer multiply. ! However, so long as the pool's size class doesn't change, it's a one-time cost ! for that block; the computation could be made cheaper via adding a highwater ! pointer to the pool_header, but the tradeoff is murky. --- 316,333 ---- block is freed, it's inserted at the front of its pool's freeblock list. Note that the available blocks in a pool are *not* linked all together when a pool ! is initialized. Instead only "the first two" (lowest addresses) blocks are ! set up, returning the first such block, and setting pool->freeblock to a ! one-block list holding the second such block. This is consistent with that ! pymalloc strives at all levels (arena, pool, and block) never to touch a piece ! of memory until it's actually needed. ! ! So long as a pool is in the used state, we're certain there *is* a block ! available for allocating. If pool->freeblock is NULL then, that means we ! simply haven't yet gotten to one of the higher-address blocks. The offset ! from the pool_header to the start of "the next" virgin block is stored in ! the pool_header nextoffset member, and the largest value of nextoffset that ! makes sense is stored in the maxnextoffset member when a pool is initialized. ! All the blocks in a pool have been passed out at least when and only when ! nextoffset > maxnextoffset. *************** *** 597,609 **** * Reached the end of the free list, try to extend it */ ! if (pool->ref.count < pool->capacity) { /* * There is room for another block */ ! size++; ! size <<= ALIGNMENT_SHIFT; /* block size */ ! pool->freeblock = (block *)pool + \ ! POOL_OVERHEAD + \ ! pool->ref.count * size; *(block **)(pool->freeblock) = NULL; UNLOCK(); --- 599,609 ---- * Reached the end of the free list, try to extend it */ ! if (pool->nextoffset <= pool->maxnextoffset) { /* * There is room for another block */ ! pool->freeblock = (block *)pool + ! pool->nextoffset; ! pool->nextoffset += INDEX2SIZE(size); *(block **)(pool->freeblock) = NULL; UNLOCK(); *************** *** 651,664 **** } /* ! * Initialize the pool header and free list ! * then return the first block. */ pool->szidx = size; ! size++; ! size <<= ALIGNMENT_SHIFT; /* block size */ bp = (block *)pool + POOL_OVERHEAD; pool->freeblock = bp + size; *(block **)(pool->freeblock) = NULL; - pool->capacity = (POOL_SIZE - POOL_OVERHEAD) / size; UNLOCK(); return (void *)bp; --- 651,665 ---- } /* ! * Initialize the pool header, set up the free list to ! * contain just the second block, and return the first ! * block. */ pool->szidx = size; ! size = INDEX2SIZE(size); bp = (block *)pool + POOL_OVERHEAD; + pool->nextoffset = POOL_OVERHEAD + (size << 1); + pool->maxnextoffset = POOL_SIZE - size; pool->freeblock = bp + size; *(block **)(pool->freeblock) = NULL; UNLOCK(); return (void *)bp; *************** *** 737,741 **** * and the pool is in a usedpools[] list. */ - assert(pool->ref.count < pool->capacity); if (--pool->ref.count != 0) { /* pool isn't empty: leave it in usedpools */ --- 738,741 ---- *************** *** 768,772 **** * blocks of the same size class. */ - assert(pool->ref.count == pool->capacity); /* else not full */ --pool->ref.count; assert(pool->ref.count > 0); /* else the pool is empty */ --- 768,771 ---- *************** *** 807,811 **** /* We're in charge of this block */ INCMINE; ! size = (pool->szidx + 1) << ALIGNMENT_SHIFT; /* block size */ if (size >= nbytes) /* Don't bother if a smaller size was requested. */ --- 806,810 ---- /* We're in charge of this block */ INCMINE; ! size = INDEX2SIZE(pool->szidx); if (size >= nbytes) /* Don't bother if a smaller size was requested. */ *************** *** 1256,1260 **** ++numpools[p->szidx]; numblocks[p->szidx] += p->ref.count; ! numfreeblocks[p->szidx] += p->capacity - p->ref.count; } } --- 1255,1259 ---- ++numpools[p->szidx]; numblocks[p->szidx] += p->ref.count; ! numfreeblocks[p->szidx] += NUMBLOCKS(p) - p->ref.count; } } *************** *** 1272,1276 **** ulong b = numblocks[i]; ulong f = numfreeblocks[i]; ! uint size = (i+1) << ALIGNMENT_SHIFT; if (p == 0) { assert(b == 0 && f == 0); --- 1271,1275 ---- ulong b = numblocks[i]; ulong f = numfreeblocks[i]; ! uint size = INDEX2SIZE(i); if (p == 0) { assert(b == 0 && f == 0); From tim_one@users.sourceforge.net Fri Apr 5 05:45:34 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 21:45:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.30,2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5988/python/Objects Modified Files: obmalloc.c Log Message: _PyMalloc_DebugDumpStats(): vastly improved the output, and it now accounts for every byte. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** obmalloc.c 5 Apr 2002 04:32:29 -0000 2.30 --- obmalloc.c 5 Apr 2002 05:45:31 -0000 2.31 *************** *** 253,259 **** #define POOL_ADDR(P) ((poolp)((uptr)(P) & ~(uptr)POOL_SIZE_MASK)) ! /* Return total number of blocks in poolp P, as a uint. */ ! #define NUMBLOCKS(P) \ ! ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE((P)->szidx)) /*==========================================================================*/ --- 253,258 ---- #define POOL_ADDR(P) ((poolp)((uptr)(P) & ~(uptr)POOL_SIZE_MASK)) ! /* Return total number of blocks in pool of size index I, as a uint. */ ! #define NUMBLOCKS(I) ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) /*==========================================================================*/ *************** *** 1196,1199 **** --- 1195,1211 ---- } + static ulong + printone(const char* msg, ulong value) + { + const size_t len = strlen(msg); + size_t i; + + fputs(msg, stderr); + for (i = len; i < 40; ++i) + fputc(' ', stderr); + fprintf(stderr, "= %15lu\n", value); + return value; + } + /* Print summary info to stderr about the state of pymalloc's structures. */ void *************** *** 1202,1217 **** uint i; const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT; ! uint numfreepools = 0; ! /* # of pools per class index */ ulong numpools[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; - /* # of allocated blocks per class index */ ulong numblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; - /* # of free blocks per class index */ ulong numfreeblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; ! ulong grandtotal; /* total # of allocated bytes */ ! ulong freegrandtotal; /* total # of available bytes in used pools */ - fprintf(stderr, "%u arenas * %d bytes/arena = %lu total bytes.\n", - narenas, ARENA_SIZE, narenas * (ulong)ARENA_SIZE); fprintf(stderr, "Small block threshold = %d, in %u size classes.\n", SMALL_REQUEST_THRESHOLD, numclasses); --- 1214,1240 ---- uint i; const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT; ! /* # of pools, allocated blocks, and free blocks per class index */ ulong numpools[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; ulong numblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; ulong numfreeblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; ! /* total # of allocated bytes in used and full pools */ ! ulong allocated_bytes = 0; ! /* total # of available bytes in used pools */ ! ulong available_bytes = 0; ! /* # of free pools + pools not yet carved out of current arena */ ! uint numfreepools = 0; ! /* # of bytes for arena alignment padding */ ! uint arena_alignment = 0; ! /* # of bytes in used and full pools used for pool_headers */ ! ulong pool_header_bytes = 0; ! /* # of bytes in used and full pools wasted due to quantization, ! * i.e. the necessarily leftover space at the ends of used and ! * full pools. ! */ ! ulong quantization = 0; ! /* running total -- should equal narenas * ARENA_SIZE */ ! ulong total; ! char buf[128]; fprintf(stderr, "Small block threshold = %d, in %u size classes.\n", SMALL_REQUEST_THRESHOLD, numclasses); *************** *** 1235,1238 **** --- 1258,1262 ---- if (base & (uptr)POOL_SIZE_MASK) { --poolsinarena; + arena_alignment += POOL_SIZE; base &= ~(uptr)POOL_SIZE_MASK; base += POOL_SIZE; *************** *** 1255,1270 **** ++numpools[p->szidx]; numblocks[p->szidx] += p->ref.count; ! numfreeblocks[p->szidx] += NUMBLOCKS(p) - p->ref.count; } } fputc('\n', stderr); - fprintf(stderr, "Number of unused pools: %u\n", numfreepools); - fputc('\n', stderr); fputs("class num bytes num pools blocks in use avail blocks\n" "----- --------- --------- ------------- ------------\n", stderr); - grandtotal = freegrandtotal = 0; for (i = 0; i < numclasses; ++i) { ulong p = numpools[i]; --- 1279,1292 ---- ++numpools[p->szidx]; numblocks[p->szidx] += p->ref.count; ! numfreeblocks[p->szidx] += NUMBLOCKS(p->szidx) - ! p->ref.count; } } fputc('\n', stderr); fputs("class num bytes num pools blocks in use avail blocks\n" "----- --------- --------- ------------- ------------\n", stderr); for (i = 0; i < numclasses; ++i) { ulong p = numpools[i]; *************** *** 1278,1289 **** fprintf(stderr, "%5u %11u %11lu %15lu %13lu\n", i, size, p, b, f); ! grandtotal += b * size; ! freegrandtotal += f * size; } fputc('\n', stderr); ! fprintf(stderr, "Total bytes in allocated blocks: %lu\n", ! grandtotal); ! fprintf(stderr, "Total free bytes in used pools: %lu\n", ! freegrandtotal); } --- 1300,1326 ---- fprintf(stderr, "%5u %11u %11lu %15lu %13lu\n", i, size, p, b, f); ! allocated_bytes += b * size; ! available_bytes += f * size; ! pool_header_bytes += p * POOL_OVERHEAD; ! quantization += p * ((POOL_SIZE - POOL_OVERHEAD) % size); } fputc('\n', stderr); ! ! PyOS_snprintf(buf, sizeof(buf), ! "%u arenas * %d bytes/arena", narenas, ARENA_SIZE); ! (void)printone(buf, (ulong)narenas * ARENA_SIZE); ! ! fputc('\n', stderr); ! ! PyOS_snprintf(buf, sizeof(buf), ! "%u unused pools * %d bytes", numfreepools, POOL_SIZE); ! total = printone(buf, (ulong)numfreepools * POOL_SIZE); ! ! total += printone("# bytes in allocated blocks", allocated_bytes); ! total += printone("# bytes in available blocks", available_bytes); ! total += printone("# bytes lost to pool headers", pool_header_bytes); ! total += printone("# bytes lost to quantization", quantization); ! total += printone("# bytes lost to arena alignment", arena_alignment); ! (void)printone("Total", total); } From tim_one@users.sourceforge.net Fri Apr 5 06:24:56 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 04 Apr 2002 22:24:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.31,2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14613/python/Objects Modified Files: obmalloc.c Log Message: Repair an incomprehensible comment. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** obmalloc.c 5 Apr 2002 05:45:31 -0000 2.31 --- obmalloc.c 5 Apr 2002 06:24:54 -0000 2.32 *************** *** 327,332 **** the pool_header nextoffset member, and the largest value of nextoffset that makes sense is stored in the maxnextoffset member when a pool is initialized. ! All the blocks in a pool have been passed out at least when and only when ! nextoffset > maxnextoffset. --- 327,332 ---- the pool_header nextoffset member, and the largest value of nextoffset that makes sense is stored in the maxnextoffset member when a pool is initialized. ! All the blocks in a pool have been passed out at least once when and only ! when nextoffset > maxnextoffset. From lemburg@users.sourceforge.net Fri Apr 5 12:12:03 2002 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Fri, 05 Apr 2002 04:12:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings utf_16.py,1.2,1.3 utf_16_be.py,1.1,1.2 utf_16_le.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv32431 Modified Files: utf_16.py utf_16_be.py utf_16_le.py Log Message: Fix for bug #222395: UTF-16 et al. don't handle .readline(). They now raise an NotImplementedError to hint to the truth ;-) Index: utf_16.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_16.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utf_16.py 19 Jun 2001 20:07:51 -0000 1.2 --- utf_16.py 5 Apr 2002 12:12:00 -0000 1.3 *************** *** 54,57 **** --- 54,60 ---- return codecs.StreamReader.read(self, size) + def readline(self, size=None): + raise NotImplementedError, '.readline() is not implemented for UTF-16' + ### encodings module API Index: utf_16_be.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_16_be.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utf_16_be.py 10 Mar 2000 23:17:24 -0000 1.1 --- utf_16_be.py 5 Apr 2002 12:12:00 -0000 1.2 *************** *** 22,26 **** class StreamReader(Codec,codecs.StreamReader): ! pass ### encodings module API --- 22,28 ---- class StreamReader(Codec,codecs.StreamReader): ! ! def readline(self, size=None): ! raise NotImplementedError, '.readline() is not implemented for UTF-16-BE' ### encodings module API Index: utf_16_le.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_16_le.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utf_16_le.py 10 Mar 2000 23:17:24 -0000 1.1 --- utf_16_le.py 5 Apr 2002 12:12:00 -0000 1.2 *************** *** 22,26 **** class StreamReader(Codec,codecs.StreamReader): ! pass ### encodings module API --- 22,28 ---- class StreamReader(Codec,codecs.StreamReader): ! ! def readline(self, size=None): ! raise NotImplementedError, '.readline() is not implemented for UTF-16-LE' ### encodings module API From lemburg@users.sourceforge.net Fri Apr 5 12:15:07 2002 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Fri, 05 Apr 2002 04:15:07 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.377,1.378 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2862/Misc Modified Files: NEWS Log Message: Comment about UTF-16 changes. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.377 retrieving revision 1.378 diff -C2 -d -r1.377 -r1.378 *** NEWS 4 Apr 2002 20:02:03 -0000 1.377 --- NEWS 5 Apr 2002 12:15:05 -0000 1.378 *************** *** 64,67 **** --- 64,73 ---- Library + - The UTF-16, -LE and -BE now raise a NotImplementedError + for all calls to .readline(). Previously, they used to just + produce garbage or fail with an encoding error -- UTF-16 is + a 2-byte encoding and the C lib's line reading APIs don't + work well with these. + - compileall now supports quiet operation. From mwh@users.sourceforge.net Fri Apr 5 15:28:34 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Fri, 05 Apr 2002 07:28:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/lib-tk turtle.py,1.5,1.5.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv28991 Modified Files: Tag: release22-maint turtle.py Log Message: backport loewis' checkin of revision 1.6 of turtle.py Patch #536117: Typo in turtle.py. 2.2.2 candidate. Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.5 retrieving revision 1.5.16.1 diff -C2 -d -r1.5 -r1.5.16.1 *** turtle.py 9 Aug 2001 16:42:07 -0000 1.5 --- turtle.py 5 Apr 2002 15:28:31 -0000 1.5.16.1 *************** *** 260,264 **** dy = distance * sin(self._angle*self._invradian) self._delete_turtle() ! self._arrow = _canvas.create_line(x-dx,y+dy,x,y, width=self._width, arrow="last", --- 260,264 ---- dy = distance * sin(self._angle*self._invradian) self._delete_turtle() ! self._arrow = self._canvas.create_line(x-dx,y+dy,x,y, width=self._width, arrow="last", From mwh@users.sourceforge.net Fri Apr 5 15:26:57 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Fri, 05 Apr 2002 07:26:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _localemodule.c,2.25.6.1,2.25.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv28509 Modified Files: Tag: release22-maint _localemodule.c Log Message: backport loewis' checkin of revision 2.28 of _localemodule.c Don't imply XPG4 constants from CODESET presence. Fixes #534153. 2.2.2 candiate. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.25.6.1 retrieving revision 2.25.6.2 diff -C2 -d -r2.25.6.1 -r2.25.6.2 *** _localemodule.c 16 Mar 2002 17:54:20 -0000 2.25.6.1 --- _localemodule.c 5 Apr 2002 15:26:55 -0000 2.25.6.2 *************** *** 485,491 **** LANGINFO(PM_STR), #ifdef CODESET - /* The following constants are available only with XPG4. */ LANGINFO(CODESET), LANGINFO(T_FMT_AMPM), LANGINFO(ERA), --- 485,494 ---- LANGINFO(PM_STR), + /* The following constants are available only with XPG4. AIX 3.2. only has + CODESET. */ #ifdef CODESET LANGINFO(CODESET), + #endif + #ifdef T_FMT_AMPM LANGINFO(T_FMT_AMPM), LANGINFO(ERA), From mwh@users.sourceforge.net Fri Apr 5 15:35:37 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Fri, 05 Apr 2002 07:35:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.135.6.1,1.135.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30884 Modified Files: Tag: release22-maint urllib.py Log Message: Backport both bits of Guido's fix for bug #503031. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.135.6.1 retrieving revision 1.135.6.2 diff -C2 -d -r1.135.6.1 -r1.135.6.2 *** urllib.py 18 Mar 2002 22:19:24 -0000 1.135.6.1 --- urllib.py 5 Apr 2002 15:35:35 -0000 1.135.6.2 *************** *** 1281,1285 **** for p in proxyServer.split(';'): protocol, address = p.split('=', 1) ! proxies[protocol] = '%s://%s' % (protocol, address) else: # Use one setting for all protocols --- 1281,1289 ---- for p in proxyServer.split(';'): protocol, address = p.split('=', 1) ! # See if address has a type:// prefix ! import re ! if not re.match('^([^/:]+)://', address): ! address = '%s://%s' % (protocol, address) ! proxies[protocol] = address else: # Use one setting for all protocols From mwh@users.sourceforge.net Fri Apr 5 15:38:34 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Fri, 05 Apr 2002 07:38:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_commands.py,1.3,1.3.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31914 Modified Files: Tag: release22-maint test_commands.py Log Message: backport fdrake's checkin of revision 1.4 of test_commands.py Make test_commands work on more systems. This removes much of the dependency on how a system is configured. This closes SF bug #497160 (which has the patch) and #460613. Bugfix candidate. Index: test_commands.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_commands.py,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -C2 -d -r1.3 -r1.3.8.1 *** test_commands.py 30 Oct 2001 03:17:30 -0000 1.3 --- test_commands.py 5 Apr 2002 15:38:31 -0000 1.3.8.1 *************** *** 31,45 **** def test_getstatus(self): ! # This pattern should match 'ls -ld /bin/ls' on any posix # system, however perversely configured. ! pat = r'''[l-]..x..x..x # It is executable. (May be a symlink.) \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. [^/]* # Skip the date. ! /bin/ls # and end with the name of the file. ''' ! self.assert_(re.match(pat, getstatus("/bin/ls"), re.VERBOSE)) --- 31,46 ---- def test_getstatus(self): ! # This pattern should match 'ls -ld /.' on any posix # system, however perversely configured. ! pat = r'''d......... # It is a directory. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. + \s+\d+ # It has a size. [^/]* # Skip the date. ! /. # and end with the name of the file. ''' ! self.assert_(re.match(pat, getstatus("/."), re.VERBOSE)) From mwh@users.sourceforge.net Fri Apr 5 15:39:33 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Fri, 05 Apr 2002 07:39:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.126.4.4,2.126.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32357 Modified Files: Tag: release22-maint typeobject.c Log Message: backport gvanrossum's checkin of revision 2.133 of typeobject.c SF patch 537536 by Phillip J. Eby, fix for SF bug 535444, super() broken w/ classmethods. Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.4 retrieving revision 2.126.4.5 diff -C2 -d -r2.126.4.4 -r2.126.4.5 *** typeobject.c 17 Mar 2002 18:57:07 -0000 2.126.4.4 --- typeobject.c 5 Apr 2002 15:39:31 -0000 2.126.4.5 *************** *** 3995,4002 **** if (su->obj != NULL) { PyObject *mro, *res, *tmp, *dict; descrgetfunc f; int i, n; ! mro = su->obj->ob_type->tp_mro; if (mro == NULL) n = 0; --- 3995,4005 ---- if (su->obj != NULL) { PyObject *mro, *res, *tmp, *dict; + PyTypeObject *starttype; descrgetfunc f; int i, n; ! starttype = su->obj->ob_type; ! mro = starttype->tp_mro; ! if (mro == NULL) n = 0; *************** *** 4010,4014 **** } if (i >= n && PyType_Check(su->obj)) { ! mro = ((PyTypeObject *)(su->obj))->tp_mro; if (mro == NULL) n = 0; --- 4013,4018 ---- } if (i >= n && PyType_Check(su->obj)) { ! starttype = (PyTypeObject *)(su->obj); ! mro = starttype->tp_mro; if (mro == NULL) n = 0; *************** *** 4038,4042 **** f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, res); Py_DECREF(res); res = tmp; --- 4042,4046 ---- f = res->ob_type->tp_descr_get; if (f != NULL) { ! tmp = f(res, su->obj, (PyObject *)starttype); Py_DECREF(res); res = tmp; From mwh@users.sourceforge.net Fri Apr 5 15:42:53 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Fri, 05 Apr 2002 07:42:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.113.4.9,1.113.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv843 Modified Files: Tag: release22-maint test_descr.py Log Message: backport gvanrossum's checkin of revision 1.126 of test_descr.py SF patch 537536 by Phillip J. Eby, fix for SF bug 535444, super() broken w/ classmethods. Bugfix candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.9 retrieving revision 1.113.4.10 diff -C2 -d -r1.113.4.9 -r1.113.4.10 *** test_descr.py 18 Mar 2002 03:05:36 -0000 1.113.4.9 --- test_descr.py 5 Apr 2002 15:42:50 -0000 1.113.4.10 *************** *** 1215,1218 **** --- 1215,1226 ---- vereq(ff.__get__(0)(42), (int, 42)) + # Test super() with classmethods (SF bug 535444) + veris(C.goo.im_self, C) + veris(D.goo.im_self, D) + veris(super(D,D).goo.im_self, D) + veris(super(D,d).goo.im_self, D) + vereq(super(D,D).goo(), (D,)) + vereq(super(D,d).goo(), (D,)) + def staticmethods(): if verbose: print "Testing static methods..." From loewis@users.sourceforge.net Fri Apr 5 16:50:56 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Fri, 05 Apr 2002 08:50:56 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.79,1.80 configure,1.292,1.293 configure.in,1.302,1.303 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv20323 Modified Files: Makefile.pre.in configure configure.in Log Message: Eliminate use of LIBOBJS which is an error in autoconf 2.53. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** Makefile.pre.in 3 Apr 2002 22:41:49 -0000 1.79 --- Makefile.pre.in 5 Apr 2002 16:50:52 -0000 1.80 *************** *** 149,153 **** MAINOBJ= @MAINOBJ@ ! LIBOBJS= @LIBOBJS@ DLINCLDIR= @DLINCLDIR@ DYNLOADFILE= @DYNLOADFILE@ --- 149,153 ---- MAINOBJ= @MAINOBJ@ ! THREADOBJ= @THREADOBJ@ DLINCLDIR= @DLINCLDIR@ DYNLOADFILE= @DYNLOADFILE@ *************** *** 243,247 **** Python/$(DYNLOADFILE) \ $(MACHDEP_OBJS) \ ! $(LIBOBJS) --- 243,247 ---- Python/$(DYNLOADFILE) \ $(MACHDEP_OBJS) \ ! $(THREADOBJ) Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.292 retrieving revision 1.293 diff -C2 -d -r1.292 -r1.293 *** configure 29 Mar 2002 16:28:30 -0000 1.292 --- configure 5 Apr 2002 16:50:53 -0000 1.293 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.301 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.302 [...3120 lines suppressed...] *** 7707,7711 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7710: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 7701,7705 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7704: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then *************** *** 7890,7893 **** --- 7884,7888 ---- s%@USE_THREAD_MODULE@%$USE_THREAD_MODULE%g s%@LDLAST@%$LDLAST%g + s%@THREADOBJ@%$THREADOBJ%g s%@DLINCLDIR@%$DLINCLDIR%g s%@DYNLOADFILE@%$DYNLOADFILE%g Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.302 retrieving revision 1.303 diff -C2 -d -r1.302 -r1.303 *** configure.in 29 Mar 2002 16:28:31 -0000 1.302 --- configure.in 5 Apr 2002 16:50:53 -0000 1.303 *************** *** 1051,1054 **** --- 1051,1055 ---- AC_MSG_RESULT($with_threads) + AC_SUBST(THREADOBJ) if test "$with_threads" = "no" then *************** *** 1060,1064 **** AC_DEFINE(_REENTRANT) posix_threads=yes ! LIBOBJS="$LIBOBJS thread.o" elif test "$ac_cv_kpthread" = "yes" then --- 1061,1065 ---- AC_DEFINE(_REENTRANT) posix_threads=yes ! THREADOBJ="Python/thread.o" elif test "$ac_cv_kpthread" = "yes" then *************** *** 1066,1070 **** AC_DEFINE(WITH_THREAD) posix_threads=yes ! LIBOBJS="$LIBOBJS thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" --- 1067,1071 ---- AC_DEFINE(WITH_THREAD) posix_threads=yes ! THREADOBJ="Python/thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" *************** *** 1091,1099 **** AC_DEFINE(HURD_C_THREADS) LIBS="$LIBS -lthreads" ! LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) AC_DEFINE(MACH_C_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ AC_MSG_CHECKING(for --with-pth) AC_ARG_WITH(pth, --- 1092,1100 ---- AC_DEFINE(HURD_C_THREADS) LIBS="$LIBS -lthreads" ! THREADOBJ="Python/thread.o"],[ AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) AC_DEFINE(MACH_C_THREADS) ! THREADOBJ="Python/thread.o"],[ AC_MSG_CHECKING(for --with-pth) AC_ARG_WITH(pth, *************** *** 1103,1107 **** AC_DEFINE(HAVE_PTH) LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ AC_MSG_RESULT(no) --- 1104,1108 ---- AC_DEFINE(HAVE_PTH) LIBS="-lpth $LIBS" ! THREADOBJ="Python/thread.o"],[ AC_MSG_RESULT(no) *************** *** 1119,1150 **** AC_DEFINE(WITH_THREAD) posix_threads=yes ! LIBOBJS="$LIBOBJS thread.o"],[ LIBS=$_libs AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) posix_threads=yes ! LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(BEOS_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS thread.o"],[ USE_THREAD_MODULE="#"]) ])])])])])])])])])]) --- 1120,1151 ---- AC_DEFINE(WITH_THREAD) posix_threads=yes ! THREADOBJ="Python/thread.o"],[ LIBS=$_libs AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) posix_threads=yes ! THREADOBJ="Python/thread.o"],[ AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(BEOS_THREADS) ! THREADOBJ="Python/thread.o"],[ AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lpthreads" ! THREADOBJ="Python/thread.o"], [ AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lc_r" ! THREADOBJ="Python/thread.o"], [ AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lthread" ! THREADOBJ="Python/thread.o"], [ AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lpthread" ! THREADOBJ="Python/thread.o"], [ AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) posix_threads=yes LIBS="$LIBS -lcma" ! THREADOBJ="Python/thread.o"],[ USE_THREAD_MODULE="#"]) ])])])])])])])])])]) *************** *** 1182,1186 **** AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE=""]) --- 1183,1187 ---- AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lmpc" ! THREADOBJ="Python/thread.o" USE_THREAD_MODULE=""]) *************** *** 1188,1192 **** AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE=""]) fi --- 1189,1193 ---- AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lthread" ! THREADOBJ="Python/thread.o" USE_THREAD_MODULE=""]) fi *************** *** 2086,2096 **** EOF AC_CHECK_TYPE(socklen_t, int) - - # Add Python/ prefix to LIBOBJS - libobjs=$LIBOBJS - LIBOBJS= - for obj in $libobjs; do - LIBOBJS="$LIBOBJS Python/$obj" - done #AC_MSG_CHECKING(for Modules/Setup) --- 2087,2090 ---- From fdrake@users.sourceforge.net Fri Apr 5 17:34:53 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 05 Apr 2002 09:34:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools mkackshtml,1.2,1.3 mkmodindex,1.12,1.13 support.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv32723/tools Modified Files: mkackshtml mkmodindex support.py Log Message: Add support for the "Aesop Meta Tag". Not widely used, but not a bad idea, either. Index: mkackshtml =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkackshtml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mkackshtml 12 Feb 2001 19:12:55 -0000 1.2 --- mkackshtml 5 Apr 2002 17:34:50 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- for i in range(options.columns): colnums.append(percol*i) + options.aesop_type = "information" fp = options.get_output_file() fp.write(string.rstrip(options.get_header()) + "\n") Index: mkmodindex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkmodindex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mkmodindex 22 Jun 2001 17:11:30 -0000 1.12 --- mkmodindex 5 Apr 2002 17:34:50 -0000 1.13 *************** *** 35,38 **** --- 35,40 ---- class IndexOptions(support.Options): + aesop_type = "links" + def __init__(self): support.Options.__init__(self) Index: support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/support.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** support.py 4 Feb 2002 21:15:42 -0000 1.5 --- support.py 5 Apr 2002 17:34:50 -0000 1.6 *************** *** 29,32 **** --- 29,50 ---- uptitle = "Python Documentation Index" + # The "Aesop Meta Tag" is poorly described, and may only be used + # by the Aesop search engine (www.aesop.com), but doesn't hurt. + # + # There are a number of values this may take to roughly categorize + # a page. A page should be marked according to its primary + # category. Known values are: + # 'personal' -- personal-info + # 'information' -- information + # 'interactive' -- interactive media + # 'multimedia' -- multimedia presenetation (non-sales) + # 'sales' -- sales material + # 'links' -- links to other information pages + # + # Setting the aesop_type value to one of these strings will cause + # get_header() to add the appropriate tag to the . + # + aesop_type = None + def __init__(self): self.args = [] *************** *** 97,100 **** --- 115,124 ---- repl = " %s\n" % link s = s.replace("", repl, 1) + if self.aesop_type: + meta = '\n ' + # Insert this in the middle of the head that's been + # generated so far, keeping and elements in + # neat groups: + s = s.replace(" Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv32723/perl Modified Files: l2hinit.perl Log Message: Add support for the "Aesop Meta Tag". Not widely used, but not a bad idea, either. Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** l2hinit.perl 26 Mar 2002 19:57:52 -0000 1.60 --- l2hinit.perl 5 Apr 2002 17:34:50 -0000 1.61 *************** *** 38,41 **** --- 38,43 ---- $HAVE_TABLE_OF_CONTENTS = 0; + $AESOP_META_TYPE = 'information'; + # A little painful, but lets us clean up the top level directory a little, *************** *** 640,643 **** --- 642,647 ---- , &meta_information($title) , $MY_PARTIAL_HEADER + , ($AESOP_META_TYPE eq '' ? '' + : "\n") , "\n\n"); } From gvanrossum@users.sourceforge.net Fri Apr 5 17:10:18 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 09:10:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.136,2.137 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25833 Modified Files: typeobject.c Log Message: Inherit tp_new and tp_is_gc. Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.136 retrieving revision 2.137 diff -C2 -d -r2.136 -r2.137 *** typeobject.c 4 Apr 2002 23:44:47 -0000 2.136 --- typeobject.c 5 Apr 2002 17:10:16 -0000 2.137 *************** *** 2025,2028 **** --- 2025,2030 ---- COPYSLOT(tp_alloc); COPYSLOT(tp_free); + COPYSLOT(tp_new); + COPYSLOT(tp_is_gc); } } From fdrake@users.sourceforge.net Fri Apr 5 18:09:24 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 05 Apr 2002 10:09:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv latex2esis.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv9473 Modified Files: latex2esis.py Log Message: Fix bug in command line handling, noted by Fredrik Lundh. Index: latex2esis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/latex2esis.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** latex2esis.py 30 Nov 2001 19:30:03 -0000 1.28 --- latex2esis.py 5 Apr 2002 18:09:22 -0000 1.29 *************** *** 549,553 **** ofp = sys.stdout elif len(args) == 1: ! ifp = open(args) ofp = sys.stdout elif len(args) == 2: --- 549,553 ---- ofp = sys.stdout elif len(args) == 1: ! ifp = open(args[0]) ofp = sys.stdout elif len(args) == 2: From andymac@bullseye.apana.org.au Fri Apr 5 11:48:16 2002 From: andymac@bullseye.apana.org.au (Andrew MacIntyre) Date: Fri, 5 Apr 2002 21:48:16 +1000 (est) Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.141,1.142 In-Reply-To: Message-ID: On Thu, 4 Apr 2002, Fred L. Drake wrote: > Update of /cvsroot/python/python/dist/src/Lib > In directory usw-pr-cvs1:/tmp/cvs-serv6623/Lib > > Modified Files: > urllib.py > Log Message: > Support manual proxy configuration for simple urlopen() operations. > This change is similar to the supplied patch, but does not save the opener > when a proxy configuration is specified. > This closes SF patch #523415. > > > Index: urllib.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v > retrieving revision 1.141 > retrieving revision 1.142 > diff -C2 -d -r1.141 -r1.142 > *** urllib.py 2 Apr 2002 14:38:16 -0000 1.141 > --- urllib.py 4 Apr 2002 20:41:34 -0000 1.142 > *************** > *** 64,76 **** > # Shortcut for basic usage > _urlopener = None > ! def urlopen(url, data=None): > """urlopen(url [, data]) -> open file-like object""" > global _urlopener > ! if not _urlopener: > ! _urlopener = FancyURLopener() > if data is None: > ! return _urlopener.open(url) > else: > ! return _urlopener.open(url, data) > def urlretrieve(url, filename=None, reporthook=None, data=None): > global _urlopener > --- 64,81 ---- > # Shortcut for basic usage > _urlopener = None > ! def urlopen(url, data=None, proxies=None): > """urlopen(url [, data]) -> open file-like object""" > global _urlopener > ! if proxies is not None: > ! opener = FancyURLopener(proxies=proxies) > ! elif not _urlopener: > ! opener = FancyURLopener() > ! _urlopener = opener > ! else: > ! opener = _urlopener > if data is None: > ! return opener.open(url) > else: > ! return opener.open(url, data) > def urlretrieve(url, filename=None, reporthook=None, data=None): > global _urlopener Accepting this part of #523415 wasn't what I expected. I just expected the docs only change to be applied (the most recent diff), based on my review comments to Andy. Not that I have any in-principle objection to this part of the patch. -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au | Snail: PO Box 370 andymac@pcug.org.au | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From gvanrossum@users.sourceforge.net Fri Apr 5 19:30:10 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 11:30:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8192/Modules Modified Files: cPickle.c Log Message: Implement an idea by Paul Rubin: Change pickling format for bools to use a backwards compatible encoding. This means you can pickle True or False on Python 2.3 and Python 2.2 or before will read it back as 1 or 0. The code used for pickling bools before would create pickles that could not be read in previous Python versions. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -d -r2.80 -r2.81 *** cPickle.c 4 Apr 2002 17:52:50 -0000 2.80 --- cPickle.c 5 Apr 2002 19:30:08 -0000 2.81 *************** *** 78,83 **** #define EMPTY_TUPLE ')' #define SETITEMS 'u' ! #define TRUE 'Z' ! #define FALSE 'z' --- 78,83 ---- #define EMPTY_TUPLE ')' #define SETITEMS 'u' ! #define TRUE "I01\n" ! #define FALSE "I00\n" *************** *** 937,944 **** save_bool(Picklerobject *self, PyObject *args) { ! static char buf[2] = {FALSE, TRUE}; long l = PyInt_AS_LONG((PyIntObject *)args); ! if ((*self->write_func)(self, buf + l, 1) < 0) return -1; --- 937,945 ---- save_bool(Picklerobject *self, PyObject *args) { ! static char *buf[2] = {FALSE, TRUE}; ! static char len[2] = {sizeof(FALSE)-1, sizeof(TRUE)-1}; long l = PyInt_AS_LONG((PyIntObject *)args); ! if ((*self->write_func)(self, buf[l], len[l]) < 0) return -1; *************** *** 2656,2660 **** } else { ! if (!( py_int = PyInt_FromLong(l))) goto finally; } --- 2657,2666 ---- } else { ! if (len == 3 && (l == 0 || l == 1)) { ! if (!( py_int = PyBool_FromLong(l))) goto finally; ! } ! else { ! if (!( py_int = PyInt_FromLong(l))) goto finally; ! } } *************** *** 3761,3774 **** case NONE: if (load_none(self) < 0) - break; - continue; - - case FALSE: - if (load_false(self) < 0) - break; - continue; - - case TRUE: - if (load_true(self) < 0) break; continue; --- 3767,3770 ---- From gvanrossum@users.sourceforge.net Fri Apr 5 19:30:10 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 11:30:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pickle.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8192/Lib Modified Files: pickle.py Log Message: Implement an idea by Paul Rubin: Change pickling format for bools to use a backwards compatible encoding. This means you can pickle True or False on Python 2.3 and Python 2.2 or before will read it back as 1 or 0. The code used for pickling bools before would create pickles that could not be read in previous Python versions. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** pickle.py 3 Apr 2002 22:41:50 -0000 1.59 --- pickle.py 5 Apr 2002 19:30:07 -0000 1.60 *************** *** 102,107 **** SETITEMS = 'u' BINFLOAT = 'G' ! TRUE = 'Z' ! FALSE = 'z' --- 102,107 ---- SETITEMS = 'u' BINFLOAT = 'G' ! TRUE = 'I01\n' ! FALSE = 'I00\n' *************** *** 640,657 **** dispatch[NONE] = load_none - def load_false(self): - self.append(False) - dispatch[FALSE] = load_false - - def load_true(self): - self.append(True) - dispatch[TRUE] = load_true - def load_int(self): data = self.readline() ! try: ! self.append(int(data)) ! except ValueError: ! self.append(long(data)) dispatch[INT] = load_int --- 640,655 ---- dispatch[NONE] = load_none def load_int(self): data = self.readline() ! if data == FALSE[1:]: ! val = False ! elif data == TRUE[1:]: ! val = True ! else: ! try: ! val = int(data) ! except ValueError: ! val = long(data) ! self.append(val) dispatch[INT] = load_int From gvanrossum@users.sourceforge.net Fri Apr 5 19:30:10 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 11:30:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_bool.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8192/Lib/test Modified Files: test_bool.py Log Message: Implement an idea by Paul Rubin: Change pickling format for bools to use a backwards compatible encoding. This means you can pickle True or False on Python 2.3 and Python 2.2 or before will read it back as 1 or 0. The code used for pickling bools before would create pickles that could not be read in previous Python versions. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_bool.py 3 Apr 2002 23:01:45 -0000 1.1 --- test_bool.py 5 Apr 2002 19:30:08 -0000 1.2 *************** *** 225,228 **** --- 225,234 ---- veris(cPickle.loads(pickle.dumps(False)), False) + # Test for specific backwards-compatible pickle values + vereq(pickle.dumps(True), "I01\n.") + vereq(pickle.dumps(False), "I00\n.") + vereq(cPickle.dumps(True), "I01\n.") + vereq(cPickle.dumps(False), "I00\n.") + if verbose: print "All OK" From fdrake@acm.org Fri Apr 5 19:31:00 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 5 Apr 2002 14:31:00 -0500 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.141,1.142 In-Reply-To: References: Message-ID: <15533.64372.583033.479934@grendel.zope.com> Andrew MacIntyre writes: > Accepting this part of #523415 wasn't what I expected. I just expected > the docs only change to be applied (the most recent diff), based on my > review comments to Andy. Hmm. I didn't think the comments were very clear. I don't the the doc patch without the implementation make a lot of sense. Perhaps the proxies dictionary for FancyURLopener needed more documentation and examples, but it may require some changes if the implementation changes are revoked. > Not that I have any in-principle objection to this part of the patch. Nor do I have any in-principle objection to it being revoked. ;-) I'll leave it as-is for now. In the future, it may be easiest for tracker entries that involve implementation changes to only include doc changes relevant to the impl change; general doc updates can go in separate issues since the review process is much simpler. Dependencies can be noted in the comments if needed. I guess I should add that somewhere on python.org. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake@users.sourceforge.net Fri Apr 5 19:42:58 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 05 Apr 2002 11:42:58 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0001.txt,1.30,1.31 pep-0200.txt,1.48,1.49 pep-0269.txt,1.1,1.2 pep-0276.txt,1.3,1.4 pep-0279.txt,1.9,1.10 pep-0288.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14991 Modified Files: pep-0001.txt pep-0200.txt pep-0269.txt pep-0276.txt pep-0279.txt pep-0288.txt Log Message: Update PEP URLs to prefer www.python.org. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** pep-0001.txt 2 Apr 2002 03:20:07 -0000 1.30 --- pep-0001.txt 5 Apr 2002 19:42:56 -0000 1.31 *************** *** 347,351 **** The URL for viewing PEPs on the web is ! http://python.sourceforge.net/peps/ [6] http://sourceforge.net/tracker/?group_id=5470&atid=305470 --- 347,351 ---- The URL for viewing PEPs on the web is ! http://www.python.org/peps/ [6] http://sourceforge.net/tracker/?group_id=5470&atid=305470 Index: pep-0200.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0200.txt,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** pep-0200.txt 1 Aug 2001 20:11:56 -0000 1.48 --- pep-0200.txt 5 Apr 2002 19:42:56 -0000 1.49 *************** *** 311,315 **** * Extended print statement - Barry Warsaw PEP 214 ! http://python.sourceforge.net/peps/pep-0214.html SF Patch #100970 http://sourceforge.net/patch/?func=detailpatch&patch_id=100970&group_id=5470 --- 311,315 ---- * Extended print statement - Barry Warsaw PEP 214 ! http://www.python.org/peps/pep-0214.html SF Patch #100970 http://sourceforge.net/patch/?func=detailpatch&patch_id=100970&group_id=5470 Index: pep-0269.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0269.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0269.txt 7 Sep 2001 22:35:39 -0000 1.1 --- pep-0269.txt 5 Apr 2002 19:42:56 -0000 1.2 *************** *** 158,173 **** [1] The (defunct) Python Compiler-SIG ! http://python.org/sigs/compiler-sig/ [2] Parser Module Documentation ! http://python.org/doc/current/lib/module-parser.html ! [3] Hylton, Jeremy. FIXME: Reference Compiler Document [4] Pelletier, Michel. "Python Interface Syntax", PEP-245. ! http://python.sourceforge.net/peps/pep-0245.html [5] The Python Types-SIG ! http://python.org/sigs/types-sig/ --- 158,174 ---- [1] The (defunct) Python Compiler-SIG ! http://www.python.org/sigs/compiler-sig/ [2] Parser Module Documentation ! http://www.python.org/doc/current/lib/module-parser.html ! [3] Hylton, Jeremy. ! http://www.python.org/doc/current/lib/compiler.html [4] Pelletier, Michel. "Python Interface Syntax", PEP-245. ! http://www.python.org/peps/pep-0245.html [5] The Python Types-SIG ! http://www.python.org/sigs/types-sig/ Index: pep-0276.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0276.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0276.txt 11 Mar 2002 18:54:40 -0000 1.3 --- pep-0276.txt 5 Apr 2002 19:42:56 -0000 1.4 *************** *** 390,400 **** [1] PEP 234, Iterators ! http://python.sourceforge.net/peps/pep-0234.html [2] PEP 204, Range Literals ! http://python.sourceforge.net/peps/pep-0204.html [3] PEP 212, Loop Counter Iteration ! http://python.sourceforge.net/peps/pep-0212.html --- 390,400 ---- [1] PEP 234, Iterators ! http://www.python.org/peps/pep-0234.html [2] PEP 204, Range Literals ! http://www.python.org/peps/pep-0204.html [3] PEP 212, Loop Counter Iteration ! http://www.python.org/peps/pep-0212.html Index: pep-0279.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0279.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0279.txt 1 Apr 2002 16:04:27 -0000 1.9 --- pep-0279.txt 5 Apr 2002 19:42:56 -0000 1.10 *************** *** 324,337 **** [1] PEP 255 Simple Generators ! http://python.sourceforge.net/peps/pep-0255.html [2] PEP 212 Loop Counter Iteration ! http://python.sourceforge.net/peps/pep-0212.html [3] PEP 202 List Comprehensions ! http://python.sourceforge.net/peps/pep-0202.html [4] PEP 234 Iterators ! http://python.sourceforge.net/peps/pep-0234.html [5] A pure Python simulation of every feature in this PEP is at: --- 324,337 ---- [1] PEP 255 Simple Generators ! http://www.python.org/peps/pep-0255.html [2] PEP 212 Loop Counter Iteration ! http://www.python.org/peps/pep-0212.html [3] PEP 202 List Comprehensions ! http://www.python.org/peps/pep-0202.html [4] PEP 234 Iterators ! http://www.python.org/peps/pep-0234.html [5] A pure Python simulation of every feature in this PEP is at: Index: pep-0288.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0288.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0288.txt 1 Apr 2002 16:10:19 -0000 1.1 --- pep-0288.txt 5 Apr 2002 19:42:56 -0000 1.2 *************** *** 386,393 **** [1] PEP 255 Simple Generators ! http://python.sourceforge.net/peps/pep-0255.html [2] PEP 234 Iterators ! http://python.sourceforge.net/peps/pep-0234.html [3] Dr. David Mertz's draft column for Charming Python. --- 386,393 ---- [1] PEP 255 Simple Generators ! http://www.python.org/peps/pep-0255.html [2] PEP 234 Iterators ! http://www.python.org/peps/pep-0234.html [3] Dr. David Mertz's draft column for Charming Python. *************** *** 406,410 **** [7] PEP 279 Enhanced Generators ! http://python.sourceforge.net/peps/pep-0279.html --- 406,410 ---- [7] PEP 279 Enhanced Generators ! http://www.python.org/peps/pep-0279.html From fdrake@users.sourceforge.net Fri Apr 5 19:54:22 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 05 Apr 2002 11:54:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ext windows.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv20998/ext Modified Files: windows.tex Log Message: Remove weird spacing in typeset version of the chapter head. Index: windows.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/windows.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** windows.tex 9 Mar 2002 10:06:14 -0000 1.4 --- windows.tex 5 Apr 2002 19:54:19 -0000 1.5 *************** *** 1,3 **** ! \chapter{Building C and \Cpp{} Extensions on Windows \label{building-on-windows}} --- 1,3 ---- ! \chapter{Building C and \Cpp{} Extensions on Windows% \label{building-on-windows}} From gvanrossum@users.sourceforge.net Fri Apr 5 20:57:05 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 12:57:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_bool.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7375 Modified Files: test_bool.py Log Message: Add tests for binary pickles. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_bool.py 5 Apr 2002 19:30:08 -0000 1.2 --- test_bool.py 5 Apr 2002 20:57:02 -0000 1.3 *************** *** 214,227 **** --- 214,235 ---- veris(pickle.loads(pickle.dumps(True)), True) veris(pickle.loads(pickle.dumps(False)), False) + veris(pickle.loads(pickle.dumps(True, True)), True) + veris(pickle.loads(pickle.dumps(False, True)), False) import cPickle veris(cPickle.loads(cPickle.dumps(True)), True) veris(cPickle.loads(cPickle.dumps(False)), False) + veris(cPickle.loads(cPickle.dumps(True, True)), True) + veris(cPickle.loads(cPickle.dumps(False, True)), False) veris(pickle.loads(cPickle.dumps(True)), True) veris(pickle.loads(cPickle.dumps(False)), False) + veris(pickle.loads(cPickle.dumps(True, True)), True) + veris(pickle.loads(cPickle.dumps(False, True)), False) veris(cPickle.loads(pickle.dumps(True)), True) veris(cPickle.loads(pickle.dumps(False)), False) + veris(cPickle.loads(pickle.dumps(True, True)), True) + veris(cPickle.loads(pickle.dumps(False, True)), False) # Test for specific backwards-compatible pickle values *************** *** 230,233 **** --- 238,245 ---- vereq(cPickle.dumps(True), "I01\n.") vereq(cPickle.dumps(False), "I00\n.") + vereq(pickle.dumps(True, True), "I01\n.") + vereq(pickle.dumps(False, True), "I00\n.") + vereq(cPickle.dumps(True, True), "I01\n.") + vereq(cPickle.dumps(False, True), "I00\n.") if verbose: From gvanrossum@users.sourceforge.net Fri Apr 5 22:04:30 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 14:04:30 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.137,2.138 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25063 Modified Files: typeobject.c Log Message: Don't inherit tp_new! This is a retraction of half of the previous checkin. And since that one was, this one is also a: Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.137 retrieving revision 2.138 diff -C2 -d -r2.137 -r2.138 *** typeobject.c 5 Apr 2002 17:10:16 -0000 2.137 --- typeobject.c 5 Apr 2002 22:04:18 -0000 2.138 *************** *** 2025,2029 **** COPYSLOT(tp_alloc); COPYSLOT(tp_free); - COPYSLOT(tp_new); COPYSLOT(tp_is_gc); } --- 2025,2028 ---- From gvanrossum@users.sourceforge.net Fri Apr 5 22:29:45 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 14:29:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.126.4.5,2.126.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32338 Modified Files: Tag: release22-maint typeobject.c Log Message: Backport half a patch from the trunk. This inherits tp_is_gc from a base class. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.5 retrieving revision 2.126.4.6 diff -C2 -d -r2.126.4.5 -r2.126.4.6 *** typeobject.c 5 Apr 2002 15:39:31 -0000 2.126.4.5 --- typeobject.c 5 Apr 2002 22:29:43 -0000 2.126.4.6 *************** *** 1981,1984 **** --- 1981,1985 ---- COPYSLOT(tp_alloc); COPYSLOT(tp_free); + COPYSLOT(tp_is_gc); } } From gvanrossum@users.sourceforge.net Fri Apr 5 22:32:25 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 14:32:25 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.337.2.4.2.15,1.337.2.4.2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv503 Modified Files: Tag: release22-maint NEWS Log Message: Backport half a patch from the trunk. This inherits tp_is_gc from a base class. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.15 retrieving revision 1.337.2.4.2.16 diff -C2 -d -r1.337.2.4.2.15 -r1.337.2.4.2.16 *** NEWS 4 Apr 2002 19:43:47 -0000 1.337.2.4.2.15 --- NEWS 5 Apr 2002 22:32:23 -0000 1.337.2.4.2.16 *************** *** 17,20 **** --- 17,24 ---- to the content handler implementation. [SF bug #535474] + C API + + - PyType_Ready() accidentally did not inherit tp_is_gc; now it does. + Windows From gvanrossum@users.sourceforge.net Fri Apr 5 22:53:18 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 14:53:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.337.2.4.2.16,1.337.2.4.2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5632 Modified Files: Tag: release22-maint NEWS Log Message: Some more news. (There's also a fix to _localemodule.c that I don't dare describe, and of course lots of jiggling of the docs and the Windows installer metadata.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.16 retrieving revision 1.337.2.4.2.17 diff -C2 -d -r1.337.2.4.2.16 -r1.337.2.4.2.17 *** NEWS 5 Apr 2002 22:32:23 -0000 1.337.2.4.2.16 --- NEWS 5 Apr 2002 22:53:16 -0000 1.337.2.4.2.17 *************** *** 5,8 **** --- 5,10 ---- Core + - Fixed super() to work correctly with class methods. [SF bug #535444] + - Fixed two bugs reported as SF #535905: under certain conditions, deallocating a deeply nested structure could cause a segfault in the *************** *** 22,25 **** --- 24,29 ---- Windows + + - Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031] - The installer now installs Start menu shortcuts under (the local From fdrake@users.sourceforge.net Fri Apr 5 23:01:16 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 05 Apr 2002 15:01:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api utilities.tex,1.3,1.4 newtypes.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv7515/api Modified Files: utilities.tex newtypes.tex Log Message: Move reference material on PyArg_Parse*() out of the Extending & Embedding document to the C API reference. Move some instructional text from the API reference to the Extending & Embedding manual. Fix the descriptions of the es and es# formats for PyArg_Parse*(). This closes SF bug #536516. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utilities.tex 23 Oct 2001 21:10:18 -0000 1.3 --- utilities.tex 5 Apr 2002 23:01:14 -0000 1.4 *************** *** 358,368 **** Interpreter}. \begin{cfuncdesc}{int}{PyArg_ParseTuple}{PyObject *args, char *format, \moreargs} Parse the parameters of a function that takes only positional parameters into local variables. Returns true on success; on ! failure, it returns false and raises the appropriate exception. See ! \citetitle[../ext/parseTuple.html]{Extending and Embedding the ! Python Interpreter} for more information. \end{cfuncdesc} --- 358,646 ---- Interpreter}. + The first three of these functions described, + \cfunction{PyArg_ParseTuple()}, + \cfunction{PyArg_ParseTupleAndKeywords()}, and + \cfunction{PyArg_Parse()}, all use \emph{format strings} which are + used to tell the function about the expected arguments. The format + strings use the same syntax for each of these functions. + + A format string consists of zero or more ``format units.'' A format + unit describes one Python object; it is usually a single character or + a parenthesized sequence of format units. With a few exceptions, a + format unit that is not a parenthesized sequence normally corresponds + to a single address argument to these functions. In the following + description, the quoted form is the format unit; the entry in (round) + parentheses is the Python object type that matches the format unit; + and the entry in [square] brackets is the type of the C variable(s) + whose address should be passed. + + \begin{description} + \item[\samp{s} (string or Unicode object) {[char *]}] + Convert a Python string or Unicode object to a C pointer to a + character string. You must not provide storage for the string + itself; a pointer to an existing string is stored into the character + pointer variable whose address you pass. The C string is + NUL-terminated. The Python string must not contain embedded NUL + bytes; if it does, a \exception{TypeError} exception is raised. + Unicode objects are converted to C strings using the default + encoding. If this conversion fails, a \exception{UnicodeError} is + raised. + + \item[\samp{s\#} (string, Unicode or any read buffer compatible object) + {[char *, int]}] + This variant on \samp{s} stores into two C variables, the first one + a pointer to a character string, the second one its length. In this + case the Python string may contain embedded null bytes. Unicode + objects pass back a pointer to the default encoded string version of + the object if such a conversion is possible. All other read-buffer + compatible objects pass back a reference to the raw internal data + representation. + + \item[\samp{z} (string or \code{None}) {[char *]}] + Like \samp{s}, but the Python object may also be \code{None}, in + which case the C pointer is set to \NULL. + + \item[\samp{z\#} (string or \code{None} or any read buffer + compatible object) {[char *, int]}] + This is to \samp{s\#} as \samp{z} is to \samp{s}. + + \item[\samp{u} (Unicode object) {[Py_UNICODE *]}] + Convert a Python Unicode object to a C pointer to a NUL-terminated + buffer of 16-bit Unicode (UTF-16) data. As with \samp{s}, there is + no need to provide storage for the Unicode data buffer; a pointer to + the existing Unicode data is stored into the \ctype{Py_UNICODE} + pointer variable whose address you pass. + + \item[\samp{u\#} (Unicode object) {[Py_UNICODE *, int]}] + This variant on \samp{u} stores into two C variables, the first one + a pointer to a Unicode data buffer, the second one its length. + Non-Unicode objects are handled by interpreting their read-buffer + pointer as pointer to a \ctype{Py_UNICODE} array. + + \item[\samp{es} (string, Unicode object or character buffer + compatible object) {[const char *encoding, char **buffer]}] + This variant on \samp{s} is used for encoding Unicode and objects + convertible to Unicode into a character buffer. It only works for + encoded data without embedded NUL bytes. + + This format requires two arguments. The first is only used as + input, and must be a \ctype{char*} which points to the name of an + encoding as a NUL-terminated string, or \NULL, in which case the + default encoding is used. An exception is raised if the named + encoding is not known to Python. The second argument must be a + \ctype{char**}; the value of the pointer it references will be set + to a buffer with the contents of the argument text. The text will + be encoded in the encoding specified by the first argument. + + \cfunction{PyArg_ParseTuple()} will allocate a buffer of the needed + size, copy the encoded data into this buffer and adjust + \var{*buffer} to reference the newly allocated storage. The caller + is responsible for calling \cfunction{PyMem_Free()} to free the + allocated buffer after use. + + \item[\samp{et} (string, Unicode object or character buffer + compatible object) {[const char *encoding, char **buffer]}] + Same as \samp{es} except that 8-bit string objects are passed + through without recoding them. Instead, the implementation assumes + that the string object uses the encoding passed in as parameter. + + \item[\samp{es\#} (string, Unicode object or character buffer compatible + object) {[const char *encoding, char **buffer, int *buffer_length]}] + This variant on \samp{s\#} is used for encoding Unicode and objects + convertible to Unicode into a character buffer. Unlike the + \samp{es} format, this variant allows input data which contains NUL + characters. + + It requires three arguments. The first is only used as input, and + must be a \ctype{char*} which points to the name of an encoding as a + NUL-terminated string, or \NULL, in which case the default encoding + is used. An exception is raised if the named encoding is not known + to Python. The second argument must be a \ctype{char**}; the value + of the pointer it references will be set to a buffer with the + contents of the argument text. The text will be encoded in the + encoding specified by the first argument. The third argument must + be a pointer to an integer; the referenced integer will be set to + the number of bytes in the output buffer. + + There are two modes of operation: + + If \var{*buffer} points a \NULL{} pointer, the function will + allocate a buffer of the needed size, copy the encoded data into + this buffer and set \var{*buffer} to reference the newly allocated + storage. The caller is responsible for calling + \cfunction{PyMem_Free()} to free the allocated buffer after usage. + + If \var{*buffer} points to a non-\NULL{} pointer (an already + allocated buffer), \cfunction{PyArg_ParseTuple()} will use this + location as the buffer and interpret the initial value of + \var{*buffer_length} as the buffer size. It will then copy the + encoded data into the buffer and NUL-terminate it. If the buffer + is not large enough, a \exception{ValueError} will be set. + + In both cases, \var{*buffer_length} is set to the length of the + encoded data without the trailing NUL byte. + + \item[\samp{et\#} (string, Unicode object or character buffer compatible + object) {[const char *encoding, char **buffer]}] + Same as \samp{es\#} except that string objects are passed through + without recoding them. Instead, the implementation assumes that the + string object uses the encoding passed in as parameter. + + \item[\samp{b} (integer) {[char]}] + Convert a Python integer to a tiny int, stored in a C \ctype{char}. + + \item[\samp{h} (integer) {[short int]}] + Convert a Python integer to a C \ctype{short int}. + + \item[\samp{i} (integer) {[int]}] + Convert a Python integer to a plain C \ctype{int}. + + \item[\samp{l} (integer) {[long int]}] + Convert a Python integer to a C \ctype{long int}. + + \item[\samp{L} (integer) {[LONG_LONG]}] + Convert a Python integer to a C \ctype{long long}. This format is + only available on platforms that support \ctype{long long} (or + \ctype{_int64} on Windows). + + \item[\samp{c} (string of length 1) {[char]}] + Convert a Python character, represented as a string of length 1, to + a C \ctype{char}. + + \item[\samp{f} (float) {[float]}] + Convert a Python floating point number to a C \ctype{float}. + + \item[\samp{d} (float) {[double]}] + Convert a Python floating point number to a C \ctype{double}. + + \item[\samp{D} (complex) {[Py_complex]}] + Convert a Python complex number to a C \ctype{Py_complex} structure. + + \item[\samp{O} (object) {[PyObject *]}] + Store a Python object (without any conversion) in a C object + pointer. The C program thus receives the actual object that was + passed. The object's reference count is not increased. The pointer + stored is not \NULL. + + \item[\samp{O!} (object) {[\var{typeobject}, PyObject *]}] + Store a Python object in a C object pointer. This is similar to + \samp{O}, but takes two C arguments: the first is the address of a + Python type object, the second is the address of the C variable (of + type \ctype{PyObject*}) into which the object pointer is stored. If + the Python object does not have the required type, + \exception{TypeError} is raised. + + \item[\samp{O\&} (object) {[\var{converter}, \var{anything}]}] + Convert a Python object to a C variable through a \var{converter} + function. This takes two arguments: the first is a function, the + second is the address of a C variable (of arbitrary type), converted + to \ctype{void *}. The \var{converter} function in turn is called + as follows: + + \var{status}\code{ = }\var{converter}\code{(}\var{object}, + \var{address}\code{);} + + where \var{object} is the Python object to be converted and + \var{address} is the \ctype{void*} argument that was passed to the + \cfunction{PyArg_Parse*()} function. The returned \var{status} + should be \code{1} for a successful conversion and \code{0} if the + conversion has failed. When the conversion fails, the + \var{converter} function should raise an exception. + + \item[\samp{S} (string) {[PyStringObject *]}] + Like \samp{O} but requires that the Python object is a string + object. Raises \exception{TypeError} if the object is not a string + object. The C variable may also be declared as \ctype{PyObject*}. + + \item[\samp{U} (Unicode string) {[PyUnicodeObject *]}] + Like \samp{O} but requires that the Python object is a Unicode + object. Raises \exception{TypeError} if the object is not a Unicode + object. The C variable may also be declared as \ctype{PyObject*}. + + \item[\samp{t\#} (read-only character buffer) {[char *, int]}] + Like \samp{s\#}, but accepts any object which implements the + read-only buffer interface. The \ctype{char*} variable is set to + point to the first byte of the buffer, and the \ctype{int} is set to + the length of the buffer. Only single-segment buffer objects are + accepted; \exception{TypeError} is raised for all others. + + \item[\samp{w} (read-write character buffer) {[char *]}] + Similar to \samp{s}, but accepts any object which implements the + read-write buffer interface. The caller must determine the length + of the buffer by other means, or use \samp{w\#} instead. Only + single-segment buffer objects are accepted; \exception{TypeError} is + raised for all others. + + \item[\samp{w\#} (read-write character buffer) {[char *, int]}] + Like \samp{s\#}, but accepts any object which implements the + read-write buffer interface. The \ctype{char *} variable is set to + point to the first byte of the buffer, and the \ctype{int} is set to + the length of the buffer. Only single-segment buffer objects are + accepted; \exception{TypeError} is raised for all others. + + \item[\samp{(\var{items})} (tuple) {[\var{matching-items}]}] + The object must be a Python sequence whose length is the number of + format units in \var{items}. The C arguments must correspond to the + individual format units in \var{items}. Format units for sequences + may be nested. + + \note{Prior to Python version 1.5.2, this format specifier only + accepted a tuple containing the individual parameters, not an + arbitrary sequence. Code which previously caused + \exception{TypeError} to be raised here may now proceed without an + exception. This is not expected to be a problem for existing code.} + \end{description} + + It is possible to pass Python long integers where integers are + requested; however no proper range checking is done --- the most + significant bits are silently truncated when the receiving field is + too small to receive the value (actually, the semantics are inherited + from downcasts in C --- your mileage may vary). + + A few other characters have a meaning in a format string. These may + not occur inside nested parentheses. They are: + + \begin{description} + \item[\samp{|}] + Indicates that the remaining arguments in the Python argument list + are optional. The C variables corresponding to optional arguments + should be initialized to their default value --- when an optional + argument is not specified, \cfunction{PyArg_ParseTuple()} does not + touch the contents of the corresponding C variable(s). + + \item[\samp{:}] + The list of format units ends here; the string after the colon is + used as the function name in error messages (the ``associated + value'' of the exception that \cfunction{PyArg_ParseTuple()} + raises). + + \item[\samp{;}] + The list of format units ends here; the string after the semicolon + is used as the error message \emph{instead} of the default error + message. Clearly, \samp{:} and \samp{;} mutually exclude each + other. + \end{description} + + Note that any Python object references which are provided to the + caller are \emph{borrowed} references; do not decrement their + reference count! + + Additional arguments passed to these functions must be addresses of + variables whose type is determined by the format string; these are + used to store values from the input tuple. There are a few cases, as + described in the list of format units above, where these parameters + are used as input values; they should match what is specified for the + corresponding format unit in that case. + + For the conversion to succeed, the \var{arg} object must match the + format and the format must be exhausted. On success, the + \cfunction{PyArg_Parse*()} functions return true, otherwise they + return false and raise an appropriate exception. + \begin{cfuncdesc}{int}{PyArg_ParseTuple}{PyObject *args, char *format, \moreargs} Parse the parameters of a function that takes only positional parameters into local variables. Returns true on success; on ! failure, it returns false and raises the appropriate exception. \end{cfuncdesc} *************** *** 373,378 **** keyword parameters into local variables. Returns true on success; on failure, it returns false and raises the appropriate exception. - See \citetitle[../ext/parseTupleAndKeywords.html]{Extending and - Embedding the Python Interpreter} for more information. \end{cfuncdesc} --- 651,654 ---- *************** *** 441,447 **** accepted by the \cfunction{PyArg_Parse*()} family of functions and a sequence of values. Returns the value or \NULL{} in the case of an ! error; an exception will be raised if \NULL{} is returned. For more ! information on the format string and additional parameters, see ! \citetitle[../ext/buildValue.html]{Extending and Embedding the ! Python Interpreter}. \end{cfuncdesc} --- 717,842 ---- accepted by the \cfunction{PyArg_Parse*()} family of functions and a sequence of values. Returns the value or \NULL{} in the case of an ! error; an exception will be raised if \NULL{} is returned. ! ! \cfunction{Py_BuildValue()} does not always build a tuple. It ! builds a tuple only if its format string contains two or more format ! units. If the format string is empty, it returns \code{None}; if it ! contains exactly one format unit, it returns whatever object is ! described by that format unit. To force it to return a tuple of ! size 0 or one, parenthesize the format string. ! ! When memory buffers are passed as parameters to supply data to build ! objects, as for the \samp{s} and \samp{s\#} formats, the required ! data is copied. Buffers provided by the caller are never referenced ! by the objects created by \cfunction{Py_BuildValue()}. In other ! words, if your code invokes \cfunction{malloc()} and passes the ! allocated memory to \cfunction{Py_BuildValue()}, your code is ! responsible for calling \cfunction{free()} for that memory once ! \cfunction{Py_BuildValue()} returns. ! ! In the following description, the quoted form is the format unit; ! the entry in (round) parentheses is the Python object type that the ! format unit will return; and the entry in [square] brackets is the ! type of the C value(s) to be passed. ! ! The characters space, tab, colon and comma are ignored in format ! strings (but not within format units such as \samp{s\#}). This can ! be used to make long format strings a tad more readable. ! ! \begin{description} ! \item[\samp{s} (string) {[char *]}] ! Convert a null-terminated C string to a Python object. If the C ! string pointer is \NULL, \code{None} is used. ! ! \item[\samp{s\#} (string) {[char *, int]}] ! Convert a C string and its length to a Python object. If the C ! string pointer is \NULL, the length is ignored and \code{None} is ! returned. ! ! \item[\samp{z} (string or \code{None}) {[char *]}] ! Same as \samp{s}. ! ! \item[\samp{z\#} (string or \code{None}) {[char *, int]}] ! Same as \samp{s\#}. ! ! \item[\samp{u} (Unicode string) {[Py_UNICODE *]}] ! Convert a null-terminated buffer of Unicode (UCS-2) data to a ! Python Unicode object. If the Unicode buffer pointer is \NULL, ! \code{None} is returned. ! ! \item[\samp{u\#} (Unicode string) {[Py_UNICODE *, int]}] ! Convert a Unicode (UCS-2) data buffer and its length to a Python ! Unicode object. If the Unicode buffer pointer is \NULL, the ! length is ignored and \code{None} is returned. ! ! \item[\samp{i} (integer) {[int]}] ! Convert a plain C \ctype{int} to a Python integer object. ! ! \item[\samp{b} (integer) {[char]}] ! Same as \samp{i}. ! ! \item[\samp{h} (integer) {[short int]}] ! Same as \samp{i}. ! ! \item[\samp{l} (integer) {[long int]}] ! Convert a C \ctype{long int} to a Python integer object. ! ! \item[\samp{c} (string of length 1) {[char]}] ! Convert a C \ctype{int} representing a character to a Python ! string of length 1. ! ! \item[\samp{d} (float) {[double]}] ! Convert a C \ctype{double} to a Python floating point number. ! ! \item[\samp{f} (float) {[float]}] ! Same as \samp{d}. ! ! \item[\samp{D} (complex) {[Py_complex *]}] ! Convert a C \ctype{Py_complex} structure to a Python complex ! number. ! ! \item[\samp{O} (object) {[PyObject *]}] ! Pass a Python object untouched (except for its reference count, ! which is incremented by one). If the object passed in is a ! \NULL{} pointer, it is assumed that this was caused because the ! call producing the argument found an error and set an exception. ! Therefore, \cfunction{Py_BuildValue()} will return \NULL{} but ! won't raise an exception. If no exception has been raised yet, ! \exception{SystemError} is set. ! ! \item[\samp{S} (object) {[PyObject *]}] ! Same as \samp{O}. ! ! \item[\samp{U} (object) {[PyObject *]}] ! Same as \samp{O}. ! ! \item[\samp{N} (object) {[PyObject *]}] ! Same as \samp{O}, except it doesn't increment the reference count ! on the object. Useful when the object is created by a call to an ! object constructor in the argument list. ! ! \item[\samp{O\&} (object) {[\var{converter}, \var{anything}]}] ! Convert \var{anything} to a Python object through a ! \var{converter} function. The function is called with ! \var{anything} (which should be compatible with \ctype{void *}) as ! its argument and should return a ``new'' Python object, or \NULL{} ! if an error occurred. ! ! \item[\samp{(\var{items})} (tuple) {[\var{matching-items}]}] ! Convert a sequence of C values to a Python tuple with the same ! number of items. ! ! \item[\samp{[\var{items}]} (list) {[\var{matching-items}]}] ! Convert a sequence of C values to a Python list with the same ! number of items. ! ! \item[\samp{\{\var{items}\}} (dictionary) {[\var{matching-items}]}] ! Convert a sequence of C values to a Python dictionary. Each pair ! of consecutive C values adds one item to the dictionary, serving ! as key and value, respectively. ! ! \end{description} ! ! If there is an error in the format string, the ! \exception{SystemError} exception is set and \NULL{} returned. \end{cfuncdesc} Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** newtypes.tex 28 Mar 2002 05:33:33 -0000 1.4 --- newtypes.tex 5 Apr 2002 23:01:14 -0000 1.5 *************** *** 1,3 **** ! \chapter{Defining New Object Types \label{newTypes}} --- 1,7 ---- ! \chapter{Object Implementation Support \label{newTypes}} ! ! ! This chapter describes the functions, types, and macros used when ! defining new object types. *************** *** 389,392 **** --- 393,402 ---- to provide any explicit support for garbage collection. + An example showing the use of these interfaces can be found in + ``\ulink{Supporting the Cycle + Collector}{../ext/example-cycle-support.html}'' in + \citetitle[../ext/ext.html]{Extending and Embedding the Python + Interpreter}. + To create a container type, the \member{tp_flags} field of the type object must include the \constant{Py_TPFLAGS_HAVE_GC} and provide an *************** *** 505,606 **** reference cycle. \end{ctypedesc} - - - \subsection{Example Cycle Collector Support - \label{example-cycle-support}} - - This example shows only enough of the implementation of an extension - type to show how the garbage collector support needs to be added. It - shows the definition of the object structure, the - \member{tp_traverse}, \member{tp_clear} and \member{tp_dealloc} - implementations, the type structure, and a constructor --- the module - initialization needed to export the constructor to Python is not shown - as there are no special considerations there for the collector. To - make this interesting, assume that the module exposes ways for the - \member{container} field of the object to be modified. Note that - since no checks are made on the type of the object used to initialize - \member{container}, we have to assume that it may be a container. - - \begin{verbatim} - #include "Python.h" - - typedef struct { - PyObject_HEAD - PyObject *container; - } MyObject; - - static int - my_traverse(MyObject *self, visitproc visit, void *arg) - { - if (self->container != NULL) - return visit(self->container, arg); - else - return 0; - } - - static int - my_clear(MyObject *self) - { - Py_XDECREF(self->container); - self->container = NULL; - - return 0; - } - - static void - my_dealloc(MyObject *self) - { - PyObject_GC_UnTrack((PyObject *) self); - Py_XDECREF(self->container); - PyObject_GC_Del(self); - } - \end{verbatim} - - \begin{verbatim} - statichere PyTypeObject - MyObject_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "MyObject", - sizeof(MyObject), - 0, - (destructor)my_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, /* tp_doc */ - (traverseproc)my_traverse, /* tp_traverse */ - (inquiry)my_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - }; - - /* This constructor should be made accessible from Python. */ - static PyObject * - new_object(PyObject *unused, PyObject *args) - { - PyObject *container = NULL; - MyObject *result = NULL; - - if (PyArg_ParseTuple(args, "|O:new_object", &container)) { - result = PyObject_GC_New(MyObject, &MyObject_Type); - if (result != NULL) { - result->container = container; - PyObject_GC_Track(result); - } - } - return (PyObject *) result; - } - \end{verbatim} --- 515,516 ---- From fdrake@users.sourceforge.net Fri Apr 5 23:01:16 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 05 Apr 2002 15:01:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ext cycle-gc.c,NONE,1.1 extending.tex,1.16,1.17 newtypes.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv7515/ext Modified Files: extending.tex newtypes.tex Added Files: cycle-gc.c Log Message: Move reference material on PyArg_Parse*() out of the Extending & Embedding document to the C API reference. Move some instructional text from the API reference to the Extending & Embedding manual. Fix the descriptions of the es and es# formats for PyArg_Parse*(). This closes SF bug #536516. --- NEW FILE: cycle-gc.c --- #include "Python.h" typedef struct { PyObject_HEAD PyObject *container; } MyObject; static int my_traverse(MyObject *self, visitproc visit, void *arg) { if (self->container != NULL) return visit(self->container, arg); else return 0; } static int my_clear(MyObject *self) { Py_XDECREF(self->container); self->container = NULL; return 0; } static void my_dealloc(MyObject *self) { PyObject_GC_UnTrack((PyObject *) self); Py_XDECREF(self->container); PyObject_GC_Del(self); } static PyTypeObject MyObject_Type = { PyObject_HEAD_INIT(NULL) 0, "MyObject", sizeof(MyObject), 0, (destructor)my_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, 0, /* tp_doc */ (traverseproc)my_traverse, /* tp_traverse */ (inquiry)my_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ }; /* This constructor should be made accessible from Python. */ static PyObject * new_object(PyObject *unused, PyObject *args) { PyObject *container = NULL; MyObject *result = NULL; if (PyArg_ParseTuple(args, "|O:new_object", &container)) { result = PyObject_GC_New(MyObject, &MyObject_Type); if (result != NULL) { result->container = container; PyObject_GC_Track(result); } } return (PyObject *) result; } Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** extending.tex 1 Apr 2002 23:12:25 -0000 1.16 --- extending.tex 5 Apr 2002 23:01:14 -0000 1.17 *************** *** 603,612 **** The \var{arg} argument must be a tuple object containing an argument list passed from Python to a C function. The \var{format} argument ! must be a format string, whose syntax is explained below. The remaining arguments must be addresses of variables whose type is ! determined by the format string. For the conversion to succeed, the ! \var{arg} object must match the format and the format must be ! exhausted. On success, \cfunction{PyArg_ParseTuple()} returns true, ! otherwise it returns false and raises an appropriate exception. Note that while \cfunction{PyArg_ParseTuple()} checks that the Python --- 603,612 ---- The \var{arg} argument must be a tuple object containing an argument list passed from Python to a C function. The \var{format} argument ! must be a format string, whose syntax is explained in ! ``\ulink{Parsing arguments and building ! values}{../api/arg-parsing.html}'' in the ! \citetitle[../api/api.html]{Python/C API Reference Manual}. The remaining arguments must be addresses of variables whose type is ! determined by the format string. Note that while \cfunction{PyArg_ParseTuple()} checks that the Python *************** *** 616,876 **** in memory. So be careful! - A format string consists of zero or more ``format units''. A format - unit describes one Python object; it is usually a single character or - a parenthesized sequence of format units. With a few exceptions, a - format unit that is not a parenthesized sequence normally corresponds - to a single address argument to \cfunction{PyArg_ParseTuple()}. In the - following description, the quoted form is the format unit; the entry - in (round) parentheses is the Python object type that matches the - format unit; and the entry in [square] brackets is the type of the C - variable(s) whose address should be passed. (Use the \samp{\&} - operator to pass a variable's address.) - Note that any Python object references which are provided to the caller are \emph{borrowed} references; do not decrement their reference count! - \begin{description} - - \item[\samp{s} (string or Unicode object) {[char *]}] - Convert a Python string or Unicode object to a C pointer to a - character string. You must not provide storage for the string - itself; a pointer to an existing string is stored into the character - pointer variable whose address you pass. The C string is - null-terminated. The Python string must not contain embedded null - bytes; if it does, a \exception{TypeError} exception is raised. - Unicode objects are converted to C strings using the default - encoding. If this conversion fails, an \exception{UnicodeError} is - raised. - - \item[\samp{s\#} (string, Unicode or any read buffer compatible object) - {[char *, int]}] - This variant on \samp{s} stores into two C variables, the first one a - pointer to a character string, the second one its length. In this - case the Python string may contain embedded null bytes. Unicode - objects pass back a pointer to the default encoded string version of the - object if such a conversion is possible. All other read buffer - compatible objects pass back a reference to the raw internal data - representation. - - \item[\samp{z} (string or \code{None}) {[char *]}] - Like \samp{s}, but the Python object may also be \code{None}, in which - case the C pointer is set to \NULL. - - \item[\samp{z\#} (string or \code{None} or any read buffer compatible object) - {[char *, int]}] - This is to \samp{s\#} as \samp{z} is to \samp{s}. - - \item[\samp{u} (Unicode object) {[Py_UNICODE *]}] - Convert a Python Unicode object to a C pointer to a null-terminated - buffer of 16-bit Unicode (UTF-16) data. As with \samp{s}, there is no - need to provide storage for the Unicode data buffer; a pointer to the - existing Unicode data is stored into the \ctype{Py_UNICODE} pointer - variable whose address you pass. - - \item[\samp{u\#} (Unicode object) {[Py_UNICODE *, int]}] - This variant on \samp{u} stores into two C variables, the first one - a pointer to a Unicode data buffer, the second one its length. - Non-Unicode objects are handled by interpreting their read buffer - pointer as pointer to a \ctype{Py_UNICODE} array. - - \item[\samp{es} (string, Unicode object or character buffer compatible - object) {[const char *encoding, char **buffer]}] - This variant on \samp{s} is used for encoding Unicode and objects - convertible to Unicode into a character buffer. It only works for - encoded data without embedded \NULL{} bytes. - - The variant reads one C variable and stores into two C variables, the - first one a pointer to an encoding name string (\var{encoding}), and the - second a pointer to a pointer to a character buffer (\var{**buffer}, - the buffer used for storing the encoded data). - - The encoding name must map to a registered codec. If set to \NULL, - the default encoding is used. - - \cfunction{PyArg_ParseTuple()} will allocate a buffer of the needed - size using \cfunction{PyMem_NEW()}, copy the encoded data into this - buffer and adjust \var{*buffer} to reference the newly allocated - storage. The caller is responsible for calling - \cfunction{PyMem_Free()} to free the allocated buffer after usage. - - \item[\samp{et} (string, Unicode object or character buffer compatible - object) {[const char *encoding, char **buffer]}] - Same as \samp{es} except that string objects are passed through without - recoding them. Instead, the implementation assumes that the string - object uses the encoding passed in as parameter. - - \item[\samp{es\#} (string, Unicode object or character buffer compatible - object) {[const char *encoding, char **buffer, int *buffer_length]}] - This variant on \samp{s\#} is used for encoding Unicode and objects - convertible to Unicode into a character buffer. It reads one C - variable and stores into three C variables, the first one a pointer to - an encoding name string (\var{encoding}), the second a pointer to a - pointer to a character buffer (\var{**buffer}, the buffer used for - storing the encoded data) and the third one a pointer to an integer - (\var{*buffer_length}, the buffer length). - - The encoding name must map to a registered codec. If set to \NULL, - the default encoding is used. - - There are two modes of operation: - - If \var{*buffer} points a \NULL{} pointer, - \cfunction{PyArg_ParseTuple()} will allocate a buffer of the needed - size using \cfunction{PyMem_NEW()}, copy the encoded data into this - buffer and adjust \var{*buffer} to reference the newly allocated - storage. The caller is responsible for calling - \cfunction{PyMem_Free()} to free the allocated buffer after usage. - - If \var{*buffer} points to a non-\NULL{} pointer (an already allocated - buffer), \cfunction{PyArg_ParseTuple()} will use this location as - buffer and interpret \var{*buffer_length} as buffer size. It will then - copy the encoded data into the buffer and 0-terminate it. Buffer - overflow is signalled with an exception. - - In both cases, \var{*buffer_length} is set to the length of the - encoded data without the trailing 0-byte. - - \item[\samp{et\#} (string, Unicode object or character buffer compatible - object) {[const char *encoding, char **buffer]}] - Same as \samp{es\#} except that string objects are passed through without - recoding them. Instead, the implementation assumes that the string - object uses the encoding passed in as parameter. - - \item[\samp{b} (integer) {[char]}] - Convert a Python integer to a tiny int, stored in a C \ctype{char}. - - \item[\samp{h} (integer) {[short int]}] - Convert a Python integer to a C \ctype{short int}. - - \item[\samp{i} (integer) {[int]}] - Convert a Python integer to a plain C \ctype{int}. - - \item[\samp{l} (integer) {[long int]}] - Convert a Python integer to a C \ctype{long int}. - - \item[\samp{L} (integer) {[LONG_LONG]}] - Convert a Python integer to a C \ctype{long long}. This format is only - available on platforms that support \ctype{long long} (or \ctype{_int64} - on Windows). - - \item[\samp{c} (string of length 1) {[char]}] - Convert a Python character, represented as a string of length 1, to a - C \ctype{char}. - - \item[\samp{f} (float) {[float]}] - Convert a Python floating point number to a C \ctype{float}. - - \item[\samp{d} (float) {[double]}] - Convert a Python floating point number to a C \ctype{double}. - - \item[\samp{D} (complex) {[Py_complex]}] - Convert a Python complex number to a C \ctype{Py_complex} structure. - - \item[\samp{O} (object) {[PyObject *]}] - Store a Python object (without any conversion) in a C object pointer. - The C program thus receives the actual object that was passed. The - object's reference count is not increased. The pointer stored is not - \NULL. - - \item[\samp{O!} (object) {[\var{typeobject}, PyObject *]}] - Store a Python object in a C object pointer. This is similar to - \samp{O}, but takes two C arguments: the first is the address of a - Python type object, the second is the address of the C variable (of - type \ctype{PyObject *}) into which the object pointer is stored. - If the Python object does not have the required type, - \exception{TypeError} is raised. - - \item[\samp{O\&} (object) {[\var{converter}, \var{anything}]}] - Convert a Python object to a C variable through a \var{converter} - function. This takes two arguments: the first is a function, the - second is the address of a C variable (of arbitrary type), converted - to \ctype{void *}. The \var{converter} function in turn is called as - follows: - - \var{status}\code{ = }\var{converter}\code{(}\var{object}, \var{address}\code{);} - - where \var{object} is the Python object to be converted and - \var{address} is the \ctype{void *} argument that was passed to - \cfunction{PyArg_ParseTuple()}. The returned \var{status} should be - \code{1} for a successful conversion and \code{0} if the conversion - has failed. When the conversion fails, the \var{converter} function - should raise an exception. - - \item[\samp{S} (string) {[PyStringObject *]}] - Like \samp{O} but requires that the Python object is a string object. - Raises \exception{TypeError} if the object is not a string object. - The C variable may also be declared as \ctype{PyObject *}. - - \item[\samp{U} (Unicode string) {[PyUnicodeObject *]}] - Like \samp{O} but requires that the Python object is a Unicode object. - Raises \exception{TypeError} if the object is not a Unicode object. - The C variable may also be declared as \ctype{PyObject *}. - - \item[\samp{t\#} (read-only character buffer) {[char *, int]}] - Like \samp{s\#}, but accepts any object which implements the read-only - buffer interface. The \ctype{char *} variable is set to point to the - first byte of the buffer, and the \ctype{int} is set to the length of - the buffer. Only single-segment buffer objects are accepted; - \exception{TypeError} is raised for all others. - - \item[\samp{w} (read-write character buffer) {[char *]}] - Similar to \samp{s}, but accepts any object which implements the - read-write buffer interface. The caller must determine the length of - the buffer by other means, or use \samp{w\#} instead. Only - single-segment buffer objects are accepted; \exception{TypeError} is - raised for all others. - - \item[\samp{w\#} (read-write character buffer) {[char *, int]}] - Like \samp{s\#}, but accepts any object which implements the - read-write buffer interface. The \ctype{char *} variable is set to - point to the first byte of the buffer, and the \ctype{int} is set to - the length of the buffer. Only single-segment buffer objects are - accepted; \exception{TypeError} is raised for all others. - - \item[\samp{(\var{items})} (tuple) {[\var{matching-items}]}] - The object must be a Python sequence whose length is the number of - format units in \var{items}. The C arguments must correspond to the - individual format units in \var{items}. Format units for sequences - may be nested. - - \note{Prior to Python version 1.5.2, this format specifier - only accepted a tuple containing the individual parameters, not an - arbitrary sequence. Code which previously caused - \exception{TypeError} to be raised here may now proceed without an - exception. This is not expected to be a problem for existing code.} - - \end{description} - - It is possible to pass Python long integers where integers are - requested; however no proper range checking is done --- the most - significant bits are silently truncated when the receiving field is - too small to receive the value (actually, the semantics are inherited - from downcasts in C --- your mileage may vary). - - A few other characters have a meaning in a format string. These may - not occur inside nested parentheses. They are: - - \begin{description} - - \item[\samp{|}] - Indicates that the remaining arguments in the Python argument list are - optional. The C variables corresponding to optional arguments should - be initialized to their default value --- when an optional argument is - not specified, \cfunction{PyArg_ParseTuple()} does not touch the contents - of the corresponding C variable(s). - - \item[\samp{:}] - The list of format units ends here; the string after the colon is used - as the function name in error messages (the ``associated value'' of - the exception that \cfunction{PyArg_ParseTuple()} raises). - - \item[\samp{;}] - The list of format units ends here; the string after the semicolon is - used as the error message \emph{instead} of the default error message. - Clearly, \samp{:} and \samp{;} mutually exclude each other. - - \end{description} - Some example calls: --- 616,623 ---- *************** *** 1042,1159 **** that format unit. To force it to return a tuple of size 0 or one, parenthesize the format string. - - When memory buffers are passed as parameters to supply data to build - objects, as for the \samp{s} and \samp{s\#} formats, the required data - is copied. Buffers provided by the caller are never referenced by the - objects created by \cfunction{Py_BuildValue()}. In other words, if - your code invokes \cfunction{malloc()} and passes the allocated memory - to \cfunction{Py_BuildValue()}, your code is responsible for - calling \cfunction{free()} for that memory once - \cfunction{Py_BuildValue()} returns. - - In the following description, the quoted form is the format unit; the - entry in (round) parentheses is the Python object type that the format - unit will return; and the entry in [square] brackets is the type of - the C value(s) to be passed. - - The characters space, tab, colon and comma are ignored in format - strings (but not within format units such as \samp{s\#}). This can be - used to make long format strings a tad more readable. - - \begin{description} - - \item[\samp{s} (string) {[char *]}] - Convert a null-terminated C string to a Python object. If the C - string pointer is \NULL, \code{None} is used. - - \item[\samp{s\#} (string) {[char *, int]}] - Convert a C string and its length to a Python object. If the C string - pointer is \NULL, the length is ignored and \code{None} is - returned. - - \item[\samp{z} (string or \code{None}) {[char *]}] - Same as \samp{s}. - - \item[\samp{z\#} (string or \code{None}) {[char *, int]}] - Same as \samp{s\#}. - - \item[\samp{u} (Unicode string) {[Py_UNICODE *]}] - Convert a null-terminated buffer of Unicode (UCS-2) data to a Python - Unicode object. If the Unicode buffer pointer is \NULL, - \code{None} is returned. - - \item[\samp{u\#} (Unicode string) {[Py_UNICODE *, int]}] - Convert a Unicode (UCS-2) data buffer and its length to a Python - Unicode object. If the Unicode buffer pointer is \NULL, the length - is ignored and \code{None} is returned. - - \item[\samp{i} (integer) {[int]}] - Convert a plain C \ctype{int} to a Python integer object. - - \item[\samp{b} (integer) {[char]}] - Same as \samp{i}. - - \item[\samp{h} (integer) {[short int]}] - Same as \samp{i}. - - \item[\samp{l} (integer) {[long int]}] - Convert a C \ctype{long int} to a Python integer object. - - \item[\samp{c} (string of length 1) {[char]}] - Convert a C \ctype{int} representing a character to a Python string of - length 1. - - \item[\samp{d} (float) {[double]}] - Convert a C \ctype{double} to a Python floating point number. - - \item[\samp{f} (float) {[float]}] - Same as \samp{d}. - - \item[\samp{D} (complex) {[Py_complex *]}] - Convert a C \ctype{Py_complex} structure to a Python complex number. - - \item[\samp{O} (object) {[PyObject *]}] - Pass a Python object untouched (except for its reference count, which - is incremented by one). If the object passed in is a \NULL{} - pointer, it is assumed that this was caused because the call producing - the argument found an error and set an exception. Therefore, - \cfunction{Py_BuildValue()} will return \NULL{} but won't raise an - exception. If no exception has been raised yet, - \cdata{PyExc_SystemError} is set. - - \item[\samp{S} (object) {[PyObject *]}] - Same as \samp{O}. - - \item[\samp{U} (object) {[PyObject *]}] - Same as \samp{O}. - - \item[\samp{N} (object) {[PyObject *]}] - Same as \samp{O}, except it doesn't increment the reference count on - the object. Useful when the object is created by a call to an object - constructor in the argument list. - - \item[\samp{O\&} (object) {[\var{converter}, \var{anything}]}] - Convert \var{anything} to a Python object through a \var{converter} - function. The function is called with \var{anything} (which should be - compatible with \ctype{void *}) as its argument and should return a - ``new'' Python object, or \NULL{} if an error occurred. - - \item[\samp{(\var{items})} (tuple) {[\var{matching-items}]}] - Convert a sequence of C values to a Python tuple with the same number - of items. - - \item[\samp{[\var{items}]} (list) {[\var{matching-items}]}] - Convert a sequence of C values to a Python list with the same number - of items. - - \item[\samp{\{\var{items}\}} (dictionary) {[\var{matching-items}]}] - Convert a sequence of C values to a Python dictionary. Each pair of - consecutive C values adds one item to the dictionary, serving as key - and value, respectively. - - \end{description} - - If there is an error in the format string, the - \cdata{PyExc_SystemError} exception is raised and \NULL{} returned. Examples (to the left the call, to the right the resulting Python value): --- 789,792 ---- Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** newtypes.tex 2 Apr 2002 15:42:46 -0000 1.12 --- newtypes.tex 5 Apr 2002 23:01:14 -0000 1.13 *************** *** 48,52 **** The \code{staticforward} is required to placate various brain dead ! compilers. \begin{verbatim} --- 48,54 ---- The \code{staticforward} is required to placate various brain dead ! compilers. The actual definition of the object declared using ! \code{staticforward} should use \code{statichere} instead of ! \keyword{static}. \begin{verbatim} *************** *** 155,159 **** \begin{verbatim} ! static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ --- 157,161 ---- \begin{verbatim} ! statichere PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ *************** *** 174,177 **** --- 176,182 ---- \end{verbatim} + (Note the use of \code{statichere} instead of \keyword{static}, since + we used \code{staticforward} in the declaration.) + Now if you go and look up the definition of \ctype{PyTypeObject} in \file{object.h} you'll see that it has many, many more fields that the *************** *** 405,409 **** ! \subsection{Object Representation} In Python, there are three ways to generate a textual representation --- 410,414 ---- ! \subsection{Object Presentation} In Python, there are three ways to generate a textual representation *************** *** 912,915 **** --- 917,943 ---- avoiding the exception can yield slightly better performance. If an actual error occurs, it should set an exception and return \NULL. + + + \subsection{Cycle Collector Support + \label{example-cycle-support}} + + This example shows only enough of the implementation of an extension + type to show how the garbage collector support needs to be added. It + shows the definition of the object structure, the + \member{tp_traverse}, \member{tp_clear} and \member{tp_dealloc} + implementations, the type structure, and a constructor --- the module + initialization needed to export the constructor to Python is not shown + as there are no special considerations there for the collector. To + make this interesting, assume that the module exposes ways for the + \member{container} field of the object to be modified. Note that + since no checks are made on the type of the object used to initialize + \member{container}, we have to assume that it may be a container. + + \verbatiminput{cycle-gc.c} + + Full details on the APIs related to the cycle detector are in + \ulink{Supporting Cyclic Garbarge + Collection}{../api/supporting-cycle-detection.html} in the + \citetitle[../api/api.html]{Python/C API Reference Manual}. From gvanrossum@users.sourceforge.net Sat Apr 6 00:23:27 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 16:23:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.378,1.379 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv26982 Modified Files: NEWS Log Message: Some more news. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.378 retrieving revision 1.379 diff -C2 -d -r1.378 -r1.379 *** NEWS 5 Apr 2002 12:15:05 -0000 1.378 --- NEWS 6 Apr 2002 00:23:25 -0000 1.379 *************** *** 7,10 **** --- 7,12 ---- Core and builtins + - Fixed super() to work correctly with class methods. [SF bug #535444] + - A new built-in type, bool, has been added, as well as built-in names for its two values, True and False. Comparisons and sundry *************** *** 148,151 **** --- 150,155 ---- Windows + + - Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031] - The installer now installs Start menu shortcuts under (the local From gvanrossum@users.sourceforge.net Sat Apr 6 01:05:03 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 17:05:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.138,2.139 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2721/Objects Modified Files: typeobject.c Log Message: - Changed new-style class instantiation so that when C's __new__ method returns something that's not a C instance, its __init__ is not called. [SF bug #537450] Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.138 retrieving revision 2.139 diff -C2 -d -r2.138 -r2.139 *** typeobject.c 5 Apr 2002 22:04:18 -0000 2.138 --- typeobject.c 6 Apr 2002 01:05:00 -0000 2.139 *************** *** 170,173 **** --- 170,177 ---- (PyDict_Check(kwds) && PyDict_Size(kwds) == 0))) return obj; + /* If the returned object is not an instance of type, + it won't be initialized. */ + if (!PyType_IsSubtype(obj->ob_type, type)) + return obj; type = obj->ob_type; if (type->tp_init != NULL && From gvanrossum@users.sourceforge.net Sat Apr 6 01:05:03 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 17:05:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.127,1.128 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2721/Lib/test Modified Files: test_descr.py Log Message: - Changed new-style class instantiation so that when C's __new__ method returns something that's not a C instance, its __init__ is not called. [SF bug #537450] Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** test_descr.py 3 Apr 2002 22:41:50 -0000 1.127 --- test_descr.py 6 Apr 2002 01:05:01 -0000 1.128 *************** *** 2898,2901 **** --- 2898,2922 ---- vereq(keys, ['__dict__', '__doc__', '__module__', '__weakref__', 'meth']) + def funnynew(): + if verbose: print "Testing __new__ returning something unexpected..." + class C(object): + def __new__(cls, arg): + if isinstance(arg, str): return [1, 2, 3] + elif isinstance(arg, int): return object.__new__(D) + else: return object.__new__(cls) + class D(C): + def __init__(self, arg): + self.foo = arg + vereq(C("1"), [1, 2, 3]) + vereq(D("1"), [1, 2, 3]) + d = D(None) + veris(d.foo, None) + d = C(1) + vereq(isinstance(d, D), True) + vereq(d.foo, 1) + d = D(1) + vereq(isinstance(d, D), True) + vereq(d.foo, 1) + def test_main(): class_docstrings() *************** *** 2960,2963 **** --- 2981,2985 ---- dictproxyiteritems() pickleslots() + funnynew() if verbose: print "All OK" From gvanrossum@users.sourceforge.net Sat Apr 6 01:05:02 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 05 Apr 2002 17:05:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.379,1.380 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2721/Misc Modified Files: NEWS Log Message: - Changed new-style class instantiation so that when C's __new__ method returns something that's not a C instance, its __init__ is not called. [SF bug #537450] Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.379 retrieving revision 1.380 diff -C2 -d -r1.379 -r1.380 *** NEWS 6 Apr 2002 00:23:25 -0000 1.379 --- NEWS 6 Apr 2002 01:05:00 -0000 1.380 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - Changed new-style class instantiation so that when C's __new__ + method returns something that's not a C instance, its __init__ is + not called. [SF bug #537450] + - Fixed super() to work correctly with class methods. [SF bug #535444] From tim_one@users.sourceforge.net Sat Apr 6 01:45:37 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 05 Apr 2002 17:45:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.32,2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10226/python/Objects Modified Files: obmalloc.c Log Message: Minor improvements to the stats output dump, including adding commas to the big numbers. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** obmalloc.c 5 Apr 2002 06:24:54 -0000 2.32 --- obmalloc.c 6 Apr 2002 01:45:35 -0000 2.33 *************** *** 1198,1209 **** printone(const char* msg, ulong value) { ! const size_t len = strlen(msg); ! size_t i; fputs(msg, stderr); ! for (i = len; i < 40; ++i) fputc(' ', stderr); ! fprintf(stderr, "= %15lu\n", value); ! return value; } --- 1198,1232 ---- printone(const char* msg, ulong value) { ! int i, k; ! char buf[100]; ! ulong origvalue = value; fputs(msg, stderr); ! for (i = (int)strlen(msg); i < 35; ++i) fputc(' ', stderr); ! fputc('=', stderr); ! ! /* Write the value with commas. */ ! i = 22; ! buf[i--] = '\0'; ! buf[i--] = '\n'; ! k = 3; ! do { ! ulong nextvalue = value / 10UL; ! uint digit = value - nextvalue * 10UL; ! value = nextvalue; ! buf[i--] = (char)(digit + '0'); ! --k; ! if (k == 0 && value && i >= 0) { ! k = 3; ! buf[i--] = ','; ! } ! } while (value && i >= 0); ! ! while (i >= 0) ! buf[i--] = ' '; ! fputs(buf, stderr); ! ! return origvalue; } *************** *** 1285,1290 **** fputc('\n', stderr); ! fputs("class num bytes num pools blocks in use avail blocks\n" ! "----- --------- --------- ------------- ------------\n", stderr); --- 1308,1313 ---- fputc('\n', stderr); ! fputs("class size num pools blocks in use avail blocks\n" ! "----- ---- --------- ------------- ------------\n", stderr); *************** *** 1298,1302 **** continue; } ! fprintf(stderr, "%5u %11u %11lu %15lu %13lu\n", i, size, p, b, f); allocated_bytes += b * size; --- 1321,1325 ---- continue; } ! fprintf(stderr, "%5u %6u %11lu %15lu %13lu\n", i, size, p, b, f); allocated_bytes += b * size; *************** *** 1313,1321 **** fputc('\n', stderr); PyOS_snprintf(buf, sizeof(buf), "%u unused pools * %d bytes", numfreepools, POOL_SIZE); ! total = printone(buf, (ulong)numfreepools * POOL_SIZE); - total += printone("# bytes in allocated blocks", allocated_bytes); total += printone("# bytes in available blocks", available_bytes); total += printone("# bytes lost to pool headers", pool_header_bytes); --- 1336,1345 ---- fputc('\n', stderr); + total = printone("# bytes in allocated blocks", allocated_bytes); + PyOS_snprintf(buf, sizeof(buf), "%u unused pools * %d bytes", numfreepools, POOL_SIZE); ! total += printone(buf, (ulong)numfreepools * POOL_SIZE); total += printone("# bytes in available blocks", available_bytes); total += printone("# bytes lost to pool headers", pool_header_bytes); From mhammond@users.sourceforge.net Sat Apr 6 03:58:44 2002 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Fri, 05 Apr 2002 19:58:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include boolobject.h,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv313 Modified Files: boolobject.h Log Message: Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs. Index: boolobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/boolobject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** boolobject.h 3 Apr 2002 23:01:45 -0000 1.1 --- boolobject.h 6 Apr 2002 03:58:41 -0000 1.2 *************** *** 1,4 **** --- 1,11 ---- /* Boolean object interface */ + #ifndef Py_BOOLOBJECT_H + #define Py_BOOLOBJECT_H + #ifdef __cplusplus + extern "C" { + #endif + + typedef PyIntObject PyBoolObject; *************** *** 19,20 **** --- 26,32 ---- /* Function to return a bool from a C long */ PyObject *PyBool_FromLong(long); + + #ifdef __cplusplus + } + #endif + #endif /* !Py_BOOLOBJECT_H */ From tim_one@users.sourceforge.net Sat Apr 6 09:14:35 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 06 Apr 2002 01:14:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api memory.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv30945/python/Doc/api Modified Files: memory.tex Log Message: Minor clarification about what's actually promised for PyMem_Malloc(0). I probably didn't do a correct thing for the LaTeX spelling of the integer 1. Index: memory.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/memory.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** memory.tex 12 Oct 2001 19:01:43 -0000 1.1 --- memory.tex 6 Apr 2002 09:14:33 -0000 1.2 *************** *** 27,31 **** It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no ! control on it, even if she regularly manipulates object pointers to memory blocks inside that heap. The allocation of heap space for Python objects and other internal buffers is performed on demand by --- 27,31 ---- It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no ! control over it, even if she regularly manipulates object pointers to memory blocks inside that heap. The allocation of heap space for Python objects and other internal buffers is performed on demand by *************** *** 80,85 **** \section{Memory Interface \label{memoryInterface}} ! The following function sets, modeled after the ANSI C standard, are ! available for allocating and releasing memory from the Python heap: --- 80,86 ---- \section{Memory Interface \label{memoryInterface}} ! The following function sets, modeled after the ANSI C standard, ! but specifying behavior when requesting zero bytes, ! are available for allocating and releasing memory from the Python heap: *************** *** 87,91 **** Allocates \var{n} bytes and returns a pointer of type \ctype{void*} to the allocated memory, or \NULL{} if the request fails. ! Requesting zero bytes returns a non-\NULL{} pointer. The memory will not have been initialized in any way. \end{cfuncdesc} --- 88,93 ---- Allocates \var{n} bytes and returns a pointer of type \ctype{void*} to the allocated memory, or \NULL{} if the request fails. ! Requesting zero bytes returns a distinct non-\NULL{} pointer if ! possible, as if \cfunction{PyMem_Malloc(1)} had been called instead. The memory will not have been initialized in any way. \end{cfuncdesc} *************** *** 95,99 **** The contents will be unchanged to the minimum of the old and the new sizes. If \var{p} is \NULL, the call is equivalent to ! \cfunction{PyMem_Malloc(\var{n})}; if \var{n} is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-\NULL. Unless \var{p} is \NULL, it must have been --- 97,101 ---- The contents will be unchanged to the minimum of the old and the new sizes. If \var{p} is \NULL, the call is equivalent to ! \cfunction{PyMem_Malloc(\var{n})}; else if \var{n} is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-\NULL. Unless \var{p} is \NULL, it must have been *************** *** 107,111 **** \cfunction{PyMem_Realloc()}. Otherwise, or if \cfunction{PyMem_Free(p)} has been called before, undefined ! behaviour occurs. If \var{p} is \NULL, no operation is performed. \end{cfuncdesc} --- 109,113 ---- \cfunction{PyMem_Realloc()}. Otherwise, or if \cfunction{PyMem_Free(p)} has been called before, undefined ! behavior occurs. If \var{p} is \NULL, no operation is performed. \end{cfuncdesc} From loewis@users.sourceforge.net Sat Apr 6 10:10:52 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Sat, 06 Apr 2002 02:10:52 -0800 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv9051 Modified Files: acconfig.h configure configure.in pyconfig.h.in Log Message: Move autoheader declarations into configure.in. Index: acconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/acconfig.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** acconfig.h 1 Jan 2002 18:41:32 -0000 1.59 --- acconfig.h 6 Apr 2002 10:10:47 -0000 1.60 *************** *** 2,69 **** - /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r - and you want support for AIX C++ shared extension modules. */ - #undef AIX_GENUINE_CPLUSPLUS - - /* Define if your contains bad prototypes for exec*() - (as it does on SGI IRIX 4.x) */ - #undef BAD_EXEC_PROTOTYPES - - /* Define if your compiler botches static forward declarations - (as it does on SCI ODT 3.0) */ - #undef BAD_STATIC_FORWARD - - /* Define this if you have BeOS threads */ - #undef BEOS_THREADS - /* Define if you have the Mach cthreads package */ #undef C_THREADS - /* Define if you are using Mach cthreads under mach / */ - #undef MACH_C_THREADS - - /* Define if you are using Mach cthreads directly under /include */ - #undef HURD_C_THREADS - - /* Define to `long' if doesn't define. */ - #undef clock_t - - /* Defined on Solaris to see additional function prototypes. */ - #undef __EXTENSIONS__ - - /* This must be set to 64 on some systems to enable large file support */ - #undef _FILE_OFFSET_BITS - - /* Define if getpgrp() must be called as getpgrp(0). */ - #undef GETPGRP_HAVE_ARG - - /* Define if gettimeofday() does not have second (timezone) argument - This is the case on Motorola V4 (R40V4.2) */ - #undef GETTIMEOFDAY_NO_TZ - - /* Define this if your time.h defines altzone */ - #undef HAVE_ALTZONE - /* Define if --enable-ipv6 is specified */ #undef ENABLE_IPV6 - /* Define if sockaddr has sa_len member */ - #undef HAVE_SOCKADDR_SA_LEN - - /* struct addrinfo (netdb.h) */ - #undef HAVE_ADDRINFO - - /* Define if you have the getaddrinfo function. */ - #undef HAVE_GETADDRINFO - - /* struct sockaddr_storage (sys/socket.h) */ - #undef HAVE_SOCKADDR_STORAGE - - /* Defined when any dynamic module loading is enabled */ - #undef HAVE_DYNAMIC_LOADING - - /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ - #undef HAVE_GETC_UNLOCKED - /* Define this if you have gethostbyname() */ #undef HAVE_GETHOSTBYNAME --- 2,11 ---- *************** *** 72,130 **** #undef HAVE_GETHOSTBYNAME_R - /* Define this if you have the 3-arg version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R_3_ARG - - /* Define this if you have the 5-arg version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R_5_ARG - - /* Define this if you have the 6-arg version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R_6_ARG - - /* Defined to enable large file support when an off_t is bigger than a long - and long long is available and at least as big as an off_t. You may need - to add some flags for configuration and compilation to enable this mode. - (For Solaris and Linux, the necessary defines are already defined.) - */ - #undef HAVE_LARGEFILE_SUPPORT - - /* Define this if you have the type long long */ - #undef HAVE_LONG_LONG - - /* Define if your compiler supports function prototypes */ - #undef HAVE_PROTOTYPES - - /* Define if you have GNU PTH threads */ - #undef HAVE_PTH - - /* Define if you have readline 4.0 */ - #undef HAVE_RL_PRE_INPUT_HOOK - - /* Define if you have readline 4.2 */ - #undef HAVE_RL_COMPLETION_MATCHES - - /* Define if your compiler supports variable length function prototypes - (e.g. void fprintf(FILE *, char *, ...);) *and* */ - #undef HAVE_STDARG_PROTOTYPES - /* Define if you have termios available */ #undef HAVE_TERMIOS_H - /* Define this if you have the type uintptr_t */ - #undef HAVE_UINTPTR_T - - /* Define if you have a useable wchar_t type defined in wchar.h; useable - means wchar_t must be 16-bit unsigned type. (see - Include/unicodeobject.h). */ - #undef HAVE_USABLE_WCHAR_T - - /* Define if the compiler provides a wchar.h header file. */ - #undef HAVE_WCHAR_H - - /* This must be defined on some systems to enable large file support */ - #undef _LARGEFILE_SOURCE - - /* Define if you want to have a Unicode type. */ - #undef Py_USING_UNICODE - /* Define as the integral type used for Unicode representation. */ #undef PY_UNICODE_TYPE --- 14,20 ---- *************** *** 133,174 **** #undef Py_UNICODE_SIZE - /* Define if nice() returns success/failure instead of the new priority. */ - #undef HAVE_BROKEN_NICE - - /* Define if malloc(0) returns a NULL pointer */ - #undef MALLOC_ZERO_RETURNS_NULL - - /* Define if you have POSIX threads */ - #undef _POSIX_THREADS - - /* Define if you want to build an interpreter with many run-time checks */ - #undef Py_DEBUG - /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT - /* Define if setpgrp() must be called as setpgrp(0, 0). */ - #undef SETPGRP_HAVE_ARG - - /* Define to empty if the keyword does not work. */ - #undef signed - - /* Define if i>>j for signed int i does not extend the sign bit - when i < 0 - */ - #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS - - /* The number of bytes in an off_t. */ - #undef SIZEOF_OFF_T - - /* The number of bytes in a time_t. */ - #undef SIZEOF_TIME_T - - /* The number of bytes in a pthread_t. */ - #undef SIZEOF_PTHREAD_T - - /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ - #undef PTHREAD_SYSTEM_SCHED_SUPPORTED - /* sizeof(void *) */ #undef SIZEOF_VOID_P --- 23,29 ---- *************** *** 180,219 **** #undef SOLARIS - /* Define if you can safely include both and - (which you can't on SCO ODT 3.0). */ - #undef SYS_SELECT_WITH_SYS_TIME - - /* Define if a va_list is an array of some kind */ - #undef VA_LIST_IS_ARRAY - - /* Define to empty if the keyword does not work. */ - #undef volatile - - /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ - #undef WANT_SIGFPE_HANDLER - - /* Define if you want wctype.h functions to be used instead of the - one supplied by Python itself. (see Include/unicodectype.h). */ - #undef WANT_WCTYPE_FUNCTIONS - - /* Define if you want to compile in cycle garbage collection */ - #undef WITH_CYCLE_GC - - /* Define if you want to emulate SGI (IRIX 4) dynamic linking. - This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), - Sequent Symmetry (Dynix), and Atari ST. - This requires the "dl-dld" library, - ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z, - as well as the "GNU dld" library, - ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z. - Don't bother on SunOS 4 or 5, they already have dynamic linking using - shared libraries */ - #undef WITH_DL_DLD - - /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) - dynamic linker (dyld) instead of the old-style (NextStep) dynamic - linker (rld). Dyld is necessary to support frameworks. */ - #undef WITH_DYLD - /* Define if you want to use BSD db. */ #undef WITH_LIBDB --- 35,38 ---- *************** *** 222,250 **** #undef WITH_LIBNDBM - /* Define if you want to compile in Python-specific mallocs */ - #undef WITH_PYMALLOC - - /* Define if you want to produce an OpenStep/Rhapsody framework - (shared library plus accessory files). */ - #undef WITH_NEXT_FRAMEWORK - - /* Define if you want to use MacPython modules on MacOSX in unix-Python */ - #undef USE_TOOLBOX_OBJECT_GLUE - - /* Define if you want to use SGI (IRIX 4) dynamic linking. - This requires the "dl" library by Jack Jansen, - ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z. - Don't bother on IRIX 5, it already has dynamic linking using SunOS - style shared libraries */ - #undef WITH_SGI_DL - /* Define if you want to compile in rudimentary thread support */ #undef WITH_THREAD - - /* Define if mvwdelch in curses.h is an expression. */ - #undef MVWDELCH_IS_EXPRESSION - - /* Define if WINDOW in curses.h offers a field _flags. */ - #undef WINDOW_HAS_FLAGS --- 41,46 ---- Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.293 retrieving revision 1.294 diff -C2 -d -r1.293 -r1.294 *** configure 5 Apr 2002 16:50:53 -0000 1.293 --- configure 6 Apr 2002 10:10:48 -0000 1.294 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.302 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.303 [...4766 lines suppressed...] if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < *************** *** 7701,7705 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7704: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 7741,7745 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7744: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.303 retrieving revision 1.304 diff -C2 -d -r1.303 -r1.304 *** configure.in 5 Apr 2002 16:50:53 -0000 1.303 --- configure.in 6 Apr 2002 10:10:49 -0000 1.304 *************** *** 239,243 **** SunOS*) # Some functions have a prototype only with that define, e.g. confstr ! AC_DEFINE(__EXTENSIONS__) ;; esac --- 239,243 ---- SunOS*) # Some functions have a prototype only with that define, e.g. confstr ! AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.]) ;; esac *************** *** 413,417 **** [ --with-pydebug build with Py_DEBUG defined], [ if test "$withval" != no ! then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true' else AC_MSG_RESULT(no); Py_DEBUG='false' fi], --- 413,421 ---- [ --with-pydebug build with Py_DEBUG defined], [ if test "$withval" != no ! then ! AC_DEFINE(Py_DEBUG, 1, ! [Define if you want to build an interpreter with many run-time checks.]) ! AC_MSG_RESULT(yes); ! Py_DEBUG='true' else AC_MSG_RESULT(no); Py_DEBUG='false' fi], *************** *** 581,591 **** was_it_defined=no AC_MSG_CHECKING(for clock_t in time.h) ! AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long)) AC_MSG_RESULT($was_it_defined) # Two defines needed to enable largefile support on various platforms # These may affect some typedefs ! AC_DEFINE(_LARGEFILE_SOURCE) ! AC_DEFINE(_FILE_OFFSET_BITS, 64) # Add some code to confdefs.h so that the test for off_t works on SCO --- 585,599 ---- was_it_defined=no AC_MSG_CHECKING(for clock_t in time.h) ! AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [ ! AC_DEFINE(clock_t, long, [Define to 'long' if doesn't define.]) ! ]) AC_MSG_RESULT($was_it_defined) # Two defines needed to enable largefile support on various platforms # These may affect some typedefs ! AC_DEFINE(_LARGEFILE_SOURCE, 1, ! [This must be defined on some systems to enable large file support.]) ! AC_DEFINE(_FILE_OFFSET_BITS, 64, ! [This must be set to 64 on some systems to enable large file support.]) # Add some code to confdefs.h so that the test for off_t works on SCO *************** *** 616,620 **** AC_MSG_CHECKING(for long long support) have_long_long=no ! AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes) AC_MSG_RESULT($have_long_long) if test "$have_long_long" = yes ; then --- 624,631 ---- AC_MSG_CHECKING(for long long support) have_long_long=no ! AC_TRY_COMPILE([], [long long x; x = (long long)0;], [ ! AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.]) ! have_long_long=yes ! ]) AC_MSG_RESULT($have_long_long) if test "$have_long_long" = yes ; then *************** *** 624,628 **** AC_MSG_CHECKING(for uintptr_t support) have_uintptr_t=no ! AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes) AC_MSG_RESULT($have_uintptr_t) if test "$have_uintptr_t" = yes ; then --- 635,642 ---- AC_MSG_CHECKING(for uintptr_t support) have_uintptr_t=no ! AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [ ! AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.]) ! have_uintptr_t=yes ! ]) AC_MSG_RESULT($have_uintptr_t) if test "$have_uintptr_t" = yes ; then *************** *** 647,651 **** ]) AC_MSG_RESULT($ac_cv_sizeof_off_t) ! AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t) AC_MSG_CHECKING(whether to enable large file support) --- 661,666 ---- ]) AC_MSG_RESULT($ac_cv_sizeof_off_t) ! AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t, ! [The number of bytes in an off_t.]) AC_MSG_CHECKING(whether to enable large file support) *************** *** 653,657 **** "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then ! AC_DEFINE(HAVE_LARGEFILE_SUPPORT) AC_MSG_RESULT(yes) else --- 668,676 ---- "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then ! AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, ! [Defined to enable large file support when an off_t is bigger than a long ! and long long is available and at least as big as an off_t. You may need ! to add some flags for configuration and compilation to enable this mode. ! (For Solaris and Linux, the necessary defines are already defined.)]) AC_MSG_RESULT(yes) else *************** *** 676,680 **** ]) AC_MSG_RESULT($ac_cv_sizeof_time_t) ! AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t) --- 695,700 ---- ]) AC_MSG_RESULT($ac_cv_sizeof_time_t) ! AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t, ! [The number of bytes in a time_t.]) *************** *** 706,710 **** ]) AC_MSG_RESULT($ac_cv_sizeof_pthread_t) ! AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t) fi CC="$ac_save_cc" --- 726,731 ---- ]) AC_MSG_RESULT($ac_cv_sizeof_pthread_t) ! AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t, ! [The number of bytes in a pthread_t.]) fi CC="$ac_save_cc" *************** *** 728,732 **** extra_machdep_objs="Python/mactoolboxglue.o" extra_undefs="-u __dummy -u _PyMac_Error" ! AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE) ;; *) --- 749,754 ---- extra_machdep_objs="Python/mactoolboxglue.o" extra_undefs="-u __dummy -u _PyMac_Error" ! AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1, ! [Define if you want to use MacPython modules on MacOSX in unix-Python.]) ;; *) *************** *** 767,771 **** Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";; esac ! AC_DEFINE(WITH_NEXT_FRAMEWORK) AC_MSG_RESULT(yes) else --- 789,795 ---- Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";; esac ! AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, ! [Define if you want to produce an OpenStep/Rhapsody framework ! (shared library plus accessory files).]) AC_MSG_RESULT(yes) else *************** *** 776,780 **** case $ac_sys_system/$ac_sys_release in Darwin/*) ! AC_DEFINE(WITH_DYLD) AC_MSG_RESULT(always on for Darwin) ;; --- 800,807 ---- case $ac_sys_system/$ac_sys_release in Darwin/*) ! AC_DEFINE(WITH_DYLD, 1, ! [Define if you want to use the new-style (Openstep, Rhapsody, MacOS) ! dynamic linker (dyld) instead of the old-style (NextStep) dynamic ! linker (rld). Dyld is necessary to support frameworks.]) AC_MSG_RESULT(always on for Darwin) ;; *************** *** 973,977 **** AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"], [loadAndInit("", 0, "")], ! [AC_DEFINE(AIX_GENUINE_CPLUSPLUS) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]);; --- 1000,1006 ---- AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"], [loadAndInit("", 0, "")], ! [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1, ! [Define for AIX if your compiler is a genuine IBM xlC/xlC_r ! and you want support for AIX C++ shared extension modules.]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]);; *************** *** 1090,1099 **** AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) ! AC_DEFINE(HURD_C_THREADS) LIBS="$LIBS -lthreads" THREADOBJ="Python/thread.o"],[ AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) ! AC_DEFINE(MACH_C_THREADS) THREADOBJ="Python/thread.o"],[ AC_MSG_CHECKING(for --with-pth) --- 1119,1130 ---- AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) ! AC_DEFINE(HURD_C_THREADS, 1, ! [Define if you are using Mach cthreads directly under /include]) LIBS="$LIBS -lthreads" THREADOBJ="Python/thread.o"],[ AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) ! AC_DEFINE(MACH_C_THREADS, 1, ! [Define if you are using Mach cthreads under mach /]) THREADOBJ="Python/thread.o"],[ AC_MSG_CHECKING(for --with-pth) *************** *** 1102,1106 **** AC_MSG_RESULT($withval) AC_DEFINE(WITH_THREAD) ! AC_DEFINE(HAVE_PTH) LIBS="-lpth $LIBS" THREADOBJ="Python/thread.o"],[ --- 1133,1137 ---- AC_MSG_RESULT($withval) AC_DEFINE(WITH_THREAD) ! AC_DEFINE(HAVE_PTH, 1, [Define if you have GNU PTH threads.]) LIBS="-lpth $LIBS" THREADOBJ="Python/thread.o"],[ *************** *** 1126,1130 **** THREADOBJ="Python/thread.o"],[ AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(BEOS_THREADS) THREADOBJ="Python/thread.o"],[ AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) --- 1157,1162 ---- THREADOBJ="Python/thread.o"],[ AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) ! AC_DEFINE(BEOS_THREADS, 1, ! [Define this if you have BeOS threads.]) THREADOBJ="Python/thread.o"],[ AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) *************** *** 1153,1157 **** if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then ! AC_DEFINE(_POSIX_THREADS) fi --- 1185,1191 ---- if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then ! AC_DEFINE(_POSIX_THREADS, 1, ! [Define if you have POSIX threads, ! and your system does not define that.]) fi *************** *** 1176,1180 **** AC_MSG_RESULT($ac_cv_pthread_system_supported) if test "$ac_cv_pthread_system_supported" = "yes"; then ! AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED) fi AC_CHECK_FUNCS(pthread_sigmask) --- 1210,1214 ---- AC_MSG_RESULT($ac_cv_pthread_system_supported) if test "$ac_cv_pthread_system_supported" = "yes"; then ! AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.]) fi AC_CHECK_FUNCS(pthread_sigmask) *************** *** 1379,1383 **** if test "$with_cycle_gc" != "no" then ! AC_DEFINE(WITH_CYCLE_GC) fi AC_MSG_RESULT($with_cycle_gc) --- 1413,1418 ---- if test "$with_cycle_gc" != "no" then ! AC_DEFINE(WITH_CYCLE_GC, 1, ! [Define if you want to compile in cycle garbage collection.]) fi AC_MSG_RESULT($with_cycle_gc) *************** *** 1393,1397 **** if test "$with_pymalloc" != "no" then ! AC_DEFINE(WITH_PYMALLOC) fi AC_MSG_RESULT($with_pymalloc) --- 1428,1433 ---- if test "$with_pymalloc" != "no" then ! AC_DEFINE(WITH_PYMALLOC, 1, ! [Define if you want to compile in Python-specific mallocs]) fi AC_MSG_RESULT($with_pymalloc) *************** *** 1402,1406 **** [ --with-wctype-functions use wctype.h functions], [ if test "$withval" != no ! then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi], --- 1438,1446 ---- [ --with-wctype-functions use wctype.h functions], [ if test "$withval" != no ! then ! AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1, ! [Define if you want wctype.h functions to be used instead of the ! one supplied by Python itself. (see Include/unicodectype.h).]) ! AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi], *************** *** 1415,1419 **** [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [ AC_MSG_RESULT($withval) ! AC_DEFINE(WITH_SGI_DL) DYNLOADFILE="dynload_dl.o" dldir=$withval --- 1455,1464 ---- [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [ AC_MSG_RESULT($withval) ! AC_DEFINE(WITH_SGI_DL, 1, ! [Define if you want to use SGI (IRIX 4) dynamic linking. ! This requires the "dl" library by Jack Jansen, ! ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z. ! Do not bother on IRIX 5, it already has dynamic linking using SunOS ! style shared libraries]) DYNLOADFILE="dynload_dl.o" dldir=$withval *************** *** 1428,1432 **** AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [ AC_MSG_RESULT($withval) ! AC_DEFINE(WITH_DL_DLD) DYNLOADFILE="dynload_dl.o" dldir=`echo "$withval" | sed 's/,.*//'` --- 1473,1486 ---- AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [ AC_MSG_RESULT($withval) ! AC_DEFINE(WITH_DL_DLD, 1, ! [Define if you want to emulate SGI (IRIX 4) dynamic linking. ! This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), ! Sequent Symmetry (Dynix), and Atari ST. ! This requires the 'dl-dld' library, ! ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z, ! as well as the 'GNU dld' library, ! ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z. ! Do not bother on SunOS 4 or 5, they already have dynamic linking using ! shared libraries.]) DYNLOADFILE="dynload_dl.o" dldir=`echo "$withval" | sed 's/,.*//'` *************** *** 1467,1471 **** if test "$DYNLOADFILE" != "dynload_stub.o" then ! AC_DEFINE(HAVE_DYNAMIC_LOADING) fi --- 1521,1526 ---- if test "$DYNLOADFILE" != "dynload_stub.o" then ! AC_DEFINE(HAVE_DYNAMIC_LOADING, 1, ! [Defined when any dynamic module loading is enabled.]) fi *************** *** 1497,1502 **** # check for openpty and forkpty ! AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])) ! AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"])) # check for long file support functions --- 1552,1557 ---- # check for openpty and forkpty ! AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"])) ! AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"])) # check for long file support functions *************** *** 1504,1510 **** AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove) ! AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include ], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) ! AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include ], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG))) ! AC_CHECK_FUNCS(gettimeofday, AC_TRY_COMPILE([#include ], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ))) --- 1559,1584 ---- AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove) ! AC_CHECK_FUNCS(getpgrp, ! AC_TRY_COMPILE([#include ], ! [getpgrp(0);], ! AC_DEFINE(GETPGRP_HAVE_ARG, 1, ! [Define if getpgrp() must be called as getpgrp(0).]) ! ) ! ) ! AC_CHECK_FUNCS(setpgrp, ! AC_TRY_COMPILE([#include ], ! [setpgrp(0,0);], ! AC_DEFINE(SETPGRP_HAVE_ARG, 1, ! [Define if setpgrp() must be called as setpgrp(0, 0).]) ! ) ! ) ! AC_CHECK_FUNCS(gettimeofday, ! AC_TRY_COMPILE([#include ], ! [gettimeofday((struct timeval*)0,(struct timezone*)0);], , ! AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1, ! [Define if gettimeofday() does not have second (timezone) argument ! This is the case on Motorola V4 (R40V4.2)]) ! ) ! ) *************** *** 1625,1629 **** fi else ! AC_DEFINE(HAVE_GETADDRINFO) fi AC_CHECK_FUNCS(getnameinfo) --- 1699,1703 ---- fi else ! AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.]) fi AC_CHECK_FUNCS(getnameinfo) *************** *** 1644,1648 **** AC_MSG_RESULT($ac_cv_header_time_altzone) if test $ac_cv_header_time_altzone = yes; then ! AC_DEFINE(HAVE_ALTZONE) fi --- 1718,1722 ---- AC_MSG_RESULT($ac_cv_header_time_altzone) if test $ac_cv_header_time_altzone = yes; then ! AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.]) fi *************** *** 1653,1657 **** #include #include ! ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes]) AC_MSG_RESULT($was_it_defined) --- 1727,1736 ---- #include #include ! ], [;], [ ! AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1, ! [Define if you can safely include both and ! (which you can't on SCO ODT 3.0).]) ! was_it_defined=yes ! ]) AC_MSG_RESULT($was_it_defined) *************** *** 1665,1669 **** AC_MSG_RESULT($ac_cv_struct_addrinfo) if test $ac_cv_struct_addrinfo = yes; then ! AC_DEFINE(HAVE_ADDRINFO) fi --- 1744,1748 ---- AC_MSG_RESULT($ac_cv_struct_addrinfo) if test $ac_cv_struct_addrinfo = yes; then ! AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)]) fi *************** *** 1678,1682 **** AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) if test $ac_cv_struct_sockaddr_storage = yes; then ! AC_DEFINE(HAVE_SOCKADDR_STORAGE) fi --- 1757,1761 ---- AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) if test $ac_cv_struct_sockaddr_storage = yes; then ! AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)]) fi *************** *** 1688,1703 **** works=no AC_MSG_CHECKING(for working volatile) ! AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, [])) AC_MSG_RESULT($works) works=no AC_MSG_CHECKING(for working signed char) ! AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, [])) AC_MSG_RESULT($works) have_prototypes=no AC_MSG_CHECKING(for prototypes) ! AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], ! AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes) AC_MSG_RESULT($have_prototypes) --- 1767,1789 ---- works=no AC_MSG_CHECKING(for working volatile) ! AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, ! AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.]) ! ) AC_MSG_RESULT($works) works=no AC_MSG_CHECKING(for working signed char) ! AC_TRY_COMPILE([], [signed char c;], works=yes, ! AC_DEFINE(signed, [], [Define to empty if the keyword does not work.]) ! ) AC_MSG_RESULT($works) have_prototypes=no AC_MSG_CHECKING(for prototypes) ! AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[ ! AC_DEFINE(HAVE_PROTOTYPES, 1, ! [Define if your compiler supports function prototype]) ! have_prototypes=yes ! ]) AC_MSG_RESULT($have_prototypes) *************** *** 1714,1719 **** return 0; } ! ], [return foo(10, "", 3.14);], ! AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes) AC_MSG_RESULT($works) --- 1800,1809 ---- return 0; } ! ], [return foo(10, "", 3.14);], [ ! AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1, ! [Define if your compiler supports variable length function prototypes ! (e.g. void fprintf(FILE *, char *, ...);) *and* ]) ! works=yes ! ]) AC_MSG_RESULT($works) *************** *** 1722,1726 **** AC_MSG_CHECKING(for bad exec* prototypes) AC_TRY_COMPILE([#include ], [char **t;execve("@",t,t);], , ! AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes) AC_MSG_RESULT($bad_prototypes) fi --- 1812,1820 ---- AC_MSG_CHECKING(for bad exec* prototypes) AC_TRY_COMPILE([#include ], [char **t;execve("@",t,t);], , ! AC_DEFINE(BAD_EXEC_PROTOTYPES, 1, ! [Define if your contains bad prototypes for exec*() ! (as it does on SGI IRIX 4.x)]) ! bad_prototypes=yes ! ) AC_MSG_RESULT($bad_prototypes) fi *************** *** 1733,1737 **** x.sa_len = 0;], AC_MSG_RESULT(yes) ! AC_DEFINE(HAVE_SOCKADDR_SA_LEN), AC_MSG_RESULT(no)) --- 1827,1831 ---- x.sa_len = 0;], AC_MSG_RESULT(yes) ! AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]), AC_MSG_RESULT(no)) *************** *** 1756,1760 **** if test "$ac_cv_bad_static_forward" = yes then ! AC_DEFINE(BAD_STATIC_FORWARD) fi --- 1850,1856 ---- if test "$ac_cv_bad_static_forward" = yes then ! AC_DEFINE(BAD_STATIC_FORWARD, 1, ! [Define if your compiler botches static forward declarations ! (as it does on SCI ODT 3.0)]) fi *************** *** 1767,1772 **** #include #endif ! ], [va_list list1, list2; list1 = list2;], , ! AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes) AC_MSG_RESULT($va_list_is_array) --- 1863,1870 ---- #include #endif ! ], [va_list list1, list2; list1 = list2;], , [ ! AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) ! va_list_is_array=yes ! ]) AC_MSG_RESULT($va_list_is_array) *************** *** 1789,1793 **** ], [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) ! AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG) AC_MSG_RESULT(yes) ], [ --- 1887,1892 ---- ], [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) ! AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1, ! [Define this if you have the 6-arg version of gethostbyname_r().]) AC_MSG_RESULT(yes) ], [ *************** *** 1806,1810 **** ], [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) ! AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG) AC_MSG_RESULT(yes) ], [ --- 1905,1910 ---- ], [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) ! AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1, ! [Define this if you have the 5-arg version of gethostbyname_r().]) AC_MSG_RESULT(yes) ], [ *************** *** 1821,1825 **** ], [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) ! AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG) AC_MSG_RESULT(yes) ], [ --- 1921,1926 ---- ], [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) ! AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1, ! [Define this if you have the 3-arg version of gethostbyname_r().]) AC_MSG_RESULT(yes) ], [ *************** *** 1852,1856 **** [ --with-fpectl enable SIGFPE catching], [ if test "$withval" != no ! then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi], --- 1953,1960 ---- [ --with-fpectl enable SIGFPE catching], [ if test "$withval" != no ! then ! AC_DEFINE(WANT_SIGFPE_HANDLER, 1, ! [Define if you want SIGFPE handled (see Include/pyfpe.h).]) ! AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi], *************** *** 1921,1930 **** if test "$ac_cv_malloc_zero" = null then ! AC_DEFINE(MALLOC_ZERO_RETURNS_NULL) fi # check for wchar.h ! AC_CHECK_HEADER(wchar.h, ! AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes", wchar_h="no" ) --- 2025,2038 ---- if test "$ac_cv_malloc_zero" = null then ! AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1, ! [Define if malloc(0) returns a NULL pointer.]) fi # check for wchar.h ! AC_CHECK_HEADER(wchar.h, [ ! AC_DEFINE(HAVE_WCHAR_H, 1, ! [Define if the compiler provides a wchar.h header file.]) ! wchar_h="yes" ! ], wchar_h="no" ) *************** *** 1962,1970 **** else UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" ! AC_DEFINE(Py_USING_UNICODE) if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" then PY_UNICODE_TYPE="wchar_t" ! AC_DEFINE(HAVE_USABLE_WCHAR_T) AC_DEFINE(PY_UNICODE_TYPE,wchar_t) elif test "$ac_cv_sizeof_short" = "$unicode_size" --- 2070,2082 ---- else UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" ! AC_DEFINE(Py_USING_UNICODE, 1, ! [Define if you want to have a Unicode type.]) if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" then PY_UNICODE_TYPE="wchar_t" ! AC_DEFINE(HAVE_USABLE_WCHAR_T, 1, ! [Define if you have a useable wchar_t type defined in wchar.h; useable ! means wchar_t must be 16-bit unsigned type. (see ! Include/unicodeobject.h).]) AC_DEFINE(PY_UNICODE_TYPE,wchar_t) elif test "$ac_cv_sizeof_short" = "$unicode_size" *************** *** 2001,2005 **** if test "$ac_cv_rshift_extends_sign" = no then ! AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS) fi --- 2113,2119 ---- if test "$ac_cv_rshift_extends_sign" = no then ! AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1, ! [Define if i>>j for signed int i does not extend the sign bit ! when i < 0]) fi *************** *** 2016,2029 **** if test "$ac_cv_have_getc_unlocked" = yes then ! AC_DEFINE(HAVE_GETC_UNLOCKED) fi # check for readline 4.0 AC_CHECK_LIB(readline, rl_pre_input_hook, ! AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK), , -ltermcap) # check for readline 4.2 AC_CHECK_LIB(readline, rl_completion_matches, ! AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap) AC_MSG_CHECKING(for broken nice()) --- 2130,2146 ---- if test "$ac_cv_have_getc_unlocked" = yes then ! AC_DEFINE(HAVE_GETC_UNLOCKED, 1, ! [Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) fi # check for readline 4.0 AC_CHECK_LIB(readline, rl_pre_input_hook, ! AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, ! [Define if you have readline 4.0]), , -ltermcap) # check for readline 4.2 AC_CHECK_LIB(readline, rl_completion_matches, ! AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, ! [Define if you have readline 4.2]), , -ltermcap) AC_MSG_CHECKING(for broken nice()) *************** *** 2044,2048 **** if test "$ac_cv_broken_nice" = yes then ! AC_DEFINE(HAVE_BROKEN_NICE) fi --- 2161,2166 ---- if test "$ac_cv_broken_nice" = yes then ! AC_DEFINE(HAVE_BROKEN_NICE, 1, ! [Define if nice() returns success/failure instead of the new priority.]) fi *************** *** 2060,2064 **** if test "$ac_cv_mvwdelch_is_expression" = yes then ! AC_DEFINE(MVWDELCH_IS_EXPRESSION) fi --- 2178,2183 ---- if test "$ac_cv_mvwdelch_is_expression" = yes then ! AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1, ! [Define if mvwdelch in curses.h is an expression.]) fi *************** *** 2076,2080 **** if test "$ac_cv_window_has_flags" = yes then ! AC_DEFINE(WINDOW_HAS_FLAGS) fi --- 2195,2200 ---- if test "$ac_cv_window_has_flags" = yes then ! AC_DEFINE(WINDOW_HAS_FLAGS, 1, ! [Define if WINDOW in curses.h offers a field _flags.]) fi Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pyconfig.h.in 27 Mar 2002 18:49:02 -0000 1.25 --- pyconfig.h.in 6 Apr 2002 10:10:49 -0000 1.26 *************** *** 76,198 **** #undef WORDS_BIGENDIAN - /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r - and you want support for AIX C++ shared extension modules. */ - #undef AIX_GENUINE_CPLUSPLUS - - /* Define if your contains bad prototypes for exec*() - (as it does on SGI IRIX 4.x) */ - #undef BAD_EXEC_PROTOTYPES - - /* Define if your compiler botches static forward declarations - (as it does on SCI ODT 3.0) */ - #undef BAD_STATIC_FORWARD - - /* Define this if you have BeOS threads */ - #undef BEOS_THREADS - /* Define if you have the Mach cthreads package */ #undef C_THREADS - /* Define if you are using Mach cthreads under mach / */ - #undef MACH_C_THREADS - - /* Define if you are using Mach cthreads directly under /include */ - #undef HURD_C_THREADS - - /* Define to `long' if doesn't define. */ - #undef clock_t - - /* Defined on Solaris to see additional function prototypes. */ - #undef __EXTENSIONS__ - - /* This must be set to 64 on some systems to enable large file support */ - #undef _FILE_OFFSET_BITS - - /* Define if getpgrp() must be called as getpgrp(0). */ - #undef GETPGRP_HAVE_ARG - - /* Define if gettimeofday() does not have second (timezone) argument - This is the case on Motorola V4 (R40V4.2) */ - #undef GETTIMEOFDAY_NO_TZ - - /* Define this if your time.h defines altzone */ - #undef HAVE_ALTZONE - /* Define if --enable-ipv6 is specified */ #undef ENABLE_IPV6 - /* Define if sockaddr has sa_len member */ - #undef HAVE_SOCKADDR_SA_LEN - - /* struct addrinfo (netdb.h) */ - #undef HAVE_ADDRINFO - - /* Define if you have the getaddrinfo function. */ - #undef HAVE_GETADDRINFO - - /* struct sockaddr_storage (sys/socket.h) */ - #undef HAVE_SOCKADDR_STORAGE - - /* Defined when any dynamic module loading is enabled */ - #undef HAVE_DYNAMIC_LOADING - - /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ - #undef HAVE_GETC_UNLOCKED - /* Define this if you have some version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R - /* Define this if you have the 3-arg version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R_3_ARG - - /* Define this if you have the 5-arg version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R_5_ARG - - /* Define this if you have the 6-arg version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R_6_ARG - - /* Defined to enable large file support when an off_t is bigger than a long - and long long is available and at least as big as an off_t. You may need - to add some flags for configuration and compilation to enable this mode. - (For Solaris and Linux, the necessary defines are already defined.) - */ - #undef HAVE_LARGEFILE_SUPPORT - - /* Define this if you have the type long long */ - #undef HAVE_LONG_LONG - - /* Define if your compiler supports function prototypes */ - #undef HAVE_PROTOTYPES - - /* Define if you have GNU PTH threads */ - #undef HAVE_PTH - - /* Define if you have readline 4.0 */ - #undef HAVE_RL_PRE_INPUT_HOOK - - /* Define if you have readline 4.2 */ - #undef HAVE_RL_COMPLETION_MATCHES - - /* Define if your compiler supports variable length function prototypes - (e.g. void fprintf(FILE *, char *, ...);) *and* */ - #undef HAVE_STDARG_PROTOTYPES - - /* Define this if you have the type uintptr_t */ - #undef HAVE_UINTPTR_T - - /* Define if you have a useable wchar_t type defined in wchar.h; useable - means wchar_t must be 16-bit unsigned type. (see - Include/unicodeobject.h). */ - #undef HAVE_USABLE_WCHAR_T - - /* Define if the compiler provides a wchar.h header file. */ - #undef HAVE_WCHAR_H - - /* This must be defined on some systems to enable large file support */ - #undef _LARGEFILE_SOURCE - - /* Define if you want to have a Unicode type. */ - #undef Py_USING_UNICODE - /* Define as the integral type used for Unicode representation. */ #undef PY_UNICODE_TYPE --- 76,88 ---- *************** *** 201,307 **** #undef Py_UNICODE_SIZE - /* Define if nice() returns success/failure instead of the new priority. */ - #undef HAVE_BROKEN_NICE - - /* Define if malloc(0) returns a NULL pointer */ - #undef MALLOC_ZERO_RETURNS_NULL - - /* Define if you have POSIX threads */ - #undef _POSIX_THREADS - - /* Define if you want to build an interpreter with many run-time checks */ - #undef Py_DEBUG - /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT - /* Define if setpgrp() must be called as setpgrp(0, 0). */ - #undef SETPGRP_HAVE_ARG - - /* Define to empty if the keyword does not work. */ - #undef signed - - /* Define if i>>j for signed int i does not extend the sign bit - when i < 0 - */ - #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS - - /* The number of bytes in an off_t. */ - #undef SIZEOF_OFF_T - - /* The number of bytes in a time_t. */ - #undef SIZEOF_TIME_T - - /* The number of bytes in a pthread_t. */ - #undef SIZEOF_PTHREAD_T - - /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ - #undef PTHREAD_SYSTEM_SCHED_SUPPORTED - /* Define to `int' if doesn't define. */ #undef socklen_t - /* Define if you can safely include both and - (which you can't on SCO ODT 3.0). */ - #undef SYS_SELECT_WITH_SYS_TIME - - /* Define if a va_list is an array of some kind */ - #undef VA_LIST_IS_ARRAY - - /* Define to empty if the keyword does not work. */ - #undef volatile - - /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ - #undef WANT_SIGFPE_HANDLER - - /* Define if you want wctype.h functions to be used instead of the - one supplied by Python itself. (see Include/unicodectype.h). */ - #undef WANT_WCTYPE_FUNCTIONS - - /* Define if you want to compile in cycle garbage collection */ - #undef WITH_CYCLE_GC - - /* Define if you want to emulate SGI (IRIX 4) dynamic linking. - This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), - Sequent Symmetry (Dynix), and Atari ST. - This requires the "dl-dld" library, - ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z, - as well as the "GNU dld" library, - ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z. - Don't bother on SunOS 4 or 5, they already have dynamic linking using - shared libraries */ - #undef WITH_DL_DLD - - /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) - dynamic linker (dyld) instead of the old-style (NextStep) dynamic - linker (rld). Dyld is necessary to support frameworks. */ - #undef WITH_DYLD - - /* Define if you want to compile in Python-specific mallocs */ - #undef WITH_PYMALLOC - - /* Define if you want to produce an OpenStep/Rhapsody framework - (shared library plus accessory files). */ - #undef WITH_NEXT_FRAMEWORK - - /* Define if you want to use MacPython modules on MacOSX in unix-Python */ - #undef USE_TOOLBOX_OBJECT_GLUE - - /* Define if you want to use SGI (IRIX 4) dynamic linking. - This requires the "dl" library by Jack Jansen, - ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z. - Don't bother on IRIX 5, it already has dynamic linking using SunOS - style shared libraries */ - #undef WITH_SGI_DL - /* Define if you want to compile in rudimentary thread support */ #undef WITH_THREAD - /* Define if mvwdelch in curses.h is an expression. */ - #undef MVWDELCH_IS_EXPRESSION - - /* Define if WINDOW in curses.h offers a field _flags. */ - #undef WINDOW_HAS_FLAGS - /* The number of bytes in a char. */ #undef SIZEOF_CHAR --- 91,103 ---- *************** *** 765,768 **** --- 561,768 ---- /* Define if you have the rt library (-lrt). */ #undef HAVE_LIBRT + + /* Defined on Solaris to see additional function prototypes. */ + #undef __EXTENSIONS__ + + /* Define if you want to build an interpreter with many run-time checks. */ + #undef Py_DEBUG + + /* Define to 'long' if doesn't define. */ + #undef clock_t + + /* This must be defined on some systems to enable large file support. */ + #undef _LARGEFILE_SOURCE + + /* This must be set to 64 on some systems to enable large file support. */ + #undef _FILE_OFFSET_BITS + + /* Define this if you have the type long long. */ + #undef HAVE_LONG_LONG + + /* Define this if you have the type uintptr_t. */ + #undef HAVE_UINTPTR_T + + /* The number of bytes in an off_t. */ + #undef SIZEOF_OFF_T + + /* Defined to enable large file support when an off_t is bigger than a long + and long long is available and at least as big as an off_t. You may need + to add some flags for configuration and compilation to enable this mode. + (For Solaris and Linux, the necessary defines are already defined.) */ + #undef HAVE_LARGEFILE_SUPPORT + + /* The number of bytes in a time_t. */ + #undef SIZEOF_TIME_T + + /* The number of bytes in a pthread_t. */ + #undef SIZEOF_PTHREAD_T + + /* Define if you want to use MacPython modules on MacOSX in unix-Python. */ + #undef USE_TOOLBOX_OBJECT_GLUE + + /* Define if you want to produce an OpenStep/Rhapsody framework + (shared library plus accessory files). */ + #undef WITH_NEXT_FRAMEWORK + + /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) + dynamic linker (dyld) instead of the old-style (NextStep) dynamic + linker (rld). Dyld is necessary to support frameworks. */ + #undef WITH_DYLD + + /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r + and you want support for AIX C++ shared extension modules. */ + #undef AIX_GENUINE_CPLUSPLUS + + /* Define if you are using Mach cthreads directly under /include */ + #undef HURD_C_THREADS + + /* Define if you are using Mach cthreads under mach / */ + #undef MACH_C_THREADS + + /* Define if you have GNU PTH threads. */ + #undef HAVE_PTH + + /* Define this if you have BeOS threads. */ + #undef BEOS_THREADS + + /* Define if you have POSIX threads, + and your system does not define that. */ + #undef _POSIX_THREADS + + /* Defined if PTHREAD_SCOPE_SYSTEM supported. */ + #undef PTHREAD_SYSTEM_SCHED_SUPPORTED + + /* Define if you want to compile in cycle garbage collection. */ + #undef WITH_CYCLE_GC + + /* Define if you want to compile in Python-specific mallocs */ + #undef WITH_PYMALLOC + + /* Define if you want wctype.h functions to be used instead of the + one supplied by Python itself. (see Include/unicodectype.h). */ + #undef WANT_WCTYPE_FUNCTIONS + + /* Define if you want to use SGI (IRIX 4) dynamic linking. + This requires the dl library by Jack Jansen, + ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z. + Do not bother on IRIX 5, it already has dynamic linking using SunOS + style shared libraries */ + #undef WITH_SGI_DL + + /* Define if you want to emulate SGI (IRIX 4) dynamic linking. + This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), + Sequent Symmetry (Dynix), and Atari ST. + This requires the 'dl-dld' library, + ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z, + as well as the 'GNU dld' library, + ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z. + Do not bother on SunOS 4 or 5, they already have dynamic linking using + shared libraries. */ + #undef WITH_DL_DLD + + /* Defined when any dynamic module loading is enabled. */ + #undef HAVE_DYNAMIC_LOADING + + /* Define if getpgrp() must be called as getpgrp(0). */ + #undef GETPGRP_HAVE_ARG + + /* Define if setpgrp() must be called as setpgrp(0, 0). */ + #undef SETPGRP_HAVE_ARG + + /* Define if gettimeofday() does not have second (timezone) argument + This is the case on Motorola V4 (R40V4.2) */ + #undef GETTIMEOFDAY_NO_TZ + + /* Define if you have the getaddrinfo function. */ + #undef HAVE_GETADDRINFO + + /* Define this if your time.h defines altzone. */ + #undef HAVE_ALTZONE + + /* Define if you can safely include both and + (which you can't on SCO ODT 3.0). */ + #undef SYS_SELECT_WITH_SYS_TIME + + /* struct addrinfo (netdb.h) */ + #undef HAVE_ADDRINFO + + /* struct sockaddr_storage (sys/socket.h) */ + #undef HAVE_SOCKADDR_STORAGE + + /* Define to empty if the keyword does not work. */ + #undef volatile + + /* Define to empty if the keyword does not work. */ + #undef signed + + /* Define if your compiler supports function prototype */ + #undef HAVE_PROTOTYPES + + /* Define if your compiler supports variable length function prototypes + (e.g. void fprintf(FILE *, char *, ...);) *and* */ + #undef HAVE_STDARG_PROTOTYPES + + /* Define if your contains bad prototypes for exec*() + (as it does on SGI IRIX 4.x) */ + #undef BAD_EXEC_PROTOTYPES + + /* Define if sockaddr has sa_len member */ + #undef HAVE_SOCKADDR_SA_LEN + + /* Define if your compiler botches static forward declarations + (as it does on SCI ODT 3.0) */ + #undef BAD_STATIC_FORWARD + + /* Define if a va_list is an array of some kind */ + #undef VA_LIST_IS_ARRAY + + /* Define this if you have the 6-arg version of gethostbyname_r(). */ + #undef HAVE_GETHOSTBYNAME_R_6_ARG + + /* Define this if you have the 5-arg version of gethostbyname_r(). */ + #undef HAVE_GETHOSTBYNAME_R_5_ARG + + /* Define this if you have the 3-arg version of gethostbyname_r(). */ + #undef HAVE_GETHOSTBYNAME_R_3_ARG + + /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ + #undef WANT_SIGFPE_HANDLER + + /* Define if malloc(0) returns a NULL pointer. */ + #undef MALLOC_ZERO_RETURNS_NULL + + /* Define if the compiler provides a wchar.h header file. */ + #undef HAVE_WCHAR_H + + /* Define if you want to have a Unicode type. */ + #undef Py_USING_UNICODE + + /* Define if you have a useable wchar_t type defined in wchar.h; useable + means wchar_t must be 16-bit unsigned type. (see + Include/unicodeobject.h). */ + #undef HAVE_USABLE_WCHAR_T + + /* Define if i>>j for signed int i does not extend the sign bit + when i < 0 */ + #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS + + /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ + #undef HAVE_GETC_UNLOCKED + + /* Define if you have readline 4.0 */ + #undef HAVE_RL_PRE_INPUT_HOOK + + /* Define if you have readline 4.2 */ + #undef HAVE_RL_COMPLETION_MATCHES + + /* Define if nice() returns success/failure instead of the new priority. */ + #undef HAVE_BROKEN_NICE + + /* Define if mvwdelch in curses.h is an expression. */ + #undef MVWDELCH_IS_EXPRESSION + + /* Define if WINDOW in curses.h offers a field _flags. */ + #undef WINDOW_HAS_FLAGS + #ifdef __CYGWIN__ From guido@python.org Sat Apr 6 14:12:01 2002 From: guido@python.org (Guido van Rossum) Date: Sat, 06 Apr 2002 09:12:01 -0500 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 In-Reply-To: Your message of "Sat, 06 Apr 2002 02:10:52 PST." References: Message-ID: <200204061412.g36EC1Q28446@pcp742651pcs.reston01.va.comcast.net> > Move autoheader declarations into configure.in. Very cool. What autoconf feature was it that we weren't using enough? Can you explain how you obtained the set of symbols that remain in acconfig.h? (Appended) --Guido van Rossum (home page: http://www.python.org/~guido/) /* Leave this blank line here -- autoheader needs it! */ /* Define if you have the Mach cthreads package */ #undef C_THREADS /* Define if --enable-ipv6 is specified */ #undef ENABLE_IPV6 /* Define this if you have gethostbyname() */ #undef HAVE_GETHOSTBYNAME /* Define this if you have some version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R /* Define if you have termios available */ #undef HAVE_TERMIOS_H /* Define as the integral type used for Unicode representation. */ #undef PY_UNICODE_TYPE /* Define as the size of the unicode type. */ #undef Py_UNICODE_SIZE /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT /* sizeof(void *) */ #undef SIZEOF_VOID_P /* Define to `int' if doesn't define. */ #undef socklen_t /* Define for SOLARIS 2.x */ #undef SOLARIS /* Define if you want to use BSD db. */ #undef WITH_LIBDB /* Define if you want to use ndbm. */ #undef WITH_LIBNDBM /* Define if you want to compile in rudimentary thread support */ #undef WITH_THREAD /* Leave that blank line there-- autoheader needs it! */ @BOTTOM@ #ifdef __CYGWIN__ #ifdef USE_DL_IMPORT #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE #else #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE #endif #endif /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif From jhylton@users.sourceforge.net Sat Apr 6 23:55:35 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sat, 06 Apr 2002 15:55:35 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox/ast - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23344/ast Log Message: Directory /cvsroot/python/python/nondist/sandbox/ast added to the repository From jhylton@users.sourceforge.net Sun Apr 7 00:05:01 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sat, 06 Apr 2002 16:05:01 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox/ast/tests README,NONE,1.1 asdl.asdl,NONE,1.1 errors.asdl,NONE,1.1 pattern.asdl,NONE,1.1 rcc.asdl,NONE,1.1 slp.asdl,NONE,1.1 slp3.asdl,NONE,1.1 test.asdl,NONE,1.1 toplevel.asdl,NONE,1.1 zsuif.asdl,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast/tests In directory usw-pr-cvs1:/tmp/cvs-serv25251 Added Files: README asdl.asdl errors.asdl pattern.asdl rcc.asdl slp.asdl slp3.asdl test.asdl toplevel.asdl zsuif.asdl Log Message: New ast definition and tools. asdl.py: an ASDL parser based on spark spark.py: John Aycock's little language toolkit python.asdl: an in-progress AST for Python tests/: a collector of .asdl files to test asdl.py --- NEW FILE: README --- Tests for the ast sandbox. The .asdl files come from asdl.sourceforge.net. They are used to test the parser in asdl.py. They are subject to the following license: COPYRIGHT NOTICE, LICENSE AND DISCLAIMER. Copyright 1998 by Princeton University 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 the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of Princeton University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Princeton University disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall Princeton University 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. --- NEW FILE: asdl.asdl --- -- ASDL specicication in ASDL without use of labels -- * = repetition ? = optional ala. grep -- Think grep meets Cish prototypes module Asdl { asdl_module = (identifier name,identifier* imports,asdl_type* defs) asdl_type = SumType(field*,constructor, constructor*) | ProductType(field,field*) attributes (identifier) constructor = Con(identifier, field*) field = Id | Option | Sequence attributes (identifier*, identifier?) } --- NEW FILE: errors.asdl --- module Foo { t = A | B (x) y = (t,int) x = (y,t) } --- NEW FILE: pattern.asdl --- (This appears to be a binary file; contents omitted.) --- NEW FILE: rcc.asdl --- -- lcc IR -- $Id: rcc.asdl,v 1.1 2002/04/07 00:04:58 jhylton Exp $ module rcc { -- Pickles start with an int version number, followed by rcc.program program = (int nuids,int nlabels,item* items,interface* interfaces,int argc,string *argv) real = (int msb,int lsb) item = Symbol(symbol symbol) | Type(type type) attributes(int uid) symbol = (identifier id,int type,int scope,int sclass,int ref,int flags) field = (identifier id,int type,int offset,int bitsize,int lsb) enum = (identifier id,int value) type = INT | UNSIGNED | FLOAT | VOID | POINTER(int type) | ENUM(identifier tag,enum* ids) | STRUCT(identifier tag,field* fields) | UNION(identifier tag,field* fields) | ARRAY(int type) | FUNCTION(int type,int* formals) | CONST(int type) | VOLATILE(int type) attributes(int size,int align) interface = Export(int p) | Import(int p) | Global(int p,int seg) | Local(int uid,symbol p) -- includes formals | Address(int uid,symbol q,int p,int n) | Segment(int seg) | Defaddress(int p) | Deflabel(int label) | Defconst(int suffix,int size,int value) | Defconstf(int size,real value) | Defstring(string s) | Space(int n) | Function(int f,int* caller,int* callee,int ncalls,interface* codelist) | Blockbeg | Blockend | Forest(node* nodes) node = CNST(int value) | CNSTF(real value) | ARG(node left,int len,int align) | ASGN(node left,node right,int len,int align) | CVT(int op,node left,int fromsize) | CALL(node left,int type) | CALLB(node left,node right,int type) | RET | ADDRG(int uid) | ADDRL(int uid) | ADDRF(int uid) | Unary(int op,node left) -- INDIR RET JUMP NEG BCOM | Binary(int op,node left,node right) -- ADD SUB DIV MUL MOD BOR BAND BXOR RSH LSH | Compare(int op,node left,node right,int label) -- EQ NE GT GE LE LT | LABEL(int label) | BRANCH(int label) | CSE(int uid,node node) attributes(int suffix,int size) } --- NEW FILE: slp.asdl --- module Slp { -- Straight Line Programs from MC stm = Compound(stm,stm) | Assign(identifier,exp) | Print(exp_list) exp_list = ExpList(exp,exp_list) | Nil exp = Id(identifier) | Num(int) | Op(exp,binop,exp) binop = Plus | Minus | Times | Div } --- NEW FILE: slp3.asdl --- module Slp3 { -- Straight Line Programs from MC -- With user defined field names -- With sequence -- With raw products, atributes and options pos = (string? file,int line, int offset) stm = Compound(stm head,stm next) | Assign(identifier id,exp exp) | Print(exp*) attributes (pos p,int? value) -- Values are optional so that a parser can ignore them -- but an evaluator can use them to record the value of each -- sub-expression exp = Id(identifier id) | Num(int v) | Op(exp lexp,binop,exp rexp) attributes (pos p,int? value) binop = Plus | Minus | Times | Div } --- NEW FILE: test.asdl --- -- ASDL specicication in ASDL without use of labels -- * = repetition ? = optional ala. grep -- Think grep meets Cish prototypes module Asdl { asdl_type = SumType(identifier, field*,constructor, constructor*) | ProductType(identifier,field?,field*) constructor = Con(identifier, field*) field = Id | Option | Sequence attributes (identifier,identifier?) op = Plus | Minus | Times | Div t = (op bar,op* baz,op?) foo = (bar) bar = (foo) } --- NEW FILE: toplevel.asdl --- module Top { pos = (string? file,int line, int offset) stm = Compound(stm head,stm next) | Assign(identifier id,exp exp) | Print(exp*) attributes (pos p,int? value) -- Values are optional so that a parser can ignore them -- but an evaluator can use them to record the value of each -- sub-expression exp = Id(identifier id) | Num(int v) | Op(exp lexp,binop,exp rexp) attributes (pos p,int? value) binop = Plus | Minus | Times | Div } --- NEW FILE: zsuif.asdl --- module zsuif { -- hacked suif_int = (int) lstring = (identifier) -- Zephyr SUIF a simplified interface for SUIF 2.0 constant = ConstInt(suif_int) | ConstString(string) | ConstBits(string) source_op = SrcVar(variable_symbol var) | SrcReg(register_symbol reg, type type) | SrcDst(instruction instr, nat op_num) destination_op = DstTmp -- unnamed destination | DstVar(variable_symbol var) | DstReg(register_symbol reg, type type) | DstSrc(instruction instr, nat op_num) int_or_source_op = Int(suif_int) | SrcOp(source_op) symbol = (nat uid, identifier name) -- reorganized type hierarchy type_id = (nat) type = Data(data_type) | Procedure(procedure_type) | Qualified(qualification* qualifications, type type) | Void procedure_type = Basic_procedure_type(type result_type, type* args) attributes(int_or_source_op? bit_size, int_or_source_op? bit_alignment) data_type = Boolean_type | Integer_type | UInteger_type | Floating_point_type | Enumerated_type(string name, enumerate_case* cases) | Pointer_type(type_id reference_type) | Array_type (type element_type, int_or_source_op lower_bound, int_or_source_op upper_bound) | Group_type(string name, group_field* fields) | Lookup_type(type_id) attributes(int_or_source_op? bit_size, int_or_source_op? bit_alignment) group_field = (field_symbol name, type type, int_or_source_op bit_offset) enumerate_case = (string name, suif_int case_constant) qualification = (string qualifier) type_table_entry = (type_id key, type) type_table = (type_table_entry* entries) code_label_symbol = (symbol) procedure_symbol = (symbol) register_symbol = (symbol) variable_symbol = (symbol) field_symbol = (symbol) parameter_symbol = (symbol) symbol_table_entry = CodeLabelEntry | ProcedureEntry(procedure_definition def) | RegisterEntry(suif_int size) | VariableEntry(variable_definition def) | ParameterEntry(parameter_symbol name, int_or_source_op bit_alignment, type type, procedure_symbol proc) | FieldEntry(int_or_source_op bit_offset) | NestedVariable(variable_symbol start, int_or_source_op bit_offset) attributes (symbol key, bool address_taken) symbol_table = (symbol_table_entry* entries) procedure_definition = (procedure_symbol name, qualification* qualifications, procedure_type procedure_type, parameter_symbol* params, statement body) variable_definition = (variable_symbol name, type type, int_or_source_op bit_alignment, value_block value_block) value_block = Constant_value_block(constant constnat) | Expression_value_block(source_op expression) | Multi_value_block(multi_value_block_init* inits) | Repeat_value_block(suif_int count, value_block block) | Undefined_value_block attributes(data_type data_type) definition_block = (variable_symbol* defined_variables, procedure_symbol* defined_procedures) file_block = (string source_file_name, definition_block definition_block) file_set_block = (file_block* file_blocks, type_table type_table, symbol_table symbol_table, symbol_table extern_symbol_table, global_information_block information_block) statement = Eval_statement -- order of evaluation undefined (instruction* instructions) | Sequence_statement -- sequential semantics (statement* statements) | If_statement (source_op condition, statement then_part, statement else_part) | While_statement (source_op condition, statement body, code_label_symbol? break_label, code_label_symbol? continue_label) | Do_while_statement (source_op condition, statement body, code_label_symbol? break_label, code_label_symbol? continue_label) | For_statement (variable_symbol index, source_op lower_bound, source_op upper_bound, source_op step, lstring init_comparison_opcode, statement body, statement? pre_pad, statement? post_pad, code_label_symbol? break_label, code_label_symbol? continue_label) | Scope_statement (statement body, definition_block definition_block) | Mark_statement -- possibly redundant | Va_start_statement (source_op ap_address, parameter_symbol parmn) | Va_start_old_statement (source_op ap_address) | Va_end_statement (source_op ap_address) | Store_statement (source_op data_operand, source_op destination_address) | Return_statement (source_op* return_values) | Jump_statement (code_label_symbol target) | Jump_indirect_statement (source_op itarget) | Branch_statement (lstring opcode, source_op decision_operand, code_label_symbol target) | Multi_way_branch_statement (source_op decision_operand, code_label_symbol default_target, multi_way_branch_case* cases) | Label_location_statement (code_label_symbol defined_label) | Assert_statement(source_op asserted_value) -- attributes(?? ) -- all instructions have at least one dest op listed in the attributes code instruction = Binary_arithmetic_instruction (lstring opcode, source_op source1, source_op source2, data_type result_type, destination_op destination_op) | Unary_arithmetic_instruction (lstring opcode, source_op source, data_type result_type, destination_op destination_op) | Copy_instruction (source_op source, data_type result_type, destination_op destination_op, destination_op* destination_ops) | Select_instruction (source_op selector, source_op selection1, source_op selection2, data_type result_type, destination_op destination_op) | Array_reference_instruction (source_op base_array_address, source_op index, data_type result_type, destination_op destination_op) | Field_access_instruction (source_op base_group_address, field_symbol field, data_type result_type, destination_op destination_op) | Extract_fields_instruction (source_op base_group_op, field_dst field_dst, field_dst* field_dsts) | Set_fields_instruction (source_op base_group_op, field_src field_src, field_src* field_srcs, data_type result_type, destination_op destination_op) | Extract_elements_instruction (source_op index, source_op base_array_op, element_dst element_dst, element_dst* element_dsts) | Set_elements_instruction (source_op base_array_op, element_src element_src, element_src* element_srcs) | Bit_size_of_instruction (type_id ref_type, data_type result_type, destination_op destination_op) | Bit_alignment_of_instruction (type_id ref_type, data_type result_type, destination_op destination_op) | Bit_offset_of_instruction (field_symbol field, data_type result_type, destination_op destination_op) -- add bit to byte coercions and avoid these | Byte_size_of_instruction (type_id ref_type, data_type result_type, destination_op destination_op) | Byte_alignment_of_instruction (type_id ref_type, data_type result_type, destination_op destination_op) | Byte_offset_of_instruction (field_symbol field, data_type result_type, destination_op destination_op) | Va_arg_instruction (source_op ap_address, data_type result_type, destination_op destination_op) | Sc_and_instruction (source_op source1, source_op source2, data_type result_type, destination_op destination_op) | Sc_or_instruction (source_op source1, source_op source2, data_type result_type, destination_op destination_op) | Sc_select_instruction (source_op selector, source_op selection1, source_op selection2, data_type result_type, destination_op destination_op) | Load_instruction (source_op source_address, data_type result_type, destination_op destination_op) | Load_address_instruction (symbol addressed_symbol, data_type result_type, destination_op destination_op) | Load_constant_instruction (constant constant, data_type result_type, destination_op destination_op) | Load_value_block_instruction (constant constant, data_type result_type, destination_op destination_op) | Call_instruction (source_op callee_address, source_op* arguments, return_value return_value, return_value* return_values) | Ssa_phi_instruction (variable_symbol* variables, data_type result_type, destination_op destination_op) | Mark_instruction -- redundant use statement versions -- | Va_start_instruction(source_op ap_address, parameter_symbol parmn) -- | Va_start_old_instruction(source_op ap_address) -- | Va_end_instruction(source_op ap_address) -- | Store_instruction(source_op data_operand, source_op destination_address) -- | Return_instruction(source_op* return_values) -- | Jump_instruction(code_label_symbol target) -- | Jump_indirect_instruction(source_op target) -- | Branch_instruction(lstring opcode, -- source_op decision_operand, -- code_label_symbol target) -- | Multi_way_branch_instruction(source_op decision_operand, -- code_label_symbol default_target, -- multi_way_branch_case* cases) -- | Label_location_instruction(code_label_symbol defined_label) -- | Assert_instruction(source_op asserted_value) -- -- attributes( ) element_dst = (data_type result_type, destination_op destination_op, source_op index) element_src = (source_op index, source_op element) field_dst = (data_type result_type, destination_op destination_op, field_symbol field) field_src = (field_symbol field, source_op source_op) return_value = (destination_op destination_op, data_type result_type) multi_way_branch_case = (constant case_constant, code_label_symbol case_target) multi_value_block_init = (suif_int bit_offset, value_block block) -- just stubbed out for now global_information_block = C_information_block } From gvanrossum@users.sourceforge.net Sun Apr 7 07:34:41 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 06 Apr 2002 22:34:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.197,2.198 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27058 Modified Files: import.c Log Message: Return bools from functions named is_(). Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.197 retrieving revision 2.198 diff -C2 -d -r2.197 -r2.198 *** import.c 31 Mar 2002 14:37:44 -0000 2.197 --- import.c 7 Apr 2002 06:34:38 -0000 2.198 *************** *** 215,221 **** return NULL; #ifdef WITH_THREAD ! return PyInt_FromLong(import_lock_thread != -1); #else ! return PyInt_FromLong(0); #endif } --- 215,221 ---- return NULL; #ifdef WITH_THREAD ! return PyBool_FromLong(import_lock_thread != -1); #else ! return PyBool_FromLong(0); #endif } *************** *** 2296,2300 **** if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) return NULL; ! return PyInt_FromLong(is_builtin(name)); } --- 2296,2300 ---- if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) return NULL; ! return PyBool_FromLong(is_builtin(name)); } *************** *** 2307,2311 **** return NULL; p = find_frozen(name); ! return PyInt_FromLong((long) (p == NULL ? 0 : p->size)); } --- 2307,2311 ---- return NULL; p = find_frozen(name); ! return PyBool_FromLong((long) (p == NULL ? 0 : p->size)); } From gvanrossum@users.sourceforge.net Sun Apr 7 07:28:03 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 06 Apr 2002 22:28:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.154,2.155 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25994 Modified Files: fileobject.c Log Message: isatty() should return a bool. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.154 retrieving revision 2.155 diff -C2 -d -r2.154 -r2.155 *** fileobject.c 3 Apr 2002 22:41:51 -0000 2.154 --- fileobject.c 7 Apr 2002 06:28:00 -0000 2.155 *************** *** 566,570 **** res = isatty((int)fileno(f->f_fp)); Py_END_ALLOW_THREADS ! return PyInt_FromLong(res); } --- 566,570 ---- res = isatty((int)fileno(f->f_fp)); Py_END_ALLOW_THREADS ! return PyBool_FromLong(res); } From jhylton@users.sourceforge.net Sat Apr 6 23:55:58 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sat, 06 Apr 2002 15:55:58 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox/ast/tests - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast/tests In directory usw-pr-cvs1:/tmp/cvs-serv23433/tests Log Message: Directory /cvsroot/python/python/nondist/sandbox/ast/tests added to the repository From jhylton@users.sourceforge.net Sun Apr 7 00:04:56 2002 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Sat, 06 Apr 2002 16:04:56 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox/ast README,NONE,1.1 asdl.py,NONE,1.1 python.asdl,NONE,1.1 spark.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv25236 Added Files: README asdl.py python.asdl spark.py Log Message: New ast definition and tools. asdl.py: an ASDL parser based on spark spark.py: John Aycock's little language toolkit python.asdl: an in-progress AST for Python tests/: a collector of .asdl files to test asdl.py --- NEW FILE: README --- This sandbox contains code to support the creation of a new AST for the builtin Python compiler. For discussion, see compiler-sig@python.org. --- NEW FILE: asdl.py --- """An implementation of the Zephyr Abstract Syntax Definition Language. See http://asdl.sourceforge.net/ and http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html. Only supports top level module decl, not view. I'm guessing that view is intended to support the browser and I'm not interested in the browser. """ #__metaclass__ = type import spark class Token: # spark seems to dispatch in the parser based on a token's # type attribute def __init__(self, type, lineno): self.type = type self.lineno = lineno def __str__(self): return self.type def __repr__(self): return str(self) class Id(Token): def __init__(self, value, lineno): self.type = 'Id' self.value = value self.lineno = lineno def __str__(self): return self.value class ASDLSyntaxError: def __init__(self, lineno, token=None, msg=None): self.lineno = lineno self.token = token self.msg = msg def __str__(self): if self.msg is None: return "Error at '%s', line %d" % (self.token, self.lineno) else: return "%s, line %d" % (self.msg, self.lineno) class ASDLScanner(spark.GenericScanner, object): def tokenize(self, input): self.rv = [] self.lineno = 1 super(ASDLScanner, self).tokenize(input) return self.rv def t_id(self, s): r"[\w\.]+" # XXX doesn't distinguish upper vs. lower, which is # significant for ASDL. self.rv.append(Id(s, self.lineno)) def t_xxx(self, s): # not sure what this production means r"<=" self.rv.append(Token(s, self.lineno)) def t_punctuation(self, s): r"[\{\}\*\=\|\(\)\,\?\:]" self.rv.append(Token(s, self.lineno)) def t_comment(self, s): r"\-\-[^\n]*" pass def t_newline(self, s): r"\n" self.lineno += 1 def t_whitespace(self, s): r"[ \t]+" pass def t_default(self, s): r" . +" raise ValueError, "unmatched input: %s" % `s` class ASDLParser(spark.GenericParser, object): def __init__(self): super(ASDLParser, self).__init__("module") def typestring(self, tok): return tok.type def error(self, tok): raise ASDLSyntaxError(tok.lineno, tok) def p_module_0(self, (module, name, _0, _1)): " module ::= Id Id { } " if module.value != "module": raise ASDLSyntaxError(module.lineno, msg="expected 'module', found %s" % module) return Module(name, None) def p_module(self, (module, name, _0, definitions, _1)): " module ::= Id Id { definitions } " if module.value != "module": raise ASDLSyntaxError(module.lineno, msg="expected 'module', found %s" % module) return Module(name, definitions) def p_definition_0(self, (definition,)): " definitions ::= definition " return definition def p_definition_1(self, (definitions, definition)): " definitions ::= definition definitions " return definitions + definition def p_definition(self, (id, _, type)): " definition ::= Id = type " return [Type(id, type)] def p_type_0(self, (product,)): " type ::= product " return product def p_type_1(self, (sum,)): " type ::= sum " return Sum(sum) def p_type_2(self, (sum, id, _0, attributes, _1)): " type ::= sum Id ( fields ) " if id.value != "attributes": raise ASDLSyntaxError(id.lineno, msg="expected attributes, found %s" % id) return Sum(sum, attributes) def p_product(self, (_0, fields, _1)): " product ::= ( fields ) " return fields def p_sum_0(self, (constructor,)): " sum ::= constructor """ return [constructor] def p_sum_1(self, (constructor, _, sum)): " sum ::= constructor | sum " return [constructor] + sum def p_sum_2(self, (constructor, _, sum)): " sum ::= constructor | sum " return [constructor] + sum def p_constructor_0(self, (id,)): " constructor ::= Id " return Constructor(id) def p_constructor_1(self, (id, _0, fields, _1)): " constructor ::= Id ( fields ) " return Constructor(id, fields) def p_fields_0(self, (field,)): " fields ::= field " return [field] def p_fields_1(self, (field, _, fields)): " fields ::= field , fields " return fields + [field] def p_field_0(self, (type,)): " field ::= Id " return Field(type) def p_field_1(self, (type, name)): " field ::= Id Id " return Field(type, name) def p_field_2(self, (type, _, name)): " field ::= Id * Id " return Field(type, name, seq=1) def p_field_3(self, (type, _, name)): " field ::= Id ? Id " return Field(type, name, opt=1) def p_field_4(self, (type, _)): " field ::= Id * " return Field(type, seq=1) def p_field_5(self, (type, _)): " field ::= Id ? " return Field(type, opt=1) # below is a collection of classes to capture the AST of an AST :-) # not sure if any of the methods are useful yet, but I'm adding them # piecemeal as they seem helpful class Module: def __init__(self, name, dfns): self.name = name self.dfns = dfns self.types = {} # maps type name to value (from dfns) for type in dfns: self.types[type.name.value] = type.value def __repr__(self): return "Module(%s, %s)" % (self.name, self.dfns) def get_type_names(self): """Return names opf all types even those contained in other types""" # to aid debugging, can use to make sure all types have # top-level definitions def get_type_names(t): if isinstance(t, Type): return [t.name.value] + get_type_names(t.value) elif isinstance(t, Constructor): l = [t.name.value] if t.fields is None: return l for f in t.fields: l += get_type_names(f) return l elif isinstance(t, Field): return [t.type.value] elif isinstance(t, Sum): l = [] for e in t.types: l += get_type_names(e) return l else: return [] names = reduce(runique, [get_type_names(t) for t in self.dfns]) # capitals are for type constructors return [name for name in names if name[0].lower() == name[0]] def runique(x, y): """Return the unique elements of two sequences""" d = {} [d.__setitem__(elt, 0) for elt in x] # I'm feeling perverse today [d.__setitem__(elt, 0) for elt in y] return d.keys() class Type: def __init__(self, name, value): self.name = name self.value = value def __repr__(self): return "Type(%s, %s)" % (self.name, self.value) class Constructor: def __init__(self, name, fields=None): self.name = name self.fields = fields def __repr__(self): return "Constructor(%s, %s)" % (self.name, self.fields) class Field: def __init__(self, type, name=None, seq=0, opt=0): self.type = type self.name = name self.seq = seq self.opt = opt def __repr__(self): if self.seq: extra = ", seq=1" elif self.opt: extra = ", opt=1" else: extra = "" if self.name is None: return "Field(%s%s)" % (self.type, extra) else: return "Field(%s, %s,%s)" % (self.type, self.name, extra) class Sum: def __init__(self, types, attributes=None): self.types = types self.attributes = attributes def __repr__(self): if self.attributes is None: return "Sum(%s)" % self.types else: return "Sum(%s, %s)" % (self.types, self.attributes) def parse(file): scanner = ASDLScanner() parser = ASDLParser() buf = open(file).read() tokens = scanner.tokenize(buf) try: return parser.parse(tokens) except ASDLSyntaxError, err: print err lines = buf.split("\n") print lines[err.lineno - 1] # lines starts at 0, files at 1 if __name__ == "__main__": import glob import sys if len(sys.argv) > 1: files = sys.argv[1:] else: testdir = "tests" files = glob.glob(testdir + "/*.asdl") for file in files: print file mod = parse(file) print "module", mod.name print len(mod.dfns), "definitions" for dfn in mod.dfns: print dfn --- NEW FILE: python.asdl --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spark.py --- # Copyright (c) 1998-2002 John Aycock # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. __version__ = 'SPARK-0.7 (pre-alpha-5)' import re import sys import string def _namelist(instance): namelist, namedict, classlist = [], {}, [instance.__class__] for c in classlist: for b in c.__bases__: classlist.append(b) for name in c.__dict__.keys(): if not namedict.has_key(name): namelist.append(name) namedict[name] = 1 return namelist class GenericScanner: def __init__(self, flags=0): pattern = self.reflect() self.re = re.compile(pattern, re.VERBOSE|flags) self.index2func = {} for name, number in self.re.groupindex.items(): self.index2func[number-1] = getattr(self, 't_' + name) def makeRE(self, name): doc = getattr(self, name).__doc__ rv = '(?P<%s>%s)' % (name[2:], doc) return rv def reflect(self): rv = [] for name in _namelist(self): if name[:2] == 't_' and name != 't_default': rv.append(self.makeRE(name)) rv.append(self.makeRE('t_default')) return string.join(rv, '|') def error(self, s, pos): print "Lexical error at position %s" % pos raise SystemExit def tokenize(self, s): pos = 0 n = len(s) while pos < n: m = self.re.match(s, pos) if m is None: self.error(s, pos) groups = m.groups() for i in range(len(groups)): if groups[i] and self.index2func.has_key(i): self.index2func[i](groups[i]) pos = m.end() def t_default(self, s): r'( . | \n )+' print "Specification error: unmatched input" raise SystemExit # # Extracted from GenericParser and made global so that [un]picking works. # class _State: def __init__(self, stateno, items): self.T, self.complete, self.items = [], [], items self.stateno = stateno class GenericParser: # # An Earley parser, as per J. Earley, "An Efficient Context-Free # Parsing Algorithm", CACM 13(2), pp. 94-102. Also J. C. Earley, # "An Efficient Context-Free Parsing Algorithm", Ph.D. thesis, # Carnegie-Mellon University, August 1968. New formulation of # the parser according to J. Aycock, "Practical Earley Parsing # and the SPARK Toolkit", Ph.D. thesis, University of Victoria, # 2001, and J. Aycock and R. N. Horspool, "Practical Earley # Parsing", unpublished paper, 2001. # def __init__(self, start): self.rules = {} self.rule2func = {} self.rule2name = {} self.collectRules() self.augment(start) self.ruleschanged = 1 _NULLABLE = '\e_' _START = 'START' _BOF = '|-' # # When pickling, take the time to generate the full state machine; # some information is then extraneous, too. Unfortunately we # can't save the rule2func map. # def __getstate__(self): if self.ruleschanged: # # XXX - duplicated from parse() # self.computeNull() self.newrules = {} self.new2old = {} self.makeNewRules() self.ruleschanged = 0 self.edges, self.cores = {}, {} self.states = { 0: self.makeState0() } self.makeState(0, self._BOF) # # XXX - should find a better way to do this.. # changes = 1 while changes: changes = 0 for k, v in self.edges.items(): if v is None: state, sym = k if self.states.has_key(state): self.goto(state, sym) changes = 1 rv = self.__dict__.copy() for s in self.states.values(): del s.items del rv['rule2func'] del rv['nullable'] del rv['cores'] return rv def __setstate__(self, D): self.rules = {} self.rule2func = {} self.rule2name = {} self.collectRules() start = D['rules'][self._START][0][1][1] # Blech. self.augment(start) D['rule2func'] = self.rule2func D['makeSet'] = self.makeSet_fast self.__dict__ = D # # A hook for GenericASTBuilder and GenericASTMatcher. Mess # thee not with this; nor shall thee toucheth the _preprocess # argument to addRule. # def preprocess(self, rule, func): return rule, func def addRule(self, doc, func, _preprocess=1): fn = func rules = string.split(doc) index = [] for i in range(len(rules)): if rules[i] == '::=': index.append(i-1) index.append(len(rules)) for i in range(len(index)-1): lhs = rules[index[i]] rhs = rules[index[i]+2:index[i+1]] rule = (lhs, tuple(rhs)) if _preprocess: rule, fn = self.preprocess(rule, func) if self.rules.has_key(lhs): self.rules[lhs].append(rule) else: self.rules[lhs] = [ rule ] self.rule2func[rule] = fn self.rule2name[rule] = func.__name__[2:] self.ruleschanged = 1 def collectRules(self): for name in _namelist(self): if name[:2] == 'p_': func = getattr(self, name) doc = func.__doc__ self.addRule(doc, func) def augment(self, start): rule = '%s ::= %s %s' % (self._START, self._BOF, start) self.addRule(rule, lambda args: args[1], 0) def computeNull(self): self.nullable = {} tbd = [] for rulelist in self.rules.values(): lhs = rulelist[0][0] self.nullable[lhs] = 0 for rule in rulelist: rhs = rule[1] if len(rhs) == 0: self.nullable[lhs] = 1 continue # # We only need to consider rules which # consist entirely of nonterminal symbols. # This should be a savings on typical # grammars. # for sym in rhs: if not self.rules.has_key(sym): break else: tbd.append(rule) changes = 1 while changes: changes = 0 for lhs, rhs in tbd: if self.nullable[lhs]: continue for sym in rhs: if not self.nullable[sym]: break else: self.nullable[lhs] = 1 changes = 1 def makeState0(self): s0 = _State(0, []) for rule in self.newrules[self._START]: s0.items.append((rule, 0)) return s0 def finalState(self, tokens): # # Yuck. # if len(self.newrules[self._START]) == 2 and len(tokens) == 0: return 1 start = self.rules[self._START][0][1][1] return self.goto(1, start) def makeNewRules(self): worklist = [] for rulelist in self.rules.values(): for rule in rulelist: worklist.append((rule, 0, 1, rule)) for rule, i, candidate, oldrule in worklist: lhs, rhs = rule n = len(rhs) while i < n: sym = rhs[i] if not self.rules.has_key(sym) or \ not self.nullable[sym]: candidate = 0 i = i + 1 continue newrhs = list(rhs) newrhs[i] = self._NULLABLE+sym newrule = (lhs, tuple(newrhs)) worklist.append((newrule, i+1, candidate, oldrule)) candidate = 0 i = i + 1 else: if candidate: lhs = self._NULLABLE+lhs rule = (lhs, rhs) if self.newrules.has_key(lhs): self.newrules[lhs].append(rule) else: self.newrules[lhs] = [ rule ] self.new2old[rule] = oldrule def typestring(self, token): return None def error(self, token): print "Syntax error at or near `%s' token" % token raise SystemExit def parse(self, tokens): sets = [ [(1,0), (2,0)] ] self.links = {} if self.ruleschanged: self.computeNull() self.newrules = {} self.new2old = {} self.makeNewRules() self.ruleschanged = 0 self.edges, self.cores = {}, {} self.states = { 0: self.makeState0() } self.makeState(0, self._BOF) for i in xrange(len(tokens)): sets.append([]) if sets[i] == []: break self.makeSet(tokens[i], sets, i) else: sets.append([]) self.makeSet(None, sets, len(tokens)) #_dump(tokens, sets, self.states) finalitem = (self.finalState(tokens), 0) if finalitem not in sets[-2]: if len(tokens) > 0: self.error(tokens[i-1]) else: self.error(None) return self.buildTree(self._START, finalitem, tokens, len(sets)-2) def isnullable(self, sym): # # For symbols in G_e only. If we weren't supporting 1.5, # could just use sym.startswith(). # return self._NULLABLE == sym[0:len(self._NULLABLE)] def skip(self, (lhs, rhs), pos=0): n = len(rhs) while pos < n: if not self.isnullable(rhs[pos]): break pos = pos + 1 return pos def makeState(self, state, sym): assert sym is not None # # Compute \epsilon-kernel state's core and see if # it exists already. # kitems = [] for rule, pos in self.states[state].items: lhs, rhs = rule if rhs[pos:pos+1] == (sym,): kitems.append((rule, self.skip(rule, pos+1))) core = kitems core.sort() tcore = tuple(core) if self.cores.has_key(tcore): return self.cores[tcore] # # Nope, doesn't exist. Compute it and the associated # \epsilon-nonkernel state together; we'll need it right away. # k = self.cores[tcore] = len(self.states) K, NK = _State(k, kitems), _State(k+1, []) self.states[k] = K predicted = {} edges = self.edges rules = self.newrules for X in K, NK: worklist = X.items for item in worklist: rule, pos = item lhs, rhs = rule if pos == len(rhs): X.complete.append(rule) continue nextSym = rhs[pos] key = (X.stateno, nextSym) if not rules.has_key(nextSym): if not edges.has_key(key): edges[key] = None X.T.append(nextSym) else: edges[key] = None if not predicted.has_key(nextSym): predicted[nextSym] = 1 for prule in rules[nextSym]: ppos = self.skip(prule) new = (prule, ppos) NK.items.append(new) # # Problem: we know K needs generating, but we # don't yet know about NK. Can't commit anything # regarding NK to self.edges until we're sure. Should # we delay committing on both K and NK to avoid this # hacky code? This creates other problems.. # if X is K: edges = {} if NK.items == []: return k # # Check for \epsilon-nonkernel's core. Unfortunately we # need to know the entire set of predicted nonterminals # to do this without accidentally duplicating states. # core = predicted.keys() core.sort() tcore = tuple(core) if self.cores.has_key(tcore): self.edges[(k, None)] = self.cores[tcore] return k nk = self.cores[tcore] = self.edges[(k, None)] = NK.stateno self.edges.update(edges) self.states[nk] = NK return k def goto(self, state, sym): key = (state, sym) if not self.edges.has_key(key): # # No transitions from state on sym. # return None rv = self.edges[key] if rv is None: # # Target state isn't generated yet. Remedy this. # rv = self.makeState(state, sym) self.edges[key] = rv return rv def gotoT(self, state, t): return [self.goto(state, t)] def gotoST(self, state, st): rv = [] for t in self.states[state].T: if st == t: rv.append(self.goto(state, t)) return rv def add(self, set, item, i=None, predecessor=None, causal=None): if predecessor is None: if item not in set: set.append(item) else: key = (item, i) if item not in set: self.links[key] = [] set.append(item) self.links[key].append((predecessor, causal)) def makeSet(self, token, sets, i): cur, next = sets[i], sets[i+1] ttype = token is not None and self.typestring(token) or None if ttype is not None: fn, arg = self.gotoT, ttype else: fn, arg = self.gotoST, token for item in cur: ptr = (item, i) state, parent = item add = fn(state, arg) for k in add: if k is not None: self.add(next, (k, parent), i+1, ptr) nk = self.goto(k, None) if nk is not None: self.add(next, (nk, i+1)) if parent == i: continue for rule in self.states[state].complete: lhs, rhs = rule for pitem in sets[parent]: pstate, pparent = pitem k = self.goto(pstate, lhs) if k is not None: why = (item, i, rule) pptr = (pitem, parent) self.add(cur, (k, pparent), i, pptr, why) nk = self.goto(k, None) if nk is not None: self.add(cur, (nk, i)) def makeSet_fast(self, token, sets, i): # # Call *only* when the entire state machine has been built! # It relies on self.edges being filled in completely, and # then duplicates and inlines code to boost speed at the # cost of extreme ugliness. # cur, next = sets[i], sets[i+1] ttype = token is not None and self.typestring(token) or None for item in cur: ptr = (item, i) state, parent = item if ttype is not None: k = self.edges.get((state, ttype), None) if k is not None: #self.add(next, (k, parent), i+1, ptr) #INLINED --v new = (k, parent) key = (new, i+1) if new not in next: self.links[key] = [] next.append(new) self.links[key].append((ptr, None)) #INLINED --^ #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: #self.add(next, (nk, i+1)) #INLINED --v new = (nk, i+1) if new not in next: next.append(new) #INLINED --^ else: add = self.gotoST(state, token) for k in add: if k is not None: self.add(next, (k, parent), i+1, ptr) #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: self.add(next, (nk, i+1)) if parent == i: continue for rule in self.states[state].complete: lhs, rhs = rule for pitem in sets[parent]: pstate, pparent = pitem #k = self.goto(pstate, lhs) k = self.edges.get((pstate, lhs), None) if k is not None: why = (item, i, rule) pptr = (pitem, parent) #self.add(cur, (k, pparent), # i, pptr, why) #INLINED --v new = (k, pparent) key = (new, i) if new not in cur: self.links[key] = [] cur.append(new) self.links[key].append((pptr, why)) #INLINED --^ #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: #self.add(cur, (nk, i)) #INLINED --v new = (nk, i) if new not in cur: cur.append(new) #INLINED --^ def predecessor(self, key, causal): for p, c in self.links[key]: if c == causal: return p assert 0 def causal(self, key): links = self.links[key] if len(links) == 1: return links[0][1] choices = [] rule2cause = {} for p, c in links: rule = c[2] choices.append(rule) rule2cause[rule] = c return rule2cause[self.ambiguity(choices)] def deriveEpsilon(self, nt): if len(self.newrules[nt]) > 1: rule = self.ambiguity(self.newrules[nt]) else: rule = self.newrules[nt][0] #print rule rhs = rule[1] attr = [None] * len(rhs) for i in range(len(rhs)-1, -1, -1): attr[i] = self.deriveEpsilon(rhs[i]) return self.rule2func[self.new2old[rule]](attr) def buildTree(self, nt, item, tokens, k): state, parent = item choices = [] for rule in self.states[state].complete: if rule[0] == nt: choices.append(rule) rule = choices[0] if len(choices) > 1: rule = self.ambiguity(choices) #print rule rhs = rule[1] attr = [None] * len(rhs) for i in range(len(rhs)-1, -1, -1): sym = rhs[i] if not self.newrules.has_key(sym): if sym != self._BOF: attr[i] = tokens[k-1] key = (item, k) item, k = self.predecessor(key, None) #elif self.isnullable(sym): elif self._NULLABLE == sym[0:len(self._NULLABLE)]: attr[i] = self.deriveEpsilon(sym) else: key = (item, k) why = self.causal(key) attr[i] = self.buildTree(sym, why[0], tokens, why[1]) item, k = self.predecessor(key, why) return self.rule2func[self.new2old[rule]](attr) def ambiguity(self, rules): # # XXX - problem here and in collectRules() if the same rule # appears in >1 method. Also undefined results if rules # causing the ambiguity appear in the same method. # sortlist = [] name2index = {} for i in range(len(rules)): lhs, rhs = rule = rules[i] name = self.rule2name[self.new2old[rule]] sortlist.append((len(rhs), name)) name2index[name] = i sortlist.sort() list = map(lambda (a,b): b, sortlist) return rules[name2index[self.resolve(list)]] def resolve(self, list): # # Resolve ambiguity in favor of the shortest RHS. # Since we walk the tree from the top down, this # should effectively resolve in favor of a "shift". # return list[0] # # GenericASTBuilder automagically constructs a concrete/abstract syntax tree # for a given input. The extra argument is a class (not an instance!) # which supports the "__setslice__" and "__len__" methods. # # XXX - silently overrides any user code in methods. # class GenericASTBuilder(GenericParser): def __init__(self, AST, start): GenericParser.__init__(self, start) self.AST = AST def preprocess(self, rule, func): rebind = lambda lhs, self=self: \ lambda args, lhs=lhs, self=self: \ self.buildASTNode(args, lhs) lhs, rhs = rule return rule, rebind(lhs) def buildASTNode(self, args, lhs): children = [] for arg in args: if isinstance(arg, self.AST): children.append(arg) else: children.append(self.terminal(arg)) return self.nonterminal(lhs, children) def terminal(self, token): return token def nonterminal(self, type, args): rv = self.AST(type) rv[:len(args)] = args return rv # # GenericASTTraversal is a Visitor pattern according to Design Patterns. For # each node it attempts to invoke the method n_, falling # back onto the default() method if the n_* can't be found. The preorder # traversal also looks for an exit hook named n__exit (no default # routine is called if it's not found). To prematurely halt traversal # of a subtree, call the prune() method -- this only makes sense for a # preorder traversal. Node type is determined via the typestring() method. # class GenericASTTraversalPruningException: pass class GenericASTTraversal: def __init__(self, ast): self.ast = ast def typestring(self, node): return node.type def prune(self): raise GenericASTTraversalPruningException def preorder(self, node=None): if node is None: node = self.ast try: name = 'n_' + self.typestring(node) if hasattr(self, name): func = getattr(self, name) func(node) else: self.default(node) except GenericASTTraversalPruningException: return for kid in node: self.preorder(kid) name = name + '_exit' if hasattr(self, name): func = getattr(self, name) func(node) def postorder(self, node=None): if node is None: node = self.ast for kid in node: self.postorder(kid) name = 'n_' + self.typestring(node) if hasattr(self, name): func = getattr(self, name) func(node) else: self.default(node) def default(self, node): pass # # GenericASTMatcher. AST nodes must have "__getitem__" and "__cmp__" # implemented. # # XXX - makes assumptions about how GenericParser walks the parse tree. # class GenericASTMatcher(GenericParser): def __init__(self, start, ast): GenericParser.__init__(self, start) self.ast = ast def preprocess(self, rule, func): rebind = lambda func, self=self: \ lambda args, func=func, self=self: \ self.foundMatch(args, func) lhs, rhs = rule rhslist = list(rhs) rhslist.reverse() return (lhs, tuple(rhslist)), rebind(func) def foundMatch(self, args, func): func(args[-1]) return args[-1] def match_r(self, node): self.input.insert(0, node) children = 0 for child in node: if children == 0: self.input.insert(0, '(') children = children + 1 self.match_r(child) if children > 0: self.input.insert(0, ')') def match(self, ast=None): if ast is None: ast = self.ast self.input = [] self.match_r(ast) self.parse(self.input) def resolve(self, list): # # Resolve ambiguity in favor of the longest RHS. # return list[-1] def _dump(tokens, sets, states): for i in range(len(sets)): print 'set', i for item in sets[i]: print '\t', item for (lhs, rhs), pos in states[item[0]].items: print '\t\t', lhs, '::=', print string.join(rhs[:pos]), print '.', print string.join(rhs[pos:]) if i < len(tokens): print print 'token', str(tokens[i]) print From gvanrossum@users.sourceforge.net Sun Apr 7 07:36:26 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 06 Apr 2002 22:36:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib CGIHTTPServer.py,1.23,1.24 StringIO.py,1.21,1.22 chunk.py,1.11,1.12 dospath.py,1.26,1.27 fileinput.py,1.9,1.10 gzip.py,1.30,1.31 macpath.py,1.34,1.35 ntpath.py,1.46,1.47 os2emxpath.py,1.2,1.3 posixpath.py,1.47,1.48 pprint.py,1.20,1.21 pydoc.py,1.61,1.62 rfc822.py,1.66,1.67 sre_parse.py,1.52,1.53 statcache.py,1.11,1.12 threading.py,1.22,1.23 urllib2.py,1.26,1.27 zipfile.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27254 Modified Files: CGIHTTPServer.py StringIO.py chunk.py dospath.py fileinput.py gzip.py macpath.py ntpath.py os2emxpath.py posixpath.py pprint.py pydoc.py rfc822.py sre_parse.py statcache.py threading.py urllib2.py zipfile.py Log Message: Partial introduction of bools where appropriate. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CGIHTTPServer.py 4 Apr 2002 22:55:58 -0000 1.23 --- CGIHTTPServer.py 7 Apr 2002 06:36:22 -0000 1.24 *************** *** 308,312 **** st = os.stat(path) except os.error: ! return 0 return st[0] & 0111 != 0 --- 308,312 ---- st = os.stat(path) except os.error: ! return False return st[0] & 0111 != 0 Index: StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** StringIO.py 11 Feb 2002 17:52:18 -0000 1.21 --- StringIO.py 7 Apr 2002 06:36:22 -0000 1.22 *************** *** 60,64 **** if self.closed: raise ValueError, "I/O operation on closed file" ! return 0 def seek(self, pos, mode = 0): --- 60,64 ---- if self.closed: raise ValueError, "I/O operation on closed file" ! return False def seek(self, pos, mode = 0): Index: chunk.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/chunk.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** chunk.py 11 May 2001 19:14:51 -0000 1.11 --- chunk.py 7 Apr 2002 06:36:22 -0000 1.12 *************** *** 26,30 **** Usage: ! while 1: try: chunk = Chunk(file) --- 26,30 ---- Usage: ! while True: try: chunk = Chunk(file) *************** *** 32,36 **** break chunktype = chunk.getname() ! while 1: data = chunk.read(nbytes) if not data: --- 32,36 ---- break chunktype = chunk.getname() ! while True: data = chunk.read(nbytes) if not data: *************** *** 50,56 **** class Chunk: ! def __init__(self, file, align = 1, bigendian = 1, inclheader = 0): import struct ! self.closed = 0 self.align = align # whether to align to word (2-byte) boundaries if bigendian: --- 50,56 ---- class Chunk: ! def __init__(self, file, align=True, bigendian=True, inclheader=False): import struct ! self.closed = False self.align = align # whether to align to word (2-byte) boundaries if bigendian: *************** *** 72,78 **** self.offset = self.file.tell() except (AttributeError, IOError): ! self.seekable = 0 else: ! self.seekable = 1 def getname(self): --- 72,78 ---- self.offset = self.file.tell() except (AttributeError, IOError): ! self.seekable = False else: ! self.seekable = True def getname(self): *************** *** 87,98 **** if not self.closed: self.skip() ! self.closed = 1 def isatty(self): if self.closed: raise ValueError, "I/O operation on closed file" ! return 0 ! def seek(self, pos, whence = 0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). --- 87,98 ---- if not self.closed: self.skip() ! self.closed = True def isatty(self): if self.closed: raise ValueError, "I/O operation on closed file" ! return False ! def seek(self, pos, whence=0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). *************** *** 118,122 **** return self.size_read ! def read(self, size = -1): """Read at most size bytes from the chunk. If size is omitted or negative, read until the end --- 118,122 ---- return self.size_read ! def read(self, size=-1): """Read at most size bytes from the chunk. If size is omitted or negative, read until the end Index: dospath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dospath.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dospath.py 4 Apr 2002 22:55:58 -0000 1.26 --- dospath.py 7 Apr 2002 06:36:22 -0000 1.27 *************** *** 142,146 **** This will always return false on systems where posix.lstat doesn't exist.""" ! return 0 --- 142,146 ---- This will always return false on systems where posix.lstat doesn't exist.""" ! return False Index: fileinput.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/fileinput.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** fileinput.py 26 Mar 2002 20:28:40 -0000 1.9 --- fileinput.py 7 Apr 2002 06:36:22 -0000 1.10 *************** *** 155,159 **** self._filelineno = 0 self._file = None ! self._isstdin = 0 self._backupfilename = None self._buffer = [] --- 155,159 ---- self._filelineno = 0 self._file = None ! self._isstdin = False self._backupfilename = None self._buffer = [] *************** *** 215,219 **** except: pass ! self._isstdin = 0 self._buffer = [] self._bufindex = 0 --- 215,219 ---- except: pass ! self._isstdin = False self._buffer = [] self._bufindex = 0 *************** *** 236,245 **** self._filelineno = 0 self._file = None ! self._isstdin = 0 self._backupfilename = 0 if self._filename == '-': self._filename = '' self._file = sys.stdin ! self._isstdin = 1 else: if self._inplace: --- 236,245 ---- self._filelineno = 0 self._file = None ! self._isstdin = False self._backupfilename = 0 if self._filename == '-': self._filename = '' self._file = sys.stdin ! self._isstdin = True else: if self._inplace: Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** gzip.py 20 Mar 2002 18:36:00 -0000 1.30 --- gzip.py 7 Apr 2002 06:36:22 -0000 1.31 *************** *** 48,52 **** self.mode = READ # Set flag indicating start of a new member ! self._new_member = 1 self.extrabuf = "" self.extrasize = 0 --- 48,52 ---- self.mode = READ # Set flag indicating start of a new member ! self._new_member = True self.extrabuf = "" self.extrasize = 0 *************** *** 121,130 **** if flag & FNAME: # Read and discard a null-terminated string containing the filename ! while (1): s=self.fileobj.read(1) if not s or s=='\000': break if flag & FCOMMENT: # Read and discard a null-terminated string containing a comment ! while (1): s=self.fileobj.read(1) if not s or s=='\000': break --- 121,130 ---- if flag & FNAME: # Read and discard a null-terminated string containing the filename ! while True: s=self.fileobj.read(1) if not s or s=='\000': break if flag & FCOMMENT: # Read and discard a null-terminated string containing a comment ! while True: s=self.fileobj.read(1) if not s or s=='\000': break *************** *** 157,161 **** if size < 0: # get the whole thing try: ! while 1: self._read(readsize) readsize = readsize * 2 --- 157,161 ---- if size < 0: # get the whole thing try: ! while True: self._read(readsize) readsize = readsize * 2 *************** *** 202,206 **** self._read_gzip_header() self.decompress = zlib.decompressobj(-zlib.MAX_WBITS) ! self._new_member = 0 # Read a chunk of data from the file --- 202,206 ---- self._read_gzip_header() self.decompress = zlib.decompressobj(-zlib.MAX_WBITS) ! self._new_member = False # Read a chunk of data from the file *************** *** 230,234 **** # a new member on the next call self._read_eof() ! self._new_member = 1 def _add_read_data(self, data): --- 230,234 ---- # a new member on the next call self._read_eof() ! self._new_member = True def _add_read_data(self, data): *************** *** 276,280 **** def isatty(self): ! return 0 def tell(self): --- 276,280 ---- def isatty(self): ! return False def tell(self): *************** *** 287,291 **** raise IOError("Can't rewind in write mode") self.fileobj.seek(0) ! self._new_member = 1 self.extrabuf = "" self.extrasize = 0 --- 287,291 ---- raise IOError("Can't rewind in write mode") self.fileobj.seek(0) ! self._new_member = True self.extrabuf = "" self.extrasize = 0 *************** *** 312,316 **** bufs = [] readsize = min(100, size) # Read from the file in small chunks ! while 1: if size == 0: return "".join(bufs) # Return resulting line --- 312,316 ---- bufs = [] readsize = min(100, size) # Read from the file in small chunks ! while True: if size == 0: return "".join(bufs) # Return resulting line *************** *** 343,347 **** line = self.readline() if line == "": break ! L.append( line ) sizehint = sizehint - len(line) --- 343,347 ---- line = self.readline() if line == "": break ! L.append(line) sizehint = sizehint - len(line) *************** *** 391,395 **** f = __builtin__.open(arg, "rb") g = open(arg + ".gz", "wb") ! while 1: chunk = f.read(1024) if not chunk: --- 391,395 ---- f = __builtin__.open(arg, "rb") g = open(arg + ".gz", "wb") ! while True: chunk = f.read(1024) if not chunk: Index: macpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** macpath.py 4 Apr 2002 22:55:58 -0000 1.34 --- macpath.py 7 Apr 2002 06:36:23 -0000 1.35 *************** *** 126,130 **** Always false on the Mac, until we understand Aliases.)""" ! return 0 --- 126,130 ---- Always false on the Mac, until we understand Aliases.)""" ! return False *************** *** 135,139 **** st = os.stat(s) except os.error: ! return 0 return S_ISREG(st[ST_MODE]) --- 135,139 ---- st = os.stat(s) except os.error: ! return False return S_ISREG(st[ST_MODE]) Index: ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** ntpath.py 4 Apr 2002 22:55:58 -0000 1.46 --- ntpath.py 7 Apr 2002 06:36:23 -0000 1.47 *************** *** 236,240 **** def islink(path): """Test for symbolic link. On WindowsNT/95 always returns false""" ! return 0 --- 236,240 ---- def islink(path): """Test for symbolic link. On WindowsNT/95 always returns false""" ! return False *************** *** 260,264 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISDIR(st[stat.ST_MODE]) --- 260,264 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISDIR(st[stat.ST_MODE]) *************** *** 273,277 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISREG(st[stat.ST_MODE]) --- 273,277 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISREG(st[stat.ST_MODE]) Index: os2emxpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os2emxpath.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** os2emxpath.py 4 Apr 2002 22:55:58 -0000 1.2 --- os2emxpath.py 7 Apr 2002 06:36:23 -0000 1.3 *************** *** 195,199 **** def islink(path): """Test for symbolic link. On OS/2 always returns false""" ! return 0 --- 195,199 ---- def islink(path): """Test for symbolic link. On OS/2 always returns false""" ! return False *************** *** 217,221 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISDIR(st[stat.ST_MODE]) --- 217,221 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISDIR(st[stat.ST_MODE]) *************** *** 230,234 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISREG(st[stat.ST_MODE]) --- 230,234 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISREG(st[stat.ST_MODE]) Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** posixpath.py 4 Apr 2002 22:55:58 -0000 1.47 --- posixpath.py 7 Apr 2002 06:36:23 -0000 1.48 *************** *** 159,163 **** st = os.lstat(path) except (os.error, AttributeError): ! return 0 return stat.S_ISLNK(st[stat.ST_MODE]) --- 159,163 ---- st = os.lstat(path) except (os.error, AttributeError): ! return False return stat.S_ISLNK(st[stat.ST_MODE]) *************** *** 184,188 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISDIR(st[stat.ST_MODE]) --- 184,188 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISDIR(st[stat.ST_MODE]) *************** *** 197,201 **** st = os.stat(path) except os.error: ! return 0 return stat.S_ISREG(st[stat.ST_MODE]) --- 197,201 ---- st = os.stat(path) except os.error: ! return False return stat.S_ISREG(st[stat.ST_MODE]) *************** *** 336,340 **** _varprog = re.compile(r'\$(\w+|\{[^}]*\})') i = 0 ! while 1: m = _varprog.search(path, i) if not m: --- 336,340 ---- _varprog = re.compile(r'\$(\w+|\{[^}]*\})') i = 0 ! while True: m = _varprog.search(path, i) if not m: Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pprint.py 2 Apr 2002 05:08:35 -0000 1.20 --- pprint.py 7 Apr 2002 06:36:23 -0000 1.21 *************** *** 127,132 **** if objid in context: stream.write(_recursion(object)) ! self.__recursive = 1 ! self.__readable = 0 return rep = self.__repr(object, context, level - 1) --- 127,132 ---- if objid in context: stream.write(_recursion(object)) ! self.__recursive = True ! self.__readable = False return rep = self.__repr(object, context, level - 1) *************** *** 196,202 **** self.__depth, level) if not readable: ! self.__readable = 0 if recursive: ! self.__recursive = 1 return repr --- 196,202 ---- self.__depth, level) if not readable: ! self.__readable = False if recursive: ! self.__recursive = True return repr *************** *** 215,219 **** if typ is StringType: if 'locale' not in _sys_modules: ! return `object`, 1, 0 if "'" in object and '"' not in object: closure = '"' --- 215,219 ---- if typ is StringType: if 'locale' not in _sys_modules: ! return `object`, True, False if "'" in object and '"' not in object: closure = '"' *************** *** 230,246 **** else: write(qget(char, `char`[1:-1])) ! return ("%s%s%s" % (closure, sio.getvalue(), closure)), 1, 0 if typ is DictType: if not object: ! return "{}", 1, 0 objid = _id(object) if maxlevels and level > maxlevels: ! return "{...}", 0, objid in context if objid in context: ! return _recursion(object), 0, 1 context[objid] = 1 ! readable = 1 ! recursive = 0 components = [] append = components.append --- 230,246 ---- else: write(qget(char, `char`[1:-1])) ! return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False if typ is DictType: if not object: ! return "{}", True, False objid = _id(object) if maxlevels and level > maxlevels: ! return "{...}", False, objid in context if objid in context: ! return _recursion(object), False, True context[objid] = 1 ! readable = True ! recursive = False components = [] append = components.append *************** *** 253,257 **** readable = readable and kreadable and vreadable if krecur or vrecur: ! recursive = 1 del context[objid] return "{%s}" % _commajoin(components), readable, recursive --- 253,257 ---- readable = readable and kreadable and vreadable if krecur or vrecur: ! recursive = True del context[objid] return "{%s}" % _commajoin(components), readable, recursive *************** *** 260,264 **** if typ is ListType: if not object: ! return "[]", 1, 0 format = "[%s]" elif _len(object) == 1: --- 260,264 ---- if typ is ListType: if not object: ! return "[]", True, False format = "[%s]" elif _len(object) == 1: *************** *** 266,279 **** else: if not object: ! return "()", 1, 0 format = "(%s)" objid = _id(object) if maxlevels and level > maxlevels: ! return format % "...", 0, objid in context if objid in context: ! return _recursion(object), 0, 1 context[objid] = 1 ! readable = 1 ! recursive = 0 components = [] append = components.append --- 266,279 ---- else: if not object: ! return "()", True, False format = "(%s)" objid = _id(object) if maxlevels and level > maxlevels: ! return format % "...", False, objid in context if objid in context: ! return _recursion(object), False, True context[objid] = 1 ! readable = True ! recursive = False components = [] append = components.append *************** *** 283,294 **** append(orepr) if not oreadable: ! readable = 0 if orecur: ! recursive = 1 del context[objid] return format % _commajoin(components), readable, recursive rep = `object` ! return rep, (rep and not rep.startswith('<')), 0 --- 283,294 ---- append(orepr) if not oreadable: ! readable = False if orecur: ! recursive = True del context[objid] return format % _commajoin(components), readable, recursive rep = `object` ! return rep, (rep and not rep.startswith('<')), False Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** pydoc.py 4 Apr 2002 22:55:58 -0000 1.61 --- pydoc.py 7 Apr 2002 06:36:23 -0000 1.62 *************** *** 444,448 **** r'PEP[- ]?(\d+)|' r'(self\.)?(\w+))') ! while 1: match = pattern.search(text, here) if not match: break --- 444,448 ---- r'PEP[- ]?(\d+)|' r'(self\.)?(\w+))') ! while True: match = pattern.search(text, here) if not match: break *************** *** 1522,1526 **** def interact(self): self.output.write('\n') ! while 1: self.output.write('help> ') self.output.flush() --- 1522,1526 ---- def interact(self): self.output.write('\n') ! while True: self.output.write('help> ') self.output.flush() *************** *** 1711,1718 **** self.inodes.append(inode) # detect circular symbolic links return ispackage(dir) def run(self, callback, key=None, completer=None): if key: key = lower(key) ! self.quit = 0 seen = {} --- 1711,1719 ---- self.inodes.append(inode) # detect circular symbolic links return ispackage(dir) + return False def run(self, callback, key=None, completer=None): if key: key = lower(key) ! self.quit = False seen = {} *************** *** 1826,1830 **** def serve_until_quit(self): import select ! self.quit = 0 while not self.quit: rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) --- 1827,1831 ---- def serve_until_quit(self): import select ! self.quit = False while not self.quit: rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** rfc822.py 20 Dec 2001 15:54:48 -0000 1.66 --- rfc822.py 7 Apr 2002 06:36:23 -0000 1.67 *************** *** 223,227 **** free-text data. """ ! return None def getallmatchingheaders(self, name): --- 223,227 ---- free-text data. """ ! return False def getallmatchingheaders(self, name): Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** sre_parse.py 11 Feb 2002 18:18:29 -0000 1.52 --- sre_parse.py 7 Apr 2002 06:36:23 -0000 1.53 *************** *** 222,230 **** # check that group name is a valid string if not isident(name[0]): ! return 0 for char in name: if not isident(char) and not isdigit(char): ! return 0 ! return 1 def _group(escape, groups): --- 222,230 ---- # check that group name is a valid string if not isident(name[0]): ! return False for char in name: if not isident(char) and not isdigit(char): ! return False ! return True def _group(escape, groups): Index: statcache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/statcache.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** statcache.py 15 Feb 2001 22:15:13 -0000 1.11 --- statcache.py 7 Apr 2002 06:36:23 -0000 1.12 *************** *** 74,77 **** st = stat(path) except _os.error: ! return 0 return S_ISDIR(st[ST_MODE]) --- 74,77 ---- st = stat(path) except _os.error: ! return False return S_ISDIR(st[ST_MODE]) Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** threading.py 4 Apr 2002 22:55:58 -0000 1.22 --- threading.py 7 Apr 2002 06:36:23 -0000 1.23 *************** *** 31,35 **** # Debug support (adapted from ihooks.py) ! _VERBOSE = 0 if __debug__: --- 31,35 ---- # Debug support (adapted from ihooks.py) ! _VERBOSE = 0 # XXX Bool or int? if __debug__: *************** *** 199,203 **** endtime = _time() + timeout delay = 0.0005 # 500 us -> initial delay of 1 ms ! while 1: gotit = waiter.acquire(0) if gotit: --- 199,203 ---- endtime = _time() + timeout delay = 0.0005 # 500 us -> initial delay of 1 ms ! while True: gotit = waiter.acquire(0) if gotit: *************** *** 257,261 **** def acquire(self, blocking=1): ! rc = 0 self.__cond.acquire() while self.__value == 0: --- 257,261 ---- def acquire(self, blocking=1): ! rc = False self.__cond.acquire() while self.__value == 0: *************** *** 271,275 **** self._note("%s.acquire: success, value=%s", self, self.__value) ! rc = 1 self.__cond.release() return rc --- 271,275 ---- self._note("%s.acquire: success, value=%s", self, self.__value) ! rc = True self.__cond.release() return rc *************** *** 310,314 **** _Verbose.__init__(self, verbose) self.__cond = Condition(Lock()) ! self.__flag = 0 def isSet(self): --- 310,314 ---- _Verbose.__init__(self, verbose) self.__cond = Condition(Lock()) ! self.__flag = False def isSet(self): *************** *** 317,321 **** def set(self): self.__cond.acquire() ! self.__flag = 1 self.__cond.notifyAll() self.__cond.release() --- 317,321 ---- def set(self): self.__cond.acquire() ! self.__flag = True self.__cond.notifyAll() self.__cond.release() *************** *** 323,327 **** def clear(self): self.__cond.acquire() ! self.__flag = 0 self.__cond.release() --- 323,327 ---- def clear(self): self.__cond.acquire() ! self.__flag = False self.__cond.release() *************** *** 349,353 **** class Thread(_Verbose): ! __initialized = 0 def __init__(self, group=None, target=None, name=None, --- 349,353 ---- class Thread(_Verbose): ! __initialized = False def __init__(self, group=None, target=None, name=None, *************** *** 360,367 **** self.__kwargs = kwargs self.__daemonic = self._set_daemon() ! self.__started = 0 ! self.__stopped = 0 self.__block = Condition(Lock()) ! self.__initialized = 1 def _set_daemon(self): --- 360,367 ---- self.__kwargs = kwargs self.__daemonic = self._set_daemon() ! self.__started = False ! self.__stopped = False self.__block = Condition(Lock()) ! self.__initialized = True def _set_daemon(self): *************** *** 389,393 **** _active_limbo_lock.release() _start_new_thread(self.__bootstrap, ()) ! self.__started = 1 _sleep(0.000001) # 1 usec, to let the thread run (Solaris hack) --- 389,393 ---- _active_limbo_lock.release() _start_new_thread(self.__bootstrap, ()) ! self.__started = True _sleep(0.000001) # 1 usec, to let the thread run (Solaris hack) *************** *** 398,402 **** def __bootstrap(self): try: ! self.__started = 1 _active_limbo_lock.acquire() _active[_get_ident()] = self --- 398,402 ---- def __bootstrap(self): try: ! self.__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self *************** *** 429,433 **** def __stop(self): self.__block.acquire() ! self.__stopped = 1 self.__block.notifyAll() self.__block.release() --- 429,433 ---- def __stop(self): self.__block.acquire() ! self.__stopped = True self.__block.notifyAll() self.__block.release() *************** *** 524,528 **** def __init__(self): Thread.__init__(self, name="MainThread") ! self._Thread__started = 1 _active_limbo_lock.acquire() _active[_get_ident()] = self --- 524,528 ---- def __init__(self): Thread.__init__(self, name="MainThread") ! self._Thread__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self *************** *** 532,536 **** def _set_daemon(self): ! return 0 def __exitfunc(self): --- 532,536 ---- def _set_daemon(self): ! return False def __exitfunc(self): *************** *** 565,569 **** def __init__(self): Thread.__init__(self, name=_newname("Dummy-%d")) ! self._Thread__started = 1 _active_limbo_lock.acquire() _active[_get_ident()] = self --- 565,569 ---- def __init__(self): Thread.__init__(self, name=_newname("Dummy-%d")) ! self._Thread__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self *************** *** 571,578 **** def _set_daemon(self): ! return 1 def join(self, timeout=None): ! assert 0, "cannot join a dummy thread" --- 571,578 ---- def _set_daemon(self): ! return True def join(self, timeout=None): ! assert False, "cannot join a dummy thread" Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** urllib2.py 18 Mar 2002 08:37:19 -0000 1.26 --- urllib2.py 7 Apr 2002 06:36:23 -0000 1.27 *************** *** 547,557 **** """ if base == test: ! return 1 if base[0] != test[0]: ! return 0 common = posixpath.commonprefix((base[1], test[1])) if len(common) == len(base[1]): ! return 1 ! return 0 --- 547,557 ---- """ if base == test: ! return True if base[0] != test[0]: ! return False common = posixpath.commonprefix((base[1], test[1])) if len(common) == len(base[1]): ! return True ! return False Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** zipfile.py 6 Dec 2001 06:23:25 -0000 1.20 --- zipfile.py 7 Apr 2002 06:36:23 -0000 1.21 *************** *** 84,90 **** fpin.close() if endrec[0:4] == "PK\005\006" and endrec[-2:] == "\000\000": ! return 1 # file has correct magic number except IOError: pass --- 84,91 ---- fpin.close() if endrec[0:4] == "PK\005\006" and endrec[-2:] == "\000\000": ! return True # file has correct magic number except IOError: pass + return False From gvanrossum@users.sourceforge.net Sun Apr 7 07:32:24 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 06 Apr 2002 22:32:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules threadmodule.c,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv26745 Modified Files: threadmodule.c Log Message: Lock methods acquire() and locked() now return bools. Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -d -r2.48 -r2.49 *** threadmodule.c 31 Mar 2002 15:27:00 -0000 2.48 --- threadmodule.c 7 Apr 2002 06:32:21 -0000 2.49 *************** *** 69,83 **** } else ! return PyInt_FromLong((long)i); } static char acquire_doc[] = ! "acquire([wait]) -> None or Boolean\n\ (PyThread_acquire_lock() is an obsolete synonym)\n\ \n\ Lock the lock. Without argument, this blocks if the lock is already\n\ locked (even by the same thread), waiting for another thread to release\n\ ! the lock, and return None when the lock is acquired.\n\ ! With a Boolean argument, this will only block if the argument is true,\n\ and the return value reflects whether the lock is acquired.\n\ The blocking operation is not interruptible."; --- 69,83 ---- } else ! return PyBool_FromLong((long)i); } static char acquire_doc[] = ! "acquire([wait]) -> None or bool\n\ (PyThread_acquire_lock() is an obsolete synonym)\n\ \n\ Lock the lock. Without argument, this blocks if the lock is already\n\ locked (even by the same thread), waiting for another thread to release\n\ ! the lock, and return None once the lock is acquired.\n\ ! With an argument, this will only block if the argument is true,\n\ and the return value reflects whether the lock is acquired.\n\ The blocking operation is not interruptible."; *************** *** 111,121 **** if (PyThread_acquire_lock(self->lock_lock, 0)) { PyThread_release_lock(self->lock_lock); ! return PyInt_FromLong(0L); } ! return PyInt_FromLong(1L); } static char locked_doc[] = ! "locked() -> Boolean\n\ (locked_lock() is an obsolete synonym)\n\ \n\ --- 111,121 ---- if (PyThread_acquire_lock(self->lock_lock, 0)) { PyThread_release_lock(self->lock_lock); ! return PyBool_FromLong(0L); } ! return PyBool_FromLong(1L); } static char locked_doc[] = ! "locked() -> bool\n\ (locked_lock() is an obsolete synonym)\n\ \n\ From loewis@users.sourceforge.net Sun Apr 7 17:29:38 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Sun, 07 Apr 2002 09:29:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib knee.py,1.5,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14802/Lib Removed Files: knee.py Log Message: Move knee.py from Lib/ to Demo/imputil/. Fixes #515745. --- knee.py DELETED --- From loewis@users.sourceforge.net Sun Apr 7 17:29:38 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Sun, 07 Apr 2002 09:29:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Demo/imputil knee.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/imputil In directory usw-pr-cvs1:/tmp/cvs-serv14802/Demo/imputil Added Files: knee.py Log Message: Move knee.py from Lib/ to Demo/imputil/. Fixes #515745. --- NEW FILE: knee.py --- """An Python re-implementation of hierarchical module import. This code is intended to be read, not executed. However, it does work -- all you need to do to enable it is "import knee". (The name is a pun on the klunkier predecessor of this module, "ni".) """ import sys, imp, __builtin__ # Replacement for __import__() def import_hook(name, globals=None, locals=None, fromlist=None): parent = determine_parent(globals) q, tail = find_head_package(parent, name) m = load_tail(q, tail) if not fromlist: return q if hasattr(m, "__path__"): ensure_fromlist(m, fromlist) return m def determine_parent(globals): if not globals or not globals.has_key("__name__"): return None pname = globals['__name__'] if globals.has_key("__path__"): parent = sys.modules[pname] assert globals is parent.__dict__ return parent if '.' in pname: i = pname.rfind('.') pname = pname[:i] parent = sys.modules[pname] assert parent.__name__ == pname return parent return None def find_head_package(parent, name): if '.' in name: i = name.find('.') head = name[:i] tail = name[i+1:] else: head = name tail = "" if parent: qname = "%s.%s" % (parent.__name__, head) else: qname = head q = import_module(head, qname, parent) if q: return q, tail if parent: qname = head parent = None q = import_module(head, qname, parent) if q: return q, tail raise ImportError, "No module named " + qname def load_tail(q, tail): m = q while tail: i = tail.find('.') if i < 0: i = len(tail) head, tail = tail[:i], tail[i+1:] mname = "%s.%s" % (m.__name__, head) m = import_module(head, mname, m) if not m: raise ImportError, "No module named " + mname return m def ensure_fromlist(m, fromlist, recursive=0): for sub in fromlist: if sub == "*": if not recursive: try: all = m.__all__ except AttributeError: pass else: ensure_fromlist(m, all, 1) continue if sub != "*" and not hasattr(m, sub): subname = "%s.%s" % (m.__name__, sub) submod = import_module(sub, subname, m) if not submod: raise ImportError, "No module named " + subname def import_module(partname, fqname, parent): try: return sys.modules[fqname] except KeyError: pass try: fp, pathname, stuff = imp.find_module(partname, parent and parent.__path__) except ImportError: return None try: m = imp.load_module(fqname, fp, pathname, stuff) finally: if fp: fp.close() if parent: setattr(parent, partname, m) return m # Replacement for reload() def reload_hook(module): name = module.__name__ if '.' not in name: return import_module(name, name, None) i = name.rfind('.') pname = name[:i] parent = sys.modules[pname] return import_module(name[i+1:], name, parent) # Save the original hooks original_import = __builtin__.__import__ original_reload = __builtin__.reload # Now install our hooks __builtin__.__import__ = import_hook __builtin__.reload = reload_hook From jackjansen@users.sourceforge.net Sun Apr 7 22:59:29 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sun, 07 Apr 2002 14:59:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Distributions/(vise) Python 2.2.vct,1.6.4.2.2.2,1.6.4.2.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv26129/Python 2.2/Mac/Distributions/(vise) Modified Files: Tag: release22-maint Python 2.2.vct Log Message: Files used for 2.2.1 release (unless disaster strikes in the next 24 hours). Index: Python 2.2.vct =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/(vise)/Python 2.2.vct,v retrieving revision 1.6.4.2.2.2 retrieving revision 1.6.4.2.2.3 diff -C2 -d -r1.6.4.2.2.2 -r1.6.4.2.2.3 Binary files /tmp/cvsvY7uNe and /tmp/cvs1GjIBv differ From jackjansen@users.sourceforge.net Sun Apr 7 22:59:34 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sun, 07 Apr 2002 14:59:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac ReadMe,1.38.4.2.2.2,1.38.4.2.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac In directory usw-pr-cvs1:/tmp/cvs-serv26363/Python 2.2/Mac Modified Files: Tag: release22-maint ReadMe Log Message: Files used for 2.2.1 release (unless disaster strikes in the next 24 hours). Index: ReadMe =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/ReadMe,v retrieving revision 1.38.4.2.2.2 retrieving revision 1.38.4.2.2.3 diff -C2 -d -r1.38.4.2.2.2 -r1.38.4.2.2.3 *** ReadMe 25 Mar 2002 14:53:11 -0000 1.38.4.2.2.2 --- ReadMe 7 Apr 2002 21:59:32 -0000 1.38.4.2.2.3 *************** *** 87,90 **** --- 87,94 ---- mktime(), this will be fixed later (it is not a very serious problem). + test_email will fail during summer (no kidding:-). Actually, it will fail + when DST is active, because the date parsing test is GMT-centric + and does not handle the Macintosh's localtime very well. + Three tests will fail on MacOS9 with MemoryErrors: test_longexp, test_sha and test_zlib (on MacOSX these should pass). From jackjansen@users.sourceforge.net Sun Apr 7 22:59:40 2002 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sun, 07 Apr 2002 14:59:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include macbuildno.h,1.22.4.2.2.1,1.22.4.2.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv26401/Python 2.2/Mac/Include Modified Files: Tag: release22-maint macbuildno.h Log Message: File used for 2.2.1 distribution, unless disaster strikes in next 24 hours. Index: macbuildno.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/macbuildno.h,v retrieving revision 1.22.4.2.2.1 retrieving revision 1.22.4.2.2.2 diff -C2 -d -r1.22.4.2.2.1 -r1.22.4.2.2.2 *** macbuildno.h 19 Mar 2002 10:59:34 -0000 1.22.4.2.2.1 --- macbuildno.h 7 Apr 2002 21:59:38 -0000 1.22.4.2.2.2 *************** *** 1 **** ! #define BUILD 132 --- 1 ---- ! #define BUILD 133 From loewis@users.sourceforge.net Mon Apr 8 15:51:33 2002 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Mon, 08 Apr 2002 07:51:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/lib-tk tkFileDialog.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv30702 Modified Files: tkFileDialog.py Log Message: Patch #539392: Invoke setlocale, try opening the file in demo mode. Index: tkFileDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tkFileDialog.py 2 Jan 2002 16:38:19 -0000 1.6 --- tkFileDialog.py 8 Apr 2002 14:51:31 -0000 1.7 *************** *** 131,143 **** # Start off with UTF-8 enc = "utf-8" # See whether CODESET is defined try: import locale enc = locale.nl_langinfo(locale.CODESET) except (ImportError, AttributeError): pass ! print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc) ! print "saveas", asksaveasfilename().encode(enc) --- 131,159 ---- # Start off with UTF-8 enc = "utf-8" + import sys # See whether CODESET is defined try: import locale + locale.setlocale(locale.LC_ALL,'') enc = locale.nl_langinfo(locale.CODESET) except (ImportError, AttributeError): pass ! # dialog for openening files ! ! openfilename=askopenfilename(filetypes=[("all files", "*")]) ! try: ! fp=open(openfilename,"r") ! fp.close() ! except: ! print "Could not open File: " ! print sys.exc_info()[1] ! ! print "open", openfilename.encode(enc) ! ! # dialog for saving files ! ! saveasfilename=asksaveasfilename() ! print "saveas", saveasfilename.encode(enc) From gvanrossum@users.sourceforge.net Mon Apr 8 02:39:58 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 07 Apr 2002 18:39:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.126.4.6,2.126.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16741/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: - A type can now inherit its metatype from its base type. Previously, when PyType_Ready() was called, if ob_type was found to be NULL, it was always set to &PyType_Type; now it is set to base->ob_type, where base is tp_base, defaulting to &PyObject_Type. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.6 retrieving revision 2.126.4.7 diff -C2 -d -r2.126.4.6 -r2.126.4.7 *** typeobject.c 5 Apr 2002 22:29:43 -0000 2.126.4.6 --- typeobject.c 8 Apr 2002 01:39:56 -0000 2.126.4.7 *************** *** 2003,2016 **** type->tp_flags |= Py_TPFLAGS_READYING; - /* Initialize ob_type if NULL. This means extensions that want to be - compilable separately on Windows can call PyType_Ready() instead of - initializing the ob_type field of their type objects. */ - if (type->ob_type == NULL) - type->ob_type = &PyType_Type; - /* Initialize tp_base (defaults to BaseObject unless that's us) */ base = type->tp_base; if (base == NULL && type != &PyBaseObject_Type) base = type->tp_base = &PyBaseObject_Type; /* Initialize tp_bases */ --- 2003,2016 ---- type->tp_flags |= Py_TPFLAGS_READYING; /* Initialize tp_base (defaults to BaseObject unless that's us) */ base = type->tp_base; if (base == NULL && type != &PyBaseObject_Type) base = type->tp_base = &PyBaseObject_Type; + + /* Initialize ob_type if NULL. This means extensions that want to be + compilable separately on Windows can call PyType_Ready() instead of + initializing the ob_type field of their type objects. */ + if (type->ob_type == NULL) + type->ob_type = base->ob_type; /* Initialize tp_bases */ From gvanrossum@users.sourceforge.net Mon Apr 8 02:39:58 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 07 Apr 2002 18:39:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.337.2.4.2.17,1.337.2.4.2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv16741/Misc Modified Files: Tag: release22-maint NEWS Log Message: - A type can now inherit its metatype from its base type. Previously, when PyType_Ready() was called, if ob_type was found to be NULL, it was always set to &PyType_Type; now it is set to base->ob_type, where base is tp_base, defaulting to &PyObject_Type. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.17 retrieving revision 1.337.2.4.2.18 diff -C2 -d -r1.337.2.4.2.17 -r1.337.2.4.2.18 *** NEWS 5 Apr 2002 22:53:16 -0000 1.337.2.4.2.17 --- NEWS 8 Apr 2002 01:39:56 -0000 1.337.2.4.2.18 *************** *** 21,24 **** --- 21,29 ---- C API + - A type can now inherit its metatype from its base type. Previously, + when PyType_Ready() was called, if ob_type was found to be NULL, it + was always set to &PyType_Type; now it is set to base->ob_type, + where base is tp_base, defaulting to &PyObject_Type. + - PyType_Ready() accidentally did not inherit tp_is_gc; now it does. From tim_one@users.sourceforge.net Mon Apr 8 05:19:52 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 07 Apr 2002 21:19:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.141.6.3,2.141.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15221/221/Objects Modified Files: Tag: release22-maint fileobject.c Log Message: SF bug 538827: Python open w/ MSVC6: bad error msgs. open_the_file: Some (not all) flavors of Windows set errno to EINVAL when passed a syntactically invalid filename. Python turned that into an incomprehensible complaint about the mode string. Fixed by special-casing MSVC. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.141.6.3 retrieving revision 2.141.6.4 diff -C2 -d -r2.141.6.3 -r2.141.6.4 *** fileobject.c 17 Mar 2002 15:55:50 -0000 2.141.6.3 --- fileobject.c 8 Apr 2002 04:19:50 -0000 2.141.6.4 *************** *** 129,134 **** } #endif if (errno == EINVAL) ! PyErr_Format(PyExc_IOError, "invalid argument: %s", mode); else --- 129,147 ---- } #endif + #ifdef _MSC_VER + /* MSVC 6 (Microsoft) leaves errno at 0 for bad mode strings, + * across all Windows flavors. When it sets EINVAL varies + * across Windows flavors, the exact conditions aren't + * documented, and the answer lies in the OS's implementation + * of Win32's CreateFile function (whose source is secret). + * Seems the best we can do is map EINVAL to ENOENT. + */ + if (errno == 0) /* bad mode string */ + errno = EINVAL; + else if (errno == EINVAL) /* unknown, but not a mode string */ + errno = ENOENT; + #endif if (errno == EINVAL) ! PyErr_Format(PyExc_IOError, "invalid mode: %s", mode); else From fdrake@users.sourceforge.net Mon Apr 8 06:23:45 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 07 Apr 2002 22:23:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimp.tex,1.28,1.28.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25979/lib Modified Files: Tag: release21-maint libimp.tex Log Message: Do not call "knee" a standard module. This addresses the issue in SF bug #515745. Index: libimp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimp.tex,v retrieving revision 1.28 retrieving revision 1.28.4.1 diff -C2 -d -r1.28 -r1.28.4.1 *** libimp.tex 17 Jan 2001 05:12:13 -0000 1.28 --- libimp.tex 8 Apr 2002 05:23:43 -0000 1.28.4.1 *************** *** 243,247 **** A more complete example that implements hierarchical module names and includes a \function{reload()}\bifuncindex{reload} function can be ! found in the standard module \module{knee}\refstmodindex{knee} (which ! is intended as an example only --- don't rely on any part of it being ! a standard interface). --- 243,245 ---- A more complete example that implements hierarchical module names and includes a \function{reload()}\bifuncindex{reload} function can be ! found in the module \module{knee}\refmodindex{knee}. From gvanrossum@users.sourceforge.net Mon Apr 8 02:38:44 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 07 Apr 2002 18:38:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.380,1.381 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv16348/Misc Modified Files: NEWS Log Message: - A type can now inherit its metatype from its base type. Previously, when PyType_Ready() was called, if ob_type was found to be NULL, it was always set to &PyType_Type; now it is set to base->ob_type, where base is tp_base, defaulting to &PyObject_Type. - PyType_Ready() accidentally did not inherit tp_is_gc; now it does. Bugfix candidate. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.380 retrieving revision 1.381 diff -C2 -d -r1.380 -r1.381 *** NEWS 6 Apr 2002 01:05:00 -0000 1.380 --- NEWS 8 Apr 2002 01:38:42 -0000 1.381 *************** *** 124,127 **** --- 124,134 ---- C API + - A type can now inherit its metatype from its base type. Previously, + when PyType_Ready() was called, if ob_type was found to be NULL, it + was always set to &PyType_Type; now it is set to base->ob_type, + where base is tp_base, defaulting to &PyObject_Type. + + - PyType_Ready() accidentally did not inherit tp_is_gc; now it does. + - Objects allocated using the new PyMalloc_New and PyMalloc_NewVar functions will be allocated using pymalloc if it is enabled. These From bwarsaw@users.sourceforge.net Mon Apr 8 16:51:10 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 08 Apr 2002 08:51:10 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.175,1.176 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28590 Modified Files: pep-0000.txt Log Message: PEP 289, Generator Comprehensions, Raymond Hettinger Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -d -r1.175 -r1.176 *** pep-0000.txt 8 Apr 2002 15:45:44 -0000 1.175 --- pep-0000.txt 8 Apr 2002 15:51:07 -0000 1.176 *************** *** 152,155 **** --- 152,156 ---- SR 271 Prefixing sys.path by command line option Giacometti SD 288 Generators Attributes and Exceptions Hettinger + SR 289 Generator Comprehensions Hettinger SR 666 Reject Foolish Indentation Creighton *************** *** 266,269 **** --- 267,271 ---- S 287 reStructuredText Standard Docstring Format Goodger SD 288 Generators Attributes and Exceptions Hettinger + SR 289 Generator Comprehensions Hettinger SR 666 Reject Foolish Indentation Creighton From bwarsaw@users.sourceforge.net Mon Apr 8 16:51:19 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 08 Apr 2002 08:51:19 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0289.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28679 Added Files: pep-0289.txt Log Message: PEP 289, Generator Comprehensions, Raymond Hettinger --- NEW FILE: pep-0289.txt --- PEP: 289 Title: Generator Comprehensions Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/04/08 15:51:17 $ Author: python@rcn.com (Raymond D. Hettinger) Status: Rejected Type: Standards Track Created: 30-Jan-2002 Python-Version: 2.3 Post-History: Abstract This PEP introduces generator comprehensions as an idea for enhancing the generators introduced in Python version 2.2 [1]. The goal is to increase the convenience, utility, and power of generators by making it easy to convert a list comprehension into a generator. Rationale Python 2.2 introduced the concept of an iterable interface as proposed in PEP 234 [4]. The iter() factory function was provided as common calling convention and deep changes were made to use iterators as a unifying theme throughout Python. The unification came in the form of establishing a common iterable interface for mappings, sequences, and file objects. Generators, as proposed in PEP 255 [1], were introduced as a means for making it easier to create iterators, especially ones with complex internal execution or variable states. When I created new programs, generators were often the tool of choice for creating an iterator. However, when updating existing programs, I found that the tool had another use, one that improved program function as well as structure. Some programs exhibited a pattern of creating large lists and then looping over them. As data sizes increased, the programs encountered scalability limitations owing to excessive memory consumption (and malloc time) for the intermediate lists. Generators were found to be directly substitutable for the lists while eliminating the memory issues through lazy evaluation a.k.a. just in time manufacturing. Python itself encountered similar issues. As a result, xrange() and xreadlines() were introduced. And, in the case of file objects and mappings, just-in-time evaluation became the norm. Generators provide a tool to program memory conserving for-loops whenever complete evaluation is not desired because of memory restrictions or availability of data. The next step in the evolution of generators is to establish a generator alternative to list comprehensions [3]. This alternative provides a simple way to convert a list comprehension into a generator whenever memory issues arise. This suggestion is designed to take advantage of the existing implementation and require little additional effort to incorporate. It is backward compatible and requires no new keywords. BDFL Pronouncements Generator comprehensions are REJECTED. The rationale is that the benefits are marginal since generators can already be coded directly and the costs are high because implementation and maintenance require major efforts with the parser. Reference Implementation There is not currently a CPython implementation; however, a simulation module written in pure Python is available on SourceForge [5]. The simulation is meant to allow direct experimentation with the proposal. There is also a module [6] with working source code for all of the examples used in this PEP. It serves as a test suite for the simulator and it documents how each the new feature works in practice. The authors and implementers of PEP 255 [1] were contacted to provide their assessment of whether these enhancements were going to be straight-forward to implement and require only minor modification of the existing generator code. Neil felt the assertion was correct. Ka-Ping thought so also. GvR said he could believe that it was true. Later GvR re-assessed and thought that it would be difficult to tweak the code generator to produce a separate object. Tim did not have an opportunity to give an assessment. Specification for Generator Comprehensions : If a list comprehension starts with a 'yield' keyword, then express the comprehension with a generator. For example: g = [yield (len(line),line) for line in file if len(line)>5] This would be implemented as if it had been written: def __temp(self): for line in file: if len(line) > 5: yield (len(line), line) g = __temp() Note A: There is some discussion about whether the enclosing brackets should be part of the syntax for generator comprehensions. On the plus side, it neatly parallels list comprehensions and would be immediately recognizable as a similar form with similar internal syntax (taking maximum advantage of what people already know). More importantly, it sets off the generator comprehension from the rest of the function so as to not suggest that the enclosing function is a generator (currently the only cue that a function is really a generator is the presence of the yield keyword). On the minus side, the brackets may falsely suggest that the whole expression returns a list. Most of the feedback received to date indicates that brackets are helpful and not misleading. Unfortunately, the one dissent is from GvR. A key advantage of the generator comprehension syntax is that it makes it trivially easy to transform existing list comprehension code to a generator by adding yield. Likewise, it can be converted back to a list by deleting yield. This makes it easy to scale-up programs from small datasets to ones large enough to warrant just in time evaluation. Note B: List comprehensions expose their looping variable and leave that variable in the enclosing scope. The code, [str(i) for i in range(8)] leaves 'i' set to 7 in the scope where the comprehension appears. This behavior is by design and reflects an intent to duplicate the result of coding a for-loop instead of a list comprehension. Further, the variable 'i' is in a defined and potentially useful state on the line immediately following the list comprehension. In contrast, generator comprehensions do not expose the looping variable to the enclosing scope. The code, [yield str(i) for i in range(8)] leaves 'i' untouched in the scope where the comprehension appears. This is also by design and reflects an intent to duplicate the result of coding a generator directly instead of a generator comprehension. Further, the variable 'i' is not in a defined state on the line immediately following the list comprehension. It does not come into existence until iteration starts (possibly never). Comments from GvR: Cute hack, but I think the use of the [] syntax strongly suggests that it would return a list, not an iterator. I also think that this is trying to turn Python into a functional language, where most algorithms use lazy infinite sequences, and I just don't think that's where its future lies. I don't think it's worth the trouble. I expect it will take a lot of work to hack it into the code generator: it has to create a separate code object in order to be a generator. List comprehensions are inlined, so I expect that the generator comprehension code generator can't share much with the list comprehension code generator. And this for something that's not that common and easily done by writing a 2-line helper function. IOW the ROI isn't high enough. Comments from Ka-Ping Yee: I am very happy with the things you have proposed in this PEP. I feel quite positive about generator comprehensions and have no reservations. So a +1 on that. Comments from Neil Schemenauer: I'm -0 on the generator list comprehensions. They don't seem to add much. You could easily use a nested generator to do the same thing. They smell like lambda. Comments from Magnus Lie Hetland: Generator comprehensions seem mildly useful, but I vote +0. Defining a separate, named generator would probably be my preference. On the other hand, I do see the advantage of "scaling up" from list comprehensions. Comments from the Community: The response to the generator comprehension proposal has been mostly favorable. There were some 0 votes from people who didn't see a real need or who were not energized by the idea. Some of the 0 votes were tempered by comments that the reviewer did not even like list comprehensions or did not have any use for generators in any form. The +1 votes outnumbered the 0 votes by about two to one. Author response: I've studied several syntactical variations and concluded that the brackets are essential for: - teachability (it's like a list comprehension) - set-off (yield applies to the comprehension not the enclosing function) - substitutability (list comprehensions can be made lazy just by adding yield) What I like best about generator comprehensions is that I can design using list comprehensions and then easily switch to a generator (by adding yield) in response to scalability requirements (when the list comprehension produces too large of an intermediate result). Had generators already been in-place when list comprehensions were accepted, the yield option might have been incorporated from the start. For certain, the mathematical style notation is explicit and readable as compared to a separate function definition with an embedded yield. References [1] PEP 255 Simple Generators http://python.sourceforge.net/peps/pep-0255.html [2] PEP 212 Loop Counter Iteration http://python.sourceforge.net/peps/pep-0212.html [3] PEP 202 List Comprehensions http://python.sourceforge.net/peps/pep-0202.html [4] PEP 234 Iterators http://python.sourceforge.net/peps/pep-0234.html [5] A pure Python simulation of every feature in this PEP is at: http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17348&aid=513752 [6] The full, working source code for each of the examples in this PEP along with other examples and tests is at: http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17412&aid=513756 Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil fill-column: 70 End: From anthonybaxter@users.sourceforge.net Mon Apr 8 05:42:12 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 21:42:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.187.2.3,2.187.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18851/Modules Modified Files: Tag: release21-maint posixmodule.c Log Message: Backport of bug 457466: "popenx() argument mangling hangs python" [Win9x only]." Can't test this myself, but MarkH sez it's ok. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.187.2.3 retrieving revision 2.187.2.4 diff -C2 -d -r2.187.2.3 -r2.187.2.4 *** posixmodule.c 11 Jul 2001 22:27:38 -0000 2.187.2.3 --- posixmodule.c 8 Apr 2002 04:42:09 -0000 2.187.2.4 *************** *** 2423,2429 **** s2 = (char *)_alloca(x); ZeroMemory(s2, x); sprintf( s2, ! "%s \"%s%s%s\"", modulepath, s1, --- 2423,2435 ---- s2 = (char *)_alloca(x); ZeroMemory(s2, x); + /* To maintain correct argument passing semantics, + we pass the command-line as it stands, and allow + quoting to be applied. w9xpopen.exe will then + use its argv vector, and re-quote the necessary + args for the ultimate child process. + */ sprintf( s2, ! "\"%s\" %s%s%s", modulepath, s1, From anthonybaxter@users.sourceforge.net Mon Apr 8 05:42:12 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 21:42:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/PC w9xpopen.c,1.2,1.2.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv18851/PC Modified Files: Tag: release21-maint w9xpopen.c Log Message: Backport of bug 457466: "popenx() argument mangling hangs python" [Win9x only]." Can't test this myself, but MarkH sez it's ok. Index: w9xpopen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/w9xpopen.c,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -C2 -d -r1.2 -r1.2.6.1 *** w9xpopen.c 14 Aug 2000 05:04:28 -0000 1.2 --- w9xpopen.c 8 Apr 2002 04:42:09 -0000 1.2.6.1 *************** *** 17,23 **** #define WINDOWS_LEAN_AND_MEAN #include const char *usage = ! "This program is used by Python's os.pipe function to\n" "to work around a limitation in Windows 95/98. It is\n" "not designed to be used as stand-alone program."; --- 17,24 ---- #define WINDOWS_LEAN_AND_MEAN #include + #include const char *usage = ! "This program is used by Python's os.popen function to\n" "to work around a limitation in Windows 95/98. It is\n" "not designed to be used as stand-alone program."; *************** *** 29,37 **** PROCESS_INFORMATION pi; DWORD exit_code=0; ! if (argc != 2) { ! MessageBox(NULL, usage, argv[0], MB_OK); return 1; } /* Make child process use this app's standard files. */ --- 30,83 ---- PROCESS_INFORMATION pi; DWORD exit_code=0; + int cmdlen = 0; + int i; + char *cmdline, *cmdlinefill; ! if (argc < 2) { ! if (GetFileType(GetStdHandle(STD_INPUT_HANDLE))==FILE_TYPE_CHAR) ! /* Attached to a console, and therefore not executed by Python ! Display a message box for the inquisitive user ! */ ! MessageBox(NULL, usage, argv[0], MB_OK); ! else { ! /* Eeek - executed by Python, but args are screwed! ! Write an error message to stdout so there is at ! least some clue for the end user when it appears ! in their output. ! A message box would be hidden and blocks the app. ! */ ! fprintf(stdout, "Internal popen error - no args specified\n%s\n", usage); ! } return 1; } + /* Build up the command-line from the args. + Args with a space are quoted, existing quotes are escaped. + To keep things simple calculating the buffer size, we assume + every character is a quote - ie, we allocate double what we need + in the worst case. As this is only double the command line passed + to us, there is a good chance this is reasonably small, so the total + allocation will almost always be < 512 bytes. + */ + for (i=1;i Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv937/Misc Modified Files: Tag: release21-maint NEWS Log Message: beginning the dance of the sugar-plum micro-release. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.12 retrieving revision 1.146.2.13 diff -C2 -d -r1.146.2.12 -r1.146.2.13 *** NEWS 8 Apr 2002 05:03:59 -0000 1.146.2.12 --- NEWS 8 Apr 2002 06:05:51 -0000 1.146.2.13 *************** *** 1,4 **** What's New in Python 2.1.3? ! Release date: XX-XXX-XXXX =========================== --- 1,4 ---- What's New in Python 2.1.3? ! Release date: 08-April-2002 =========================== From gvanrossum@users.sourceforge.net Mon Apr 8 14:29:04 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 08 Apr 2002 06:29:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.246.4.2,2.246.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv32072 Modified Files: Tag: release22-maint bltinmodule.c Log Message: Add bool(), True, False (as ints) for backwards compatibility. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.246.4.2 retrieving revision 2.246.4.3 diff -C2 -d -r2.246.4.2 -r2.246.4.3 *** bltinmodule.c 11 Mar 2002 10:15:00 -0000 2.246.4.2 --- bltinmodule.c 8 Apr 2002 13:29:00 -0000 2.246.4.3 *************** *** 108,111 **** --- 108,131 ---- static PyObject * + builtin_bool(PyObject *self, PyObject *x) + { + long b = PyObject_IsTrue(x); + if (b < 0) + return NULL; + if (b) + x = Py_True; + else + x = Py_False; + Py_INCREF(x); + return x; + } + + static char bool_doc[] = + "bool(x) -> integer\n\ + \n\ + Normalize Boolean: return True (1) when x is true, False (0) otherwise."; + + + static PyObject * builtin_buffer(PyObject *self, PyObject *args) { *************** *** 1774,1777 **** --- 1794,1798 ---- {"abs", builtin_abs, METH_O, abs_doc}, {"apply", builtin_apply, METH_VARARGS, apply_doc}, + {"bool", builtin_bool, METH_O, bool_doc}, {"buffer", builtin_buffer, METH_VARARGS, buffer_doc}, {"callable", builtin_callable, METH_O, callable_doc}, *************** *** 1845,1848 **** --- 1866,1871 ---- SETBUILTIN("Ellipsis", Py_Ellipsis); SETBUILTIN("NotImplemented", Py_NotImplemented); + SETBUILTIN("True", Py_True); + SETBUILTIN("False", Py_False); SETBUILTIN("classmethod", &PyClassMethod_Type); #ifndef WITHOUT_COMPLEX From fdrake@users.sourceforge.net Mon Apr 8 06:23:24 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 07 Apr 2002 22:23:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimp.tex,1.30,1.30.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25933/lib Modified Files: Tag: release22-maint libimp.tex Log Message: Do not call "knee" a standard module. This addresses the issue in SF bug #515745. Index: libimp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimp.tex,v retrieving revision 1.30 retrieving revision 1.30.14.1 diff -C2 -d -r1.30 -r1.30.14.1 *** libimp.tex 30 Aug 2001 05:16:12 -0000 1.30 --- libimp.tex 8 Apr 2002 05:23:22 -0000 1.30.14.1 *************** *** 256,260 **** A more complete example that implements hierarchical module names and includes a \function{reload()}\bifuncindex{reload} function can be ! found in the standard module \module{knee}\refstmodindex{knee} (which ! is intended as an example only --- don't rely on any part of it being ! a standard interface). --- 256,258 ---- A more complete example that implements hierarchical module names and includes a \function{reload()}\bifuncindex{reload} function can be ! found in the module \module{knee}\refmodindex{knee}. From anthonybaxter@users.sourceforge.net Mon Apr 8 07:06:21 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 23:06:21 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.122.2.6,1.122.2.7 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv937 Modified Files: Tag: release21-maint README Log Message: beginning the dance of the sugar-plum micro-release. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.122.2.6 retrieving revision 1.122.2.7 diff -C2 -d -r1.122.2.6 -r1.122.2.7 *** README 15 Jan 2002 22:09:27 -0000 1.122.2.6 --- README 8 Apr 2002 06:05:47 -0000 1.122.2.7 *************** *** 1,3 **** ! This is Python version 2.1.2 ============================ --- 1,3 ---- ! This is Python version 2.1.3 ============================ From fdrake@users.sourceforge.net Mon Apr 8 06:22:33 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 07 Apr 2002 22:22:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimp.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25767/lib Modified Files: libimp.tex Log Message: Do not call "knee" a standard module, and point to the new location. This addresses the issue in SF bug #515745. Index: libimp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimp.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** libimp.tex 30 Aug 2001 05:16:12 -0000 1.30 --- libimp.tex 8 Apr 2002 05:22:30 -0000 1.31 *************** *** 256,260 **** A more complete example that implements hierarchical module names and includes a \function{reload()}\bifuncindex{reload} function can be ! found in the standard module \module{knee}\refstmodindex{knee} (which ! is intended as an example only --- don't rely on any part of it being ! a standard interface). --- 256,260 ---- A more complete example that implements hierarchical module names and includes a \function{reload()}\bifuncindex{reload} function can be ! found in the module \module{knee}\refmodindex{knee}. The ! \module{knee} module can be found in \file{Demo/imputil/} in the ! Python source distribution. From anthonybaxter@users.sourceforge.net Mon Apr 8 06:04:02 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 22:04:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.146.2.11,1.146.2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22884 Modified Files: Tag: release21-maint NEWS Log Message: #457466: "popenx() argument mangling hangs python" [Win9x only] Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.11 retrieving revision 1.146.2.12 diff -C2 -d -r1.146.2.11 -r1.146.2.12 *** NEWS 4 Apr 2002 19:45:01 -0000 1.146.2.11 --- NEWS 8 Apr 2002 05:03:59 -0000 1.146.2.12 *************** *** 11,14 **** --- 11,18 ---- could access a pointer to freed memory. + - SF #457466: popenx() argument mangling hangs python (win9x only). + Under certain circumstances, using any of the popen calls on win9x + would cause python to hang. + Library From bwarsaw@users.sourceforge.net Mon Apr 8 16:44:55 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 08 Apr 2002 08:44:55 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0279.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv25260 Modified Files: pep-0279.txt Log Message: Raymond Hettinger's latest revision. Now marked Accepted. Index: pep-0279.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0279.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0279.txt 5 Apr 2002 19:42:56 -0000 1.10 --- pep-0279.txt 8 Apr 2002 15:44:52 -0000 1.11 *************** *** 4,8 **** Last-Modified: $Date$ Author: python@rcn.com (Raymond D. Hettinger) ! Status: Draft Type: Standards Track Created: 30-Jan-2002 --- 4,8 ---- Last-Modified: $Date$ Author: python@rcn.com (Raymond D. Hettinger) ! Status: Accepted Type: Standards Track Created: 30-Jan-2002 *************** *** 13,106 **** Abstract ! This PEP introduces two orthogonal (not mutually exclusive) ideas ! for enhancing the generators introduced in Python version 2.2 [1]. ! The goal is to increase the convenience, utility, and power ! of generators. Rationale ! Python 2.2 introduced the concept of an iterable interface as proposed ! in PEP 234 [4]. The iter() factory function was provided as common ! calling convention and deep changes were made to use iterators as a ! unifying theme throughout Python. The unification came in the form of ! establishing a common iterable interface for mappings, sequences, ! and file objects. ! ! Generators, as proposed in PEP 255 [1], were introduced as a means for ! making it easier to create iterators, especially ones with complex ! internal execution or variable states. When I created new programs, ! generators were often the tool of choice for creating an iterator. ! ! However, when updating existing programs, I found that the tool had ! another use, one that improved program function as well as structure. ! Some programs exhibited a pattern of creating large lists and then ! looping over them. As data sizes increased, the programs encountered ! scalability limitations owing to excessive memory consumption (and ! malloc time) for the intermediate lists. Generators were found to be ! directly substitutable for the lists while eliminating the memory ! issues through lazy evaluation a.k.a. just in time manufacturing. ! ! Python itself encountered similar issues. As a result, xrange() and ! xreadlines() were introduced. And, in the case of file objects and ! mappings, lazy evaluation became the norm. Generators provide a tool ! to program memory conserving for-loops whenever complete evaluation is ! not desired because of memory restrictions or availability of data. ! ! The next steps in the evolution of generators are: ! ! 1. Add a new builtin function, iterindexed() which was made possible ! once iterators and generators became available. It provides ! all iterables with the same advantage that iteritems() affords ! to dictionaries -- a compact, readable, reliable index notation. ! 2. Establish a generator alternative to list comprehensions [3] ! that provides a simple way to convert a list comprehension into ! a generator whenever memory issues arise. ! All of the suggestions are designed to take advantage of the ! existing implementation and require little additional effort to ! incorporate. Each is backward compatible and requires no new ! keywords. The two generator tools go into Python 2.3 when ! generators become final and are not imported from __future__. BDFL Pronouncements ! 1. The new built-in function is ACCEPTED. There needs to be further ! discussion on the best name for the function. ! ! 2. Generator comprehensions are REJECTED. The rationale is that ! the benefits are marginal since generators can already be coded directly ! and the costs are high because implementation and maintenance require ! major efforts with the parser. ! ! ! Reference Implementation ! ! There is not currently a CPython implementation; however, a simulation ! module written in pure Python is available on SourceForge [5]. The ! simulation covers every feature proposed in this PEP and is meant ! to allow direct experimentation with the proposals. ! ! There is also a module [6] with working source code for all of the ! examples used in this PEP. It serves as a test suite for the simulator ! and it documents how each of the new features works in practice. ! ! The authors and implementers of PEP 255 [1] were contacted to provide ! their assessment of whether these enhancements were going to be ! straight-forward to implement and require only minor modification ! of the existing generator code. Neil felt the assertion was correct. ! Ka-Ping thought so also. GvR said he could believe that it was true. ! Tim did not have an opportunity to give an assessment. ! ! - Specification for a new builtin [ACCEPTED PROPOSAL]: ! def iterindexed(collection): ! 'Generates an indexed series: (0,seqn[0]), (1,seqn[1]) ...' i = 0 it = iter(collection) --- 13,64 ---- Abstract ! This PEP introduces a new built-in function, enumerate() to ! simplify a commonly used looping idiom. It provides all iterable ! collections with the same advantage that iteritems() affords to ! dictionaries -- a compact, readable, reliable index notation. Rationale ! Python 2.2 introduced the concept of an iterable interface as ! proposed in PEP 234 [3]. The iter() factory function was provided ! as common calling convention and deep changes were made to use ! iterators as a unifying theme throughout Python. The unification ! came in the form of establishing a common iterable interface for ! mappings, sequences, and file objects. ! Generators, as proposed in PEP 255 [1], were introduced as a means ! for making it easier to create iterators, especially ones with ! complex internal execution or variable states. The availability ! of generators makes it possible to improve on the loop counter ! ideas in PEP 212 [2]. Those ideas provided a clean syntax for ! iteration with indices and values, but did not apply to all ! iterable objects. Also, that approach did not have the memory ! friendly benefit provided by generators which do not evaluate the ! entire sequence all at once. ! The new proposal is to add a built-in function, enumerate() which ! was made possible once iterators and generators became available. ! It provides all iterables with the same advantage that iteritems() ! affords to dictionaries -- a compact, readable, reliable index ! notation. Like zip(), it is expected to become a commonly used ! looping idiom. + This suggestion is designed to take advantage of the existing + implementation and require little additional effort to + incorporate. It is backwards compatible and requires no new + keywords. The proposal will go into Python 2.3 when generators + become final and are not imported from __future__. BDFL Pronouncements ! The new built-in function is ACCEPTED. + Specification for a new built-in: ! def enumerate(collection): ! 'Generates an indexed series: (0,coll[0]), (1,coll[1]) ...' i = 0 it = iter(collection) *************** *** 109,113 **** i += 1 - Note A: PEP 212 Loop Counter Iteration [2] discussed several proposals for achieving indexing. Some of the proposals only work --- 67,70 ---- *************** *** 117,176 **** not include generators. As a result, the non-generator version in PEP 212 had the disadvantage of consuming memory with a giant list ! of tuples. The generator version presented here is fast and light, ! works with all iterables, and allows users to abandon the sequence ! in mid-stream with no loss of computation effort. ! ! There are other PEPs which touch on related issues: integer iterators, ! integer for-loops, and one for modifying the arguments to range and ! xrange. The iterindexed() proposal does not preclude the other proposals ! and it still meets an important need even if those are adopted -- the need ! to count items in any iterable. The other proposals give a means of ! producing an index but not the corresponding value. This is especially ! problematic if a sequence is given which doesn't support random access ! such as a file object, generator, or sequence defined with __getitem__. ! ! Note B: Almost all of the PEP reviewers welcomed the function but were ! divided as to whether there should be any builtins. The main argument ! for a separate module was to slow the rate of language inflation. The ! main argument for a builtin was that the function is destined to be ! part of a core programming style, applicable to any object with an ! iterable interface. Just as zip() solves the problem of looping ! over multiple sequences, the iterindexed() function solves the loop ! counter problem. ! If only one builtin is allowed, then iterindexed() is the most important ! general purpose tool, solving the broadest class of problems while ! improving program brevity, clarity and reliability. ! Note C: Various alternative names have been proposed: ! iterindexed()-- five syllables is a mouthfull index() -- nice verb but could be confused the .index() method indexed() -- widely liked however adjectives should be avoided count() -- direct and explicit but often used in other contexts itercount() -- direct, explicit and hated by more than one person - enumerate() -- a contender but doesn't mention iteration or indices iteritems() -- conflicts with key:value concept for dictionaries ! Note D: This function was originally proposed with optional start and ! stop arguments. GvR pointed out that the function call ! iterindexed(seqn,4,6) had an alternate, plausible interpretation as a ! slice that would return the fourth and fifth elements of the sequence. ! To avoid the ambiguity, the optional arguments were dropped eventhough ! it meant losing flexibity as a loop counter. That flexiblity was most ! important for the common case of counting from one, as in: ! for linenum, line in iterindexed(source): print linenum, line Comments from GvR: filter and map should die and be subsumed into list ! comprehensions, not grow more variants. I'd rather introduce builtins ! that do iterator algebra (e.g. the iterzip that I've often used as ! an example). ! I like the idea of having some way to iterate over a sequence and ! its index set in parallel. It's fine for this to be a builtin. I don't like the name "indexed"; adjectives do not make good --- 74,143 ---- not include generators. As a result, the non-generator version in PEP 212 had the disadvantage of consuming memory with a giant list ! of tuples. The generator version presented here is fast and ! light, works with all iterables, and allows users to abandon the ! sequence in mid-stream with no loss of computation effort. ! There are other PEPs which touch on related issues: integer ! iterators, integer for-loops, and one for modifying the arguments ! to range and xrange. The enumerate() proposal does not preclude ! the other proposals and it still meets an important need even if ! those are adopted -- the need to count items in any iterable. The ! other proposals give a means of producing an index but not the ! corresponding value. This is especially problematic if a sequence ! is given which doesn't support random access such as a file ! object, generator, or sequence defined with __getitem__. ! Note B: Almost all of the PEP reviewers welcomed the function but ! were divided as to whether there should be any built-ins. The ! main argument for a separate module was to slow the rate of ! language inflation. The main argument for a built-in was that the ! function is destined to be part of a core programming style, ! applicable to any object with an iterable interface. Just as ! zip() solves the problem of looping over multiple sequences, the ! enumerate() function solves the loop counter problem. + If only one built-in is allowed, then enumerate() is the most + important general purpose tool, solving the broadest class of + problems while improving program brevity, clarity and reliability. ! Note C: Various alternative names were discussed: ! iterindexed()-- five syllables is a mouthful index() -- nice verb but could be confused the .index() method indexed() -- widely liked however adjectives should be avoided + indexer() -- noun did not read well in a for-loop count() -- direct and explicit but often used in other contexts itercount() -- direct, explicit and hated by more than one person iteritems() -- conflicts with key:value concept for dictionaries + itemize() -- confusing because amap.items() != list(itemize(amap)) + enum() -- pithy; less clear than enumerate; too similar to enum + in other languages where it has a different meaning + All of the names involving 'count' had the further disadvantage of + implying that the count would begin from one instead of zero. ! All of the names involving 'index' clashed with usage in database ! languages where indexing implies a sorting operation rather than ! linear sequencing. + Note D: This function was originally proposed with optional start + and stop arguments. GvR pointed out that the function call + enumerate(seqn,4,6) had an alternate, plausible interpretation as + a slice that would return the fourth and fifth elements of the + sequence. To avoid the ambiguity, the optional arguments were + dropped even though it meant losing flexibility as a loop counter. + That flexibility was most important for the common case of + counting from one, as in: + + for linenum, line in enumerate(source,1): print linenum, line Comments from GvR: filter and map should die and be subsumed into list ! comprehensions, not grow more variants. I'd rather introduce ! built-ins that do iterator algebra (e.g. the iterzip that I've ! often used as an example). ! I like the idea of having some way to iterate over a sequence ! and its index set in parallel. It's fine for this to be a ! built-in. I don't like the name "indexed"; adjectives do not make good *************** *** 178,322 **** Comments from Ka-Ping Yee: I'm also quite happy with everything you ! proposed ... and the extra builtins (really 'indexed' in particular) ! are things I have wanted for a long time. ! Comments from Neil Schemenauer: The new builtins sound okay. Guido ! may be concerned with increasing the number of builtins too much. You ! might be better off selling them as part of a module. If you use a ! module then you can add lots of useful functions (Haskell has lots of ! them that we could steal). Comments for Magnus Lie Hetland: I think indexed would be a useful and ! natural built-in function. I would certainly use it a lot. ! I like indexed() a lot; +1. I'm quite happy to have it make PEP 281 ! obsolete. Adding a separate module for iterator utilities seems like ! a good idea. ! ! Comments from the Community: The response to the iterindexed() proposal ! has been close to 100% favorable. Almost everyone loves the idea. ! ! Author response: Prior to these comments, four builtins were proposed. ! After the comments, xmap xfilter and xzip were withdrawn. The one ! that remains is vital for the language and is proposed by itself. ! Indexed() is trivially easy to implement and can be documented in ! minutes. More importantly, it is useful in everyday programming ! which does not otherwise involve explicit use of generators. ! ! Though withdrawn from the proposal, I still secretly covet xzip() ! a.k.a. iterzip() but think that it will happen on its own someday. ! ! ! ! Specification for Generator Comprehensions [REJECTED PROPOSAL]: ! ! If a list comprehension starts with a 'yield' keyword, then ! express the comprehension with a generator. For example: ! ! g = [yield (len(line),line) for line in file if len(line)>5] ! ! This would be implemented as if it had been written: ! ! def __temp(self): ! for line in file: ! if len(line) > 5: ! yield (len(line), line) ! g = __temp() ! ! ! Note A: There is some discussion about whether the enclosing brackets ! should be part of the syntax for generator comprehensions. On the ! plus side, it neatly parallels list comprehensions and would be ! immediately recognizable as a similar form with similar internal ! syntax (taking maximum advantage of what people already know). ! More importantly, it sets off the generator comprehension from the ! rest of the function so as to not suggest that the enclosing ! function is a generator (currently the only cue that a function is ! really a generator is the presence of the yield keyword). On the ! minus side, the brackets may falsely suggest that the whole ! expression returns a list. Most of the feedback received to date ! indicates that brackets are helpful and not misleading. Unfortunately, ! the one dissent is from GvR. ! ! A key advantage of the generator comprehension syntax is that it ! makes it trivially easy to transform existing list comprehension ! code to a generator by adding yield. Likewise, it can be converted ! back to a list by deleting yield. This makes it easy to scale-up ! programs from small datasets to ones large enough to warrant ! just in time evaluation. ! ! ! Note B: List comprehensions expose their looping variable and ! leave that variable in the enclosing scope. The code, [str(i) for ! i in range(8)] leaves 'i' set to 7 in the scope where the ! comprehension appears. This behavior is by design and reflects an ! intent to duplicate the result of coding a for-loop instead of a ! list comprehension. Further, the variable 'i' is in a defined and ! potentially useful state on the line immediately following the ! list comprehension. ! ! In contrast, generator comprehensions do not expose the looping ! variable to the enclosing scope. The code, [yield str(i) for i in ! range(8)] leaves 'i' untouched in the scope where the ! comprehension appears. This is also by design and reflects an ! intent to duplicate the result of coding a generator directly ! instead of a generator comprehension. Further, the variable 'i' ! is not in a defined state on the line immediately following the ! list comprehension. It does not come into existence until ! iteration starts (possibly never). ! ! ! Comments from GvR: Cute hack, but I think the use of the [] syntax ! strongly suggests that it would return a list, not an iterator. I ! also think that this is trying to turn Python into a functional ! language, where most algorithms use lazy infinite sequences, and I ! just don't think that's where its future lies. ! ! I don't think it's worth the trouble. I expect it will take a lot ! of work to hack it into the code generator: it has to create a ! separate code object in order to be a generator. List ! comprehensions are inlined, so I expect that the generator ! comprehension code generator can't share much with the list ! comprehension code generator. And this for something that's not ! that common and easily done by writing a 2-line helper function. ! IOW the ROI isn't high enough. ! ! Comments from Ka-Ping Yee: I am very happy with the things you have ! proposed in this PEP. I feel quite positive about generator ! comprehensions and have no reservations. So a +1 on that. ! ! Comments from Neil Schemenauer: I'm -0 on the generator list ! comprehensions. They don't seem to add much. You could easily use ! a nested generator to do the same thing. They smell like lambda. ! ! Comments for Magnus Lie Hetland: Generator comprehensions seem mildly ! useful, but I vote +0. Defining a separate, named generator would ! probably be my preference. On the other hand, I do see the advantage ! of "scaling up" from list comprehensions. ! Comments from the Community: The response to the generator comprehension ! proposal has been mostly favorable. There were some 0 votes from ! people who didn't see a real need or who were not energized by the ! idea. Some of the 0 votes were tempered by comments that the reviewer ! did not even like list comprehensions or did not have any use for ! generators in any form. The +1 votes outnumbered the 0 votes by about ! two to one. ! Author response: I've studied several syntactical variations and ! concluded that the brackets are essential for: ! - teachability (it's like a list comprehension) ! - set-off (yield applies to the comprehension not the enclosing ! function) ! - substitutability (list comprehensions can be made lazy just by ! adding yield) ! What I like best about generator comprehensions is that I can design ! using list comprehensions and then easily switch to a generator (by ! adding yield) in response to scalability requirements (when the list ! comprehension produces too large of an intermediate result). Had ! generators already been in-place when list comprehensions were ! accepted, the yield option might have been incorporated from the ! start. For certain, the mathematical style notation is explicit and ! readable as compared to a separate function definition with an ! embedded yield. --- 145,178 ---- Comments from Ka-Ping Yee: I'm also quite happy with everything you ! proposed ... and the extra built-ins (really 'indexed' in ! particular) are things I have wanted for a long time. ! Comments from Neil Schemenauer: The new built-ins sound okay. Guido ! may be concerned with increasing the number of built-ins too ! much. You might be better off selling them as part of a ! module. If you use a module then you can add lots of useful ! functions (Haskell has lots of them that we could steal). Comments for Magnus Lie Hetland: I think indexed would be a useful and ! natural built-in function. I would certainly use it a lot. I ! like indexed() a lot; +1. I'm quite happy to have it make PEP ! 281 obsolete. Adding a separate module for iterator utilities ! seems like a good idea. ! Comments from the Community: The response to the enumerate() proposal ! has been close to 100% favorable. Almost everyone loves the ! idea. ! Author response: Prior to these comments, four built-ins were proposed. ! After the comments, xmap xfilter and xzip were withdrawn. The ! one that remains is vital for the language and is proposed by ! itself. Indexed() is trivially easy to implement and can be ! documented in minutes. More importantly, it is useful in ! everyday programming which does not otherwise involve explicit ! use of generators. ! Though withdrawn from the proposal, I still secretly covet ! xzip() a.k.a. iterzip() but think that it will happen on its ! own someday. *************** *** 324,345 **** [1] PEP 255 Simple Generators ! http://www.python.org/peps/pep-0255.html [2] PEP 212 Loop Counter Iteration ! http://www.python.org/peps/pep-0212.html ! ! [3] PEP 202 List Comprehensions ! http://www.python.org/peps/pep-0202.html ! ! [4] PEP 234 Iterators ! http://www.python.org/peps/pep-0234.html ! ! [5] A pure Python simulation of every feature in this PEP is at: ! http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17348&aid=513752 ! ! [6] The full, working source code for each of the examples in this PEP ! along with other examples and tests is at: ! http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17412&aid=513756 --- 180,190 ---- [1] PEP 255 Simple Generators ! http://python.sourceforge.net/peps/pep-0255.html [2] PEP 212 Loop Counter Iteration ! http://python.sourceforge.net/peps/pep-0212.html + [3] PEP 234 Iterators + http://python.sourceforge.net/peps/pep-0234.html *************** *** 355,356 **** --- 200,203 ---- fill-column: 70 End: + + From gvanrossum@users.sourceforge.net Mon Apr 8 02:38:45 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sun, 07 Apr 2002 18:38:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.139,2.140 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16348/Objects Modified Files: typeobject.c Log Message: - A type can now inherit its metatype from its base type. Previously, when PyType_Ready() was called, if ob_type was found to be NULL, it was always set to &PyType_Type; now it is set to base->ob_type, where base is tp_base, defaulting to &PyObject_Type. - PyType_Ready() accidentally did not inherit tp_is_gc; now it does. Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.139 retrieving revision 2.140 diff -C2 -d -r2.139 -r2.140 *** typeobject.c 6 Apr 2002 01:05:00 -0000 2.139 --- typeobject.c 8 Apr 2002 01:38:42 -0000 2.140 *************** *** 2051,2064 **** type->tp_flags |= Py_TPFLAGS_READYING; - /* Initialize ob_type if NULL. This means extensions that want to be - compilable separately on Windows can call PyType_Ready() instead of - initializing the ob_type field of their type objects. */ - if (type->ob_type == NULL) - type->ob_type = &PyType_Type; - /* Initialize tp_base (defaults to BaseObject unless that's us) */ base = type->tp_base; if (base == NULL && type != &PyBaseObject_Type) base = type->tp_base = &PyBaseObject_Type; /* Initialize tp_bases */ --- 2051,2064 ---- type->tp_flags |= Py_TPFLAGS_READYING; /* Initialize tp_base (defaults to BaseObject unless that's us) */ base = type->tp_base; if (base == NULL && type != &PyBaseObject_Type) base = type->tp_base = &PyBaseObject_Type; + + /* Initialize ob_type if NULL. This means extensions that want to be + compilable separately on Windows can call PyType_Ready() instead of + initializing the ob_type field of their type objects. */ + if (type->ob_type == NULL) + type->ob_type = base->ob_type; /* Initialize tp_bases */ From lemburg@users.sourceforge.net Mon Apr 8 09:19:41 2002 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Mon, 08 Apr 2002 01:19:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.157,2.158 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv3699/Python Modified Files: pythonrun.c Log Message: Move Unicode finalization further down in the chain. Fixes bug #525620. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.157 retrieving revision 2.158 diff -C2 -d -r2.157 -r2.158 *** pythonrun.c 1 Apr 2002 01:41:20 -0000 2.157 --- pythonrun.c 8 Apr 2002 08:19:36 -0000 2.158 *************** *** 220,228 **** PyOS_FiniInterrupts(); - #ifdef Py_USING_UNICODE - /* Cleanup Unicode implementation */ - _PyUnicode_Fini(); - #endif - /* Cleanup Codec registry */ _PyCodecRegistry_Fini(); --- 220,223 ---- *************** *** 268,271 **** --- 263,271 ---- PyInt_Fini(); PyFloat_Fini(); + + #ifdef Py_USING_UNICODE + /* Cleanup Unicode implementation */ + _PyUnicode_Fini(); + #endif /* XXX Still allocated: From bwarsaw@users.sourceforge.net Mon Apr 8 16:45:46 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 08 Apr 2002 08:45:46 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.174,1.175 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv25740 Modified Files: pep-0000.txt Log Message: Mark PEP 279 as Accepted. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.174 retrieving revision 1.175 diff -C2 -d -r1.174 -r1.175 *** pep-0000.txt 3 Apr 2002 22:11:23 -0000 1.174 --- pep-0000.txt 8 Apr 2002 15:45:44 -0000 1.175 *************** *** 88,92 **** S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen ! S 279 Enhanced Generators Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland --- 88,92 ---- S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen ! SA 279 Enhanced Generators Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland *************** *** 256,260 **** S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen ! S 279 Enhanced Generators Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland --- 256,260 ---- S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen ! SA 279 Enhanced Generators Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland From anthonybaxter@users.sourceforge.net Mon Apr 8 07:06:23 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 23:06:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.49.2.7,2.49.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv937/Include Modified Files: Tag: release21-maint patchlevel.h Log Message: beginning the dance of the sugar-plum micro-release. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.49.2.7 retrieving revision 2.49.2.8 diff -C2 -d -r2.49.2.7 -r2.49.2.8 *** patchlevel.h 15 Jan 2002 22:19:12 -0000 2.49.2.7 --- patchlevel.h 8 Apr 2002 06:05:49 -0000 2.49.2.8 *************** *** 22,34 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 1 ! #define PY_MICRO_VERSION 2 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.1.2" /* Historic */ ! #define PATCHLEVEL "2.1.2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,34 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 1 ! #define PY_MICRO_VERSION 3 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.1.3" /* Historic */ ! #define PATCHLEVEL "2.1.3" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From anthonybaxter@users.sourceforge.net Mon Apr 8 07:44:14 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 23:44:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib this.py,NONE,1.2.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8882 Added Files: Tag: release21-maint this.py Log Message: backport fred's revision 1.2.2.1 Python 10 was a success, commemorate it\! This includes Guido's whitespace cleanup. --- NEW FILE: this.py --- s = """Gur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbzcyvpngrq. Syng vf orggre guna arfgrq. Fcnefr vf orggre guna qrafr. Ernqnovyvgl pbhagf. Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf. Nygubhtu cenpgvpnyvgl orngf chevgl. Reebef fubhyq arire cnff fvyragyl. Hayrff rkcyvpvgyl fvyraprq. Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff. Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg. Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu. Abj vf orggre guna arire. Nygubhtu arire vf bsgra orggre guna *evtug* abj. Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn. Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn. Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!""" d = {} for c in (65, 97): for i in range(26): d[chr(i+c)] = chr((i+13) % 26 + c) print "".join([d.get(c, c) for c in s]) From gvanrossum@users.sourceforge.net Mon Apr 8 14:31:15 2002 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 08 Apr 2002 06:31:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.337.2.4.2.18,1.337.2.4.2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv434 Modified Files: Tag: release22-maint NEWS Log Message: Add bool(), True, False (as ints) for backwards compatibility. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.18 retrieving revision 1.337.2.4.2.19 diff -C2 -d -r1.337.2.4.2.18 -r1.337.2.4.2.19 *** NEWS 8 Apr 2002 01:39:56 -0000 1.337.2.4.2.18 --- NEWS 8 Apr 2002 13:31:12 -0000 1.337.2.4.2.19 *************** *** 3,7 **** ================================= ! Core - Fixed super() to work correctly with class methods. [SF bug #535444] --- 3,11 ---- ================================= ! Core and builtins ! ! - Added new builtin function bool() and new builtin constants True and ! False to ease backporting of code developed for Python 2.3. In 2.2, ! bool() returns 1 or 0, True == 1, and False == 0. - Fixed super() to work correctly with class methods. [SF bug #535444] From anthonybaxter@users.sourceforge.net Mon Apr 8 05:42:11 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 21:42:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_popen.py,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18851/Lib/test Added Files: Tag: release21-maint test_popen.py Log Message: Backport of bug 457466: "popenx() argument mangling hangs python" [Win9x only]." Can't test this myself, but MarkH sez it's ok. --- NEW FILE: test_popen.py --- #! /usr/bin/env python """Basic tests for os.popen() Particularly useful for platforms that fake popen. """ import os import sys from test_support import TestSkipped from os import popen # Test that command-lines get down as we expect. # To do this we execute: # python -c "import sys;print sys.argv" {rest_of_commandline} # This results in Python being spawned and printing the sys.argv list. # We can then eval() the result of this, and see what each argv was. def _do_test_commandline(cmdline, expected): cmd = 'python -c "import sys;print sys.argv" %s' % (cmdline,) data = popen(cmd).read() got = eval(data)[1:] # strip off argv[0] if got != expected: print "Error in popen commandline handling." print " executed '%s', expected '%r', but got '%r'" \ % (cmdline, expected, got) def _test_commandline(): _do_test_commandline("foo bar", ["foo", "bar"]) _do_test_commandline('foo "spam and eggs" "silly walk"', ["foo", "spam and eggs", "silly walk"]) _do_test_commandline('foo "a \\"quoted\\" arg" bar', ["foo", 'a "quoted" arg', "bar"]) print "popen seemed to process the command-line correctly" def main(): print "Test popen:" _test_commandline() main() From tim_one@users.sourceforge.net Mon Apr 8 05:13:15 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 07 Apr 2002 21:13:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.155,2.156 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13693/python/Objects Modified Files: fileobject.c Log Message: SF bug 538827: Python open w/ MSVC6: bad error msgs. open_the_file: Some (not all) flavors of Windows set errno to EINVAL when passed a syntactically invalid filename. Python turned that into an incomprehensible complaint about the mode string. Fixed by special-casing MSVC. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.155 retrieving revision 2.156 diff -C2 -d -r2.155 -r2.156 *** fileobject.c 7 Apr 2002 06:28:00 -0000 2.155 --- fileobject.c 8 Apr 2002 04:13:12 -0000 2.156 *************** *** 151,156 **** } #endif if (errno == EINVAL) ! PyErr_Format(PyExc_IOError, "invalid argument: %s", mode); else --- 151,169 ---- } #endif + #ifdef _MSC_VER + /* MSVC 6 (Microsoft) leaves errno at 0 for bad mode strings, + * across all Windows flavors. When it sets EINVAL varies + * across Windows flavors, the exact conditions aren't + * documented, and the answer lies in the OS's implementation + * of Win32's CreateFile function (whose source is secret). + * Seems the best we can do is map EINVAL to ENOENT. + */ + if (errno == 0) /* bad mode string */ + errno = EINVAL; + else if (errno == EINVAL) /* unknown, but not a mode string */ + errno = ENOENT; + #endif if (errno == EINVAL) ! PyErr_Format(PyExc_IOError, "invalid mode: %s", mode); else *************** *** 158,162 **** f = NULL; } ! if (f != NULL) f = dircheck(f); return (PyObject *)f; --- 171,175 ---- f = NULL; } ! if (f != NULL) f = dircheck(f); return (PyObject *)f; From anthonybaxter@users.sourceforge.net Mon Apr 8 05:42:11 2002 From: anthonybaxter@users.sourceforge.net (Anthony Baxter) Date: Sun, 07 Apr 2002 21:42:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_popen,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv18851/Lib/test/output Added Files: Tag: release21-maint test_popen Log Message: Backport of bug 457466: "popenx() argument mangling hangs python" [Win9x only]." Can't test this myself, but MarkH sez it's ok. --- NEW FILE: test_popen --- test_popen Test popen: popen seemed to process the command-line correctly From bwarsaw@users.sourceforge.net Mon Apr 8 18:02:42 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 08 Apr 2002 10:02:42 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0279.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28120 Modified Files: pep-0279.txt Log Message: PEP 279 is renamed to "The enumerate() built-in function" since the old title didn't reflect its accepted proposals. Also, moved this to the accepted but not yet implemented category. Index: pep-0279.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0279.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0279.txt 8 Apr 2002 15:44:52 -0000 1.11 --- pep-0279.txt 8 Apr 2002 17:02:40 -0000 1.12 *************** *** 1,4 **** PEP: 279 ! Title: Enhanced Generators Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 279 ! Title: The enumerate() built-in function Version: $Revision$ Last-Modified: $Date$ From mwh@users.sourceforge.net Mon Apr 8 18:00:56 2002 From: mwh@users.sourceforge.net (Michael Hudson) Date: Mon, 08 Apr 2002 10:00:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.153.6.2,2.153.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27386 Modified Files: Tag: release22-maint pythonrun.c Log Message: This may well be my final checkin before 2.2.1. If you think I've forgotten something, now is a good time to howl (although I won't read the howl for a good few hours 'cause I'm going home). backport lemburg's checkin of revision 2.158 of pythonrun.c Move Unicode finalization further down in the chain. Fixes bug #525620. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.153.6.2 retrieving revision 2.153.6.3 diff -C2 -d -r2.153.6.2 -r2.153.6.3 *** pythonrun.c 3 Mar 2002 21:32:01 -0000 2.153.6.2 --- pythonrun.c 8 Apr 2002 17:00:54 -0000 2.153.6.3 *************** *** 220,228 **** PyOS_FiniInterrupts(); - #ifdef Py_USING_UNICODE - /* Cleanup Unicode implementation */ - _PyUnicode_Fini(); - #endif - /* Cleanup Codec registry */ _PyCodecRegistry_Fini(); --- 220,223 ---- *************** *** 268,271 **** --- 263,271 ---- PyInt_Fini(); PyFloat_Fini(); + + #ifdef Py_USING_UNICODE + /* Cleanup Unicode implementation */ + _PyUnicode_Fini(); + #endif /* XXX Still allocated: From bwarsaw@users.sourceforge.net Mon Apr 8 18:02:18 2002 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 08 Apr 2002 10:02:18 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.176,1.177 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv27925 Modified Files: pep-0000.txt Log Message: PEP 279 is renamed to "The enumerate() built-in function" since the old title didn't reflect its accepted proposals. Also, moved this to the accepted but not yet implemented category. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.176 retrieving revision 1.177 diff -C2 -d -r1.176 -r1.177 *** pep-0000.txt 8 Apr 2002 15:51:07 -0000 1.176 --- pep-0000.txt 8 Apr 2002 17:02:16 -0000 1.177 *************** *** 55,58 **** --- 55,59 ---- S 253 Subtyping Built-in Types van Rossum S 285 Adding a bool type van Rossum + SA 279 The enumerate() built-in function Hettinger Open PEPs (under consideration) *************** *** 88,92 **** S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen - SA 279 Enhanced Generators Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland --- 89,92 ---- *************** *** 257,261 **** S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen ! SA 279 Enhanced Generators Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland --- 257,261 ---- S 277 Unicode file name support for Windows NT Hodgson S 278 Universal Newline Support Jansen ! SA 279 The enumerate() built-in function Hettinger S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland From tim_one@users.sourceforge.net Mon Apr 8 19:00:12 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:00:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.5,1.11.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv14412/212/dist/src/PCbuild Modified Files: Tag: release21-maint BUILDno.txt Log Message: Update 2.1.3 Windows buildno. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.11.2.5 retrieving revision 1.11.2.6 diff -C2 -d -r1.11.2.5 -r1.11.2.6 *** BUILDno.txt 15 Jan 2002 22:34:58 -0000 1.11.2.5 --- BUILDno.txt 8 Apr 2002 18:00:09 -0000 1.11.2.6 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 35 2.1.3 (final) + 9-Apr-2002 31 2.1.2 final 16-Jan-2002 From tim_one@users.sourceforge.net Mon Apr 8 19:00:28 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:00:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv14676/python/PCbuild Modified Files: BUILDno.txt Log Message: Update 2.1.3 Windows buildno. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** BUILDno.txt 4 Apr 2002 21:49:08 -0000 1.35 --- BUILDno.txt 8 Apr 2002 18:00:26 -0000 1.36 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 35 2.1.3 (final) + 9-Apr-2002 34 2.2.1 (final) 9-Apr-2002 From tim_one@users.sourceforge.net Mon Apr 8 19:06:44 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:06:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild zlib.dsp,1.15,1.15.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv16590/212/dist/src/PCbuild Modified Files: Tag: release21-maint zlib.dsp Log Message: Change 2.1.3 Windows build to use zlib 1.1.4. Index: zlib.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/zlib.dsp,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -d -r1.15 -r1.15.4.1 *** zlib.dsp 31 Jan 2001 10:28:03 -0000 1.15 --- zlib.dsp 8 Apr 2002 18:06:42 -0000 1.15.4.1 *************** *** 45,49 **** F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\..\zlib-1.1.3" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 --- 45,49 ---- F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\..\zlib-1.1.4" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 *************** *** 55,64 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 ..\..\zlib-1.1.3\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib.pyd" /export:initzlib # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool SOURCE="$(InputPath)" PreLink_Desc=Checking static zlib has been built ! PreLink_Cmds=cd ..\..\zlib-1.1.3 nmake -nologo -f msdos\makefile.w32 zlib.lib # End Special Build Tool --- 55,64 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 ..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib.pyd" /export:initzlib # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool SOURCE="$(InputPath)" PreLink_Desc=Checking static zlib has been built ! PreLink_Cmds=cd ..\..\zlib-1.1.4 nmake -nologo -f msdos\makefile.w32 zlib.lib # End Special Build Tool *************** *** 78,82 **** F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /I "..\..\zlib-1.1.3" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 --- 78,82 ---- F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /I "..\..\zlib-1.1.4" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 *************** *** 88,97 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\zlib-1.1.3\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib_d.pyd" /pdbtype:sept /export:initzlib # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool SOURCE="$(InputPath)" PreLink_Desc=Checking static zlib has been built ! PreLink_Cmds=cd ..\..\zlib-1.1.3 nmake -nologo -f msdos\makefile.w32 zlib.lib # End Special Build Tool --- 88,97 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib_d.pyd" /pdbtype:sept /export:initzlib # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool SOURCE="$(InputPath)" PreLink_Desc=Checking static zlib has been built ! PreLink_Cmds=cd ..\..\zlib-1.1.4 nmake -nologo -f msdos\makefile.w32 zlib.lib # End Special Build Tool From tim_one@users.sourceforge.net Mon Apr 8 19:03:02 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:03:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild pythoncore.dsp,1.13.2.4,1.13.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv15498/212/dist/src/PCbuild Modified Files: Tag: release21-maint pythoncore.dsp Log Message: Change the 2.1.3 Windows buildno (#35). Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.13.2.4 retrieving revision 1.13.2.5 diff -C2 -d -r1.13.2.4 -r1.13.2.5 *** pythoncore.dsp 15 Jan 2002 22:34:58 -0000 1.13.2.4 --- pythoncore.dsp 8 Apr 2002 18:02:54 -0000 1.13.2.5 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=31 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=31 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=35 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=35 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From tim_one@users.sourceforge.net Mon Apr 8 19:21:58 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:21:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.39.2.8,1.39.2.9 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv22638/212/dist/src/PCbuild Modified Files: Tag: release21-maint python20.wse Log Message: Update Windows installer identification and resource strings for 2.1.3. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.39.2.8 retrieving revision 1.39.2.9 diff -C2 -d -r1.39.2.8 -r1.39.2.9 *** python20.wse 15 Jan 2002 22:34:58 -0000 1.39.2.8 --- python20.wse 8 Apr 2002 18:21:56 -0000 1.39.2.9 *************** *** 2,6 **** item: Global Version=8.14 ! Title=Python 2.1.2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=8.14 ! Title=Python 2.1.3 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 19,25 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.1.2.exe Dialogs Version=8 ! Version File=2.1.2 Version Description=Python Programming Language Version Copyright=©2002 Python Software Foundation --- 19,25 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.1.3.exe Dialogs Version=8 ! Version File=2.1.3 Version Description=Python Programming Language Version Copyright=©2002 Python Software Foundation *************** *** 65,69 **** item: Set Variable Variable=PYVER_STRING ! Value=2.1.2 end item: Remark --- 65,69 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.1.3 end item: Remark From fdrake@users.sourceforge.net Mon Apr 8 19:27:55 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 08 Apr 2002 11:27:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.218.2.5,1.218.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv24745 Modified Files: Tag: release21-maint Makefile Log Message: Begin the Release Dance. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.218.2.5 retrieving revision 1.218.2.6 diff -C2 -d -r1.218.2.5 -r1.218.2.6 *** Makefile 15 Jan 2002 22:00:09 -0000 1.218.2.5 --- Makefile 8 Apr 2002 18:27:53 -0000 1.218.2.6 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1.2 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1.3 PYTHON= python From fdrake@users.sourceforge.net Mon Apr 8 19:27:55 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 08 Apr 2002 11:27:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.58.2.6,1.58.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv24745/texinputs Modified Files: Tag: release21-maint boilerplate.tex Log Message: Begin the Release Dance. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.58.2.6 retrieving revision 1.58.2.7 diff -C2 -d -r1.58.2.6 -r1.58.2.7 *** boilerplate.tex 15 Jan 2002 22:00:25 -0000 1.58.2.6 --- boilerplate.tex 8 Apr 2002 18:27:53 -0000 1.58.2.7 *************** *** 6,11 **** } ! \date{January 16, 2002} % XXX update before release! ! \release{2.1.2} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.1} % major.minor only for software --- 6,11 ---- } ! \date{April 9, 2002} % XXX update before release! ! \release{2.1.3} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.1} % major.minor only for software From tim_one@users.sourceforge.net Mon Apr 8 19:31:21 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:31:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.146.2.13,1.146.2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25400/212/dist/src/Misc Modified Files: Tag: release21-maint NEWS Log Message: Add news about zlib 1.1.4 for the Windows installer. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.13 retrieving revision 1.146.2.14 diff -C2 -d -r1.146.2.13 -r1.146.2.14 *** NEWS 8 Apr 2002 06:05:51 -0000 1.146.2.13 --- NEWS 8 Apr 2002 18:31:19 -0000 1.146.2.14 *************** *** 1,4 **** What's New in Python 2.1.3? ! Release date: 08-April-2002 =========================== --- 1,4 ---- What's New in Python 2.1.3? ! Release date: 09-April-2002 =========================== *************** *** 20,23 **** --- 20,28 ---- circular references by using itself as the locator that gets passed to the content handler implementation. [SF bug #535474] + + - A security hole ("double free") was found in zlib-1.1.3, a popular + third party compression library used by some Python modules. The + hole was quickly plugged in zlib-1.1.4, and the Windows build of + Python now ships with zlib-1.1.4. From fdrake@users.sourceforge.net Mon Apr 8 19:31:29 2002 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 08 Apr 2002 11:31:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.58.2.7,1.58.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv26156/texinputs Modified Files: Tag: release21-maint boilerplate.tex Log Message: Talk about uncoordinated dance partners! Fixed the release date to match the source release. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.58.2.7 retrieving revision 1.58.2.8 diff -C2 -d -r1.58.2.7 -r1.58.2.8 *** boilerplate.tex 8 Apr 2002 18:27:53 -0000 1.58.2.7 --- boilerplate.tex 8 Apr 2002 18:31:27 -0000 1.58.2.8 *************** *** 6,10 **** } ! \date{April 9, 2002} % XXX update before release! \release{2.1.3} % software release, not documentation \setreleaseinfo{} % empty for final release --- 6,10 ---- } ! \date{April 8, 2002} % XXX update before release! \release{2.1.3} % software release, not documentation \setreleaseinfo{} % empty for final release From tim_one@users.sourceforge.net Mon Apr 8 19:37:15 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:37:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.146.2.14,1.146.2.15 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28474/212/dist/src/Misc Modified Files: Tag: release21-maint NEWS Log Message: SF bug 497854: Short-cuts missing for All Users. Fixing a Windows-specific installer glitch. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.14 retrieving revision 1.146.2.15 diff -C2 -d -r1.146.2.14 -r1.146.2.15 *** NEWS 8 Apr 2002 18:31:19 -0000 1.146.2.14 --- NEWS 8 Apr 2002 18:37:13 -0000 1.146.2.15 *************** *** 1,4 **** What's New in Python 2.1.3? ! Release date: 09-April-2002 =========================== --- 1,4 ---- What's New in Python 2.1.3? ! Release date: 08-April-2002 =========================== *************** *** 25,28 **** --- 25,33 ---- hole was quickly plugged in zlib-1.1.4, and the Windows build of Python now ships with zlib-1.1.4. + + Windows + + - The installer now installs Start menu shortcuts under (the local + equivalent of) "All Users" when doing an Admin install. From tim_one@users.sourceforge.net Mon Apr 8 19:37:16 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:37:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.39.2.9,1.39.2.10 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv28474/212/dist/src/PCbuild Modified Files: Tag: release21-maint python20.wse Log Message: SF bug 497854: Short-cuts missing for All Users. Fixing a Windows-specific installer glitch. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.39.2.9 retrieving revision 1.39.2.10 diff -C2 -d -r1.39.2.9 -r1.39.2.10 *** python20.wse 8 Apr 2002 18:21:56 -0000 1.39.2.9 --- python20.wse 8 Apr 2002 18:37:13 -0000 1.39.2.10 *************** *** 1513,1524 **** Flags=00000100 end - item: Set Variable - Variable=CGROUP_SAVE - Value=%GROUP% - end - item: Set Variable - Variable=GROUP - Value=%GROUPDIR%\%GROUP% - end item: Else Statement end --- 1513,1516 ---- *************** *** 1557,1567 **** item: Remark end item: If/While Statement Variable=TASKS Value=B ! Flags=00000011 end item: Set Variable Variable=GROUP end item: End Block --- 1549,1576 ---- item: Remark end + item: Set Variable + Variable=CGROUP_SAVE + Value=%GROUP% + end item: If/While Statement Variable=TASKS Value=B ! Flags=00000010 ! end ! item: If/While Statement ! Variable=DOADMIN ! Value=1 end item: Set Variable Variable=GROUP + Value=%CGROUPDIR%\%GROUP% + end + item: Else Statement + end + item: Set Variable + Variable=GROUP + Value=%GROUPDIR%\%GROUP% + end + item: End Block end item: End Block From tim_one@users.sourceforge.net Mon Apr 8 19:47:36 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:47:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv26133/python/PCbuild Modified Files: BUILDno.txt Log Message: Change 2.1.3 release date. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** BUILDno.txt 8 Apr 2002 18:00:26 -0000 1.36 --- BUILDno.txt 8 Apr 2002 18:47:34 -0000 1.37 *************** *** 35,39 **** ---------------------------- 35 2.1.3 (final) ! 9-Apr-2002 34 2.2.1 (final) 9-Apr-2002 --- 35,39 ---- ---------------------------- 35 2.1.3 (final) ! 8-Apr-2002 34 2.2.1 (final) 9-Apr-2002 From tim_one@users.sourceforge.net Mon Apr 8 19:48:07 2002 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 08 Apr 2002 11:48:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv26359/212/dist/src/PCbuild Modified Files: Tag: release21-maint BUILDno.txt Log Message: Change 2.1.3 release date. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.11.2.6 retrieving revision 1.11.2.7 diff -C2 -d -r1.11.2.6 -r1.11.2.7 *** BUILDno.txt 8 Apr 2002 18:00:09 -0000 1.11.2.6 --- BUILDno.txt 8 Apr 2002 18:48:05 -0000 1.11.2.7 *************** *** 35,39 **** ---------------------------- 35 2.1.3 (final) ! 9-Apr-2002 31 2.1.2 final 16-Jan-2002 --- 35,39 ---- ---------------------------- 35 2.1.3 (final) ! 8-Apr-2002 31 2.1.2 final 16-Jan-2002 From fdrake@acm.org Mon Apr 8 21:02:45 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Mon, 8 Apr 2002 16:02:45 -0400 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: References: Message-ID: <15537.63333.723316.606511@grendel.zope.com> Tim Peters writes: > Modified Files: > Tag: release21-maint > BUILDno.txt > Log Message: > Change 2.1.3 release date. I'm not planning on changing this again for the docs! They *are* available today, and that's my stand. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From tim.one@comcast.net Mon Apr 8 21:10:40 2002 From: tim.one@comcast.net (Tim Peters) Date: Mon, 08 Apr 2002 16:10:40 -0400 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: <15537.63333.723316.606511@grendel.zope.com> Message-ID: > > Change 2.1.3 release date. [Fred] > I'm not planning on changing this again for the docs! They *are* > available today, and that's my stand. I'm not sure what you're trying to communicate. The version of the docs I got from you say "April 8, 2002", which is the same date now in BUILDno.txt, as shown in the part of the patch you snipped out: *************** *** 35,39 **** ---------------------------- 35 2.1.3 (final) ! 9-Apr-2002 31 2.1.2 final 16-Jan-2002 --- 35,39 ---- ---------------------------- 35 2.1.3 (final) ! 8-Apr-2002 31 2.1.2 final 16-Jan-2002 Are you saying that 8-Apr-2002 is now incorrect? If so, you must have changed the docs again, and I didn't hear about it; or if not, please clarify what you are trying to say. From tim_one@sourceforge.net Mon Apr 8 21:24:36 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 08 Apr 2002 13:24:36 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.15.2.5,1.15.2.6 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7282/212/dist/src Modified Files: Tag: release21-maint LICENSE Log Message: Change license text to refer to 2.1.3. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.15.2.5 retrieving revision 1.15.2.6 diff -C2 -d -r1.15.2.5 -r1.15.2.6 *** LICENSE 15 Jan 2002 22:09:55 -0000 1.15.2.5 --- LICENSE 8 Apr 2002 20:24:34 -0000 1.15.2.6 *************** *** 44,48 **** 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and ! otherwise using Python 2.1.2 software in source or binary form and its associated documentation. --- 44,48 ---- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and ! otherwise using Python 2.1.3 software in source or binary form and its associated documentation. *************** *** 50,76 **** hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 2.1.2 alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001-2002 Python Software Foundation; All Rights Reserved" are ! retained in Python 2.1.2 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 2.1.2 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of ! the changes made to Python 2.1.2. ! 4. PSF is making Python 2.1.2 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.1.2 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 2.1.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ! A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.1.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. --- 50,76 ---- hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 2.1.3 alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001-2002 Python Software Foundation; All Rights Reserved" are ! retained in Python 2.1.3 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 2.1.3 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of ! the changes made to Python 2.1.3. ! 4. PSF is making Python 2.1.3 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.1.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 2.1.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ! A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.1.3, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. *************** *** 84,88 **** products or services of Licensee, or any third party. ! 8. By copying, installing or otherwise using Python 2.1.2, Licensee agrees to be bound by the terms and conditions of this License Agreement. --- 84,88 ---- products or services of Licensee, or any third party. ! 8. By copying, installing or otherwise using Python 2.1.3, Licensee agrees to be bound by the terms and conditions of this License Agreement. From fdrake@acm.org Mon Apr 8 21:31:57 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Mon, 8 Apr 2002 16:31:57 -0400 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: References: <15537.63333.723316.606511@grendel.zope.com> Message-ID: <15537.65085.57210.959192@grendel.zope.com> I said: > I'm not planning on changing this again for the docs! They *are* > available today, and that's my stand. Tim Peters writes: > I'm not sure what you're trying to communicate. The version of the docs I > got from you say "April 8, 2002", which is the same date now in BUILDno.txt, > as shown in the part of the patch you snipped out: *Blush* Er, no, I just read your patch backward. ;-) > Are you saying that 8-Apr-2002 is now incorrect? If so, you must have > changed the docs again, and I didn't hear about it; or if not, please > clarify what you are trying to say. No, I'd checked in the 9th as the release date at first, since I thought that's what it was going to be. Then I saw a README or NEWS checkin that said it was the 8th (must be that Aussie calendar! ;), so I had to change it and re-build the docs. As far as I'm concerned, the 8th is fine. Sorry for the confusion. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From tim_one@sourceforge.net Mon Apr 8 21:46:26 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 08 Apr 2002 13:46:26 -0700 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv16109 Modified Files: pep-0102.txt Log Message: Add a note about the necessity of updating the LICENSE file. Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0102.txt 10 Jan 2002 16:10:18 -0000 1.3 --- pep-0102.txt 8 Apr 2002 20:46:24 -0000 1.4 *************** *** 72,77 **** README file, which has a big banner at the top proclaiming its identity. Don't do this if you're just releasing a new alpha or ! beta release, but /do/ do this if you're release a new micro ! release. ___ After starting the process, the most important thing to do next --- 72,84 ---- README file, which has a big banner at the top proclaiming its identity. Don't do this if you're just releasing a new alpha or ! beta release, but /do/ do this if you're release a new micro, ! minor or major release. ! ! ___ The LICENSE file also needs to be changed, due to several ! references to the release number. As for the README file, changing ! these are necessary for a new micro, minor or major release. ! ! ___ When the year changes, copyright legends need to be updated in ! many places, including the README and LICENSE files. ___ After starting the process, the most important thing to do next From tim.one@comcast.net Mon Apr 8 21:49:01 2002 From: tim.one@comcast.net (Tim Peters) Date: Mon, 08 Apr 2002 16:49:01 -0400 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: <15537.65085.57210.959192@grendel.zope.com> Message-ID: [Fred[ > No, I'd checked in the 9th as the release date at first, since I > thought that's what it was going to be. Heh heh -- that's why *I* started changing it to the 9th everywhere. I'm happy-- really, truly, undeniably happy --to leave it at the 8th now. > ... > As far as I'm concerned, the 8th is fine. Sorry for the confusion. Hey, don't sweat it, I'm a Tim. I'm always confused. From loewis@sourceforge.net Mon Apr 8 22:28:22 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Mon, 08 Apr 2002 14:28:22 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.164,1.165 NEWS,1.381,1.382 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv1713/Misc Modified Files: ACKS NEWS Log Message: Patch #512005: getrusage() returns struct-like object. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** ACKS 29 Mar 2002 16:28:31 -0000 1.164 --- ACKS 8 Apr 2002 21:28:20 -0000 1.165 *************** *** 414,417 **** --- 414,418 ---- Eric Siegerman Paul Sijben + Kirill Simonov Nathan Paul Simons Janne Sinkkonen Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.381 retrieving revision 1.382 diff -C2 -d -r1.381 -r1.382 *** NEWS 8 Apr 2002 01:38:42 -0000 1.381 --- NEWS 8 Apr 2002 21:28:20 -0000 1.382 *************** *** 57,61 **** Python now ships with zlib-1.1.4. ! - pwd and grp return enhanced tuples now, with symbolic field names. - array.array is now a type object. A new format character --- 57,62 ---- Python now ships with zlib-1.1.4. ! - pwd, grp, and resource return enhanced tuples now, with symbolic ! field names. - array.array is now a type object. A new format character From loewis@sourceforge.net Mon Apr 8 22:28:22 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Mon, 08 Apr 2002 14:28:22 -0700 Subject: [Python-checkins] python/dist/src/Modules resource.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1713/Modules Modified Files: resource.c Log Message: Patch #512005: getrusage() returns struct-like object. Index: resource.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** resource.c 24 Mar 2002 22:27:39 -0000 2.23 --- resource.c 8 Apr 2002 21:28:20 -0000 2.24 *************** *** 1,4 **** --- 1,5 ---- #include "Python.h" + #include "structseq.h" #include #include *************** *** 17,20 **** --- 18,57 ---- static PyObject *ResourceError; + static char struct_rusage__doc__[] = + "struct_rusage: Result from getrusage.\n\n" + "This object may be accessed either as a tuple of\n" + " (utime,stime,maxrss,ixrss,idrss,isrss,minflt,majflt,\n" + " nswap,inblock,oublock,msgsnd,msgrcv,nsignals,nvcsw,nivcsw)\n" + "or via the attributes ru_utime, ru_stime, ru_maxrss, and so on.\n"; + + static PyStructSequence_Field struct_rusage_fields[] = { + {"ru_utime", "user time used"}, + {"ru_stime", "system time used"}, + {"ru_maxrss", "max. resident set size"}, + {"ru_ixrss", "shared memory size"}, + {"ru_idrss", "unshared data size"}, + {"ru_isrss", "unshared stack size"}, + {"ru_minflt", "page faults not requiring I/O"}, + {"ru_majflt", "page faults requiring I/O"}, + {"ru_nswap", "number of swap outs"}, + {"ru_inblock", "block input operations"}, + {"ru_oublock", "block output operations"}, + {"ru_msgsnd", "IPC messages sent"}, + {"ru_msgrcv", "IPC messages received"}, + {"ru_nsignals", "signals received"}, + {"ru_nvcsw", "voluntary context switches"}, + {"ru_nivcsw", "involuntary context switches"}, + {0} + }; + + static PyStructSequence_Desc struct_rusage_desc = { + "resource.struct_rusage", /* name */ + struct_rusage__doc__, /* doc */ + struct_rusage_fields, /* fields */ + 16 /* n_in_sequence */ + }; + + static PyTypeObject StructRUsageType; + static PyObject * resource_getrusage(PyObject *self, PyObject *args) *************** *** 22,25 **** --- 59,63 ---- int who; struct rusage ru; + PyObject *result; if (!PyArg_ParseTuple(args, "i:getrusage", &who)) *************** *** 36,62 **** } ! /* Yeah, this 16-tuple is way ugly. It's probably a lot less ! ugly than a dictionary with keys (or object attributes) ! named things like 'ixrss'. ! */ ! return Py_BuildValue( ! "ddiiiiiiiiiiiiii", ! doubletime(ru.ru_utime), /* user time used */ ! doubletime(ru.ru_stime), /* system time used */ ! ru.ru_maxrss, /* max. resident set size */ ! ru.ru_ixrss, /* shared memory size */ ! ru.ru_idrss, /* unshared memory size */ ! ru.ru_isrss, /* unshared stack size */ ! ru.ru_minflt, /* page faults not requiring I/O*/ ! ru.ru_majflt, /* page faults requiring I/O */ ! ru.ru_nswap, /* number of swap outs */ ! ru.ru_inblock, /* block input operations */ ! ru.ru_oublock, /* block output operations */ ! ru.ru_msgsnd, /* messages sent */ ! ru.ru_msgrcv, /* messages received */ ! ru.ru_nsignals, /* signals received */ ! ru.ru_nvcsw, /* voluntary context switches */ ! ru.ru_nivcsw /* involuntary context switches */ ! ); } --- 74,106 ---- } ! result = PyStructSequence_New(&StructRUsageType); ! if (!result) ! return NULL; ! ! PyStructSequence_SET_ITEM(result, 0, ! PyFloat_FromDouble(doubletime(ru.ru_utime))); ! PyStructSequence_SET_ITEM(result, 1, ! PyFloat_FromDouble(doubletime(ru.ru_stime))); ! PyStructSequence_SET_ITEM(result, 2, PyInt_FromLong(ru.ru_maxrss)); ! PyStructSequence_SET_ITEM(result, 3, PyInt_FromLong(ru.ru_ixrss)); ! PyStructSequence_SET_ITEM(result, 4, PyInt_FromLong(ru.ru_idrss)); ! PyStructSequence_SET_ITEM(result, 5, PyInt_FromLong(ru.ru_isrss)); ! PyStructSequence_SET_ITEM(result, 6, PyInt_FromLong(ru.ru_minflt)); ! PyStructSequence_SET_ITEM(result, 7, PyInt_FromLong(ru.ru_majflt)); ! PyStructSequence_SET_ITEM(result, 8, PyInt_FromLong(ru.ru_nswap)); ! PyStructSequence_SET_ITEM(result, 9, PyInt_FromLong(ru.ru_inblock)); ! PyStructSequence_SET_ITEM(result, 10, PyInt_FromLong(ru.ru_oublock)); ! PyStructSequence_SET_ITEM(result, 11, PyInt_FromLong(ru.ru_msgsnd)); ! PyStructSequence_SET_ITEM(result, 12, PyInt_FromLong(ru.ru_msgrcv)); ! PyStructSequence_SET_ITEM(result, 13, PyInt_FromLong(ru.ru_nsignals)); ! PyStructSequence_SET_ITEM(result, 14, PyInt_FromLong(ru.ru_nvcsw)); ! PyStructSequence_SET_ITEM(result, 15, PyInt_FromLong(ru.ru_nivcsw)); ! ! if (PyErr_Occurred()) { ! Py_DECREF(result); ! return NULL; ! } ! ! return result; } *************** *** 173,176 **** --- 217,223 ---- Py_INCREF(ResourceError); PyModule_AddObject(m, "error", ResourceError); + PyStructSequence_InitType(&StructRUsageType, &struct_rusage_desc); + PyModule_AddObject(m, "struct_rusage", + (PyObject*) &StructRUsageType); /* insert constants */ From loewis@sourceforge.net Mon Apr 8 22:28:22 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Mon, 08 Apr 2002 14:28:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libresource.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1713/Doc/lib Modified Files: libresource.tex Log Message: Patch #512005: getrusage() returns struct-like object. Index: libresource.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libresource.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libresource.tex 22 Oct 2001 14:18:23 -0000 1.16 --- libresource.tex 8 Apr 2002 21:28:19 -0000 1.17 *************** *** 134,141 **** \subsection{Resource Usage} ! These functiona are used to retrieve resource usage information: \begin{funcdesc}{getrusage}{who} ! This function returns a large tuple that describes the resources consumed by either the current process or its children, as specified by the \var{who} parameter. The \var{who} parameter should be --- 134,141 ---- \subsection{Resource Usage} ! These functions are used to retrieve resource usage information: \begin{funcdesc}{getrusage}{who} ! This function returns an object that describes the resources consumed by either the current process or its children, as specified by the \var{who} parameter. The \var{who} parameter should be *************** *** 143,181 **** below. ! The elements of the return value each ! describe how a particular system resource has been used, e.g. amount ! of time spent running is user mode or number of times the process was ! swapped out of main memory. Some values are dependent on the clock ! tick internal, e.g. the amount of memory the process is using. ! The first two elements of the return value are floating point values ! representing the amount of time spent executing in user mode and the ! amount of time spent executing in system mode, respectively. The ! remaining values are integers. Consult the \manpage{getrusage}{2} ! man page for detailed information about these values. A brief ! summary is presented here: ! \begin{tableii}{r|l}{code}{Offset}{Resource} ! \lineii{0}{time in user mode (float)} ! \lineii{1}{time in system mode (float)} ! \lineii{2}{maximum resident set size} ! \lineii{3}{shared memory size} ! \lineii{4}{unshared memory size} ! \lineii{5}{unshared stack size} ! \lineii{6}{page faults not requiring I/O} ! \lineii{7}{page faults requiring I/O} ! \lineii{8}{number of swap outs} ! \lineii{9}{block input operations} ! \lineii{10}{block output operations} ! \lineii{11}{messages sent} ! \lineii{12}{messages received} ! \lineii{13}{signals received} ! \lineii{14}{voluntary context switches} ! \lineii{15}{involuntary context switches} ! \end{tableii} This function will raise a \exception{ValueError} if an invalid \var{who} parameter is specified. It may also raise \exception{error} exception in unusual circumstances. \end{funcdesc} --- 143,187 ---- below. ! The fields of the return value each describe how a particular system ! resource has been used, e.g. amount of time spent running is user mode ! or number of times the process was swapped out of main memory. Some ! values are dependent on the clock tick internal, e.g. the amount of ! memory the process is using. ! For backward compatibility, the return value is also accessible as ! a tuple of 16 elements. ! The fields \member{ru_utime} and \member{ru_stime} of the return value ! are floating point values representing the amount of time spent ! executing in user mode and the amount of time spent executing in system ! mode, respectively. The remaining values are integers. Consult the ! \manpage{getrusage}{2} man page for detailed information about these ! values. A brief summary is presented here: ! ! \begin{tableiii}{r|l|l}{code}{Index}{Field}{Resource} ! \lineiii{0}{\member{ru_utime}}{time in user mode (float)} ! \lineiii{1}{\member{ru_stime}}{time in system mode (float)} ! \lineiii{2}{\member{ru_maxrss}}{maximum resident set size} ! \lineiii{3}{\member{ru_ixrss}}{shared memory size} ! \lineiii{4}{\member{ru_idrss}}{unshared memory size} ! \lineiii{5}{\member{ru_isrss}}{unshared stack size} ! \lineiii{6}{\member{ru_minflt}}{page faults not requiring I/O} ! \lineiii{7}{\member{ru_majflt}}{page faults requiring I/O} ! \lineiii{8}{\member{ru_nswap}}{number of swap outs} ! \lineiii{9}{\member{ru_inblock}}{block input operations} ! \lineiii{10}{\member{ru_oublock}}{block output operations} ! \lineiii{11}{\member{ru_msgsnd}}{messages sent} ! \lineiii{12}{\member{ru_msgrcv}}{messages received} ! \lineiii{13}{\member{ru_nsignals}}{signals received} ! \lineiii{14}{\member{ru_nvcsw}}{voluntary context switches} ! \lineiii{15}{\member{ru_nivcsw}}{involuntary context switches} ! \end{tableiii} This function will raise a \exception{ValueError} if an invalid \var{who} parameter is specified. It may also raise \exception{error} exception in unusual circumstances. + + \versionchanged[Added access to values as attributes of the + returned object]{2.3} \end{funcdesc} From tim_one@sourceforge.net Mon Apr 8 22:36:49 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 08 Apr 2002 14:36:49 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5015/python Modified Files: LICENSE Log Message: Update table of releases. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** LICENSE 4 Apr 2002 17:52:49 -0000 1.20 --- LICENSE 8 Apr 2002 21:36:47 -0000 1.21 *************** *** 38,41 **** --- 38,44 ---- 2.1.1 2.1+2.0.1 2001 PSF yes 2.2 2.1.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2.1 2.2 2002 PSF yes Footnotes: From tim_one@sourceforge.net Mon Apr 8 22:37:09 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 08 Apr 2002 14:37:09 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.18.16.2,1.18.16.3 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5239/221 Modified Files: Tag: release22-maint LICENSE Log Message: Update table of releases. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.18.16.2 retrieving revision 1.18.16.3 diff -C2 -d -r1.18.16.2 -r1.18.16.3 *** LICENSE 26 Mar 2002 10:22:09 -0000 1.18.16.2 --- LICENSE 8 Apr 2002 21:37:07 -0000 1.18.16.3 *************** *** 37,40 **** --- 37,42 ---- 2.1.1 2.1+2.0.1 2001 PSF yes 2.2 2.1.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes 2.2.1 2.2 2002 PSF yes From fdrake@sourceforge.net Mon Apr 8 22:48:22 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 08 Apr 2002 14:48:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs license.tex,1.4.4.1,1.4.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv9357/texinputs Modified Files: Tag: release22-maint license.tex Log Message: Replace "Digital Creations" with Zope Corporation in one place. Update the table of releases. Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/license.tex,v retrieving revision 1.4.4.1 retrieving revision 1.4.4.2 diff -C2 -d -r1.4.4.1 -r1.4.4.2 *** license.tex 27 Feb 2002 13:31:33 -0000 1.4.4.1 --- license.tex 8 Apr 2002 21:48:20 -0000 1.4.4.2 *************** *** 17,21 **** Software Foundation (PSF, see \url{http://www.python.org/psf/}) was formed, a non-profit organization created specifically to own ! Python-related Intellectual Property. Digital Creations is a sponsoring member of the PSF. --- 17,21 ---- Software Foundation (PSF, see \url{http://www.python.org/psf/}) was formed, a non-profit organization created specifically to own ! Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF. *************** *** 35,38 **** --- 35,41 ---- \linev{2.1.1}{2.1+2.0.1}{2001}{PSF}{yes} \linev{2.2}{2.1.1}{2001}{PSF}{yes} + \linev{2.1.2}{2.1.1}{2002}{PSF}{yes} + \linev{2.1.3}{2.1.2}{2002}{PSF}{yes} + \linev{2.2.1}{2.2}{2002}{PSF}{yes} \end{tablev} From fdrake@sourceforge.net Mon Apr 8 22:57:34 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 08 Apr 2002 14:57:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs license.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv12730/texinputs Modified Files: license.tex Log Message: Update the table of releases. Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/license.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** license.tex 4 Apr 2002 17:52:49 -0000 1.6 --- license.tex 8 Apr 2002 21:57:31 -0000 1.7 *************** *** 35,38 **** --- 35,41 ---- \linev{2.1.1}{2.1+2.0.1}{2001}{PSF}{yes} \linev{2.2}{2.1.1}{2001}{PSF}{yes} + \linev{2.1.2}{2.1.1}{2002}{PSF}{yes} + \linev{2.1.3}{2.1.2}{2002}{PSF}{yes} + \linev{2.2.1}{2.2}{2002}{PSF}{yes} \end{tablev} From gvanrossum@sourceforge.net Mon Apr 8 23:18:47 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Mon, 08 Apr 2002 15:18:47 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.177,1.178 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20056 Modified Files: pep-0000.txt Log Message: PEP 283 is not finished until 2.3 is released. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** pep-0000.txt 8 Apr 2002 17:02:16 -0000 1.177 --- pep-0000.txt 8 Apr 2002 22:18:44 -0000 1.178 *************** *** 92,95 **** --- 92,96 ---- S 281 Loop Counter Iteration with range and xrange Hetland S 282 A Logging System Mick + I 283 Python 2.3 Release Schedule Hylton S 284 Integer for-loops Eppstein, Ewing S 286 Enhanced Argument Tuples von Loewis *************** *** 127,131 **** S 261 Support for "wide" Unicode characters Prescod SF 264 Future statements in simulated shells Hudson - I 283 Python 2.3 Release Schedule Hylton Empty PEPs (or containing only an abstract) --- 128,131 ---- From anthonybaxter@sourceforge.net Tue Apr 9 01:39:12 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 08 Apr 2002 17:39:12 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.34.2.2,1.34.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30323 Modified Files: Tag: release21-maint httplib.py Log Message: backport 1.47's "add sendall() to FakeSocket class" Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.34.2.2 retrieving revision 1.34.2.3 diff -C2 -d -r1.34.2.2 -r1.34.2.3 *** httplib.py 23 Dec 2001 01:47:10 -0000 1.34.2.2 --- httplib.py 9 Apr 2002 00:39:10 -0000 1.34.2.3 *************** *** 601,604 **** --- 601,607 ---- return self.__ssl.write(stuff) + def sendall(self, stuff, flags = 0): + return self.__ssl.write(stuff) + def recv(self, len = 1024, flags = 0): return self.__ssl.read(len) From tim_one@sourceforge.net Tue Apr 9 02:16:13 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 08 Apr 2002 18:16:13 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.146.2.16,1.146.2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11712/213/dist/src/Misc Modified Files: Tag: release21-maint NEWS Log Message: Weasle-word the SSL-on-Windows blurb. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.16 retrieving revision 1.146.2.17 diff -C2 -d -r1.146.2.16 -r1.146.2.17 *** NEWS 9 Apr 2002 01:09:05 -0000 1.146.2.16 --- NEWS 9 Apr 2002 01:16:08 -0000 1.146.2.17 *************** *** 31,35 **** equivalent of) "All Users" when doing an Admin install. ! - A bug fix that makes SSL support work on Windows was added. What's New in Python 2.1.2 (final)? --- 31,39 ---- equivalent of) "All Users" when doing an Admin install. ! - If you do what it takes to compile SSL support for Windows, a bug in ! httplib.py prevented SSL from working correctly. That bug has been ! fixed, but note that SSL support on Windows is still not enabled in ! this release. ! What's New in Python 2.1.2 (final)? From anthonybaxter@sourceforge.net Tue Apr 9 02:09:08 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 08 Apr 2002 18:09:08 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.146.2.15,1.146.2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9270 Modified Files: Tag: release21-maint NEWS Log Message: re-adding the NEWS entry. SF ate my previous commit. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.15 retrieving revision 1.146.2.16 diff -C2 -d -r1.146.2.15 -r1.146.2.16 *** NEWS 8 Apr 2002 18:37:13 -0000 1.146.2.15 --- NEWS 9 Apr 2002 01:09:05 -0000 1.146.2.16 *************** *** 31,34 **** --- 31,35 ---- equivalent of) "All Users" when doing an Admin install. + - A bug fix that makes SSL support work on Windows was added. What's New in Python 2.1.2 (final)? From Anthony Baxter Tue Apr 9 04:15:25 2002 From: Anthony Baxter (Anthony Baxter) Date: Tue, 09 Apr 2002 13:15:25 +1000 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: Message from "Fred L. Drake, Jr." of "Mon, 08 Apr 2002 16:31:57 -0400." <15537.65085.57210.959192@grendel.zope.com> Message-ID: <200204090315.g393FPJ30303@mbuna.arbhome.com.au> >>> "Fred L. Drake, Jr." wrote > No, I'd checked in the 9th as the release date at first, since I > thought that's what it was going to be. Then I saw a README or NEWS > checkin that said it was the 8th (must be that Aussie calendar! ;), so > I had to change it and re-build the docs. Hey, if it's the 8th, that makes the release date an even number. And even numbers mean stable, don't they? Anthony -- Anthony Baxter It's never too late to have a happy childhood. From guido@python.org Tue Apr 9 04:22:41 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 08 Apr 2002 23:22:41 -0400 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: Your message of "Tue, 09 Apr 2002 13:15:25 +1000." <200204090315.g393FPJ30303@mbuna.arbhome.com.au> References: <200204090315.g393FPJ30303@mbuna.arbhome.com.au> Message-ID: <200204090322.g393Mfd17537@pcp742651pcs.reston01.va.comcast.net> > Hey, if it's the 8th, that makes the release date an even number. > > And even numbers mean stable, don't they? This release will be stable until midnight. That's another 40 minutes, max, here in Virginia... Enjoy the ball, Cinderella! --Guido van Rossum (home page: http://www.python.org/~guido/) From Anthony Baxter Tue Apr 9 04:24:26 2002 From: Anthony Baxter (Anthony Baxter) Date: Tue, 09 Apr 2002 13:24:26 +1000 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: Message from Guido van Rossum of "Mon, 08 Apr 2002 23:22:41 -0400." <200204090322.g393Mfd17537@pcp742651pcs.reston01.va.comcast.net> Message-ID: <200204090324.g393OQu30480@mbuna.arbhome.com.au> > This release will be stable until midnight. That's another 40 > minutes, max, here in Virginia... Hey, I'm prepared to go with that guarantee. low-expectations-are-good-expectations Anthony -- Anthony Baxter It's never too late to have a happy childhood. From fdrake@acm.org Tue Apr 9 05:45:55 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 9 Apr 2002 00:45:55 -0400 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.11.2.6,1.11.2.7 In-Reply-To: <200204090315.g393FPJ30303@mbuna.arbhome.com.au> References: <15537.65085.57210.959192@grendel.zope.com> <200204090315.g393FPJ30303@mbuna.arbhome.com.au> Message-ID: <15538.29187.62329.614573@grendel.zope.com> Anthony Baxter writes: > Hey, if it's the 8th, that makes the release date an even number. > > And even numbers mean stable, don't they? We can add that as an assertion in the code, I'm sure. ;-) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From jhylton@sourceforge.net Tue Apr 9 06:32:44 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 08 Apr 2002 22:32:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv17950 Modified Files: asdl.py Log Message: Use AST base class as marker (simplifies visitor). Add explicit Product class. Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asdl.py 7 Apr 2002 00:04:53 -0000 1.1 --- asdl.py 9 Apr 2002 05:32:41 -0000 1.2 *************** *** 139,143 **** def p_product(self, (_0, fields, _1)): " product ::= ( fields ) " ! return fields def p_sum_0(self, (constructor,)): --- 139,143 ---- def p_product(self, (_0, fields, _1)): " product ::= ( fields ) " ! return Product(fields) def p_sum_0(self, (constructor,)): *************** *** 197,201 **** # piecemeal as they seem helpful ! class Module: def __init__(self, name, dfns): self.name = name --- 197,204 ---- # piecemeal as they seem helpful ! class AST: ! pass # a marker class ! ! class Module(AST): def __init__(self, name, dfns): self.name = name *************** *** 242,246 **** return d.keys() ! class Type: def __init__(self, name, value): self.name = name --- 245,249 ---- return d.keys() ! class Type(AST): def __init__(self, name, value): self.name = name *************** *** 250,254 **** return "Type(%s, %s)" % (self.name, self.value) ! class Constructor: def __init__(self, name, fields=None): self.name = name --- 253,257 ---- return "Type(%s, %s)" % (self.name, self.value) ! class Constructor(AST): def __init__(self, name, fields=None): self.name = name *************** *** 258,262 **** return "Constructor(%s, %s)" % (self.name, self.fields) ! class Field: def __init__(self, type, name=None, seq=0, opt=0): self.type = type --- 261,265 ---- return "Constructor(%s, %s)" % (self.name, self.fields) ! class Field(AST): def __init__(self, type, name=None, seq=0, opt=0): self.type = type *************** *** 277,281 **** return "Field(%s, %s,%s)" % (self.type, self.name, extra) ! class Sum: def __init__(self, types, attributes=None): self.types = types --- 280,284 ---- return "Field(%s, %s,%s)" % (self.type, self.name, extra) ! class Sum(AST): def __init__(self, types, attributes=None): self.types = types *************** *** 287,290 **** --- 290,300 ---- else: return "Sum(%s, %s)" % (self.types, self.attributes) + + class Product(AST): + def __init__(self, fields): + self.fields = fields + + def __repr__(self): + return "Product(%s)" % self.fields def parse(file): From jhylton@sourceforge.net Tue Apr 9 06:35:29 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 08 Apr 2002 22:35:29 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv18938 Modified Files: python.asdl Log Message: Add explicit Lambda constructor (stmts vs. expr for body) Remove augop type, because it was the same as operator. Rename 'else' field to 'orelse' so I don't have to think about a renaming for languages where else is a reserved word. Fix ListComp() using new listcomp type. Make names of sequences plural in Compare(). Add assign type which copies constructors from expr. Define arguments type. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** python.asdl 7 Apr 2002 00:04:53 -0000 1.1 --- python.asdl 9 Apr 2002 05:35:27 -0000 1.2 *************** *** 5,9 **** mod = Module(stmts body) ! stmts = Function(identifier? name, arguments args, stmts body) | Class(identifier name, bases bases, stmts body) | Return(expr value) | Yield(expr value) --- 5,10 ---- mod = Module(stmts body) ! stmts = Function(identifier name, arguments args, stmts body) ! | Lambda(arguments args, expr body) | Class(identifier name, bases bases, stmts body) | Return(expr value) | Yield(expr value) *************** *** 11,22 **** | Del(assign* targets) | Assign(assign* targets, expr value) ! | AugAssign(assign target, augop op, expr value) -- not sure if bool is allowed, can always use int | Print(expr? dest, expr value, bool nl) ! | For(expr target, expr iter, stmts body, stmts else) ! | While(expr test, stmts body, stmts else) ! | If(stmts else) -- XXX | Raise(expr type, expr inst, expr tback) --- 12,25 ---- | Del(assign* targets) | Assign(assign* targets, expr value) ! | AugAssign(assign target, operator op, expr value) -- not sure if bool is allowed, can always use int | Print(expr? dest, expr value, bool nl) ! -- XXX use 'orelse' because else is a keyword ! -- need a better solution for that ! | For(expr target, expr iter, stmts body, stmts orelse) ! | While(expr test, stmts body, stmts orelse) ! | If(expr test, stmts body, stmts? orelse) | Raise(expr type, expr inst, expr tback) *************** *** 40,67 **** | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) ! | Dict(expr* elts) | List(expr* elts) | Tuple(expr *elts) ! | ListComp(expr target, expr iter) -- XXX -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 ! | Compare(expr left, cmpop* op, expr* comparator) | Call(expr func, expr* args, expr? starargs, expr? kwargs) | Repr(expr) | Attribute(expr value, identifier* attrs) | Subscript(expr value, slice slice) - | Literal(string) -- numbers, strings | Name(identifier) ! slice = Ellipsis | Slice(expr? lower, expr? upper) -- maybe Slice and ExtSlice should be merged... ! | ExtSlice(expr* dim) varop = And | Or - augop = (operator op) -- all allowed as augmented assignment? - operator = Add | Sub | Mult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv ! unaryop = Invert | Not | UAdd | USub cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | LtGt --- 43,77 ---- | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) ! | Dict(expr* elts) ! | ListComp(expr target, listcomp* generators) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 ! | Compare(expr left, cmpop* ops, expr* comparators) | Call(expr func, expr* args, expr? starargs, expr? kwargs) | Repr(expr) + | Literal(string) -- numbers, strings + -- the following items appear in expr and assign | Attribute(expr value, identifier* attrs) | Subscript(expr value, slice slice) | Name(identifier) ! | List(expr* elts) | Tuple(expr *elts) ! ! -- the subset of expressions that are valid as the target of ! -- assignments. ! assign = Attribute(expr value, identifier* attrs) ! | Subscript(expr value, slice slice) ! | Name(identifier) ! | List(expr* elts) | Tuple(expr *elts) ! slice = Ellipsis | Slice(expr? lower, expr? upper) -- maybe Slice and ExtSlice should be merged... ! | ExtSlice(expr* dims) varop = And | Or operator = Add | Sub | Mult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv ! unaryop = Invert | Not | UAdd | USub cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | LtGt *************** *** 70,78 **** bases = (expr* bases) ! -- the rest are just placeholders for real definitions ! ! assign = (identifier) ! arguments = (identifier* args) } --- 80,88 ---- bases = (expr* bases) ! listcomp = (expr target, expr iter, expr* ifs) ! -- XXX need to handle 'def f((a, b)):' ! arguments = (identifier* args, identifer? vararg, ! identifier? kwarg, expr* defaults) } From mwh@sourceforge.net Tue Apr 9 10:29:30 2002 From: mwh@sourceforge.net (mwh@sourceforge.net) Date: Tue, 09 Apr 2002 02:29:30 -0700 Subject: [Python-checkins] python/dist/src/Misc/RPM README,1.1.24.1,1.1.24.2 python-2.2.spec,1.1.2.1,1.1.2.2 Python-2.1-expat.patch,1.1.2.1,NONE Python-2.1-pythonpath.patch,1.1.2.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory usw-pr-cvs1:/tmp/cvs-serv31129 Modified Files: Tag: release22-maint README python-2.2.spec Removed Files: Tag: release22-maint Python-2.1-expat.patch Python-2.1-pythonpath.patch Log Message: Updates from Sean Reifschneider. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/README,v retrieving revision 1.1.24.1 retrieving revision 1.1.24.2 diff -C2 -d -r1.1.24.1 -r1.1.24.2 *** README 28 Jan 2002 14:58:24 -0000 1.1.24.1 --- README 9 Apr 2002 09:29:28 -0000 1.1.24.2 *************** *** 1,6 **** This directory contains support file used to build RPM releases of Python. Its contents are maintained by Sean Reifschneider ! . ! ! Note that the patches say "2.1" in the name -- they didn't need to be ! updated for 2.2. --- 1,3 ---- This directory contains support file used to build RPM releases of Python. Its contents are maintained by Sean Reifschneider ! . Index: python-2.2.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.2.spec,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** python-2.2.spec 28 Jan 2002 14:58:24 -0000 1.1.2.1 --- python-2.2.spec 9 Apr 2002 09:29:28 -0000 1.1.2.2 *************** *** 31,38 **** %define name python ! %define version 2.2 ! %define libvers 2.2 ! %define release 2 %define __prefix /usr # kludge to get around rpm define weirdness --- 31,38 ---- %define name python ! %define version 2.2.1 ! %define release 1 %define __prefix /usr + %define libvers %(echo "%{version}" | awk -F. '{ printf "%s.%s", $1, $2 }') # kludge to get around rpm define weirdness *************** *** 42,45 **** --- 42,48 ---- %define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi) + # look for documentation files + %define include_htmldocs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi) + Summary: An interpreted, interactive, object-oriented programming language. Name: %{name}%{binsuffix} *************** *** 49,59 **** Group: Development/Languages Source: Python-%{version}.tgz Source1: html-%{version}.tar.bz2 ! Source2: info-%{version}.tar.bz2 ! Patch0: Python-2.1-pythonpath.patch ! Patch1: Python-2.1-expat.patch BuildRoot: /var/tmp/%{name}-%{version}-root BuildPrereq: expat-devel ! BuildPrereq: db1-devel BuildPrereq: gdbm-devel Prefix: %{__prefix} --- 52,61 ---- Group: Development/Languages Source: Python-%{version}.tgz + %if %{include_htmldocs} Source1: html-%{version}.tar.bz2 ! %endif BuildRoot: /var/tmp/%{name}-%{version}-root BuildPrereq: expat-devel ! BuildPrereq: /usr/include/db1/db.h BuildPrereq: gdbm-devel Prefix: %{__prefix} *************** *** 115,118 **** --- 117,121 ---- tkinter packages. + %if %{include_htmldocs} %package docs Summary: Python-related documentation. *************** *** 122,127 **** --- 125,142 ---- Documentation relating to the Python programming language in HTML and info formats. + %endif %changelog + * Tue Mar 26 2002 Sean Reifschneider + [Release 2.2.1c2-1] + - Updated to 2.2.1c2. + - Changed build pre-req for db to use file instead of package. + (Suggested by Alf Werder) + + * Wed Jan 23 2002 Sean Reifschneider + [Release 2.2-3] + - Using "*" for the man page extension to pick up both systems which use + .bz2 and .gz compressed man pages. (Pointed out by Tony Hammitt) + * Sun Dec 23 2001 Sean Reifschneider [Release 2.2-2] *************** *** 171,176 **** %prep %setup -n Python-%{version} ! %patch0 -p1 ! %patch1 ######## --- 186,191 ---- %prep %setup -n Python-%{version} ! ! # fix path to xmlparse header file ######## *************** *** 181,184 **** --- 196,210 ---- make + # fix paths + for file in \ + Tools/scripts/pathfix.py \ + Lib/cgi.py \ + Tools/faqwiz/faqw.py \ + Tools/scripts/parseentities.py + do + ./python Tools/scripts/pathfix.py -i '/usr/bin/env python' "$file" + rm -f "$file"~ # remove backup + done + ########## # INSTALL *************** *** 238,241 **** --- 264,268 ---- ###### # Docs + %if %{include_htmldocs} mkdir -p "$RPM_BUILD_ROOT"/var/www/html/python ( *************** *** 243,251 **** bunzip2 < %{SOURCE1} | tar x ) ! mkdir -p "$RPM_BUILD_ROOT"/usr/share/info ! ( ! cd "$RPM_BUILD_ROOT"/usr/share/info ! bunzip2 < %{SOURCE2} | tar x ! ) ######## --- 270,274 ---- bunzip2 < %{SOURCE1} | tar x ) ! %endif ######## *************** *** 261,267 **** %files -f mainpkg.files %defattr(-,root,root) ! %doc Misc/README Misc/HYPE Misc/cheatsheet Misc/unicode.txt Misc/Porting ! %doc LICENSE Misc/ACKS Misc/BLURB.* Misc/HISTORY Misc/NEWS ! %{__prefix}/man/man1/python%{binsuffix}.1.gz %dir %{__prefix}/include/python%{libvers} --- 284,292 ---- %files -f mainpkg.files %defattr(-,root,root) ! %doc Misc/*README Misc/cheatsheet Misc/Porting Misc/gdbinit Misc/indent.pro ! %doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS Misc/Porting ! %doc Misc/python-mode.el Misc/RFD Misc/setuid-prog.c Misc/vgrindefs ! %doc Misc/RPM/README ! %{__prefix}/man/man1/python%{binsuffix}.1* %dir %{__prefix}/include/python%{libvers} *************** *** 297,302 **** %endif %files docs %defattr(-,root,root) /var/www/html/python ! /usr/share/info --- 322,329 ---- %endif + %if %{include_htmldocs} %files docs %defattr(-,root,root) /var/www/html/python ! #/usr/share/info ! %endif --- Python-2.1-expat.patch DELETED --- --- Python-2.1-pythonpath.patch DELETED --- From theller@sourceforge.net Tue Apr 9 13:50:16 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Tue, 09 Apr 2002 05:50:16 -0700 Subject: [Python-checkins] python/dist/src/Modules xxmodule.c,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21972 Modified Files: xxmodule.c Log Message: Fix an obvious bug. Index: xxmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** xxmodule.c 12 Mar 2002 21:49:44 -0000 2.26 --- xxmodule.c 9 Apr 2002 12:50:13 -0000 2.27 *************** *** 222,226 **** initxx(void) { ! PyObject *m, *d; /* Initialize the type of the new type object here; doing it here --- 222,226 ---- initxx(void) { ! PyObject *m; /* Initialize the type of the new type object here; doing it here *************** *** 238,241 **** } Py_INCREF(ErrorObject); ! PyModule_AddObject(d, "error", ErrorObject); } --- 238,241 ---- } Py_INCREF(ErrorObject); ! PyModule_AddObject(m, "error", ErrorObject); } From theller@sourceforge.net Tue Apr 9 15:14:41 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Tue, 09 Apr 2002 07:14:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_dumb.py,1.18,1.19 bdist_wininst.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv17863 Modified Files: bdist_dumb.py bdist_wininst.py Log Message: Set the warn_dir option to 0 before running the install command. This suppresses bogus warnings about modules installed into a directory not in sys.path. Bugfix candidate. Index: bdist_dumb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_dumb.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** bdist_dumb.py 31 Jan 2002 18:55:59 -0000 1.18 --- bdist_dumb.py 9 Apr 2002 14:14:38 -0000 1.19 *************** *** 82,85 **** --- 82,86 ---- install.root = self.bdist_dir install.skip_build = self.skip_build + install.warn_dir = 0 self.announce("installing to %s" % self.bdist_dir) Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** bdist_wininst.py 21 Mar 2002 23:44:01 -0000 1.30 --- bdist_wininst.py 9 Apr 2002 14:14:38 -0000 1.31 *************** *** 99,102 **** --- 99,103 ---- install.root = self.bdist_dir install.skip_build = self.skip_build + install.warn_dir = 0 install_lib = self.reinitialize_command('install_lib') From mwh@sourceforge.net Tue Apr 9 15:21:46 2002 From: mwh@sourceforge.net (mwh@sourceforge.net) Date: Tue, 09 Apr 2002 07:21:46 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.19,1.337.2.4.2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21065 Modified Files: Tag: release22-maint NEWS Log Message: I always forget the release date in here... Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.19 retrieving revision 1.337.2.4.2.20 diff -C2 -d -r1.337.2.4.2.19 -r1.337.2.4.2.20 *** NEWS 8 Apr 2002 13:31:12 -0000 1.337.2.4.2.19 --- NEWS 9 Apr 2002 14:21:43 -0000 1.337.2.4.2.20 *************** *** 1,4 **** What's New in Python 2.2.1 final? ! Release date: XX-Apr-2002 ================================= --- 1,4 ---- What's New in Python 2.2.1 final? ! Release date: 10-Apr-2002 ================================= From fdrake@sourceforge.net Tue Apr 9 15:52:47 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 07:52:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/isilo .cvsignore,1.1,1.1.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/isilo In directory usw-pr-cvs1:/tmp/cvs-serv32585/isilo Modified Files: Tag: release22-maint .cvsignore Log Message: Ignore an output directory for intermediates here as well. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/isilo/.cvsignore,v retrieving revision 1.1 retrieving revision 1.1.8.1 diff -C2 -d -r1.1 -r1.1.8.1 *** .cvsignore 19 Oct 2001 21:09:19 -0000 1.1 --- .cvsignore 9 Apr 2002 14:52:44 -0000 1.1.8.1 *************** *** 8,10 **** --- 8,11 ---- dist inst + whatsnew python-*.pdb From fdrake@sourceforge.net Tue Apr 9 15:54:29 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 07:54:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/isilo .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/isilo In directory usw-pr-cvs1:/tmp/cvs-serv815/isilo Modified Files: .cvsignore Log Message: Ignore an output directory for intermediates here as well. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/isilo/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 19 Oct 2001 21:09:19 -0000 1.1 --- .cvsignore 9 Apr 2002 14:54:26 -0000 1.2 *************** *** 8,10 **** --- 8,11 ---- dist inst + whatsnew python-*.pdb From fdrake@sourceforge.net Tue Apr 9 15:38:46 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 07:38:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.53.4.3,1.53.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv27228/ref Modified Files: Tag: release22-maint ref5.tex Log Message: Fix typo: coverted --> converted. Reported by Francois Pinard. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.53.4.3 retrieving revision 1.53.4.4 diff -C2 -d -r1.53.4.3 -r1.53.4.4 *** ref5.tex 18 Mar 2002 16:47:35 -0000 1.53.4.3 --- ref5.tex 9 Apr 2002 14:38:44 -0000 1.53.4.4 *************** *** 830,834 **** \code{!=} compare the values of two objects. The objects need not have the same type. ! If both are numbers, they are coverted to a common type. Otherwise, objects of different types \emph{always} compare unequal, and are ordered consistently but arbitrarily. --- 830,834 ---- \code{!=} compare the values of two objects. The objects need not have the same type. ! If both are numbers, they are converted to a common type. Otherwise, objects of different types \emph{always} compare unequal, and are ordered consistently but arbitrarily. From theller@sourceforge.net Tue Apr 9 15:16:09 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Tue, 09 Apr 2002 07:16:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv19345 Modified Files: bdist.py Log Message: Remove unconditional debugging prints. Index: bdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** bdist.py 31 Jan 2002 18:55:58 -0000 1.23 --- bdist.py 9 Apr 2002 14:16:07 -0000 1.24 *************** *** 132,138 **** sub_cmd.format = self.formats[i] - print ("bdist.run: format=%s, command=%s, rest=%s" % - (self.formats[i], cmd_name, commands[i+1:])) - # If we're going to need to run this command again, tell it to # keep its temporary files around so subsequent runs go faster. --- 132,135 ---- From fdrake@sourceforge.net Tue Apr 9 15:39:12 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 07:39:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv27402/ref Modified Files: ref5.tex Log Message: Fix typo: coverted --> converted. Reported by Francois Pinard. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** ref5.tex 1 Apr 2002 21:05:21 -0000 1.58 --- ref5.tex 9 Apr 2002 14:39:10 -0000 1.59 *************** *** 814,818 **** \code{!=} compare the values of two objects. The objects need not have the same type. ! If both are numbers, they are coverted to a common type. Otherwise, objects of different types \emph{always} compare unequal, and are ordered consistently but arbitrarily. --- 814,818 ---- \code{!=} compare the values of two objects. The objects need not have the same type. ! If both are numbers, they are converted to a common type. Otherwise, objects of different types \emph{always} compare unequal, and are ordered consistently but arbitrarily. From nnorwitz@sourceforge.net Tue Apr 9 19:13:00 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Tue, 09 Apr 2002 11:13:00 -0700 Subject: [Python-checkins] python/dist/src/Lib statcache.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4072 Modified Files: statcache.py Log Message: Update docstring to reflect code change to bool Index: statcache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/statcache.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** statcache.py 7 Apr 2002 06:36:23 -0000 1.12 --- statcache.py 9 Apr 2002 18:12:58 -0000 1.13 *************** *** 70,74 **** def isdir(path): ! """Return 1 if directory, else 0.""" try: st = stat(path) --- 70,74 ---- def isdir(path): ! """Return True if directory, else False.""" try: st = stat(path) From nnorwitz@sourceforge.net Tue Apr 9 19:15:02 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Tue, 09 Apr 2002 11:15:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libchunk.tex,1.4,1.5 libimp.tex,1.31,1.32 librfc822.tex,1.39,1.40 libstdtypes.tex,1.84,1.85 libthread.tex,1.24,1.25 libzipfile.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv4862 Modified Files: libchunk.tex libimp.tex librfc822.tex libstdtypes.tex libthread.tex libzipfile.tex Log Message: Update docs for bool changes by Guido around April 6 Index: libchunk.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libchunk.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libchunk.tex 16 Jul 2000 19:01:09 -0000 1.4 --- libchunk.tex 9 Apr 2002 18:14:59 -0000 1.5 *************** *** 79,83 **** \begin{methoddesc}{isatty}{} ! Returns \code{0}. \end{methoddesc} --- 79,83 ---- \begin{methoddesc}{isatty}{} ! Returns \code{False}. \end{methoddesc} Index: libimp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimp.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** libimp.tex 8 Apr 2002 05:22:30 -0000 1.31 --- libimp.tex 9 Apr 2002 18:14:59 -0000 1.32 *************** *** 95,100 **** \begin{funcdesc}{lock_held}{} ! Return 1 if the import lock is currently held, else 0. ! On platforms without threads, always return 0. On platforms with threads, a thread executing an import holds an internal --- 95,100 ---- \begin{funcdesc}{lock_held}{} ! Return \code{True} if the import lock is currently held, else \code{False}. ! On platforms without threads, always return \code{False}. On platforms with threads, a thread executing an import holds an internal *************** *** 175,180 **** \begin{funcdesc}{is_frozen}{name} ! Return \code{1} if there is a frozen module (see ! \function{init_frozen()}) called \var{name}, or \code{0} if there is no such module. \end{funcdesc} --- 175,180 ---- \begin{funcdesc}{is_frozen}{name} ! Return \code{True} if there is a frozen module (see ! \function{init_frozen()}) called \var{name}, or \code{False} if there is no such module. \end{funcdesc} Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** librfc822.tex 5 Jan 2002 01:52:41 -0000 1.39 --- librfc822.tex 9 Apr 2002 18:14:59 -0000 1.40 *************** *** 157,162 **** \begin{methoddesc}{iscomment}{line} ! Return true if the given line should be ignored entirely, just skipped. ! By default this is a stub that always returns false, but you can override it in a subclass. \end{methoddesc} --- 157,162 ---- \begin{methoddesc}{iscomment}{line} ! Return \code{True} if the given line should be ignored entirely, just skipped. ! By default this is a stub that always returns \code{False}, but you can override it in a subclass. \end{methoddesc} Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** libstdtypes.tex 3 Apr 2002 22:41:50 -0000 1.84 --- libstdtypes.tex 9 Apr 2002 18:14:59 -0000 1.85 *************** *** 1073,1078 **** \begin{methoddesc}[file]{isatty}{} ! Return true if the file is connected to a tty(-like) device, else ! false. \note{If a file-like object is not associated with a real file, this method should \emph{not} be implemented.} \end{methoddesc} --- 1073,1078 ---- \begin{methoddesc}[file]{isatty}{} ! Return \code{True} if the file is connected to a tty(-like) device, else ! \code{False}. \note{If a file-like object is not associated with a real file, this method should \emph{not} be implemented.} \end{methoddesc} *************** *** 1194,1198 **** \begin{memberdesc}[file]{closed} ! Boolean indicating the current state of the file object. This is a read-only attribute; the \method{close()} method changes the value. It may not be available on all file-like objects. --- 1194,1198 ---- \begin{memberdesc}[file]{closed} ! bool indicating the current state of the file object. This is a read-only attribute; the \method{close()} method changes the value. It may not be available on all file-like objects. Index: libthread.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthread.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libthread.tex 28 Nov 2001 07:26:15 -0000 1.24 --- libthread.tex 9 Apr 2002 18:15:00 -0000 1.25 *************** *** 83,88 **** immediately without waiting, while if it is nonzero, the lock is acquired unconditionally as before. If an argument is present, the ! return value is \code{1} if the lock is acquired successfully, ! \code{0} if not. \end{methoddesc} --- 83,88 ---- immediately without waiting, while if it is nonzero, the lock is acquired unconditionally as before. If an argument is present, the ! return value is \code{True} if the lock is acquired successfully, ! \code{False} if not. \end{methoddesc} *************** *** 93,98 **** \begin{methoddesc}[lock]{locked}{} ! Return the status of the lock:\ \code{1} if it has been acquired by ! some thread, \code{0} if not. \end{methoddesc} --- 93,98 ---- \begin{methoddesc}[lock]{locked}{} ! Return the status of the lock:\ \code{True} if it has been acquired by ! some thread, \code{False} if not. \end{methoddesc} Index: libzipfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzipfile.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libzipfile.tex 14 Jan 2002 08:37:39 -0000 1.13 --- libzipfile.tex 9 Apr 2002 18:15:00 -0000 1.14 *************** *** 49,54 **** \begin{funcdesc}{is_zipfile}{filename} ! Returns true if \var{filename} is a valid ZIP file based on its magic ! number, otherwise returns false. This module does not currently handle ZIP files which have appended comments. \end{funcdesc} --- 49,54 ---- \begin{funcdesc}{is_zipfile}{filename} ! Returns \code{True} if \var{filename} is a valid ZIP file based on its magic ! number, otherwise returns \code{False}. This module does not currently handle ZIP files which have appended comments. \end{funcdesc} From gvanrossum@sourceforge.net Tue Apr 9 19:01:01 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 09 Apr 2002 11:01:01 -0700 Subject: [Python-checkins] python/dist/src/Python import.c,2.198,2.199 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv32728 Modified Files: import.c Log Message: is_builtin() is not a Boolean -- it can return -1, 0, 1. [SF #541652] Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.198 retrieving revision 2.199 diff -C2 -d -r2.198 -r2.199 *** import.c 7 Apr 2002 06:34:38 -0000 2.198 --- import.c 9 Apr 2002 18:00:58 -0000 2.199 *************** *** 2296,2300 **** if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) return NULL; ! return PyBool_FromLong(is_builtin(name)); } --- 2296,2300 ---- if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) return NULL; ! return PyInt_FromLong(is_builtin(name)); } From jhylton@sourceforge.net Tue Apr 9 20:13:39 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 12:13:39 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv22159 Modified Files: python.asdl Log Message: A bunch of small changes suggested by Guido Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** python.asdl 9 Apr 2002 05:35:27 -0000 1.2 --- python.asdl 9 Apr 2002 19:13:36 -0000 1.3 *************** *** 5,11 **** mod = Module(stmts body) ! stmts = Function(identifier name, arguments args, stmts body) ! | Lambda(arguments args, expr body) ! | Class(identifier name, bases bases, stmts body) | Return(expr value) | Yield(expr value) --- 5,10 ---- mod = Module(stmts body) ! stmts = FunctionDef(identifier name, arguments args, stmts body) ! | ClassDef(identifier name, expr* bases, stmts body) | Return(expr value) | Yield(expr value) *************** *** 15,19 **** -- not sure if bool is allowed, can always use int ! | Print(expr? dest, expr value, bool nl) -- XXX use 'orelse' because else is a keyword --- 14,18 ---- -- not sure if bool is allowed, can always use int ! | Print(expr? dest, expr* value, bool nl) -- XXX use 'orelse' because else is a keyword *************** *** 23,46 **** | If(expr test, stmts body, stmts? orelse) ! | Raise(expr type, expr inst, expr tback) | TryExcept(stmts body) -- XXX | TryFinally(stmts body, stmts final) ! | Assert(expr test, expr fail) | Import(identifier* names) | ImportAs(identifier name, identifier alias) | ImportFrom(identifier module, identifier* names) -- Doesn't capture requirement that locals must be -- defined if globals is | Exec(expr body, expr? locals, expr? globals) ! | Global(identifier) ! | Noop(expr value) | Pass | Break | Continue ! expr = VarOp(varop op, expr* values) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Dict(expr* elts) | ListComp(expr target, listcomp* generators) --- 22,54 ---- | If(expr test, stmts body, stmts? orelse) ! -- 'type' is a bad name ! | Raise(expr? type, expr? inst, expr? tback) | TryExcept(stmts body) -- XXX | TryFinally(stmts body, stmts final) ! | Assert(expr test, expr? msg) + -- may want to factor this differently perhaps excluding + -- 'as' from the type because can mix name and alias w/ from + -- also need import * | Import(identifier* names) | ImportAs(identifier name, identifier alias) | ImportFrom(identifier module, identifier* names) + | ImportFromAs(identifier module, identifier name, + identifier alias) -- Doesn't capture requirement that locals must be -- defined if globals is + -- still supports use as a function! | Exec(expr body, expr? locals, expr? globals) ! | Global(identifier* name) ! | Expr(expr value) | Pass | Break | Continue ! -- BoolOp() can use left & right ! expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) + | Lambda(arguments args, expr body) | Dict(expr* elts) | ListComp(expr target, listcomp* generators) *************** *** 48,56 **** -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) ! | Call(expr func, expr* args, expr? starargs, expr? kwargs) | Repr(expr) ! | Literal(string) -- numbers, strings -- the following items appear in expr and assign ! | Attribute(expr value, identifier* attrs) | Subscript(expr value, slice slice) | Name(identifier) --- 56,65 ---- -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) ! | Call(expr func, expr* args, XXX keywords, ! expr? starargs, expr? kwargs) | Repr(expr) ! | Literal(string) -- numbers, strings -- probably separate -- the following items appear in expr and assign ! | Attribute(expr value, identifier attr) | Subscript(expr value, slice slice) | Name(identifier) *************** *** 59,63 **** -- the subset of expressions that are valid as the target of -- assignments. ! assign = Attribute(expr value, identifier* attrs) | Subscript(expr value, slice slice) | Name(identifier) --- 68,72 ---- -- the subset of expressions that are valid as the target of -- assignments. ! assign = Attribute(expr value, identifier attr) | Subscript(expr value, slice slice) | Name(identifier) *************** *** 68,72 **** | ExtSlice(expr* dims) ! varop = And | Or operator = Add | Sub | Mult | Div | Mod | Pow | LShift --- 77,81 ---- | ExtSlice(expr* dims) ! boolop = And | Or operator = Add | Sub | Mult | Div | Mod | Pow | LShift *************** *** 77,82 **** cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | LtGt | Is | IsNot | In | NotIn - - bases = (expr* bases) listcomp = (expr target, expr iter, expr* ifs) --- 86,89 ---- From jhylton@sourceforge.net Tue Apr 9 20:13:55 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 12:13:55 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.2,1.3 asdl_c.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv22231 Modified Files: asdl.py asdl_c.py Log Message: More changes w/ no time to document them :-( Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** asdl.py 9 Apr 2002 05:32:41 -0000 1.2 --- asdl.py 9 Apr 2002 19:13:53 -0000 1.3 *************** *** 159,162 **** --- 159,164 ---- def p_constructor_1(self, (id, _0, fields, _1)): " constructor ::= Id ( fields ) " + # XXX can't I just construct things in the right order? + fields.reverse() return Constructor(id, fields) Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asdl_c.py 9 Apr 2002 05:29:24 -0000 1.1 --- asdl_c.py 9 Apr 2002 19:13:53 -0000 1.2 *************** *** 8,11 **** --- 8,27 ---- MAX_COL = 76 + _builtin_types = ("identifier", "string", "int", "bool") + + def get_c_type(name): + """Return a string for the C name of the type. + + This function special cases the default types provided by asdl: + identifier, string, int, bool. + """ + # XXX ack! need to figure out where Id is useful and where string + if isinstance(name, asdl.Id): + name = name.value + if name in _builtin_types: + return name + else: + return "%s_ty" % name + class VisitorBase(object): *************** *** 106,119 **** enum.append("%s=%d" % (type.name, i + 1)) enums = ", ".join(enum) ! self.emit("enum %s_ty { %s };" % (name, enums), depth) self.emit("", depth) def sum_with_constructors(self, sum, name, depth): ! s = "typedef struct _%(name)s *%(name)s_ty;" % locals() self.emit(s, depth) self.emit("", depth) def visitProduct(self, product, name, depth): ! pass class StructVisitor(EmitVisitor): --- 122,141 ---- enum.append("%s=%d" % (type.name, i + 1)) enums = ", ".join(enum) ! ctype = get_c_type(name) ! s = "typedef enum _%s { %s } %s;" % (name, enums, ctype) ! self.emit(s, depth) self.emit("", depth) def sum_with_constructors(self, sum, name, depth): ! ctype = get_c_type(name) ! s = "typedef struct _%(name)s *%(ctype)s;" % locals() self.emit(s, depth) self.emit("", depth) def visitProduct(self, product, name, depth): ! ctype = get_c_type(name) ! s = "typedef struct _%(name)s *%(ctype)s;" % locals() ! self.emit(s, depth) ! self.emit("", depth) class StructVisitor(EmitVisitor): *************** *** 167,174 **** # XXX need to lookup field.type, because it might be something # like a builtin... ! self.emit("%(type)s_ty %(name)s;" % field.__dict__, depth) def visitProduct(self, product, name, depth): ! pass class FunctionVisitor(EmitVisitor): --- 189,202 ---- # XXX need to lookup field.type, because it might be something # like a builtin... ! ctype = get_c_type(field.type) ! name = field.name ! self.emit("%(ctype)s %(name)s;" % locals(), depth) def visitProduct(self, product, name, depth): ! self.emit("struct _%(name)s {" % locals(), depth) ! for f in product.fields: ! self.visit(f, depth + 1) ! self.emit("};", depth) ! self.emit("", depth) class FunctionVisitor(EmitVisitor): *************** *** 210,219 **** else: name = f.name ! args.append((str(f.type) + "_ty", name)) ! argstr = ", ".join(["%s %s" % (type, name) for type, name in args]) ! self.emit("%s" % type, 0) emit("%s(%s)" % (cons.name, argstr)) emit("{") ! emit("%s_ty p = (%s_ty)malloc(sizeof(*p));" % (type, type), 1) emit("if (!p) {", 1) emit("PyErr_SetString(PyExc_MemoryError, \"no memory\");", 2) --- 238,248 ---- else: name = f.name ! args.append((get_c_type(f.type), name)) ! argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname in args]) ! ctype = get_c_type(type) ! self.emit("%s" % ctype, 0) emit("%s(%s)" % (cons.name, argstr)) emit("{") ! emit("%s p = (%s)malloc(sizeof(*p));" % (ctype, ctype), 1) emit("if (!p) {", 1) emit("PyErr_SetString(PyExc_MemoryError, \"no memory\");", 2) *************** *** 242,245 **** --- 271,276 ---- mod = asdl.parse(sys.argv[1]) f = open("%s-ast.c" % mod.name, "wb") + print >> f, '#include "Python.h"' + print >> f, '#include "asdl.h"\n' c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), *************** *** 247,249 **** c.visit(mod) f.close() - --- 278,279 ---- From fdrake@sourceforge.net Tue Apr 9 21:16:52 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 13:16:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv13063/texinputs Modified Files: python.sty Log Message: Add \csimplemacro to parallel the csimplemacrodesc environment. Fix a typo in the comments for csimplemacrodesc. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** python.sty 28 Mar 2002 22:28:43 -0000 1.92 --- python.sty 9 Apr 2002 20:16:47 -0000 1.93 *************** *** 614,618 **** % Funky macros ----------------------------------------------------------- ! % \begin{csimplemacro}{name} % -- "simple" because it has no args; NOT for constant definitions! \newenvironment{csimplemacrodesc}[1]{ --- 614,618 ---- % Funky macros ----------------------------------------------------------- ! % \begin{csimplemacrodesc}{name} % -- "simple" because it has no args; NOT for constant definitions! \newenvironment{csimplemacrodesc}[1]{ *************** *** 788,791 **** --- 788,792 ---- \newcommand{\bfcode}[1]{\code{\bfseries#1}} % bold-faced code font + \newcommand{\csimplemacro}[1]{\code{#1}} \newcommand{\kbd}[1]{\code{#1}} \newcommand{\samp}[1]{`\code{#1}'} From fdrake@sourceforge.net Tue Apr 9 21:17:44 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 13:17:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv13439/doc Modified Files: doc.tex Log Message: Document the \csimplemacro macro and the csimplemacrodesc environment. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** doc.tex 13 Mar 2002 02:48:24 -0000 1.60 --- doc.tex 9 Apr 2002 20:17:42 -0000 1.61 *************** *** 550,553 **** --- 550,563 ---- \end{envdesc} + \begin{envdesc}{csimplemacrodesc}{\p{name}} + Documentation for a ``simple'' macro. Simple macros are macros + which are used for code expansion, but which do not take + arguments so cannot be described as functions. This is not to + be used for simple constant definitions. Examples of it's use + in the Python documentation include + \csimplemacro{PyObject_HEAD} and + \csimplemacro{Py_BEGIN_ALLOW_THREADS}. + \end{envdesc} + \begin{envdesc}{ctypedesc}{\op{tag}\p{name}} Environment used to described a C type. The \var{name} *************** *** 734,737 **** --- 744,757 ---- \code{\#define} or a Python variable that is not intended to be changed. + \end{macrodesc} + + \begin{macrodesc}{csimplemacro}{\p{name}} + The name of a ``simple'' macro. Simple macros are macros + which are used for code expansion, but which do not take + arguments so cannot be described as functions. This is not to + be used for simple constant definitions. Examples of it's use + in the Python documentation include + \csimplemacro{PyObject_HEAD} and + \csimplemacro{Py_BEGIN_ALLOW_THREADS}. \end{macrodesc} From fdrake@sourceforge.net Tue Apr 9 22:09:44 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 14:09:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv1066/ext Modified Files: extending.tex Log Message: Update to use the new \csimplemacro macro Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** extending.tex 5 Apr 2002 23:01:14 -0000 1.17 --- extending.tex 9 Apr 2002 21:09:42 -0000 1.18 *************** *** 1069,1077 **** lock protecting Python's entire object space. However, it is possible to temporarily release this lock using the macro ! \code{Py_BEGIN_ALLOW_THREADS}, and to re-acquire it using ! \code{Py_END_ALLOW_THREADS}. This is common around blocking I/O ! calls, to let other threads use the processor while waiting for the I/O to ! complete. Obviously, the following function has the same problem as ! the previous one: \begin{verbatim} --- 1069,1077 ---- lock protecting Python's entire object space. However, it is possible to temporarily release this lock using the macro ! \csimplemacro{Py_BEGIN_ALLOW_THREADS}, and to re-acquire it using ! \csimplemacro{Py_END_ALLOW_THREADS}. This is common around blocking ! I/O calls, to let other threads use the processor while waiting for ! the I/O to complete. Obviously, the following function has the same ! problem as the previous one: \begin{verbatim} From fdrake@sourceforge.net Tue Apr 9 22:09:44 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 14:09:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv1066/api Modified Files: init.tex Log Message: Update to use the new \csimplemacro macro Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** init.tex 16 Oct 2001 19:23:55 -0000 1.2 --- init.tex 9 Apr 2002 21:09:42 -0000 1.3 *************** *** 392,401 **** \end{verbatim} ! The \code{Py_BEGIN_ALLOW_THREADS}\ttindex{Py_BEGIN_ALLOW_THREADS} macro ! opens a new block and declares a hidden local variable; the ! \code{Py_END_ALLOW_THREADS}\ttindex{Py_END_ALLOW_THREADS} macro closes ! the block. Another advantage of using these two macros is that when ! Python is compiled without thread support, they are defined empty, ! thus saving the thread state and lock manipulations. When thread support is enabled, the block above expands to the --- 392,402 ---- \end{verbatim} ! The ! \csimplemacro{Py_BEGIN_ALLOW_THREADS}\ttindex{Py_BEGIN_ALLOW_THREADS} ! macro opens a new block and declares a hidden local variable; the ! \csimplemacro{Py_END_ALLOW_THREADS}\ttindex{Py_END_ALLOW_THREADS} ! macro closes the block. Another advantage of using these two macros ! is that when Python is compiled without thread support, they are ! defined empty, thus saving the thread state and lock manipulations. When thread support is enabled, the block above expands to the *************** *** 575,581 **** \samp{\{ PyThreadState *_save; _save = PyEval_SaveThread();}. Note that it contains an opening brace; it must be matched with a ! following \code{Py_END_ALLOW_THREADS} macro. See above for further ! discussion of this macro. It is a no-op when thread support is ! disabled at compile time. \end{csimplemacrodesc} --- 576,582 ---- \samp{\{ PyThreadState *_save; _save = PyEval_SaveThread();}. Note that it contains an opening brace; it must be matched with a ! following \csimplemacro{Py_END_ALLOW_THREADS} macro. See above for ! further discussion of this macro. It is a no-op when thread support ! is disabled at compile time. \end{csimplemacrodesc} *************** *** 583,602 **** This macro expands to \samp{PyEval_RestoreThread(_save); \}}. Note that it contains a closing brace; it must be matched with an ! earlier \code{Py_BEGIN_ALLOW_THREADS} macro. See above for further ! discussion of this macro. It is a no-op when thread support is ! disabled at compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_BLOCK_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save);}: it is ! equivalent to \code{Py_END_ALLOW_THREADS} without the closing brace. ! It is a no-op when thread support is disabled at compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_UNBLOCK_THREADS} This macro expands to \samp{_save = PyEval_SaveThread();}: it is ! equivalent to \code{Py_BEGIN_ALLOW_THREADS} without the opening ! brace and variable declaration. It is a no-op when thread support ! is disabled at compile time. \end{csimplemacrodesc} --- 584,604 ---- This macro expands to \samp{PyEval_RestoreThread(_save); \}}. Note that it contains a closing brace; it must be matched with an ! earlier \csimplemacro{Py_BEGIN_ALLOW_THREADS} macro. See above for ! further discussion of this macro. It is a no-op when thread support ! is disabled at compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_BLOCK_THREADS} This macro expands to \samp{PyEval_RestoreThread(_save);}: it is ! equivalent to \csimplemacro{Py_END_ALLOW_THREADS} without the ! closing brace. It is a no-op when thread support is disabled at ! compile time. \end{csimplemacrodesc} \begin{csimplemacrodesc}{Py_UNBLOCK_THREADS} This macro expands to \samp{_save = PyEval_SaveThread();}: it is ! equivalent to \csimplemacro{Py_BEGIN_ALLOW_THREADS} without the ! opening brace and variable declaration. It is a no-op when thread ! support is disabled at compile time. \end{csimplemacrodesc} From tim_one@sourceforge.net Tue Apr 9 22:18:40 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 09 Apr 2002 14:18:40 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv5074/python/PCbuild Modified Files: BUILDno.txt Log Message: Repair 2.2.1 release date. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** BUILDno.txt 8 Apr 2002 18:47:34 -0000 1.37 --- BUILDno.txt 9 Apr 2002 21:18:37 -0000 1.38 *************** *** 37,41 **** 8-Apr-2002 34 2.2.1 (final) ! 9-Apr-2002 33 2.2.1c2 26-Mar-2002 --- 37,41 ---- 8-Apr-2002 34 2.2.1 (final) ! 10-Apr-2002 33 2.2.1c2 26-Mar-2002 From tim_one@sourceforge.net Tue Apr 9 22:19:55 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 09 Apr 2002 14:19:55 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.26.4.6,1.26.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv5535/221/PCbuild Modified Files: Tag: release22-maint BUILDno.txt Log Message: Repair 2.2.1 release date. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.26.4.6 retrieving revision 1.26.4.7 diff -C2 -d -r1.26.4.6 -r1.26.4.7 *** BUILDno.txt 4 Apr 2002 21:47:49 -0000 1.26.4.6 --- BUILDno.txt 9 Apr 2002 21:19:53 -0000 1.26.4.7 *************** *** 35,39 **** ---------------------------- 34 2.2.1 (final) ! 9-Apr-2002 33 2.2.1c2 26-Mar-2002 --- 35,39 ---- ---------------------------- 34 2.2.1 (final) ! 10-Apr-2002 33 2.2.1c2 26-Mar-2002 From fdrake@sourceforge.net Tue Apr 9 22:22:09 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 14:22:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv6582/api Modified Files: newtypes.tex Log Message: Started filling in the information about some of the basic types and macros used to define Python objects. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** newtypes.tex 5 Apr 2002 23:01:14 -0000 1.5 --- newtypes.tex 9 Apr 2002 21:22:07 -0000 1.6 *************** *** 123,129 **** \section{Common Object Structures \label{common-structs}} ! PyObject, PyVarObject ! PyObject_HEAD, PyObject_HEAD_INIT, PyObject_VAR_HEAD Typedefs: --- 123,191 ---- \section{Common Object Structures \label{common-structs}} ! There are a large number of structures which are used in the ! definition of object types for Python. This section describes these ! structures and how they are used. ! All Python objects ultimately share a small number of fields at the ! beginning of the object's representation in memory. These are ! represented by the \ctype{PyObject} and \ctype{PyVarObject} types, ! which are defined, in turn, by the expansions of some macros also ! used, whether directly or indirectly, in the definition of all other ! Python objects. ! ! \begin{ctypedesc}{PyObject} ! All object types are extensions of this type. This is a type which ! contains the information Python needs to treat a pointer to an ! object as an object. In a normal ``release'' build, it contains ! only the objects reference count and a pointer to the corresponding ! type object. It corresponds to the fields defined by the ! expansion of the \code{PyObject_VAR_HEAD} macro. ! \end{ctypedesc} ! ! \begin{ctypedesc}{PyVarObject} ! This is an extension of \ctype{PyObject} that adds the ! \member{ob_size} field. This is only used for objects that have ! some notion of \emph{length}. This type does not often appear in ! the Python/C API. It corresponds to the fields defined by the ! expansion of the \code{PyObject_VAR_HEAD} macro. ! \end{ctypedesc} ! ! These macros are used in the definition of \ctype{PyObject} and ! \ctype{PyVarObject}: ! ! \begin{csimplemacrodesc}{PyObject_HEAD} ! This is a macro which expands to the declarations of the fields of ! the \ctype{PyObject} type; it is used when declaring new types which ! represent objects without a varying length. The specific fields it ! expands to depends on the definition of ! \csimplemacro{Py_TRACE_REFS}. By default, that macro is not ! defined, and \csimplemacro{PyObject_HEAD} expands to: ! \begin{verbatim} ! int ob_refcnt; ! PyTypeObject *ob_type; ! \end{verbatim} ! When \csimplemacro{Py_TRACE_REFS} is defined, it expands to: ! \begin{verbatim} ! PyObject *_ob_next, *_ob_prev; ! int ob_refcnt; ! PyTypeObject *ob_type; ! \end{verbatim} ! \end{csimplemacrodesc} ! ! \begin{csimplemacrodesc}{PyObject_VAR_HEAD} ! This is a macro which expands to the declarations of the fields of ! the \ctype{PyVarObject} type; it is used when declaring new types which ! represent objects with a length that varies from instance to ! instance. This macro always expands to: ! \begin{verbatim} ! PyObject_HEAD ! int ob_size; ! \end{verbatim} ! Note that \csimplemacro{PyObject_HEAD} is part of the expansion, and ! that it's own expansion varies depending on the definition of ! \csimplemacro{Py_TRACE_REFS}. ! \end{csimplemacrodesc} ! ! PyObject_HEAD_INIT Typedefs: *************** *** 135,138 **** --- 197,205 ---- \begin{ctypedesc}{PyCFunction} Type of the functions used to implement most Python callables in C. + Functions of this type take two \ctype{PyObject*} parameters and + return one such value. If the return value is \NULL, an exception + shall have been set. If not \NULL, the return value is interpreted + as the return value of the function as exposed in Python. The + function must return a new reference. \end{ctypedesc} From fdrake@sourceforge.net Wed Apr 10 02:45:13 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 18:45:13 -0700 Subject: [Python-checkins] python/dist/src/Lib whrandom.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20473/Lib Modified Files: whrandom.py Log Message: Add a deprecation warning to reflect the documented deprecation of the whrandom module. (The deprecation was effective in Python 2.1.) Index: whrandom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whrandom.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** whrandom.py 15 Jan 2001 03:34:38 -0000 1.18 --- whrandom.py 10 Apr 2002 01:45:11 -0000 1.19 *************** *** 37,40 **** --- 37,45 ---- # Adrian Baddeley. + import warnings + warnings.warn("the whrandom module is deprecated; please use random", + DeprecationWarning) + del warnings + class whrandom: From nnorwitz@sourceforge.net Wed Apr 10 03:04:02 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Tue, 09 Apr 2002 19:04:02 -0700 Subject: [Python-checkins] python/dist/src/Lib statcache.py,1.13,1.14 xmllib.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24186 Modified Files: statcache.py xmllib.py Log Message: Add deprecation warnings for modules as documented Index: statcache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/statcache.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** statcache.py 9 Apr 2002 18:12:58 -0000 1.13 --- statcache.py 10 Apr 2002 02:04:00 -0000 1.14 *************** *** 4,7 **** --- 4,12 ---- """ + import warnings + warnings.warn("The statcache module is obsolete. Use os.stat() instead.", + DeprecationWarning) + del warnings + import os as _os from stat import * Index: xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmllib.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** xmllib.py 14 Mar 2001 17:03:30 -0000 1.28 --- xmllib.py 10 Apr 2002 02:04:00 -0000 1.29 *************** *** 6,9 **** --- 6,13 ---- import string + import warnings + warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", + DeprecationWarning) + del warnings version = '0.3' From jhylton@sourceforge.net Wed Apr 10 04:14:00 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:14:00 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.3,1.4 asdl_c.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv5173 Modified Files: asdl.py asdl_c.py Log Message: Move VisitorBase from asdl_c to asdl. Add Check visitor in asdl that looks for errors. So far the only error checking is to verify that the same constructor name isn't used more than once (even in different types). It's not sensible to reuse names, because you couldn't tell which type was implied from the constructor alone. Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** asdl.py 9 Apr 2002 19:13:53 -0000 1.3 --- asdl.py 10 Apr 2002 03:13:58 -0000 1.4 *************** *** 11,14 **** --- 11,17 ---- #__metaclass__ = type + import os + import traceback + import spark *************** *** 300,303 **** --- 303,376 ---- return "Product(%s)" % self.fields + class VisitorBase(object): + + def __init__(self, skip=0): + self.cache = {} + self.skip = skip + + def visit(self, object, *args): + meth = self._dispatch(object) + if meth is None: + return + try: + meth(object, *args) + except Exception, err: + print "Error visiting", repr(object) + print err + traceback.print_exc() + # XXX hack + if hasattr(self, 'file'): + self.file.flush() + os._exit(1) + + def _dispatch(self, object): + assert isinstance(object, AST), repr(object) + klass = object.__class__ + meth = self.cache.get(klass) + if meth is None: + methname = "visit" + klass.__name__ + if self.skip: + meth = getattr(self, methname, None) + else: + meth = getattr(self, methname) + self.cache[object.__class__] = meth + return meth + + class Check(VisitorBase): + + def __init__(self): + super(Check, self).__init__(skip=1) + self.cons = {} + self.errors = 0 + + def visitModule(self, mod): + for dfn in mod.dfns: + self.visit(dfn) + + def visitType(self, type): + self.visit(type.value, type.name) + + def visitSum(self, sum, name): + for t in sum.types: + self.visit(t, name) + + def visitConstructor(self, cons, name): + key = str(cons.name) + conflict = self.cons.get(key) + if conflict is None: + self.cons[key] = name + else: + print "Redefinition of constructor %s" % key + print "Defined in %s and %s" % (conflict, name) + self.errors += 1 + + def check(mod): + v = Check() + v.visit(mod) + if v.errors: + return False + else: + return True + def parse(file): scanner = ASDLScanner() *************** *** 328,331 **** print "module", mod.name print len(mod.dfns), "definitions" ! for dfn in mod.dfns: ! print dfn --- 401,407 ---- print "module", mod.name print len(mod.dfns), "definitions" ! if not check(mod): ! print "Check failed" ! else: ! for dfn in mod.dfns: ! print dfn.type Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** asdl_c.py 9 Apr 2002 19:13:53 -0000 1.2 --- asdl_c.py 10 Apr 2002 03:13:58 -0000 1.3 *************** *** 24,53 **** return "%s_ty" % name - class VisitorBase(object): - - def __init__(self): - self.cache = {} - - def visit(self, object, *args): - meth = self._dispatch(object) - try: - meth(object, *args) - except Exception, err: - print "Error visiting", repr(object) - print err - traceback.print_exc() - self.file.flush() - os._exit(1) - - def _dispatch(self, object): - assert isinstance(object, asdl.AST), repr(object) - klass = object.__class__ - meth = self.cache.get(klass) - if meth is None: - methname = "visit" + klass.__name__ - meth = getattr(self, methname) - self.cache[object.__class__] = meth - return meth - def reflow_lines(s, depth): """Reflow the line s indented depth tabs. --- 24,27 ---- *************** *** 83,87 **** return lines ! class EmitVisitor(VisitorBase): """Visit that emits lines""" --- 57,61 ---- return lines ! class EmitVisitor(asdl.VisitorBase): """Visit that emits lines""" From jhylton@sourceforge.net Wed Apr 10 04:33:05 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:33:05 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast Makefile,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv8649 Modified Files: Makefile Log Message: Add -I to Makefile Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 10 Apr 2002 03:09:43 -0000 1.1 --- Makefile 10 Apr 2002 03:33:02 -0000 1.2 *************** *** 1,4 **** Python-ast.o: Python-ast.c ! gcc -Wall -o Python-ast.o Python-ast.c Python-ast.c: python.asdl --- 1,6 ---- + PYINCLUDE=/usr/local/include/python2.3 + Python-ast.o: Python-ast.c ! gcc -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c Python-ast.c: python.asdl From jhylton@sourceforge.net Wed Apr 10 04:48:27 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:48:27 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv11957 Modified Files: asdl.py Log Message: Define asdl builtin types here and not in asdl_c. Remove get_type_names() method on Module and runique() function. The functionality is subsumed in the check visitor. Reported use of undefined types in the error checker. Make sure that sequence attributes of objects are initialized to empty sequences instead of None when there are no values. Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** asdl.py 10 Apr 2002 03:13:58 -0000 1.4 --- asdl.py 10 Apr 2002 03:48:25 -0000 1.5 *************** *** 198,201 **** --- 198,203 ---- return Field(type, opt=1) + builtin_types = ("identifier", "string", "int", "bool") + # below is a collection of classes to capture the AST of an AST :-) # not sure if any of the methods are useful yet, but I'm adding them *************** *** 216,253 **** return "Module(%s, %s)" % (self.name, self.dfns) - def get_type_names(self): - """Return names opf all types even those contained in other types""" - # to aid debugging, can use to make sure all types have - # top-level definitions - def get_type_names(t): - if isinstance(t, Type): - return [t.name.value] + get_type_names(t.value) - elif isinstance(t, Constructor): - l = [t.name.value] - if t.fields is None: - return l - for f in t.fields: - l += get_type_names(f) - return l - elif isinstance(t, Field): - return [t.type.value] - elif isinstance(t, Sum): - l = [] - for e in t.types: - l += get_type_names(e) - return l - else: - return [] - names = reduce(runique, [get_type_names(t) for t in self.dfns]) - # capitals are for type constructors - return [name for name in names if name[0].lower() == name[0]] - - def runique(x, y): - """Return the unique elements of two sequences""" - d = {} - [d.__setitem__(elt, 0) for elt in x] # I'm feeling perverse today - [d.__setitem__(elt, 0) for elt in y] - return d.keys() - class Type(AST): def __init__(self, name, value): --- 218,221 ---- *************** *** 261,265 **** def __init__(self, name, fields=None): self.name = name ! self.fields = fields def __repr__(self): --- 229,233 ---- def __init__(self, name, fields=None): self.name = name ! self.fields = fields or [] def __repr__(self): *************** *** 288,292 **** def __init__(self, types, attributes=None): self.types = types ! self.attributes = attributes def __repr__(self): --- 256,260 ---- def __init__(self, types, attributes=None): self.types = types ! self.attributes = attributes or [] def __repr__(self): *************** *** 343,346 **** --- 311,315 ---- self.cons = {} self.errors = 0 + self.types = {} def visitModule(self, mod): *************** *** 349,353 **** def visitType(self, type): ! self.visit(type.value, type.name) def visitSum(self, sum, name): --- 318,322 ---- def visitType(self, type): ! self.visit(type.value, str(type.name)) def visitSum(self, sum, name): *************** *** 364,371 **** --- 333,358 ---- print "Defined in %s and %s" % (conflict, name) self.errors += 1 + for f in cons.fields: + self.visit(f, key) + + def visitField(self, field, name): + key = str(field.type) + l = self.types.setdefault(key, []) + l.append(name) + + def visitProduct(self, prod, name): + for f in prod.fields: + self.visit(f, name) def check(mod): v = Check() v.visit(mod) + + for t in v.types: + if not mod.types.has_key(t) and not t in builtin_types: + v.errors += 1 + uses = ", ".join(v.types[t]) + print "Undefined type %s, used in %s" % (t, uses) + if v.errors: return False From jhylton@sourceforge.net Wed Apr 10 04:48:53 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:48:53 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv12029 Modified Files: asdl_c.py Log Message: Define asdl builtin types here and not in asdl_c. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** asdl_c.py 10 Apr 2002 03:13:58 -0000 1.3 --- asdl_c.py 10 Apr 2002 03:48:50 -0000 1.4 *************** *** 8,13 **** MAX_COL = 76 - _builtin_types = ("identifier", "string", "int", "bool") - def get_c_type(name): """Return a string for the C name of the type. --- 8,11 ---- *************** *** 19,23 **** if isinstance(name, asdl.Id): name = name.value ! if name in _builtin_types: return name else: --- 17,21 ---- if isinstance(name, asdl.Id): name = name.value ! if name in asdl.builtin_types: return name else: *************** *** 244,247 **** --- 242,247 ---- mod = asdl.parse(sys.argv[1]) + if not asdl.check(mod): + sys.exit(1) f = open("%s-ast.c" % mod.name, "wb") print >> f, '#include "Python.h"' From jhylton@sourceforge.net Wed Apr 10 04:50:41 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:50:41 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv12340 Modified Files: python.asdl Log Message: Continuing refinements. Finish TryExcept() by adding except type. Finish Call() by adding keyword type. Separate string and number literals. Add Lvalue() constructor to expr, which contains an assign type. Used to avoid repitition for constructors that can appear in expressions or as the target of an assignment. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** python.asdl 9 Apr 2002 19:13:36 -0000 1.3 --- python.asdl 10 Apr 2002 03:50:39 -0000 1.4 *************** *** 24,28 **** -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmts body) -- XXX | TryFinally(stmts body, stmts final) | Assert(expr test, expr? msg) --- 24,28 ---- -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmts body, except* handlers) | TryFinally(stmts body, stmts final) | Assert(expr test, expr? msg) *************** *** 56,68 **** -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) ! | Call(expr func, expr* args, XXX keywords, expr? starargs, expr? kwargs) | Repr(expr) ! | Literal(string) -- numbers, strings -- probably separate ! -- the following items appear in expr and assign ! | Attribute(expr value, identifier attr) ! | Subscript(expr value, slice slice) ! | Name(identifier) ! | List(expr* elts) | Tuple(expr *elts) -- the subset of expressions that are valid as the target of --- 56,66 ---- -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) ! | Call(expr func, expr* args, keyword* keywords, expr? starargs, expr? kwargs) | Repr(expr) ! | Lvalue(assign lvalue) ! | Number(string n) -- string representation of a number ! | String(string s) -- need to specify raw, unicode, etc? ! -- other literals? bools? -- the subset of expressions that are valid as the target of *************** *** 89,95 **** --- 87,99 ---- listcomp = (expr target, expr iter, expr* ifs) + -- not sure what to call the first argument for raise and except + + except = (expr type, identifier? name) + -- XXX need to handle 'def f((a, b)):' arguments = (identifier* args, identifer? vararg, identifier? kwarg, expr* defaults) + -- keyword arguments supplied to call + keyword = (identifier arg, expr value) } From jhylton@sourceforge.net Wed Apr 10 04:52:11 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:52:11 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv12544 Modified Files: python.asdl Log Message: Typo 'identifer' -> 'identifier' Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** python.asdl 10 Apr 2002 03:50:39 -0000 1.4 --- python.asdl 10 Apr 2002 03:52:09 -0000 1.5 *************** *** 92,96 **** -- XXX need to handle 'def f((a, b)):' ! arguments = (identifier* args, identifer? vararg, identifier? kwarg, expr* defaults) --- 92,96 ---- -- XXX need to handle 'def f((a, b)):' ! arguments = (identifier* args, identifier? vararg, identifier? kwarg, expr* defaults) From jhylton@sourceforge.net Wed Apr 10 04:53:36 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:53:36 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv12757 Modified Files: python.asdl Log Message: Add a name to expr field in Repr. (It was the only field with an unnamed value.) Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** python.asdl 10 Apr 2002 03:52:09 -0000 1.5 --- python.asdl 10 Apr 2002 03:53:34 -0000 1.6 *************** *** 58,62 **** | Call(expr func, expr* args, keyword* keywords, expr? starargs, expr? kwargs) ! | Repr(expr) | Lvalue(assign lvalue) | Number(string n) -- string representation of a number --- 58,62 ---- | Call(expr func, expr* args, keyword* keywords, expr? starargs, expr? kwargs) ! | Repr(expr value) | Lvalue(assign lvalue) | Number(string n) -- string representation of a number From jhylton@sourceforge.net Wed Apr 10 04:57:42 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:57:42 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast Makefile,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv13515 Modified Files: Makefile Log Message: Add -c -pedantic flags to gcc Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 10 Apr 2002 03:33:02 -0000 1.2 --- Makefile 10 Apr 2002 03:57:40 -0000 1.3 *************** *** 2,6 **** Python-ast.o: Python-ast.c ! gcc -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c Python-ast.c: python.asdl --- 2,6 ---- Python-ast.o: Python-ast.c ! gcc -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c Python-ast.c: python.asdl From jhylton@sourceforge.net Wed Apr 10 04:58:03 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:58:03 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv13604 Modified Files: python.asdl Log Message: Add name for Name() (a second constructor missing one) Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** python.asdl 10 Apr 2002 03:53:34 -0000 1.6 --- python.asdl 10 Apr 2002 03:58:01 -0000 1.7 *************** *** 68,72 **** assign = Attribute(expr value, identifier attr) | Subscript(expr value, slice slice) ! | Name(identifier) | List(expr* elts) | Tuple(expr *elts) --- 68,72 ---- assign = Attribute(expr value, identifier attr) | Subscript(expr value, slice slice) ! | Name(identifier id) | List(expr* elts) | Tuple(expr *elts) From jhylton@sourceforge.net Wed Apr 10 04:58:31 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 09 Apr 2002 20:58:31 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv13719 Modified Files: asdl_c.py Log Message: Add one entry on to do list. Add semicolon at the end of struct declaration. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** asdl_c.py 10 Apr 2002 03:48:50 -0000 1.4 --- asdl_c.py 10 Apr 2002 03:58:28 -0000 1.5 *************** *** 1,4 **** --- 1,7 ---- """Generate C code from an ASDL description.""" + # TO DO + # handle fields that have a type but no name + import os, sys, traceback *************** *** 144,148 **** self.visit(t, depth + 2) emit("} v;", depth + 1) ! emit("}") emit("") --- 147,151 ---- self.visit(t, depth + 2) emit("} v;", depth + 1) ! emit("};") emit("") From fdrake@sourceforge.net Wed Apr 10 05:19:14 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 21:19:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools/sgmlconv conversion.xml,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv18381 Modified Files: conversion.xml Log Message: Added support for \csimplemacro and csimplemacrodesc. Index: conversion.xml =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/conversion.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** conversion.xml 4 Apr 2002 21:39:42 -0000 1.26 --- conversion.xml 10 Apr 2002 04:19:12 -0000 1.27 *************** *** 99,102 **** --- 99,105 ---- + + + *************** *** 733,736 **** --- 736,742 ---- + + + From fdrake@sourceforge.net Wed Apr 10 05:20:36 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 09 Apr 2002 21:20:36 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools/sgmlconv latex2esis.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv18678 Modified Files: latex2esis.py Log Message: When adding a name to the table of macros and environments, make sure it is not already present. If it is, raise an exception, since that should not happen in a well-defined conversion. Index: latex2esis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/latex2esis.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** latex2esis.py 5 Apr 2002 18:09:22 -0000 1.29 --- latex2esis.py 10 Apr 2002 04:20:33 -0000 1.30 *************** *** 488,492 **** self.__current.outputname = attrs.get("outputname") def end_macro(self): ! self.__table[self.__current.name] = self.__current self.__current = None --- 488,495 ---- self.__current.outputname = attrs.get("outputname") def end_macro(self): ! name = self.__current.name ! if self.__table.has_key(name): ! raise ValueError("name %s already in use" % `name`) ! self.__table[name] = self.__current self.__current = None From montanaro@sourceforge.net Wed Apr 10 05:37:12 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Tue, 09 Apr 2002 21:37:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmimetools.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22264 Modified Files: libmimetools.tex Log Message: document all the valid encoding values Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** libmimetools.tex 3 Aug 2001 18:39:36 -0000 1.20 --- libmimetools.tex 10 Apr 2002 04:37:09 -0000 1.21 *************** *** 30,34 **** object \var{input} and write the decoded data to open file object \var{output}. Valid values for \var{encoding} include ! \code{'base64'}, \code{'quoted-printable'} and \code{'uuencode'}. \end{funcdesc} --- 30,37 ---- object \var{input} and write the decoded data to open file object \var{output}. Valid values for \var{encoding} include ! \code{'base64'}, \code{'quoted-printable'}, \code{'uuencode'}, ! \code{'x-uuencode'}, \code{'uue'}, \code{'x-uue'}, \code{'7bit'}, and ! \code{'8bit'}. Decoding messages encoded in \code{'7bit'} or \code{'8bit'} ! has no effect. The input is simply copied to the output. \end{funcdesc} From fdrake@sourceforge.net Wed Apr 10 19:16:37 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Wed, 10 Apr 2002 11:16:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/api api.tex,1.117.2.13,1.117.2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv20217/api Modified Files: Tag: release21-maint api.tex Log Message: Document PyType_IS_GC(). Update description of PyType_Check(). Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.117.2.13 retrieving revision 1.117.2.14 diff -C2 -d -r1.117.2.13 -r1.117.2.14 *** api.tex 4 Apr 2002 04:21:23 -0000 1.117.2.13 --- api.tex 10 Apr 2002 18:16:32 -0000 1.117.2.14 *************** *** 2193,2197 **** \begin{cfuncdesc}{int}{PyType_Check}{PyObject *o} ! Returns true is the object \var{o} is a type object. \end{cfuncdesc} --- 2193,2199 ---- \begin{cfuncdesc}{int}{PyType_Check}{PyObject *o} ! Returns true if the object \var{o} is a type object, including ! instances of types derived from the standard type object. Returns ! false in all other cases. \end{cfuncdesc} *************** *** 2199,2202 **** --- 2201,2210 ---- Returns true if the type object \var{o} sets the feature \var{feature}. Type features are denoted by single bit flags. + \end{cfuncdesc} + + \begin{cfuncdesc}{int}{PyType_IS_GC}{PyObject *o} + Return true if the type object includes support for the cycle + detector; this tests the type flag \constant{Py_TPFLAGS_HAVE_GC}. + \versionadded{2.0} \end{cfuncdesc} From fdrake@sourceforge.net Wed Apr 10 18:52:55 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Wed, 10 Apr 2002 10:52:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv13596/api Modified Files: concrete.tex Log Message: Document PyType_CheckExact(), PyType_IS_GC(). Update description of PyType_Check(). Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** concrete.tex 12 Mar 2002 20:12:54 -0000 1.9 --- concrete.tex 10 Apr 2002 17:52:52 -0000 1.10 *************** *** 37,41 **** \begin{cfuncdesc}{int}{PyType_Check}{PyObject *o} ! Returns true is the object \var{o} is a type object. \end{cfuncdesc} --- 37,50 ---- \begin{cfuncdesc}{int}{PyType_Check}{PyObject *o} ! Returns true if the object \var{o} is a type object, including ! instances of types derived from the standard type object. Returns ! false in all other cases. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyType_CheckExact}{PyObject *o} ! Returns true if the object \var{o} is a type object, but not a ! subtype of the standard type object. Returns false in all other ! cases. ! \versionadded{2.2} \end{cfuncdesc} *************** *** 43,46 **** --- 52,61 ---- Returns true if the type object \var{o} sets the feature \var{feature}. Type features are denoted by single bit flags. + \end{cfuncdesc} + + \begin{cfuncdesc}{int}{PyType_IS_GC}{PyObject *o} + Return true if the type object includes support for the cycle + detector; this tests the type flag \constant{Py_TPFLAGS_HAVE_GC}. + \versionadded{2.0} \end{cfuncdesc} From akuchling@sourceforge.net Wed Apr 10 15:54:41 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 07:54:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test sortperf.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23868 Modified Files: sortperf.py Log Message: Use random instead of whrandom Index: sortperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/sortperf.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sortperf.py 9 Feb 2001 11:41:34 -0000 1.6 --- sortperf.py 10 Apr 2002 14:54:39 -0000 1.7 *************** *** 8,12 **** import sys import time ! import whrandom import marshal import tempfile --- 8,12 ---- import sys import time ! import random import marshal import tempfile *************** *** 24,28 **** result = [] for i in range(n): ! result.append(whrandom.random()) try: try: --- 24,28 ---- result = [] for i in range(n): ! result.append(random.random()) try: try: *************** *** 45,49 **** # Shuffle it a bit... for i in range(10): ! i = whrandom.randint(0, n-1) temp = result[:i] del result[:i] --- 45,49 ---- # Shuffle it a bit... for i in range(10): ! i = random.randrange(0, n) temp = result[:i] del result[:i] From akuchling@sourceforge.net Wed Apr 10 15:50:19 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 07:50:19 -0700 Subject: [Python-checkins] python/dist/src/Demo/curses life.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/curses In directory usw-pr-cvs1:/tmp/cvs-serv21831 Modified Files: life.py Log Message: Use random module instead of whrandom Move imports to top Index: life.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/curses/life.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** life.py 5 Nov 2001 21:21:55 -0000 1.2 --- life.py 10 Apr 2002 14:50:16 -0000 1.3 *************** *** 18,21 **** --- 18,24 ---- # + import random, string, traceback + import curses + class LifeBoard: """Encapsulates a Life board *************** *** 119,127 **** def makeRandom(self): "Fill the board with a random pattern" - import whrandom self.state={} for i in range(0, self.X): for j in range(0, self.Y): ! if whrandom.random()*10>5.0: self.set(j,i) --- 122,129 ---- def makeRandom(self): "Fill the board with a random pattern" self.state={} for i in range(0, self.X): for j in range(0, self.Y): ! if random.random() > 0.5: self.set(j,i) *************** *** 140,144 **** def main(stdscr): - import string, curses # Clear the screen and display the menu of keys --- 142,145 ---- *************** *** 197,201 **** if __name__=='__main__': - import curses, traceback try: # Initialize curses --- 198,201 ---- From lemburg@sourceforge.net Wed Apr 10 21:36:16 2002 From: lemburg@sourceforge.net (lemburg@sourceforge.net) Date: Wed, 10 Apr 2002 13:36:16 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.135,2.136 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1896/Objects Modified Files: unicodeobject.c Log Message: Bug fix for UTF-8 encoding bug (buffer overrun) #541828. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.135 retrieving revision 2.136 diff -C2 -d -r2.135 -r2.136 *** unicodeobject.c 10 Apr 2002 17:18:02 -0000 2.135 --- unicodeobject.c 10 Apr 2002 20:36:13 -0000 2.136 *************** *** 1173,1176 **** --- 1173,1182 ---- #endif + /* Allocation strategy: we default to Latin-1, then do one resize + whenever we hit an order boundary. The assumption is that + characters from higher orders usually occur often enough to warrant + this. + */ + PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, int size, *************** *** 1179,1255 **** PyObject *v; char *p; - unsigned int cbAllocated = 2 * size; - unsigned int cbWritten = 0; int i = 0; ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! /* We allocate 4 more bytes to have room for at least one full ! UTF-8 sequence; saves a few cycles in the loop below */ ! v = PyString_FromStringAndSize(NULL, cbAllocated + 4); if (v == NULL) return NULL; p = PyString_AS_STRING(v); while (i < size) { Py_UCS4 ch = s[i++]; ! if (ch < 0x80) { *p++ = (char) ch; - cbWritten++; - } else if (ch < 0x0800) { *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); - cbWritten += 2; } else { ! ! /* Assure that we have enough room for high order Unicode ! ordinals */ ! if (cbWritten >= cbAllocated) { ! cbAllocated += 4 * 10; ! if (_PyString_Resize(&v, cbAllocated + 4)) ! goto onError; ! p = PyString_AS_STRING(v) + cbWritten; ! } ! if (ch < 0x10000) { ! /* Check for high surrogate */ if (0xD800 <= ch && ch <= 0xDBFF && i != size) { Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x00010000; ! *p++ = (char)(0xf0 | (ch >> 18)); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! i++; ! cbWritten += 4; ! continue; } /* Fall through: handles isolated high surrogates */ } *p++ = (char)(0xe0 | (ch >> 12)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); ! cbWritten += 3; ! ! } else { ! *p++ = (char)(0xf0 | (ch>>18)); ! *p++ = (char)(0x80 | ((ch>>12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch>>6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! cbWritten += 4; } } } *p = '\0'; ! if (_PyString_Resize(&v, cbWritten)) goto onError; return v; --- 1185,1262 ---- PyObject *v; char *p; int i = 0; ! int overalloc = 2; ! int len; ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! v = PyString_FromStringAndSize(NULL, overalloc * size); if (v == NULL) return NULL; p = PyString_AS_STRING(v); + while (i < size) { Py_UCS4 ch = s[i++]; ! if (ch < 0x80) ! /* Encode ASCII */ *p++ = (char) ch; else if (ch < 0x0800) { + /* Encode Latin-1 */ *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); } else { ! /* Encode UCS2 Unicode ordinals */ if (ch < 0x10000) { ! ! /* Special case: check for high surrogate */ if (0xD800 <= ch && ch <= 0xDBFF && i != size) { Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate and combine the two to ! form a UCS4 value */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; ! i++; ! goto encodeUCS4; } /* Fall through: handles isolated high surrogates */ } + + if (overalloc < 3) { + len = (int)(p - PyString_AS_STRING(v)); + overalloc = 3; + if (_PyString_Resize(&v, overalloc * size)) + goto onError; + p = PyString_AS_STRING(v) + len; + } *p++ = (char)(0xe0 | (ch >> 12)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); ! continue; } + + /* Encode UCS4 Unicode ordinals */ + encodeUCS4: + if (overalloc < 4) { + len = (int)(p - PyString_AS_STRING(v)); + overalloc = 4; + if (_PyString_Resize(&v, overalloc * size)) + goto onError; + p = PyString_AS_STRING(v) + len; + } + *p++ = (char)(0xf0 | (ch >> 18)); + *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); + *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); + *p++ = (char)(0x80 | (ch & 0x3f)); } } *p = '\0'; ! if (_PyString_Resize(&v, (int)(p - PyString_AS_STRING(v)))) goto onError; return v; From akuchling@sourceforge.net Wed Apr 10 22:14:04 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 14:14:04 -0700 Subject: [Python-checkins] python/dist/src/Demo/curses life.py,1.2,1.2.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/curses In directory usw-pr-cvs1:/tmp/cvs-serv16686 Modified Files: Tag: release22-maint life.py Log Message: Use random module instead of whrandom Move imports to top Index: life.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/curses/life.py,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -C2 -d -r1.2 -r1.2.8.1 *** life.py 5 Nov 2001 21:21:55 -0000 1.2 --- life.py 10 Apr 2002 21:14:02 -0000 1.2.8.1 *************** *** 18,21 **** --- 18,24 ---- # + import random, string, traceback + import curses + class LifeBoard: """Encapsulates a Life board *************** *** 119,127 **** def makeRandom(self): "Fill the board with a random pattern" - import whrandom self.state={} for i in range(0, self.X): for j in range(0, self.Y): ! if whrandom.random()*10>5.0: self.set(j,i) --- 122,129 ---- def makeRandom(self): "Fill the board with a random pattern" self.state={} for i in range(0, self.X): for j in range(0, self.Y): ! if random.random() > 0.5: self.set(j,i) *************** *** 140,144 **** def main(stdscr): - import string, curses # Clear the screen and display the menu of keys --- 142,145 ---- *************** *** 197,201 **** if __name__=='__main__': - import curses, traceback try: # Initialize curses --- 198,201 ---- From akuchling@sourceforge.net Wed Apr 10 22:14:39 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 14:14:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test sortperf.py,1.6,1.6.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16873 Modified Files: Tag: release22-maint sortperf.py Log Message: Use random instead of whrandom Index: sortperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/sortperf.py,v retrieving revision 1.6 retrieving revision 1.6.24.1 diff -C2 -d -r1.6 -r1.6.24.1 *** sortperf.py 9 Feb 2001 11:41:34 -0000 1.6 --- sortperf.py 10 Apr 2002 21:14:37 -0000 1.6.24.1 *************** *** 8,12 **** import sys import time ! import whrandom import marshal import tempfile --- 8,12 ---- import sys import time ! import random import marshal import tempfile *************** *** 24,28 **** result = [] for i in range(n): ! result.append(whrandom.random()) try: try: --- 24,28 ---- result = [] for i in range(n): ! result.append(random.random()) try: try: *************** *** 45,49 **** # Shuffle it a bit... for i in range(10): ! i = whrandom.randint(0, n-1) temp = result[:i] del result[:i] --- 45,49 ---- # Shuffle it a bit... for i in range(10): ! i = random.randrange(0, n) temp = result[:i] del result[:i] From akuchling@sourceforge.net Wed Apr 10 22:15:42 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 14:15:42 -0700 Subject: [Python-checkins] python/dist/src/Lib re.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17137 Modified Files: re.py Log Message: Remove support for importing 'pre' module Index: re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/re.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** re.py 4 Sep 2001 19:10:20 -0000 1.41 --- re.py 10 Apr 2002 21:15:40 -0000 1.42 *************** *** 1,7 **** """Minimal "re" compatibility wrapper""" - # If your regexps don't work well under 2.0b1, you can switch - # to the old engine ("pre") down below. - # # To help us fix any remaining bugs in the new engine, please # report what went wrong. You can either use the following web --- 1,4 ---- *************** *** 20,33 **** # ! engine = "sre" ! # engine = "pre" - if engine == "sre": - # New unicode-aware engine - from sre import * - from sre import __all__ - else: - # Old 1.5.2 engine. This one supports 8-bit strings only, - # and will be removed in 2.0 final. - from pre import * - from pre import __all__ --- 17,21 ---- # ! from sre import * ! from sre import __all__ From akuchling@sourceforge.net Wed Apr 10 22:28:33 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 14:28:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21708 Modified Files: libre.tex Log Message: Remove mention of 'pre' module (2.2 bugfix candidate?) Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** libre.tex 25 Mar 2002 20:22:59 -0000 1.81 --- libre.tex 10 Apr 2002 21:28:31 -0000 1.82 *************** *** 34,46 **** string notation. - \strong{Implementation note:} - The \module{re}\refstmodindex{pre} module has two distinct - implementations: \module{sre} is the default implementation and - includes Unicode support, but may run into stack limitations for some - patterns. Though this will be fixed for a future release of Python, - the older implementation (without Unicode support) is still available - as the \module{pre}\refstmodindex{pre} module. - - \begin{seealso} \seetitle{Mastering Regular Expressions}{Book on regular expressions --- 34,37 ---- From akuchling@sourceforge.net Wed Apr 10 22:36:14 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 14:36:14 -0700 Subject: [Python-checkins] python/dist/src/Lib pre.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24500 Modified Files: pre.py Log Message: Add deprecation warning to 'pre' module Index: pre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pre.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pre.py 11 May 2001 19:20:17 -0000 1.10 --- pre.py 10 Apr 2002 21:36:11 -0000 1.11 *************** *** 88,91 **** --- 88,97 ---- from pcre import * + # XXX This module is deprecated as of Python 2.3, and should be removed + # in the version that follows 2.3. + import warnings as _warnings + _warnings.warn("Please use the 're' module, not the 'pre' module", + DeprecationWarning) + __all__ = ["match","search","sub","subn","split","findall","escape","compile", "I","L","M","S","X","IGNORECASE","LOCALE","MULTILINE","DOTALL", From akuchling@sourceforge.net Wed Apr 10 22:53:24 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 14:53:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv29470 Modified Files: whatsnew22.tex Log Message: Add a name Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** whatsnew22.tex 1 Apr 2002 19:22:34 -0000 1.55 --- whatsnew22.tex 10 Apr 2002 21:53:22 -0000 1.56 *************** *** 1432,1436 **** Hudson, Jack Jansen, Marc-Andr\'e Lemburg, Martin von L\"owis, Fredrik Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, ! Don O'Donnell, Tim Peters, Jens Quade, Tom Reinhardt, Neil Schemenauer, Guido van Rossum, Greg Ward. --- 1432,1436 ---- Hudson, Jack Jansen, Marc-Andr\'e Lemburg, Martin von L\"owis, Fredrik Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, ! Don O'Donnell, Joonas Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil Schemenauer, Guido van Rossum, Greg Ward. From akuchling@sourceforge.net Wed Apr 10 23:10:02 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 10 Apr 2002 15:10:02 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1940 Modified Files: pep-0004.txt Log Message: Add 'pre' to list of deprecated modules Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0004.txt 1 Nov 2001 05:30:35 -0000 1.2 --- pep-0004.txt 10 Apr 2002 22:09:55 -0000 1.3 *************** *** 98,101 **** --- 98,109 ---- Documentation: TBD + Module name: pre + Rationale: The underlying PCRE engine doesn't support Unicode, and + has been unmaintained since Python 1.5.2. + Date: 10-Apr-2002 + Documentation: It was only mentioned as an implementation detail, + and never had a section of its own. This mention + has now been removed. + Undeprecated modules From jhylton@sourceforge.net Thu Apr 11 00:03:34 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Wed, 10 Apr 2002 16:03:34 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv14803 Modified Files: python.asdl Log Message: Rename stmts to stmt. It only describes a single statement. (Thanks to Finn Bock for observing this.) Make uses of stmt be stmt*, since there can be many statements or none. Q: Does we need "pass" or is that just a NULL stmt value? Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** python.asdl 10 Apr 2002 03:58:01 -0000 1.7 --- python.asdl 10 Apr 2002 23:03:32 -0000 1.8 *************** *** 3,10 **** module Python { ! mod = Module(stmts body) ! stmts = FunctionDef(identifier name, arguments args, stmts body) ! | ClassDef(identifier name, expr* bases, stmts body) | Return(expr value) | Yield(expr value) --- 3,10 ---- module Python { ! mod = Module(stmt* body) ! stmt = FunctionDef(identifier name, arguments args, stmt* body) ! | ClassDef(identifier name, expr* bases, stmt* body) | Return(expr value) | Yield(expr value) *************** *** 18,29 **** -- XXX use 'orelse' because else is a keyword -- need a better solution for that ! | For(expr target, expr iter, stmts body, stmts orelse) ! | While(expr test, stmts body, stmts orelse) ! | If(expr test, stmts body, stmts? orelse) -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmts body, except* handlers) ! | TryFinally(stmts body, stmts final) | Assert(expr test, expr? msg) --- 18,29 ---- -- XXX use 'orelse' because else is a keyword -- need a better solution for that ! | For(expr target, expr iter, stmt body, stmt orelse) ! | While(expr test, stmt body, stmt orelse) ! | If(expr test, stmt body, stmt? orelse) -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmt body, except* handlers) ! | TryFinally(stmt body, stmt final) | Assert(expr test, expr? msg) From fdrake@sourceforge.net Thu Apr 11 04:59:47 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Wed, 10 Apr 2002 20:59:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13712/Lib/test Modified Files: test_weakref.py Log Message: Improve coverage of Objects/weakrefobject.c. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_weakref.py 19 Dec 2001 16:54:23 -0000 1.17 --- test_weakref.py 11 Apr 2002 03:59:42 -0000 1.18 *************** *** 47,50 **** --- 47,59 ---- self.check_basic_ref(create_unbound_method) + # Just make sure the tp_repr handler doesn't raise an exception. + # Live reference: + o = C() + wr = weakref.ref(o) + `wr` + # Dead reference: + del o + `wr` + def test_basic_callback(self): self.check_basic_callback(C) *************** *** 167,170 **** --- 176,186 ---- p2 = weakref.proxy(L2) self.assertEqual(p, p2) + ## self.assertEqual(`L2`, `p2`) + L3 = UserList.UserList(range(10)) + p3 = weakref.proxy(L3) + self.assertEqual(L3[:], p3[:]) + self.assertEqual(L3[5:], p3[5:]) + self.assertEqual(L3[:5], p3[:5]) + self.assertEqual(L3[2:5], p3[2:5]) def test_callable_proxy(self): From mhammond@sourceforge.net Thu Apr 11 06:40:37 2002 From: mhammond@sourceforge.net (mhammond@sourceforge.net) Date: Wed, 10 Apr 2002 22:40:37 -0700 Subject: [Python-checkins] python/dist/src/PC pyc.ico,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv3555 Modified Files: pyc.ico Log Message: Different .pyc icon - use "paler" colors to better differentiate it from the main .py icon. As discussed with Tim (prompted by cl.lpy posting) Index: pyc.ico =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyc.ico,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs7VB6ai and /tmp/cvsgEqjdq differ From tim_one@sourceforge.net Thu Apr 11 07:36:48 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Wed, 10 Apr 2002 23:36:48 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.33,2.34 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14060/python/Objects Modified Files: obmalloc.c Log Message: SF bug 542181: Realloc behavior The bug report pointed out a bogosity in the comment block explaining thread safety for arena management. Repaired that comment, repaired a couple others while I was at it, and added an assert. _PyMalloc_DebugRealloc: If this needed to get more memory, but couldn't, it erroneously freed the original memory. Repaired that. This is for 2.3 only (unless we decide to backport the new pymalloc). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -d -r2.33 -r2.34 *** obmalloc.c 6 Apr 2002 01:45:35 -0000 2.33 --- obmalloc.c 11 Apr 2002 06:36:45 -0000 2.34 *************** *** 322,332 **** So long as a pool is in the used state, we're certain there *is* a block ! available for allocating. If pool->freeblock is NULL then, that means we ! simply haven't yet gotten to one of the higher-address blocks. The offset ! from the pool_header to the start of "the next" virgin block is stored in ! the pool_header nextoffset member, and the largest value of nextoffset that ! makes sense is stored in the maxnextoffset member when a pool is initialized. ! All the blocks in a pool have been passed out at least once when and only ! when nextoffset > maxnextoffset. --- 322,333 ---- So long as a pool is in the used state, we're certain there *is* a block ! available for allocating, and pool->freeblock is not NULL. If pool->freeblock ! points to the end of the free list before we've carved the entire pool into ! blocks, that means we simply haven't yet gotten to one of the higher-address ! blocks. The offset from the pool_header to the start of "the next" virgin ! block is stored in the pool_header nextoffset member, and the largest value ! of nextoffset that makes sense is stored in the maxnextoffset member when a ! pool is initialized. All the blocks in a pool have been passed out at least ! once when and only when nextoffset > maxnextoffset. *************** *** 468,473 **** } else if (narenas == maxarenas) { ! /* Grow arenas. Don't use realloc: if this fails, we ! * don't want to lose the base addresses we already have. * * Exceedingly subtle: Someone may be calling the pymalloc --- 469,473 ---- } else if (narenas == maxarenas) { ! /* Grow arenas. * * Exceedingly subtle: Someone may be calling the pymalloc *************** *** 591,594 **** --- 591,595 ---- ++pool->ref.count; bp = pool->freeblock; + assert(bp != NULL); if ((pool->freeblock = *(block **)bp) != NULL) { UNLOCK(); *************** *** 1058,1067 **** } /* More memory is needed: get it, copy over the first original_nbytes of the original data, and free the original memory. */ fresh = _PyMalloc_DebugMalloc(nbytes); ! if (fresh != NULL && original_nbytes > 0) ! memcpy(fresh, p, original_nbytes); ! _PyMalloc_DebugFree(p); return fresh; } --- 1059,1071 ---- } + assert(nbytes != 0); /* More memory is needed: get it, copy over the first original_nbytes of the original data, and free the original memory. */ fresh = _PyMalloc_DebugMalloc(nbytes); ! if (fresh != NULL) { ! if (original_nbytes > 0) ! memcpy(fresh, p, original_nbytes); ! _PyMalloc_DebugFree(p); ! } return fresh; } From fdrake@sourceforge.net Thu Apr 11 15:30:17 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 07:30:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11028 Modified Files: pep-0102.txt Log Message: Update the instructions on release notes now that we do not use the SF file release machinery for that. Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0102.txt 11 Apr 2002 14:11:27 -0000 1.5 --- pep-0102.txt 11 Apr 2002 14:30:15 -0000 1.6 *************** *** 215,224 **** ___ Edit the file for content: usually you can globally replace X.Ya(Z-1) with X.YaZ. However, you'll need to think about the ! "What's New?" section. You also need to watch out about two ! specific links in the file, one which references "the full ! scoop" on changes -- a shownotes link, and one which ! references the downloads on SF -- a showfiles link. You won't ! be able to update either link until you've completed the steps ! below. For now just note what needs to change. ___ Also, update the MD5 checksums. --- 215,223 ---- ___ Edit the file for content: usually you can globally replace X.Ya(Z-1) with X.YaZ. However, you'll need to think about the ! "What's New?" section. ! ! ___ Copy the Misc/NEWS file to NEWS.txt in the X.Y directory for ! python.org; this contains the "full scoop" of changes to ! Python since the previous release for this version of Python. ___ Also, update the MD5 checksums. From loewis@sourceforge.net Thu Apr 11 13:24:14 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Thu, 11 Apr 2002 05:24:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32637 Modified Files: libre.tex Log Message: Explain octal escapes. Fixes #542226. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** libre.tex 10 Apr 2002 21:28:31 -0000 1.82 --- libre.tex 11 Apr 2002 12:24:12 -0000 1.83 *************** *** 374,382 **** \end{verbatim} ! Note that octal escapes are not included. While the parser can ! attempt to determine whether a character is being specified by it's ! ordinal value expressed in octal, doing so yields an expression which ! is relatively difficult to maintain, as the same syntax is used to ! refer to numbered groups. --- 374,380 ---- \end{verbatim} ! Octal escapes are included in a limited form: If the first digit is a ! 0, or if there are three octal digits, it is considered an octal ! escape. Otherwise, it is a group reference. From fdrake@sourceforge.net Thu Apr 11 15:11:30 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 07:11:30 -0700 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv3907 Modified Files: pep-0102.txt Log Message: Excise SourceForge file releases from the release process. Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0102.txt 8 Apr 2002 20:46:24 -0000 1.4 --- pep-0102.txt 11 Apr 2002 14:11:27 -0000 1.5 *************** *** 126,149 **** ___ Tim Peters grabs the HTML and uses this to build the Windows ! installer. Tim then creates a new "release" named X.YaZ on the ! SourceForge file release manager. (Although, if you get there ! first, you should create the new release.) ! ! (Diversion: SF's file manager has "packages" and "releases". We ! use packages to name major upcoming releases, e.g. python-2.2 or ! python-2.1.1. Inside each package are a number of "releases" ! for each new actual release -- i.e. the thing you're building. ! An example of a release name is 2.2a3. Once created, packages ! and releases are never deleted, but old ones are hidden to ! reduce confusion. More on this below.) ! ! If this is the first release for this major Python version, Tim ! will create a new package containing the major Python version ! number. ___ Tim performs his Windows magic, generating an installer ! executable. He uploads this file to SourceForge under the ! release he just created. He then sends the RM a notice which ! includes the MD5 checksum of the Windows executable. Note that Tim's creation of the Windows executable may generate --- 126,135 ---- ___ Tim Peters grabs the HTML and uses this to build the Windows ! installer. ___ Tim performs his Windows magic, generating an installer ! executable. He uploads this file to python.org. He then sends ! the RM a notice which includes the location and MD5 checksum of ! the Windows executable. Note that Tim's creation of the Windows executable may generate *************** *** 209,245 **** figure out what the problem is. ! ___ Start your upload to SF. You need to get Python-2.1.2.tgz into ! SourceForge. This can take a while both because of the time it ! takes to upload such a huge file, /and/ because SF has a 30 ! minute delay built into the file release process. The next few ! steps can be taken in parallel, so it's best to start the upload ! now and keep an eye on its progress. ! ! I've found that the `ncftpput' program is a great tool to use if ! you have it available. You can execute the following command to ! do the upload: ! % ncftpput upload.sf.net incoming Python-2.1.2.tgz ! ! If you don't have ncftpput around, you can use whatever ftp ! client you're comfortable with. Just be sure that you're ! uploading this to the "incoming" directory on upload.sf.net. ! ! ___ You also need to upload the tgz file to creosote.python.org. ! Usually Tim will have already uploaded the exe file to creosote, ! but if not, you'll need to do that too. These steps can take a ! long time depending on your network bandwidth. You have two ! choices: ! ! 1) Upload them to SF first, then wget them from creosote. Pros: ! easy to do; much friendlier to your own personal bandwidth. ! Cons: can take even longer because you're subject to the 30 ! minute SF file upload delay, and the upload rate from ! SF->creosote never seems to get above 20 KB/sec. ! ! 2) scp both files from your own machine to creosote. Pros: you ! avoid the 30 minute SF delay. Cons: you don't get much else ! done if you're on a small pipe. ! ! I usually opt for #2. ___ While you're waiting, you can start twiddling the web pages to --- 195,203 ---- figure out what the problem is. ! ___ You need to upload the tgz file to creosote.python.org. Tim ! will have already uploaded the exe file to creosote, but if not, ! you'll need to do that too. These steps can take a long time ! depending on your network bandwidth. scp both files from your ! own machine to creosote. ___ While you're waiting, you can start twiddling the web pages to *************** *** 275,357 **** above. Do NOT do a "make install" yet! ! ___ Now we're waiting for the ncftpput command, and the scp to ! creosote to finish. Da de da, da de dum, hmm, hmm, dum de dum. ! ! ___ Do the SourceForge file release dance. ! ! ___ Go to the Python project and click on "Admin" ! ___ Click on "Edit/Release Files" ! ___ Since Tim has usually by now created the package and release ! we're going to use, scroll down and click on "Edit Releases" ! for the package we're releasing into. ! ___ Find the release named X.YaZ and click on "Edit This Release" ! ! You should now perform Step 1 of the file release dance... ! ! ___ The "Status" field should be "Active" not "Hidden" ! ___ In the text box that says "Paste The Notes In", paste in all ! the "What's New" entries from the Misc/NEWS file that describe ! this major version of Python, /not/ just the ones for this ! particular release. E.g. If we're releasing Python 2.2a3, ! we'd include the "What's New" sections for Python 2.2a3, ! 2.2a2, and 2.2a1. ! ___ Leave the "Paste The Change Log In" section blank, but click ! on "Preserve my pre-formatted text". ! ___ Hit the Submit/Refresh button for Step 1. ! ! This will bring you back to the file release page. DO NOT do ! the following step until your ftp upload is complete! Once it ! is, you can perform Step 2 of the file release dance... ! ! ___ Click on the checkbox next to the file Python-X.YaZ.tgz. Be ! sure no other box is checked! Then click on the "Add Files ! and/or Refresh View" button for Step 2. ! ! And now, Step 3... ! ! ___ There should be exactly two files listed here, one is the tgz ! file you just added, and the other is the exe file that Tim ! added earlier. ! ___ For the tgz file, be sure that the "Processor" field says ! "Any" and the "File Type" field says "Source .gz". ! ___ Click on "Update/Refresh" for the .tgz file. ! ___ For the exe file, make sure that the "Processor" field says ! "i386" and the "File Type" field says "Other". Tim usually ! gets this right , but if not, make any necessary changes ! and click on "Update/Refresh" for the exe file. ! ! Step 4... ! ! DO NOT DO STEP 4 NOW. Wait until after you send out the email ! announcement to send the SF email notice. ! ! ___ Still on SF, click on the "Files" button at the top of the ! page. Find the release you've just made and click on it -- not ! on the tgz or exe file, but on the release link under the ! package name. E.g. package named python-2.2, click on the ! "2.2a3" link. ! ! This should be a page that says "Release Name: X.YaZ" and it ! should contain the "What's New" sections you pasted in earlier. ! Note the url of this page. Copy and paste it into the ! pydotorg/X.Y/new-index.ht file you created above. This is the ! "shownotes" link mentioned earlier. ! ! ___ Now click on the "Summary" link at the top of the page and ! scroll down to the "Latest File Releases" section. Find the ! package you just made a release for (the Version should be ! X.YaZ, and the Date should be today's date). Click on the ! "Download" link. ! ! Your new release should be highlighted in pink. Note the url ! for this page. Copy and paste it into the ! pydotorg/X.Y/new-index.ht file from above. This is the ! "showfiles" link mentioned earlier. ! ___ Now you need to go to creosote.python.org and move all the files ! in place over there. Our policy is that every Python version ! gets its own directory, but each directory may contain several ! releases. We keep all old releases, moving them into a "prev" ! subdirectory when we have a new release. So, there's a directory called "2.2" which contains --- 233,244 ---- above. Do NOT do a "make install" yet! ! ___ Now we're waiting for the scp to creosote to finish. Da de da, ! da de dum, hmm, hmm, dum de dum. ! ___ Once that's done you need to go to creosote.python.org and move ! all the files in place over there. Our policy is that every ! Python version gets its own directory, but each directory may ! contain several releases. We keep all old releases, moving them ! into a "prev" subdirectory when we have a new release. So, there's a directory called "2.2" which contains *************** *** 400,406 **** python-dev@python.org - ___ Go back to the file releases page on SF and complete Step 4, - sending out the email notification. - ___ Send a SourceForge News Item about the release. From the project's "menu bar", select the "News" link; once in News, --- 287,290 ---- *************** *** 415,424 **** Now it's time to do some cleanup. These steps are very important! - ___ Go back to SF, Admin->Edit/Release Files. Click on "Edit - Releases" for the package you just added to. For each old - release, click on "Edit This Release" and under Step 1, change - the "Status" to "Hidden". Click on the Step 1 Submit/Refresh - button. - ___ Edit the file Include/patchlevel.h so that the PY_VERSION string says something like "X.YaZ+". Note the trailing `+' --- 299,302 ---- *************** *** 432,437 **** ___ For the extra paranoid, do a completely clean test of the ! release. This includes downloading the tarball from either ! SourceForge or www.python.org. ___ Make sure the md5 checksums match. Then unpack the tarball, --- 310,315 ---- ___ For the extra paranoid, do a completely clean test of the ! release. This includes downloading the tarball from ! www.python.org. ___ Make sure the md5 checksums match. Then unpack the tarball, *************** *** 448,457 **** Verify! This can be interleaved with Step 4. Pretend you're a ! user: download the files from python.org *and* SourceForge, and make ! Pythons from them. This step is too easy to overlook, and on ! several occasions we've had useless release files. Once a general ! server problem caused mysterious corruption of all files; once the ! source tarball got built incorrectly; more than once the file upload ! process on SF truncated files; and so on. --- 326,335 ---- Verify! This can be interleaved with Step 4. Pretend you're a ! user: download the files from python.org, and make Python from ! it. This step is too easy to overlook, and on several occasions ! we've had useless release files. Once a general server problem ! caused mysterious corruption of all files; once the source tarball ! got built incorrectly; more than once the file upload process on ! SF truncated files; and so on. *************** *** 468,475 **** use this to build the MacOS versions. He may send you information about the Mac release that should be merged into the informational ! pages on SourceForge or www.python.org. When he's done, he'll ! tag the branch something like "rX.YaZ-mac". He'll also be ! responsible for merging any Mac-related changes back into the ! trunk. --- 346,352 ---- use this to build the MacOS versions. He may send you information about the Mac release that should be merged into the informational ! pages on www.python.org. When he's done, he'll tag the branch ! something like "rX.YaZ-mac". He'll also be responsible for ! merging any Mac-related changes back into the trunk. From fdrake@sourceforge.net Thu Apr 11 15:30:54 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 07:30:54 -0700 Subject: [Python-checkins] python/nondist/peps pep-0101.txt,1.23,1.24 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11451 Modified Files: pep-0101.txt Log Message: Excise SourceForge file releases from the release process. Index: pep-0101.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0101.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** pep-0101.txt 10 Jan 2002 16:22:46 -0000 1.23 --- pep-0101.txt 11 Apr 2002 14:30:51 -0000 1.24 *************** *** 183,206 **** ___ Tim Peters grabs the HTML and uses this to build the Windows ! installer. Tim then creates a new "release" named X.YaZ on the ! SourceForge file release manager. (Although, if you get there ! first, you should create the new release.) ! ! (Diversion: SF's file manager has "packages" and "releases". We ! use packages to name major upcoming releases, e.g. python-2.2 or ! python-2.1.1. Inside each package are a number of "releases" ! for each new actual release -- i.e. the thing you're building. ! An example of a release name is 2.2a3. Once created, packages ! and releases are never deleted, but old ones are hidden to ! reduce confusion. More on this below.) ! ! If this is the first release for this major Python version, Tim ! will create a new package containing the major Python version ! number. ___ Tim performs his Windows magic, generating an installer ! executable. He uploads this file to SourceForge under the ! release he just created. He then sends the RM a notice which ! includes the MD5 checksum of the Windows executable. Note that Tim's creation of the Windows executable may generate --- 183,192 ---- ___ Tim Peters grabs the HTML and uses this to build the Windows ! installer. ___ Tim performs his Windows magic, generating an installer ! executable. He uploads this file to python.org, and then sends ! the RM a notice which includes the location and MD5 checksum of ! the Windows executable. Note that Tim's creation of the Windows executable may generate *************** *** 266,302 **** figure out what the problem is. ! ___ Start your upload to SF. You need to get Python-2.2a3.tgz into ! SourceForge. This can take a while both because of the time it ! takes to upload such a huge file, /and/ because SF has a 30 ! minute delay built into the file release process. The next few ! steps can be taken in parallel, so it's best to start the upload ! now and keep an eye on its progress. ! ! I've found that the `ncftpput' program is a great tool to use if ! you have it available. You can execute the following command to ! do the upload: ! % ncftpput upload.sf.net incoming Python-2.2a3.tgz ! ! If you don't have ncftpput around, you can use whatever ftp ! client you're comfortable with. Just be sure that you're ! uploading this to the "incoming" directory on upload.sf.net. ! ! ___ You also need to upload the tgz file to creosote.python.org. ! Usually Tim will have already uploaded the exe file to creosote, ! but if not, you'll need to do that too. These steps can take a ! long time depending on your network bandwidth. You have two ! choices: ! ! 1) Upload them to SF first, then wget them from creosote. Pros: ! easy to do; much friendlier to your own personal bandwidth. ! Cons: can take even longer because you're subject to the 30 ! minute SF file upload delay, and the upload rate from ! SF->creosote never seems to get above 20 KB/sec. ! ! 2) scp both files from your own machine to creosote. Pros: you ! avoid the 30 minute SF delay. Cons: you don't get much else ! done if you're on a small pipe. ! ! I usually opt for #2. ___ While you're waiting, you can start twiddling the web pages to --- 252,260 ---- figure out what the problem is. ! ___ Upload the tgz file to creosote.python.org. Tim will have ! already uploaded the exe file to creosote, but if not, you'll ! need to do that too. These steps can take a long time depending ! on your network bandwidth. scp both files from your own machine ! to creosote. ___ While you're waiting, you can start twiddling the web pages to *************** *** 320,329 **** ___ Edit the file for content: usually you can globally replace X.Ya(Z-1) with X.YaZ. However, you'll need to think about the ! "What's New?" section. You also need to watch out about two ! specific links in the file, one which references "the full ! scoop" on changes -- a shownotes link, and one which ! references the downloads on SF -- a showfiles link. You won't ! be able to update either link until you've completed the steps ! below. For now just note what needs to change. ___ Also, update the MD5 checksums. --- 278,286 ---- ___ Edit the file for content: usually you can globally replace X.Ya(Z-1) with X.YaZ. However, you'll need to think about the ! "What's New?" section. ! ! ___ Copy the Misc/NEWS file to NEWS.txt in the X.Y directory for ! python.org; this contains the "full scoop" of changes to ! Python since the previous release for this version of Python. ___ Also, update the MD5 checksums. *************** *** 338,414 **** above. Do NOT do a "make install" yet! ! ___ Now we're waiting for the ncftpput command, and the scp to ! creosote to finish. Da de da, da de dum, hmm, hmm, dum de dum. ! ! ___ Do the SourceForge file release dance. ! ! ___ Go to the Python project and click on "Admin" ! ___ Click on "Edit/Release Files" ! ___ Since Tim has usually by now created the package and release ! we're going to use, scroll down and click on "Edit Releases" ! for the package we're releasing into. ! ___ Find the release named X.YaZ and click on "Edit This Release" ! ! You should now perform Step 1 of the file release dance... ! ! ___ The "Status" field should be "Active" not "Hidden" ! ___ In the text box that says "Paste The Notes In", paste in all ! the "What's New" entries from the Misc/NEWS file that describe ! this major version of Python, /not/ just the ones for this ! particular release. E.g. If we're releasing Python 2.2a3, ! we'd include the "What's New" sections for Python 2.2a3, ! 2.2a2, and 2.2a1. ! ___ Leave the "Paste The Change Log In" section blank, but click ! on "Preserve my pre-formatted text". ! ___ Hit the Submit/Refresh button for Step 1. ! ! This will bring you back to the file release page. DO NOT do ! the following step until your ftp upload is complete! Once it ! is, you can perform Step 2 of the file release dance... ! ! ___ Click on the checkbox next to the file Python-X.YaZ.tgz. Be ! sure no other box is checked! Then click on the "Add Files ! and/or Refresh View" button for Step 2. ! ! And now, Step 3... ! ! ___ There should be exactly two files listed here, one is the tgz ! file you just added, and the other is the exe file that Tim ! added earlier. ! ___ For the tgz file, be sure that the "Processor" field says ! "Any" and the "File Type" field says "Source .gz". ! ___ Click on "Update/Refresh" for the .tgz file. ! ___ For the exe file, make sure that the "Processor" field says ! "i386" and the "File Type" field says "Other". Tim usually ! gets this right , but if not, make any necessary changes ! and click on "Update/Refresh" for the exe file. ! ! Step 4... ! ! DO NOT DO STEP 4 NOW. Wait until after you send out the email ! announcement to send the SF email notice. ! ! ___ Still on SF, click on the "Files" button at the top of the ! page. Find the release you've just made and click on it -- not ! on the tgz or exe file, but on the release link under the ! package name. E.g. package named python-2.2, click on the ! "2.2a3" link. ! ! This should be a page that says "Release Name: X.YaZ" and it ! should contain the "What's New" sections you pasted in earlier. ! Note the url of this page. Copy and paste it into the ! pydotorg/X.Y/new-index.ht file you created above. This is the ! "shownotes" link mentioned earlier. ! ! ___ Now click on the "Summary" link at the top of the page and ! scroll down to the "Latest File Releases" section. Find the ! package you just made a release for (the Version should be ! X.YaZ, and the Date should be today's date). Click on the ! "Download" link. ! ! Your new release should be highlighted in pink. Note the url ! for this page. Copy and paste it into the ! pydotorg/X.Y/new-index.ht file from above. This is the ! "showfiles" link mentioned earlier. ___ Now you need to go to creosote.python.org and move all the files --- 295,300 ---- above. Do NOT do a "make install" yet! ! ___ Now we're waiting for the scp to creosote to finish. Da de da, ! da de dum, hmm, hmm, dum de dum. ___ Now you need to go to creosote.python.org and move all the files *************** *** 463,469 **** python-dev@python.org - ___ Go back to the file releases page on SF and complete Step 4, - sending out the email notification. - ___ Send a SourceForge News Item about the release. From the project's "menu bar", select the "News" link; once in News, --- 349,352 ---- *************** *** 478,487 **** Now it's time to do some cleanup. These steps are very important! - ___ Go back to SF, Admin->Edit/Release Files. Click on "Edit - Releases" for the package you just added to. For each old - release, click on "Edit This Release" and under Step 1, change - the "Status" to "Hidden". Click on the Step 1 Submit/Refresh - button. - ___ Merge the branch back into the trunk! Now that we've released this branch, we don't need it any more. We've already tagged it --- 361,364 ---- *************** *** 541,546 **** ___ For the extra paranoid, do a completely clean test of the ! release. This includes downloading the tarball from either ! SourceForge or www.python.org. ___ Make sure the md5 checksums match. Then unpack the tarball, --- 418,423 ---- ___ For the extra paranoid, do a completely clean test of the ! release. This includes downloading the tarball from ! www.python.org. ___ Make sure the md5 checksums match. Then unpack the tarball, *************** *** 557,566 **** Verify! This can be interleaved with Step 4. Pretend you're a ! user: download the files from python.org *and* SourceForge, and make ! Pythons from them. This step is too easy to overlook, and on ! several occasions we've had useless release files. Once a general ! server problem caused mysterious corruption of all files; once the ! source tarball got built incorrectly; more than once the file upload ! process on SF truncated files; and so on. --- 434,443 ---- Verify! This can be interleaved with Step 4. Pretend you're a ! user: download the files from python.org, and make Python from it. ! This step is too easy to overlook, and on several occasions we've ! had useless release files. Once a general server problem caused ! mysterious corruption of all files; once the source tarball got ! built incorrectly; more than once the file upload process on SF ! truncated files; and so on. *************** *** 577,584 **** use this to build the MacOS versions. He may send you information about the Mac release that should be merged into the informational ! pages on SourceForge or www.python.org. When he's done, he'll ! tag the branch something like "rX.YaZ-mac". He'll also be ! responsible for merging any Mac-related changes back into the ! trunk. --- 454,460 ---- use this to build the MacOS versions. He may send you information about the Mac release that should be merged into the informational ! pages on www.python.org. When he's done, he'll tag the branch ! something like "rX.YaZ-mac". He'll also be responsible for ! merging any Mac-related changes back into the trunk. From loewis@sourceforge.net Thu Apr 11 13:39:38 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Thu, 11 Apr 2002 05:39:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv6415 Modified Files: ref3.tex Log Message: Document __unicode__. Fixes #541245. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** ref3.tex 3 Apr 2002 22:41:50 -0000 1.85 --- ref3.tex 11 Apr 2002 12:39:35 -0000 1.86 *************** *** 1097,1100 **** --- 1097,1107 ---- \end{methoddesc} + \begin{methoddesc}[object]{__unicode__}{self} + Called to implement \function{unicode()}\bifuncindex{unicode} builtin; + should return a Unicode object. When this method is not defined, string + conversion is attempted, and the result of string conversion is converted + to Unicode using the system default encoding. + \end{methoddesc} + \subsection{Customizing attribute access\label{attribute-access}} From guido@python.org Thu Apr 11 15:48:26 2002 From: guido@python.org (Guido van Rossum) Date: Thu, 11 Apr 2002 10:48:26 -0400 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 In-Reply-To: Your message of "Sat, 06 Apr 2002 02:10:52 PST." References: Message-ID: <200204111448.g3BEmQP25970@pcp742651pcs.reston01.va.comcast.net> [resend, email from me to sf bounces.] > Move autoheader declarations into configure.in. Very cool. What autoconf feature was it that we weren't using enough? Can you explain how you obtained the set of symbols that remain in acconfig.h? (Appended) --Guido van Rossum (home page: http://www.python.org/~guido/) /* Leave this blank line here -- autoheader needs it! */ /* Define if you have the Mach cthreads package */ #undef C_THREADS /* Define if --enable-ipv6 is specified */ #undef ENABLE_IPV6 /* Define this if you have gethostbyname() */ #undef HAVE_GETHOSTBYNAME /* Define this if you have some version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R /* Define if you have termios available */ #undef HAVE_TERMIOS_H /* Define as the integral type used for Unicode representation. */ #undef PY_UNICODE_TYPE /* Define as the size of the unicode type. */ #undef Py_UNICODE_SIZE /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT /* sizeof(void *) */ #undef SIZEOF_VOID_P /* Define to `int' if doesn't define. */ #undef socklen_t /* Define for SOLARIS 2.x */ #undef SOLARIS /* Define if you want to use BSD db. */ #undef WITH_LIBDB /* Define if you want to use ndbm. */ #undef WITH_LIBNDBM /* Define if you want to compile in rudimentary thread support */ #undef WITH_THREAD /* Leave that blank line there-- autoheader needs it! */ @BOTTOM@ #ifdef __CYGWIN__ #ifdef USE_DL_IMPORT #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE #else #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE #endif #endif /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif From gvanrossum@sourceforge.net Thu Apr 11 16:34:21 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Thu, 11 Apr 2002 08:34:21 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.178,1.179 pep-0285.txt,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32622 Modified Files: pep-0000.txt pep-0285.txt Log Message: PEP 285 is Final. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** pep-0000.txt 8 Apr 2002 22:18:44 -0000 1.178 --- pep-0000.txt 11 Apr 2002 15:34:19 -0000 1.179 *************** *** 54,58 **** S 252 Making Types Look More Like Classes van Rossum S 253 Subtyping Built-in Types van Rossum - S 285 Adding a bool type van Rossum SA 279 The enumerate() built-in function Hettinger --- 54,57 ---- *************** *** 128,131 **** --- 127,131 ---- S 261 Support for "wide" Unicode characters Prescod SF 264 Future statements in simulated shells Hudson + SF 285 Adding a bool type van Rossum Empty PEPs (or containing only an abstract) *************** *** 263,267 **** I 283 Python 2.3 Release Schedule Hylton S 284 Integer for-loops Eppstein, Ewing ! S 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis S 287 reStructuredText Standard Docstring Format Goodger --- 263,267 ---- I 283 Python 2.3 Release Schedule Hylton S 284 Integer for-loops Eppstein, Ewing ! SF 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis S 287 reStructuredText Standard Docstring Format Goodger Index: pep-0285.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pep-0285.txt 3 Apr 2002 22:11:05 -0000 1.20 --- pep-0285.txt 11 Apr 2002 15:34:19 -0000 1.21 *************** *** 4,8 **** Last-Modified: $Date$ Author: guido@python.org (Guido van Rossum) ! Status: Accepted Type: Standards Track Created: 8-Mar-2002 --- 4,8 ---- Last-Modified: $Date$ Author: guido@python.org (Guido van Rossum) ! Status: Final Type: Standards Track Created: 8-Mar-2002 From loewis@informatik.hu-berlin.de Thu Apr 11 16:42:35 2002 From: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-1?q?L=F6wis?=) Date: 11 Apr 2002 17:42:35 +0200 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 In-Reply-To: <200204111448.g3BEmQP25970@pcp742651pcs.reston01.va.comcast.net> References: <200204111448.g3BEmQP25970@pcp742651pcs.reston01.va.comcast.net> Message-ID: Guido van Rossum writes: > > Move autoheader declarations into configure.in. > > Very cool. What autoconf feature was it that we weren't using enough? AC_DEFINE has an optional third argument which is the docstring. If that is filled out, autoheader won't complain if it is not in acconfig.h, and put the macro into pyconfig.h.in properly. > Can you explain how you obtained the set of symbols that remain in > acconfig.h? (Appended) I think they fall into three categories: - More than one AC_DEFINE. autoheader will continue to complain that there is no template. This is the problem for most of them. Possible solutions: a) arrange that there is only a single AC_DEFINE, conditional upon some variable. b) Use AH_TEMPLATE. This allows to specify the template in configure.in; multiple AC_DEFINEs can then refer to a single template. This is only available in autoconf 2.5x - Not referenced in configure.in. I haven't checked whether they are all used. - The part below @BOTTOM. It may be sensible to put it into pyport.h. Alternatively, autoconf 2.5x offers AH_BOTTOM. It would be easiest to rewrite this to use the autoconf 2.5x features, then kill acconfig.h. A solution that continues to work with 2.13 might be possible, but require more work (and I'd like to bump AC_PREREQ at the end, so that the Debian wrapper correctly knows what autoconf to invoke). Regards, Martin From guido@python.org Thu Apr 11 16:45:06 2002 From: guido@python.org (Guido van Rossum) Date: Thu, 11 Apr 2002 11:45:06 -0400 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 In-Reply-To: Your message of "11 Apr 2002 17:42:35 +0200." References: <200204111448.g3BEmQP25970@pcp742651pcs.reston01.va.comcast.net> Message-ID: <200204111545.g3BFj6v24771@odiug.zope.com> Thanks for the explanation! > It would be easiest to rewrite this to use the autoconf 2.5x features, > then kill acconfig.h. A solution that continues to work with 2.13 > might be possible, but require more work (and I'd like to bump > AC_PREREQ at the end, so that the Debian wrapper correctly knows what > autoconf to invoke). As long as it fails cleanly with older versions of autoconf, I'm all for using autoconf 2.53 now. --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum@sourceforge.net Thu Apr 11 16:44:11 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Thu, 11 Apr 2002 08:44:11 -0700 Subject: [Python-checkins] python/nondist/peps pep-0278.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv3324 Modified Files: pep-0278.txt Log Message: Add live link to the SF patch. Index: pep-0278.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0278.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0278.txt 16 Mar 2002 00:35:36 -0000 1.5 --- pep-0278.txt 11 Apr 2002 15:44:08 -0000 1.6 *************** *** 166,170 **** Reference Implementation ! A reference implementation is available in SourceForge patch #476814. --- 166,171 ---- Reference Implementation ! A reference implementation is available in SourceForge patch ! #476814: http://www.python.org/sf/476814 From fdrake@sourceforge.net Thu Apr 11 17:39:19 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 09:39:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22978/Lib/test Modified Files: regrtest.py Log Message: Added the resource name "all" to enable all of the optional resource uses. This is nice for use with "make TESTOPTS='-u all' test". Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** regrtest.py 1 Apr 2002 05:04:46 -0000 1.73 --- regrtest.py 11 Apr 2002 16:39:16 -0000 1.74 *************** *** 37,40 **** --- 37,42 ---- only the following are defined: + all - Enable all special resources. + curses - Tests that use curses and will modify the terminal's state and output modes. *************** *** 57,60 **** --- 59,66 ---- import test_support + + RESOURCE_NAMES = ('curses', 'largefile', 'network') + + def usage(code, msg=''): print __doc__ *************** *** 122,127 **** u = [x.lower() for x in a.split(',')] for r in u: ! if r not in ('curses', 'largefile', 'network'): ! usage(1, 'Invalid -u/--use option: %s' % a) use_resources.extend(u) if generate and verbose: --- 128,136 ---- u = [x.lower() for x in a.split(',')] for r in u: ! if r == 'all': ! use_resources = RESOURCE_NAMES ! break ! if r not in RESOURCE_NAMES: ! usage(1, 'Invalid -u/--use option: ' + a) use_resources.extend(u) if generate and verbose: From tim_one@sourceforge.net Thu Apr 11 20:53:00 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 12:53:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16281/Lib/test Modified Files: regrtest.py Log Message: I don't expect test_email_codecs to run on Windows. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** regrtest.py 11 Apr 2002 16:39:16 -0000 1.74 --- regrtest.py 11 Apr 2002 19:52:58 -0000 1.75 *************** *** 490,493 **** --- 490,494 ---- test_dbm test_dl + test_email_codecs test_fcntl test_fork1 From tim_one@sourceforge.net Thu Apr 11 20:54:13 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 12:54:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pyclbr.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16978/Lib/test Modified Files: test_pyclbr.py Log Message: Stop sucking up xmllib -- it's deprecated. Index: test_pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyclbr.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_pyclbr.py 8 Mar 2002 21:31:59 -0000 1.7 --- test_pyclbr.py 11 Apr 2002 19:54:11 -0000 1.8 *************** *** 107,111 **** '_classify_class_attrs']) self.checkModule('rfc822') - self.checkModule('xmllib') self.checkModule('difflib') --- 107,110 ---- From tim_one@sourceforge.net Thu Apr 11 21:04:14 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 13:04:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22035/Lib/test Modified Files: test___all__.py Log Message: Ignore more deprecation warnings. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test___all__.py 7 Dec 2001 21:35:42 -0000 1.22 --- test___all__.py 11 Apr 2002 20:04:12 -0000 1.23 *************** *** 1,4 **** --- 1,9 ---- from test_support import verify, verbose import sys + import warnings + + warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning) + warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning) + warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning) def check_all(modname): *************** *** 111,115 **** check_all("posixpath") check_all("pprint") ! check_all("pre") check_all("profile") check_all("pstats") --- 116,120 ---- check_all("posixpath") check_all("pprint") ! check_all("pre") # deprecated check_all("profile") check_all("pstats") *************** *** 121,127 **** check_all("re") check_all("reconvert") - import warnings - warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning, "regsub", - append=1) check_all("regsub") check_all("repr") --- 126,129 ---- From tim_one@sourceforge.net Thu Apr 11 21:18:42 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 13:18:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_xmllib.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28479/Lib/test Modified Files: test_xmllib.py Log Message: Since xmllib is deprecated now, suppress the DeprecationWarning its test module necessarily raises. Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_xmllib.py 20 Sep 2001 21:33:42 -0000 1.6 --- test_xmllib.py 11 Apr 2002 20:18:40 -0000 1.7 *************** *** 14,21 **** """ import test_support import unittest import xmllib - class XMLParserTestCase(unittest.TestCase): --- 14,25 ---- """ + import warnings + warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", + DeprecationWarning) + del warnings + import test_support import unittest import xmllib class XMLParserTestCase(unittest.TestCase): From jackjansen@sourceforge.net Thu Apr 11 21:41:21 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:41:21 -0700 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv6616/Python/Include Modified Files: dictobject.h Log Message: Get rid of USE_CACHE_ALIGNED. It has no function anymore. Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** dictobject.h 11 Dec 2001 18:51:08 -0000 2.23 --- dictobject.h 11 Apr 2002 20:41:18 -0000 2.24 *************** *** 46,52 **** PyObject *me_key; PyObject *me_value; - #ifdef USE_CACHE_ALIGNED - long aligner; - #endif } PyDictEntry; --- 46,49 ---- From jackjansen@sourceforge.net Thu Apr 11 21:44:08 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:44:08 -0700 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.125,2.126 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8162/Python/Modules Modified Files: timemodule.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -d -r2.125 -r2.126 *** timemodule.c 1 Apr 2002 14:49:59 -0000 2.125 --- timemodule.c 11 Apr 2002 20:44:06 -0000 2.126 *************** *** 10,20 **** #include #include - #ifdef USE_GUSI211 - /* GUSI, the I/O library which has the time() function and such uses the - ** Mac epoch of 1904. MSL, the C library which has localtime() and so uses - ** the ANSI epoch of 1900. - */ - #define GUSI_TO_MSL_EPOCH (4*365*24*60*60) - #endif /* USE_GUSI2 */ #else #include --- 10,13 ---- *************** *** 260,266 **** struct tm *p; errno = 0; - #if defined(macintosh) && defined(USE_GUSI204) - when = when + GUSI_TO_MSL_EPOCH; - #endif p = function(&when); if (p == NULL) { --- 253,256 ---- *************** *** 488,494 **** tt = (time_t)dt; } - #if defined(macintosh) && defined(USE_GUSI204) - tt = tt + GUSI_TO_MSL_EPOCH; - #endif p = ctime(&tt); if (p == NULL) { --- 478,481 ---- *************** *** 527,533 **** return NULL; } - #if defined(macintosh) && defined(USE_GUSI211) - tt = tt - GUSI_TO_MSL_EPOCH; - #endif return PyFloat_FromDouble((double)tt); } --- 514,517 ---- From jackjansen@sourceforge.net Thu Apr 11 21:44:19 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:44:19 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.213,1.214 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8215/Python/Modules Modified Files: socketmodule.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** socketmodule.c 1 Apr 2002 14:53:37 -0000 1.213 --- socketmodule.c 11 Apr 2002 20:44:16 -0000 1.214 *************** *** 150,156 **** typedef size_t socklen_t; # else - # ifndef USE_GUSI1 # include - # endif # endif --- 150,154 ---- *************** *** 182,190 **** #endif - #ifdef USE_GUSI1 - /* fdopen() isn't declared in stdio.h (sigh) */ - # include - #endif - #include "addrinfo.h" --- 180,183 ---- *************** *** 2333,2341 **** return NULL; } - #ifdef USE_GUSI1 - packed_addr = inet_addr(ip_addr).s_addr; - #else packed_addr = inet_addr(ip_addr); - #endif if (packed_addr == INADDR_NONE) { /* invalid address */ --- 2326,2330 ---- *************** *** 3332,3340 **** if(af == AF_INET){ long packed_addr; - #ifdef USE_GUSI1 - packed_addr = (long)inet_addr(src).s_addr; - #else packed_addr = inet_addr(src); - #endif if (packed_addr == INADDR_NONE) return 0; --- 3321,3325 ---- From jackjansen@sourceforge.net Thu Apr 11 21:44:24 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:44:24 -0700 Subject: [Python-checkins] python/dist/src/Include pyport.h,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv8290/Python/Include Modified Files: pyport.h Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** pyport.h 9 Mar 2002 04:58:24 -0000 2.45 --- pyport.h 11 Apr 2002 20:44:21 -0000 2.46 *************** *** 118,128 **** #include - #else /* !HAVE_SYS_SELECT_H */ - - #ifdef USE_GUSI1 - /* If we don't have sys/select the definition may be in unistd.h */ - #include - #endif - #endif /* !HAVE_SYS_SELECT_H */ --- 118,121 ---- From jackjansen@sourceforge.net Thu Apr 11 21:46:09 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:46:09 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include pyconfig.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv8894/Python/Mac/Include Modified Files: pyconfig.h Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pyconfig.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pyconfig.h 14 Dec 2001 22:58:11 -0000 1.5 --- pyconfig.h 11 Apr 2002 20:46:07 -0000 1.6 *************** *** 37,41 **** #endif ! #if defined(USE_GUSI1) || defined(USE_GUSI2) #define USE_GUSI #endif --- 37,41 ---- #endif ! #if defined(USE_GUSI2) #define USE_GUSI #endif From jackjansen@sourceforge.net Thu Apr 11 21:46:14 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:46:14 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules macmodule.c,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8941/Python/Mac/Modules Modified Files: macmodule.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: macmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macmodule.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** macmodule.c 21 Mar 2002 21:09:36 -0000 1.51 --- macmodule.c 11 Apr 2002 20:46:11 -0000 1.52 *************** *** 47,53 **** #undef S_IEXEC - #ifdef USE_GUSI1 - #include - #endif /* USE_GUSI1 */ #include #include --- 47,50 ---- *************** *** 182,196 **** PyObject *args; { - #ifdef USE_GUSI1 - PyObject *rv; - - /* Change MacOS's idea of wd too */ - rv = mac_1str(args, chdir); - PyMac_FixGUSIcd(); - return rv; - #else return mac_1str(args, chdir); - #endif - } --- 179,183 ---- *************** *** 206,214 **** res = close(fd); Py_END_ALLOW_THREADS - #ifndef USE_GUSI1 - /* GUSI gives surious errors here? */ if (res < 0) return mac_error(); - #endif Py_INCREF(Py_None); return Py_None; --- 193,198 ---- *************** *** 386,394 **** return NULL; Py_BEGIN_ALLOW_THREADS - #ifdef USE_GUSI1 - res = mkdir(path); - #else res = mkdir(path, mode); - #endif Py_END_ALLOW_THREADS if (res < 0) --- 370,374 ---- From jackjansen@sourceforge.net Thu Apr 11 21:46:18 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:46:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macgetcompiler.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv8967/Python/Mac/Python Modified Files: macgetcompiler.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: macgetcompiler.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetcompiler.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** macgetcompiler.c 7 Aug 2001 12:33:27 -0000 1.16 --- macgetcompiler.c 11 Apr 2002 20:46:16 -0000 1.17 *************** *** 36,47 **** #ifdef __MWERKS__ - #ifdef USE_GUSI1 - #define HASGUSI " GUSI1" - #else #ifdef USE_GUSI2 #define HASGUSI " GUSI2" #else #define HASGUSI "" - #endif #endif --- 36,43 ---- From jackjansen@sourceforge.net Thu Apr 11 21:46:25 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:46:25 -0700 Subject: [Python-checkins] python/dist/src/Python import.c,2.199,2.200 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9001/Python/Python Modified Files: import.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -d -r2.199 -r2.200 *** import.c 9 Apr 2002 18:00:58 -0000 2.199 --- import.c 11 Apr 2002 20:46:23 -0000 2.200 *************** *** 1140,1146 **** #elif defined(macintosh) #include - #ifdef USE_GUSI1 - #include "TFileSpec.h" /* for Path2FSSpec() */ - #endif #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) --- 1140,1143 ---- *************** *** 1216,1238 **** return 1; - #ifndef USE_GUSI1 err = FSMakeFSSpec(0, 0, Pstring(buf), &fss); - #else - /* GUSI's Path2FSSpec() resolves all possible aliases nicely on - the way, which is fine for all directories, but here we need - the original name of the alias file (say, Dlg.ppc.slb, not - toolboxmodules.ppc.slb). */ - char *colon; - err = Path2FSSpec(buf, &fss); - if (err == noErr) { - colon = strrchr(buf, ':'); /* find filename */ - if (colon != NULL) - err = FSMakeFSSpec(fss.vRefNum, fss.parID, - Pstring(colon+1), &fss); - else - err = FSMakeFSSpec(fss.vRefNum, fss.parID, - fss.name, &fss); - } - #endif if (err) { PyErr_Format(PyExc_NameError, --- 1213,1217 ---- From jackjansen@sourceforge.net Thu Apr 11 21:50:23 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:50:23 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/old mwerks_cfm68k_config.h,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/old In directory usw-pr-cvs1:/tmp/cvs-serv10522/Python/Mac/mwerks/old Removed Files: mwerks_cfm68k_config.h Log Message: These are long obsolete. Get rid of them. --- mwerks_cfm68k_config.h DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:50:28 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:50:28 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/old mwerks_nsgusi_config.h,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/old In directory usw-pr-cvs1:/tmp/cvs-serv10554/Python/Mac/mwerks/old Removed Files: mwerks_nsgusi_config.h Log Message: These are long obsolete. Get rid of them. --- mwerks_nsgusi_config.h DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:50:32 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:50:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/old mwerks_nsgusitk_config.h,1.4,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/old In directory usw-pr-cvs1:/tmp/cvs-serv10596/Python/Mac/mwerks/old Removed Files: mwerks_nsgusitk_config.h Log Message: These are long obsolete. Get rid of them. --- mwerks_nsgusitk_config.h DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:50:36 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:50:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/old mwerks_shgusi_config.h,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/old In directory usw-pr-cvs1:/tmp/cvs-serv10624/Python/Mac/mwerks/old Removed Files: mwerks_shgusi_config.h Log Message: These are long obsolete. Get rid of them. --- mwerks_shgusi_config.h DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:50:41 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:50:41 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks/old mwerks_tk_config.h,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks/old In directory usw-pr-cvs1:/tmp/cvs-serv10643/Python/Mac/mwerks/old Removed Files: mwerks_tk_config.h Log Message: These are long obsolete. Get rid of them. --- mwerks_tk_config.h DELETED --- From fdrake@sourceforge.net Thu Apr 11 21:52:02 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 13:52:02 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11144 Modified Files: pep-0004.txt Log Message: Fix typo spotted by Tim. Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0004.txt 11 Apr 2002 20:48:55 -0000 1.4 --- pep-0004.txt 11 Apr 2002 20:52:00 -0000 1.5 *************** *** 108,112 **** Module name: whrandom Rationale: The module's default seed computation was ! inherantly insecure; the random module should be used instead. Date: 11-Apr-2002 --- 108,112 ---- Module name: whrandom Rationale: The module's default seed computation was ! inherently insecure; the random module should be used instead. Date: 11-Apr-2002 From jackjansen@sourceforge.net Thu Apr 11 21:53:05 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:53:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include macglue.h,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv11524/Python/Mac/Include Modified Files: macglue.h Log Message: Got rid of ifdefs for long-obsolete GUSI versions and other lurkers. Index: macglue.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/macglue.h,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** macglue.h 14 Dec 2001 22:58:06 -0000 1.60 --- macglue.h 11 Apr 2002 20:53:03 -0000 1.61 *************** *** 47,55 **** } PyMacSchedParams; - #ifdef USE_GUSI1 - void PyMac_FixGUSIcd(void); /* Workaround for GUSI chdir() call */ - extern void PyMac_SetGUSISpin(void); /* Install our private GUSI spin routine */ - #endif - unsigned char *Pstring(char *str); /* Convert c-string to pascal-string in static buffer */ --- 47,50 ---- *************** *** 64,68 **** extern OSErr PyMac_init_application_location(void); /* Init the above */ extern int PyMac_GetArgv(char ***, int); /* Get argc, argv (from macargv.c) */ - extern int PyMac_AppearanceCompliant; /* True if in appearance support mode */ extern PyObject *PyMac_OSErrException; /* Exception for OSErr */ --- 59,62 ---- From jackjansen@sourceforge.net Thu Apr 11 21:54:00 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:54:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonCore.mcp,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv11671/Python/Mac/Build Modified Files: PythonCore.mcp Log Message: Added boolobject.c Index: PythonCore.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCore.mcp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 Binary files /tmp/cvstv8FcI and /tmp/cvsY4krKh differ From jackjansen@sourceforge.net Thu Apr 11 21:54:23 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:54:23 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandalone.mcp,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv11782/Python/Mac/Build Modified Files: PythonStandalone.mcp Log Message: Added boolobject.c Index: PythonStandalone.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandalone.mcp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 Binary files /tmp/cvsu33jtm and /tmp/cvskrHNU4 differ From jackjansen@sourceforge.net Thu Apr 11 21:55:28 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:28 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_tkplugin_config.h,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12184/Python/Mac/mwerks Modified Files: mwerks_tkplugin_config.h Log Message: Got rid of obsolete defines. Index: mwerks_tkplugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_tkplugin_config.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mwerks_tkplugin_config.h 5 Dec 2001 22:44:45 -0000 1.7 --- mwerks_tkplugin_config.h 11 Apr 2002 20:55:25 -0000 1.8 *************** *** 5,9 **** #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ /* #define USE_GUSI1 /* Stdio implemented with GUSI 1.X */ ! #if defined(USE_GUSI1) || defined(USE_GUSI2) #define USE_GUSI #endif --- 5,9 ---- #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ /* #define USE_GUSI1 /* Stdio implemented with GUSI 1.X */ ! #if defined(USE_GUSI2) #define USE_GUSI #endif From jackjansen@sourceforge.net Thu Apr 11 21:55:32 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_plugin_config.h,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12222/Python/Mac/mwerks Modified Files: mwerks_plugin_config.h Log Message: Got rid of obsolete defines. Index: mwerks_plugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_plugin_config.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mwerks_plugin_config.h 5 Dec 2001 22:44:16 -0000 1.11 --- mwerks_plugin_config.h 11 Apr 2002 20:55:29 -0000 1.12 *************** *** 5,9 **** /* #define USE_GUSI1 /* Stdio implemented with GUSI */ #define USE_GUSI2 /* Stdio implemented with GUSI */ ! #if defined(USE_GUSI1) || defined(USE_GUSI2) #define USE_GUSI #endif --- 5,9 ---- /* #define USE_GUSI1 /* Stdio implemented with GUSI */ #define USE_GUSI2 /* Stdio implemented with GUSI */ ! #if defined(USE_GUSI2) #define USE_GUSI #endif From jackjansen@sourceforge.net Thu Apr 11 21:55:36 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_carbon_config.h,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12260/Python/Mac/mwerks Modified Files: mwerks_carbon_config.h Log Message: Got rid of obsolete defines. Index: mwerks_carbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbon_config.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mwerks_carbon_config.h 5 Dec 2001 22:43:57 -0000 1.10 --- mwerks_carbon_config.h 11 Apr 2002 20:55:33 -0000 1.11 *************** *** 9,15 **** #define TARGET_API_MAC_CARBON 1 - #define USE_ARGV0_CHDIR /* Workaround for OSXDP4: change dir to argv[0] dir */ #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ - /* # define USE_GUSI1 /* Stdio implemented with GUSI 1 */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ #define USE_TOOLBOX /* Include toolbox modules in core Python */ --- 9,13 ---- *************** *** 29,33 **** /* #define USE_GDBM /* Include the gdbm module */ /* #define USE_ZLIB /* Include the zlib module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define WITH_HOTSHOT /* Enable hotshot profiler */ --- 27,30 ---- *************** *** 35,39 **** #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ --- 32,35 ---- From jackjansen@sourceforge.net Thu Apr 11 21:55:40 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:40 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_carbonplugin_config.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12299/Python/Mac/mwerks Modified Files: mwerks_carbonplugin_config.h Log Message: Got rid of obsolete defines. Index: mwerks_carbonplugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbonplugin_config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mwerks_carbonplugin_config.h 5 Dec 2001 22:43:52 -0000 1.5 --- mwerks_carbonplugin_config.h 11 Apr 2002 20:55:37 -0000 1.6 *************** *** 8,16 **** #define USE_TOOLBOX_OBJECT_GLUE /* Use glue routines for accessing PyArg_Parse/Py_BuildValue helpers */ - /* #define USE_GUSI1 /* Stdio implemented with GUSI */ #define USE_GUSI2 /* Stdio implemented with GUSI */ - #if defined(USE_GUSI1) || defined(USE_GUSI2) #define USE_GUSI - #endif #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ #define USE_MSL /* Use MSL libraries */ --- 8,13 ---- From jackjansen@sourceforge.net Thu Apr 11 21:55:44 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_nonshared_config.h,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12339/Python/Mac/mwerks Modified Files: mwerks_nonshared_config.h Log Message: Got rid of obsolete defines. Index: mwerks_nonshared_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_nonshared_config.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mwerks_nonshared_config.h 5 Dec 2001 22:44:02 -0000 1.26 --- mwerks_nonshared_config.h 11 Apr 2002 20:55:41 -0000 1.27 *************** *** 6,14 **** */ - /* #define USE_GUSI1 /* Stdio implemented with GUSI */ #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ - #if defined(USE_GUSI1) || defined(USE_GUSI2) #define USE_GUSI - #endif #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ #define USE_TOOLBOX /* Include toolbox modules in core Python */ --- 6,11 ---- *************** *** 27,35 **** #define USE_IC /* Include Internet Config module */ #define USE_PYEXPAT /* Include Pyexpat module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ --- 24,30 ---- From jackjansen@sourceforge.net Thu Apr 11 21:55:48 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:48 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_nscarbon_config.h,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12382/Python/Mac/mwerks Modified Files: mwerks_nscarbon_config.h Log Message: Got rid of obsolete defines. Index: mwerks_nscarbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_nscarbon_config.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mwerks_nscarbon_config.h 5 Dec 2001 22:44:09 -0000 1.7 --- mwerks_nscarbon_config.h 11 Apr 2002 20:55:45 -0000 1.8 *************** *** 9,17 **** #define TARGET_API_MAC_CARBON 1 - #define USE_ARGV0_CHDIR /* Workaround for OSXDP4: change dir to argv[0] dir */ #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ - #if defined(USE_GUSI1) || defined(USE_GUSI2) #define USE_GUSI - #endif /* #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ --- 9,14 ---- *************** *** 31,39 **** #define USE_IC /* Include Internet Config module */ #define USE_PYEXPAT /* Include Pyexpat module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ --- 28,34 ---- From jackjansen@sourceforge.net Thu Apr 11 21:55:52 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_shared_config.h,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12435/Python/Mac/mwerks Modified Files: mwerks_shared_config.h Log Message: Got rid of obsolete defines. Index: mwerks_shared_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_shared_config.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mwerks_shared_config.h 5 Dec 2001 22:44:22 -0000 1.21 --- mwerks_shared_config.h 11 Apr 2002 20:55:50 -0000 1.22 *************** *** 7,11 **** */ - /* #define USE_GUSI1 /* Stdio implemented with GUSI */ #define USE_GUSI2 /* Stdio implemented with GUSI */ #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ --- 7,10 ---- *************** *** 27,31 **** /* #define USE_GDBM /* Include the gdbm module */ /* #define USE_ZLIB /* Include the zlib module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_TOOLBOX_OBJECT_GLUE /* Call toolbox object converters indirectly */ --- 26,29 ---- *************** *** 34,38 **** #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif --- 32,35 ---- From jackjansen@sourceforge.net Thu Apr 11 21:55:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_shcarbon_config.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12488/Python/Mac/mwerks Modified Files: mwerks_shcarbon_config.h Log Message: Got rid of obsolete defines. Index: mwerks_shcarbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_shcarbon_config.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mwerks_shcarbon_config.h 5 Dec 2001 22:44:27 -0000 1.6 --- mwerks_shcarbon_config.h 11 Apr 2002 20:55:54 -0000 1.7 *************** *** 10,16 **** #define TARGET_API_MAC_CARBON 1 - #define USE_ARGV0_CHDIR /* Workaround for OSXDP4: change dir to argv[0] dir */ #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ - /* # define USE_GUSI1 /* Stdio implemented with GUSI 1 */ #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ --- 10,14 ---- *************** *** 31,35 **** /* #define USE_GDBM /* Include the gdbm module */ /* #define USE_ZLIB /* Include the zlib module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_TOOLBOX_OBJECT_GLUE /* Call toolbox object converters indirectly */ --- 29,32 ---- *************** *** 38,42 **** #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif --- 35,38 ---- From jackjansen@sourceforge.net Thu Apr 11 21:55:00 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:55:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandSmall.mcp,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv11877/Python/Mac/Build Modified Files: PythonStandSmall.mcp Log Message: Added boolobject.c Index: PythonStandSmall.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandSmall.mcp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 Binary files /tmp/cvswz6z9b and /tmp/cvsqeqSSg differ From jackjansen@sourceforge.net Thu Apr 11 21:56:07 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:56:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_small_config.h,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12576/Python/Mac/mwerks Modified Files: mwerks_small_config.h Log Message: Got rid of obsolete defines. Index: mwerks_small_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_small_config.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mwerks_small_config.h 5 Dec 2001 22:44:31 -0000 1.16 --- mwerks_small_config.h 11 Apr 2002 20:56:05 -0000 1.17 *************** *** 7,11 **** #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ - /* # define USE_GUSI1 /* Stdio implemented with GUSI 1 */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ #define USE_TOOLBOX /* Include toolbox modules in core Python */ --- 7,10 ---- *************** *** 24,28 **** /* #define USE_GDBM /* Include the gdbm module */ /* #define USE_ZLIB /* Include the zlib module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define WITH_HOTSHOT /* Enable hotshot profiler */ --- 23,26 ---- *************** *** 31,35 **** #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif --- 29,32 ---- From jackjansen@sourceforge.net Thu Apr 11 21:56:12 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:56:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_thrcarbonsm_config.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12628/Python/Mac/mwerks Modified Files: mwerks_thrcarbonsm_config.h Log Message: Got rid of obsolete defines. Index: mwerks_thrcarbonsm_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_thrcarbonsm_config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mwerks_thrcarbonsm_config.h 5 Dec 2001 22:44:36 -0000 1.5 --- mwerks_thrcarbonsm_config.h 11 Apr 2002 20:56:10 -0000 1.6 *************** *** 9,15 **** #define TARGET_API_MAC_CARBON 1 - #define USE_ARGV0_CHDIR /* Workaround for OSXDP4: change dir to argv[0] dir */ #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ - /* # define USE_GUSI1 /* Stdio implemented with GUSI 1 */ #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ --- 9,13 ---- *************** *** 30,34 **** /* #define USE_GDBM /* Include the gdbm module */ /* #define USE_ZLIB /* Include the zlib module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ --- 28,31 ---- *************** *** 36,40 **** #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif --- 33,36 ---- From fdrake@sourceforge.net Thu Apr 11 21:57:32 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 13:57:32 -0700 Subject: [Python-checkins] python/dist/src/Lib whrandom.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13167 Modified Files: whrandom.py Log Message: Guido sez to remove the deprecation warning for a year. The deprecation is now listed in PEP 4. Index: whrandom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whrandom.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** whrandom.py 10 Apr 2002 01:45:11 -0000 1.19 --- whrandom.py 11 Apr 2002 20:57:30 -0000 1.20 *************** *** 37,45 **** # Adrian Baddeley. - import warnings - warnings.warn("the whrandom module is deprecated; please use random", - DeprecationWarning) - del warnings - class whrandom: --- 37,40 ---- From jackjansen@sourceforge.net Thu Apr 11 21:56:15 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:56:15 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules macosmodule.c,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12654/Python/Mac/Modules Modified Files: macosmodule.c Log Message: Got rid of obsolete appearance flag. Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** macosmodule.c 8 Dec 2001 18:02:51 -0000 1.58 --- macosmodule.c 11 Apr 2002 20:56:13 -0000 1.59 *************** *** 758,766 **** return; } - #if !TARGET_API_MAC_OSX - if (PyDict_SetItemString(d, "AppearanceCompliant", - Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0) - return; - #endif #if TARGET_API_MAC_OSX #define PY_RUNTIMEMODEL "macho" --- 758,761 ---- From jackjansen@sourceforge.net Thu Apr 11 21:56:17 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:56:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_threadsmall_config.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv12678/Python/Mac/mwerks Modified Files: mwerks_threadsmall_config.h Log Message: Got rid of obsolete defines. Index: mwerks_threadsmall_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_threadsmall_config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mwerks_threadsmall_config.h 5 Dec 2001 22:44:40 -0000 1.5 --- mwerks_threadsmall_config.h 11 Apr 2002 20:56:15 -0000 1.6 *************** *** 7,12 **** #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ ! /* # define USE_GUSI1 /* Stdio implemented with GUSI 1 */ ! #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ #define USE_TOOLBOX /* Include toolbox modules in core Python */ --- 7,11 ---- #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ ! #define WITH_THREAD /* Use thread support */ #define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ #define USE_TOOLBOX /* Include toolbox modules in core Python */ *************** *** 25,29 **** /* #define USE_GDBM /* Include the gdbm module */ /* #define USE_ZLIB /* Include the zlib module */ - #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ --- 24,27 ---- *************** *** 31,35 **** #ifndef USE_MSL_MALLOC /* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ - #define USE_CACHE_ALIGNED 8 /* Align on 32-byte boundaries for 604 */ #endif --- 29,32 ---- From fdrake@sourceforge.net Thu Apr 11 21:58:56 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 13:58:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.75,1.76 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13743 Modified Files: regrtest.py Log Message: Clean up the "all" support for -u. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** regrtest.py 11 Apr 2002 19:52:58 -0000 1.75 --- regrtest.py 11 Apr 2002 20:58:54 -0000 1.76 *************** *** 133,137 **** if r not in RESOURCE_NAMES: usage(1, 'Invalid -u/--use option: ' + a) ! use_resources.extend(u) if generate and verbose: usage(2, "-g and -v don't go together!") --- 133,138 ---- if r not in RESOURCE_NAMES: usage(1, 'Invalid -u/--use option: ' + a) ! if r not in use_resources: ! use_resources.extend(r) if generate and verbose: usage(2, "-g and -v don't go together!") From jackjansen@sourceforge.net Thu Apr 11 21:59:37 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:59:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat AE.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv13993/Python/Mac/Lib/lib-compat Removed Files: AE.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- AE.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:59:41 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:59:41 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat App.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14021/Python/Mac/Lib/lib-compat Removed Files: App.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- App.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:59:45 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:59:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Appearance.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14068/Python/Mac/Lib/lib-compat Removed Files: Appearance.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Appearance.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:59:49 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:59:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat AppleEvents.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14095/Python/Mac/Lib/lib-compat Removed Files: AppleEvents.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- AppleEvents.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:59:53 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:59:53 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Balloons.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14117/Python/Mac/Lib/lib-compat Removed Files: Balloons.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Balloons.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:59:57 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:59:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat CF.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14166/Python/Mac/Lib/lib-compat Removed Files: CF.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- CF.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:02 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Cm.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14209/Python/Mac/Lib/lib-compat Removed Files: Cm.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Cm.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:26 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat TE.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16316/Python/Mac/Lib/lib-compat Removed Files: TE.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- TE.py DELETED --- From fdrake@sourceforge.net Thu Apr 11 21:48:58 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 11 Apr 2002 13:48:58 -0700 Subject: [Python-checkins] python/nondist/peps pep-0004.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9965 Modified Files: pep-0004.txt Log Message: Added formal deprecation for whrandom. Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0004.txt 10 Apr 2002 22:09:55 -0000 1.3 --- pep-0004.txt 11 Apr 2002 20:48:55 -0000 1.4 *************** *** 106,109 **** --- 106,120 ---- has now been removed. + Module name: whrandom + Rationale: The module's default seed computation was + inherantly insecure; the random module should be + used instead. + Date: 11-Apr-2002 + Documentation: This module has been documented as obsolete since + Python 2.1, but listing in this PEP was neglected. + The deprecation warning will be added to the module + one year after Python 2.3 is released, and the + module will be removed one year after that. + Undeprecated modules From jackjansen@sourceforge.net Thu Apr 11 22:01:00 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Dragconst.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14779/Python/Mac/Lib/lib-compat Removed Files: Dragconst.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Dragconst.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:00 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat MacTextEditor.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15417/Python/Mac/Lib/lib-compat Removed Files: MacTextEditor.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- MacTextEditor.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:59 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Res.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16016/Python/Mac/Lib/lib-compat Removed Files: Res.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Res.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Drag.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14755/Python/Mac/Lib/lib-compat Removed Files: Drag.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Drag.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:42 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Ctl.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14582/Python/Mac/Lib/lib-compat Removed Files: Ctl.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Ctl.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:30 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:30 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat TextEdit.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16362/Python/Mac/Lib/lib-compat Removed Files: TextEdit.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- TextEdit.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:07 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Components.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14306/Python/Mac/Lib/lib-compat Removed Files: Components.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Components.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:04 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat MediaDescr.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15482/Python/Mac/Lib/lib-compat Removed Files: MediaDescr.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- MediaDescr.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:50 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat QuickDraw.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15893/Python/Mac/Lib/lib-compat Removed Files: QuickDraw.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- QuickDraw.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:46 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Dialogs.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14656/Python/Mac/Lib/lib-compat Removed Files: Dialogs.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Dialogs.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:38 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Icn.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15193/Python/Mac/Lib/lib-compat Removed Files: Icn.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Icn.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:48:12 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:48:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macmain.c,1.75,1.76 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv9689/Python/Mac/Python Modified Files: macmain.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions and other stuff that is now standard (appearance, interned strings) Index: macmain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macmain.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** macmain.c 29 Mar 2002 14:43:50 -0000 1.75 --- macmain.c 11 Apr 2002 20:48:08 -0000 1.76 *************** *** 46,53 **** #include #endif /* TARGET_API_MAC_CARBON */ - #ifdef USE_APPEARANCE #include #include - #endif /* USE_APPEARANCE */ #else #include --- 46,51 ---- *************** *** 92,110 **** void PyMac_Exit(int); /* Forward */ - static void init_appearance(void) - { - #ifdef USE_APPEARANCE - OSErr err; - SInt32 response; - - err = Gestalt(gestaltAppearanceAttr,&response); - if ( err ) goto no_appearance; - if ( !(response&(1< Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16231/Python/Mac/Lib/lib-compat Removed Files: Sndihooks.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Sndihooks.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:26 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat ControlAccessor.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14446/Python/Mac/Lib/lib-compat Removed Files: ControlAccessor.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- ControlAccessor.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:12 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Menus.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15585/Python/Mac/Lib/lib-compat Removed Files: Menus.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Menus.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:27 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Qd.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15686/Python/Mac/Lib/lib-compat Removed Files: Qd.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Qd.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:14 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:14 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Snd.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16180/Python/Mac/Lib/lib-compat Removed Files: Snd.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Snd.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:47 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:47 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat List.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15283/Python/Mac/Lib/lib-compat Removed Files: List.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- List.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:08 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Scrap.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16144/Python/Mac/Lib/lib-compat Removed Files: Scrap.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Scrap.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:24 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:24 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Fm.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15010/Python/Mac/Lib/lib-compat Removed Files: Fm.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Fm.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:08 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Menu.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15534/Python/Mac/Lib/lib-compat Removed Files: Menu.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Menu.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:33 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Controls.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14517/Python/Mac/Lib/lib-compat Removed Files: Controls.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Controls.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:48:21 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:48:21 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macglue.c,1.110,1.111 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv9761/Python/Mac/Python Modified Files: macglue.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions and other stuff that is now standard (appearance, interned strings) Index: macglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macglue.c,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** macglue.c 27 Dec 2001 23:01:18 -0000 1.110 --- macglue.c 11 Apr 2002 20:48:19 -0000 1.111 *************** *** 72,80 **** #endif - #ifdef USE_GUSI1 - #include /* For Path2FSSpec */ - #include - #endif - /* The ID of the Sioux apple menu */ #define SIOUX_APPLEID 32000 --- 72,75 ---- *************** *** 175,183 **** static PyObject *python_event_handler; - /* - ** Set to true if we're appearance-compliant - */ - int PyMac_AppearanceCompliant; - /* Given an FSSpec, return the FSSpec of the parent folder */ --- 170,173 ---- *************** *** 251,277 **** } - #ifdef USE_GUSI1 - /* - ** GUSI (1.6.0 and earlier, at the least) do not set the MacOS idea of - ** the working directory. Hence, we call this routine after each call - ** to chdir() to rectify things. - */ - void - PyMac_FixGUSIcd() - { - WDPBRec pb; - FSSpec curdirfss; - - if ( Path2FSSpec(":x", &curdirfss) != noErr ) - return; - - /* Set MacOS "working directory" */ - pb.ioNamePtr= "\p"; - pb.ioVRefNum= curdirfss.vRefNum; - pb.ioWDDirID= curdirfss.parID; - if (PBHSetVolSync(&pb) != noErr) - return; - } - #endif #ifdef USE_GUSI --- 241,244 ---- *************** *** 283,328 **** void RotateCursor(short x) { /* Dummy */ } - /* - ** Replacement GUSI Spin function - */ - #ifdef USE_GUSI1 - static int - PyMac_GUSISpin(spin_msg msg, long arg) - { - static Boolean inForeground = true; - int maxsleep = 6; /* 6 ticks is "normal" sleeptime */ - - if (PyMac_ConsoleIsDead) return 0; - #if 0 - if (inForeground) - SpinCursor(msg == SP_AUTO_SPIN ? short(arg) : 1); - #endif - - - if ( msg == SP_AUTO_SPIN ) - maxsleep = 0; - if ( msg==SP_SLEEP||msg==SP_SELECT ) { - maxsleep = arg; - /* - ** We force-scan for interrupts. Not pretty, but otherwise - ** a program may hang in select or sleep forever. - */ - scan_event_queue(1); - } - if (interrupted) { - interrupted = 0; - return -1; - } - - PyMac_DoYield(maxsleep, 0); /* XXXX or is it safe to call python here? */ - - return 0; - } - - void - PyMac_SetGUSISpin() { - GUSISetHook(GUSI_SpinHook, (GUSIHook)PyMac_GUSISpin); - } - #endif /* Called at exit() time thru atexit(), to stop event processing */ --- 250,253 ---- *************** *** 441,449 **** if (thread_for_sentinel == PyThreadState_Get()) { return -1; - #if 0 - } else { - /* Else we are unsure... */ - fprintf(stderr, "Stackcheck in other thread (was %x now %x)\n", thread_for_sentinel,PyThreadState_Get()); - #endif } } --- 366,369 ---- *************** *** 736,748 **** if ( sioux_mbar ) return; - #if 0 - /* This code does not seem to work anymore: apparently - ** we now always have a menubar (since MacOS9?). - ** So we simply always setup the Sioux menus here. - */ - if ( (sioux_mbar=GetMenuBar()) == NULL ) { - #else if ( (sioux_mbar=GetMenuBar()) == NULL || GetMenuHandle(SIOUX_APPLEID) == NULL) { - #endif /* Sioux menu not installed yet. Do so */ SIOUXSetupMenus(); --- 656,660 ---- *************** *** 763,768 **** PyMac_RestoreMenuBar() { - #if 1 - /* This doesn't seem to work anymore? Or only for Carbon? */ MenuBarHandle curmenubar; --- 675,678 ---- *************** *** 775,779 **** DrawMenuBar(); } - #endif } --- 685,688 ---- From jackjansen@sourceforge.net Thu Apr 11 22:02:38 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat QDOffscreen.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15773/Python/Mac/Lib/lib-compat Removed Files: QDOffscreen.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- QDOffscreen.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:40 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:40 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Windows.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16501/Python/Mac/Lib/lib-compat Removed Files: Windows.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Windows.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:03 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:03 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Resources.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16072/Python/Mac/Lib/lib-compat Removed Files: Resources.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Resources.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Lists.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15368/Python/Mac/Lib/lib-compat Removed Files: Lists.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Lists.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:32 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Qdoffs.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15733/Python/Mac/Lib/lib-compat Removed Files: Qdoffs.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Qdoffs.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:30 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:30 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Fonts.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15102/Python/Mac/Lib/lib-compat Removed Files: Fonts.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Fonts.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:00:51 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:00:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Dlg.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv14699/Python/Mac/Lib/lib-compat Removed Files: Dlg.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Dlg.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:03:34 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Win.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16430/Python/Mac/Lib/lib-compat Removed Files: Win.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Win.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:43 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Qt.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15824/Python/Mac/Lib/lib-compat Removed Files: Qt.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Qt.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:55 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:55 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat QuickTime.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15946/Python/Mac/Lib/lib-compat Removed Files: QuickTime.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- QuickTime.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:02:20 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:02:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Mlte.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15628/Python/Mac/Lib/lib-compat Removed Files: Mlte.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Mlte.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:34 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Help.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15154/Python/Mac/Lib/lib-compat Removed Files: Help.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Help.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 22:01:43 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:01:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Icons.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv15231/Python/Mac/Lib/lib-compat Removed Files: Icons.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Icons.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:48:16 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:48:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macimport.c,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv9723/Python/Mac/Python Modified Files: macimport.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions and other stuff that is now standard (appearance, interned strings) Index: macimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macimport.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** macimport.c 5 Dec 2001 23:27:44 -0000 1.14 --- macimport.c 11 Apr 2002 20:48:14 -0000 1.15 *************** *** 36,57 **** #include #include - #if 0 - #include /* for Set(Current)A5 */ - #include - #include - #include - #include - #include - #include - #include - #include - #endif #include #include - #ifdef USE_GUSI1 - #include "TFileSpec.h" /* for Path2FSSpec() */ - #endif - typedef void (*dl_funcptr)(); #define FUNCNAME_PATTERN "init%.200s" --- 36,42 ---- *************** *** 83,87 **** Handle h; - #ifdef INTERN_STRINGS /* ** If we have interning find_module takes care of interning all --- 68,71 ---- *************** *** 101,114 **** return 0; } - #endif /* INTERN_STRINGS */ - #ifdef USE_GUSI1 - if ( Path2FSSpec(filename, &fss) != noErr ) { - #else if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { - #endif - #ifdef INTERN_STRINGS if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) not_a_file[max_not_a_file++] = obj; - #endif /* INTERN_STRINGS */ /* doesn't exist or is folder */ return 0; --- 85,91 ---- *************** *** 124,128 **** filerh = -1; } else { - #ifdef INTERN_STRINGS if ( FSpGetFInfo(&fss, &finfo) != noErr ) { if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) --- 101,104 ---- *************** *** 131,135 **** return 0; } - #endif /* INTERN_STRINGS */ oldrh = CurResFile(); filerh = FSpOpenResFile(&fss, fsRdPerm); --- 107,110 ---- *************** *** 271,275 **** return NULL; } - #if 1 /* Remember the filename as the __file__ attribute */ d = PyModule_GetDict(m); --- 246,249 ---- *************** *** 278,282 **** PyErr_Clear(); /* Not important enough to report */ Py_XDECREF(s); - #endif if (Py_VerboseFlag) PySys_WriteStderr("import %s # pyd fragment %#s loaded from %s\n", --- 252,255 ---- *************** *** 302,311 **** long num, size; - #ifdef USE_GUSI1 - if ( (err=Path2FSSpec(filename, &fss)) != noErr || - FSpGetFInfo(&fss, &finfo) != noErr ) - #else if ( (err=FSMakeFSSpec(0, 0, Pstring(filename), &fss)) != noErr ) - #endif goto error; if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) { --- 275,279 ---- *************** *** 424,430 **** int modnamelen = strlen(module); FSSpec fss; - #ifdef USE_GUSI1 - FInfo finfo; - #endif short refnum; long dirid; --- 392,395 ---- *************** *** 439,450 **** strcpy(buf+*lenp, _PyImport_Filetab[0].suffix); - #ifdef USE_GUSI1 - if ( Path2FSSpec(buf, &fss) == noErr && - FSpGetFInfo(&fss, &finfo) == noErr) - return _PyImport_Filetab; - #else if ( FSMakeFSSpec(0, 0, Pstring(buf), &fss) == noErr ) return _PyImport_Filetab; - #endif /* ** We cannot check for fnfErr (unfortunately), it can mean either that --- 404,409 ---- From jackjansen@sourceforge.net Thu Apr 11 22:03:22 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 14:03:22 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-compat Sound.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-compat In directory usw-pr-cvs1:/tmp/cvs-serv16271/Python/Mac/Lib/lib-compat Removed Files: Sound.py Log Message: Get rid of backward compatibility modules. Do this fairly early in the 2.3 cycle so we don't shoot ourselves in the foot later. --- Sound.py DELETED --- From jackjansen@sourceforge.net Thu Apr 11 21:48:29 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Thu, 11 Apr 2002 13:48:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macgetpath.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv9810/Python/Mac/Python Modified Files: macgetpath.c Log Message: Got rid of ifdefs for long-obsolete GUSI versions and other stuff that is now standard (appearance, interned strings) Index: macgetpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetpath.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** macgetpath.c 14 Dec 2001 22:57:34 -0000 1.25 --- macgetpath.c 11 Apr 2002 20:48:25 -0000 1.26 *************** *** 64,71 **** #include - #ifdef USE_GUSI1 - #include - #endif - #ifndef USE_BUILTIN_PATH staticforward char *PyMac_GetPythonPath(); --- 64,67 ---- *************** *** 212,220 **** prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); if ( prefrh < 0 ) { - #if 0 - action = CautionAlert(NOPREFFILE_ID, NULL); - if ( action == NOPREFFILE_NO ) - exit(1); - #endif FSpCreateResFile(&dirspec, 'Pyth', 'pref', 0); prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); --- 208,211 ---- *************** *** 454,480 **** UseResFile(oldrh); } - - #ifdef USE_GUSI1 - void - PyMac_SetGUSIOptions() - { - Handle h; - short oldrh, prefrh = -1; - - oldrh = CurResFile(); - - /* Try override from the application resource fork */ - UseResFile(PyMac_AppRefNum); - h = Get1Resource('GU\267I', GUSIOPTIONSOVERRIDE_ID); - UseResFile(oldrh); - - /* If that didn't work try nonoverride from anywhere */ - if ( h == NULL ) { - prefrh = PyMac_OpenPrefFile(); - h = GetResource('GU\267I', GUSIOPTIONS_ID); - } - if ( h ) GUSILoadConfiguration(h); - if ( prefrh != -1) CloseResFile(prefrh); - UseResFile(oldrh); - } - #endif /* USE_GUSI1 */ --- 445,446 ---- From jhylton@sourceforge.net Thu Apr 11 22:20:21 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Thu, 11 Apr 2002 14:20:21 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,NONE,1.1 setup.py,NONE,1.1 .cvsignore,1.1,1.2 Makefile,1.3,1.4 asdl_c.py,1.5,1.6 python.asdl,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv24404 Modified Files: .cvsignore Makefile asdl_c.py python.asdl Added Files: astmodule.c setup.py Log Message: Initial boilerplate for a transformer module (astmodule.c) A few fixes to the gramar from Finn Bock. --- NEW FILE: astmodule.c --- #include "Python.h" #include "Python-ast.h" #include "grammar.h" #include "node.h" #include "token.h" #include "parsetok.h" #include "graminit.h" extern grammar _PyParser_Grammar; /* From graminit.c */ static stmt_ty ast_for_stmt(node *n) { REQ(n, stmt); assert(NCH(n) == 1); n = CHILD(n, 0); if (TYPE(n) == simple_stmt) { /* I'm explicitly punting on multiple statements joined by a semicolon. When I do handle it, ast_for_stmt() will have to return a sequence of statements. */ assert(NCH(n) == 2); n = CHILD(n, 0); REQ(n, small_stmt); n = CHILD(n, 0); switch (TYPE(n)) { case expr_stmt: fprintf(stderr, "expr_stmt NCH=%d\n", NCH(n)); break; default: fprintf(stderr, "TYPE=%d NCH=%d\n", TYPE(n), NCH(n)); } } else { REQ(n, compound_stmt); fprintf(stderr, "compound_stmt\n"); } return NULL; } static mod_ty ast_for_module(node *n) { int i; REQ(n, file_input); fprintf(stderr, "file_input NCH=%d\n", NCH(n)); for (i = 0; i < NCH(n); i++) { if (TYPE(CHILD(n, i)) == stmt) ast_for_stmt(CHILD(n, i)); else fprintf(stderr, "skipping %d\n", TYPE(CHILD(n, i))); } return NULL; } static PyObject * ast_transform(PyObject *self, PyObject *src) { node *n; perrdetail err; if (!PyString_Check(src)) { PyErr_Format(PyExc_TypeError, "transform() expected string, found %s", src->ob_type->tp_name); return NULL; } n = PyParser_ParseStringFlags(PyString_AS_STRING(src), &_PyParser_Grammar, Py_file_input, &err, 0); if (n == NULL) { PyErr_SetString(PyExc_ValueError, "parse error"); return NULL; } ast_for_module(n); Py_INCREF(Py_None); return Py_None; } static struct PyMethodDef ast_methods[] = { {"transform", ast_transform, METH_O}, {NULL, NULL} }; DL_EXPORT(void) initast(void) { Py_InitModule("ast", ast_methods); } --- NEW FILE: setup.py --- from distutils.core import setup from distutils.extension import Extension ast = Extension(name="ast", sources=["astmodule.c", "Python-ast.c"]) setup(name="ast", ext_modules=[ast]) import ast ast.transform("1 + 2") Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 10 Apr 2002 03:10:10 -0000 1.1 --- .cvsignore 11 Apr 2002 21:20:19 -0000 1.2 *************** *** 1 **** --- 1,3 ---- Python-ast.c + Python-ast.h + build Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 10 Apr 2002 03:57:40 -0000 1.3 --- Makefile 11 Apr 2002 21:20:19 -0000 1.4 *************** *** 1,5 **** PYINCLUDE=/usr/local/include/python2.3 ! Python-ast.o: Python-ast.c gcc -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c --- 1,5 ---- PYINCLUDE=/usr/local/include/python2.3 ! Python-ast.o: Python-ast.c python.asdl gcc -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** asdl_c.py 10 Apr 2002 03:58:28 -0000 1.5 --- asdl_c.py 11 Apr 2002 21:20:19 -0000 1.6 *************** *** 175,178 **** --- 175,181 ---- self.emit("", depth) + class PrototypeVisitor(EmitVisitor): + """Generate function prototypes for the .h file""" + class FunctionVisitor(EmitVisitor): """Visitor to generate constructor functions for AST.""" *************** *** 247,256 **** if not asdl.check(mod): sys.exit(1) ! f = open("%s-ast.c" % mod.name, "wb") ! print >> f, '#include "Python.h"' print >> f, '#include "asdl.h"\n' c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! FunctionVisitor(f)) c.visit(mod) f.close() --- 250,265 ---- if not asdl.check(mod): sys.exit(1) ! f = open("%s-ast.h" % mod.name, "wb") print >> f, '#include "asdl.h"\n' c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! PrototypeVisitor(f)) c.visit(mod) + f.close() + + f = open("%s-ast.c" % mod.name, "wb") + print >> f, '#include "Python.h"' + print >> f, '#include "%s-ast.h"' % mod.name + v = FunctionVisitor(f) + v.visit(mod) f.close() Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** python.asdl 10 Apr 2002 23:03:32 -0000 1.8 --- python.asdl 11 Apr 2002 21:20:19 -0000 1.9 *************** *** 18,29 **** -- XXX use 'orelse' because else is a keyword -- need a better solution for that ! | For(expr target, expr iter, stmt body, stmt orelse) ! | While(expr test, stmt body, stmt orelse) ! | If(expr test, stmt body, stmt? orelse) -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmt body, except* handlers) ! | TryFinally(stmt body, stmt final) | Assert(expr test, expr? msg) --- 18,29 ---- -- XXX use 'orelse' because else is a keyword -- need a better solution for that ! | For(expr target, expr iter, stmt* body, stmt* orelse) ! | While(expr test, stmt* body, stmt* orelse) ! | If(expr test, stmt* body, stmt* orelse) -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmt* body, except* handlers) ! | TryFinally(stmt* body, stmt* finalbody) | Assert(expr test, expr? msg) *************** *** 60,65 **** | Repr(expr value) | Lvalue(assign lvalue) ! | Number(string n) -- string representation of a number ! | String(string s) -- need to specify raw, unicode, etc? -- other literals? bools? --- 60,65 ---- | Repr(expr value) | Lvalue(assign lvalue) ! | Num(string n) -- string representation of a number ! | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? From tim_one@sourceforge.net Fri Apr 12 02:20:13 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 18:20:13 -0700 Subject: [Python-checkins] python/dist/src/Python future.c,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28086/python/Python Modified Files: future.c Log Message: Removed more hair in support of future-generator stmts. Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** future.c 20 Aug 2001 20:32:33 -0000 2.11 --- future.c 12 Apr 2002 01:20:10 -0000 2.12 *************** *** 36,40 **** continue; } else if (strcmp(feature, FUTURE_GENERATORS) == 0) { ! ff->ff_features |= CO_GENERATOR_ALLOWED; } else if (strcmp(feature, FUTURE_DIVISION) == 0) { ff->ff_features |= CO_FUTURE_DIVISION; --- 36,40 ---- continue; } else if (strcmp(feature, FUTURE_GENERATORS) == 0) { ! continue; } else if (strcmp(feature, FUTURE_DIVISION) == 0) { ff->ff_features |= CO_FUTURE_DIVISION; From tim_one@sourceforge.net Fri Apr 12 02:20:13 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 18:20:13 -0700 Subject: [Python-checkins] python/dist/src/Include compile.h,2.36,2.37 pythonrun.h,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28086/python/Include Modified Files: compile.h pythonrun.h Log Message: Removed more hair in support of future-generator stmts. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** compile.h 13 Dec 2001 19:47:02 -0000 2.36 --- compile.h 12 Apr 2002 01:20:09 -0000 2.37 *************** *** 41,45 **** effect, this passes on the "from __future__ import generators" state in effect when the code block was compiled. */ ! #define CO_GENERATOR_ALLOWED 0x1000 #define CO_FUTURE_DIVISION 0x2000 --- 41,45 ---- effect, this passes on the "from __future__ import generators" state in effect when the code block was compiled. */ ! #define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */ #define CO_FUTURE_DIVISION 0x2000 Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -d -r2.48 -r2.49 *** pythonrun.h 31 Aug 2001 17:40:14 -0000 2.48 --- pythonrun.h 12 Apr 2002 01:20:10 -0000 2.49 *************** *** 8,13 **** #endif ! #define PyCF_MASK (CO_GENERATOR_ALLOWED | CO_FUTURE_DIVISION) ! #define PyCF_MASK_OBSOLETE (CO_NESTED) typedef struct { --- 8,13 ---- #endif ! #define PyCF_MASK (CO_FUTURE_DIVISION) ! #define PyCF_MASK_OBSOLETE (CO_GENERATOR_ALLOWED | CO_NESTED) typedef struct { From nascheme@sourceforge.net Fri Apr 12 02:57:08 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 18:57:08 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.100,2.101 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv3676/Include Modified Files: object.h Log Message: Change the type of the tp_free from 'destructor' to 'freefunc'. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.100 retrieving revision 2.101 diff -C2 -d -r2.100 -r2.101 *** object.h 3 Apr 2002 22:41:50 -0000 2.100 --- object.h 12 Apr 2002 01:57:06 -0000 2.101 *************** *** 200,203 **** --- 200,204 ---- + typedef void (*freefunc)(void *); typedef void (*destructor)(PyObject *); typedef int (*printfunc)(PyObject *, FILE *, int); *************** *** 285,289 **** allocfunc tp_alloc; newfunc tp_new; ! destructor tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; --- 286,290 ---- allocfunc tp_alloc; newfunc tp_new; ! freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; From jhylton@sourceforge.net Fri Apr 12 03:35:17 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Thu, 11 Apr 2002 19:35:17 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv11515 Modified Files: asdl_c.py Log Message: PrototypeVisitor isn't ready yet. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** asdl_c.py 11 Apr 2002 21:20:19 -0000 1.6 --- asdl_c.py 12 Apr 2002 02:35:15 -0000 1.7 *************** *** 254,258 **** c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! PrototypeVisitor(f)) c.visit(mod) f.close() --- 254,259 ---- c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! ## PrototypeVisitor(f) ! ) c.visit(mod) f.close() From nascheme@sourceforge.net Fri Apr 12 03:38:47 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:38:47 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv12203/Include Modified Files: objimpl.h Log Message: Remove PyMalloc_* symbols. PyObject_Malloc now uses pymalloc if it's enabled. To avoid breaking extension modules that allocate using PyObject_{NEW,New} and deallocate with PyMem_{Del,DEL}, PyMem_DEL has been changed to call pymalloc's free. Allow PyObject_Del, PyObject_Free, and PyObject_GC_Del to be used as function designators. Provide source compatibility macros. Make PyObject_GC_Track and PyObject_GC_UnTrack functions instead of trivial macros wrapping functions. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -d -r2.48 -r2.49 *** objimpl.h 28 Mar 2002 21:06:16 -0000 2.48 --- objimpl.h 12 Apr 2002 02:38:45 -0000 2.49 *************** *** 35,42 **** Note that objects created with PyObject_{New, NewVar} are allocated ! within the Python heap by the raw memory allocator (usually the system ! malloc). If you want to use the specialized Python allocator use ! PyMalloc_New and PyMalloc_NewVar to allocate the objects and ! PyMalloc_Del to free them. In case a specific form of memory management is needed, implying that --- 35,39 ---- Note that objects created with PyObject_{New, NewVar} are allocated ! using the specialized Python allocator (implemented in obmalloc.c). In case a specific form of memory management is needed, implying that *************** *** 83,90 **** extern DL_IMPORT(void) PyObject_Free(void *); /* Macros */ ! #define PyObject_MALLOC(n) PyMem_MALLOC(n) ! #define PyObject_REALLOC(op, n) PyMem_REALLOC((void *)(op), (n)) ! #define PyObject_FREE(op) PyMem_FREE((void *)(op)) /* --- 80,117 ---- extern DL_IMPORT(void) PyObject_Free(void *); + /* Macros */ ! #ifdef WITH_PYMALLOC ! #ifdef PYMALLOC_DEBUG ! DL_IMPORT(void *) _PyObject_DebugMalloc(size_t nbytes); ! DL_IMPORT(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); ! DL_IMPORT(void) _PyObject_DebugFree(void *p); ! DL_IMPORT(void) _PyObject_DebugDumpAddress(const void *p); ! DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); ! DL_IMPORT(void) _PyObject_DebugDumpStats(void); ! #define PyObject_MALLOC _PyObject_DebugMalloc ! #define PyObject_Malloc _PyObject_DebugMalloc ! #define PyObject_REALLOC _PyObject_DebugRealloc ! #define PyObject_Realloc _PyObject_DebugRealloc ! #define PyObject_FREE _PyObject_DebugFree ! #define PyObject_Free _PyObject_DebugFree ! ! #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ ! #define PyObject_MALLOC PyObject_Malloc ! #define PyObject_REALLOC PyObject_Realloc ! #define PyObject_FREE PyObject_Free ! #endif ! ! #else /* ! WITH_PYMALLOC */ ! #define PyObject_MALLOC PyMem_MALLOC ! #define PyObject_REALLOC PyMem_REALLOC ! #define PyObject_FREE PyMem_FREE ! #endif /* WITH_PYMALLOC */ ! ! #define PyObject_Del PyObject_Free ! #define PyObject_DEL PyObject_FREE ! ! /* for source compatibility with 2.2 */ ! #define _PyObject_Del PyObject_Free /* *************** *** 99,103 **** extern DL_IMPORT(PyObject *) _PyObject_New(PyTypeObject *); extern DL_IMPORT(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int); - extern DL_IMPORT(void) _PyObject_Del(PyObject *); #define PyObject_New(type, typeobj) \ --- 126,129 ---- *************** *** 105,109 **** #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) - #define PyObject_Del(op) _PyObject_Del((PyObject *)(op)) /* Macros trading binary compatibility for speed. See also pymem.h. --- 131,134 ---- *************** *** 147,152 **** (typeobj), (n)) ) - #define PyObject_DEL(op) PyObject_FREE(op) - /* This example code implements an object constructor with a custom allocator, where PyObject_New is inlined, and shows the important --- 172,175 ---- *************** *** 179,198 **** /* - * The PyMalloc Object Allocator - * ============================= - */ - - extern DL_IMPORT(PyObject *) _PyMalloc_New(PyTypeObject *); - extern DL_IMPORT(PyVarObject *) _PyMalloc_NewVar(PyTypeObject *, int); - extern DL_IMPORT(void) _PyMalloc_Del(PyObject *); - - #define PyMalloc_New(type, typeobj) \ - ( (type *) _PyMalloc_New(typeobj) ) - #define PyMalloc_NewVar(type, typeobj, n) \ - ( (type *) _PyMalloc_NewVar((typeobj), (n)) ) - #define PyMalloc_Del(op) _PyMalloc_Del((PyObject *)(op)) - - - /* * Garbage Collection Support * ========================== --- 202,205 ---- *************** *** 210,224 **** ((o)->ob_type->tp_is_gc == NULL || (o)->ob_type->tp_is_gc(o))) - extern DL_IMPORT(PyObject *) _PyObject_GC_Malloc(PyTypeObject *, int); extern DL_IMPORT(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, int); - #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) ! extern DL_IMPORT(PyObject *) _PyObject_GC_New(PyTypeObject *); ! extern DL_IMPORT(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, int); ! extern DL_IMPORT(void) _PyObject_GC_Del(PyObject *); ! extern DL_IMPORT(void) _PyObject_GC_Track(PyObject *); ! extern DL_IMPORT(void) _PyObject_GC_UnTrack(PyObject *); #ifdef WITH_CYCLE_GC --- 217,226 ---- ((o)->ob_type->tp_is_gc == NULL || (o)->ob_type->tp_is_gc(o))) extern DL_IMPORT(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, int); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) ! /* for source compatibility with 2.2 */ ! #define _PyObject_GC_Del PyObject_GC_Del #ifdef WITH_CYCLE_GC *************** *** 258,264 **** } while (0); ! #define PyObject_GC_Track(op) _PyObject_GC_Track((PyObject *)op) ! #define PyObject_GC_UnTrack(op) _PyObject_GC_UnTrack((PyObject *)op) ! #define PyObject_GC_New(type, typeobj) \ --- 260,269 ---- } while (0); ! extern DL_IMPORT(PyObject *) _PyObject_GC_Malloc(size_t); ! extern DL_IMPORT(PyObject *) _PyObject_GC_New(PyTypeObject *); ! extern DL_IMPORT(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, int); ! extern DL_IMPORT(void) PyObject_GC_Track(void *); ! extern DL_IMPORT(void) PyObject_GC_UnTrack(void *); ! extern DL_IMPORT(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ *************** *** 266,273 **** #define PyObject_GC_NewVar(type, typeobj, n) \ ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) ! #define PyObject_GC_Del(op) _PyObject_GC_Del((PyObject *)(op)) #else /* !WITH_CYCLE_GC */ #define PyObject_GC_New PyObject_New #define PyObject_GC_NewVar PyObject_NewVar --- 271,279 ---- #define PyObject_GC_NewVar(type, typeobj, n) \ ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) ! #else /* !WITH_CYCLE_GC */ + #define _PyObject_GC_Malloc PyObject_Malloc #define PyObject_GC_New PyObject_New #define PyObject_GC_NewVar PyObject_NewVar From nascheme@sourceforge.net Fri Apr 12 03:39:20 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:39:20 -0700 Subject: [Python-checkins] python/dist/src/Include pymem.h,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv12323/Include Modified Files: pymem.h Log Message: Remove PyMalloc_* symbols. PyObject_Malloc now uses pymalloc if it's enabled. Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** pymem.h 1 Apr 2002 06:04:21 -0000 2.11 --- pymem.h 12 Apr 2002 02:39:18 -0000 2.12 *************** *** 91,124 **** - /* pymalloc (private to the interpreter) */ - #ifdef WITH_PYMALLOC - DL_IMPORT(void *) _PyMalloc_Malloc(size_t nbytes); - DL_IMPORT(void *) _PyMalloc_Realloc(void *p, size_t nbytes); - DL_IMPORT(void) _PyMalloc_Free(void *p); - - #ifdef PYMALLOC_DEBUG - DL_IMPORT(void *) _PyMalloc_DebugMalloc(size_t nbytes); - DL_IMPORT(void *) _PyMalloc_DebugRealloc(void *p, size_t nbytes); - DL_IMPORT(void) _PyMalloc_DebugFree(void *p); - DL_IMPORT(void) _PyMalloc_DebugDumpAddress(const void *p); - DL_IMPORT(void) _PyMalloc_DebugCheckAddress(const void *p); - DL_IMPORT(void) _PyMalloc_DebugDumpStats(void); - #define _PyMalloc_MALLOC _PyMalloc_DebugMalloc - #define _PyMalloc_REALLOC _PyMalloc_DebugRealloc - #define _PyMalloc_FREE _PyMalloc_DebugFree - - #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ - #define _PyMalloc_MALLOC _PyMalloc_Malloc - #define _PyMalloc_REALLOC _PyMalloc_Realloc - #define _PyMalloc_FREE _PyMalloc_Free - #endif - - #else /* ! WITH_PYMALLOC */ - #define _PyMalloc_MALLOC PyMem_MALLOC - #define _PyMalloc_REALLOC PyMem_REALLOC - #define _PyMalloc_FREE PyMem_FREE - #endif /* WITH_PYMALLOC */ - - #ifdef __cplusplus } --- 91,94 ---- From nascheme@sourceforge.net Fri Apr 12 03:39:59 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:39:59 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12396/Modules Modified Files: arraymodule.c Log Message: PyObject_Del can now be used as a function designator. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** arraymodule.c 1 Apr 2002 03:45:06 -0000 2.69 --- arraymodule.c 12 Apr 2002 02:39:57 -0000 2.70 *************** *** 1720,1724 **** PyType_GenericAlloc, /* tp_alloc */ array_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 1720,1724 ---- PyType_GenericAlloc, /* tp_alloc */ array_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:41:05 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:41:05 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12602/Modules Modified Files: gcmodule.c Log Message: Allow PyObject_Del to be used as a function designator. Provide binary compatibility function. Make PyObject_GC_Track and PyObject_GC_UnTrack functions instead of trivial macros wrapping functions. Provide binary compatibility functions. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** gcmodule.c 29 Mar 2002 03:04:25 -0000 2.38 --- gcmodule.c 12 Apr 2002 02:41:03 -0000 2.39 *************** *** 811,822 **** functions must always be available */ void ! _PyObject_GC_Track(PyObject *op) { _PyObject_GC_TRACK(op); } void ! _PyObject_GC_UnTrack(PyObject *op) { #ifdef WITH_CYCLE_GC --- 811,834 ---- functions must always be available */ + #undef PyObject_GC_Track + #undef PyObject_GC_UnTrack + #undef PyObject_GC_Del + #undef _PyObject_GC_Malloc + void ! PyObject_GC_Track(void *op) { _PyObject_GC_TRACK(op); } + /* for binary compatibility with 2.2 */ void ! _PyObject_GC_Track(PyObject *op) ! { ! PyObject_GC_Track(op); ! } ! ! void ! PyObject_GC_UnTrack(void *op) { #ifdef WITH_CYCLE_GC *************** *** 827,838 **** } PyObject * ! _PyObject_GC_Malloc(PyTypeObject *tp, int nitems) { PyObject *op; - const size_t basicsize = _PyObject_VAR_SIZE(tp, nitems); #ifdef WITH_CYCLE_GC ! const size_t nbytes = sizeof(PyGC_Head) + basicsize; ! PyGC_Head *g = _PyMalloc_MALLOC(nbytes); if (g == NULL) return (PyObject *)PyErr_NoMemory(); --- 839,855 ---- } + /* for binary compatibility with 2.2 */ + void + _PyObject_GC_UnTrack(PyObject *op) + { + PyObject_GC_UnTrack(op); + } + PyObject * ! _PyObject_GC_Malloc(size_t basicsize) { PyObject *op; #ifdef WITH_CYCLE_GC ! PyGC_Head *g = PyObject_MALLOC(sizeof(PyGC_Head) + basicsize); if (g == NULL) return (PyObject *)PyErr_NoMemory(); *************** *** 850,854 **** op = FROM_GC(g); #else ! op = _PyMalloc_MALLOC(basicsize); if (op == NULL) return (PyObject *)PyErr_NoMemory(); --- 867,871 ---- op = FROM_GC(g); #else ! op = PyObject_MALLOC(basicsize); if (op == NULL) return (PyObject *)PyErr_NoMemory(); *************** *** 861,865 **** _PyObject_GC_New(PyTypeObject *tp) { ! PyObject *op = _PyObject_GC_Malloc(tp, 0); return PyObject_INIT(op, tp); } --- 878,882 ---- _PyObject_GC_New(PyTypeObject *tp) { ! PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp)); return PyObject_INIT(op, tp); } *************** *** 868,872 **** _PyObject_GC_NewVar(PyTypeObject *tp, int nitems) { ! PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(tp, nitems); return PyObject_INIT_VAR(op, tp, nitems); } --- 885,890 ---- _PyObject_GC_NewVar(PyTypeObject *tp, int nitems) { ! const size_t size = _PyObject_VAR_SIZE(tp, nitems); ! PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(size); return PyObject_INIT_VAR(op, tp, nitems); } *************** *** 878,887 **** #ifdef WITH_CYCLE_GC PyGC_Head *g = AS_GC(op); ! g = _PyMalloc_REALLOC(g, sizeof(PyGC_Head) + basicsize); if (g == NULL) return (PyVarObject *)PyErr_NoMemory(); op = (PyVarObject *) FROM_GC(g); #else ! op = _PyMalloc_REALLOC(op, basicsize); if (op == NULL) return (PyVarObject *)PyErr_NoMemory(); --- 896,905 ---- #ifdef WITH_CYCLE_GC PyGC_Head *g = AS_GC(op); ! g = PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize); if (g == NULL) return (PyVarObject *)PyErr_NoMemory(); op = (PyVarObject *) FROM_GC(g); #else ! op = PyObject_REALLOC(op, basicsize); if (op == NULL) return (PyVarObject *)PyErr_NoMemory(); *************** *** 892,896 **** void ! _PyObject_GC_Del(PyObject *op) { #ifdef WITH_CYCLE_GC --- 910,914 ---- void ! PyObject_GC_Del(void *op) { #ifdef WITH_CYCLE_GC *************** *** 901,908 **** allocated--; } ! _PyMalloc_FREE(g); #else ! _PyMalloc_FREE(op); #endif } --- 919,933 ---- allocated--; } ! PyObject_FREE(g); #else ! PyObject_FREE(op); #endif } + /* for binary compatibility with 2.2 */ + #undef _PyObject_GC_Del + void + _PyObject_GC_Del(PyObject *op) + { + PyObject_GC_Del(op); + } From nascheme@sourceforge.net Fri Apr 12 03:41:27 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:41:27 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.214,1.215 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12660/Modules Modified Files: socketmodule.c Log Message: PyObject_Del can now be used as a function designator. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -d -r1.214 -r1.215 *** socketmodule.c 11 Apr 2002 20:44:16 -0000 1.214 --- socketmodule.c 12 Apr 2002 02:41:24 -0000 1.215 *************** *** 2704,2708 **** PySocketSock_Type.tp_getattro = PyObject_GenericGetAttr; PySocketSock_Type.tp_alloc = PyType_GenericAlloc; ! PySocketSock_Type.tp_free = _PyObject_Del; m = Py_InitModule3(PySocket_MODULE_NAME, PySocket_methods, --- 2704,2708 ---- PySocketSock_Type.tp_getattro = PyObject_GenericGetAttr; PySocketSock_Type.tp_alloc = PyType_GenericAlloc; ! PySocketSock_Type.tp_free = PyObject_Del; m = Py_InitModule3(PySocket_MODULE_NAME, PySocket_methods, From nascheme@sourceforge.net Fri Apr 12 03:41:34 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:41:34 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12681/Objects Modified Files: complexobject.c Log Message: PyObject_Del can now be used as a function designator. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** complexobject.c 22 Mar 2002 02:48:46 -0000 2.55 --- complexobject.c 12 Apr 2002 02:41:32 -0000 2.56 *************** *** 993,997 **** 0, /* tp_alloc */ complex_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 993,997 ---- 0, /* tp_alloc */ complex_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:41:49 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:41:49 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12730/Objects Modified Files: descrobject.c Log Message: PyObject_GC_Del can now be used as a function designator. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** descrobject.c 25 Mar 2002 17:43:22 -0000 2.23 --- descrobject.c 12 Apr 2002 02:41:47 -0000 2.24 *************** *** 1128,1131 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; --- 1128,1131 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:43:02 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:43:02 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.123,2.124 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12947/Objects Modified Files: dictobject.c Log Message: PyObject_GC_Del and PyObject_Del can now be used as a function designators. Remove PyMalloc_New. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -d -r2.123 -r2.124 *** dictobject.c 3 Apr 2002 22:41:51 -0000 2.123 --- dictobject.c 12 Apr 2002 02:43:00 -0000 2.124 *************** *** 1829,1833 **** PyType_GenericAlloc, /* tp_alloc */ dict_new, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; --- 1829,1833 ---- PyType_GenericAlloc, /* tp_alloc */ dict_new, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; *************** *** 1889,1893 **** { dictiterobject *di; ! di = PyMalloc_New(dictiterobject, &PyDictIter_Type); if (di == NULL) return NULL; --- 1889,1893 ---- { dictiterobject *di; ! di = PyObject_New(dictiterobject, &PyDictIter_Type); if (di == NULL) return NULL; *************** *** 1904,1908 **** { Py_DECREF(di->di_dict); ! PyMalloc_Del(di); } --- 1904,1908 ---- { Py_DECREF(di->di_dict); ! PyObject_Del(di); } From nascheme@sourceforge.net Fri Apr 12 03:43:34 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:43:34 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.156,2.157 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13086/Objects Modified Files: fileobject.c Log Message: PyObject_Del can now be used as a function designator. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.156 retrieving revision 2.157 diff -C2 -d -r2.156 -r2.157 *** fileobject.c 8 Apr 2002 04:13:12 -0000 2.156 --- fileobject.c 12 Apr 2002 02:43:31 -0000 2.157 *************** *** 1632,1636 **** PyType_GenericAlloc, /* tp_alloc */ file_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 1632,1636 ---- PyType_GenericAlloc, /* tp_alloc */ file_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:43:50 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:43:50 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.52,2.53 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13132/Objects Modified Files: funcobject.c Log Message: PyObject_Del can now be used as a function designator. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** funcobject.c 3 Apr 2002 21:42:45 -0000 2.52 --- funcobject.c 12 Apr 2002 02:43:44 -0000 2.53 *************** *** 555,559 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 555,559 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 684,688 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 684,688 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:44:02 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:44:02 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.104,2.105 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13201/Objects Modified Files: listobject.c Log Message: PyObject_GC_Del can now be used as a function designator. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.104 retrieving revision 2.105 diff -C2 -d -r2.104 -r2.105 *** listobject.c 28 Mar 2002 20:34:59 -0000 2.104 --- listobject.c 12 Apr 2002 02:43:59 -0000 2.105 *************** *** 1715,1719 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; --- 1715,1719 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:44:13 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:44:13 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13253/Objects Modified Files: longobject.c Log Message: PyObject_Del can now be used as a function designator. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** longobject.c 9 Mar 2002 12:02:59 -0000 1.115 --- longobject.c 12 Apr 2002 02:44:10 -0000 1.116 *************** *** 2353,2356 **** 0, /* tp_alloc */ long_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 2353,2356 ---- 0, /* tp_alloc */ long_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:44:25 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:44:25 -0700 Subject: [Python-checkins] python/dist/src/Objects moduleobject.c,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13287/Objects Modified Files: moduleobject.c Log Message: PyObject_GC_Del can now be used as a function designator. Index: moduleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/moduleobject.c,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** moduleobject.c 12 Mar 2002 20:37:02 -0000 2.41 --- moduleobject.c 12 Apr 2002 02:44:22 -0000 2.42 *************** *** 238,241 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; --- 238,241 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 03:44:57 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 19:44:57 -0700 Subject: [Python-checkins] python/dist/src/Objects rangeobject.c,2.32,2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13380/Objects Modified Files: rangeobject.c Log Message: Remove PyMalloc_New and PyMalloc_Del. Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** rangeobject.c 22 Mar 2002 15:28:53 -0000 2.32 --- rangeobject.c 12 Apr 2002 02:44:55 -0000 2.33 *************** *** 61,65 **** { long totlen = -1; ! rangeobject *obj = PyMalloc_New(rangeobject, &PyRange_Type); if (obj == NULL) --- 61,65 ---- { long totlen = -1; ! rangeobject *obj = PyObject_New(rangeobject, &PyRange_Type); if (obj == NULL) *************** *** 105,109 **** range_dealloc(rangeobject *r) { ! PyMalloc_Del(r); } --- 105,109 ---- range_dealloc(rangeobject *r) { ! PyObject_Del(r); } From nascheme@sourceforge.net Fri Apr 12 04:04:17 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:04:17 -0700 Subject: [Python-checkins] python/dist/src/Objects sliceobject.c,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18027/Objects Modified Files: sliceobject.c Log Message: Remove PyMalloc_New and PyMalloc_Del. Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** sliceobject.c 22 Mar 2002 15:29:09 -0000 2.11 --- sliceobject.c 12 Apr 2002 03:04:15 -0000 2.12 *************** *** 61,65 **** PySlice_New(PyObject *start, PyObject *stop, PyObject *step) { ! PySliceObject *obj = PyMalloc_New(PySliceObject, &PySlice_Type); if (obj == NULL) --- 61,65 ---- PySlice_New(PyObject *start, PyObject *stop, PyObject *step) { ! PySliceObject *obj = PyObject_New(PySliceObject, &PySlice_Type); if (obj == NULL) *************** *** 116,120 **** Py_DECREF(r->start); Py_DECREF(r->stop); ! PyMalloc_Del(r); } --- 116,120 ---- Py_DECREF(r->start); Py_DECREF(r->stop); ! PyObject_Del(r); } From nascheme@sourceforge.net Fri Apr 12 04:05:21 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:05:21 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.154,2.155 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18323/Objects Modified Files: stringobject.c Log Message: Remove PyMalloc_New, _PyMalloc_MALLOC, and PyMalloc_Del. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.154 retrieving revision 2.155 diff -C2 -d -r2.154 -r2.155 *** stringobject.c 3 Apr 2002 22:41:51 -0000 2.154 --- stringobject.c 12 Apr 2002 03:05:19 -0000 2.155 *************** *** 65,69 **** /* PyObject_NewVar is inlined */ op = (PyStringObject *) ! _PyMalloc_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); --- 65,69 ---- /* PyObject_NewVar is inlined */ op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); *************** *** 121,125 **** /* PyObject_NewVar is inlined */ op = (PyStringObject *) ! _PyMalloc_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); --- 121,125 ---- /* PyObject_NewVar is inlined */ op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); *************** *** 718,722 **** /* PyObject_NewVar is inlined */ op = (PyStringObject *) ! _PyMalloc_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); --- 718,722 ---- /* PyObject_NewVar is inlined */ op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); *************** *** 761,765 **** } op = (PyStringObject *) ! _PyMalloc_MALLOC(sizeof(PyStringObject) + nbytes); if (op == NULL) return PyErr_NoMemory(); --- 761,765 ---- } op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + nbytes); if (op == NULL) return PyErr_NoMemory(); *************** *** 2756,2760 **** 0, /* tp_alloc */ string_new, /* tp_new */ ! _PyMalloc_Del, /* tp_free */ }; --- 2756,2760 ---- 0, /* tp_alloc */ string_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 2808,2815 **** _Py_ForgetReference(v); *pv = (PyObject *) ! _PyMalloc_REALLOC((char *)v, sizeof(PyStringObject) + newsize * sizeof(char)); if (*pv == NULL) { ! PyMalloc_Del(v); PyErr_NoMemory(); return -1; --- 2808,2815 ---- _Py_ForgetReference(v); *pv = (PyObject *) ! PyObject_REALLOC((char *)v, sizeof(PyStringObject) + newsize * sizeof(char)); if (*pv == NULL) { ! PyObject_Del(v); PyErr_NoMemory(); return -1; From nascheme@sourceforge.net Fri Apr 12 04:05:39 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:05:39 -0700 Subject: [Python-checkins] python/dist/src/Objects structseq.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18415/Objects Modified Files: structseq.c Log Message: Remove PyMalloc_New and PyMalloc_Del. Index: structseq.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/structseq.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** structseq.c 22 Mar 2002 15:30:25 -0000 1.7 --- structseq.c 12 Apr 2002 03:05:37 -0000 1.8 *************** *** 23,27 **** PyStructSequence *obj; ! obj = PyMalloc_New(PyStructSequence, type); obj->ob_size = VISIBLE_SIZE_TP(type); --- 23,27 ---- PyStructSequence *obj; ! obj = PyObject_New(PyStructSequence, type); obj->ob_size = VISIBLE_SIZE_TP(type); *************** *** 38,42 **** Py_XDECREF(obj->ob_item[i]); } ! PyMalloc_Del(obj); } --- 38,42 ---- Py_XDECREF(obj->ob_item[i]); } ! PyObject_Del(obj); } From nascheme@sourceforge.net Fri Apr 12 04:05:54 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:05:54 -0700 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18455/Objects Modified Files: tupleobject.c Log Message: PyObject_GC_Del can now be used as a function designator. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** tupleobject.c 28 Mar 2002 20:34:59 -0000 2.63 --- tupleobject.c 12 Apr 2002 03:05:52 -0000 2.64 *************** *** 583,587 **** 0, /* tp_alloc */ tuple_new, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; --- 583,587 ---- 0, /* tp_alloc */ tuple_new, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 04:06:56 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:06:56 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.140,2.141 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18699/Objects Modified Files: typeobject.c Log Message: Change signature of _PyObject_GC_Malloc to match PyObject_MALLOC. PyObject_Del and PyObject_GC_Del can now be used as a function designators. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.140 retrieving revision 2.141 diff -C2 -d -r2.140 -r2.141 *** typeobject.c 8 Apr 2002 01:38:42 -0000 2.140 --- typeobject.c 12 Apr 2002 03:06:53 -0000 2.141 *************** *** 191,195 **** if (PyType_IS_GC(type)) ! obj = _PyObject_GC_Malloc(type, nitems); else obj = PyObject_MALLOC(size); --- 191,195 ---- if (PyType_IS_GC(type)) ! obj = _PyObject_GC_Malloc(size); else obj = PyObject_MALLOC(size); *************** *** 1188,1197 **** type->tp_alloc = PyType_GenericAlloc; if (type->tp_flags & Py_TPFLAGS_HAVE_GC) { ! type->tp_free = _PyObject_GC_Del; type->tp_traverse = subtype_traverse; type->tp_clear = base->tp_clear; } else ! type->tp_free = _PyObject_Del; /* Initialize the rest */ --- 1188,1197 ---- type->tp_alloc = PyType_GenericAlloc; if (type->tp_flags & Py_TPFLAGS_HAVE_GC) { ! type->tp_free = PyObject_GC_Del; type->tp_traverse = subtype_traverse; type->tp_clear = base->tp_clear; } else ! type->tp_free = PyObject_Del; /* Initialize the rest */ *************** *** 1495,1499 **** 0, /* tp_alloc */ type_new, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ (inquiry)type_is_gc, /* tp_is_gc */ }; --- 1495,1499 ---- 0, /* tp_alloc */ type_new, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ (inquiry)type_is_gc, /* tp_is_gc */ }; *************** *** 1710,1714 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 1710,1714 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 4273,4276 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; --- 4273,4276 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 12 04:07:22 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:07:22 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.136,2.137 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18828/Objects Modified Files: unicodeobject.c Log Message: Remove PyMalloc_*. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.136 retrieving revision 2.137 diff -C2 -d -r2.136 -r2.137 *** unicodeobject.c 10 Apr 2002 20:36:13 -0000 2.136 --- unicodeobject.c 12 Apr 2002 03:07:20 -0000 2.137 *************** *** 202,206 **** } else { ! unicode = PyMalloc_New(PyUnicodeObject, &PyUnicode_Type); if (unicode == NULL) return NULL; --- 202,206 ---- } else { ! unicode = PyObject_New(PyUnicodeObject, &PyUnicode_Type); if (unicode == NULL) return NULL; *************** *** 220,224 **** onError: _Py_ForgetReference((PyObject *)unicode); ! PyMalloc_Del(unicode); return NULL; } --- 220,224 ---- onError: _Py_ForgetReference((PyObject *)unicode); ! PyObject_Del(unicode); return NULL; } *************** *** 5719,5723 **** if (pnew->str == NULL) { _Py_ForgetReference((PyObject *)pnew); ! PyMalloc_Del(pnew); return NULL; } --- 5719,5723 ---- if (pnew->str == NULL) { _Py_ForgetReference((PyObject *)pnew); ! PyObject_Del(pnew); return NULL; } *************** *** 5777,5781 **** 0, /* tp_alloc */ unicode_new, /* tp_new */ ! _PyMalloc_Del, /* tp_free */ }; --- 5777,5781 ---- 0, /* tp_alloc */ unicode_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 5819,5823 **** PyMem_DEL(v->str); Py_XDECREF(v->defenc); ! PyMalloc_Del(v); } unicode_freelist = NULL; --- 5819,5823 ---- PyMem_DEL(v->str); Py_XDECREF(v->defenc); ! PyObject_Del(v); } unicode_freelist = NULL; From nascheme@sourceforge.net Fri Apr 12 04:08:44 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:08:44 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.170,2.171 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19023/Objects Modified Files: object.c Log Message: Move PyObject_Malloc and PyObject_Free to obmalloc.c. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.170 retrieving revision 2.171 diff -C2 -d -r2.170 -r2.171 *** object.c 3 Apr 2002 22:41:51 -0000 2.170 --- object.c 12 Apr 2002 03:08:42 -0000 2.171 *************** *** 138,141 **** --- 138,143 ---- } + /* for binary compatibility with 2.2 */ + #undef _PyObject_Del void _PyObject_Del(PyObject *op) *************** *** 1914,1938 **** { PyMem_FREE(p); - } - - - /* Python's object malloc wrappers (see objimpl.h) */ - - void * - PyObject_Malloc(size_t nbytes) - { - return PyObject_MALLOC(nbytes); - } - - void * - PyObject_Realloc(void *p, size_t nbytes) - { - return PyObject_REALLOC(p, nbytes); - } - - void - PyObject_Free(void *p) - { - PyObject_FREE(p); } --- 1916,1919 ---- From nascheme@sourceforge.net Fri Apr 12 04:10:22 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 11 Apr 2002 20:10:22 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19336/Objects Modified Files: obmalloc.c Log Message: Move PyObject_Malloc and PyObject_Free here from object.c. Remove PyMalloc_ prefix and use PyObject_ instead. I'm not sure about the debugging functions. Perhaps they should stay as PyMalloc_. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** obmalloc.c 11 Apr 2002 06:36:45 -0000 2.34 --- obmalloc.c 12 Apr 2002 03:10:20 -0000 2.35 *************** *** 566,571 **** */ void * ! _PyMalloc_Malloc(size_t nbytes) { block *bp; --- 566,572 ---- */ + #undef PyObject_Malloc void * ! PyObject_Malloc(size_t nbytes) { block *bp; *************** *** 707,712 **** /* free */ void ! _PyMalloc_Free(void *p) { poolp pool; --- 708,714 ---- /* free */ + #undef PyObject_Free void ! PyObject_Free(void *p) { poolp pool; *************** *** 792,797 **** */ void * ! _PyMalloc_Realloc(void *p, size_t nbytes) { void *bp; --- 794,800 ---- */ + #undef PyObject_Realloc void * ! PyObject_Realloc(void *p, size_t nbytes) { void *bp; *************** *** 800,804 **** if (p == NULL) ! return _PyMalloc_Malloc(nbytes); pool = POOL_ADDR(p); --- 803,807 ---- if (p == NULL) ! return PyObject_Malloc(nbytes); pool = POOL_ADDR(p); *************** *** 812,819 **** /* We need more memory. */ assert(nbytes != 0); ! bp = _PyMalloc_Malloc(nbytes); if (bp != NULL) { memcpy(bp, p, size); ! _PyMalloc_Free(p); } return bp; --- 815,822 ---- /* We need more memory. */ assert(nbytes != 0); ! bp = PyObject_Malloc(nbytes); if (bp != NULL) { memcpy(bp, p, size); ! PyObject_Free(p); } return bp; *************** *** 823,827 **** if (nbytes <= SMALL_REQUEST_THRESHOLD) { /* Take over this block. */ ! bp = _PyMalloc_Malloc(nbytes ? nbytes : 1); if (bp != NULL) { memcpy(bp, p, nbytes); --- 826,830 ---- if (nbytes <= SMALL_REQUEST_THRESHOLD) { /* Take over this block. */ ! bp = PyObject_Malloc(nbytes ? nbytes : 1); if (bp != NULL) { memcpy(bp, p, nbytes); *************** *** 846,853 **** /*==========================================================================*/ ! /* pymalloc not enabled: Redirect the entry points to the PyMem family. */ void * ! _PyMalloc_Malloc(size_t n) { return PyMem_MALLOC(n); --- 849,857 ---- /*==========================================================================*/ ! /* pymalloc not enabled: Redirect the entry points to malloc. These will ! * only be used by extensions that are compiled with pymalloc enabled. */ void * ! PyObject_Malloc(size_t n) { return PyMem_MALLOC(n); *************** *** 855,859 **** void * ! _PyMalloc_Realloc(void *p, size_t n) { return PyMem_REALLOC(p, n); --- 859,863 ---- void * ! PyObject_Realloc(void *p, size_t n) { return PyMem_REALLOC(p, n); *************** *** 861,865 **** void ! _PyMalloc_Free(void *p) { PyMem_FREE(p); --- 865,869 ---- void ! PyObject_Free(void *p) { PyMem_FREE(p); *************** *** 867,902 **** #endif /* WITH_PYMALLOC */ - /*==========================================================================*/ - /* Regardless of whether pymalloc is enabled, export entry points for - * the object-oriented pymalloc functions. - */ - - PyObject * - _PyMalloc_New(PyTypeObject *tp) - { - PyObject *op; - op = (PyObject *) _PyMalloc_MALLOC(_PyObject_SIZE(tp)); - if (op == NULL) - return PyErr_NoMemory(); - return PyObject_INIT(op, tp); - } - - PyVarObject * - _PyMalloc_NewVar(PyTypeObject *tp, int nitems) - { - PyVarObject *op; - const size_t size = _PyObject_VAR_SIZE(tp, nitems); - op = (PyVarObject *) _PyMalloc_MALLOC(size); - if (op == NULL) - return (PyVarObject *)PyErr_NoMemory(); - return PyObject_INIT_VAR(op, tp, nitems); - } - - void - _PyMalloc_Del(PyObject *op) - { - _PyMalloc_FREE(op); - } - #ifdef PYMALLOC_DEBUG /*==========================================================================*/ --- 871,874 ---- *************** *** 956,960 **** The requested memory, filled with copies of PYMALLOC_CLEANBYTE. Used to catch reference to uninitialized memory. ! &p[8] is returned. Note that this is 8-byte aligned if PyMalloc handled the request itself. p[8+n:8+n+4] --- 928,932 ---- The requested memory, filled with copies of PYMALLOC_CLEANBYTE. Used to catch reference to uninitialized memory. ! &p[8] is returned. Note that this is 8-byte aligned if pymalloc handled the request itself. p[8+n:8+n+4] *************** *** 962,967 **** and reads. p[8+n+4:8+n+8] ! A serial number, incremented by 1 on each call to _PyMalloc_DebugMalloc ! and _PyMalloc_DebugRealloc. 4-byte unsigned integer, big-endian. If "bad memory" is detected later, the serial number gives an --- 934,939 ---- and reads. p[8+n+4:8+n+8] ! A serial number, incremented by 1 on each call to _PyObject_DebugMalloc ! and _PyObject_DebugRealloc. 4-byte unsigned integer, big-endian. If "bad memory" is detected later, the serial number gives an *************** *** 971,975 **** void * ! _PyMalloc_DebugMalloc(size_t nbytes) { uchar *p; /* base address of malloc'ed block */ --- 943,947 ---- void * ! _PyObject_DebugMalloc(size_t nbytes) { uchar *p; /* base address of malloc'ed block */ *************** *** 988,992 **** } ! p = _PyMalloc_Malloc(total); if (p == NULL) return NULL; --- 960,964 ---- } ! p = PyObject_Malloc(total); if (p == NULL) return NULL; *************** *** 1011,1015 **** */ void ! _PyMalloc_DebugFree(void *p) { uchar *q = (uchar *)p; --- 983,987 ---- */ void ! _PyObject_DebugFree(void *p) { uchar *q = (uchar *)p; *************** *** 1018,1030 **** if (p == NULL) return; ! _PyMalloc_DebugCheckAddress(p); nbytes = read4(q-8); if (nbytes > 0) memset(q, PYMALLOC_DEADBYTE, nbytes); ! _PyMalloc_Free(q-8); } void * ! _PyMalloc_DebugRealloc(void *p, size_t nbytes) { uchar *q = (uchar *)p; --- 990,1002 ---- if (p == NULL) return; ! _PyObject_DebugCheckAddress(p); nbytes = read4(q-8); if (nbytes > 0) memset(q, PYMALLOC_DEADBYTE, nbytes); ! PyObject_Free(q-8); } void * ! _PyObject_DebugRealloc(void *p, size_t nbytes) { uchar *q = (uchar *)p; *************** *** 1033,1039 **** if (p == NULL) ! return _PyMalloc_DebugMalloc(nbytes); ! _PyMalloc_DebugCheckAddress(p); original_nbytes = read4(q-8); if (nbytes == original_nbytes) { --- 1005,1011 ---- if (p == NULL) ! return _PyObject_DebugMalloc(nbytes); ! _PyObject_DebugCheckAddress(p); original_nbytes = read4(q-8); if (nbytes == original_nbytes) { *************** *** 1062,1070 **** /* More memory is needed: get it, copy over the first original_nbytes of the original data, and free the original memory. */ ! fresh = _PyMalloc_DebugMalloc(nbytes); if (fresh != NULL) { if (original_nbytes > 0) memcpy(fresh, p, original_nbytes); ! _PyMalloc_DebugFree(p); } return fresh; --- 1034,1042 ---- /* More memory is needed: get it, copy over the first original_nbytes of the original data, and free the original memory. */ ! fresh = _PyObject_DebugMalloc(nbytes); if (fresh != NULL) { if (original_nbytes > 0) memcpy(fresh, p, original_nbytes); ! _PyObject_DebugFree(p); } return fresh; *************** *** 1072,1080 **** /* Check the forbidden bytes on both ends of the memory allocated for p. ! * If anything is wrong, print info to stderr via _PyMalloc_DebugDumpAddress, * and call Py_FatalError to kill the program. */ void ! _PyMalloc_DebugCheckAddress(const void *p) { const uchar *q = (const uchar *)p; --- 1044,1052 ---- /* Check the forbidden bytes on both ends of the memory allocated for p. ! * If anything is wrong, print info to stderr via _PyObject_DebugDumpAddress, * and call Py_FatalError to kill the program. */ void ! _PyObject_DebugCheckAddress(const void *p) { const uchar *q = (const uchar *)p; *************** *** 1108,1112 **** error: ! _PyMalloc_DebugDumpAddress(p); Py_FatalError(msg); } --- 1080,1084 ---- error: ! _PyObject_DebugDumpAddress(p); Py_FatalError(msg); } *************** *** 1114,1118 **** /* Display info to stderr about the memory block at p. */ void ! _PyMalloc_DebugDumpAddress(const void *p) { const uchar *q = (const uchar *)p; --- 1086,1090 ---- /* Display info to stderr about the memory block at p. */ void ! _PyObject_DebugDumpAddress(const void *p) { const uchar *q = (const uchar *)p; *************** *** 1237,1241 **** /* Print summary info to stderr about the state of pymalloc's structures. */ void ! _PyMalloc_DebugDumpStats(void) { uint i; --- 1209,1213 ---- /* Print summary info to stderr about the state of pymalloc's structures. */ void ! _PyObject_DebugDumpStats(void) { uint i; From tim_one@sourceforge.net Fri Apr 12 06:21:36 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 11 Apr 2002 22:21:36 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv8414/python/Include Modified Files: objimpl.h Log Message: First cut at repairing out-of-date comments; make alignment of macro defs all the same within the #ifdef WITH_PYMALLOC block. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** objimpl.h 12 Apr 2002 02:38:45 -0000 2.49 --- objimpl.h 12 Apr 2002 05:21:34 -0000 2.50 *************** *** 18,23 **** type object. Reference count and type pointer are filled in; the rest of the bytes of the object are *undefined*! The resulting ! expression type is 'type *'. The size of the object is actually ! determined by the tp_basicsize field of the type object. - PyObject_NewVar(type, typeobj, n) is similar but allocates a --- 18,23 ---- type object. Reference count and type pointer are filled in; the rest of the bytes of the object are *undefined*! The resulting ! expression type is 'type *'. The size of the object is determined ! by the tp_basicsize field of the type object. - PyObject_NewVar(type, typeobj, n) is similar but allocates a *************** *** 26,30 **** as well. ! - PyObject_Del(op) releases the memory allocated for an object. - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) are --- 26,32 ---- as well. ! - PyObject_Del(op) releases the memory allocated for an object. It ! does not run a destructor -- it only frees the memory. PyObject_Free ! is identical. - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) are *************** *** 35,39 **** Note that objects created with PyObject_{New, NewVar} are allocated ! using the specialized Python allocator (implemented in obmalloc.c). In case a specific form of memory management is needed, implying that --- 37,43 ---- Note that objects created with PyObject_{New, NewVar} are allocated ! using the specialized Python allocator (implemented in obmalloc.c), if ! WITH_PYMALLOC is enabled. In addition, a special debugging allocator ! is used if PYMALLOC_DEBUG is also #defined. In case a specific form of memory management is needed, implying that *************** *** 71,79 **** /* Functions */ ! /* Wrappers that useful if you need to be sure that you are using the ! same object memory allocator as Python. These wrappers *do not* make ! sure that allocating 0 bytes returns a non-NULL pointer. Returned ! pointers must be checked for NULL explicitly; no action is performed ! on failure. */ extern DL_IMPORT(void *) PyObject_Malloc(size_t); extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t); --- 75,88 ---- /* Functions */ ! /* Functions to call the same malloc/realloc/free as used by Python's ! object allocator. If WITH_PYMALLOC is enabled, these may differ from ! the platform malloc/realloc/free. The Python object allocator is ! designed for fast, cache-conscious allocation of many "small" objects, ! with low hidden memory overhead. PyObject_Malloc(0) returns a unique ! non-NULL pointer if possible. PyObject_Realloc(NULL, n) acts like ! PyObject_Malloc(n). PyObject_Realloc(p != NULL, 0) does not return ! NULL or free the memory at p. Returned pointers must be checked for ! NULL explicitly; no action is performed on failure other than to return ! NULL. */ extern DL_IMPORT(void *) PyObject_Malloc(size_t); extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t); *************** *** 90,99 **** DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); DL_IMPORT(void) _PyObject_DebugDumpStats(void); ! #define PyObject_MALLOC _PyObject_DebugMalloc ! #define PyObject_Malloc _PyObject_DebugMalloc ! #define PyObject_REALLOC _PyObject_DebugRealloc ! #define PyObject_Realloc _PyObject_DebugRealloc ! #define PyObject_FREE _PyObject_DebugFree ! #define PyObject_Free _PyObject_DebugFree #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ --- 99,108 ---- DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); DL_IMPORT(void) _PyObject_DebugDumpStats(void); ! #define PyObject_MALLOC _PyObject_DebugMalloc ! #define PyObject_Malloc _PyObject_DebugMalloc ! #define PyObject_REALLOC _PyObject_DebugRealloc ! #define PyObject_Realloc _PyObject_DebugRealloc ! #define PyObject_FREE _PyObject_DebugFree ! #define PyObject_Free _PyObject_DebugFree #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ From tim_one@sourceforge.net Fri Apr 12 08:22:58 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 00:22:58 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.171,2.172 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31971/python/Objects Modified Files: object.c Log Message: First stab at rationalizing the PyMem_ API. Mixing PyObject_xyz with PyMem_{Del, DEL} doesn't work yet (compilation problems). pyport.h: _PyMem_EXTRA is gone. pmem.h: Repaired comments. PyMem_{Malloc, MALLOC} and PyMem_{Realloc, REALLOC} now make the same x-platform guarantees when asking for 0 bytes, and when passing a NULL pointer to the latter. object.c: PyMem_{Malloc, Realloc} just call their macro versions now, since the latter take care of the x-platform 0 and NULL stuff by themselves now. pypcre.c, grow_stack(): So sue me. On two lines, this called PyMem_RESIZE to grow a "const" area. It's not legit to realloc a const area, so the compiler warned given the new expansion of PyMem_RESIZE. It would have gotten the same warning before if it had used PyMem_Resize() instead; the older macro version, but not the function version, silently cast away the constness. IMO that was a wrong thing to do, and the docs say the macro versions of PyMem_xyz are deprecated anyway. If somebody else is resizing const areas with the macro spelling, they'll get a warning when they recompile now too. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.171 retrieving revision 2.172 diff -C2 -d -r2.171 -r2.172 *** object.c 12 Apr 2002 03:08:42 -0000 2.171 --- object.c 12 Apr 2002 07:22:56 -0000 2.172 *************** *** 1898,1905 **** PyMem_Malloc(size_t nbytes) { - #if _PyMem_EXTRA > 0 - if (nbytes == 0) - nbytes = _PyMem_EXTRA; - #endif return PyMem_MALLOC(nbytes); } --- 1898,1901 ---- *************** *** 1908,1913 **** PyMem_Realloc(void *p, size_t nbytes) { ! /* See comment near MALLOC_ZERO_RETURNS_NULL in pyport.h. */ ! return PyMem_REALLOC(p, nbytes ? nbytes : 1); } --- 1904,1908 ---- PyMem_Realloc(void *p, size_t nbytes) { ! return PyMem_REALLOC(p, nbytes); } From tim_one@sourceforge.net Fri Apr 12 08:22:58 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 00:22:58 -0700 Subject: [Python-checkins] python/dist/src/Modules pypcre.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31971/python/Modules Modified Files: pypcre.c Log Message: First stab at rationalizing the PyMem_ API. Mixing PyObject_xyz with PyMem_{Del, DEL} doesn't work yet (compilation problems). pyport.h: _PyMem_EXTRA is gone. pmem.h: Repaired comments. PyMem_{Malloc, MALLOC} and PyMem_{Realloc, REALLOC} now make the same x-platform guarantees when asking for 0 bytes, and when passing a NULL pointer to the latter. object.c: PyMem_{Malloc, Realloc} just call their macro versions now, since the latter take care of the x-platform 0 and NULL stuff by themselves now. pypcre.c, grow_stack(): So sue me. On two lines, this called PyMem_RESIZE to grow a "const" area. It's not legit to realloc a const area, so the compiler warned given the new expansion of PyMem_RESIZE. It would have gotten the same warning before if it had used PyMem_Resize() instead; the older macro version, but not the function version, silently cast away the constness. IMO that was a wrong thing to do, and the docs say the macro versions of PyMem_xyz are deprecated anyway. If somebody else is resizing const areas with the macro spelling, they'll get a warning when they recompile now too. Index: pypcre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pypcre.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** pypcre.c 15 Mar 2002 09:16:40 -0000 2.23 --- pypcre.c 12 Apr 2002 07:22:56 -0000 2.24 *************** *** 3079,3084 **** } PyMem_RESIZE(md->offset_top, int, md->length); ! PyMem_RESIZE(md->eptr, const uschar *, md->length); ! PyMem_RESIZE(md->ecode, const uschar *, md->length); PyMem_RESIZE(md->off_num, int, md->length); PyMem_RESIZE(md->r1, int, md->length); --- 3079,3087 ---- } PyMem_RESIZE(md->offset_top, int, md->length); ! /* Can't realloc a pointer-to-const; cast const away. */ ! md->eptr = (const uschar **)PyMem_Realloc((void *)md->eptr, ! sizeof(uschar *) * md->length); ! md->ecode = (const uschar **)PyMem_Realloc((void *)md->ecode, ! sizeof(uschar *) * md->length); PyMem_RESIZE(md->off_num, int, md->length); PyMem_RESIZE(md->r1, int, md->length); From tim_one@sourceforge.net Fri Apr 12 08:22:58 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 00:22:58 -0700 Subject: [Python-checkins] python/dist/src/Include pymem.h,2.12,2.13 pyport.h,2.46,2.47 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv31971/python/Include Modified Files: pymem.h pyport.h Log Message: First stab at rationalizing the PyMem_ API. Mixing PyObject_xyz with PyMem_{Del, DEL} doesn't work yet (compilation problems). pyport.h: _PyMem_EXTRA is gone. pmem.h: Repaired comments. PyMem_{Malloc, MALLOC} and PyMem_{Realloc, REALLOC} now make the same x-platform guarantees when asking for 0 bytes, and when passing a NULL pointer to the latter. object.c: PyMem_{Malloc, Realloc} just call their macro versions now, since the latter take care of the x-platform 0 and NULL stuff by themselves now. pypcre.c, grow_stack(): So sue me. On two lines, this called PyMem_RESIZE to grow a "const" area. It's not legit to realloc a const area, so the compiler warned given the new expansion of PyMem_RESIZE. It would have gotten the same warning before if it had used PyMem_Resize() instead; the older macro version, but not the function version, silently cast away the constness. IMO that was a wrong thing to do, and the docs say the macro versions of PyMem_xyz are deprecated anyway. If somebody else is resizing const areas with the macro spelling, they'll get a warning when they recompile now too. Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -d -r2.12 -r2.13 *** pymem.h 12 Apr 2002 02:39:18 -0000 2.12 --- pymem.h 12 Apr 2002 07:22:56 -0000 2.13 *************** *** 19,29 **** malloc), no recompilation is required for the extensions. ! The macro versions trade compatibility for speed. They can be used ! whenever there is a performance problem, but their use implies ! recompilation of the code for each new Python release. The Python ! core uses the macros because it *is* compiled on every upgrade. ! This might not be the case with 3rd party extensions in a custom ! setup (for example, a customer does not always have access to the ! source of 3rd party deliverables). You have been warned! */ /* --- 19,29 ---- malloc), no recompilation is required for the extensions. ! The macro versions are free to trade compatibility for speed, although ! there's no guarantee they're ever faster. Extensions shouldn't use the ! macro versions, as they don't gurantee binary compatibility across ! releases. ! ! Do not mix calls to PyMem_xyz with calls to platform ! malloc/realloc/calloc/free. */ /* *************** *** 32,46 **** */ - /* To make sure the interpreter is user-malloc friendly, all memory - APIs are implemented on top of this one. */ - /* Functions */ ! /* Function wrappers around PyMem_MALLOC and friends; useful if you ! need to be sure that you are using the same memory allocator as ! Python. Note that the wrappers make sure that allocating 0 bytes ! returns a non-NULL pointer, even if the underlying malloc ! doesn't. Returned pointers must be checked for NULL explicitly. ! No action is performed on failure. */ extern DL_IMPORT(void *) PyMem_Malloc(size_t); extern DL_IMPORT(void *) PyMem_Realloc(void *, size_t); --- 32,48 ---- */ /* Functions */ ! /* Functions supplying platform-independent semantics for malloc/realloc/ ! free; useful if you need to be sure you're using the same memory ! allocator as Python (this can be especially important on Windows, if ! you need to make sure you're using the same MS malloc/free, and out of ! the same heap, as the main Python DLL uses). ! These functions make sure that allocating 0 bytes returns a distinct ! non-NULL pointer (whenever possible -- if we're flat out of memory, NULL ! may be returned), even if the platform malloc and realloc don't. ! Returned pointers must be checked for NULL explicitly. No action is ! performed on failure (no exception is set, no warning is printed, etc).` */ ! extern DL_IMPORT(void *) PyMem_Malloc(size_t); extern DL_IMPORT(void *) PyMem_Realloc(void *, size_t); *************** *** 50,63 **** no longer supported. They used to call PyErr_NoMemory() on failure. */ ! /* Macros (override these if you want to a different malloc */ #ifndef PyMem_MALLOC ! #define PyMem_MALLOC(n) malloc(n) ! #define PyMem_REALLOC(p, n) realloc((void *)(p), (n)) ! #define PyMem_FREE(p) free((void *)(p)) #endif /* * Type-oriented memory interface * ============================== */ --- 52,78 ---- no longer supported. They used to call PyErr_NoMemory() on failure. */ ! /* Macros. */ #ifndef PyMem_MALLOC ! #ifdef MALLOC_ZERO_RETURNS_NULL ! #define PyMem_MALLOC(n) malloc((n) ? (n) : 1) ! #else ! #define PyMem_MALLOC malloc #endif + /* Caution: whether MALLOC_ZERO_RETURNS_NULL is #defined has nothing to + do with whether platform realloc(non-NULL, 0) normally frees the memory + or returns NULL. Rather than introduce yet another config variation, + just make a realloc to 0 bytes act as if to 1 instead. */ + #define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1) + + #define PyMem_FREE free + #endif /* PyMem_MALLOC */ + /* * Type-oriented memory interface * ============================== + * + * These are carried along for historical reasons. There's rarely a good + * reason to use them anymore. */ *************** *** 67,93 **** #define PyMem_Resize(p, type, n) \ ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) ! #define PyMem_Del(p) PyMem_Free(p) /* Macros */ #define PyMem_NEW(type, n) \ ! ( (type *) PyMem_MALLOC(_PyMem_EXTRA + (n) * sizeof(type)) ) ! ! /* See comment near MALLOC_ZERO_RETURNS_NULL in pyport.h. */ ! #define PyMem_RESIZE(p, type, n) \ ! do { \ ! size_t _sum = (n) * sizeof(type); \ ! if (!_sum) \ ! _sum = 1; \ ! (p) = (type *)((p) ? \ ! PyMem_REALLOC(p, _sum) : \ ! PyMem_MALLOC(_sum)); \ ! } while (0) ! ! #define PyMem_DEL(p) PyMem_FREE(p) ! ! /* PyMem_XDEL is deprecated. To avoid the call when p is NULL, ! it is recommended to write the test explicitly in the code. ! Note that according to ANSI C, free(NULL) has no effect. */ #ifdef __cplusplus --- 82,108 ---- #define PyMem_Resize(p, type, n) \ ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) ! ! /* In order to avoid breaking old code mixing PyObject_{New, NEW} with ! PyMem_{Del, DEL} (there was no choice about this in 1.5.2), the latter ! have to be redirected to the object allocator. */ ! /* XXX The parser module needs rework before this can be enabled. */ ! #if 0 ! #define PyMem_Del PyObject_Free ! #else ! #define PyMem_Del PyMem_Free ! #endif /* Macros */ #define PyMem_NEW(type, n) \ ! ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ! #define PyMem_RESIZE(p, type, n) \ ! ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) + /* XXX The parser module needs rework before this can be enabled. */ + #if 0 + #define PyMem_DEL PyObject_FREE + #else + #define PyMem_DEL PyMem_FREE + #endif #ifdef __cplusplus Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -d -r2.46 -r2.47 *** pyport.h 11 Apr 2002 20:44:21 -0000 2.46 --- pyport.h 12 Apr 2002 07:22:56 -0000 2.47 *************** *** 385,413 **** #endif - - /************************************ - * MALLOC COMPATIBILITY FOR pymem.h * - ************************************/ - #ifndef DL_IMPORT /* declarations for DLL import */ #define DL_IMPORT(RTYPE) RTYPE #endif - - #ifdef MALLOC_ZERO_RETURNS_NULL - /* Allocate an extra byte if the platform malloc(0) returns NULL. - Caution: this bears no relation to whether realloc(p, 0) returns NULL - when p != NULL. Even on platforms where malloc(0) does not return NULL, - realloc(p, 0) may act like free(p) and return NULL. Examples include - Windows, and Python's own obmalloc.c (as of 2-Mar-2002). For whatever - reason, our docs promise that PyMem_Realloc(p, 0) won't act like - free(p) or return NULL, so realloc() calls may have to be hacked - too, but MALLOC_ZERO_RETURNS_NULL's state is irrelevant to realloc (it - needs a different hack). - */ - #define _PyMem_EXTRA 1 - #else - #define _PyMem_EXTRA 0 - #endif - /* If the fd manipulation macros aren't defined, --- 385,391 ---- From tim.one@comcast.net Fri Apr 12 08:26:06 2002 From: tim.one@comcast.net (Tim Peters) Date: Fri, 12 Apr 2002 03:26:06 -0400 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.48,2.49 In-Reply-To: Message-ID: [nascheme@sourceforge.net] > Modified Files: > objimpl.h > Log Message: > ... > To avoid breaking extension modules that allocate using > PyObject_{NEW,New} and deallocate with PyMem_{Del,DEL}, PyMem_DEL has > been changed to call pymalloc's free. Neil, I didn't see any code to that effect in this patch (or the others). I've since moved pymem.h closer to supporting that, but if you enable it the compiler gripes about something (probably shallow). From tim_one@sourceforge.net Fri Apr 12 08:38:56 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 00:38:56 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.35,2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8602/python/Objects Modified Files: obmalloc.c Log Message: PYMALLOC_{CLEAN, DEAD, FORBIDDEN}BYTE symbols: remove the PYMALLOC_ prefix. These symbols are private to the file, and the PYMALLOC_ gets in the way (overly long code lines, comments, and error messages). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** obmalloc.c 12 Apr 2002 03:10:20 -0000 2.35 --- obmalloc.c 12 Apr 2002 07:38:53 -0000 2.36 *************** *** 877,883 **** */ ! #define PYMALLOC_CLEANBYTE 0xCB /* uninitialized memory */ ! #define PYMALLOC_DEADBYTE 0xDB /* free()ed memory */ ! #define PYMALLOC_FORBIDDENBYTE 0xFB /* unusable memory */ static ulong serialno = 0; /* incremented on each debug {m,re}alloc */ --- 877,890 ---- */ ! /* Special bytes broadcast into debug memory blocks at appropriate times. ! * Strings of these are unlikely to be valid addresses, floats, ints or ! * 7-bit ASCII. ! */ ! #undef CLEANBYTE ! #undef DEADBYTE ! #undef FORBIDDENBYTE ! #define CLEANBYTE 0xCB /* clean (newly allocated) memory */ ! #define DEADBYTE 0xDB /* deed (newly freed) memory */ ! #define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ static ulong serialno = 0; /* incremented on each debug {m,re}alloc */ *************** *** 923,936 **** big-endian (easier to read in a memory dump). p[4:8] ! Copies of PYMALLOC_FORBIDDENBYTE. Used to catch under- writes ! and reads. p[8:8+n] ! The requested memory, filled with copies of PYMALLOC_CLEANBYTE. Used to catch reference to uninitialized memory. &p[8] is returned. Note that this is 8-byte aligned if pymalloc handled the request itself. p[8+n:8+n+4] ! Copies of PYMALLOC_FORBIDDENBYTE. Used to catch over- writes ! and reads. p[8+n+4:8+n+8] A serial number, incremented by 1 on each call to _PyObject_DebugMalloc --- 930,941 ---- big-endian (easier to read in a memory dump). p[4:8] ! Copies of FORBIDDENBYTE. Used to catch under- writes and reads. p[8:8+n] ! The requested memory, filled with copies of CLEANBYTE. Used to catch reference to uninitialized memory. &p[8] is returned. Note that this is 8-byte aligned if pymalloc handled the request itself. p[8+n:8+n+4] ! Copies of FORBIDDENBYTE. Used to catch over- writes and reads. p[8+n+4:8+n+8] A serial number, incremented by 1 on each call to _PyObject_DebugMalloc *************** *** 965,975 **** write4(p, nbytes); ! p[4] = p[5] = p[6] = p[7] = PYMALLOC_FORBIDDENBYTE; if (nbytes > 0) ! memset(p+8, PYMALLOC_CLEANBYTE, nbytes); tail = p + 8 + nbytes; ! tail[0] = tail[1] = tail[2] = tail[3] = PYMALLOC_FORBIDDENBYTE; write4(tail + 4, serialno); --- 970,980 ---- write4(p, nbytes); ! p[4] = p[5] = p[6] = p[7] = FORBIDDENBYTE; if (nbytes > 0) ! memset(p+8, CLEANBYTE, nbytes); tail = p + 8 + nbytes; ! tail[0] = tail[1] = tail[2] = tail[3] = FORBIDDENBYTE; write4(tail + 4, serialno); *************** *** 978,983 **** /* The debug free first checks the 8 bytes on each end for sanity (in ! particular, that the PYMALLOC_FORBIDDENBYTEs are still intact). ! Then fills the original bytes with PYMALLOC_DEADBYTE. Then calls the underlying free. */ --- 983,988 ---- /* The debug free first checks the 8 bytes on each end for sanity (in ! particular, that the FORBIDDENBYTEs are still intact). ! Then fills the original bytes with DEADBYTE. Then calls the underlying free. */ *************** *** 993,997 **** nbytes = read4(q-8); if (nbytes > 0) ! memset(q, PYMALLOC_DEADBYTE, nbytes); PyObject_Free(q-8); } --- 998,1002 ---- nbytes = read4(q-8); if (nbytes > 0) ! memset(q, DEADBYTE, nbytes); PyObject_Free(q-8); } *************** *** 1025,1031 **** /* kill the excess bytes plus the trailing 8 pad bytes */ q += nbytes; ! q[0] = q[1] = q[2] = q[3] = PYMALLOC_FORBIDDENBYTE; write4(q+4, serialno); ! memset(q+8, PYMALLOC_DEADBYTE, excess); return p; } --- 1030,1036 ---- /* kill the excess bytes plus the trailing 8 pad bytes */ q += nbytes; ! q[0] = q[1] = q[2] = q[3] = FORBIDDENBYTE; write4(q+4, serialno); ! memset(q+8, DEADBYTE, excess); return p; } *************** *** 1060,1064 **** for (i = 4; i >= 1; --i) { ! if (*(q-i) != PYMALLOC_FORBIDDENBYTE) { msg = "bad leading pad byte"; goto error; --- 1065,1069 ---- for (i = 4; i >= 1; --i) { ! if (*(q-i) != FORBIDDENBYTE) { msg = "bad leading pad byte"; goto error; *************** *** 1070,1074 **** const uchar *tail = q + nbytes; for (i = 0; i < 4; ++i) { ! if (tail[i] != PYMALLOC_FORBIDDENBYTE) { msg = "bad trailing pad byte"; goto error; --- 1075,1079 ---- const uchar *tail = q + nbytes; for (i = 0; i < 4; ++i) { ! if (tail[i] != FORBIDDENBYTE) { msg = "bad trailing pad byte"; goto error; *************** *** 1104,1120 **** fputs(" the 4 pad bytes at p-4 are ", stderr); ! if (*(q-4) == PYMALLOC_FORBIDDENBYTE && ! *(q-3) == PYMALLOC_FORBIDDENBYTE && ! *(q-2) == PYMALLOC_FORBIDDENBYTE && ! *(q-1) == PYMALLOC_FORBIDDENBYTE) { ! fputs("PYMALLOC_FORBIDDENBYTE, as expected\n", stderr); } else { ! fprintf(stderr, "not all PYMALLOC_FORBIDDENBYTE (0x%02x):\n", ! PYMALLOC_FORBIDDENBYTE); for (i = 4; i >= 1; --i) { const uchar byte = *(q-i); fprintf(stderr, " at p-%d: 0x%02x", i, byte); ! if (byte != PYMALLOC_FORBIDDENBYTE) fputs(" *** OUCH", stderr); fputc('\n', stderr); --- 1109,1125 ---- fputs(" the 4 pad bytes at p-4 are ", stderr); ! if (*(q-4) == FORBIDDENBYTE && ! *(q-3) == FORBIDDENBYTE && ! *(q-2) == FORBIDDENBYTE && ! *(q-1) == FORBIDDENBYTE) { ! fputs("FORBIDDENBYTE, as expected\n", stderr); } else { ! fprintf(stderr, "not all FORBIDDENBYTE (0x%02x):\n", ! FORBIDDENBYTE); for (i = 4; i >= 1; --i) { const uchar byte = *(q-i); fprintf(stderr, " at p-%d: 0x%02x", i, byte); ! if (byte != FORBIDDENBYTE) fputs(" *** OUCH", stderr); fputc('\n', stderr); *************** *** 1124,1141 **** tail = q + nbytes; fprintf(stderr, " the 4 pad bytes at tail=%p are ", tail); ! if (tail[0] == PYMALLOC_FORBIDDENBYTE && ! tail[1] == PYMALLOC_FORBIDDENBYTE && ! tail[2] == PYMALLOC_FORBIDDENBYTE && ! tail[3] == PYMALLOC_FORBIDDENBYTE) { ! fputs("PYMALLOC_FORBIDDENBYTE, as expected\n", stderr); } else { ! fprintf(stderr, "not all PYMALLOC_FORBIDDENBYTE (0x%02x):\n", ! PYMALLOC_FORBIDDENBYTE); for (i = 0; i < 4; ++i) { const uchar byte = tail[i]; fprintf(stderr, " at tail+%d: 0x%02x", i, byte); ! if (byte != PYMALLOC_FORBIDDENBYTE) fputs(" *** OUCH", stderr); fputc('\n', stderr); --- 1129,1146 ---- tail = q + nbytes; fprintf(stderr, " the 4 pad bytes at tail=%p are ", tail); ! if (tail[0] == FORBIDDENBYTE && ! tail[1] == FORBIDDENBYTE && ! tail[2] == FORBIDDENBYTE && ! tail[3] == FORBIDDENBYTE) { ! fputs("FORBIDDENBYTE, as expected\n", stderr); } else { ! fprintf(stderr, "not all FORBIDDENBYTE (0x%02x):\n", ! FORBIDDENBYTE); for (i = 0; i < 4; ++i) { const uchar byte = tail[i]; fprintf(stderr, " at tail+%d: 0x%02x", i, byte); ! if (byte != FORBIDDENBYTE) fputs(" *** OUCH", stderr); fputc('\n', stderr); From tim_one@sourceforge.net Fri Apr 12 08:43:10 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 00:43:10 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.36,2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9682/python/Objects Modified Files: obmalloc.c Log Message: _PyObject_DebugDumpAddress(): clarify an output message. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** obmalloc.c 12 Apr 2002 07:38:53 -0000 2.36 --- obmalloc.c 12 Apr 2002 07:43:07 -0000 2.37 *************** *** 1103,1107 **** nbytes = read4(q-8); ! fprintf(stderr, " %lu bytes originally allocated\n", nbytes); /* In case this is nuts, check the pad bytes before trying to read up --- 1103,1107 ---- nbytes = read4(q-8); ! fprintf(stderr, " %lu bytes originally requested\n", nbytes); /* In case this is nuts, check the pad bytes before trying to read up From tim_one@sourceforge.net Fri Apr 12 09:52:54 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 01:52:54 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28856/python/Objects Modified Files: obmalloc.c Log Message: _PyObject_DebugRealloc(): rewritten to let the underlying realloc do most of the work. In particular, if the underlying realloc is able to grow the memory block in place, great (this routine used to do a fresh malloc + memcpy every time a block grew). BTW, I'm not so keen here on avoiding possible quadratic-time realloc patterns as I am on making the debug pymalloc more invisible (the more it uses memory "just like" the underlying allocator, the better the chance that a suspected memory corruption bug won't vanish when the debug malloc is turned on). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** obmalloc.c 12 Apr 2002 07:43:07 -0000 2.37 --- obmalloc.c 12 Apr 2002 08:52:50 -0000 2.38 *************** *** 1006,1011 **** { uchar *q = (uchar *)p; size_t original_nbytes; - void *fresh; /* new memory block, if needed */ if (p == NULL) --- 1006,1012 ---- { uchar *q = (uchar *)p; + uchar *tail; + size_t total; /* nbytes + 16 */ size_t original_nbytes; if (p == NULL) *************** *** 1013,1049 **** _PyObject_DebugCheckAddress(p); original_nbytes = read4(q-8); ! if (nbytes == original_nbytes) { ! /* note that this case is likely to be common due to the ! way Python appends to lists */ ! bumpserialno(); ! write4(q + nbytes + 4, serialno); ! return p; } if (nbytes < original_nbytes) { ! /* shrinking -- leave the guts alone, except to ! fill the excess with DEADBYTE */ ! const size_t excess = original_nbytes - nbytes; ! bumpserialno(); ! write4(q-8, nbytes); ! /* kill the excess bytes plus the trailing 8 pad bytes */ ! q += nbytes; ! q[0] = q[1] = q[2] = q[3] = FORBIDDENBYTE; ! write4(q+4, serialno); ! memset(q+8, DEADBYTE, excess); ! return p; } ! assert(nbytes != 0); ! /* More memory is needed: get it, copy over the first original_nbytes ! of the original data, and free the original memory. */ ! fresh = _PyObject_DebugMalloc(nbytes); ! if (fresh != NULL) { ! if (original_nbytes > 0) ! memcpy(fresh, p, original_nbytes); ! _PyObject_DebugFree(p); } ! return fresh; } --- 1014,1052 ---- _PyObject_DebugCheckAddress(p); + bumpserialno(); original_nbytes = read4(q-8); ! total = nbytes + 16; ! if (total < nbytes || (total >> 31) > 1) { ! /* overflow, or we can't represent it in 4 bytes */ ! return NULL; } if (nbytes < original_nbytes) { ! /* shrinking: mark old extra memory dead */ ! memset(q + nbytes, DEADBYTE, original_nbytes - nbytes); } ! /* Resize and add decorations. */ ! q = (uchar *)PyObject_Realloc(q-8, total); ! if (q == NULL) ! return NULL; ! ! write4(q, nbytes); ! assert(q[4] == FORBIDDENBYTE && ! q[5] == FORBIDDENBYTE && ! q[6] == FORBIDDENBYTE && ! q[7] == FORBIDDENBYTE); ! q += 8; ! tail = q + nbytes; ! tail[0] = tail[1] = tail[2] = tail[3] = FORBIDDENBYTE; ! write4(tail + 4, serialno); ! ! if (nbytes > original_nbytes) { ! /* growing: mark new extra memory clean */ ! memset(q + original_nbytes, CLEANBYTE, ! nbytes - original_nbytes); } ! ! return q; } From loewis@sourceforge.net Fri Apr 12 10:54:11 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 12 Apr 2002 02:54:11 -0700 Subject: [Python-checkins] python/dist/src acconfig.h,1.60,1.61 configure,1.294,1.295 configure.in,1.304,1.305 pyconfig.h.in,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17974 Modified Files: acconfig.h configure configure.in pyconfig.h.in Log Message: Update to autoconf 2.5x. Index: acconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/acconfig.h,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** acconfig.h 6 Apr 2002 10:10:47 -0000 1.60 --- acconfig.h 12 Apr 2002 09:54:01 -0000 1.61 *************** *** 2,29 **** - /* Define if you have the Mach cthreads package */ - #undef C_THREADS - - /* Define if --enable-ipv6 is specified */ - #undef ENABLE_IPV6 - /* Define this if you have gethostbyname() */ #undef HAVE_GETHOSTBYNAME - /* Define this if you have some version of gethostbyname_r() */ - #undef HAVE_GETHOSTBYNAME_R - /* Define if you have termios available */ #undef HAVE_TERMIOS_H - /* Define as the integral type used for Unicode representation. */ - #undef PY_UNICODE_TYPE - /* Define as the size of the unicode type. */ #undef Py_UNICODE_SIZE - /* Define to force use of thread-safe errno, h_errno, and other functions */ - #undef _REENTRANT - /* sizeof(void *) */ #undef SIZEOF_VOID_P --- 2,14 ---- *************** *** 41,65 **** #undef WITH_LIBNDBM - /* Define if you want to compile in rudimentary thread support */ - #undef WITH_THREAD - /* Leave that blank line there-- autoheader needs it! */ @BOTTOM@ - - #ifdef __CYGWIN__ - #ifdef USE_DL_IMPORT - #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE - #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE - #else - #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE - #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE - #endif - #endif - - /* Define the macros needed if on a UnixWare 7.x system. */ - #if defined(__USLC__) && defined(__SCO_VERSION__) - #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ - #endif --- 26,32 ---- Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.294 retrieving revision 1.295 diff -C2 -d -r1.294 -r1.295 *** configure 6 Apr 2002 10:10:48 -0000 1.294 --- configure 12 Apr 2002 09:54:01 -0000 1.295 *************** *** 1,74 **** #! /bin/sh ! ! # From configure.in Revision: 1.303 ! # Guess values for system-dependent variables and create Makefiles. ! # Generated automatically using autoconf version 2.13 ! # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. [...23335 lines suppressed...] ! ! # configure is writing to config.log, and then calls config.status. ! # config.status does its own redirection, appending to config.log. ! # Unfortunately, on DOS this fails, as config.log is still kept open ! # by configure, so config.status won't be able to write to it; its ! # output is simply discarded. So we exec the FD to /dev/null, ! # effectively closing config.log, so it can be properly (re)opened and ! # appended to by config.status. When coming back to configure, we ! # need to make the FD available again. ! if test "$no_create" != yes; then ! ac_cs_success=: ! exec 5>/dev/null ! $SHELL $CONFIG_STATUS || ac_cs_success=false ! exec 5>>config.log ! # Use ||, not &&, to avoid exiting from the if with $? = 1, which ! # would make configure fail if this is the last instruction. ! $ac_cs_success || { (exit 1); exit 1; } ! fi Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.304 retrieving revision 1.305 diff -C2 -d -r1.304 -r1.305 *** configure.in 6 Apr 2002 10:10:49 -0000 1.304 --- configure.in 12 Apr 2002 09:54:03 -0000 1.305 *************** *** 1,8 **** dnl Process this file with autoconf 2.0 or later to make a configure script. AC_REVISION($Revision$) ! AC_PREREQ(2.0) AC_INIT(Include/object.h) AC_CONFIG_HEADER(pyconfig.h) # Set VERSION so we only need to edit in one place (i.e., here) AC_SUBST(VERSION) --- 1,27 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. AC_REVISION($Revision$) ! AC_PREREQ(2.50) AC_INIT(Include/object.h) AC_CONFIG_HEADER(pyconfig.h) + # This is for stuff that absolutely must end up in pyconfig.h. + # Please use pyport.h instead, if possible. + AH_BOTTOM([ + #ifdef __CYGWIN__ + #ifdef USE_DL_IMPORT + #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE + #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE + #else + #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE + #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE + #endif + #endif + + /* Define the macros needed if on a UnixWare 7.x system. */ + #if defined(__USLC__) && defined(__SCO_VERSION__) + #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ + #endif + ]) + # Set VERSION so we only need to edit in one place (i.e., here) AC_SUBST(VERSION) *************** *** 1066,1069 **** --- 1085,1096 ---- AC_MSG_RESULT(no)) + # Templates for things AC_DEFINEd more than once. + # For a single AC_DEFINE, no template is needed. + AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package]) + AH_TEMPLATE(_REENTRANT, + [Define to force use of thread-safe errno, h_errno, and other functions]) + AH_TEMPLATE(WITH_THREAD, + [Define if you want to compile in rudimentary thread support]) + AC_MSG_CHECKING(for --with-threads) AC_ARG_WITH(threads, *************** *** 1238,1241 **** --- 1265,1269 ---- # Check for enable-ipv6 + AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) AC_MSG_CHECKING([if --enable-ipv6 is specified]) AC_ARG_ENABLE(ipv6, *************** *** 1870,1873 **** --- 1898,1904 ---- # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( + AH_TEMPLATE(HAVE_GETHOSTBYNAME_R, + [Define this if you have some version of gethostbyname_r()]) + AC_CHECK_FUNC(gethostbyname_r, [ AC_DEFINE(HAVE_GETHOSTBYNAME_R) *************** *** 2063,2066 **** --- 2094,2099 ---- esac + AH_TEMPLATE(PY_UNICODE_TYPE, + [Define as the integral type used for Unicode representation.]) AC_SUBST(UNICODE_OBJS) if test "$enable_unicode" = "no" Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pyconfig.h.in 6 Apr 2002 10:10:49 -0000 1.26 --- pyconfig.h.in 12 Apr 2002 09:54:03 -0000 1.27 *************** *** 1,78 **** ! /* pyconfig.h.in. Generated automatically from configure.in by autoheader. */ ! ! /* Define if on AIX 3. ! System headers sometimes define this. ! We just want to avoid a redefinition error message. */ ! #ifndef _ALL_SOURCE ! #undef _ALL_SOURCE ! #endif ! ! /* Define if type char is unsigned and you are not using gcc. */ [...1584 lines suppressed...] ! /* Define to `unsigned' if does not define. */ ! #undef size_t ! /* Define to `int' if does not define. */ ! #undef socklen_t ! /* Define to `int' if doesn't define. */ ! #undef uid_t ! /* Define to empty if the keyword does not work. */ ! #undef volatile *************** *** 780,782 **** --- 855,858 ---- #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif + From loewis@sourceforge.net Fri Apr 12 10:55:30 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 12 Apr 2002 02:55:30 -0700 Subject: [Python-checkins] python/dist/src acconfig.h,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18514 Modified Files: acconfig.h Log Message: Remove unused macros. Index: acconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/acconfig.h,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** acconfig.h 12 Apr 2002 09:54:01 -0000 1.61 --- acconfig.h 12 Apr 2002 09:55:28 -0000 1.62 *************** *** 2,28 **** - /* Define this if you have gethostbyname() */ - #undef HAVE_GETHOSTBYNAME - - /* Define if you have termios available */ - #undef HAVE_TERMIOS_H - - /* Define as the size of the unicode type. */ - #undef Py_UNICODE_SIZE - - /* sizeof(void *) */ - #undef SIZEOF_VOID_P - - /* Define to `int' if doesn't define. */ - #undef socklen_t - - /* Define for SOLARIS 2.x */ - #undef SOLARIS - - /* Define if you want to use BSD db. */ - #undef WITH_LIBDB - - /* Define if you want to use ndbm. */ - #undef WITH_LIBNDBM --- 2,5 ---- From loewis@sourceforge.net Fri Apr 12 10:58:47 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 12 Apr 2002 02:58:47 -0700 Subject: [Python-checkins] python/dist/src configure,1.295,1.296 configure.in,1.305,1.306 pyconfig.h.in,1.27,1.28 acconfig.h,1.62,NONE Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19296 Modified Files: configure configure.in pyconfig.h.in Removed Files: acconfig.h Log Message: Remove acconfig.h. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.295 retrieving revision 1.296 diff -C2 -d -r1.295 -r1.296 *** configure 12 Apr 2002 09:54:01 -0000 1.295 --- configure 12 Apr 2002 09:58:43 -0000 1.296 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.304 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.305 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 14948,14951 **** --- 14948,14953 ---- fi + + case "$enable_unicode" in ucs2) unicode_size="2" *************** *** 14962,14965 **** --- 14964,14968 ---- ;; esac + Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.305 retrieving revision 1.306 diff -C2 -d -r1.305 -r1.306 *** configure.in 12 Apr 2002 09:54:03 -0000 1.305 --- configure.in 12 Apr 2002 09:58:45 -0000 1.306 *************** *** 2085,2088 **** --- 2085,2090 ---- fi + AH_TEMPLATE(Py_UNICODE_SIZE, + [Define as the size of the unicode type.]) case "$enable_unicode" in ucs2) unicode_size="2" *************** *** 2096,2099 **** --- 2098,2102 ---- AH_TEMPLATE(PY_UNICODE_TYPE, [Define as the integral type used for Unicode representation.]) + AC_SUBST(UNICODE_OBJS) if test "$enable_unicode" = "no" Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** pyconfig.h.in 12 Apr 2002 09:54:03 -0000 1.27 --- pyconfig.h.in 12 Apr 2002 09:58:45 -0000 1.28 *************** *** 1,33 **** /* pyconfig.h.in. Generated from configure.in by autoheader. */ - /* Leave this blank line here -- autoheader needs it! */ - - - /* Define this if you have gethostbyname() */ - #undef HAVE_GETHOSTBYNAME - - /* Define if you have termios available */ - #undef HAVE_TERMIOS_H - - /* Define as the size of the unicode type. */ - #undef Py_UNICODE_SIZE - - /* sizeof(void *) */ - #undef SIZEOF_VOID_P - - /* Define to `int' if doesn't define. */ - #undef socklen_t - - /* Define for SOLARIS 2.x */ - #undef SOLARIS - - /* Define if you want to use BSD db. */ - #undef WITH_LIBDB - - /* Define if you want to use ndbm. */ - #undef WITH_LIBNDBM - - - /* Leave that blank line there-- autoheader needs it! */ - /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want --- 1,3 ---- *************** *** 651,654 **** --- 621,627 ---- #undef Py_DEBUG + /* Define as the size of the unicode type. */ + #undef Py_UNICODE_SIZE + /* Define if you want to have a Unicode type. */ #undef Py_USING_UNICODE *************** *** 855,858 **** #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif - --- 828,830 ---- --- acconfig.h DELETED --- From loewis@informatik.hu-berlin.de Fri Apr 12 12:07:19 2002 From: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-1?q?L=F6wis?=) Date: 12 Apr 2002 13:07:19 +0200 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 In-Reply-To: <200204111545.g3BFj6v24771@odiug.zope.com> References: <200204111448.g3BEmQP25970@pcp742651pcs.reston01.va.comcast.net> <200204111545.g3BFj6v24771@odiug.zope.com> Message-ID: Guido van Rossum writes: > As long as it fails cleanly with older versions of autoconf, I'm all > for using autoconf 2.53 now. Done. At the moment, AC_PREREQ is 2.50, so 2.13 will fail. Even the changes between 2.52 and 2.53 in the generated configure are huge, so 2.53 should be the "official" version. This could be done in two ways: - allow people to continue to use, say, 2.52, and just ask that 2.53 is used when committing; or - bump AC_PREREQ to 2.53; 2.52 (and earlier) will then refuse to work. It's your choice. The other issue is caching: autoconf 2.50 will, by default, not generate a config.cache, since that has caused too many problems. Again, two options: - leave it as-is, and suggest that people who want caching use the -C option of configure (new in 2.5x), or - hack configure to create a cache file by default (I'm not sure how to do this) Regards, Martin From jackjansen@sourceforge.net Fri Apr 12 14:14:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Fri, 12 Apr 2002 06:14:56 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenType.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv9747 Modified Files: bgenType.py Log Message: Give type name when complaining about using input-only type for output or v.v. Index: bgenType.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenType.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bgenType.py 18 Mar 2002 15:24:22 -0000 1.8 --- bgenType.py 12 Apr 2002 13:14:54 -0000 1.9 *************** *** 116,120 **** def passOutput(self, name): ! raise RuntimeError, "this type can only be used for input parameters" class InputOnlyType(InputOnlyMixIn, Type): --- 116,120 ---- def passOutput(self, name): ! raise RuntimeError, "Type '%s' can only be used for input parameters" % self.typeName class InputOnlyType(InputOnlyMixIn, Type): *************** *** 127,131 **** def passInput(self, name): ! raise RuntimeError, "this type can only be used for output parameters" class OutputOnlyType(OutputOnlyMixIn, Type): --- 127,131 ---- def passInput(self, name): ! raise RuntimeError, "Type '%s' can only be used for output parameters" % self.typeName class OutputOnlyType(OutputOnlyMixIn, Type): From jackjansen@sourceforge.net Fri Apr 12 14:21:52 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Fri, 12 Apr 2002 06:21:52 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen scantools.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv11767 Modified Files: scantools.py Log Message: - Added support for inherent pointer types (typedefs of arrays) - Added a debug class variable to enable parser debugging. Index: scantools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** scantools.py 12 Dec 2001 20:51:22 -0000 1.25 --- scantools.py 12 Apr 2002 13:21:49 -0000 1.26 *************** *** 33,36 **** --- 33,39 ---- class Scanner: + # Set to 1 in subclass to debug your scanner patterns. + debug = 0 + def __init__(self, input = None, output = None, defsoutput = None): self.initsilent() *************** *** 120,123 **** --- 123,127 ---- def initrepairinstructions(self): self.repairinstructions = self.makerepairinstructions() + self.inherentpointertypes = self.makeinherentpointertypes() def makerepairinstructions(self): *************** *** 211,214 **** --- 215,221 ---- list.append((fpat, patterns, replacements)) return list + + def makeinherentpointertypes(self): + return [] def openrepairfile(self, filename = "REPAIR"): *************** *** 396,407 **** --- 403,424 ---- try: line = self.getline() except EOFError: break + if self.debug: + self.report("LINE: %s" % `line`) if self.comment1.match(line) >= 0: line = self.comment1.group('rest') + if self.debug: + self.report("\tafter comment1: %s" % `line`) while self.comment2.match(line) >= 0: line = self.comment2.group('rest1')+self.comment2.group('rest2') + if self.debug: + self.report("\tafter comment2: %s" % `line`) if self.defsfile and self.sym.match(line) >= 0: + if self.debug: + self.report("\tmatches sym.") self.dosymdef() continue if self.head.match(line) >= 0: + if self.debug: + self.report("\tmatches head.") self.dofuncspec() continue *************** *** 412,415 **** --- 429,434 ---- def dosymdef(self): name, defn = self.sym.group('name', 'defn') + if self.debug: + self.report("\tsym: name=%s, defn=%s" % (`name`, `defn`)) if not name in self.blacklistnames: self.defsfile.write("%s = %s\n" % (name, defn)) *************** *** 422,430 **** --- 441,457 ---- while self.tail.search(raw) < 0: line = self.getline() + if self.debug: + self.report("* CONTINUATION LINE: %s" % `line`) if self.comment1.match(line) >= 0: line = self.comment1.group('rest') + if self.debug: + self.report("\tafter comment1: %s" % `line`) while self.comment2.match(line) >= 0: line = self.comment2.group('rest1')+self.comment2.group('rest2') + if self.debug: + self.report("\tafter comment1: %s" % `line`) raw = raw + line + if self.debug: + self.report("* WHOLE LINE: %s" % `raw`) self.processrawspec(raw) *************** *** 432,435 **** --- 459,467 ---- if self.whole.search(raw) < 0: self.report("Bad raw spec: %s", `raw`) + if self.debug: + if self.type.search(raw) < 0: + self.report("(Type already doesn't match)") + else: + self.report("(Type matched: %s)" % `self.type.group('type')`) return type, name, args = self.whole.group('type', 'name', 'args') *************** *** 486,489 **** --- 518,523 ---- elif type[-4:] == "_ptr": type = type[:-4] + mode = "OutMode" + elif type in self.inherentpointertypes: mode = "OutMode" if type[-4:] == "_far": From nas@python.ca Fri Apr 12 14:35:15 2002 From: nas@python.ca (Neil Schemenauer) Date: Fri, 12 Apr 2002 06:35:15 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.48,2.49 In-Reply-To: ; from tim.one@comcast.net on Fri, Apr 12, 2002 at 03:26:06AM -0400 References: Message-ID: <20020412063514.A9835@glacier.arctrix.com> Tim Peters wrote: > Neil, I didn't see any code to that effect in this patch (or the others). Oops. That part is not finished yet. I've fixed the cvs comment for rev 2.49. Neil From gvanrossum@sourceforge.net Fri Apr 12 16:12:49 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 08:12:49 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.165,1.166 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15678 Modified Files: ACKS Log Message: Add Raymond Hettinger, CPA. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** ACKS 8 Apr 2002 21:28:20 -0000 1.165 --- ACKS 12 Apr 2002 15:12:47 -0000 1.166 *************** *** 193,196 **** --- 193,197 ---- Bernhard Herzog Magnus L. Hetland + Raymon Hettinger Kevan Heydon Jason Hildebrand From nnorwitz@sourceforge.net Fri Apr 12 16:18:24 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 12 Apr 2002 08:18:24 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.166,1.167 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17235/Misc Modified Files: ACKS Log Message: Spell Raymond Hettinger's name write Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** ACKS 12 Apr 2002 15:12:47 -0000 1.166 --- ACKS 12 Apr 2002 15:18:22 -0000 1.167 *************** *** 193,197 **** Bernhard Herzog Magnus L. Hetland ! Raymon Hettinger Kevan Heydon Jason Hildebrand --- 193,197 ---- Bernhard Herzog Magnus L. Hetland ! Raymond Hettinger Kevan Heydon Jason Hildebrand From gvanrossum@sourceforge.net Fri Apr 12 16:12:02 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 08:12:02 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.124,2.125 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15040/Objects Modified Files: dictobject.c Log Message: Add Raymond Hettinger's d.pop(). See SF patch 539949. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -d -r2.124 -r2.125 *** dictobject.c 12 Apr 2002 02:43:00 -0000 2.124 --- dictobject.c 12 Apr 2002 15:11:58 -0000 2.125 *************** *** 1496,1499 **** --- 1496,1532 ---- static PyObject * + dict_pop(dictobject *mp, PyObject *key) + { + long hash; + dictentry *ep; + PyObject *old_value, *old_key; + + if (mp->ma_used == 0) { + PyErr_SetString(PyExc_KeyError, + "pop(): dictionary is empty"); + return NULL; + } + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { + hash = PyObject_Hash(key); + if (hash == -1) + return NULL; + } + ep = (mp->ma_lookup)(mp, key, hash); + if (ep->me_value == NULL) { + PyErr_SetObject(PyExc_KeyError, key); + return NULL; + } + old_key = ep->me_key; + Py_INCREF(dummy); + ep->me_key = dummy; + old_value = ep->me_value; + ep->me_value = NULL; + mp->ma_used--; + Py_DECREF(old_key); + return old_value; + } + + static PyObject * dict_popitem(dictobject *mp) { *************** *** 1637,1640 **** --- 1670,1676 ---- "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k)"; + static char pop__doc__[] = + "D.pop(k) -> v, remove specified key and return the corresponding value"; + static char popitem__doc__[] = "D.popitem() -> (k, v), remove and return some (key, value) pair as a\n\ *************** *** 1675,1678 **** --- 1711,1716 ---- {"setdefault", (PyCFunction)dict_setdefault, METH_VARARGS, setdefault_doc__}, + {"pop", (PyCFunction)dict_pop, METH_O, + pop__doc__}, {"popitem", (PyCFunction)dict_popitem, METH_NOARGS, popitem__doc__}, From gvanrossum@sourceforge.net Fri Apr 12 16:12:02 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 08:12:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15040/Doc/lib Modified Files: libstdtypes.tex Log Message: Add Raymond Hettinger's d.pop(). See SF patch 539949. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** libstdtypes.tex 9 Apr 2002 18:14:59 -0000 1.85 --- libstdtypes.tex 12 Apr 2002 15:11:59 -0000 1.86 *************** *** 993,996 **** --- 993,999 ---- else \var{x} (also setting it)} {(5)} + \lineiii{\var{a}.pop(\var{k})} + {remove specified \var{key} and return corresponding \var{value}} + {} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} From gvanrossum@sourceforge.net Fri Apr 12 16:12:02 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 08:12:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15040/Lib/test Modified Files: test_types.py Log Message: Add Raymond Hettinger's d.pop(). See SF patch 539949. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_types.py 24 Mar 2002 01:24:07 -0000 1.26 --- test_types.py 12 Apr 2002 15:11:59 -0000 1.27 *************** *** 477,480 **** --- 477,495 ---- else: raise TestFailed, "{}.popitem doesn't raise KeyError" + # Tests for pop with specified key + d.clear() + k, v = 'abc', 'def' + d[k] = v + try: d.pop('ghi') + except KeyError: pass + else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when k not in dictionary" + + if d.pop(k) != v: raise TestFailed, "{}.pop(k) doesn't find known key/value pair" + if len(d) > 0: raise TestFailed, "{}.pop(k) failed to remove the specified pair" + + try: d.pop(k) + except KeyError: pass + else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is empty" + d[1] = 1 try: From fdrake@sourceforge.net Fri Apr 12 16:37:45 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 08:37:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv23220 Modified Files: newtypes.tex Log Message: Update the type of tp_dealloc. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** newtypes.tex 5 Apr 2002 23:01:14 -0000 1.13 --- newtypes.tex 12 Apr 2002 15:37:43 -0000 1.14 *************** *** 348,352 **** \begin{verbatim} ! destructor tp_dealloc; \end{verbatim} --- 348,352 ---- \begin{verbatim} ! freefunc tp_dealloc; \end{verbatim} From jhylton@sourceforge.net Fri Apr 12 16:50:39 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 12 Apr 2002 08:50:39 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv27699 Modified Files: asdl_c.py Log Message: Implement the PrototypeVisitor, which generates C function prototypes. Implement it and FunctionVisitor using the same basic infrastructure, where all the code is generated by emit_function(). FunctionVisitor extends PrototypeVisitor and overrides emit_function(). Extend reflow_lines() to indent to first paren if there is no brace. This change gets function prototypes formatted nicely. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** asdl_c.py 12 Apr 2002 02:35:15 -0000 1.7 --- asdl_c.py 12 Apr 2002 15:50:36 -0000 1.8 *************** *** 53,56 **** --- 53,62 ---- size -= j padding = " " * j + else: + j = cur.find('(', 0, i) + if j >= 0: + j += 1 # account for the paren (no space after it) + size -= j + padding = " " * j cur = cur[i+1:] else: *************** *** 178,184 **** """Generate function prototypes for the .h file""" - class FunctionVisitor(EmitVisitor): - """Visitor to generate constructor functions for AST.""" - def visitModule(self, mod): for dfn in mod.dfns: --- 184,187 ---- *************** *** 200,208 **** for t in sum.types: self.visit(t, name) - self.emit("", 0) def visitConstructor(self, cons, type): - def emit(s, depth=0): - self.emit(s, depth) args = [] if cons.fields: --- 203,208 ---- *************** *** 217,224 **** name = f.name args.append((get_c_type(f.type), name)) - argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname in args]) ctype = get_c_type(type) self.emit("%s" % ctype, 0) ! emit("%s(%s)" % (cons.name, argstr)) emit("{") emit("%s p = (%s)malloc(sizeof(*p));" % (ctype, ctype), 1) --- 217,244 ---- name = f.name args.append((get_c_type(f.type), name)) ctype = get_c_type(type) + self.emit_function(cons.name, ctype, args) + + def emit_function(self, name, ctype, args): + if args: + argstr = ", ".join(["%s %s" % (atype, aname) + for atype, aname in args]) + else: + argstr = "void" + self.emit("%s %s(%s);" % (ctype, name, argstr), 0) + + # XXX or just set skip=1 in constructor? + def visitProduct(self, prod, name): + pass + + class FunctionVisitor(PrototypeVisitor): + """Visitor to generate constructor functions for AST.""" + + def emit_function(self, name, ctype, args): + def emit(s, depth=0): + self.emit(s, depth) + argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname in args]) self.emit("%s" % ctype, 0) ! emit("%s(%s)" % (name, argstr)) emit("{") emit("%s p = (%s)malloc(sizeof(*p));" % (ctype, ctype), 1) *************** *** 227,239 **** emit("return NULL;", 2) emit("}", 1) ! emit("p->kind = %s_kind;" % cons.name, 1) for argtype, argname in args: ! emit("p->v.%s.%s = %s;" % (cons.name, argname, argname), 1) emit("return p;", 1) emit("}") ! ! def visitProduct(self, prod, name): ! pass ! class ChainOfVisitors: def __init__(self, *visitors): --- 247,257 ---- emit("return NULL;", 2) emit("}", 1) ! emit("p->kind = %s_kind;" % name, 1) for argtype, argname in args: ! emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) emit("return p;", 1) emit("}") ! emit("") ! class ChainOfVisitors: def __init__(self, *visitors): *************** *** 254,258 **** c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! ## PrototypeVisitor(f) ) c.visit(mod) --- 272,276 ---- c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! PrototypeVisitor(f) ) c.visit(mod) From jhylton@sourceforge.net Fri Apr 12 16:55:27 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 12 Apr 2002 08:55:27 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv29142 Modified Files: astmodule.c Log Message: Enough noodling to handle "global x" but not "global x, y." Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** astmodule.c 11 Apr 2002 21:20:19 -0000 1.1 --- astmodule.c 12 Apr 2002 15:55:25 -0000 1.2 *************** *** 10,16 **** --- 10,34 ---- extern grammar _PyParser_Grammar; /* From graminit.c */ + extern stmt_ty Global(identifier name); + + /* XXX should be seq */ + static stmt_ty + ast_for_global(node *n) + { + /* global_stmt: 'global' NAME (',' NAME)* */ + identifier *name; + REQ(n, global_stmt); + n = CHILD(n, 1); + name = PyString_InternFromString(STR(n)); + if (!name) + return NULL; + return Global(name); + } + static stmt_ty ast_for_stmt(node *n) { + int i; + REQ(n, stmt); assert(NCH(n) == 1); *************** *** 19,24 **** /* I'm explicitly punting on multiple statements joined by a semicolon. When I do handle it, ast_for_stmt() will have ! to return a sequence of statements. ! */ assert(NCH(n) == 2); n = CHILD(n, 0); --- 37,44 ---- /* I'm explicitly punting on multiple statements joined by a semicolon. When I do handle it, ast_for_stmt() will have ! to return a sequence of statements. It may actually be ! easier to put the check for a several small statements ! joined by a semicolon in the caller. ! */ assert(NCH(n) == 2); n = CHILD(n, 0); *************** *** 29,32 **** --- 49,54 ---- fprintf(stderr, "expr_stmt NCH=%d\n", NCH(n)); break; + case global_stmt: + return ast_for_global(n); default: fprintf(stderr, "TYPE=%d NCH=%d\n", TYPE(n), NCH(n)); From jhylton@sourceforge.net Fri Apr 12 16:56:45 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 12 Apr 2002 08:56:45 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.c,NONE,1.1 asdl.h,1.1,1.2 setup.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv29606 Modified Files: asdl.h setup.py Added Files: asdl.c Log Message: Add the beginnings of an ASDL sequence type (like PyListObject). --- NEW FILE: asdl.c --- #include "Python.h" #include "asdl.h" static asdl_seq * asdl_list_new(int size) { asdl_seq *seq = (asdl_seq *)malloc(sizeof(asdl_seq)); if (!seq) return NULL; seq->elements = malloc(sizeof(void *) * size); if (!seq->elements) { free(seq); return NULL; } seq->size = size; seq->used = 0; return seq; } static void * asdl_get(asdl_seq *seq, int offset) { if (offset > seq->used) return NULL; return seq->elements[offset]; } static int append(asdl_seq *seq, void *elt) { if (seq->size == seq->used) { void *newptr; int nsize = seq->size * 2; newptr = realloc(seq->elements, sizeof(void *) * nsize); if (!newptr) return 0; seq->elements = newptr; } seq->elements[seq->size++] = elt; return 1; } Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asdl.h 9 Apr 2002 19:13:19 -0000 1.1 --- asdl.h 12 Apr 2002 15:56:43 -0000 1.2 *************** *** 1,3 **** ! #define identifier const char * #define bool int #define string const char * --- 1,20 ---- ! #define identifier PyObject * #define bool int #define string const char * + + /* It would be nice if the code generated by asdl_c.py was completely + independent of Python, but it is a goal the requires too much work + at this stage. So, for example, I'll represent identifiers as + interned Python strings. + */ + + typedef struct { + int size; + int used; + void **elements; + } asdl_seq; + + asdl_seq *asdl_list_new(int size); + void *asdl_get(asdl_seq *seq, int offset); + int append(asdl_seq *seq, void *elt); + Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 11 Apr 2002 21:20:19 -0000 1.1 --- setup.py 12 Apr 2002 15:56:43 -0000 1.2 *************** *** 3,7 **** ast = Extension(name="ast", ! sources=["astmodule.c", "Python-ast.c"]) setup(name="ast", --- 3,7 ---- ast = Extension(name="ast", ! sources=["astmodule.c", "Python-ast.c", "asdl.c"]) setup(name="ast", *************** *** 9,11 **** import ast ! ast.transform("1 + 2") --- 9,11 ---- import ast ! ast.transform("global xyz") From fdrake@sourceforge.net Fri Apr 12 17:15:13 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 09:15:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv3297/api Modified Files: concrete.tex Log Message: Add a (very) simple description of PyType_Ready(). Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** concrete.tex 10 Apr 2002 17:52:52 -0000 1.10 --- concrete.tex 12 Apr 2002 16:15:10 -0000 1.11 *************** *** 76,79 **** --- 76,83 ---- \begin{cfuncdesc}{int}{PyType_Ready}{PyTypeObject *type} + Finalize a type object. This should be called on all type objects + to finish their initialization. This function is responsible for + adding inherited slots from a type's base class. Returns \code{0} + on success, or returns \code{-1} and sets an exception on error. \versionadded{2.2} \end{cfuncdesc} From gvanrossum@sourceforge.net Fri Apr 12 17:25:41 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 09:25:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_userstring.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7350 Modified Files: test_userstring.py Log Message: I am mad. This test never worked! The test function's signature should be test(methodname, input, output, *args) but the output argument was omitted. This caused all tests to fail, because the expected output was passed as the initial argument to the method call. But because of the way the test works (it compares the results for a regular string to the results for a UserString instance with the same value, and it's OK if both raise the same exception) the test never failed! I've fixed this, and also cleaned up a few warts in the verbose output. Finally, I've made it possible to run the test stand-alone in verbose mode by passing -v as a command line argument. Now, the test will report failure related to zfill. That's not my fault, that's a legitimate problem: the string_tests.py file contains a test for the zfill() method (just added) but this method is not implemented. The responsible party will surely fix this soon now. Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_userstring.py 9 Feb 2001 12:00:47 -0000 1.5 --- test_userstring.py 12 Apr 2002 16:25:39 -0000 1.6 *************** *** 9,21 **** if __name__ == "__main__": ! verbose = 0 tested_methods = {} ! def test(methodname, input, *args): global tested_methods tested_methods[methodname] = 1 if verbose: ! print '%s.%s(%s) ' % (input, methodname, args), u = UserString(input) objects = [input, u, UserString(u)] --- 9,21 ---- if __name__ == "__main__": ! verbose = '-v' in sys.argv tested_methods = {} ! def test(methodname, input, output, *args): global tested_methods tested_methods[methodname] = 1 if verbose: ! print '%r.%s(%s)' % (input, methodname, ", ".join(map(repr, args))), u = UserString(input) objects = [input, u, UserString(u)] *************** *** 25,45 **** try: f = getattr(object, methodname) ! res[i] = apply(f, args) ! except: ! res[i] = sys.exc_type ! if res[0] != res[1]: ! if verbose: ! print 'no' ! print `input`, f, `res[0]`, "<>", `res[1]` ! else: if verbose: print 'yes' - if res[1] != res[2]: - if verbose: - print 'no' - print `input`, f, `res[1]`, "<>", `res[2]` else: if verbose: ! print 'yes' string_tests.run_method_tests(test) --- 25,43 ---- try: f = getattr(object, methodname) ! except AttributeError: ! f = None ! res[i] = AttributeError ! else: ! try: ! res[i] = apply(f, args) ! except: ! res[i] = sys.exc_type ! if res[0] == res[1] == res[2] == output: if verbose: print 'yes' else: if verbose: ! print 'no' ! print (methodname, input, output, args, res[0], res[1], res[2]) string_tests.run_method_tests(test) From fdrake@sourceforge.net Fri Apr 12 17:17:09 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 09:17:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv3956/ext Modified Files: noddy.c Log Message: Modernize the minimal example of an extension type. Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** noddy.c 28 Mar 2002 23:32:53 -0000 1.1 --- noddy.c 12 Apr 2002 16:17:06 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- typedef struct { PyObject_HEAD + /* Type-specific fields go here. */ } noddy_NoddyObject; *************** *** 12,20 **** noddy_NoddyObject* noddy; - if (!PyArg_ParseTuple(args,":new_noddy")) - return NULL; - noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); return (PyObject*)noddy; } --- 13,20 ---- noddy_NoddyObject* noddy; noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); + /* Initialize type-specific fields here. */ + return (PyObject*)noddy; } *************** *** 23,30 **** noddy_noddy_dealloc(PyObject* self) { PyObject_Del(self); } ! static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, --- 23,34 ---- noddy_noddy_dealloc(PyObject* self) { + /* Free any external resources here; + * if the instance owns references to any Python + * objects, call Py_DECREF() on them here. + */ PyObject_Del(self); } ! statichere PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, *************** *** 45,51 **** static PyMethodDef noddy_methods[] = { ! {"new_noddy", noddy_new_noddy, METH_VARARGS, "Create a new Noddy object."}, ! {NULL, NULL, 0, NULL} }; --- 49,56 ---- static PyMethodDef noddy_methods[] = { ! {"new_noddy", noddy_new_noddy, METH_NOARGS, "Create a new Noddy object."}, ! ! {NULL} /* Sentinel */ }; *************** *** 54,58 **** { noddy_NoddyType.ob_type = &PyType_Type; ! Py_InitModule("noddy", noddy_methods); } --- 59,66 ---- { noddy_NoddyType.ob_type = &PyType_Type; + if (PyType_Ready(&noddy_NoddyType)) + return; ! Py_InitModule3("noddy", noddy_methods ! "Example module that creates an extension type."); } From loewis@sourceforge.net Fri Apr 12 18:25:29 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 12 Apr 2002 10:25:29 -0700 Subject: [Python-checkins] python/dist/src configure,1.296,1.297 configure.in,1.306,1.307 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv26242 Modified Files: configure configure.in Log Message: Bump AC_PREREQ to 2.53. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.296 retrieving revision 1.297 diff -C2 -d -r1.296 -r1.297 *** configure 12 Apr 2002 09:58:43 -0000 1.296 --- configure 12 Apr 2002 17:25:15 -0000 1.297 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.305 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.306 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.306 retrieving revision 1.307 diff -C2 -d -r1.306 -r1.307 *** configure.in 12 Apr 2002 09:58:45 -0000 1.306 --- configure.in 12 Apr 2002 17:25:21 -0000 1.307 *************** *** 1,5 **** dnl Process this file with autoconf 2.0 or later to make a configure script. AC_REVISION($Revision$) ! AC_PREREQ(2.50) AC_INIT(Include/object.h) AC_CONFIG_HEADER(pyconfig.h) --- 1,5 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. AC_REVISION($Revision$) ! AC_PREREQ(2.53) AC_INIT(Include/object.h) AC_CONFIG_HEADER(pyconfig.h) From fdrake@sourceforge.net Fri Apr 12 19:28:12 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 11:28:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv12727/ext Modified Files: newtypes.tex Log Message: Change the type of the tp_dealloc back to what it really is. Change a section title to fit in better. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** newtypes.tex 12 Apr 2002 15:37:43 -0000 1.14 --- newtypes.tex 12 Apr 2002 18:28:08 -0000 1.15 *************** *** 348,352 **** \begin{verbatim} ! freefunc tp_dealloc; \end{verbatim} --- 348,352 ---- \begin{verbatim} ! destructor tp_dealloc; \end{verbatim} *************** *** 919,923 **** ! \subsection{Cycle Collector Support \label{example-cycle-support}} --- 919,923 ---- ! \subsection{Supporting the Cycle Collector \label{example-cycle-support}} From fdrake@sourceforge.net Fri Apr 12 20:04:20 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 12:04:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext embedding.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv23151/ext Modified Files: embedding.tex Log Message: Change example of retrieving & calling a Python function to not use PyModule_GetDict(), which is also more flexible: it does not assume that the "module" is a real module. Index: embedding.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/embedding.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** embedding.tex 28 Nov 2001 07:26:14 -0000 1.4 --- embedding.tex 12 Apr 2002 19:04:17 -0000 1.5 *************** *** 179,200 **** \begin{verbatim} ! pDict = PyModule_GetDict(pModule); ! /* pDict is a borrowed reference */ ! ! pFunc = PyDict_GetItemString(pDict, argv[2]); ! /* pFun is a borrowed reference */ if (pFunc && PyCallable_Check(pFunc)) { ... } \end{verbatim} ! Once the script is loaded, its dictionary is retrieved with ! \cfunction{PyModule_GetDict()}. The dictionary is then searched using ! the normal dictionary access routines for the function name. If the ! name exists, and the object retunred is callable, you can safely ! assume that it is a function. The program then proceeds by ! constructing a tuple of arguments as normal. The call to the python ! function is then made with: \begin{verbatim} --- 179,197 ---- \begin{verbatim} ! pFunc = PyObject_GetAttrString(pModule, argv[2]); ! /* pFunc is a new reference */ if (pFunc && PyCallable_Check(pFunc)) { ... } + Py_XDECREF(pFunc); \end{verbatim} ! Once the script is loaded, the name we're looking for is retrieved ! using \cfunction{PyObject_GetAttrString()}. If the name exists, and ! the object retunred is callable, you can safely assume that it is a ! function. The program then proceeds by constructing a tuple of ! arguments as normal. The call to the Python function is then made ! with: \begin{verbatim} From fdrake@sourceforge.net Fri Apr 12 20:08:34 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 12:08:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv24289/ext Modified Files: extending.tex Log Message: Do not use PyModule_GetDict(). Clean up the example of exporting a C-callable API from an extension module. Add a hyperlink to a related section in the Python/C API reference. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** extending.tex 9 Apr 2002 21:09:42 -0000 1.18 --- extending.tex 12 Apr 2002 19:08:31 -0000 1.19 *************** *** 218,227 **** initspam(void) { ! PyObject *m, *d; m = Py_InitModule("spam", SpamMethods); ! d = PyModule_GetDict(m); SpamError = PyErr_NewException("spam.error", NULL, NULL); ! PyDict_SetItemString(d, "error", SpamError); } \end{verbatim} --- 218,228 ---- initspam(void) { ! PyObject *m; m = Py_InitModule("spam", SpamMethods); ! SpamError = PyErr_NewException("spam.error", NULL, NULL); ! Py_INCREF(SpamError); ! PyModule_AddObject(m, "error", SpamError); } \end{verbatim} *************** *** 1278,1288 **** c_api_object = PyCObject_FromVoidPtr((void *)PySpam_API, NULL); ! if (c_api_object != NULL) { ! /* Create a name for this object in the module's namespace */ ! PyObject *d = PyModule_GetDict(m); ! ! PyDict_SetItemString(d, "_C_API", c_api_object); ! Py_DECREF(c_api_object); ! } } \end{verbatim} --- 1279,1284 ---- c_api_object = PyCObject_FromVoidPtr((void *)PySpam_API, NULL); ! if (c_api_object != NULL) ! PyModule_AddObject(m, "_C_API", c_api_object); } \end{verbatim} *************** *** 1325,1338 **** (*(PySpam_System_RETURN (*)PySpam_System_PROTO) PySpam_API[PySpam_System_NUM]) ! #define import_spam() \ ! { \ ! PyObject *module = PyImport_ImportModule("spam"); \ ! if (module != NULL) { \ ! PyObject *module_dict = PyModule_GetDict(module); \ ! PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ ! if (PyCObject_Check(c_api_object)) { \ ! PySpam_API = (void **)PyCObject_AsVoidPtr(c_api_object); \ ! } \ ! } \ } --- 1321,1339 ---- (*(PySpam_System_RETURN (*)PySpam_System_PROTO) PySpam_API[PySpam_System_NUM]) ! /* Return -1 and set exception on error, 0 on success. */ ! static int ! import_spam(void) ! { ! PyObject *module = PyImport_ImportModule("spam"); ! ! if (module != NULL) { ! PyObject *c_api_object = PyObject_GetAttrString(module, "_C_API"); ! if (c_api_object == NULL) ! return -1; ! if (PyCObject_Check(c_api_object)) ! PySpam_API = (void **)PyCObject_AsVoidPtr(c_api_object); ! Py_DECREF(c_api_object); ! } ! return 0; } *************** *** 1358,1362 **** Py_InitModule("client", ClientMethods); ! import_spam(); } \end{verbatim} --- 1359,1365 ---- Py_InitModule("client", ClientMethods); ! if (import_spam() < 0) ! return; ! /* additional initialization can happen here */ } \end{verbatim} *************** *** 1371,1375 **** deallocation of the pointer stored in a CObject. The details are described in the \citetitle[../api/api.html]{Python/C API ! Reference Manual} in the section ``CObjects'' and in the ! implementation of CObjects (files \file{Include/cobject.h} and \file{Objects/cobject.c} in the Python source code distribution). --- 1374,1379 ---- deallocation of the pointer stored in a CObject. The details are described in the \citetitle[../api/api.html]{Python/C API ! Reference Manual} in the section ! ``\ulink{CObjects}{../api/cObjects.html}'' and in the implementation ! of CObjects (files \file{Include/cobject.h} and \file{Objects/cobject.c} in the Python source code distribution). From gvanrossum@sourceforge.net Fri Apr 12 20:22:51 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 12:22:51 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.382,1.383 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28734 Modified Files: NEWS Log Message: News about dict.pop(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.382 retrieving revision 1.383 diff -C2 -d -r1.382 -r1.383 *** NEWS 8 Apr 2002 21:28:20 -0000 1.382 --- NEWS 12 Apr 2002 19:22:48 -0000 1.383 *************** *** 7,10 **** --- 7,13 ---- Core and builtins + - Added a new dict method pop(key). This removes and returns the + value corresponding to key. [SF patch #539949] + - Changed new-style class instantiation so that when C's __new__ method returns something that's not a C instance, its __init__ is From fdrake@sourceforge.net Fri Apr 12 20:32:11 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 12:32:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv31546/api Modified Files: concrete.tex Log Message: Warn people away from PyModule_GetDict(), but not too strongly. (The real issue is whether modules can benefit from an alternate implementation strategy rather than using a dictionary. We should migrate away from direct dictionary manipulation to allow more room for Jeremy to flex the implementation with changes in globals lookup.) Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** concrete.tex 12 Apr 2002 16:15:10 -0000 1.11 --- concrete.tex 12 Apr 2002 19:32:07 -0000 1.12 *************** *** 2112,2115 **** --- 2112,2118 ---- attribute of the module object. This function never fails. \withsubitem{(module attribute)}{\ttindex{__dict__}} + It is recommended extensions use other \cfunction{PyModule_*()} + and \cfunction{PyObject_*()} functions rather than directly + manipulate a module's \member{__dict__}. \end{cfuncdesc} From fdrake@sourceforge.net Fri Apr 12 20:49:17 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 12:49:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext typestruct.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv3958/ext Modified Files: typestruct.h Log Message: Update the type of the tp_free slot. Index: typestruct.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/typestruct.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** typestruct.h 29 Mar 2002 22:46:04 -0000 1.2 --- typestruct.h 12 Apr 2002 19:49:13 -0000 1.3 *************** *** 66,70 **** allocfunc tp_alloc; newfunc tp_new; ! destructor tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; --- 66,70 ---- allocfunc tp_alloc; newfunc tp_new; ! freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; From fdrake@sourceforge.net Fri Apr 12 21:01:50 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 13:01:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librandom.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8097/lib Modified Files: librandom.tex Log Message: BDFL agreed with Tim: rehabilitate randint(). Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** librandom.tex 21 Apr 2001 05:56:06 -0000 1.25 --- librandom.tex 12 Apr 2002 20:01:47 -0000 1.26 *************** *** 157,161 **** \begin{funcdesc}{randint}{a, b} - \deprecated{2.0}{Use \function{randrange()} instead.} Return a random integer \var{N} such that \code{\var{a} <= \var{N} <= \var{b}}. --- 157,160 ---- From tim_one@sourceforge.net Fri Apr 12 21:49:39 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 13:49:39 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22429/python/Objects Modified Files: obmalloc.c Log Message: Small anal correctness tweaks: _PyObject_DebugMalloc: explicitly cast PyObject_Malloc's result to the target pointer type. _PyObject_DebugDumpStats: change decl of arena_alignment from unsigned int to unsigned long. This is for the 2.3 release only (it's new code). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** obmalloc.c 12 Apr 2002 08:52:50 -0000 2.38 --- obmalloc.c 12 Apr 2002 20:49:36 -0000 2.39 *************** *** 965,969 **** } ! p = PyObject_Malloc(total); if (p == NULL) return NULL; --- 965,969 ---- } ! p = (uchar *)PyObject_Malloc(total); if (p == NULL) return NULL; *************** *** 1232,1236 **** uint numfreepools = 0; /* # of bytes for arena alignment padding */ ! uint arena_alignment = 0; /* # of bytes in used and full pools used for pool_headers */ ulong pool_header_bytes = 0; --- 1232,1236 ---- uint numfreepools = 0; /* # of bytes for arena alignment padding */ ! ulong arena_alignment = 0; /* # of bytes in used and full pools used for pool_headers */ ulong pool_header_bytes = 0; From bwarsaw@sourceforge.net Fri Apr 12 21:50:07 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Fri, 12 Apr 2002 13:50:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv23333 Modified Files: Utils.py Log Message: AddrlistClass -> AddressList Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Utils.py 10 Apr 2002 21:01:30 -0000 1.10 --- Utils.py 12 Apr 2002 20:50:05 -0000 1.11 *************** *** 15,19 **** from rfc822 import unquote, quote ! from rfc822 import AddrlistClass as _AddrlistClass from rfc822 import mktime_tz --- 15,19 ---- from rfc822 import unquote, quote ! from rfc822 import AddressList as _AddressList from rfc822 import mktime_tz *************** *** 97,101 **** """Return a list of (REALNAME, EMAIL) for each fieldvalue.""" all = COMMASPACE.join(fieldvalues) ! a = _AddrlistClass(all) return a.getaddrlist() --- 97,101 ---- """Return a list of (REALNAME, EMAIL) for each fieldvalue.""" all = COMMASPACE.join(fieldvalues) ! a = _AddressList(all) return a.getaddrlist() From bwarsaw@sourceforge.net Fri Apr 12 21:55:33 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Fri, 12 Apr 2002 13:55:33 -0700 Subject: [Python-checkins] python/dist/src/Lib rfc822.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25105 Modified Files: rfc822.py Log Message: AddrlistClass -> AddressList Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** rfc822.py 7 Apr 2002 06:36:23 -0000 1.67 --- rfc822.py 12 Apr 2002 20:55:31 -0000 1.68 *************** *** 352,356 **** raw.append(addr) alladdrs = ''.join(raw) ! a = AddrlistClass(alladdrs) return a.getaddrlist() --- 352,356 ---- raw.append(addr) alladdrs = ''.join(raw) ! a = AddressList(alladdrs) return a.getaddrlist() *************** *** 495,499 **** def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" ! a = AddrlistClass(address) list = a.getaddrlist() if not list: --- 495,499 ---- def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" ! a = AddressList(address) list = a.getaddrlist() if not list: From fdrake@sourceforge.net Fri Apr 12 23:47:20 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 15:47:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv27061/api Modified Files: newtypes.tex Log Message: Integrate a bunch of new text from Guido. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** newtypes.tex 9 Apr 2002 21:22:07 -0000 1.6 --- newtypes.tex 12 Apr 2002 22:47:18 -0000 1.7 *************** *** 189,198 **** PyObject_HEAD_INIT - Typedefs: - unaryfunc, binaryfunc, ternaryfunc, inquiry, coercion, intargfunc, - intintargfunc, intobjargproc, intintobjargproc, objobjargproc, - destructor, printfunc, getattrfunc, getattrofunc, setattrfunc, - setattrofunc, cmpfunc, reprfunc, hashfunc - \begin{ctypedesc}{PyCFunction} Type of the functions used to implement most Python callables in C. --- 189,192 ---- *************** *** 310,313 **** --- 304,569 ---- use the \cfunction{PyObject_GenericGetAttr()} function. \end{cfuncdesc} + + + \section{Type Objects \label{type-structs}} + + Perhaps one of the most important structures of the Python object + system is the structure that defines a new type: the + \ctype{PyTypeObject} structure. Type objects can be handled using any + of the \cfunction{PyObject_*()} or \cfunction{PyType_*()} functions, + but do not offer much that's interesting to most Python applications. + These objects are fundamental to how objects behave, so they are very + important to the interpreter itself and to any extension module that + implements new types. + + Type objects are fairly large compared to most of the standard types. + The reason for the size is that each type object stores a large number + of values, mostly C function pointers, each of which implements a + small part of the type's functionality. The fields of the type object + are examined in detail in this section. The fields will be described + in the order in which they occur in the structure. + + Typedefs: + unaryfunc, binaryfunc, ternaryfunc, inquiry, coercion, intargfunc, + intintargfunc, intobjargproc, intintobjargproc, objobjargproc, + destructor, freefunc, printfunc, getattrfunc, getattrofunc, setattrfunc, + setattrofunc, cmpfunc, reprfunc, hashfunc + + The structure definition for \ctype{PyTypeObject} can be found in + \file{Include/object.h}. For convenience of reference, this repeats + the definition found there: + + \verbatiminput{typestruct.h} + + The type object structure extends the \ctype{PyVarObject} structure, + though it does not actually need the the \member{ob_size} field. The + inclusion of this field is a historical accident that must be + maintained to ensure binary compatibility between new versions of + Python and older compiled extensions. + + \begin{cmemberdesc}{PyObject}{PyObject*}{_ob_next} + \cmemberline{PyObject}{PyObject*}{_ob_prev} + These fields are only present when the macro \code{Py_TRACE_REFS} is + defined. Their initialization to \NULL{} is taken care of by the + \code{PyObject_HEAD_INIT} macro. For statically allocated objects, + these fields always remain \NULL. For dynamically allocated + objects, these two fields are used to link the object into a + doubly-linked list of \emph{all} live objects on the heap. This + could be used for various debugging purposes; currently the only use + is to print the objects that are still alive at the end of a run + when the environment variable \envvar{PYTHONDUMPREFS} is set. + + These fields are not inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyObject}{int}{ob_refcnt} + This is the type object's reference count, initialized to \code{1} + by the \code{PyObject_HEAD_INIT} macro. Note that for statically + allocated type objects, the type's instances (objects whose + \member{ob_type} points back to the type) do \emph{not} count as + references. But for dynamically allocated type objects, the + instances \emph{do} count as references. + + This field is not inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyObject}{PyTypeObject*}{ob_type} + This is the type's type, in other words its metatype. It is + initialized by the argument to the \code{PyObject_HEAD_INIT} macro, + and its value should normally be \code{\&PyType_Type}. However, for + dynamically loadable extension modules that must be usable on + Windows (at least), the compiler complains that this is not a valid + initializer. Therefore, the convention is to pass \NULL{} to the + \code{PyObject_HEAD_INIT} macro and to initialize this field + explicitly at the start of the module's initialization function, + before doing anything else. This is typically done like this: + + \begin{verbatim} + Foo_Type.ob_type = &PyType_Type; + \end{verbatim} + + This should be done before any instances of the type are created. + \cfunction{PyType_Ready()} checks if \member{ob_type} is \NULL, and + if so, initializes it: in Python 2.2, it is set to + \code{\&PyType_Type}; in Python 2.2.1 and later it will be + initialized to the \member{ob_type} field of the base class. + \cfunction{PyType_Ready()} will not change this field if it is + nonzero. + + In Python 2.2, this field is not inherited by subtypes. In 2.2.1, + and in 2.3 and beyond, it is inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyVarObject}{int}{ob_size} + For statically allocated type objects, this should be initialized + to zero. For dynamically allocated type objects, this field has a + special internal meaning. + + This field is not inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{char*}{tp_name} + Pointer to a NUL-terminated string containing the name of the type. + For types that are accessible as module globals, the string should + be the full module name, followed by a dot, followed by the type + name; for built-in types, it should be just the type name. If the + module is a submodule of a package, the full package name is part of + the full module name. For example, a type named \class{T} defined + in module \module{M} in subpackage \module{Q} in package \module{P} + should have the \member{tp_name} initializer \code{"P.Q.M.T"}. + + For dynamically allocated type objects, this may be just the type + name, if the module name is explicitly stored in the type dict as + the value for key \code{'__module__'}. + + If the tp_name field contains a dot, everything before the last dot + is made accessible as the \member{__module__} attribute, and + everything after the last dot is made accessible as the + \member{__name__} attribute. If no dot is present, the entire + \member{tp_name} field is made accessible as the \member{__name__} + attribute, and the \member{__module__} attribute is undefined + (unless explicitly set in the dictionary, as explained above). + + This field is not inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{int}{tp_basicsize} + \cmemberline{PyTypeObject}{int}{tp_itemsize} + These fields allow calculating the size in byte of instances of + the type. + + There are two kinds of types: types with fixed-length instances have + a zero \member{tp_itemsize} field, types with variable-length + instances have a non-zero \member{tp_itemsize} field. For a type + with fixed-length instances, all instances have the same size, + given in \member{tp_basicsize}. + + For a type with variable-length instances, the instances must have + an \member{ob_size} field, and the instance size is + \member{tp_basicsize} plus N times \member{tp_itemsize}, where N is + the ``length'' of the object. The value of N is typically stored in + the instance's \member{ob_size} field. There are exceptions: for + example, long ints use a negative \member{ob_size} to indicate a + negative number, and N is \code{abs(\member{ob_size})} there. Also, + the presence of an \member{ob_size} field in the instance layout + doesn't mean that the type is variable-length (for example, the list + type has fixed-length instances, yet those instances have a + meaningful \member{ob_size} field). + + The basic size includes the fields in the instance declared by the + macro \csimplemacro{PyObject_HEAD} or + \csimplemacro{PyObject_VAR_HEAD} (whichever is used to declare the + instance struct) and this in turn includes the \member{_ob_prev} and + \member{_ob_next} fields if they are present. This means that the + only correct way to get an initializer for the \member{tp_basicsize} + is to use the \keyword{sizeof} operator on the struct used to + declare the instance layout. The basic size does not include the GC + header size (this is new in Python 2.2; in 2.1 and 2.0, the GC + header size was included in \member{tp_basicsize}). + + These fields are inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{destructor}{tp_dealloc} + A pointer to the instance destructor function. This function must + be defined unless the type guarantees that its instances will never + be deallocated (as is the case for the singletons \code{None} and + \code{Ellipsis}). + + The destructor function is called by the \cfunction{Py_DECREF()} and + \cfunction{Py_XDECREF()} macros when the new reference count is + zero. At this point, the instance is still in existance, but there + are no references to it. The destructor function should free all + references which the instance owns, free all memory buffers owned by + the instance (using the freeing function corresponding to the + allocation function used to allocate the buffer), and finally (as + its last action) call the type's \member{tp_free} slot. If the type + is not subtypable (doesn't have the \constant{Py_TPFLAGS_BASETYPE} + flag bit set), it is permissible to call the object deallocator + directly instead of via \member{tp_free}. The object deallocator + should be the one used to allocate the instance; this is normally + \cfunction{PyObject_Del()} if the instance was allocated using + \cfunction{PyObject_New()} or \cfunction{PyOject_VarNew()}, or + \cfunction{PyObject_GC_Del()} if the instance was allocated using + \cfunction{PyObject_GC_New()} or \cfunction{PyObject_GC_VarNew()}. + + This field is inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{printfunc}{tp_print} + An optional pointer to the instance print function. + + The print function is only called when the instance is printed to a + \emph{real} file; when it is printed to a pseudo-file (like a + \class{StringIO} instance), the instance's \member{tp_repr} or + \member{tp_str} function is called to convert it to a string. These + are also called when the type's \member{tp_print} field is \NULL. + + The print function is called with the same signature as + \cfunction{PyObject_Print()}: \code{tp_print(PyObject *self, FILE + *file, int flags)}. The \var{self} argument is the instance to be + printed. The \var{file} argument is the stdio file to which it is + to be printed. The \var{flags} argument is composed of flag bits. + The only flag bit currently defined is \constant{Py_PRINT_RAW}. + When the \constant{Py_PRINT_RAW} flag bit is set, the instance + should be printed the same way as \member{tp_str} would format it; + when the \constant{Py_PRINT_RAW} flag bit is clear, the instance + should be printed the same was as \member{tp_repr} would format it. + + It is possible that the \member{tp_print} field will be deprecated. + In any case, it is recommended not to define \member{tp_print}, but + instead to rely on \member{tp_repr} and \member{tp_str} for + printing. + + This field is inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{getattrfunc}{tp_getattr} + An optional pointer to the get-attribute-string function. + + This field is deprecated. When it is defined, it should point to a + function that acts the same as the \member{tp_getattro} function, + but taking a C string instead of a Python string object to give the + attribute name. The signature is the same as for + \cfunction{PyObject_GetAttrString()}. + + This field is inherited by subtypes together with + \member{tp_getattro}: a subtype inherits both \member{tp_getattr} + and \member{tp_getattro} from its base type when the subtype's + \member{tp_getattr} and \member{tp_getattro} are both \NULL. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{setattrfunc}{tp_setattr} + An optional pointer to the set-attribute-string function. + + This field is deprecated. When it is defined, it should point to a + function that acts the same as the \member{tp_setattro} function, + but taking a C string instead of a Python string object to give the + attribute name. The signature is the same as for + \cfunction{PyObject_SetAttrString()}. + + This field is inherited by subtypes together with + \member{tp_setattro}: a subtype inherits both \member{tp_setattr} + and \member{tp_setattro} from its base type when the subtype's + \member{tp_setattr} and \member{tp_setattro} are both \NULL. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{cmpfunc}{tp_compare} + An optional pointer to the three-way comparison function. + + The signature is the same as for \cfunction{PyObject_Compare()}. + The function should return \code{1} if \var{self} greater than + \var{other}, \code{0} if \var{self} is equal to \var{other}, and + \code{-1} if \var{self} less than \var{other}. It should return + \code{-1} and set an exception condition when an error occurred + during the comparison. + + This field is inherited by subtypes together with + \member{tp_richcompare} and \member{tp_hash}: a subtypes inherits + all three of \member{tp_compare}, \member{tp_richcompare}, and + \member{tp_hash} when the subtype's \member{tp_compare}, + \member{tp_richcompare}, and \member{tp_hash} are all \NULL. + \end{cmemberdesc} + From fdrake@sourceforge.net Fri Apr 12 23:48:04 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 15:48:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv27294/texinputs Modified Files: python.sty Log Message: Additional support for describing C structure members. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** python.sty 9 Apr 2002 20:16:47 -0000 1.93 --- python.sty 12 Apr 2002 22:48:02 -0000 1.94 *************** *** 613,616 **** --- 613,627 ---- }{\end{fulllineitems}} + % C type fields ---------------------------------------------------------- + % \begin{cmemberdesc}{container type}{ctype}{membername} + \newcommand{\cmemberline}[3]{ + \item[\code{#2 \bfcode{#3}}] + \index{#3@{\py@idxcode{#3}} (#1 member)} + } + \newenvironment{cmemberdesc}[3]{ + \begin{fulllineitems} + \cmemberline{#1}{#2}{#3} + }{\end{fulllineitems}} + % Funky macros ----------------------------------------------------------- % \begin{csimplemacrodesc}{name} From nascheme@sourceforge.net Sat Apr 13 00:00:11 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Fri, 12 Apr 2002 16:00:11 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.383,1.384 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30397/Misc Modified Files: NEWS Log Message: Add news about memory managent APIs changing. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.383 retrieving revision 1.384 diff -C2 -d -r1.383 -r1.384 *** NEWS 12 Apr 2002 19:22:48 -0000 1.383 --- NEWS 12 Apr 2002 23:00:08 -0000 1.384 *************** *** 128,131 **** --- 128,136 ---- C API + - The type of tp_free has been changed from "void (*)(PyObject *)" to + "void (*)(void *)". + + - PyObject_Del, PyObject_GC_Del are now functions instead of macros. + - A type can now inherit its metatype from its base type. Previously, when PyType_Ready() was called, if ob_type was found to be NULL, it From skip@pobox.com Sat Apr 13 00:14:18 2002 From: skip@pobox.com (Skip Montanaro) Date: Fri, 12 Apr 2002 18:14:18 -0500 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.59,1.60 configure,1.293,1.294 configure.in,1.303,1.304 pyconfig.h.in,1.25,1.26 In-Reply-To: References: <200204111448.g3BEmQP25970@pcp742651pcs.reston01.va.comcast.net> <200204111545.g3BFj6v24771@odiug.zope.com> Message-ID: <15543.27210.168894.579028@12-248-41-177.client.attbi.com> Martin> At the moment, AC_PREREQ is 2.50, so 2.13 will fail. Even the Martin> changes between 2.52 and 2.53 in the generated configure are Martin> huge, so 2.53 should be the "official" version. FWIW, I just bumped from 2.52 to 2.53 locally because I couldn't get the configure script generated by 2.52 to work in several instances (in a Debian system where the directory was NFS mounted using the user-space NFS daemon, for example). When I was trying to debug the problem, people on the autoconf mailing list suggested there are problems w.r.t. unfsd. Skip From gvanrossum@sourceforge.net Sat Apr 13 01:56:10 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 17:56:10 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.155,2.156 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21002/Objects Modified Files: stringobject.c Log Message: Partially implement SF feature request 444708. Add optional arg to string methods strip(), lstrip(), rstrip(). The optional arg specifies characters to delete. Also for UserString. Still to do: - Misc/NEWS - LaTeX docs (I did the docstrings though) - Unicode methods, and Unicode support in the string methods. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.155 retrieving revision 2.156 diff -C2 -d -r2.155 -r2.156 *** stringobject.c 12 Apr 2002 03:05:19 -0000 2.155 --- stringobject.c 13 Apr 2002 00:56:08 -0000 2.156 *************** *** 1003,1006 **** --- 1003,1009 ---- #define BOTHSTRIP 2 + /* Arrays indexed by above */ + static const char *stripname[] = {"lstrip", "rstrip", "strip"}; + static PyObject * *************** *** 1378,1381 **** --- 1381,1417 ---- static PyObject * + do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) + { + char *s = PyString_AS_STRING(self); + int len = PyString_GET_SIZE(self); + char *sep = PyString_AS_STRING(sepobj); + int seplen = PyString_GET_SIZE(sepobj); + int i, j; + + i = 0; + if (striptype != RIGHTSTRIP) { + while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { + i++; + } + } + + j = len; + if (striptype != LEFTSTRIP) { + do { + j--; + } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); + j++; + } + + if (i == 0 && j == len && PyString_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyString_FromStringAndSize(s+i, j-i); + } + + + static PyObject * do_strip(PyStringObject *self, int striptype) { *************** *** 1407,1444 **** static char strip__doc__[] = ! "S.strip() -> string\n\ \n\ Return a copy of the string S with leading and trailing\n\ ! whitespace removed."; static PyObject * ! string_strip(PyStringObject *self) { ! return do_strip(self, BOTHSTRIP); } static char lstrip__doc__[] = ! "S.lstrip() -> string\n\ \n\ ! Return a copy of the string S with leading whitespace removed."; static PyObject * ! string_lstrip(PyStringObject *self) { ! return do_strip(self, LEFTSTRIP); } static char rstrip__doc__[] = ! "S.rstrip() -> string\n\ \n\ ! Return a copy of the string S with trailing whitespace removed."; static PyObject * ! string_rstrip(PyStringObject *self) { ! return do_strip(self, RIGHTSTRIP); } --- 1443,1515 ---- + static PyObject * + do_argstrip(PyStringObject *self, int striptype, PyObject *args) + { + PyObject *sep = NULL; + + if (!PyArg_ParseTuple(args, "|O:[lr]strip", &sep)) + return NULL; + + if (sep != NULL && sep != Py_None) { + /* XXX What about Unicode? */ + if (!PyString_Check(sep)) { + PyErr_Format(PyExc_TypeError, + "%s arg must be None or string", + stripname[striptype]); + return NULL; + } + return do_xstrip(self, striptype, sep); + } + + return do_strip(self, striptype); + } + + static char strip__doc__[] = ! "S.strip([sep]) -> string\n\ \n\ Return a copy of the string S with leading and trailing\n\ ! whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * ! string_strip(PyStringObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, BOTHSTRIP); /* Common case */ ! else ! return do_argstrip(self, BOTHSTRIP, args); } static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string\n\ \n\ ! Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * ! string_lstrip(PyStringObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, LEFTSTRIP); /* Common case */ ! else ! return do_argstrip(self, LEFTSTRIP, args); } static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string\n\ \n\ ! Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * ! string_rstrip(PyStringObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, RIGHTSTRIP); /* Common case */ ! else ! return do_argstrip(self, RIGHTSTRIP, args); } *************** *** 2645,2655 **** {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, ! {"lstrip", (PyCFunction)string_lstrip, METH_NOARGS, lstrip__doc__}, {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, ! {"rstrip", (PyCFunction)string_rstrip, METH_NOARGS, rstrip__doc__}, {"startswith", (PyCFunction)string_startswith, METH_VARARGS, startswith__doc__}, ! {"strip", (PyCFunction)string_strip, METH_NOARGS, strip__doc__}, {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction)string_translate, METH_VARARGS, translate__doc__}, --- 2716,2726 ---- {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, ! {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, ! {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, {"startswith", (PyCFunction)string_startswith, METH_VARARGS, startswith__doc__}, ! {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction)string_translate, METH_VARARGS, translate__doc__}, From gvanrossum@sourceforge.net Sat Apr 13 01:56:10 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 17:56:10 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21002/Lib Modified Files: UserString.py Log Message: Partially implement SF feature request 444708. Add optional arg to string methods strip(), lstrip(), rstrip(). The optional arg specifies characters to delete. Also for UserString. Still to do: - Misc/NEWS - LaTeX docs (I did the docstrings though) - Unicode methods, and Unicode support in the string methods. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** UserString.py 15 May 2001 11:58:05 -0000 1.10 --- UserString.py 13 Apr 2002 00:56:08 -0000 1.11 *************** *** 109,113 **** def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self): return self.__class__(self.data.lstrip()) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) --- 109,113 ---- def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, sep=None): return self.__class__(self.data.lstrip(sep)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) *************** *** 117,121 **** return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self): return self.__class__(self.data.rstrip()) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) --- 117,121 ---- return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, sep=None): return self.__class__(self.data.rstrip(sep)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) *************** *** 123,127 **** def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self): return self.__class__(self.data.strip()) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) --- 123,127 ---- def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, sep=None): return self.__class__(self.data.strip(sep)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) From gvanrossum@sourceforge.net Sat Apr 13 01:56:10 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 17:56:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21002/Lib/test Modified Files: string_tests.py Log Message: Partially implement SF feature request 444708. Add optional arg to string methods strip(), lstrip(), rstrip(). The optional arg specifies characters to delete. Also for UserString. Still to do: - Misc/NEWS - LaTeX docs (I did the docstrings though) - Unicode methods, and Unicode support in the string methods. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** string_tests.py 29 Mar 2002 16:00:13 -0000 1.11 --- string_tests.py 13 Apr 2002 00:56:08 -0000 1.12 *************** *** 164,167 **** --- 164,179 ---- test('strip', 'hello', 'hello') + # strip/lstrip/rstrip with None arg + test('strip', ' hello ', 'hello', None) + test('lstrip', ' hello ', 'hello ', None) + test('rstrip', ' hello ', ' hello', None) + test('strip', 'hello', 'hello', None) + + # strip/lstrip/rstrip with real arg + test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz') + test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz') + test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz') + test('strip', 'hello', 'hello', 'xyz') + test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') test('translate', 'xyzabcdef', 'xyzxyz', transtable, 'def') From gvanrossum@sourceforge.net Sat Apr 13 01:59:07 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 12 Apr 2002 17:59:07 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.384,1.385 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22439 Modified Files: NEWS Log Message: News for strip methods. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.384 retrieving revision 1.385 diff -C2 -d -r1.384 -r1.385 *** NEWS 12 Apr 2002 23:00:08 -0000 1.384 --- NEWS 13 Apr 2002 00:59:05 -0000 1.385 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - String methods lstrip(), rstrip() and strip() now take an optional + argument that specifies the characters to strip. For example, + "Foo!!!?!?!?".rstrip("?!") -> "Foo". + - Added a new dict method pop(key). This removes and returns the value corresponding to key. [SF patch #539949] From fdrake@acm.org Sat Apr 13 03:02:32 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 12 Apr 2002 22:02:32 -0400 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.155,2.156 In-Reply-To: References: Message-ID: <15543.37304.658907.205166@grendel.zope.com> gvanrossum@sourceforge.net writes: > Still to do: ... > - LaTeX docs (I did the docstrings though) These will be checked in shortly. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake@sourceforge.net Sat Apr 13 03:43:41 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 12 Apr 2002 19:43:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10503/lib Modified Files: libstdtypes.tex Log Message: Document the optional argument to the .strip(), .rstrip(), .strip() string methods. Part of SF feature #444708. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** libstdtypes.tex 12 Apr 2002 15:11:59 -0000 1.86 --- libstdtypes.tex 13 Apr 2002 02:43:39 -0000 1.87 *************** *** 604,609 **** \end{methoddesc} ! \begin{methoddesc}[string]{lstrip}{} ! Return a copy of the string with leading whitespace removed. \end{methoddesc} --- 604,613 ---- \end{methoddesc} ! \begin{methoddesc}[string]{lstrip}{\optional{chars}} ! Return a copy of the string with leading characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the beginning of ! the string this method is called on. \end{methoddesc} *************** *** 633,638 **** \end{methoddesc} ! \begin{methoddesc}[string]{rstrip}{} ! Return a copy of the string with trailing whitespace removed. \end{methoddesc} --- 637,646 ---- \end{methoddesc} ! \begin{methoddesc}[string]{rstrip}{\optional{chars}} ! Return a copy of the string with trailing characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the end of the ! string this method is called on. \end{methoddesc} *************** *** 650,654 **** \end{methoddesc} ! \begin{methoddesc}[string]{startswith}{prefix\optional{, start\optional{, end}}} Return true if string starts with the \var{prefix}, otherwise return false. With optional \var{start}, test string beginning at --- 658,663 ---- \end{methoddesc} ! \begin{methoddesc}[string]{startswith}{prefix\optional{, ! start\optional{, end}}} Return true if string starts with the \var{prefix}, otherwise return false. With optional \var{start}, test string beginning at *************** *** 657,663 **** \end{methoddesc} ! \begin{methoddesc}[string]{strip}{} ! Return a copy of the string with leading and trailing whitespace ! removed. \end{methoddesc} --- 666,675 ---- \end{methoddesc} ! \begin{methoddesc}[string]{strip}{\optional{chars}} ! Return a copy of the string with leading and trailing characters ! removed. If \var{chars} is omitted or \code{None}, whitespace ! characters are removed. If given and not \code{None}, \var{chars} ! must be a string; the characters in the string will be stripped from ! the both ends of the string this method is called on. \end{methoddesc} From tim_one@sourceforge.net Sat Apr 13 06:21:49 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 22:21:49 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3272/python/Objects Modified Files: frameobject.c Log Message: SF bug 543148: Memory leak with stackframes + inspect. Put a bound on the number of frameobjects that can live in the frameobject free_list. Am also backporting to 2.2. I don't intend to backport to 2.1 (too much work -- lots of cyclic structures leak there, and the GC API). Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** frameobject.c 28 Mar 2002 20:34:59 -0000 2.60 --- frameobject.c 13 Apr 2002 05:21:47 -0000 2.61 *************** *** 57,63 **** --- 57,69 ---- call depth of more than 20 or 30 is probably already exceptional unless the program contains run-away recursion. I hope. + + Later, MAXFREELIST was added to bound the # of frames saved on + free_list. Else programs creating lots of cyclic trash involving + frames could provoke free_list into growing without bound. */ static PyFrameObject *free_list = NULL; + static int numfree = 0; /* number of frames currently in free_list */ + #define MAXFREELIST 200 /* max value for numfree */ static void *************** *** 92,97 **** Py_XDECREF(f->f_exc_value); Py_XDECREF(f->f_exc_traceback); ! f->f_back = free_list; ! free_list = f; Py_TRASHCAN_SAFE_END(f) } --- 98,108 ---- Py_XDECREF(f->f_exc_value); Py_XDECREF(f->f_exc_traceback); ! if (numfree < MAXFREELIST) { ! ++numfree; ! f->f_back = free_list; ! free_list = f; ! } ! else ! PyObject_GC_Del(f); Py_TRASHCAN_SAFE_END(f) } *************** *** 246,249 **** --- 257,262 ---- } else { + assert(numfree > 0); + --numfree; f = free_list; free_list = free_list->f_back; *************** *** 476,479 **** --- 489,494 ---- free_list = free_list->f_back; PyObject_GC_Del(f); + --numfree; } + assert(numfree == 0); } From tim_one@sourceforge.net Sat Apr 13 06:25:30 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 22:25:30 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.20,1.337.2.4.2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv3938/221/Misc Modified Files: Tag: release22-maint NEWS Log Message: SF bug 543148: Memory leak with stackframes + inspect. Put a bound on the number of frameobjects that can live in the frameobject free_list. Also fixed on the trunk. I don't intend to backport to 2.1 (too much work -- lots of cyclic structures leak there). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.20 retrieving revision 1.337.2.4.2.21 diff -C2 -d -r1.337.2.4.2.20 -r1.337.2.4.2.21 *** NEWS 9 Apr 2002 14:21:43 -0000 1.337.2.4.2.20 --- NEWS 13 Apr 2002 05:25:28 -0000 1.337.2.4.2.21 *************** *** 1,2 **** --- 1,21 ---- + What's New in Python 2.2.2? + Release date: dd-mmm-2002 + =========================== + + Core and builtins + + - Repaired a slow memory leak possible only in programs creating a + great many cyclic structures involving frames. Reported on + SourceForge as bug 543148. + + Library + + + C API + + + Windows + + What's New in Python 2.2.1 final? Release date: 10-Apr-2002 From tim_one@sourceforge.net Sat Apr 13 06:25:30 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 12 Apr 2002 22:25:30 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.59.6.1,2.59.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3938/221/Objects Modified Files: Tag: release22-maint frameobject.c Log Message: SF bug 543148: Memory leak with stackframes + inspect. Put a bound on the number of frameobjects that can live in the frameobject free_list. Also fixed on the trunk. I don't intend to backport to 2.1 (too much work -- lots of cyclic structures leak there). Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.59.6.1 retrieving revision 2.59.6.2 diff -C2 -d -r2.59.6.1 -r2.59.6.2 *** frameobject.c 28 Mar 2002 20:36:50 -0000 2.59.6.1 --- frameobject.c 13 Apr 2002 05:25:28 -0000 2.59.6.2 *************** *** 57,63 **** --- 57,69 ---- call depth of more than 20 or 30 is probably already exceptional unless the program contains run-away recursion. I hope. + + Later, MAXFREELIST was added to bound the # of frames saved on + free_list. Else programs creating lots of cyclic trash involving + frames could provoke free_list into growing without bound. */ static PyFrameObject *free_list = NULL; + static int numfree = 0; /* number of frames currently in free_list */ + #define MAXFREELIST 200 /* max value for numfree */ static void *************** *** 92,97 **** Py_XDECREF(f->f_exc_value); Py_XDECREF(f->f_exc_traceback); ! f->f_back = free_list; ! free_list = f; Py_TRASHCAN_SAFE_END(f) } --- 98,108 ---- Py_XDECREF(f->f_exc_value); Py_XDECREF(f->f_exc_traceback); ! if (numfree < MAXFREELIST) { ! ++numfree; ! f->f_back = free_list; ! free_list = f; ! } ! else ! PyObject_GC_Del(f); Py_TRASHCAN_SAFE_END(f) } *************** *** 246,249 **** --- 257,262 ---- } else { + assert(numfree > 0); + --numfree; f = free_list; free_list = free_list->f_back; *************** *** 476,479 **** --- 489,494 ---- free_list = free_list->f_back; PyObject_GC_Del(f); + --numfree; } + assert(numfree == 0); } From tim_one@sourceforge.net Sat Apr 13 09:29:17 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 13 Apr 2002 01:29:17 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.158,2.159 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1392/python/Python Modified Files: pythonrun.c Log Message: _PyObject_DebugDumpStats: renamed to _PyObject_DebugMallocStats. Added code to call this when PYMALLOC_DEBUG is enabled, and envar PYTHONMALLOCSTATS is set, whenever a new arena is obtained and once late in the Python shutdown process. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.158 retrieving revision 2.159 diff -C2 -d -r2.158 -r2.159 *** pythonrun.c 8 Apr 2002 08:19:36 -0000 2.158 --- pythonrun.c 13 Apr 2002 08:29:14 -0000 2.159 *************** *** 277,280 **** --- 277,285 ---- PyGrammar_RemoveAccelerators(&_PyParser_Grammar); + #ifdef PYMALLOC_DEBUG + if (Py_GETENV("PYTHONMALLOCSTATS")) + _PyObject_DebugMallocStats(); + #endif + call_ll_exitfuncs(); From tim_one@sourceforge.net Sat Apr 13 09:29:16 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 13 Apr 2002 01:29:16 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1392/python/Objects Modified Files: obmalloc.c Log Message: _PyObject_DebugDumpStats: renamed to _PyObject_DebugMallocStats. Added code to call this when PYMALLOC_DEBUG is enabled, and envar PYTHONMALLOCSTATS is set, whenever a new arena is obtained and once late in the Python shutdown process. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** obmalloc.c 12 Apr 2002 20:49:36 -0000 2.39 --- obmalloc.c 13 Apr 2002 08:29:14 -0000 2.40 *************** *** 449,452 **** --- 449,457 ---- return NULL; + #ifdef PYMALLOC_DEBUG + if (Py_GETENV("PYTHONMALLOCSTATS")) + _PyObject_DebugMallocStats(); + #endif + /* arenabase <- first pool-aligned address in the arena nfreepools <- number of whole pools that fit after alignment */ *************** *** 1217,1221 **** /* Print summary info to stderr about the state of pymalloc's structures. */ void ! _PyObject_DebugDumpStats(void) { uint i; --- 1222,1226 ---- /* Print summary info to stderr about the state of pymalloc's structures. */ void ! _PyObject_DebugMallocStats(void) { uint i; *************** *** 1246,1251 **** fprintf(stderr, "Small block threshold = %d, in %u size classes.\n", SMALL_REQUEST_THRESHOLD, numclasses); - fprintf(stderr, "pymalloc malloc+realloc called %lu times.\n", - serialno); for (i = 0; i < numclasses; ++i) --- 1251,1254 ---- *************** *** 1313,1316 **** --- 1316,1320 ---- } fputc('\n', stderr); + (void)printone("# times object malloc called", serialno); PyOS_snprintf(buf, sizeof(buf), *************** *** 1321,1324 **** --- 1325,1329 ---- total = printone("# bytes in allocated blocks", allocated_bytes); + total += printone("# bytes in available blocks", available_bytes); PyOS_snprintf(buf, sizeof(buf), *************** *** 1326,1330 **** total += printone(buf, (ulong)numfreepools * POOL_SIZE); - total += printone("# bytes in available blocks", available_bytes); total += printone("# bytes lost to pool headers", pool_header_bytes); total += printone("# bytes lost to quantization", quantization); --- 1331,1334 ---- From tim_one@sourceforge.net Sat Apr 13 09:29:16 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 13 Apr 2002 01:29:16 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1392/python/Include Modified Files: objimpl.h Log Message: _PyObject_DebugDumpStats: renamed to _PyObject_DebugMallocStats. Added code to call this when PYMALLOC_DEBUG is enabled, and envar PYTHONMALLOCSTATS is set, whenever a new arena is obtained and once late in the Python shutdown process. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** objimpl.h 12 Apr 2002 05:21:34 -0000 2.50 --- objimpl.h 13 Apr 2002 08:29:14 -0000 2.51 *************** *** 98,102 **** DL_IMPORT(void) _PyObject_DebugDumpAddress(const void *p); DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); ! DL_IMPORT(void) _PyObject_DebugDumpStats(void); #define PyObject_MALLOC _PyObject_DebugMalloc #define PyObject_Malloc _PyObject_DebugMalloc --- 98,102 ---- DL_IMPORT(void) _PyObject_DebugDumpAddress(const void *p); DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); ! DL_IMPORT(void) _PyObject_DebugMallocStats(void); #define PyObject_MALLOC _PyObject_DebugMalloc #define PyObject_Malloc _PyObject_DebugMalloc From bckfnn@sourceforge.net Sat Apr 13 14:21:26 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sat, 13 Apr 2002 06:21:26 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv19524 Modified Files: asdl.py Log Message: Put the fields of a product in the right order. This matches what is done for a Constructor. Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** asdl.py 10 Apr 2002 03:48:25 -0000 1.5 --- asdl.py 13 Apr 2002 13:21:23 -0000 1.6 *************** *** 142,145 **** --- 142,147 ---- def p_product(self, (_0, fields, _1)): " product ::= ( fields ) " + # XXX can't I just construct things in the right order? + fields.reverse() return Product(fields) From gvanrossum@sourceforge.net Sat Apr 13 15:06:39 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sat, 13 Apr 2002 07:06:39 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29389 Modified Files: descrobject.c Log Message: Fold long lines. (Walter, please take note! :-) Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** descrobject.c 12 Apr 2002 02:41:47 -0000 2.24 --- descrobject.c 13 Apr 2002 14:06:36 -0000 2.25 *************** *** 668,680 **** static PyMethodDef proxy_methods[] = { ! {"has_key", (PyCFunction)proxy_has_key, METH_O, "D.has_key(k) -> 1 if D has a key k, else 0"}, ! {"get", (PyCFunction)proxy_get, METH_VARARGS, "D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None."}, ! {"keys", (PyCFunction)proxy_keys, METH_NOARGS, "D.keys() -> list of D's keys"}, ! {"values", (PyCFunction)proxy_values, METH_NOARGS, "D.values() -> list of D's values"}, ! {"items", (PyCFunction)proxy_items, METH_NOARGS, "D.items() -> list of D's (key, value) pairs, as 2-tuples"}, ! {"iterkeys", (PyCFunction)proxy_iterkeys, METH_NOARGS, "D.iterkeys() -> an iterator over the keys of D"}, ! {"itervalues",(PyCFunction)proxy_itervalues, METH_NOARGS, "D.itervalues() -> an iterator over the values of D"}, ! {"iteritems", (PyCFunction)proxy_iteritems, METH_NOARGS, "D.iteritems() -> an iterator over the (key, value) items of D"}, ! {"copy", (PyCFunction)proxy_copy, METH_NOARGS, "D.copy() -> a shallow copy of D"}, {0} }; --- 668,689 ---- static PyMethodDef proxy_methods[] = { ! {"has_key", (PyCFunction)proxy_has_key, METH_O, ! "D.has_key(k) -> 1 if D has a key k, else 0"}, ! {"get", (PyCFunction)proxy_get, METH_VARARGS, ! "D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None."}, ! {"keys", (PyCFunction)proxy_keys, METH_NOARGS, ! "D.keys() -> list of D's keys"}, ! {"values", (PyCFunction)proxy_values, METH_NOARGS, ! "D.values() -> list of D's values"}, ! {"items", (PyCFunction)proxy_items, METH_NOARGS, ! "D.items() -> list of D's (key, value) pairs, as 2-tuples"}, ! {"iterkeys", (PyCFunction)proxy_iterkeys, METH_NOARGS, ! "D.iterkeys() -> an iterator over the keys of D"}, ! {"itervalues",(PyCFunction)proxy_itervalues, METH_NOARGS, ! "D.itervalues() -> an iterator over the values of D"}, ! {"iteritems", (PyCFunction)proxy_iteritems, METH_NOARGS, ! "D.iteritems() -> an iterator over the (key, value) items of D"}, ! {"copy", (PyCFunction)proxy_copy, METH_NOARGS, ! "D.copy() -> a shallow copy of D"}, {0} }; From gvanrossum@sourceforge.net Sat Apr 13 15:03:41 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sat, 13 Apr 2002 07:03:41 -0700 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28555 Modified Files: UserDict.py Log Message: Add pop() to UserDict. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UserDict.py 5 Nov 2001 17:40:48 -0000 1.16 --- UserDict.py 13 Apr 2002 14:03:38 -0000 1.17 *************** *** 51,54 **** --- 51,56 ---- self[key] = failobj return self[key] + def pop(self, key): + return self.data.pop(key) def popitem(self): return self.data.popitem() From nnorwitz@sourceforge.net Sat Apr 13 15:41:22 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sat, 13 Apr 2002 07:41:22 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5598/Lib Modified Files: random.py Log Message: BDFL agreed with Tim: rehabilitate randint(). Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** random.py 25 Nov 2001 21:12:43 -0000 1.26 --- random.py 13 Apr 2002 14:41:19 -0000 1.27 *************** *** 316,321 **** def randint(self, a, b): """Return random integer in range [a, b], including both end points. - - (Deprecated; use randrange(a, b+1).) """ --- 316,319 ---- From jackjansen@sourceforge.net Sat Apr 13 23:16:51 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sat, 13 Apr 2002 15:16:51 -0700 Subject: [Python-checkins] python/nondist/peps pep-0278.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28129 Modified Files: pep-0278.txt Log Message: - Fixed a typo - Return a tuple of newlines in stead of 'mixed' - Added rationale for having the code in ifdefs and not having the newlines attribute in --without-universal-newlines builds. Index: pep-0278.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0278.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0278.txt 11 Apr 2002 15:44:08 -0000 1.6 --- pep-0278.txt 13 Apr 2002 22:16:49 -0000 1.7 *************** *** 31,35 **** Specification ! Universal newline support needs to be enabled by default, but can be disabled during the configure of Python. --- 31,35 ---- Specification ! Universal newline support is enabled by default, but can be disabled during the configure of Python. *************** *** 50,60 **** There is no special support for output to file with a different ! newline convention. A file object that has been opened in universal newline mode gets a new attribute "newlines" which reflects the newline convention used in the file. The value for this attribute is one of None (no ! newline read yet), "\r", "\n", "\r\n" or "mixed" (multiple ! different types of newlines seen). --- 50,60 ---- There is no special support for output to file with a different ! newline convention, and so mode "wU" is also illegal. A file object that has been opened in universal newline mode gets a new attribute "newlines" which reflects the newline convention used in the file. The value for this attribute is one of None (no ! newline read yet), "\r", "\n", "\r\n" or a tuple containing all the ! newline types seen. *************** *** 162,165 **** --- 162,175 ---- fgets() or fread() replacement routines, just some integer-valued flags, so the chances of core dumps are zero (he said:-). + + Universal newline support can be disabled during configure because it does + have a small performance penalty, and moreover the implementation has + not been tested on all concievable platforms yet. It might also be silly + on some platforms (WinCE or Palm devices, for instance). If universal + newline support is not enabled then file objects do not have the "newlines" + attribute, so testing whether the current Python has it can be done with a + simple + if hasattr(sys.stdout, 'newlines'): + print 'We have universal newline support' From bckfnn@sourceforge.net Sun Apr 14 10:23:03 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 14 Apr 2002 02:23:03 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv14173 Modified Files: python.asdl Log Message: Refactored 'Import' and 'ImportFrom' to support 'as' alias in both import statements. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** python.asdl 11 Apr 2002 21:20:19 -0000 1.9 --- python.asdl 14 Apr 2002 09:23:01 -0000 1.10 *************** *** 28,39 **** | Assert(expr test, expr? msg) ! -- may want to factor this differently perhaps excluding ! -- 'as' from the type because can mix name and alias w/ from ! -- also need import * ! | Import(identifier* names) ! | ImportAs(identifier name, identifier alias) ! | ImportFrom(identifier module, identifier* names) ! | ImportFromAs(identifier module, identifier name, ! identifier alias) -- Doesn't capture requirement that locals must be --- 28,33 ---- | Assert(expr test, expr? msg) ! | Import(alias* names) ! | ImportFrom(identifier module, alias* names) -- Doesn't capture requirement that locals must be *************** *** 97,99 **** -- keyword arguments supplied to call keyword = (identifier arg, expr value) ! } \ No newline at end of file --- 91,96 ---- -- keyword arguments supplied to call keyword = (identifier arg, expr value) ! ! -- import name with optional 'as' alias. ! alias = (identifier name, identifier? asname) ! } From loewis@sourceforge.net Sun Apr 14 10:53:53 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 02:53:53 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.239,2.240 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv21770 Modified Files: compile.c Log Message: Patch #542659: Eliminate duplicate check for NULL of freevars/cellvars. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.239 retrieving revision 2.240 diff -C2 -d -r2.239 -r2.240 *** compile.c 3 Mar 2002 21:30:27 -0000 2.239 --- compile.c 14 Apr 2002 09:53:49 -0000 2.240 *************** *** 287,295 **** intern_strings(names); intern_strings(varnames); - if (freevars == NULL) - freevars = PyTuple_New(0); intern_strings(freevars); - if (cellvars == NULL) - cellvars = PyTuple_New(0); intern_strings(cellvars); /* Intern selected string constants */ --- 287,291 ---- From bckfnn@sourceforge.net Sun Apr 14 11:10:05 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 14 Apr 2002 03:10:05 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv25858 Modified Files: python.asdl Log Message: Added orelse to TryExcept and body to except. Made name an assign'able. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** python.asdl 14 Apr 2002 09:23:01 -0000 1.10 --- python.asdl 14 Apr 2002 10:10:02 -0000 1.11 *************** *** 24,28 **** -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmt* body, except* handlers) | TryFinally(stmt* body, stmt* finalbody) | Assert(expr test, expr? msg) --- 24,28 ---- -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) ! | TryExcept(stmt* body, except* handlers, stmt* orelse) | TryFinally(stmt* body, stmt* finalbody) | Assert(expr test, expr? msg) *************** *** 83,87 **** -- not sure what to call the first argument for raise and except ! except = (expr type, identifier? name) -- XXX need to handle 'def f((a, b)):' --- 83,87 ---- -- not sure what to call the first argument for raise and except ! except = (expr? type, assign? name, stmt* body) -- XXX need to handle 'def f((a, b)):' From bckfnn@sourceforge.net Sun Apr 14 11:18:01 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 14 Apr 2002 03:18:01 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_java.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv27998 Added Files: asdl_java.py Log Message: Initial revision of the codegenerator for the jython AST classes. --- NEW FILE: asdl_java.py --- """Generate C code from an ASDL description.""" # TO DO # handle fields that have a type but no name import os, sys, traceback import asdl TABSIZE = 4 MAX_COL = 76 def reflow_lines(s, depth): """Reflow the line s indented depth tabs. Return a sequence of lines where no line extends beyond MAX_COL when properly indented. The first line is properly indented based exclusively on depth * TABSIZE. All following lines -- these are the reflowed lines generated by this function -- start at the same column as the first character beyond the opening { in the first line. """ size = MAX_COL - depth * TABSIZE if len(s) < size: return [s] lines = [] cur = s padding = "" while len(cur) > size: i = cur.rfind(' ', 0, size) assert i != -1, "Impossible line to reflow: %s" % `line` lines.append(padding + cur[:i]) if len(lines) == 1: # find new size based on brace j = cur.find('{', 0, i) if j >= 0: j += 2 # account for the brace and the space after it size -= j padding = " " * j cur = cur[i+1:] else: lines.append(padding + cur) return lines class EmitVisitor(asdl.VisitorBase): """Visit that emits lines""" def __init__(self): super(EmitVisitor, self).__init__() def open(self, name): self.file = open("%s.java" % name, "wb") print >> self.file, 'package org.python.p2.ast;' print >> self.file, 'import org.python.p2.SimpleNode;' def close(self): self.file.close() def emit(self, s, depth): # XXX reflow long lines? lines = reflow_lines(s, depth) for line in lines: line = (" " * TABSIZE * depth) + line + "\n" self.file.write(line) # This step will add a 'simple' boolean attribute to all Sum and Product # nodes and add a 'typedef' link to each Field node that points to the # Sum or Product node that defines the field. class AnalyzeVisitor(EmitVisitor): def visitModule(self, mod): self.types = {} for dfn in mod.dfns: self.types[str(dfn.name)] = dfn.value for dfn in mod.dfns: self.visit(dfn) def visitType(self, type, depth=0): self.visit(type.value, type.name, depth) def visitSum(self, sum, name, depth): sum.simple = 1 for t in sum.types: if t.fields: sum.simple = 0 break for t in sum.types: self.visit(t, name, depth) def visitProduct(self, product, name, depth): product.simple = 0 for f in product.fields: self.visit(f, depth + 1) def visitConstructor(self, cons, name, depth): for f in cons.fields: self.visit(f, depth + 1) def visitField(self, field, depth): field.typedef = self.types.get(str(field.type)) # The code generator itself. # class JavaVisitor(EmitVisitor): def visitModule(self, mod): for dfn in mod.dfns: self.visit(dfn) def visitType(self, type, depth=0): self.visit(type.value, type.name, depth) def visitSum(self, sum, name, depth): if sum.simple: self.simple_sum(sum, name, depth) else: self.sum_with_constructor(sum, name, depth) def simple_sum(self, sum, name, depth): self.open("%sType" % name) self.emit("public interface %(name)sType {" % locals(), depth) for i in range(len(sum.types)): type = sum.types[i] self.emit("public static final int %s = %d;" % (type.name, i+1), depth + 1) self.emit("}", depth) self.close() def sum_with_constructor(self, sum, name, depth): self.open("%sType" % name) self.emit("public abstract class %(name)sType extends SimpleNode {" % locals(), depth) self.emit("}", depth) self.close() for t in sum.types: self.visit(t, name, depth) def visitProduct(self, product, name, depth): self.open("%sType" % name) self.emit("public class %(name)sType extends SimpleNode {" % locals(), depth) for f in product.fields: self.visit(f, depth + 1) self.emit("", depth); self.javaMethods(name, "%sType" % name, product.fields, depth+1) self.emit("}", depth) self.close() def visitConstructor(self, cons, name, depth): self.open(cons.name) enums = [] for f in cons.fields: if f.typedef and f.typedef.simple: enums.append("%sType" % f.type) if enums: s = "implements %s " % ", ".join(enums) else: s = "" self.emit("public class %s extends %sType %s{" % (cons.name, name, s), depth) for f in cons.fields: self.visit(f, depth + 1) self.emit("", depth) self.javaMethods(cons.name, cons.name, cons.fields, depth+1) self.emit("}", depth) self.close() def javaMethods(self, clsname, ctorname, fields, depth): # The java ctor self.emit("public %s(%s) {" % (ctorname, ", ".join([self.fieldDef(f) for f in fields])), depth) for f in fields: self.emit("this.%s = %s;" % (f.name, f.name), depth+1) self.emit("}", depth) # The toString() method self.emit("public String toString() {", depth) self.emit('StringBuffer sb = new StringBuffer("%s[");' % clsname, depth+1) for f in fields: self.emit('sb.append("%s=");' % f.name, depth+1); self.emit("sb.append(dumpThis(this.%s));" % f.name, depth+1) if f != fields[-1]: self.emit('sb.append(", ");', depth+1) self.emit('sb.append("]");', depth+1) self.emit("return sb.toString();", depth+1) self.emit("}", depth) def visitField(self, field, depth): self.emit("public %s;" % self.fieldDef(field), depth) bltinnames = { 'bool' : 'boolean', 'identifier' : 'String', 'string' : 'String', } def fieldDef(self, field): jtype = str(field.type) if field.typedef and field.typedef.simple: jtype = 'int' else: jtype = self.bltinnames.get(jtype, jtype + 'Type') name = field.name seq = field.seq and "[]" or "" return "%(jtype)s%(seq)s %(name)s" % locals() class ChainOfVisitors: def __init__(self, *visitors): self.visitors = visitors def visit(self, object): for v in self.visitors: v.visit(object) if __name__ == "__main__": import sys mod = asdl.parse(sys.argv[1]) if not asdl.check(mod): sys.exit(1) c = ChainOfVisitors(AnalyzeVisitor(), JavaVisitor()) c.visit(mod) From loewis@sourceforge.net Sun Apr 14 11:19:45 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 03:19:45 -0700 Subject: [Python-checkins] python/dist/src configure,1.297,1.298 configure.in,1.307,1.308 pyconfig.h.in,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv28399 Modified Files: configure configure.in pyconfig.h.in Log Message: Patch #543447: Add posix.mknod. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.297 retrieving revision 1.298 diff -C2 -d -r1.297 -r1.298 *** configure 12 Apr 2002 17:25:15 -0000 1.297 --- configure 14 Apr 2002 10:19:40 -0000 1.298 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.306 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.307 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 11246,11253 **** for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ ! hstrerror inet_pton kill killpg link lstat mkfifo mktime mremap \ nice pathconf pause plock poll pthread_init \ putenv readlink \ --- 11246,11254 ---- + for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ ! hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ nice pathconf pause plock poll pthread_init \ putenv readlink \ Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.307 retrieving revision 1.308 diff -C2 -d -r1.307 -r1.308 *** configure.in 12 Apr 2002 17:25:21 -0000 1.307 --- configure.in 14 Apr 2002 10:19:42 -0000 1.308 *************** *** 1569,1573 **** flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ ! hstrerror inet_pton kill killpg link lstat mkfifo mktime mremap \ nice pathconf pause plock poll pthread_init \ putenv readlink \ --- 1569,1573 ---- flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ ! hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ nice pathconf pause plock poll pthread_init \ putenv readlink \ Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** pyconfig.h.in 12 Apr 2002 09:58:45 -0000 1.28 --- pyconfig.h.in 14 Apr 2002 10:19:43 -0000 1.29 *************** *** 261,264 **** --- 261,267 ---- #undef HAVE_MKFIFO + /* Define to 1 if you have the `mknod' function. */ + #undef HAVE_MKNOD + /* Define to 1 if you have the `mktime' function. */ #undef HAVE_MKTIME From loewis@sourceforge.net Sun Apr 14 11:19:46 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 03:19:46 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.385,1.386 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28399/Misc Modified Files: NEWS Log Message: Patch #543447: Add posix.mknod. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.385 retrieving revision 1.386 diff -C2 -d -r1.385 -r1.386 *** NEWS 13 Apr 2002 00:59:05 -0000 1.385 --- NEWS 14 Apr 2002 10:19:43 -0000 1.386 *************** *** 57,60 **** --- 57,62 ---- Extension modules + - posix.mknod was added. + - The locale module now exposes the C library's gettext interface. From loewis@sourceforge.net Sun Apr 14 11:19:45 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 03:19:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28399/Doc/lib Modified Files: libos.tex Log Message: Patch #543447: Add posix.mknod. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** libos.tex 1 Apr 2002 23:30:47 -0000 1.78 --- libos.tex 14 Apr 2002 10:19:43 -0000 1.79 *************** *** 645,648 **** --- 645,659 ---- \end{funcdesc} + \begin{funcdesc}{mknod}{path\optional{, mode=0600, major, minor}} + Create a filesystem node (file, device special file or named pipe) + named filename. mode specifies both the permissions to use and the + type of node to be created, being combined (bitwise OR) with one of + S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO (those constants are available + in \module{stat}). For S_IFCHR and S_IFBLK, major and minor define the + newly created device special file, otherwise they are ignored. + + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{mkdir}{path\optional{, mode}} Create a directory named \var{path} with numeric mode \var{mode}. From loewis@sourceforge.net Sun Apr 14 11:19:46 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 03:19:46 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.227,2.228 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv28399/Modules Modified Files: posixmodule.c Log Message: Patch #543447: Add posix.mknod. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.227 retrieving revision 2.228 diff -C2 -d -r2.227 -r2.228 *** posixmodule.c 3 Apr 2002 01:47:00 -0000 2.227 --- posixmodule.c 14 Apr 2002 10:19:44 -0000 2.228 *************** *** 4583,4587 **** #ifdef HAVE_MKFIFO static char posix_mkfifo__doc__[] = ! "mkfifo(file, [, mode=0666]) -> None\n\ Create a FIFO (a POSIX named pipe)."; --- 4583,4587 ---- #ifdef HAVE_MKFIFO static char posix_mkfifo__doc__[] = ! "mkfifo(filename, [, mode=0666]) -> None\n\ Create a FIFO (a POSIX named pipe)."; *************** *** 4589,4599 **** posix_mkfifo(PyObject *self, PyObject *args) { ! char *file; int mode = 0666; int res; ! if (!PyArg_ParseTuple(args, "s|i:mkfifo", &file, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS ! res = mkfifo(file, mode); Py_END_ALLOW_THREADS if (res < 0) --- 4589,4632 ---- posix_mkfifo(PyObject *self, PyObject *args) { ! char *filename; int mode = 0666; int res; ! if (!PyArg_ParseTuple(args, "s|i:mkfifo", &filename, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS ! res = mkfifo(filename, mode); ! Py_END_ALLOW_THREADS ! if (res < 0) ! return posix_error(); ! Py_INCREF(Py_None); ! return Py_None; ! } ! #endif ! ! ! #ifdef HAVE_MKNOD ! static char posix_mknod__doc__[] = ! "mknod(filename, [, mode=0600, major, minor]) -> None\n\ ! Create a filesystem node (file, device special file or named pipe)\n\ ! named filename. mode specifies both the permissions to use and the\n\ ! type of node to be created, being combined (bitwise OR) with one of\n\ ! S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,\n\ ! major and minor define the newly created device special file, otherwise\n\ ! they are ignored."; ! ! ! static PyObject * ! posix_mknod(PyObject *self, PyObject *args) ! { ! char *filename; ! int mode = 0600; ! int major = 0; ! int minor = 0; ! int res; ! if (!PyArg_ParseTuple(args, "s|iii:mknod", &filename, ! &mode, &major, &minor)) ! return NULL; ! Py_BEGIN_ALLOW_THREADS ! res = mknod(filename, mode, makedev(major, minor)); Py_END_ALLOW_THREADS if (res < 0) *************** *** 6336,6339 **** --- 6369,6375 ---- #ifdef HAVE_MKFIFO {"mkfifo", posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__}, + #endif + #ifdef HAVE_MKNOD + {"mknod", posix_mknod, METH_VARARGS, posix_mknod__doc__}, #endif #ifdef HAVE_FTRUNCATE From loewis@sourceforge.net Sun Apr 14 11:22:31 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 03:22:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bool.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29214 Modified Files: test_bool.py Log Message: Patch #542569: tp_print tp_repr tp_str in test_bool.py. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_bool.py 5 Apr 2002 20:57:02 -0000 1.3 --- test_bool.py 14 Apr 2002 10:22:29 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- from test_support import verbose, TestFailed, TESTFN, vereq + import os def veris(a, b): *************** *** 26,29 **** --- 27,47 ---- raise TestFailed, "should not be able to create new bool instances" + # checking tp_print slot + fo = open(TESTFN, "wb") + print >> fo, False, True + fo.close() + fo = open(TESTFN, "rb") + vereq(fo.read(), 'False True\n') + fo.close() + os.remove(TESTFN) + + # checking repr and str + vereq(str(False), 'False') + vereq(str(True), 'True') + vereq(repr(False), 'False') + vereq(repr(True), 'True') + vereq(eval(repr(False)), False) + vereq(eval(repr(True)), True) + vereq(int(False), 0) verisnot(int(False), False) *************** *** 186,190 **** f.close() veris(f.closed, True) - import os os.remove(TESTFN) --- 204,207 ---- From loewis@sourceforge.net Sun Apr 14 11:30:53 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 14 Apr 2002 03:30:53 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle EditorWindow.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv30999 Modified Files: EditorWindow.py Log Message: Patch #540583: Open MS Help Docs if available. Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/EditorWindow.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** EditorWindow.py 4 Apr 2002 22:55:58 -0000 1.40 --- EditorWindow.py 14 Apr 2002 10:30:51 -0000 1.41 *************** *** 295,306 **** if sys.platform[:3] == "win": fn = os.path.dirname(__file__) ! fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html") fn = os.path.normpath(fn) if os.path.isfile(fn): help_url = fn del fn ! def python_docs(self, event=None): ! webbrowser.open(self.help_url) def select_all(self, event=None): --- 295,315 ---- if sys.platform[:3] == "win": fn = os.path.dirname(__file__) ! fn = os.path.join(fn, os.pardir, os.pardir, "pythlp.chm") fn = os.path.normpath(fn) if os.path.isfile(fn): help_url = fn + else: + fn = os.path.dirname(__file__) + fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html") + fn = os.path.normpath(fn) + if os.path.isfile(fn): + help_url = fn del fn ! def python_docs(self, event=None): ! os.startfile(self.help_url) ! else: ! def python_docs(self, event=None): ! webbrowser.open(self.help_url) def select_all(self, event=None): From jackjansen@sourceforge.net Sun Apr 14 21:12:42 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:12:42 -0700 Subject: [Python-checkins] python/dist/src/Lib linecache.py,1.8,1.9 py_compile.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1748/Lib Modified Files: linecache.py py_compile.py Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: linecache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/linecache.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** linecache.py 29 May 2001 04:27:01 -0000 1.8 --- linecache.py 14 Apr 2002 20:12:39 -0000 1.9 *************** *** 91,95 **** return [] try: ! fp = open(fullname, 'r') lines = fp.readlines() fp.close() --- 91,95 ---- return [] try: ! fp = open(fullname, 'rU') lines = fp.readlines() fp.close() Index: py_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/py_compile.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** py_compile.py 12 Feb 2001 02:00:42 -0000 1.18 --- py_compile.py 14 Apr 2002 20:12:40 -0000 1.19 *************** *** 45,49 **** """ import os, marshal, __builtin__ ! f = open(file) try: timestamp = long(os.fstat(f.fileno())[8]) --- 45,49 ---- """ import os, marshal, __builtin__ ! f = open(file, 'U') try: timestamp = long(os.fstat(f.fileno())[8]) From jackjansen@sourceforge.net Sun Apr 14 21:12:42 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:12:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macmain.c,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv1748/Mac/Python Modified Files: macmain.c Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: macmain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macmain.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** macmain.c 11 Apr 2002 20:48:08 -0000 1.76 --- macmain.c 14 Apr 2002 20:12:40 -0000 1.77 *************** *** 612,616 **** if (filename != NULL) { ! if ((fp = fopen(filename, "r")) == NULL) { fprintf(stderr, "%s: can't open file '%s'\n", argv[0], filename); --- 612,616 ---- if (filename != NULL) { ! if ((fp = fopen(filename, "r" PY_STDIOTEXTMODE)) == NULL) { fprintf(stderr, "%s: can't open file '%s'\n", argv[0], filename); *************** *** 631,635 **** if (filename == NULL && isatty((int)fileno(fp))) { ! FILE *fp = fopen(STARTUP, "r"); if (fp != NULL) { (void) PyRun_SimpleFile(fp, STARTUP); --- 631,635 ---- if (filename == NULL && isatty((int)fileno(fp))) { ! FILE *fp = fopen(STARTUP, "r" PY_STDIOTEXTMODE); if (fp != NULL) { (void) PyRun_SimpleFile(fp, STARTUP); From jackjansen@sourceforge.net Sun Apr 14 21:12:43 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:12:43 -0700 Subject: [Python-checkins] python/dist/src/Parser pgenmain.c,2.24,2.25 tokenizer.c,2.53,2.54 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv1748/Parser Modified Files: pgenmain.c tokenizer.c Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: pgenmain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/pgenmain.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** pgenmain.c 11 Sep 2001 16:43:16 -0000 2.24 --- pgenmain.c 14 Apr 2002 20:12:41 -0000 2.25 *************** *** 14,17 **** --- 14,18 ---- */ + #include "Python.h" #include "pgenheaders.h" #include "grammar.h" *************** *** 182,185 **** --- 183,196 ---- return PyMem_REALLOC(p, n+1); } + + #ifdef WITH_UNIVERSAL_NEWLINES + /* No-nonsense fgets */ + char * + Py_UniversalNewlineFgets(char *buf, int n, FILE *stream, PyObject *fobj) + { + return fgets(buf, n, stream); + } + #endif + #include Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** tokenizer.c 30 Aug 2001 20:51:59 -0000 2.53 --- tokenizer.c 14 Apr 2002 20:12:41 -0000 2.54 *************** *** 2,5 **** --- 2,6 ---- /* Tokenizer implementation */ + #include "Python.h" #include "pgenheaders.h" *************** *** 246,251 **** tok->end = tok->buf + BUFSIZ; } ! if (fgets(tok->buf, (int)(tok->end - tok->buf), ! tok->fp) == NULL) { tok->done = E_EOF; done = 1; --- 247,252 ---- tok->end = tok->buf + BUFSIZ; } ! if (Py_UniversalNewlineFgets(tok->buf, (int)(tok->end - tok->buf), ! tok->fp, NULL) == NULL) { tok->done = E_EOF; done = 1; *************** *** 285,291 **** tok->start = curstart < 0 ? NULL : tok->buf + curstart; ! if (fgets(tok->inp, (int)(tok->end - tok->inp), ! tok->fp) == NULL) { /* Last line does not end in \n, fake one */ --- 286,292 ---- tok->start = curstart < 0 ? NULL : tok->buf + curstart; ! if (Py_UniversalNewlineFgets(tok->inp, (int)(tok->end - tok->inp), ! tok->fp, NULL) == NULL) { /* Last line does not end in \n, fake one */ From jackjansen@sourceforge.net Sun Apr 14 21:12:43 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:12:43 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.250,2.251 errors.c,2.68,2.69 import.c,2.200,2.201 traceback.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1748/Python Modified Files: bltinmodule.c errors.c import.c traceback.c Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.250 retrieving revision 2.251 diff -C2 -d -r2.250 -r2.251 *** bltinmodule.c 3 Apr 2002 22:41:51 -0000 2.250 --- bltinmodule.c 14 Apr 2002 20:12:41 -0000 2.251 *************** *** 595,599 **** if (exists) { Py_BEGIN_ALLOW_THREADS ! fp = fopen(filename, "r"); Py_END_ALLOW_THREADS --- 595,599 ---- if (exists) { Py_BEGIN_ALLOW_THREADS ! fp = fopen(filename, "r" PY_STDIOTEXTMODE); Py_END_ALLOW_THREADS Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** errors.c 9 Mar 2002 12:07:51 -0000 2.68 --- errors.c 14 Apr 2002 20:12:41 -0000 2.69 *************** *** 647,651 **** if (filename == NULL || lineno <= 0) return NULL; ! fp = fopen(filename, "r"); if (fp == NULL) return NULL; --- 647,651 ---- if (filename == NULL || lineno <= 0) return NULL; ! fp = fopen(filename, "r" PY_STDIOTEXTMODE); if (fp == NULL) return NULL; *************** *** 654,658 **** do { *pLastChar = '\0'; ! if (fgets(linebuf, sizeof linebuf, fp) == NULL) break; /* fgets read *something*; if it didn't get as --- 654,658 ---- do { *pLastChar = '\0'; ! if (Py_UniversalNewlineFgets(linebuf, sizeof linebuf, fp, NULL) == NULL) break; /* fgets read *something*; if it didn't get as Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.200 retrieving revision 2.201 diff -C2 -d -r2.200 -r2.201 *** import.c 11 Apr 2002 20:46:23 -0000 2.200 --- import.c 14 Apr 2002 20:12:41 -0000 2.201 *************** *** 82,86 **** #ifdef RISCOS static const struct filedescr _PyImport_StandardFiletab[] = { ! {"/py", "r", PY_SOURCE}, {"/pyc", "rb", PY_COMPILED}, {0, 0} --- 82,86 ---- #ifdef RISCOS static const struct filedescr _PyImport_StandardFiletab[] = { ! {"/py", "r" PY_STDIOTEXTMODE, PY_SOURCE}, {"/pyc", "rb", PY_COMPILED}, {0, 0} *************** *** 88,94 **** #else static const struct filedescr _PyImport_StandardFiletab[] = { ! {".py", "r", PY_SOURCE}, #ifdef MS_WIN32 ! {".pyw", "r", PY_SOURCE}, #endif {".pyc", "rb", PY_COMPILED}, --- 88,94 ---- #else static const struct filedescr _PyImport_StandardFiletab[] = { ! {".py", "r" PY_STDIOTEXTMODE, PY_SOURCE}, #ifdef MS_WIN32 ! {".pyw", "r" PY_STDIOTEXTMODE, PY_SOURCE}, #endif {".pyc", "rb", PY_COMPILED}, Index: traceback.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/traceback.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** traceback.c 29 Mar 2002 03:07:29 -0000 2.37 --- traceback.c 14 Apr 2002 20:12:41 -0000 2.38 *************** *** 156,160 **** #define FMT " File \"%.500s\", line %d, in %.500s\n" #endif ! xfp = fopen(filename, "r"); if (xfp == NULL) { /* Search tail of filename in sys.path before giving up */ --- 156,160 ---- #define FMT " File \"%.500s\", line %d, in %.500s\n" #endif ! xfp = fopen(filename, "r" PY_STDIOTEXTMODE); if (xfp == NULL) { /* Search tail of filename in sys.path before giving up */ *************** *** 187,191 **** namebuf[len++] = SEP; strcpy(namebuf+len, tail); ! xfp = fopen(namebuf, "r"); if (xfp != NULL) { filename = namebuf; --- 187,191 ---- namebuf[len++] = SEP; strcpy(namebuf+len, tail); ! xfp = fopen(namebuf, "r" PY_STDIOTEXTMODE); if (xfp != NULL) { filename = namebuf; *************** *** 204,208 **** do { *pLastChar = '\0'; ! if (fgets(linebuf, sizeof linebuf, xfp) == NULL) break; /* fgets read *something*; if it didn't get as --- 204,208 ---- do { *pLastChar = '\0'; ! if (Py_UniversalNewlineFgets(linebuf, sizeof linebuf, xfp, NULL) == NULL) break; /* fgets read *something*; if it didn't get as From jackjansen@sourceforge.net Sun Apr 14 21:12:43 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:12:43 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.157,2.158 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1748/Objects Modified Files: fileobject.c Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.157 retrieving revision 2.158 diff -C2 -d -r2.157 -r2.158 *** fileobject.c 12 Apr 2002 02:43:31 -0000 2.157 --- fileobject.c 14 Apr 2002 20:12:40 -0000 2.158 *************** *** 38,41 **** --- 38,58 ---- #endif + #ifdef HAVE_GETC_UNLOCKED + #define GETC(f) getc_unlocked(f) + #define FLOCKFILE(f) flockfile(f) + #define FUNLOCKFILE(f) funlockfile(f) + #else + #define GETC(f) getc(f) + #define FLOCKFILE(f) + #define FUNLOCKFILE(f) + #endif + + #ifdef WITH_UNIVERSAL_NEWLINES + /* Bits in f_newlinetypes */ + #define NEWLINE_UNKNOWN 0 /* No newline seen, yet */ + #define NEWLINE_CR 1 /* \r newline seen */ + #define NEWLINE_LF 2 /* \n newline seen */ + #define NEWLINE_CRLF 4 /* \r\n newline seen */ + #endif FILE * *************** *** 100,103 **** --- 117,125 ---- f->f_softspace = 0; f->f_binary = strchr(mode,'b') != NULL; + #ifdef WITH_UNIVERSAL_NEWLINES + f->f_univ_newline = (strchr(mode, 'U') != NULL); + f->f_newlinetypes = NEWLINE_UNKNOWN; + f->f_skipnextlf = 0; + #endif if (f->f_name == NULL || f->f_mode == NULL) *************** *** 135,138 **** --- 157,171 ---- { Py_BEGIN_ALLOW_THREADS + #ifdef WITH_UNIVERSAL_NEWLINES + if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0) + mode = "rb"; + #else + /* Compatibility: specifying U in a Python without universal + ** newlines is allowed, and the file is opened as a normal text + ** file. + */ + if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0) + mode = "r"; + #endif f->f_fp = fopen(name, mode); Py_END_ALLOW_THREADS *************** *** 395,398 **** --- 428,434 ---- return NULL; } + #ifdef WITH_UNIVERSAL_NEWLINES + f->f_skipnextlf = 0; + #endif Py_INCREF(Py_None); return Py_None; *************** *** 535,538 **** --- 571,584 ---- return NULL; } + #ifdef WITH_UNIVERSAL_NEWLINES + if (f->f_skipnextlf) { + int c; + c = GETC(f->f_fp); + if (c == '\n') { + pos++; + f->f_skipnextlf = 0; + } else if (c != EOF) ungetc(c, f->f_fp); + } + #endif #if !defined(HAVE_LARGEFILE_SUPPORT) return PyInt_FromLong(pos); *************** *** 666,671 **** Py_BEGIN_ALLOW_THREADS errno = 0; ! chunksize = fread(BUF(v) + bytesread, 1, ! buffersize - bytesread, f->f_fp); Py_END_ALLOW_THREADS if (chunksize == 0) { --- 712,717 ---- Py_BEGIN_ALLOW_THREADS errno = 0; ! chunksize = Py_UniversalNewlineFread(BUF(v) + bytesread, ! buffersize - bytesread, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS if (chunksize == 0) { *************** *** 706,710 **** Py_BEGIN_ALLOW_THREADS errno = 0; ! nnow = fread(ptr+ndone, 1, ntodo, f->f_fp); Py_END_ALLOW_THREADS if (nnow == 0) { --- 752,756 ---- Py_BEGIN_ALLOW_THREADS errno = 0; ! nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS if (nnow == 0) { *************** *** 935,948 **** */ - #ifdef HAVE_GETC_UNLOCKED - #define GETC(f) getc_unlocked(f) - #define FLOCKFILE(f) flockfile(f) - #define FUNLOCKFILE(f) funlockfile(f) - #else - #define GETC(f) getc(f) - #define FLOCKFILE(f) - #define FUNLOCKFILE(f) - #endif - static PyObject * get_line(PyFileObject *f, int n) --- 981,984 ---- *************** *** 955,961 **** size_t increment; /* amount to increment the buffer */ PyObject *v; ! #ifdef USE_FGETS_IN_GETLINE if (n <= 0) return getline_via_fgets(fp); #endif --- 991,1006 ---- size_t increment; /* amount to increment the buffer */ PyObject *v; + #ifdef WITH_UNIVERSAL_NEWLINES + int newlinetypes = f->f_newlinetypes; + int skipnextlf = f->f_skipnextlf; + int univ_newline = f->f_univ_newline; + #endif ! #if defined(USE_FGETS_IN_GETLINE) ! #ifdef WITH_UNIVERSAL_NEWLINES ! if (n <= 0 && !univ_newline ) ! #else if (n <= 0) + #endif return getline_via_fgets(fp); #endif *************** *** 970,973 **** --- 1015,1047 ---- Py_BEGIN_ALLOW_THREADS FLOCKFILE(fp); + #ifdef WITH_UNIVERSAL_NEWLINES + if (univ_newline) { + c = 'x'; /* Shut up gcc warning */ + while ( buf != end && (c = GETC(fp)) != EOF ) { + if (skipnextlf ) { + skipnextlf = 0; + if (c == '\n') { + /* Seeing a \n here with skipnextlf true + ** means we saw a \r before. + */ + newlinetypes |= NEWLINE_CRLF; + c = GETC(fp); + if (c == EOF) break; + } else { + newlinetypes |= NEWLINE_CR; + } + } + if (c == '\r') { + skipnextlf = 1; + c = '\n'; + } else if ( c == '\n') + newlinetypes |= NEWLINE_LF; + *buf++ = c; + if (c == '\n') break; + } + if ( c == EOF && skipnextlf ) + newlinetypes |= NEWLINE_CR; + } else /* If not universal newlines use the normal loop */ + #endif while ((c = GETC(fp)) != EOF && (*buf++ = c) != '\n' && *************** *** 976,979 **** --- 1050,1057 ---- FUNLOCKFILE(fp); Py_END_ALLOW_THREADS + #ifdef WITH_UNIVERSAL_NEWLINES + f->f_newlinetypes = newlinetypes; + f->f_skipnextlf = skipnextlf; + #endif if (c == '\n') break; *************** *** 1151,1156 **** Py_BEGIN_ALLOW_THREADS errno = 0; ! nread = fread(buffer+nfilled, 1, ! buffersize-nfilled, f->f_fp); Py_END_ALLOW_THREADS shortread = (nread < buffersize-nfilled); --- 1229,1234 ---- Py_BEGIN_ALLOW_THREADS errno = 0; ! nread = Py_UniversalNewlineFread(buffer+nfilled, ! buffersize-nfilled, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS shortread = (nread < buffersize-nfilled); *************** *** 1189,1193 **** else { /* Grow the big buffer */ ! _PyString_Resize(&big_buffer, buffersize); buffer = PyString_AS_STRING(big_buffer); } --- 1267,1272 ---- else { /* Grow the big buffer */ ! if ( _PyString_Resize(&big_buffer, buffersize) < 0 ) ! goto error; buffer = PyString_AS_STRING(big_buffer); } *************** *** 1504,1510 **** --- 1583,1620 ---- return PyBool_FromLong((long)(f->f_fp == 0)); } + #ifdef WITH_UNIVERSAL_NEWLINES + static PyObject * + get_newlines(PyFileObject *f, void *closure) + { + switch (f->f_newlinetypes) { + case NEWLINE_UNKNOWN: + Py_INCREF(Py_None); + return Py_None; + case NEWLINE_CR: + return PyString_FromString("\r"); + case NEWLINE_LF: + return PyString_FromString("\n"); + case NEWLINE_CR|NEWLINE_LF: + return Py_BuildValue("(ss)", "\r", "\n"); + case NEWLINE_CRLF: + return PyString_FromString("\r\n"); + case NEWLINE_CR|NEWLINE_CRLF: + return Py_BuildValue("(ss)", "\r", "\r\n"); + case NEWLINE_LF|NEWLINE_CRLF: + return Py_BuildValue("(ss)", "\n", "\r\n"); + case NEWLINE_CR|NEWLINE_LF|NEWLINE_CRLF: + return Py_BuildValue("(sss)", "\r", "\n", "\r\n"); + default: + PyErr_Format(PyExc_SystemError, "Unknown newlines value 0x%x\n", f->f_newlinetypes); + return NULL; + } + } + #endif static PyGetSetDef file_getsetlist[] = { {"closed", (getter)get_closed, NULL, "True if the file is closed"}, + #ifdef WITH_UNIVERSAL_NEWLINES + {"newlines", (getter)get_newlines, NULL, "end-of-line convention used in this file"}, + #endif {0}, }; *************** *** 1806,1807 **** --- 1916,2084 ---- return fd; } + + #ifdef WITH_UNIVERSAL_NEWLINES + /* From here on we need access to the real fgets and fread */ + #undef fgets + #undef fread + + /* + ** Py_UniversalNewlineFgets is an fgets variation that understands + ** all of \r, \n and \r\n conventions. + ** The stream should be opened in binary mode. + ** If fobj is NULL the routine always does newline conversion, and + ** it may peek one char ahead to gobble the second char in \r\n. + ** If fobj is non-NULL it must be a PyFileObject. In this case there + ** is no readahead but in stead a flag is used to skip a following + ** \n on the next read. Also, if the file is open in binary mode + ** the whole conversion is skipped. Finally, the routine keeps track of + ** the different types of newlines seen. + ** Note that we need no error handling: fgets() treats error and eof + ** identically. + */ + char * + Py_UniversalNewlineFgets(char *buf, int n, FILE *stream, PyObject *fobj) + { + char *p = buf; + int c; + int newlinetypes = 0; + int skipnextlf = 0; + int univ_newline = 1; + + if (fobj) { + if (!PyFile_Check(fobj)) { + errno = ENXIO; /* What can you do... */ + return NULL; + } + univ_newline = ((PyFileObject *)fobj)->f_univ_newline; + if ( !univ_newline ) + return fgets(buf, n, stream); + newlinetypes = ((PyFileObject *)fobj)->f_newlinetypes; + skipnextlf = ((PyFileObject *)fobj)->f_skipnextlf; + } + FLOCKFILE(stream); + c = 'x'; /* Shut up gcc warning */ + while (--n > 0 && (c = GETC(stream)) != EOF ) { + if (skipnextlf ) { + skipnextlf = 0; + if (c == '\n') { + /* Seeing a \n here with skipnextlf true + ** means we saw a \r before. + */ + newlinetypes |= NEWLINE_CRLF; + c = GETC(stream); + if (c == EOF) break; + } else { + /* + ** Note that c == EOF also brings us here, + ** so we're okay if the last char in the file + ** is a CR. + */ + newlinetypes |= NEWLINE_CR; + } + } + if (c == '\r') { + /* A \r is translated into a \n, and we skip + ** an adjacent \n, if any. We don't set the + ** newlinetypes flag until we've seen the next char. + */ + skipnextlf = 1; + c = '\n'; + } else if ( c == '\n') { + newlinetypes |= NEWLINE_LF; + } + *p++ = c; + if (c == '\n') break; + } + if ( c == EOF && skipnextlf ) + newlinetypes |= NEWLINE_CR; + FUNLOCKFILE(stream); + *p = '\0'; + if (fobj) { + ((PyFileObject *)fobj)->f_newlinetypes = newlinetypes; + ((PyFileObject *)fobj)->f_skipnextlf = skipnextlf; + } else if ( skipnextlf ) { + /* If we have no file object we cannot save the + ** skipnextlf flag. We have to readahead, which + ** will cause a pause if we're reading from an + ** interactive stream, but that is very unlikely + ** unless we're doing something silly like + ** execfile("/dev/tty"). + */ + c = GETC(stream); + if ( c != '\n' ) + ungetc(c, stream); + } + if (p == buf) + return NULL; + return buf; + } + + /* + ** Py_UniversalNewlineFread is an fread variation that understands + ** all of \r, \n and \r\n conventions. + ** The stream should be opened in binary mode. + ** fobj must be a PyFileObject. In this case there + ** is no readahead but in stead a flag is used to skip a following + ** \n on the next read. Also, if the file is open in binary mode + ** the whole conversion is skipped. Finally, the routine keeps track of + ** the different types of newlines seen. + */ + size_t + Py_UniversalNewlineFread(void *buf, size_t n, + FILE *stream, PyObject *fobj) + { + char *src = buf, *dst = buf, c; + int nread, ntodo=n; + int newlinetypes, skipnextlf, univ_newline; + + if (!fobj || !PyFile_Check(fobj)) { + errno = ENXIO; /* What can you do... */ + return -1; + } + univ_newline = ((PyFileObject *)fobj)->f_univ_newline; + if ( !univ_newline ) + return fread(buf, 1, n, stream); + newlinetypes = ((PyFileObject *)fobj)->f_newlinetypes; + skipnextlf = ((PyFileObject *)fobj)->f_skipnextlf; + while (ntodo > 0) { + if (ferror(stream)) + break; + nread = fread(dst, 1, ntodo, stream); + src = dst; + if (nread <= 0) { + if (skipnextlf) + newlinetypes |= NEWLINE_CR; + break; + } + ntodo -= nread; + while ( nread-- ) { + c = *src++; + if (c == '\r') { + /* Save CR as LF and set flag to skip next newline + */ + *dst++ = '\n'; + skipnextlf = 1; + } else if (skipnextlf && c == '\n') { + /* Skip an LF, and remember that we saw CR LF + */ + skipnextlf = 0; + newlinetypes |= NEWLINE_CRLF; + } else { + /* Normal char to be stored in buffer. Also update + ** the newlinetypes flag if either this is an LF + ** or the previous char was a CR. + */ + if (c == '\n') + newlinetypes |= NEWLINE_LF; + else if (skipnextlf) + newlinetypes |= NEWLINE_CR; + *dst++ = c; + skipnextlf = 0; + } + } + } + ((PyFileObject *)fobj)->f_newlinetypes = newlinetypes; + ((PyFileObject *)fobj)->f_skipnextlf = skipnextlf; + return dst - (char *)buf; + } + #endif From jackjansen@sourceforge.net Sun Apr 14 21:13:11 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:13:11 -0700 Subject: [Python-checkins] python/dist/src/Include fileobject.h,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1748/Include Modified Files: fileobject.h Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** fileobject.h 15 Mar 2002 17:42:16 -0000 2.26 --- fileobject.h 14 Apr 2002 20:12:39 -0000 2.27 *************** *** 15,20 **** int (*f_close)(FILE *); int f_softspace; /* Flag used by 'print' command */ ! int f_binary; /* Flag which indicates whether the file is open in binary (1) or test (0) mode */ } PyFileObject; --- 15,25 ---- int (*f_close)(FILE *); int f_softspace; /* Flag used by 'print' command */ ! int f_binary; /* Flag which indicates whether the file is open open in binary (1) or test (0) mode */ + #ifdef WITH_UNIVERSAL_NEWLINES + int f_univ_newline; /* Handle any newline convention */ + int f_newlinetypes; /* Types of newlines seen */ + int f_skipnextlf; /* Skip next \n */ + #endif } PyFileObject; *************** *** 41,44 **** --- 46,62 ---- extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding; + #ifdef WITH_UNIVERSAL_NEWLINES + /* Routines to replace fread() and fgets() which accept any of \r, \n + or \r\n as line terminators. + */ + #define PY_STDIOTEXTMODE "b" + char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); + size_t Py_UniversalNewlineFread(void *, size_t, FILE *, PyObject *); + #else + #define PY_STDIOTEXTMODE "" + #define Py_UniversalNewlineFgets(buf, len, fp, obj) (fgets((buf), (len), (fp))) + #define Py_UniversalNewlineFread(buf, len, fp, obj) \ + (fread((buf), 1, (len), (fp))) + #endif /* WITH_UNIVERSAL_NEWLINES */ #ifdef __cplusplus } From jackjansen@sourceforge.net Sun Apr 14 21:13:11 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:13:11 -0700 Subject: [Python-checkins] python/dist/src README,1.143,1.144 configure,1.298,1.299 configure.in,1.308,1.309 pyconfig.h.in,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv1748 Modified Files: README configure configure.in pyconfig.h.in Log Message: Mass checkin of universal newline support. Highlights: import and friends will understand any of \r, \n and \r\n as end of line. Python file input will do the same if you use mode 'U'. Everything can be disabled by configuring with --without-universal-newlines. See PEP278 for details. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** README 29 Mar 2002 16:28:30 -0000 1.143 --- README 14 Apr 2002 20:12:37 -0000 1.144 *************** *** 812,815 **** --- 812,822 ---- memory management problems. This allows printing a list of all live objects when the interpreter terminates. + + --with(out)-universal-newlines: enable reading of text files with + foreign newline convention (default: enabled). In other words, + any of \r, \n or \r\n is acceptable as end-of-line character. + If enabled import and execfile will automatically accept any newline + in files. Python code can open a file with open(file, 'U') to + read it in universal newline mode. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.298 retrieving revision 1.299 diff -C2 -d -r1.298 -r1.299 *** configure 14 Apr 2002 10:19:40 -0000 1.298 --- configure 14 Apr 2002 20:12:37 -0000 1.299 *************** *** 845,848 **** --- 845,849 ---- --with-pth use GNU pth threading libraries --with(out)-cycle-gc disable/enable garbage collection + --with(out)-universal-newlines disable/enable foreign newlines --with(out)-pymalloc disable/enable specialized mallocs --with-wctype-functions use wctype.h functions *************** *** 10933,10936 **** --- 10934,10960 ---- echo "$as_me:$LINENO: result: $with_cycle_gc" >&5 echo "${ECHO_T}$with_cycle_gc" >&6 + + # Check for universal newline support + echo "$as_me:$LINENO: checking for --with-universal-newline" >&5 + echo $ECHO_N "checking for --with-universal-newline... $ECHO_C" >&6 + + # Check whether --with-universal-newlines or --without-universal-newlines was given. + if test "${with_universal_newlines+set}" = set; then + withval="$with_universal_newlines" + + fi; + + if test -z "$with_universal_newlines" + then with_universal_newlines="yes" + fi + if test "$with_universal_newlines" != "no" + then + cat >>confdefs.h <<\_ACEOF + #define WITH_UNIVERSAL_NEWLINES 1 + _ACEOF + + fi + echo "$as_me:$LINENO: result: $with_universal_newlines" >&5 + echo "${ECHO_T}$with_universal_newlines" >&6 # Check for Python-specific malloc support Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.308 retrieving revision 1.309 diff -C2 -d -r1.308 -r1.309 *** configure.in 14 Apr 2002 10:19:42 -0000 1.308 --- configure.in 14 Apr 2002 20:12:39 -0000 1.309 *************** *** 1446,1449 **** --- 1446,1463 ---- AC_MSG_RESULT($with_cycle_gc) + # Check for universal newline support + AC_MSG_CHECKING(for --with-universal-newline) + AC_ARG_WITH(universal-newlines, + [ --with(out)-universal-newlines disable/enable foreign newlines]) + + if test -z "$with_universal_newlines" + then with_universal_newlines="yes" + fi + if test "$with_universal_newlines" != "no" + then + AC_DEFINE(WITH_UNIVERSAL_NEWLINES) + fi + AC_MSG_RESULT($with_universal_newlines) + # Check for Python-specific malloc support AC_MSG_CHECKING(for --with-pymalloc) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** pyconfig.h.in 14 Apr 2002 10:19:43 -0000 1.29 --- pyconfig.h.in 14 Apr 2002 20:12:39 -0000 1.30 *************** *** 713,716 **** --- 713,719 ---- #undef WITH_CYCLE_GC + /* Define if you want to read files with foreign newlines. */ + #undef WITH_UNIVERSAL_NEWLINES + /* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry From jackjansen@sourceforge.net Sun Apr 14 21:17:21 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 13:17:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_univnewlines.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4147 Added Files: test_univnewlines.py Log Message: Test suite for universal newline support. --- NEW FILE: test_univnewlines.py --- # Tests universal newline support for both reading and parsing files. import unittest import test_support import os import sys DATA_TEMPLATE=[ "line1=1", "line2='this is a very long line designed to go past the magic " + "hundred character limit that is inside fileobject.c and which " + "is meant to speed up the common case, but we also want to test " + "the uncommon case, naturally.'", "def line3():pass" ] DATA_LF = "\n".join(DATA_TEMPLATE) + "\n" DATA_CR = "\r".join(DATA_TEMPLATE) + "\r" DATA_CRLF = "\r\n".join(DATA_TEMPLATE) + "\r\n" # Note that DATA_MIXED also tests the ability to recognize a lone \r # before end-of-file. DATA_MIXED = "\n".join(DATA_TEMPLATE) + "\r" DATA_SPLIT = map(lambda x: x+"\n", DATA_TEMPLATE) if not hasattr(sys.stdin, 'newlines'): raise test_support.TestSkipped, \ "This Python does not have universal newline support" class TestGenericUnivNewlines(unittest.TestCase): # use a class variable DATA to define the data to write to the file # and a class variable NEWLINE to set the expected newlines value READMODE = 'U' WRITEMODE = 'wb' def setUp(self): fp = open(test_support.TESTFN, self.WRITEMODE) fp.write(self.DATA) fp.close() def tearDown(self): try: os.unlink(test_support.TESTFN) except: pass def test_read(self): fp = open(test_support.TESTFN, self.READMODE) data = fp.read() self.assertEqual(data, DATA_LF) self.assertEqual(`fp.newlines`, `self.NEWLINE`) def test_readlines(self): fp = open(test_support.TESTFN, self.READMODE) data = fp.readlines() self.assertEqual(data, DATA_SPLIT) self.assertEqual(`fp.newlines`, `self.NEWLINE`) def test_readline(self): fp = open(test_support.TESTFN, self.READMODE) data = [] d = fp.readline() while d: data.append(d) d = fp.readline() self.assertEqual(data, DATA_SPLIT) self.assertEqual(`fp.newlines`, `self.NEWLINE`) def test_seek(self): fp = open(test_support.TESTFN, self.READMODE) fp.readline() pos = fp.tell() data = fp.readlines() self.assertEqual(data, DATA_SPLIT[1:]) fp.seek(pos) data = fp.readlines() self.assertEqual(data, DATA_SPLIT[1:]) def test_execfile(self): dict = {} execfile(test_support.TESTFN, dict) func = dict['line3'] self.assertEqual(func.func_code.co_firstlineno, 3) class TestNativeNewlines(TestGenericUnivNewlines): NEWLINE=None DATA=DATA_LF READMODE='r' WRITEMODE='w' class TestCRNewlines(TestGenericUnivNewlines): NEWLINE='\r' DATA=DATA_CR class TestLFNewlines(TestGenericUnivNewlines): NEWLINE='\n' DATA=DATA_LF class TestCRLFNewlines(TestGenericUnivNewlines): NEWLINE='\r\n' DATA=DATA_CRLF class TestMixedNewlines(TestGenericUnivNewlines): NEWLINE=('\r', '\n') DATA=DATA_MIXED def test_main(): test_support.run_unittest(TestNativeNewlines) test_support.run_unittest(TestCRNewlines) test_support.run_unittest(TestLFNewlines) test_support.run_unittest(TestCRLFNewlines) test_support.run_unittest(TestMixedNewlines) if __name__ == '__main__': test_main() From tim_one@sourceforge.net Sun Apr 14 23:04:05 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 14 Apr 2002 15:04:05 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28911/python/Objects Modified Files: complexobject.c Log Message: SF bug 543840: complex(string) accepts strings with \0 complex_subtype_from_string(): this stopped parsing at the first 0 byte, as if that were the end of the input string. Bugfix candidate. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** complexobject.c 12 Apr 2002 02:41:32 -0000 2.56 --- complexobject.c 14 Apr 2002 22:04:03 -0000 2.57 *************** *** 788,792 **** } /* end of switch */ ! } while (*s!='\0' && !sw_error); if (sw_error) { --- 788,792 ---- } /* end of switch */ ! } while (s - start < len && !sw_error); if (sw_error) { From tim_one@sourceforge.net Sun Apr 14 23:04:05 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 14 Apr 2002 15:04:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28911/python/Lib/test Modified Files: test_b1.py Log Message: SF bug 543840: complex(string) accepts strings with \0 complex_subtype_from_string(): this stopped parsing at the first 0 byte, as if that were the end of the input string. Bugfix candidate. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_b1.py 26 Feb 2002 22:39:23 -0000 1.44 --- test_b1.py 14 Apr 2002 22:04:03 -0000 1.45 *************** *** 125,138 **** --- 125,151 ---- if complex("1") != 1+0j: raise TestFailed, 'complex("1")' if complex("1j") != 1j: raise TestFailed, 'complex("1j")' + try: complex("1", "1") except TypeError: pass else: raise TestFailed, 'complex("1", "1")' + try: complex(1, "1") except TypeError: pass else: raise TestFailed, 'complex(1, "1")' + if complex(" 3.14+J ") != 3.14+1j: raise TestFailed, 'complex(" 3.14+J )"' if have_unicode: if complex(unicode(" 3.14+J ")) != 3.14+1j: raise TestFailed, 'complex(u" 3.14+J )"' + + # SF bug 543840: complex(string) accepts strings with \0 + # Fixed in 2.3. + try: + complex('1+1j\0j') + except ValueError: + pass + else: + raise TestFailed("complex('1+1j\0j') should have raised ValueError") + class Z: def __complex__(self): return 3.14j From jackjansen@sourceforge.net Sun Apr 14 23:13:37 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Sun, 14 Apr 2002 15:13:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include pyconfig.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv32120/Python/Mac/Include Modified Files: pyconfig.h Log Message: Enable universal newline support for MacPython. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pyconfig.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pyconfig.h 11 Apr 2002 20:46:07 -0000 1.6 --- pyconfig.h 14 Apr 2002 22:13:35 -0000 1.7 *************** *** 287,290 **** --- 287,293 ---- #define WITH_CYCLE_GC 1 + /* Define if you want cross-platform newline support for reading */ + #define WITH_UNIVERSAL_NEWLINES + /* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), From gvanrossum@sourceforge.net Mon Apr 15 01:19:14 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 17:19:14 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv24274 Modified Files: IOBinding.py Log Message: Provisional fix for writefile() [SF bug # 541730]. The problem was that an exception can occur in the text.get() call or in the write() call, when the text buffer contains non-ASCII characters. This causes the previous contents of the file to be lost. The provisional fix is to call str(self.text.get(...)) *before* opening the file, so that if the exception occurs, we never open the file. Two orthogonal better solutions have to wait for policy decisions: 1. We could try to encode the data as Latin-1 or as UTF-8; but that would require IDLE to grow a notion of file encoding which requires more thought. 2. We could make backups before overwriting a file. This requires more thought because it needs to be fast and cross-platform and configurable. Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IOBinding.py 4 Apr 2002 22:55:58 -0000 1.5 --- IOBinding.py 15 Apr 2002 00:19:12 -0000 1.6 *************** *** 149,155 **** def writefile(self, filename): self.fixlastline() try: f = open(filename, "w") - chars = self.text.get("1.0", "end-1c") f.write(chars) f.close() --- 149,155 ---- def writefile(self, filename): self.fixlastline() + chars = str(self.text.get("1.0", "end-1c")) try: f = open(filename, "w") f.write(chars) f.close() From gvanrossum@sourceforge.net Mon Apr 15 01:25:03 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 17:25:03 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.142,1.143 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25476 Modified Files: urllib.py Log Message: Fix from SF bug #541980 (Jacques A. Vidrine). When os.stat() for a file raises OSError, turn it into IOError per documentation. Bugfix candidate. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** urllib.py 4 Apr 2002 20:41:34 -0000 1.142 --- urllib.py 15 Apr 2002 00:25:01 -0000 1.143 *************** *** 414,418 **** host, file = splithost(url) localname = url2pathname(file) ! stats = os.stat(localname) size = stats.st_size modified = rfc822.formatdate(stats.st_mtime) --- 414,421 ---- host, file = splithost(url) localname = url2pathname(file) ! try: ! stats = os.stat(localname) ! except OSError, e: ! raise IOError(e.errno, e.strerror, e.filename) size = stats.st_size modified = rfc822.formatdate(stats.st_mtime) From gvanrossum@sourceforge.net Mon Apr 15 01:36:50 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 17:36:50 -0700 Subject: [Python-checkins] python/dist/src/Lib SocketServer.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28072 Modified Files: SocketServer.py Log Message: SF bug #543318 (Frank J. Tobin). In DatagramRequestHandler.setup(), the wfile initialization should be StringIO.StringIO(), not StringIO.StringIO(slf.packet). Bugfix candidate (all the way back to Python 1.5.2 :-). Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** SocketServer.py 4 Apr 2002 22:55:58 -0000 1.30 --- SocketServer.py 15 Apr 2002 00:36:48 -0000 1.31 *************** *** 571,575 **** self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) ! self.wfile = StringIO.StringIO(self.packet) def finish(self): --- 571,575 ---- self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) ! self.wfile = StringIO.StringIO() def finish(self): From gvanrossum@sourceforge.net Mon Apr 15 01:48:26 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 17:48:26 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30252 Modified Files: pdb.py Log Message: Add exit as alias for quit, as the easiest way to address SF bug #543674. Bugfix candidate. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** pdb.py 9 Feb 2001 23:28:07 -0000 1.51 --- pdb.py 15 Apr 2002 00:48:24 -0000 1.52 *************** *** 498,501 **** --- 498,502 ---- return 1 do_q = do_quit + do_exit = do_quit def do_args(self, arg): *************** *** 820,825 **** def help_q(self): ! print """q(uit) Quit from the debugger. The program being executed is aborted.""" def help_whatis(self): --- 821,828 ---- def help_q(self): ! print """q(uit) or exit - Quit from the debugger. The program being executed is aborted.""" + + help_exit = help_q def help_whatis(self): From gvanrossum@sourceforge.net Mon Apr 15 02:02:14 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 18:02:14 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.141,2.142 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv325 Modified Files: typeobject.c Log Message: SF bug #541883 (Vincent Fiack). A stupid bug in object_set_class(): didn't check for value==NULL before checking its type. Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.141 retrieving revision 2.142 diff -C2 -d -r2.141 -r2.142 *** typeobject.c 12 Apr 2002 03:06:53 -0000 2.141 --- typeobject.c 15 Apr 2002 01:02:12 -0000 2.142 *************** *** 1606,1609 **** --- 1606,1614 ---- PyTypeObject *new, *newbase, *oldbase; + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, + "can't delete __class__ attribute"); + return -1; + } if (!PyType_Check(value)) { PyErr_Format(PyExc_TypeError, From gvanrossum@sourceforge.net Mon Apr 15 02:03:33 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 18:03:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.128,1.129 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv696 Modified Files: test_descr.py Log Message: SF bug #541883 (Vincent Fiack). A stupid bug in object_set_class(): didn't check for value==NULL before checking its type. Bugfix candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** test_descr.py 6 Apr 2002 01:05:01 -0000 1.128 --- test_descr.py 15 Apr 2002 01:03:30 -0000 1.129 *************** *** 2353,2356 **** --- 2353,2362 ---- else: raise TestFailed, "shouldn't allow %r.__class__ = %r" % (x, C) + try: + delattr(x, "__class__") + except TypeError: + pass + else: + raise TestFailed, "shouldn't allow del %r.__class__" % x cant(C(), list) cant(list(), C) From gvanrossum@sourceforge.net Mon Apr 15 02:05:03 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 18:05:03 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.167,1.168 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv995 Modified Files: ACKS Log Message: Four more names for the hall of fame. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** ACKS 12 Apr 2002 15:18:22 -0000 1.167 --- ACKS 15 Apr 2002 01:05:01 -0000 1.168 *************** *** 106,109 **** --- 106,110 ---- Lars Damerow Eric Daniel + Ben Darnell Jonathan Dasteel John DeGood *************** *** 142,145 **** --- 143,147 ---- Niels Ferguson Sebastian Fernandez + Vincent Fiack Nils Fischbeck Doug Fort *************** *** 450,453 **** --- 452,456 ---- Jason Tishler Christian Tismer + Frank J. Tobin R Lindsay Todd Bennett Todd *************** *** 462,465 **** --- 465,469 ---- Jaap Vermeulen Al Vezza + Jacques A. Vidrine John Viega Kannan Vijayan From guido@python.org Mon Apr 15 02:25:21 2002 From: guido@python.org (Guido van Rossum) Date: Sun, 14 Apr 2002 21:25:21 -0400 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.5,1.6 In-Reply-To: Your message of "Sun, 14 Apr 2002 17:19:14 PDT." References: Message-ID: <200204150125.g3F1PLJ15415@pcp742651pcs.reston01.va.comcast.net> I forgot to mark this one as a bugfix candidate. > Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.5,1.6 > From: gvanrossum@sourceforge.net > To: python-checkins@python.org > Date: Sun, 14 Apr 2002 17:19:14 -0700 > X-Spam-Status: No, hits=-1.4 required=5.0 tests=NO_REAL_NAME,SUBJ_PYTHON_ZOPE,BODY_PYTHON_ZOPE version=2.11 > X-MailScanner: Found to be clean > > Update of /cvsroot/python/python/dist/src/Tools/idle > In directory usw-pr-cvs1:/tmp/cvs-serv24274 > > Modified Files: > IOBinding.py > Log Message: > Provisional fix for writefile() [SF bug # 541730]. > > The problem was that an exception can occur in the text.get() call or > in the write() call, when the text buffer contains non-ASCII > characters. This causes the previous contents of the file to be lost. > > The provisional fix is to call str(self.text.get(...)) *before* > opening the file, so that if the exception occurs, we never open the > file. > > Two orthogonal better solutions have to wait for policy decisions: > > 1. We could try to encode the data as Latin-1 or as UTF-8; but that > would require IDLE to grow a notion of file encoding which requires > more thought. > > 2. We could make backups before overwriting a file. This requires > more thought because it needs to be fast and cross-platform and > configurable. > > > Index: IOBinding.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -C2 -d -r1.5 -r1.6 > *** IOBinding.py 4 Apr 2002 22:55:58 -0000 1.5 > --- IOBinding.py 15 Apr 2002 00:19:12 -0000 1.6 > *************** > *** 149,155 **** > def writefile(self, filename): > self.fixlastline() > try: > f = open(filename, "w") > - chars = self.text.get("1.0", "end-1c") > f.write(chars) > f.close() > --- 149,155 ---- > def writefile(self, filename): > self.fixlastline() > + chars = str(self.text.get("1.0", "end-1c")) > try: > f = open(filename, "w") > f.write(chars) > f.close() > > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins From gvanrossum@sourceforge.net Mon Apr 15 02:41:58 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Sun, 14 Apr 2002 18:41:58 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7877 Modified Files: complexobject.c Log Message: SF bug #543387. Complex numbers implement divmod() and //, neither of which makes one lick of sense. Unfortunately this is documented, so I'm adding a deprecation warning now, so we can delete this silliness, oh, around 2005 or so. Bugfix candidate (At least for 2.2.2, I think.) Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** complexobject.c 14 Apr 2002 22:04:03 -0000 2.57 --- complexobject.c 15 Apr 2002 01:41:56 -0000 2.58 *************** *** 419,422 **** --- 419,427 ---- Py_complex div, mod; PyObject *d, *m, *z; + + if (PyErr_Warn(PyExc_DeprecationWarning, + "complex divmod() and // are deprecated") < 0) + return NULL; + errno = 0; div = c_quot(v->cval,w->cval); /* The raw divisor value. */ From akuchling@sourceforge.net Mon Apr 15 03:27:57 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Sun, 14 Apr 2002 19:27:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv16021 Modified Files: whatsnew23.tex Log Message: Add items Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** whatsnew23.tex 3 Apr 2002 22:44:47 -0000 1.5 --- whatsnew23.tex 15 Apr 2002 02:27:55 -0000 1.6 *************** *** 183,186 **** --- 183,203 ---- %====================================================================== + \section{PEP 278: Universal Newline Support} + + XXX write this section + + %Highlights: import and friends will understand any of \r, \n and \r\n + %as end of line. Python file input will do the same if you use mode 'U'. + %Everything can be disabled by configuring with --without-universal-newlines. + + + \begin{seealso} + + \seepep{278}{Universal Newline Support}{Written + and implemented by Jack Jansen.} + + \end{seealso} + + %====================================================================== \section{PEP 285: The \class{bool} Type} *************** *** 208,211 **** --- 225,231 ---- Readline: Add get_history_item, get_current_history_length, and redisplay functions. + + Add optional arg to string methods strip(), lstrip(), rstrip(). + The optional arg specifies characters to delete. From aimacintyre@sourceforge.net Mon Apr 15 13:09:47 2002 From: aimacintyre@sourceforge.net (aimacintyre@sourceforge.net) Date: Mon, 15 Apr 2002 05:09:47 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.1,1.2 python23.def,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory usw-pr-cvs1:/tmp/cvs-serv30846 Modified Files: Makefile python23.def Log Message: update build infrastructure for pymalloc and bool changes Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 17 Feb 2002 05:23:30 -0000 1.1 --- Makefile 15 Apr 2002 12:09:45 -0000 1.2 *************** *** 301,304 **** --- 301,305 ---- SRC.OBJECT= $(addprefix $(TOP), \ Objects/abstract.c \ + Objects/boolobject.c \ Objects/bufferobject.c \ Objects/cellobject.c \ *************** *** 319,322 **** --- 320,324 ---- Objects/moduleobject.c \ Objects/object.c \ + Objects/obmalloc.c \ Objects/rangeobject.c \ Objects/sliceobject.c \ Index: python23.def =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/python23.def,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** python23.def 17 Feb 2002 05:23:30 -0000 1.1 --- python23.def 15 Apr 2002 12:09:45 -0000 1.2 *************** *** 168,171 **** --- 168,179 ---- "PyObject_IsSubclass" + ; From python23_s.lib(boolobject) + "bool_repr" + "PyBool_FromLong" + "bool_new" + "_Py_ZeroStruct" + "_Py_TrueStruct" + "PyBool_Type" + ; From python23_s.lib(bufferobject) "PyBuffer_FromObject" *************** *** 303,309 **** "PyInt_FromUnicode" "PyInt_Fini" - "_Py_ZeroStruct" "PyInt_Type" - "_Py_TrueStruct" ; From python23_s.lib(iterobject) --- 311,315 ---- *************** *** 405,411 **** "PyMem_Realloc" "PyMem_Free" - "PyObject_Malloc" - "PyObject_Realloc" - "PyObject_Free" "Py_ReprEnter" "Py_ReprLeave" --- 411,414 ---- *************** *** 419,422 **** --- 422,430 ---- "_PyTrash_delete_later" + ; From python23_s.lib(obmalloc) + "PyObject_Malloc" + "PyObject_Realloc" + "PyObject_Free" + ; From python23_s.lib(rangeobject) "PyRange_New" *************** *** 904,908 **** --- 912,918 ---- ; "initgc" "_PyGC_Dump" + "PyObject_GC_Track" "_PyObject_GC_Track" + "PyObject_GC_UnTrack" "_PyObject_GC_UnTrack" "_PyObject_GC_Malloc" *************** *** 910,913 **** --- 920,924 ---- "_PyObject_GC_NewVar" "_PyObject_GC_Resize" + "PyObject_GC_Del" "_PyObject_GC_Del" "_PyGC_generation0" From gvanrossum@sourceforge.net Mon Apr 15 13:36:49 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Mon, 15 Apr 2002 05:36:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.386,1.387 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9848 Modified Files: NEWS Log Message: Add news about deprecated complex ops. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.386 retrieving revision 1.387 diff -C2 -d -r1.386 -r1.387 *** NEWS 14 Apr 2002 10:19:43 -0000 1.386 --- NEWS 15 Apr 2002 12:36:47 -0000 1.387 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - Complex numbers supported divmod() and the // and % operators, but + these make no sense. Since this was documented, they're being + deprecated now. + - String methods lstrip(), rstrip() and strip() now take an optional argument that specifies the characters to strip. For example, From gvanrossum@sourceforge.net Mon Apr 15 13:39:14 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Mon, 15 Apr 2002 05:39:14 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11334 Modified Files: complexobject.c Log Message: Deprecate % as well. The message for deprecation of //, % and divmod is the same in all three cases (mostly because // calls divmod :-). Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** complexobject.c 15 Apr 2002 01:41:56 -0000 2.58 --- complexobject.c 15 Apr 2002 12:39:12 -0000 2.59 *************** *** 400,403 **** --- 400,408 ---- { Py_complex div, mod; + + if (PyErr_Warn(PyExc_DeprecationWarning, + "complex divmod(), // and % are deprecated") < 0) + return NULL; + errno = 0; div = c_quot(v->cval,w->cval); /* The raw divisor value. */ *************** *** 421,425 **** if (PyErr_Warn(PyExc_DeprecationWarning, ! "complex divmod() and // are deprecated") < 0) return NULL; --- 426,430 ---- if (PyErr_Warn(PyExc_DeprecationWarning, ! "complex divmod(), // and % are deprecated") < 0) return NULL; From nnorwitz@sourceforge.net Mon Apr 15 13:46:13 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Mon, 15 Apr 2002 05:46:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv14462/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: posix.mknod() and {}.pop() were added Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** whatsnew23.tex 15 Apr 2002 02:27:55 -0000 1.6 --- whatsnew23.tex 15 Apr 2002 12:46:11 -0000 1.7 *************** *** 219,223 **** Return enhanced tuples in grpmodule ! posixmodule: killpg, Expat is now included with the Python source --- 219,223 ---- Return enhanced tuples in grpmodule ! posixmodule: killpg, mknod Expat is now included with the Python source *************** *** 229,232 **** --- 229,233 ---- The optional arg specifies characters to delete. + Add dict method pop(). %====================================================================== From doerwalter@sourceforge.net Mon Apr 15 14:36:49 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 15 Apr 2002 06:36:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.387,1.388 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv32693/Misc Modified Files: NEWS Log Message: Apply the second version of SF patch http://www.python.org/sf/536241 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.387 retrieving revision 1.388 diff -C2 -d -r1.387 -r1.388 *** NEWS 15 Apr 2002 12:36:47 -0000 1.387 --- NEWS 15 Apr 2002 13:36:44 -0000 1.388 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - A method zfill() was added to str and unicode, that fills a numeric + string to the left with zeros. For example, + "+123".zfill(6) -> "+00123". + - Complex numbers supported divmod() and the // and % operators, but these make no sense. Since this was documented, they're being From doerwalter@sourceforge.net Mon Apr 15 14:36:49 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 15 Apr 2002 06:36:49 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.156,2.157 unicodeobject.c,2.137,2.138 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32693/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Apply the second version of SF patch http://www.python.org/sf/536241 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62) Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.156 retrieving revision 2.157 diff -C2 -d -r2.156 -r2.157 *** stringobject.c 13 Apr 2002 00:56:08 -0000 2.156 --- stringobject.c 15 Apr 2002 13:36:47 -0000 2.157 *************** *** 2382,2385 **** --- 2382,2424 ---- } + static char zfill__doc__[] = + "S.zfill(width) -> string\n" + "\n" + "Pad a numeric string S with zeros on the left, to fill a field\n" + "of the specified width. The string S is never truncated."; + + static PyObject * + string_zfill(PyStringObject *self, PyObject *args) + { + int fill; + PyObject *s; + const char *p; + + int width; + if (!PyArg_ParseTuple(args, "i:zfill", &width)) + return NULL; + + if (PyString_GET_SIZE(self) >= width) { + Py_INCREF(self); + return (PyObject*) self; + } + + fill = width - PyString_GET_SIZE(self); + + s = pad(self, fill, 0, '0'); + + if (s == NULL) + return NULL; + + p = PyString_AS_STRING(s); + if (p[fill] == '+' || p[fill] == '-') { + /* move sign to beginning of string */ + p[0] = p[fill]; + p[fill] = '0'; + } + + return (PyObject*) s; + } + static char isspace__doc__[] = "S.isspace() -> bool\n" *************** *** 2729,2732 **** --- 2768,2772 ---- {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, + {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.137 retrieving revision 2.138 diff -C2 -d -r2.137 -r2.138 *** unicodeobject.c 12 Apr 2002 03:07:20 -0000 2.137 --- unicodeobject.c 15 Apr 2002 13:36:47 -0000 2.138 *************** *** 4825,4829 **** } - #if 0 static char zfill__doc__[] = "S.zfill(width) -> unicode\n\ --- 4825,4828 ---- *************** *** 4851,4854 **** --- 4850,4856 ---- u = pad(self, fill, 0, '0'); + if (u == NULL) + return NULL; + if (u->str[fill] == '+' || u->str[fill] == '-') { /* move sign to beginning of string */ *************** *** 4859,4863 **** return (PyObject*) u; } - #endif #if 0 --- 4861,4864 ---- *************** *** 4971,4976 **** {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__}, - #if 0 {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, #endif --- 4972,4977 ---- {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__}, {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, + #if 0 {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, #endif From doerwalter@sourceforge.net Mon Apr 15 14:37:16 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 15 Apr 2002 06:37:16 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.11,1.12 string.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32693/Lib Modified Files: UserString.py string.py Log Message: Apply the second version of SF patch http://www.python.org/sf/536241 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62) Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** UserString.py 13 Apr 2002 00:56:08 -0000 1.11 --- UserString.py 15 Apr 2002 13:36:43 -0000 1.12 *************** *** 129,132 **** --- 129,133 ---- return self.__class__(self.data.translate(*args)) def upper(self): return self.__class__(self.data.upper()) + def zfill(self, width): return self.__class__(self.data.zfill(width)) class MutableString(UserString): Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** string.py 29 Mar 2002 16:20:33 -0000 1.62 --- string.py 15 Apr 2002 13:36:43 -0000 1.63 *************** *** 191,195 **** _int = int _long = long ! _StringTypes = (str, unicode) # Convert string to float --- 191,198 ---- _int = int _long = long ! try: ! _StringTypes = (str, unicode) ! except NameError: ! _StringTypes = (str,) # Convert string to float *************** *** 278,288 **** """ if not isinstance(x, _StringTypes): ! x = str(x) ! n = len(x) ! if n >= width: return x ! sign = '' ! if x[0] in '-+': ! sign, x = x[0], x[1:] ! return sign + '0'*(width-n) + x # Expand tabs in a string. --- 281,286 ---- """ if not isinstance(x, _StringTypes): ! x = repr(x) ! return x.zfill(width) # Expand tabs in a string. From doerwalter@sourceforge.net Mon Apr 15 14:37:16 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 15 Apr 2002 06:37:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.87,1.88 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32693/Doc/lib Modified Files: libstdtypes.tex Log Message: Apply the second version of SF patch http://www.python.org/sf/536241 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** libstdtypes.tex 13 Apr 2002 02:43:39 -0000 1.87 --- libstdtypes.tex 15 Apr 2002 13:36:43 -0000 1.88 *************** *** 695,698 **** --- 695,704 ---- \end{methoddesc} + \begin{methoddesc}[string]{zfill}{width} + Return the numeric string left filled with zeros in a string + of length \var{width}. The original string is returned if + \var{width} is less than \code{len(\var{s})}. + \end{methoddesc} + \subsubsection{String Formatting Operations \label{typesseq-strings}} From doerwalter@sourceforge.net Mon Apr 15 14:37:16 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 15 Apr 2002 06:37:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.12,1.13 test_unicode.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32693/Lib/test Modified Files: string_tests.py test_unicode.py Log Message: Apply the second version of SF patch http://www.python.org/sf/536241 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62) Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** string_tests.py 13 Apr 2002 00:56:08 -0000 1.12 --- string_tests.py 15 Apr 2002 13:36:43 -0000 1.13 *************** *** 228,231 **** --- 228,241 ---- test('endswith', 'ab', 0, 'ab', 0, 0) + test('zfill', '123', '123', 2) + test('zfill', '123', '123', 3) + test('zfill', '123', '0123', 4) + test('zfill', '+123', '+123', 3) + test('zfill', '+123', '+123', 4) + test('zfill', '+123', '+0123', 5) + test('zfill', '-123', '-123', 3) + test('zfill', '-123', '-123', 4) + test('zfill', '-123', '-0123', 5) + test('zfill', '', '000', 3) test('zfill', '34', '34', 1) test('zfill', '34', '0034', 4) Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** test_unicode.py 10 Apr 2002 17:18:01 -0000 1.53 --- test_unicode.py 15 Apr 2002 13:36:44 -0000 1.54 *************** *** 207,212 **** test('capwords', u'abc\t def \nghi', u'Abc Def Ghi') ! verify(string.zfill(u'34', 1) == u'34') ! verify(string.zfill(u'34', 5) == u'00034') # Comparisons: --- 207,222 ---- test('capwords', u'abc\t def \nghi', u'Abc Def Ghi') ! test('zfill', u'123', u'123', 2) ! test('zfill', u'123', u'123', 3) ! test('zfill', u'123', u'0123', 4) ! test('zfill', u'+123', u'+123', 3) ! test('zfill', u'+123', u'+123', 4) ! test('zfill', u'+123', u'+0123', 5) ! test('zfill', u'-123', u'-123', 3) ! test('zfill', u'-123', u'-123', 4) ! test('zfill', u'-123', u'-0123', 5) ! test('zfill', u'', u'000', 3) ! test('zfill', u'34', u'34', 1) ! test('zfill', u'34', u'00034', 5) # Comparisons: From akuchling@sourceforge.net Mon Apr 15 15:06:02 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Mon, 15 Apr 2002 07:06:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv10654 Modified Files: whatsnew23.tex Log Message: Add item Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** whatsnew23.tex 15 Apr 2002 12:46:11 -0000 1.7 --- whatsnew23.tex 15 Apr 2002 14:05:59 -0000 1.8 *************** *** 229,232 **** --- 229,234 ---- The optional arg specifies characters to delete. + New method: string.zfill() + Add dict method pop(). From nnorwitz@sourceforge.net Mon Apr 15 17:29:03 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Mon, 15 Apr 2002 09:29:03 -0700 Subject: [Python-checkins] python/dist/src/Modules pwdmodule.c,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19470/Modules Modified Files: pwdmodule.c Log Message: Remove unused variable reported by Walter Dörwald Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pwdmodule.c 13 Apr 2002 21:07:45 -0000 1.32 --- pwdmodule.c 15 Apr 2002 16:29:00 -0000 1.33 *************** *** 159,163 **** initpwd(void) { ! PyObject *m, *d; m = Py_InitModule3("pwd", pwd_methods, pwd__doc__); --- 159,163 ---- initpwd(void) { ! PyObject *m; m = Py_InitModule3("pwd", pwd_methods, pwd__doc__); From fdrake@sourceforge.net Mon Apr 15 18:46:04 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 10:46:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv13837/perl Modified Files: python.perl Log Message: Add support for \cmemberline and the cmemberdesc environment. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** python.perl 3 Apr 2002 02:47:14 -0000 1.120 --- python.perl 15 Apr 2002 17:46:00 -0000 1.121 *************** *** 940,943 **** --- 940,967 ---- } + sub do_cmd_cmemberline{ + local($_) = @_; + my $container = next_argument(); + my $type = next_argument(); + my $name = next_argument(); + my $idx = make_str_index_entry("$name" + . " ($type member)"); + $idx =~ s/ \(.*\)//; + return "
$type $idx\n
" + . $_; + } + sub do_env_cmemberdesc{ + local($_) = @_; + my $container = next_argument(); + my $type = next_argument(); + my $name = next_argument(); + my $idx = make_str_index_entry("$name" + . " ($type member)"); + $idx =~ s/ \(.*\)//; + return "
$type $idx\n
" + . $_ + . '
'; + } + sub do_env_csimplemacrodesc{ local($_) = @_; From fdrake@sourceforge.net Mon Apr 15 19:41:33 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 11:41:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/html style.css,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv5084/html Modified Files: style.css Log Message: Clean up the application of style to verbatim text. This moves styling to the stylesheet; the use of
structures to control style sometimes produced improper indentation of subsequent text in many browsers when the text was already part of the
structure (as in a function or class description). Index: style.css =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/style.css,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** style.css 4 Apr 2002 22:56:57 -0000 1.20 --- style.css 15 Apr 2002 18:41:31 -0000 1.21 *************** *** 66,72 **** .titlegraphic { vertical-align: top; } ! .verbatim { color: #00008b; font-family: lucida typewriter, lucidatypewriter, ! monospace; } .grammar { background-color: #99ccff; --- 66,74 ---- .titlegraphic { vertical-align: top; } ! .verbatim pre { color: #00008b; font-family: lucida typewriter, lucidatypewriter, ! monospace; ! font-size: 90%; } ! .verbatim { margin-left: 2em; } .grammar { background-color: #99ccff; From fdrake@sourceforge.net Mon Apr 15 19:41:33 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 11:41:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.61,1.62 python.perl,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv5084/perl Modified Files: l2hinit.perl python.perl Log Message: Clean up the application of style to verbatim text. This moves styling to the stylesheet; the use of
structures to control style sometimes produced improper indentation of subsequent text in many browsers when the text was already part of the
structure (as in a function or class description). Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** l2hinit.perl 5 Apr 2002 17:34:50 -0000 1.61 --- l2hinit.perl 15 Apr 2002 18:41:29 -0000 1.62 *************** *** 578,582 **** # before style files are loaded). # ! %declarations = ('preform' => '
', %declarations); --- 578,582 ---- # before style files are loaded). # ! %declarations = ('preform' => '
', %declarations); Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** python.perl 15 Apr 2002 17:46:00 -0000 1.121 --- python.perl 15 Apr 2002 18:41:29 -0000 1.122 *************** *** 1916,1921 **** ! $alltt_start = '
';
! $alltt_end = '
'; sub do_env_alltt { --- 1916,1921 ---- ! $alltt_start = '
';
! $alltt_end = '
'; sub do_env_alltt { *************** *** 2009,2018 **** $text = 'Could not locate requested file $fname!\n'; } ! return ('
'
              . $text
!             . "
\n
\n
" . $_); } --- 2009,2018 ---- $text = 'Could not locate requested file $fname!\n'; } ! return ("" . $_); } From doerwalter@sourceforge.net Mon Apr 15 19:42:18 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 15 Apr 2002 11:42:18 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.158,2.159 unicodeobject.c,2.138,2.139 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5246/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Return the orginal string only if it's a real str or unicode instance, otherwise make a copy. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.158 retrieving revision 2.159 diff -C2 -d -r2.158 -r2.159 *** stringobject.c 15 Apr 2002 13:48:52 -0000 2.158 --- stringobject.c 15 Apr 2002 18:42:15 -0000 2.159 *************** *** 2402,2407 **** if (PyString_GET_SIZE(self) >= width) { ! Py_INCREF(self); ! return (PyObject*) self; } --- 2402,2414 ---- if (PyString_GET_SIZE(self) >= width) { ! if (PyString_CheckExact(self)) { ! Py_INCREF(self); ! return (PyObject*) self; ! } ! else ! return PyString_FromStringAndSize( ! PyString_AS_STRING(self), ! PyString_GET_SIZE(self) ! ); } Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.138 retrieving revision 2.139 diff -C2 -d -r2.138 -r2.139 *** unicodeobject.c 15 Apr 2002 13:36:47 -0000 2.138 --- unicodeobject.c 15 Apr 2002 18:42:15 -0000 2.139 *************** *** 4842,4847 **** if (self->length >= width) { ! Py_INCREF(self); ! return (PyObject*) self; } --- 4842,4854 ---- if (self->length >= width) { ! if (PyUnicode_CheckExact(self)) { ! Py_INCREF(self); ! return (PyObject*) self; ! } ! else ! return PyUnicode_FromUnicode( ! PyUnicode_AS_UNICODE(self), ! PyUnicode_GET_SIZE(self) ! ); } From fdrake@sourceforge.net Mon Apr 15 19:43:22 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 11:43:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext typestruct.h,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv5828/ext Removed Files: typestruct.h Log Message: Move the listing of the type structure, since both the C API reference and the Extending & Embedding manual use it. --- typestruct.h DELETED --- From fdrake@sourceforge.net Mon Apr 15 19:43:22 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 11:43:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs typestruct.h,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv5828/texinputs Added Files: typestruct.h Log Message: Move the listing of the type structure, since both the C API reference and the Extending & Embedding manual use it. --- NEW FILE: typestruct.h --- typedef struct _typeobject { PyObject_VAR_HEAD char *tp_name; /* For printing, in format "." */ int tp_basicsize, tp_itemsize; /* For allocation */ /* Methods to implement standard operations */ destructor tp_dealloc; printfunc tp_print; getattrfunc tp_getattr; setattrfunc tp_setattr; cmpfunc tp_compare; reprfunc tp_repr; /* Method suites for standard classes */ PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; PyMappingMethods *tp_as_mapping; /* More standard operations (here for binary compatibility) */ hashfunc tp_hash; ternaryfunc tp_call; reprfunc tp_str; getattrofunc tp_getattro; setattrofunc tp_setattro; /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; /* Flags to define presence of optional/expanded features */ long tp_flags; char *tp_doc; /* Documentation string */ /* Assigned meaning in release 2.0 */ /* call function for all accessible objects */ traverseproc tp_traverse; /* delete references to contained objects */ inquiry tp_clear; /* Assigned meaning in release 2.1 */ /* rich comparisons */ richcmpfunc tp_richcompare; /* weak reference enabler */ long tp_weaklistoffset; /* Added in release 2.2 */ /* Iterators */ getiterfunc tp_iter; iternextfunc tp_iternext; /* Attribute descriptor and subclassing stuff */ struct PyMethodDef *tp_methods; struct PyMemberDef *tp_members; struct PyGetSetDef *tp_getset; struct _typeobject *tp_base; PyObject *tp_dict; descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; long tp_dictoffset; initproc tp_init; allocfunc tp_alloc; newfunc tp_new; freefunc tp_free; /* Low-level free-memory routine */ inquiry tp_is_gc; /* For PyObject_IS_GC */ PyObject *tp_bases; PyObject *tp_mro; /* method resolution order */ PyObject *tp_cache; PyObject *tp_subclasses; PyObject *tp_weaklist; } PyTypeObject; From fdrake@sourceforge.net Mon Apr 15 19:44:48 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 11:44:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv6456/api Modified Files: newtypes.tex Log Message: Integrated more text from Guido. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** newtypes.tex 12 Apr 2002 22:47:18 -0000 1.7 --- newtypes.tex 15 Apr 2002 18:44:46 -0000 1.8 *************** *** 462,466 **** header size was included in \member{tp_basicsize}). ! These fields are inherited by subtypes. \end{cmemberdesc} --- 462,469 ---- header size was included in \member{tp_basicsize}). ! These fields are inherited separately by subtypes. If the base type ! has a non-zero \member{tp_itemsize}, it is generally not safe to set ! \member{tp_itemsize} to a different non-zero value in a subtype ! (though this depends on the implementation of the base type). \end{cmemberdesc} *************** *** 498,502 **** \class{StringIO} instance), the instance's \member{tp_repr} or \member{tp_str} function is called to convert it to a string. These ! are also called when the type's \member{tp_print} field is \NULL. The print function is called with the same signature as --- 501,507 ---- \class{StringIO} instance), the instance's \member{tp_repr} or \member{tp_str} function is called to convert it to a string. These ! are also called when the type's \member{tp_print} field is \NULL. A ! type should never implement \member{tp_print} in a way that produces ! different output than \member{tp_repr} or \member{tp_str} would. The print function is called with the same signature as *************** *** 566,569 **** --- 571,926 ---- \end{cmemberdesc} + \begin{cmemberdesc}{PyTypeObject}{reprfunc}{tp_repr} + An optional pointer to a function that implements the built-in + function \function{repr()}.\bifuncindex{repr} + + The signature is the same as for \cfunction{PyObject_Repr()}; it + must return a string or a Unicode object. Ideally, this function + should return a string that, when passed to \function{eval()}, given + a suitable environment, returns an object with the same value. If + this is not feasible, it should return a string starting with + \character{\textless} and ending with \character{\textgreater} from + which both the type and the value of the object can be deduced. + + When this field is not set, a string of the form \samp{<\%s object + at \%p>} is returned, where \code{\%s} is replaced by the type name, + and \code{\%p} by the object's memory address. + + This field is inherited by subtypes. + \end{cmemberdesc} + + PyNumberMethods *tp_as_number; + + XXX + + PySequenceMethods *tp_as_sequence; + + XXX + + PyMappingMethods *tp_as_mapping; + + XXX + + \begin{cmemberdesc}{PyTypeObject}{hashfunc}{tp_hash} + An optional pointer to a function that implements the built-in + function \function{hash()}.\bifuncindex{hash} + + The signature is the same as for \cfunction{PyObject_Hash()}; it + must return a C long. The value \code{-1} should not be returned as + a normal return value; when an error occurs during the computation + of the hash value, the function should set an exception and return + \code{-1}. + + When this field is not set, two possibilities exist: if the + \member{tp_compare} and \member{tp_richcompare} fields are both + \NULL, a default hash value based on the object's address is + returned; otherwise, a \exception{TypeError} is raised. + + This field is inherited by subtypes together with + \member{tp_richcompare} and \member{tp_compare}: a subtypes inherits + all three of \member{tp_compare}, \member{tp_richcompare}, and + \member{tp_hash}, when the subtype's \member{tp_compare}, + \member{tp_richcompare} and \member{tp_hash} are all \NULL. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{ternaryfunc}{tp_call} + An optional pointer to a function that implements calling the + object. This should be \NULL{} if the object is not callable. The + signature is the same as for \cfunction{PyObject_Call()}. + + This field is inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{reprfunc}{tp_str} + An optional pointer to a function that implements the built-in + operation \function{str()}. (Note that \class{str} is a type now, + and \function{str()} calls the constructor for that type. This + constructor calls \cfunction{PyObject_Str()} to do the actual work, + and \cfunction{PyObject_Str()} will call this handler.) + + The signature is the same as for \cfunction{PyObject_Str()}; it must + return a string or a Unicode object. This function should return a + ``friendly'' string representation of the object, as this is the + representation that will be used by the print statement. + + When this field is not set, \cfunction{PyObject_Repr()} is called to + return a string representation. + + This field is inherited by subtypes. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{getattrofunc}{tp_getattro} + An optional pointer to the get-attribute function. + + The signature is the same as for \cfunction{PyObject_GetAttr()}. It + is usually convenient to set this field to + \cfunction{PyObject_GenericGetAttr()}, which implements the normal + way of looking for object attributes. + + This field is inherited by subtypes together with + \member{tp_getattr}: a subtype inherits both \member{tp_getattr} and + \member{tp_getattro} from its base type when the subtype's + \member{tp_getattr} and \member{tp_getattro} are both \NULL. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{setattrofunc}{tp_setattro} + An optional pointer to the set-attribute function. + + The signature is the same as for \cfunction{PyObject_SetAttr()}. It + is usually convenient to set this field to + \cfunction{PyObject_GenericSetAttr()}, which implements the normal + way of setting object attributes. + + This field is inherited by subtypes together with + \member{tp_setattr}: a subtype inherits both \member{tp_setattr} and + \member{tp_setattro} from its base type when the subtype's + \member{tp_setattr} and \member{tp_setattro} are both \NULL. + \end{cmemberdesc} + + PyBufferProcs *tp_as_buffer; + + XXX + + \begin{cmemberdesc}{PyTypeObject}{long}{tp_flags} + This field is a bit mask of various flags. Some flags indicate + variant semantics for certain situations; others are used to + indicate that certain fields in the type object (or in the extension + structures referenced via \member{tp_as_number}, + \member{tp_as_sequence}, \member{tp_as_mapping}, and + \member{tp_as_buffer}) that were historically not always present are + valid; if such a flag bit is clear, the type fields it guards must + not be accessed and must be considered to have a zero or \NULL{} + value instead. + + Inheritance of this field is complicated. Most flag bits are + inherited individually, i.e. if the base type has a flag bit set, + the subtype inherits this flag bit. The flag bits that pertain to + extension structures are strictly inherited if the extension + structure is inherited, i.e. the base type's value of the flag bit + is copied into the subtype together with a pointer to the extension + structure. The \constant{Py_TPFLAGS_HAVE_GC} flag bit is inherited + together with the \member{tp_traverse} and \member{tp_clear} fields, + i.e. if the \constant{Py_TPFLAGS_HAVE_GC} flag bit is clear in the + subtype and the \member{tp_traverse} and \member{tp_clear} fields in + the subtype exist (as indicated by the + \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} flag bit) and have \NULL{} + values. + + The following bit masks are currently defined; these can be or-ed + together using the \code{|} operator to form the value of the + \member{tp_flags} field. The macro \cfunction{PyType_HasFeature()} + takes a type and a flags value, \var{tp} and \var{f}, and checks + whether \code{\var{tp}->tp_flags \& \var{f}} is nonzero. + + \begin{datadesc}{Py_TPFLAGS_HAVE_GETCHARBUFFER} + If this bit is set, the \ctype{PyBufferProcs} struct referenced by + \member{tp_as_buffer} has the \member{bf_getcharbuffer} field. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_SEQUENCE_IN} + If this bit is set, the \ctype{PySequenceMethods} struct + referenced by \member{tp_as_sequence} has the \member{sq_contains} + field. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_GC} + This bit is obsolete. The bit it used to name is no longer in + use. The symbol is now defined as zero. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_INPLACEOPS} + If this bit is set, the \ctype{PySequenceMethods} struct + referenced by \member{tp_as_sequence} and the + \ctype{PyNumberMethods} structure referenced by + \member{tp_as_number} contain the fields for in-place operators. + In particular, this means that the \ctype{PyNumberMethods} + structure has the fields \member{nb_inplace_add}, + \member{nb_inplace_subtract}, \member{nb_inplace_multiply}, + \member{nb_inplace_divide}, \member{nb_inplace_remainder}, + \member{nb_inplace_power}, \member{nb_inplace_lshift}, + \member{nb_inplace_rshift}, \member{nb_inplace_and}, + \member{nb_inplace_xor}, and \member{nb_inplace_or}; and the + \ctype{PySequenceMethods} struct has the fields + \member{sq_inplace_concat} and \member{sq_inplace_repeat}. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_CHECKTYPES} + If this bit is set, the binary and ternary operations in the + \ctype{PyNumberMethods} structure referenced by + \member{tp_as_number} accept arguments of arbitrary object types, + and do their own type conversions if needed. If this bit is + clear, those operations require that all arguments have the + current type as their type, and the caller is supposed to perform + a coercion operation first. This applies to \member{nb_add}, + \member{nb_subtract}, \member{nb_multiply}, \member{nb_divide}, + \member{nb_remainder}, \member{nb_divmod}, \member{nb_power}, + \member{nb_lshift}, \member{nb_rshift}, \member{nb_and}, + \member{nb_xor}, and \member{nb_or}. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_RICHCOMPARE} + If this bit is set, the type object has the + \member{tp_richcompare} field, as well as the \member{tp_traverse} + and the \member{tp_clear} fields. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_WEAKREFS} + If this bit is set, the \member{tp_weaklistoffset} field is + defined. Instances of a type are weakly referenceable if the + type's \member{tp_weaklistoffset} field has a value greater than + zero. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_ITER} + If this bit is set, the type object has the \member{tp_iter} and + \member{tp_iternext} fields. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_CLASS} + If this bit is set, the type object has several new fields defined + starting in Python 2.2: \member{tp_methods}, \member{tp_members}, + \member{tp_getset}, \member{tp_base}, \member{tp_dict}, + \member{tp_descr_get}, \member{tp_descr_set}, + \member{tp_dictoffset}, \member{tp_init}, \member{tp_alloc}, + \member{tp_new}, \member{tp_free}, \member{tp_is_gc}, + \member{tp_bases}, \member{tp_mro}, \member{tp_cache}, + \member{tp_subclasses}, and \member{tp_weaklist}. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HEAPTYPE} + This bit is set when the type object itself is allocated on the + heap. In this case, the \member{ob_type} field of its instances + is considered a reference to the type, and the type object is + INCREF'ed when a new instance is created, and DECREF'ed when an + instance is destroyed (this does not apply to instances of + subtypes; only the type referenced by the instance's ob_type gets + INCREF'ed or DECREF'ed). + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_BASETYPE} + This bit is set when the type can be used as the base type of + another type. If this bit is clear, the type cannot be subtyped + (similar to a "final" class in Java). + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_READY} + This bit is set when the type object has been fully initialized by + \cfunction{PyType_Ready()}. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_READYING} + This bit is set while \cfunction{PyType_Ready()} is in the process + of initializing the type object. + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_HAVE_GC} + This bit is set when the object supports garbage collection. If + this bit is set, instances must be created using + \cfunction{PyObject_GC_New()} and destroyed using + \cfunction{PyObject_GC_Del()}. More information in section XXX + about garbage collection. This bit also implies that the + GC-related fields \member{tp_traverse} and \member{tp_clear} are + present in the type object; but those fields also exist when + \constant{Py_TPFLAGS_HAVE_GC} is clear but + \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} is set). + \end{datadesc} + + \begin{datadesc}{Py_TPFLAGS_DEFAULT} + This is a bitmask of all the bits that pertain to the existence of + certain fields in the type object and its extension structures. + Currently, it includes the following bits: + \constant{Py_TPFLAGS_HAVE_GETCHARBUFFER}, + \constant{Py_TPFLAGS_HAVE_SEQUENCE_IN}, + \constant{Py_TPFLAGS_HAVE_INPLACEOPS}, + \constant{Py_TPFLAGS_HAVE_RICHCOMPARE}, + \constant{Py_TPFLAGS_HAVE_WEAKREFS}, + \constant{Py_TPFLAGS_HAVE_ITER}, and + \constant{Py_TPFLAGS_HAVE_CLASS}. + \end{datadesc} + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{char*}{tp_doc} + An optional pointer to a NUL-terminated C string giving the + docstring for this type object. + + This field is \emph{not} inherited by subtypes. + \end{cmemberdesc} + + The following three fields only exist if the + \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} flag bit is set. + + \begin{cmemberdesc}{PyTypeObject}{traverseproc}{tp_traverse} + An optional pointer to a traversal function for the garbage + collector. This is only used if the \constant{Py_TPFLAGS_HAVE_GC} + flag bit is set. More information in section XXX about garbage + collection. + + This field is inherited by subtypes together with \member{tp_clear} + and the \constant{Py_TPFLAGS_HAVE_GC} flag bit: the flag bit, + \member{tp_traverse}, and \member{tp_clear} are all inherited from + the base type if they are all zero in the subtype \emph{and} the + subtype has the \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} flag bit set. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{inquiry}{tp_clear} + An optional pointer to a clear function for the garbage collector. + This is only used if the \constant{Py_TPFLAGS_HAVE_GC} flag bit is + set. More information in section XXX about garbage collection. + + This field is inherited by subtypes together with \member{tp_clear} + and the \constant{Py_TPFLAGS_HAVE_GC} flag bit: the flag bit, + \member{tp_traverse}, and \member{tp_clear} are all inherited from + the base type if they are all zero in the subtype \emph{and} the + subtype has the \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} flag bit set. + \end{cmemberdesc} + + \begin{cmemberdesc}{PyTypeObject}{richcmpfunc}{tp_richcompare} + An optional pointer to the rich comparison function. + + The signature is the same as for \cfunction{PyObject_RichCompare()}. + The function should return \code{1} if the requested comparison + returns true, \code{0} if it returns false. It should return + \code{-1} and set an exception condition when an error occurred + during the comparison. + + This field is inherited by subtypes together with + \member{tp_compare} and \member{tp_hash}: a subtype inherits all + three of \member{tp_compare}, \member{tp_richcompare}, and + \member{tp_hash}, when the subtype's \member{tp_compare}, + \member{tp_richcompare}, and \member{tp_hash} are all \NULL. + + The following constants are defined to be used as the third argument + for \member{tp_richcompare} and for \cfunction{PyObject_RichCompare()}: + + \begin{tableii}{l|c}{constant}{Constant}{Comparison} + \lineii{Py_LT}{\code{<}} + \lineii{Py_LE}{\code{<=}} + \lineii{Py_EQ}{\code{==}} + \lineii{Py_NE}{\code{!=}} + \lineii{Py_GT}{\code{>}} + \lineii{Py_GE}{\code{>=}} + \end{tableii} + \end{cmemberdesc} + + The next field only exists if the \constant{Py_TPFLAGS_HAVE_WEAKREFS} + flag bit is set. (XXX ???) + + long tp_weaklistoffset; + + XXX + + + The remaining fields only exist if the + \constant{Py_TPFLAGS_HAVE_CLASS} flag bit is set. + + /* Added in release 2.2 */ + /* Iterators */ + getiterfunc tp_iter; + + XXX + + iternextfunc tp_iternext; + + XXX From fdrake@sourceforge.net Mon Apr 15 20:20:30 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:20:30 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.309,1.310 configure,1.299,1.300 pyconfig.h.in,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17869 Modified Files: configure.in configure pyconfig.h.in Log Message: Add a test for fchdir(). This is part of SF feature #536796. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.309 retrieving revision 1.310 diff -C2 -d -r1.309 -r1.310 *** configure.in 14 Apr 2002 20:12:39 -0000 1.309 --- configure.in 15 Apr 2002 19:20:23 -0000 1.310 *************** *** 1581,1585 **** # checks for library functions AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \ ! flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ --- 1581,1585 ---- # checks for library functions AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \ ! fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.299 retrieving revision 1.300 diff -C2 -d -r1.299 -r1.300 *** configure 14 Apr 2002 20:12:37 -0000 1.299 --- configure 15 Apr 2002 19:20:23 -0000 1.300 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.307 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.309 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 11271,11276 **** for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ ! flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ --- 11271,11277 ---- + for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ ! fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpid getpwent getwd \ hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** pyconfig.h.in 14 Apr 2002 20:12:39 -0000 1.30 --- pyconfig.h.in 15 Apr 2002 19:20:27 -0000 1.31 *************** *** 87,90 **** --- 87,93 ---- #undef HAVE_EXECV + /* Define to 1 if you have the `fchdir' function. */ + #undef HAVE_FCHDIR + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H From fdrake@sourceforge.net Mon Apr 15 20:35:33 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:35:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.122,1.123 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv22013/perl Modified Files: python.perl Log Message: Generate the right annotations in the index entries. Thanks to Thomas Heller for the sharp eye. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** python.perl 15 Apr 2002 18:41:29 -0000 1.122 --- python.perl 15 Apr 2002 19:35:29 -0000 1.123 *************** *** 946,950 **** my $name = next_argument(); my $idx = make_str_index_entry("$name" ! . " ($type member)"); $idx =~ s/ \(.*\)//; return "
$type $idx\n
" --- 946,950 ---- my $name = next_argument(); my $idx = make_str_index_entry("$name" ! . " ($container member)"); $idx =~ s/ \(.*\)//; return "
$type $idx\n
" *************** *** 957,961 **** my $name = next_argument(); my $idx = make_str_index_entry("$name" ! . " ($type member)"); $idx =~ s/ \(.*\)//; return "
$type $idx\n
" --- 957,961 ---- my $name = next_argument(); my $idx = make_str_index_entry("$name" ! . " ($container member)"); $idx =~ s/ \(.*\)//; return "
$type $idx\n
" From fdrake@sourceforge.net Mon Apr 15 20:40:11 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:40:11 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.228,2.229 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23421/Modules Modified Files: posixmodule.c Log Message: posix_fildes(): New helper: run a function that takes a file descriptor and returns None. This allows any object that supports the fileno() method to be passed as a file descriptor, not just an integer. posix_fchdir(): New exposed function: implements posix.fchdir(). This closes SF feature #536796. posix_fsync(), posix_fdatasync(): Convert to use posix_fildes() instead of posix_int(). This also changes them from METH_VARARGS to METH_O functions. setup_confname_table(): Remove unused variable. Change to take a module rather than a dict to save the resulting table into. setup_confname_tables(): Change to take a module instead of a dict to pass to setup_confname_table(). Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.228 retrieving revision 2.229 diff -C2 -d -r2.228 -r2.229 *** posixmodule.c 14 Apr 2002 10:19:44 -0000 2.228 --- posixmodule.c 15 Apr 2002 19:40:07 -0000 2.229 *************** *** 465,469 **** int fd; int res; ! if (!PyArg_ParseTuple(args, format, &fd)) return NULL; Py_BEGIN_ALLOW_THREADS --- 465,469 ---- int fd; int res; ! if (!PyArg_ParseTuple(args, format, &fd)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 476,479 **** --- 476,495 ---- } + static PyObject * + posix_fildes(PyObject *fdobj, int (*func)(int)) + { + int fd; + int res; + fd = PyObject_AsFileDescriptor(fdobj); + if (fd < 0) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = (*func)(fd); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); + Py_INCREF(Py_None); + return Py_None; + } static PyObject * *************** *** 824,827 **** --- 840,856 ---- } + #ifdef HAVE_FCHDIR + static char posix_fchdir__doc__[] = + "fchdir(fildes) -> None\n\ + Change to the directory of the given file descriptor. fildes must be\n\ + opened on a directory, not a file."; + + static PyObject * + posix_fchdir(PyObject *self, PyObject *fdobj) + { + return posix_fildes(fdobj, fchdir); + } + #endif /* HAVE_FCHDIR */ + static char posix_chmod__doc__[] = *************** *** 867,873 **** static PyObject * ! posix_fsync(PyObject *self, PyObject *args) { ! return posix_int(args, "i:fsync", fsync); } #endif /* HAVE_FSYNC */ --- 896,902 ---- static PyObject * ! posix_fsync(PyObject *self, PyObject *fdobj) { ! return posix_fildes(fdobj, fsync); } #endif /* HAVE_FSYNC */ *************** *** 885,891 **** static PyObject * ! posix_fdatasync(PyObject *self, PyObject *args) { ! return posix_int(args, "i:fdatasync", fdatasync); } #endif /* HAVE_FDATASYNC */ --- 914,920 ---- static PyObject * ! posix_fdatasync(PyObject *self, PyObject *fdobj) { ! return posix_fildes(fdobj, fdatasync); } #endif /* HAVE_FDATASYNC */ *************** *** 6089,6097 **** static int setup_confname_table(struct constdef *table, size_t tablesize, ! char *tablename, PyObject *moddict) { PyObject *d = NULL; size_t i; - int status; qsort(table, tablesize, sizeof(struct constdef), cmp_constdefs); --- 6118,6125 ---- static int setup_confname_table(struct constdef *table, size_t tablesize, ! char *tablename, PyObject *module) { PyObject *d = NULL; size_t i; qsort(table, tablesize, sizeof(struct constdef), cmp_constdefs); *************** *** 6109,6120 **** Py_DECREF(o); } ! status = PyDict_SetItemString(moddict, tablename, d); ! Py_DECREF(d); ! return status; } /* Return -1 on failure, 0 on success. */ static int ! setup_confname_tables(PyObject *moddict) { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) --- 6137,6146 ---- Py_DECREF(o); } ! return PyModule_AddObject(module, tablename, d); } /* Return -1 on failure, 0 on success. */ static int ! setup_confname_tables(PyObject *module) { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) *************** *** 6122,6126 **** sizeof(posix_constants_pathconf) / sizeof(struct constdef), ! "pathconf_names", moddict)) return -1; #endif --- 6148,6152 ---- sizeof(posix_constants_pathconf) / sizeof(struct constdef), ! "pathconf_names", module)) return -1; #endif *************** *** 6129,6133 **** sizeof(posix_constants_confstr) / sizeof(struct constdef), ! "confstr_names", moddict)) return -1; #endif --- 6155,6159 ---- sizeof(posix_constants_confstr) / sizeof(struct constdef), ! "confstr_names", module)) return -1; #endif *************** *** 6136,6140 **** sizeof(posix_constants_sysconf) / sizeof(struct constdef), ! "sysconf_names", moddict)) return -1; #endif --- 6162,6166 ---- sizeof(posix_constants_sysconf) / sizeof(struct constdef), ! "sysconf_names", module)) return -1; #endif *************** *** 6385,6393 **** {"strerror", posix_strerror, METH_VARARGS, posix_strerror__doc__}, #endif #ifdef HAVE_FSYNC ! {"fsync", posix_fsync, METH_VARARGS, posix_fsync__doc__}, #endif #ifdef HAVE_FDATASYNC ! {"fdatasync", posix_fdatasync, METH_VARARGS, posix_fdatasync__doc__}, #endif #ifdef HAVE_SYS_WAIT_H --- 6411,6422 ---- {"strerror", posix_strerror, METH_VARARGS, posix_strerror__doc__}, #endif + #ifdef HAVE_FCHDIR + {"fchdir", posix_fchdir, METH_O, posix_fchdir__doc__}, + #endif #ifdef HAVE_FSYNC ! {"fsync", posix_fsync, METH_O, posix_fsync__doc__}, #endif #ifdef HAVE_FDATASYNC ! {"fdatasync", posix_fdatasync, METH_O, posix_fdatasync__doc__}, #endif #ifdef HAVE_SYS_WAIT_H *************** *** 6447,6463 **** static int ! ins(PyObject *d, char *symbol, long value) { ! PyObject* v = PyInt_FromLong(value); ! if (!v || PyDict_SetItemString(d, symbol, v) < 0) ! return -1; /* triggers fatal error */ ! ! Py_DECREF(v); ! return 0; } #if defined(PYOS_OS2) /* Insert Platform-Specific Constant Values (Strings & Numbers) of Common Use */ ! static int insertvalues(PyObject *d) { APIRET rc; --- 6476,6487 ---- static int ! ins(PyObject *module, char *symbol, long value) { ! return PyModule_AddIntConstant(module, symbol, value); } #if defined(PYOS_OS2) /* Insert Platform-Specific Constant Values (Strings & Numbers) of Common Use */ ! static int insertvalues(PyObject *module) { APIRET rc; *************** *** 6475,6485 **** } ! if (ins(d, "meminstalled", values[QSV_TOTPHYSMEM])) return -1; ! if (ins(d, "memkernel", values[QSV_TOTRESMEM])) return -1; ! if (ins(d, "memvirtual", values[QSV_TOTAVAILMEM])) return -1; ! if (ins(d, "maxpathlen", values[QSV_MAX_PATH_LENGTH])) return -1; ! if (ins(d, "maxnamelen", values[QSV_MAX_COMP_LENGTH])) return -1; ! if (ins(d, "revision", values[QSV_VERSION_REVISION])) return -1; ! if (ins(d, "timeslice", values[QSV_MIN_SLICE])) return -1; switch (values[QSV_VERSION_MINOR]) { --- 6499,6509 ---- } ! if (ins(module, "meminstalled", values[QSV_TOTPHYSMEM])) return -1; ! if (ins(module, "memkernel", values[QSV_TOTRESMEM])) return -1; ! if (ins(module, "memvirtual", values[QSV_TOTAVAILMEM])) return -1; ! if (ins(module, "maxpathlen", values[QSV_MAX_PATH_LENGTH])) return -1; ! if (ins(module, "maxnamelen", values[QSV_MAX_COMP_LENGTH])) return -1; ! if (ins(module, "revision", values[QSV_VERSION_REVISION])) return -1; ! if (ins(module, "timeslice", values[QSV_MIN_SLICE])) return -1; switch (values[QSV_VERSION_MINOR]) { *************** *** 6498,6505 **** /* Add Indicator of the Version of the Operating System */ ! v = PyString_FromString(ver); ! if (!v || PyDict_SetItemString(d, "version", v) < 0) return -1; - Py_DECREF(v); /* Add Indicator of Which Drive was Used to Boot the System */ --- 6522,6527 ---- /* Add Indicator of the Version of the Operating System */ ! if (PyModule_AddStringConstant(module, "version", tmp) < 0) return -1; /* Add Indicator of Which Drive was Used to Boot the System */ *************** *** 6508,6517 **** tmp[2] = '\0'; ! v = PyString_FromString(tmp); ! if (!v || PyDict_SetItemString(d, "bootdrive", v) < 0) ! return -1; ! Py_DECREF(v); ! ! return 0; } #endif --- 6530,6534 ---- tmp[2] = '\0'; ! return PyModule_AddStringConstant(module, "bootdrive", tmp); } #endif *************** *** 6681,6706 **** INITFUNC(void) { ! PyObject *m, *d, *v; ! m = Py_InitModule4(MODNAME, posix_methods, ! posix__doc__, ! (PyObject *)NULL, ! PYTHON_API_VERSION); ! d = PyModule_GetDict(m); /* Initialize environ dictionary */ v = convertenviron(); ! if (v == NULL || PyDict_SetItemString(d, "environ", v) != 0) return; Py_DECREF(v); ! if (all_ins(d)) return; ! if (setup_confname_tables(d)) return; ! PyDict_SetItemString(d, "error", PyExc_OSError); #ifdef HAVE_PUTENV --- 6698,6722 ---- INITFUNC(void) { ! PyObject *m, *v; ! m = Py_InitModule3(MODNAME, posix_methods, ! posix__doc__); /* Initialize environ dictionary */ v = convertenviron(); ! Py_XINCREF(v); ! if (v == NULL || PyModule_AddObject(m, "environ", v) != 0) return; Py_DECREF(v); ! if (all_ins(m)) return; ! if (setup_confname_tables(m)) return; ! Py_INCREF(PyExc_OSError); ! PyModule_AddObject(m, "error", PyExc_OSError); #ifdef HAVE_PUTENV *************** *** 6711,6718 **** stat_result_desc.name = MODNAME ".stat_result"; PyStructSequence_InitType(&StatResultType, &stat_result_desc); ! PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType); statvfs_result_desc.name = MODNAME ".statvfs_result"; PyStructSequence_InitType(&StatVFSResultType, &statvfs_result_desc); ! PyDict_SetItemString(d, "statvfs_result", (PyObject*) &StatVFSResultType); } --- 6727,6737 ---- stat_result_desc.name = MODNAME ".stat_result"; PyStructSequence_InitType(&StatResultType, &stat_result_desc); ! Py_INCREF((PyObject*) &StatResultType); ! PyModule_AddObject(m, "stat_result", (PyObject*) &StatResultType); statvfs_result_desc.name = MODNAME ".statvfs_result"; PyStructSequence_InitType(&StatVFSResultType, &statvfs_result_desc); ! Py_INCREF((PyObject*) &StatVFSResultType); ! PyModule_AddObject(m, "statvfs_result", ! (PyObject*) &StatVFSResultType); } From fdrake@sourceforge.net Mon Apr 15 20:41:29 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:41:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23866/Doc/lib Modified Files: libos.tex Log Message: Add docs for os.fchdir(). Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** libos.tex 14 Apr 2002 10:19:43 -0000 1.79 --- libos.tex 15 Apr 2002 19:41:27 -0000 1.80 *************** *** 102,105 **** --- 102,106 ---- \begin{funcdescni}{chdir}{path} + \funclineni{fchdir}{} \funclineni{getcwd}{} These functions are described in ``Files and Directories'' (section *************** *** 589,592 **** --- 590,601 ---- Change the current working directory to \var{path}. Availability: Macintosh, \UNIX, Windows. + \end{funcdesc} + + \begin{funcdesc}{fchdir}{fd} + Change the current working directory to the directory represented by + the file descriptor \var{fd}. The descriptor must refer to an opened + directory, not an open file. + Availability: \UNIX. + \versionadded{2.3} \end{funcdesc} From fdrake@sourceforge.net Mon Apr 15 20:46:42 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:46:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.80,1.81 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25348/lib Modified Files: libos.tex Log Message: Be consistent in presenting the signatures. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** libos.tex 15 Apr 2002 19:41:27 -0000 1.80 --- libos.tex 15 Apr 2002 19:46:40 -0000 1.81 *************** *** 102,106 **** \begin{funcdescni}{chdir}{path} ! \funclineni{fchdir}{} \funclineni{getcwd}{} These functions are described in ``Files and Directories'' (section --- 102,106 ---- \begin{funcdescni}{chdir}{path} ! \funclineni{fchdir}{fd} \funclineni{getcwd}{} These functions are described in ``Files and Directories'' (section From fdrake@sourceforge.net Mon Apr 15 20:53:38 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:53:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libmacui.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv27598/mac Modified Files: libmacui.tex Log Message: Better documentation for GetArgv() and the ProgressBar type. Back-porting to release22-maint. This closes SF patch #496705. Index: libmacui.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacui.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libmacui.tex 14 Oct 2000 04:56:52 -0000 1.16 --- libmacui.tex 15 Apr 2002 19:53:35 -0000 1.17 *************** *** 6,60 **** \modulesynopsis{Basic Macintosh dialogs.} ! ! The \module{EasyDialogs} module contains some simple dialogs for ! the Macintosh. All routines have an optional parameter \var{id} with ! which you can override the DLOG resource used for the dialog, as long ! as the item numbers correspond. See the source for details. The \module{EasyDialogs} module defines the following functions: ! \begin{funcdesc}{Message}{str} ! A modal dialog with the message text \var{str}, which should be at ! most 255 characters long, is displayed. Control is returned when the ! user clicks ``OK''. \end{funcdesc} ! \begin{funcdesc}{AskString}{prompt\optional{, default}} ! Ask the user to input a string value, in a modal dialog. \var{prompt} ! is the prompt message, the optional \var{default} arg is the initial ! value for the string. All strings can be at most 255 bytes ! long. \function{AskString()} returns the string entered or \code{None} ! in case the user cancelled. \end{funcdesc} ! \begin{funcdesc}{AskPassword}{prompt\optional{, default}} ! Ask the user to input a string value, in a modal dialog. Like ! \method{AskString}, but with the text shown as bullets. \var{prompt} ! is the prompt message, the optional \var{default} arg is the initial ! value for the string. All strings can be at most 255 bytes ! long. \function{AskString()} returns the string entered or \code{None} ! in case the user cancelled. \end{funcdesc} ! \begin{funcdesc}{AskYesNoCancel}{question\optional{, default}} ! Present a dialog with text \var{question} and three buttons labelled ! ``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for ! no and \code{-1} for cancel. The default return value chosen by ! hitting return is \code{0}. This can be changed with the optional ! \var{default} argument. \end{funcdesc} - \begin{funcdesc}{ProgressBar}{\optional{title \optional{, maxval\optional{,label}}}} - Display a modeless progress dialog with a thermometer bar. \var{title} - is the text string displayed (default ``Working...''), \var{maxval} is - the value at which progress is complete (default - \code{100}). \var{label} is the text that is displayed over the progress - bar itself. The returned object has two methods, - \code{set(\var{value})}, which sets the value of the progress bar, and - \code{label(\var{text})}, which sets the text of the label. The bar - remains visible until the object returned is discarded. ! The progress bar has a ``cancel'' button. [NOTE: how does the cancel ! button behave?] \end{funcdesc} --- 6,177 ---- \modulesynopsis{Basic Macintosh dialogs.} ! The \module{EasyDialogs} module contains some simple dialogs for the ! Macintosh. All routines take an optional resource ID parameter \var{id} ! with which one can override the \constant{DLOG} resource used for the ! dialog, provided that the dialog items correspond (both type and item ! number) to those in the default \constant{DLOG} resource. See source ! code for details. The \module{EasyDialogs} module defines the following functions: ! \begin{funcdesc}{Message}{str\optional{, id\optional{, ok=None}}} ! Displays a modal dialog with the message text \var{str}, which should be ! at most 255 characters long. The button text defaults to ``OK'', but is ! set to the string argument \var{ok} if the latter is supplied. Control ! is returned when the user clicks the ``OK'' button. \end{funcdesc} ! ! \begin{funcdesc}{AskString}{prompt\optional{, default\optional{, ! id\optional{, ok\optional{, cancel}}}}} ! Asks the user to input a string value via a modal dialog. \var{prompt} ! is the prompt message, and the optional \var{default} supplies the ! initial value for the string (otherwise \code{""} is used). The text of ! the ``OK'' and ``Cancel'' buttons can be changed with the \var{ok} and ! \var{cancel} arguments. All strings can be at most 255 bytes long. ! \function{AskString()} returns the string entered or \code{None} in case ! the user cancelled. \end{funcdesc} ! ! \begin{funcdesc}{AskPassword}{prompt\optional{, default\optional{, ! id\optional{, ok\optional{, cancel}}}}} ! Asks the user to input a string value via a modal dialog. Like ! \function{AskString()}, but with the text shown as bullets. The ! arguments have the same meaning as for \function{AskString()}. \end{funcdesc} ! ! \begin{funcdesc}{AskYesNoCancel}{question\optional{, default\optional{, ! yes\optional{, no\optional{, cancel\optional{, id}}}}}} ! Presents a dialog with prompt \var{question} and three buttons labelled ! ``Yes'', ``No'', and ``Cancel''. Returns \code{1} for ``Yes'', \code{0} ! for ``No'' and \code{-1} for ``Cancel''. The value of \var{default} (or ! \code{0} if \var{default} is not supplied) is returned when the ! \kbd{RETURN} key is pressed. The text of the buttons can be changed with ! the \var{yes}, \var{no}, and \var{cancel} arguments; to prevent a button ! from appearing, supply \code{""} for the corresponding argument. \end{funcdesc} ! \begin{funcdesc}{ProgressBar}{\optional{title\optional{, maxval\optional{, ! label\optional{, id}}}}} ! Displays a modeless progress-bar dialog. This is the constructor for the ! \class{ProgressBar} class described below. \var{title} is the text ! string displayed (default ``Working...''), \var{maxval} is the value at ! which progress is complete (default \code{0}, indicating that an ! indeterminate amount of work remains to be done), and \var{label} is ! the text that is displayed above the progress bar itself. \end{funcdesc} + + + \begin{funcdesc}{GetArgv}{\optional{optionlist\optional{ + commandlist\optional{, addoldfile\optional{, addnewfile\optional{, + addfolder\optional{, id}}}}}}} + Displays a dialog which aids the user in constructing a command-line + argument list. Returns the list in \code{sys.argv} format, suitable for + passing as an argument to \function{getopt.getopt()}. \var{addoldfile}, + \var{addnewfile}, and \var{addfolder} are boolean arguments. When + nonzero, they enable the user to insert into the command line paths to + an existing file, a (possibly) not-yet-existent file, and a folder, + respectively. (Note: Option arguments must appear in the command line + before file and folder arguments in order to be recognized by + \function{getopt.getopt()}.) Arguments containing spaces can be + specified by enclosing them within single or double quotes. A + \exception{SystemExit} exception is raised if the user presses the + ``Cancel'' button. + + \var{optionlist} is a list that determines a popup menu from which the + allowed options are selected. Its items can take one of two forms: + \var{optstr} or \code{(\var{optstr}, \var{descr})}. When present, + \var{descr} is a short descriptive string that is displayed in the + dialog while this option is selected in the popup menu. The + correspondence between \var{optstr}s and command-line arguments is: + + \begin{tableii}{l|l}{textrm}{\var{optstr} format}{Command-line format} + \lineii{\code{x}} + {\programopt{-x} (short option)} + \lineii{\code{x:} or \code{x=}} + {\programopt{-x} (short option with value)} + \lineii{\code{xyz}} + {\longprogramopt{xyz} (long option)} + \lineii{\code{xyz:} or \code{xyz=}} + {\longprogramopt{xyz} (long option with value)} + \end{tableii} + + \var{commandlist} is a list of items of the form \var{cmdstr} or + \code{(\var{cmdstr}, \var{descr})}, where \var{descr} is as above. The + \var{cmdstr}s will appear in a popup menu. When chosen, the text of + \var{cmdstr} will be appended to the command line as is, except that a + trailing \character{:} or \character{=} (if present) will be trimmed + off. + + \versionadded{2.0} + \end{funcdesc} + + + + \subsection{ProgressBar Objects \label{progressbar-objects}} + + \class{ProgressBar} objects provide support for modeless progress-bar + dialogs. Both determinate (thermometer style) and indeterminate + (barber-pole style) progress bars are supported. The bar will be + determinate if its maximum value is greater than zero; otherwise it + will be indeterminate. + \versionchanged[Support for indeterminate-style progress bars was + added]{2.2} + + The dialog is displayed immediately after creation. If the dialog's + ``Cancel'' button is pressed, or if \kbd{Cmd-.} or \kbd{ESC} is typed, + the dialog window is hidden and \exception{KeyboardInterrupt} is + raised (but note that this response does not occur until the progress + bar is next updated, typically via a call to \method{inc()} or + \method{set()}). Otherwise, the bar remains visible until the + \class{ProgressBar} object is discarded. + + \class{ProgressBar} objects possess the following attributes and + methods: + + \begin{memberdesc}[ProgressBar]{curval} + The current value (of type integer or long integer) of the progress + bar. The normal access methods coerce \member{curval} between + \code{0} and \member{maxval}. This attribute should not be altered + directly. + \end{memberdesc} + + \begin{memberdesc}[ProgressBar]{maxval} + The maximum value (of type integer or long integer) of the progress + bar; the progress bar (thermometer style) is full when \member{curval} + equals \member{maxval}. If \member{maxval} is \code{0}, the bar will + be indeterminate (barber-pole). This attribute should not be altered + directly. + \end{memberdesc} + + \begin{methoddesc}[ProgressBar]{title}{\optional{newstr}} + Sets the text in the title bar of the progress dialog to + \var{newstr}. + \end{methoddesc} + + \begin{methoddesc}[ProgressBar]{label}{\optional{newstr}} + Sets the text in the progress box of the progress dialog to + \var{newstr}. + \end{methoddesc} + + \begin{methoddesc}[ProgressBar]{set}{value\optional{, max}} + Sets the progress bar's \member{curval} to \var{value}, and also + \member{maxval} to \var{max} if the latter is provided. \var{value} + is first coerced between 0 and \member{maxval}. The thermometer bar + is updated to reflect the changes, including a change from + indeterminate to determinate or vice versa. + \end{methoddesc} + + \begin{methoddesc}[ProgressBar]{inc}{\optional{n}} + Increments the progress bar's \member{curval} by \var{n}, or by \code{1} + if \var{n} is not provided. (Note that \var{n} may be negative, in + which case the effect is a decrement.) The progress bar is updated to + reflect the change. If the bar is indeterminate, this causes one + ``spin'' of the barber pole. The resulting \member{curval} is coerced + between 0 and \member{maxval} if incrementing causes it to fall + outside this range. + \end{methoddesc} From fdrake@sourceforge.net Mon Apr 15 20:54:10 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 12:54:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libmacui.tex,1.16,1.16.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv27791/mac Modified Files: Tag: release22-maint libmacui.tex Log Message: Better documentation for GetArgv() and the ProgressBar type. This closes SF patch #496705. Index: libmacui.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacui.tex,v retrieving revision 1.16 retrieving revision 1.16.24.1 diff -C2 -d -r1.16 -r1.16.24.1 *** libmacui.tex 14 Oct 2000 04:56:52 -0000 1.16 --- libmacui.tex 15 Apr 2002 19:54:08 -0000 1.16.24.1 *************** *** 6,60 **** \modulesynopsis{Basic Macintosh dialogs.} ! ! The \module{EasyDialogs} module contains some simple dialogs for ! the Macintosh. All routines have an optional parameter \var{id} with ! which you can override the DLOG resource used for the dialog, as long ! as the item numbers correspond. See the source for details. The \module{EasyDialogs} module defines the following functions: ! \begin{funcdesc}{Message}{str} ! A modal dialog with the message text \var{str}, which should be at ! most 255 characters long, is displayed. Control is returned when the ! user clicks ``OK''. \end{funcdesc} ! \begin{funcdesc}{AskString}{prompt\optional{, default}} ! Ask the user to input a string value, in a modal dialog. \var{prompt} ! is the prompt message, the optional \var{default} arg is the initial ! value for the string. All strings can be at most 255 bytes ! long. \function{AskString()} returns the string entered or \code{None} ! in case the user cancelled. \end{funcdesc} ! \begin{funcdesc}{AskPassword}{prompt\optional{, default}} ! Ask the user to input a string value, in a modal dialog. Like ! \method{AskString}, but with the text shown as bullets. \var{prompt} ! is the prompt message, the optional \var{default} arg is the initial ! value for the string. All strings can be at most 255 bytes ! long. \function{AskString()} returns the string entered or \code{None} ! in case the user cancelled. \end{funcdesc} ! \begin{funcdesc}{AskYesNoCancel}{question\optional{, default}} ! Present a dialog with text \var{question} and three buttons labelled ! ``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for ! no and \code{-1} for cancel. The default return value chosen by ! hitting return is \code{0}. This can be changed with the optional ! \var{default} argument. \end{funcdesc} - \begin{funcdesc}{ProgressBar}{\optional{title \optional{, maxval\optional{,label}}}} - Display a modeless progress dialog with a thermometer bar. \var{title} - is the text string displayed (default ``Working...''), \var{maxval} is - the value at which progress is complete (default - \code{100}). \var{label} is the text that is displayed over the progress - bar itself. The returned object has two methods, - \code{set(\var{value})}, which sets the value of the progress bar, and - \code{label(\var{text})}, which sets the text of the label. The bar - remains visible until the object returned is discarded. ! The progress bar has a ``cancel'' button. [NOTE: how does the cancel ! button behave?] \end{funcdesc} --- 6,177 ---- \modulesynopsis{Basic Macintosh dialogs.} ! The \module{EasyDialogs} module contains some simple dialogs for the ! Macintosh. All routines take an optional resource ID parameter \var{id} ! with which one can override the \constant{DLOG} resource used for the ! dialog, provided that the dialog items correspond (both type and item ! number) to those in the default \constant{DLOG} resource. See source ! code for details. The \module{EasyDialogs} module defines the following functions: ! \begin{funcdesc}{Message}{str\optional{, id\optional{, ok=None}}} ! Displays a modal dialog with the message text \var{str}, which should be ! at most 255 characters long. The button text defaults to ``OK'', but is ! set to the string argument \var{ok} if the latter is supplied. Control ! is returned when the user clicks the ``OK'' button. \end{funcdesc} ! ! \begin{funcdesc}{AskString}{prompt\optional{, default\optional{, ! id\optional{, ok\optional{, cancel}}}}} ! Asks the user to input a string value via a modal dialog. \var{prompt} ! is the prompt message, and the optional \var{default} supplies the ! initial value for the string (otherwise \code{""} is used). The text of ! the ``OK'' and ``Cancel'' buttons can be changed with the \var{ok} and ! \var{cancel} arguments. All strings can be at most 255 bytes long. ! \function{AskString()} returns the string entered or \code{None} in case ! the user cancelled. \end{funcdesc} ! ! \begin{funcdesc}{AskPassword}{prompt\optional{, default\optional{, ! id\optional{, ok\optional{, cancel}}}}} ! Asks the user to input a string value via a modal dialog. Like ! \function{AskString()}, but with the text shown as bullets. The ! arguments have the same meaning as for \function{AskString()}. \end{funcdesc} ! ! \begin{funcdesc}{AskYesNoCancel}{question\optional{, default\optional{, ! yes\optional{, no\optional{, cancel\optional{, id}}}}}} ! Presents a dialog with prompt \var{question} and three buttons labelled ! ``Yes'', ``No'', and ``Cancel''. Returns \code{1} for ``Yes'', \code{0} ! for ``No'' and \code{-1} for ``Cancel''. The value of \var{default} (or ! \code{0} if \var{default} is not supplied) is returned when the ! \kbd{RETURN} key is pressed. The text of the buttons can be changed with ! the \var{yes}, \var{no}, and \var{cancel} arguments; to prevent a button ! from appearing, supply \code{""} for the corresponding argument. \end{funcdesc} ! \begin{funcdesc}{ProgressBar}{\optional{title\optional{, maxval\optional{, ! label\optional{, id}}}}} ! Displays a modeless progress-bar dialog. This is the constructor for the ! \class{ProgressBar} class described below. \var{title} is the text ! string displayed (default ``Working...''), \var{maxval} is the value at ! which progress is complete (default \code{0}, indicating that an ! indeterminate amount of work remains to be done), and \var{label} is ! the text that is displayed above the progress bar itself. \end{funcdesc} + + + \begin{funcdesc}{GetArgv}{\optional{optionlist\optional{ + commandlist\optional{, addoldfile\optional{, addnewfile\optional{, + addfolder\optional{, id}}}}}}} + Displays a dialog which aids the user in constructing a command-line + argument list. Returns the list in \code{sys.argv} format, suitable for + passing as an argument to \function{getopt.getopt()}. \var{addoldfile}, + \var{addnewfile}, and \var{addfolder} are boolean arguments. When + nonzero, they enable the user to insert into the command line paths to + an existing file, a (possibly) not-yet-existent file, and a folder, + respectively. (Note: Option arguments must appear in the command line + before file and folder arguments in order to be recognized by + \function{getopt.getopt()}.) Arguments containing spaces can be + specified by enclosing them within single or double quotes. A + \exception{SystemExit} exception is raised if the user presses the + ``Cancel'' button. + + \var{optionlist} is a list that determines a popup menu from which the + allowed options are selected. Its items can take one of two forms: + \var{optstr} or \code{(\var{optstr}, \var{descr})}. When present, + \var{descr} is a short descriptive string that is displayed in the + dialog while this option is selected in the popup menu. The + correspondence between \var{optstr}s and command-line arguments is: + + \begin{tableii}{l|l}{textrm}{\var{optstr} format}{Command-line format} + \lineii{\code{x}} + {\programopt{-x} (short option)} + \lineii{\code{x:} or \code{x=}} + {\programopt{-x} (short option with value)} + \lineii{\code{xyz}} + {\longprogramopt{xyz} (long option)} + \lineii{\code{xyz:} or \code{xyz=}} + {\longprogramopt{xyz} (long option with value)} + \end{tableii} + + \var{commandlist} is a list of items of the form \var{cmdstr} or + \code{(\var{cmdstr}, \var{descr})}, where \var{descr} is as above. The + \var{cmdstr}s will appear in a popup menu. When chosen, the text of + \var{cmdstr} will be appended to the command line as is, except that a + trailing \character{:} or \character{=} (if present) will be trimmed + off. + + \versionadded{2.0} + \end{funcdesc} + + + + \subsection{ProgressBar Objects \label{progressbar-objects}} + + \class{ProgressBar} objects provide support for modeless progress-bar + dialogs. Both determinate (thermometer style) and indeterminate + (barber-pole style) progress bars are supported. The bar will be + determinate if its maximum value is greater than zero; otherwise it + will be indeterminate. + \versionchanged[Support for indeterminate-style progress bars was + added]{2.2} + + The dialog is displayed immediately after creation. If the dialog's + ``Cancel'' button is pressed, or if \kbd{Cmd-.} or \kbd{ESC} is typed, + the dialog window is hidden and \exception{KeyboardInterrupt} is + raised (but note that this response does not occur until the progress + bar is next updated, typically via a call to \method{inc()} or + \method{set()}). Otherwise, the bar remains visible until the + \class{ProgressBar} object is discarded. + + \class{ProgressBar} objects possess the following attributes and + methods: + + \begin{memberdesc}[ProgressBar]{curval} + The current value (of type integer or long integer) of the progress + bar. The normal access methods coerce \member{curval} between + \code{0} and \member{maxval}. This attribute should not be altered + directly. + \end{memberdesc} + + \begin{memberdesc}[ProgressBar]{maxval} + The maximum value (of type integer or long integer) of the progress + bar; the progress bar (thermometer style) is full when \member{curval} + equals \member{maxval}. If \member{maxval} is \code{0}, the bar will + be indeterminate (barber-pole). This attribute should not be altered + directly. + \end{memberdesc} + + \begin{methoddesc}[ProgressBar]{title}{\optional{newstr}} + Sets the text in the title bar of the progress dialog to + \var{newstr}. + \end{methoddesc} + + \begin{methoddesc}[ProgressBar]{label}{\optional{newstr}} + Sets the text in the progress box of the progress dialog to + \var{newstr}. + \end{methoddesc} + + \begin{methoddesc}[ProgressBar]{set}{value\optional{, max}} + Sets the progress bar's \member{curval} to \var{value}, and also + \member{maxval} to \var{max} if the latter is provided. \var{value} + is first coerced between 0 and \member{maxval}. The thermometer bar + is updated to reflect the changes, including a change from + indeterminate to determinate or vice versa. + \end{methoddesc} + + \begin{methoddesc}[ProgressBar]{inc}{\optional{n}} + Increments the progress bar's \member{curval} by \var{n}, or by \code{1} + if \var{n} is not provided. (Note that \var{n} may be negative, in + which case the effect is a decrement.) The progress bar is updated to + reflect the change. If the bar is indeterminate, this causes one + ``spin'' of the barber pole. The resulting \member{curval} is coerced + between 0 and \member{maxval} if incrementing causes it to fall + outside this range. + \end{methoddesc} From fdrake@sourceforge.net Mon Apr 15 21:10:26 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 13:10:26 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv2279/doc Modified Files: doc.tex Log Message: Document the cmemberdesc environment. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** doc.tex 9 Apr 2002 20:17:42 -0000 1.61 --- doc.tex 15 Apr 2002 20:10:23 -0000 1.62 *************** *** 550,553 **** --- 550,564 ---- \end{envdesc} + \begin{envdesc}{cmemberdesc}{\p{container}\p{type}\p{name}} + Description for a structure member. \var{container} should be + the \keyword{typedef} name, if there is one, otherwise if should + be \samp{struct \var{tag}}. The type of the member should given + as \var{type}, and the name should be given as \var{name}. The + text of the description should include the range of values + allowed, how the value should be interpreted, and whether the + value can be changed. References to structure members in text + should use the \macro{member} macro. + \end{envdesc} + \begin{envdesc}{csimplemacrodesc}{\p{name}} Documentation for a ``simple'' macro. Simple macros are macros From fdrake@sourceforge.net Mon Apr 15 21:48:43 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 13:48:43 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv15159/texinputs Modified Files: python.sty Log Message: Separate out a \cfuncline macro from the cfuncdesc environment. This matches many other of the *desc environments, and is useful when multiple functions share a description. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** python.sty 12 Apr 2002 22:48:02 -0000 1.94 --- python.sty 15 Apr 2002 20:48:40 -0000 1.95 *************** *** 586,592 **** % Note that the [refcount] slot should only be filled in by % tools/anno-api.py; it pulls the value from the refcounts database. \newenvironment{cfuncdesc}[4][\py@badkey]{ \begin{fulllineitems} ! \item[\code{#2 \bfcode{#3}(\py@varvars{#4})}\index{#3@{\py@idxcode{#3()}}}] \ifx#1\@undefined\else% \emph{Return value: \textbf{#1}.}\\ --- 586,595 ---- % Note that the [refcount] slot should only be filled in by % tools/anno-api.py; it pulls the value from the refcounts database. + \newcommand{\cfuncline}[3]{ + \item[\code{#1 \bfcode{#2}(\py@varvars{#3})}\index{#2@{\py@idxcode{#2()}}}] + } \newenvironment{cfuncdesc}[4][\py@badkey]{ \begin{fulllineitems} ! \cfuncline{#2}{#3}{#4} \ifx#1\@undefined\else% \emph{Return value: \textbf{#1}.}\\ From fdrake@sourceforge.net Mon Apr 15 21:48:42 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 13:48:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv15159/perl Modified Files: python.perl Log Message: Separate out a \cfuncline macro from the cfuncdesc environment. This matches many other of the *desc environments, and is useful when multiple functions share a description. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** python.perl 15 Apr 2002 19:35:29 -0000 1.123 --- python.perl 15 Apr 2002 20:48:39 -0000 1.124 *************** *** 908,921 **** $TLEND = ''; ! sub do_env_cfuncdesc{ ! local($_) = @_; ! my $return_type = next_argument(); ! my $function_name = next_argument(); ! my $arg_list = next_argument(); my $idx = make_str_index_entry( ! "$function_name()" . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? - why both of these? ! my $result_rc = get_refcount($function_name, ''); my $rcinfo = ''; if ($result_rc eq '+1') { --- 908,934 ---- $TLEND = ''; ! sub cfuncline_helper{ ! my ($type, $name, $args) = @_; my $idx = make_str_index_entry( ! "$name()" . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? - why both of these? ! return "$type $idx($args)"; ! } ! sub do_cmd_cfuncline{ ! local($_) = @_; ! my $type = next_argument(); ! my $name = next_argument(); ! my $args = next_argument(); ! my $siginfo = cfuncline_helper($type, $name, $args); ! return "
$siginfo\n
" . $_; ! } ! sub do_env_cfuncdesc{ ! local($_) = @_; ! my $type = next_argument(); ! my $name = next_argument(); ! my $args = next_argument(); ! my $siginfo = cfuncline_helper($type, $name, $args); ! my $result_rc = get_refcount($name, ''); my $rcinfo = ''; if ($result_rc eq '+1') { *************** *** 934,938 **** . "\n"); } ! return "
$return_type $idx($arg_list)\n
" . $rcinfo . $_ --- 947,951 ---- . "\n"); } ! return "
$siginfo\n
" . $rcinfo . $_ From fdrake@sourceforge.net Mon Apr 15 21:51:22 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 13:51:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv15983 Modified Files: abstract.tex Log Message: Add documentation for PyObject_Call(). Note that PyObject_Size() is a synonym for PyObject_Length(). This closes SF patch #544330 (contributed by Thomas Heller). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** abstract.tex 4 Apr 2002 04:10:36 -0000 1.11 --- abstract.tex 15 Apr 2002 20:51:19 -0000 1.12 *************** *** 173,176 **** --- 173,191 ---- + \begin{cfuncdesc}{PyObject*}{PyObject_Call}{PyObject *callable_object, + PyObject *args, + PyObject *kw} + Call a callable Python object \var{callable_object}, with arguments + given by the tuple \var{args}, and named arguments given by the + dictionary \var{kw}. If no named arguments are needed, \var{kw} may + be \NULL{}. \var{args} must not be \NULL{}, use an empty tuple if + no arguments are needed. Returns the result of the call on success, + or \NULL{} on failure. This is the equivalent of the Python + expression \samp{apply(\var{callable_object}, \var{args}, \var{kw})} + or \samp{\var{callable_object}(*\var{args}, **\var{kw})}. + \bifuncindex{apply} + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyObject_CallObject}{PyObject *callable_object, PyObject *args} *************** *** 262,265 **** --- 277,281 ---- \begin{cfuncdesc}{int}{PyObject_Length}{PyObject *o} + \cfuncline{int}{PyObject_Size}{PyObject *o} Return the length of object \var{o}. If the object \var{o} provides both sequence and mapping protocols, the sequence length is From bwarsaw@sourceforge.net Mon Apr 15 23:00:28 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 15 Apr 2002 15:00:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv7956 Modified Files: Utils.py Log Message: parseaddr(): Don't use rfc822.parseaddr() because this now implies a double call to AddressList.getaddrlist(), and /that/ always returns an empty list for the second and subsequent calls. Instead, instantiate an AddressList directly, and get the parsed addresses out of the addresslist attribute. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Utils.py 12 Apr 2002 20:50:05 -0000 1.11 --- Utils.py 15 Apr 2002 22:00:25 -0000 1.12 *************** *** 21,25 **** from rfc822 import parsedate as _parsedate from rfc822 import parsedate_tz as _parsedate_tz - from rfc822 import parseaddr as _parseaddr from quopri import decodestring as _qdecode --- 21,24 ---- *************** *** 238,243 **** def parseaddr(addr): ! realname, emailaddr = _parseaddr(addr) ! if realname == '' and emailaddr is None: return '', '' ! return realname, emailaddr --- 237,242 ---- def parseaddr(addr): ! addrs = _AddressList(addr).addresslist ! if not addrs: return '', '' ! return addrs[0] From bwarsaw@sourceforge.net Mon Apr 15 23:11:58 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 15 Apr 2002 15:11:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11149 Modified Files: test_email.py Log Message: test_main(): Added this so the test can actually get run under the regrtest framework. Keep the original standalone-unittest scaffolding (i.e. suite() and __main__). Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_email.py 10 Apr 2002 21:01:31 -0000 1.26 --- test_email.py 15 Apr 2002 22:11:55 -0000 1.27 *************** *** 30,35 **** --- 30,37 ---- from email import quopriMIME + import test_support from test_support import findfile, __file__ as test_support_file + NL = '\n' EMPTYSTRING = '' *************** *** 1574,1599 **** def suite(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestMessageAPI)) ! suite.addTest(unittest.makeSuite(TestEncoders)) ! suite.addTest(unittest.makeSuite(TestLongHeaders)) ! suite.addTest(unittest.makeSuite(TestFromMangling)) ! suite.addTest(unittest.makeSuite(TestMIMEAudio)) ! suite.addTest(unittest.makeSuite(TestMIMEImage)) ! suite.addTest(unittest.makeSuite(TestMIMEText)) ! suite.addTest(unittest.makeSuite(TestMultipartMixed)) ! suite.addTest(unittest.makeSuite(TestNonConformant)) ! suite.addTest(unittest.makeSuite(TestRFC2047)) ! suite.addTest(unittest.makeSuite(TestMIMEMessage)) ! suite.addTest(unittest.makeSuite(TestIdempotent)) ! suite.addTest(unittest.makeSuite(TestMiscellaneous)) ! suite.addTest(unittest.makeSuite(TestIterators)) ! suite.addTest(unittest.makeSuite(TestParsers)) ! suite.addTest(unittest.makeSuite(TestBase64)) ! suite.addTest(unittest.makeSuite(TestQuopri)) ! suite.addTest(unittest.makeSuite(TestHeader)) ! suite.addTest(unittest.makeSuite(TestCharset)) return suite --- 1576,1594 ---- + def _testclasses(): + mod = sys.modules[__name__] + return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] + + def suite(): suite = unittest.TestSuite() ! for testclass in _testclasses(): ! suite.addTest(unittest.makeSuite(testclass)) return suite + + + def test_main(): + for testclass in _testclasses(): + test_support.run_unittest(testclass) From bwarsaw@sourceforge.net Mon Apr 15 23:14:08 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 15 Apr 2002 15:14:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email_codecs.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11705 Modified Files: test_email_codecs.py Log Message: test_main(): Added this so the test can actually get run under the regrtest framework. Keep the original standalone-unittest scaffolding (i.e. suite() and __main__). Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email_codecs.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_email_codecs.py 10 Apr 2002 21:01:31 -0000 1.1 --- test_email_codecs.py 15 Apr 2002 22:14:06 -0000 1.2 *************** *** 3,7 **** import unittest ! from test_support import TestSkipped from email.Charset import Charset --- 3,7 ---- import unittest ! import test_support from email.Charset import Charset *************** *** 13,17 **** unicode('foo', 'japanese.iso-2022-jp') except LookupError: ! raise TestSkipped, 'Optional Japanese codecs not installed' --- 13,17 ---- unicode('foo', 'japanese.iso-2022-jp') except LookupError: ! raise test_support.TestSkipped, 'Optional Japanese codecs not installed' *************** *** 45,48 **** --- 45,52 ---- suite.addTest(unittest.makeSuite(TestEmailAsianCodecs)) return suite + + + def test_main(): + test_support.run_unittest(TestEmailAsianCodecs) From nnorwitz@sourceforge.net Mon Apr 15 23:57:48 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Mon, 15 Apr 2002 15:57:48 -0700 Subject: [Python-checkins] python/dist/src/PC w9xpopen.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv23267/PC Modified Files: w9xpopen.c Log Message: Fix grammar Index: w9xpopen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/w9xpopen.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** w9xpopen.c 3 Apr 2002 01:47:00 -0000 1.3 --- w9xpopen.c 15 Apr 2002 22:57:46 -0000 1.4 *************** *** 20,26 **** const char *usage = ! "This program is used by Python's os.popen function to\n" "to work around a limitation in Windows 95/98. It is\n" ! "not designed to be used as stand-alone program."; int main(int argc, char *argv[]) --- 20,26 ---- const char *usage = ! "This program is used by Python's os.popen function\n" "to work around a limitation in Windows 95/98. It is\n" ! "not designed to be used as a stand-alone program."; int main(int argc, char *argv[]) From nnorwitz@sourceforge.net Mon Apr 15 23:59:47 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Mon, 15 Apr 2002 15:59:47 -0700 Subject: [Python-checkins] python/dist/src/PC w9xpopen.c,1.2,1.2.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv23840/PC Modified Files: Tag: release22-maint w9xpopen.c Log Message: Fix grammar Index: w9xpopen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/w9xpopen.c,v retrieving revision 1.2 retrieving revision 1.2.26.1 diff -C2 -d -r1.2 -r1.2.26.1 *** w9xpopen.c 14 Aug 2000 05:04:28 -0000 1.2 --- w9xpopen.c 15 Apr 2002 22:59:45 -0000 1.2.26.1 *************** *** 19,25 **** const char *usage = ! "This program is used by Python's os.pipe function to\n" "to work around a limitation in Windows 95/98. It is\n" ! "not designed to be used as stand-alone program."; int main(int argc, char *argv[]) --- 19,25 ---- const char *usage = ! "This program is used by Python's os.popen function\n" "to work around a limitation in Windows 95/98. It is\n" ! "not designed to be used as a stand-alone program."; int main(int argc, char *argv[]) From tim_one@sourceforge.net Tue Apr 16 00:52:06 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 16:52:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.23,1.24 test_coercion.py,1.2,1.3 test_xmllib.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6489/python/Lib/test Modified Files: test___all__.py test_coercion.py test_xmllib.py Log Message: Reduce the number of test-suite DeprecationWarnings; start adding resetwarnings() calls too. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test___all__.py 11 Apr 2002 20:04:12 -0000 1.23 --- test___all__.py 15 Apr 2002 23:52:03 -0000 1.24 *************** *** 159,160 **** --- 159,162 ---- check_all("xdrlib") check_all("zipfile") + + warnings.resetwarnings() Index: test_coercion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_coercion.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_coercion.py 3 Jan 2001 01:52:10 -0000 1.2 --- test_coercion.py 15 Apr 2002 23:52:03 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- import copy import sys + import warnings # Fake a number that implements numeric methods through __coerce__ *************** *** 110,113 **** print '=', x ! do_infix_binops() ! do_prefix_binops() --- 111,120 ---- print '=', x ! warnings.filterwarnings("ignore", ! r'complex divmod\(\), // and % are deprecated', ! DeprecationWarning) ! try: ! do_infix_binops() ! do_prefix_binops() ! finally: ! warnings.resetwarnings() Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_xmllib.py 11 Apr 2002 20:18:40 -0000 1.7 --- test_xmllib.py 15 Apr 2002 23:52:04 -0000 1.8 *************** *** 17,21 **** warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", DeprecationWarning) - del warnings import test_support --- 17,20 ---- *************** *** 34,37 **** --- 33,37 ---- def test_main(): test_support.run_unittest(XMLParserTestCase) + warnings.resetwarnings() From tim_one@sourceforge.net Tue Apr 16 00:56:06 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 16:56:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7386/python/Lib/test Modified Files: regrtest.py Log Message: I expect test_univnewlines to be skipped on Windows. I expect this because it *is* skipped. I'm not entirely sure it should be skipped, but figuring that out would take actual thought . Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** regrtest.py 11 Apr 2002 20:58:54 -0000 1.76 --- regrtest.py 15 Apr 2002 23:56:04 -0000 1.77 *************** *** 512,515 **** --- 512,516 ---- test_sunaudiodev test_timing + test_univnewlines """, 'linux2': From tim_one@sourceforge.net Tue Apr 16 01:01:11 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 17:01:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.77,1.78 test___all__.py,1.24,1.25 test_coercion.py,1.3,1.4 test_xmllib.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8780/python/Lib/test Modified Files: regrtest.py test___all__.py test_coercion.py test_xmllib.py Log Message: It makes more sense to call resetwarnings() after every test runs than to keep doing that in every test that wants to filter a warning. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** regrtest.py 15 Apr 2002 23:56:04 -0000 1.77 --- regrtest.py 16 Apr 2002 00:01:09 -0000 1.78 *************** *** 56,59 **** --- 56,60 ---- import random import StringIO + import warnings import test_support *************** *** 323,326 **** --- 324,328 ---- finally: sys.stdout = save_stdout + warnings.resetwarnings() except (ImportError, test_support.TestSkipped), msg: if not quiet: Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test___all__.py 15 Apr 2002 23:52:03 -0000 1.24 --- test___all__.py 16 Apr 2002 00:01:09 -0000 1.25 *************** *** 159,162 **** check_all("xdrlib") check_all("zipfile") - - warnings.resetwarnings() --- 159,160 ---- Index: test_coercion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_coercion.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_coercion.py 15 Apr 2002 23:52:03 -0000 1.3 --- test_coercion.py 16 Apr 2002 00:01:09 -0000 1.4 *************** *** 114,120 **** r'complex divmod\(\), // and % are deprecated', DeprecationWarning) ! try: ! do_infix_binops() ! do_prefix_binops() ! finally: ! warnings.resetwarnings() --- 114,117 ---- r'complex divmod\(\), // and % are deprecated', DeprecationWarning) ! do_infix_binops() ! do_prefix_binops() Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_xmllib.py 15 Apr 2002 23:52:04 -0000 1.8 --- test_xmllib.py 16 Apr 2002 00:01:09 -0000 1.9 *************** *** 33,38 **** def test_main(): test_support.run_unittest(XMLParserTestCase) - warnings.resetwarnings() - if __name__ == "__main__": --- 33,36 ---- From guido@python.org Tue Apr 16 01:12:34 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 15 Apr 2002 20:12:34 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.23,1.24 test_coercion.py,1.2,1.3 test_xmllib.py,1.7,1.8 In-Reply-To: Your message of "Mon, 15 Apr 2002 16:52:06 PDT." References: Message-ID: <200204160012.g3G0CYj03088@pcp742651pcs.reston01.va.comcast.net> > start adding resetwarnings() calls too. I think that's the wrong thing to do (see my post to python-dev). --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@sourceforge.net Tue Apr 16 01:29:29 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 17:29:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15373/python/Lib/test Modified Files: regrtest.py Log Message: OK, don't call resetwarnings(). Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** regrtest.py 16 Apr 2002 00:01:09 -0000 1.78 --- regrtest.py 16 Apr 2002 00:29:27 -0000 1.79 *************** *** 56,60 **** import random import StringIO - import warnings import test_support --- 56,59 ---- *************** *** 324,328 **** finally: sys.stdout = save_stdout - warnings.resetwarnings() except (ImportError, test_support.TestSkipped), msg: if not quiet: --- 323,326 ---- From tim_one@sourceforge.net Tue Apr 16 02:27:46 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 18:27:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.25,1.26 test_coercion.py,1.4,1.5 test_exceptions.py,1.16,1.17 test_os.py,1.9,1.10 test_regex.py,1.10,1.11 test_repr.py,1.11,1.12 test_strop.py,1.15,1.16 test_sundry.py,1.9,1.10 test_xmllib.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27580/python/Lib/test Modified Files: test___all__.py test_coercion.py test_exceptions.py test_os.py test_regex.py test_repr.py test_strop.py test_sundry.py test_xmllib.py Log Message: Tighten up some warning filters, and break some dependencies on the order in which the tests are normally run. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test___all__.py 16 Apr 2002 00:01:09 -0000 1.25 --- test___all__.py 16 Apr 2002 01:27:44 -0000 1.26 *************** *** 3,9 **** import warnings ! warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning) ! warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning) ! warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning) def check_all(modname): --- 3,12 ---- import warnings ! warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning, ! r'pre$') ! warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning, ! r'^regsub$') ! warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning, ! r'statcache$') def check_all(modname): Index: test_coercion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_coercion.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_coercion.py 16 Apr 2002 00:01:09 -0000 1.4 --- test_coercion.py 16 Apr 2002 01:27:44 -0000 1.5 *************** *** 113,117 **** warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated', ! DeprecationWarning) do_infix_binops() do_prefix_binops() --- 113,118 ---- warnings.filterwarnings("ignore", r'complex divmod\(\), // and % are deprecated', ! DeprecationWarning, ! r'test_coercion$') do_infix_binops() do_prefix_binops() Index: test_exceptions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_exceptions.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_exceptions.py 8 Dec 2001 10:15:48 -0000 1.16 --- test_exceptions.py 16 Apr 2002 01:27:44 -0000 1.17 *************** *** 6,11 **** import sys, traceback - warnings.filterwarnings("error", "", OverflowWarning, __name__) - print '5. Built-in exceptions' # XXX This is not really enough, each *operation* should be tested! --- 6,9 ---- *************** *** 87,90 **** --- 85,94 ---- r(OverflowError) + # XXX + # Obscure: this test relies on int+int raising OverflowError if the + # ints are big enough. But ints no longer do that by default. This + # test will have to go away someday. For now, we can convert the + # transitional OverflowWarning into an error. + warnings.filterwarnings("error", "", OverflowWarning, __name__) x = 1 try: Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_os.py 18 Oct 2001 21:57:37 -0000 1.9 --- test_os.py 16 Apr 2002 01:27:44 -0000 1.10 *************** *** 34,38 **** return warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, ! "test_os") self.check_tempfile(os.tempnam()) --- 34,38 ---- return warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, ! r"test_os$") self.check_tempfile(os.tempnam()) *************** *** 58,62 **** return warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, ! "test_os") self.check_tempfile(os.tmpnam()) --- 58,62 ---- return warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, ! r"test_os$") self.check_tempfile(os.tmpnam()) Index: test_regex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_regex.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_regex.py 13 May 2001 00:19:31 -0000 1.10 --- test_regex.py 16 Apr 2002 01:27:44 -0000 1.11 *************** *** 2,6 **** import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", ! DeprecationWarning, __name__) import regex from regex_syntax import * --- 2,6 ---- import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", ! DeprecationWarning, r'test_regex$') import regex from regex_syntax import * Index: test_repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_repr.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_repr.py 29 Dec 2001 00:25:42 -0000 1.11 --- test_repr.py 16 Apr 2002 01:27:44 -0000 1.12 *************** *** 106,109 **** --- 106,110 ---- def test_xrange(self): + import warnings eq = self.assertEquals eq(repr(xrange(1)), 'xrange(1)') *************** *** 111,117 **** eq(repr(xrange(1, 2, 3)), 'xrange(1, 4, 3)') # Turn off warnings for deprecated multiplication ! import warnings ! warnings.filterwarnings('ignore', category=DeprecationWarning, ! module=ReprTests.__module__) eq(repr(xrange(1) * 3), '(xrange(1) * 3)') --- 112,121 ---- eq(repr(xrange(1, 2, 3)), 'xrange(1, 4, 3)') # Turn off warnings for deprecated multiplication ! warnings.filterwarnings('ignore', ! r'xrange object multiplication is deprecated', ! DeprecationWarning, module=ReprTests.__module__) ! warnings.filterwarnings('ignore', ! r"PyRange_New's 'repetitions' argument is deprecated", ! DeprecationWarning, module=ReprTests.__module__) eq(repr(xrange(1) * 3), '(xrange(1) * 3)') Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_strop.py 20 Sep 2001 21:33:42 -0000 1.15 --- test_strop.py 16 Apr 2002 01:27:44 -0000 1.16 *************** *** 1,5 **** import warnings ! warnings.filterwarnings("ignore", "", DeprecationWarning, __name__) ! warnings.filterwarnings("ignore", "", DeprecationWarning, "unittest") import strop import test_support --- 1,6 ---- import warnings ! warnings.filterwarnings("ignore", "strop functions are obsolete;", ! DeprecationWarning, ! r'test_strop|unittest') import strop import test_support Index: test_sundry.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_sundry.py 22 Mar 2002 02:48:57 -0000 1.9 --- test_sundry.py 16 Apr 2002 01:27:44 -0000 1.10 *************** *** 2,6 **** import warnings ! warnings.filterwarnings('ignore', '', DeprecationWarning, 'posixfile') from test_support import verbose --- 2,11 ---- import warnings ! warnings.filterwarnings('ignore', r".*posixfile module", ! DeprecationWarning, 'posixfile$') ! warnings.filterwarnings('ignore', r".*statcache module", ! DeprecationWarning, 'statcache$') ! warnings.filterwarnings('ignore', r".*'re' module", ! DeprecationWarning, 'pre$') from test_support import verbose Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_xmllib.py 16 Apr 2002 00:01:09 -0000 1.9 --- test_xmllib.py 16 Apr 2002 01:27:44 -0000 1.10 *************** *** 16,20 **** import warnings warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", ! DeprecationWarning) import test_support --- 16,20 ---- import warnings warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", ! DeprecationWarning, r'xmllib$') import test_support From tim_one@sourceforge.net Tue Apr 16 02:34:01 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 18:34:01 -0700 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28607/python/Lib Modified Files: warnings.py Log Message: resetwarnings(): change the docstring to reflect what the code actually does. Note that the description in the Library Reference manual is already accurate. Bugfix candidate. Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** warnings.py 21 Mar 2002 10:38:40 -0000 1.10 --- warnings.py 16 Apr 2002 01:33:59 -0000 1.11 *************** *** 140,144 **** def resetwarnings(): ! """Reset the list of warnings filters to its default state.""" filters[:] = [] --- 140,144 ---- def resetwarnings(): ! """Clear the list of warning filters, so that no filters are active.""" filters[:] = [] From tim_one@sourceforge.net Tue Apr 16 02:38:42 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 18:38:42 -0700 Subject: [Python-checkins] python/dist/src/Lib BaseHTTPServer.py,1.20,1.21 asynchat.py,1.17,1.18 fileinput.py,1.10,1.11 gzip.py,1.31,1.32 imaplib.py,1.45,1.46 os2emxpath.py,1.3,1.4 pre.py,1.11,1.12 re.py,1.42,1.43 rlcompleter.py,1.10,1.11 smtplib.py,1.52,1.53 warnings.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29959/python/Lib Modified Files: BaseHTTPServer.py asynchat.py fileinput.py gzip.py imaplib.py os2emxpath.py pre.py re.py rlcompleter.py smtplib.py warnings.py Log Message: Whitespace normalization. Index: BaseHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/BaseHTTPServer.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** BaseHTTPServer.py 4 Apr 2002 22:55:58 -0000 1.20 --- BaseHTTPServer.py 16 Apr 2002 01:38:39 -0000 1.21 *************** *** 33,37 **** # Request for Comments: 2616 et al # Obsoletes: 2068 June 1999 ! # Category: Standards Track # # URL: http://www.faqs.org/rfcs/rfc2616.html --- 33,37 ---- # Request for Comments: 2616 et al # Obsoletes: 2068 June 1999 ! # Category: Standards Track # # URL: http://www.faqs.org/rfcs/rfc2616.html Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** asynchat.py 20 Mar 2002 02:22:58 -0000 1.17 --- asynchat.py 16 Apr 2002 01:38:39 -0000 1.18 *************** *** 67,74 **** 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" --- 67,74 ---- 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" *************** *** 292,297 **** def find_prefix_at_end (haystack, needle): ! l = len(needle) - 1 ! while l and not haystack.endswith(needle[:l]): ! l -= 1 ! return l --- 292,297 ---- def find_prefix_at_end (haystack, needle): ! l = len(needle) - 1 ! while l and not haystack.endswith(needle[:l]): ! l -= 1 ! return l Index: fileinput.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/fileinput.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fileinput.py 7 Apr 2002 06:36:22 -0000 1.10 --- fileinput.py 16 Apr 2002 01:38:39 -0000 1.11 *************** *** 184,188 **** raise StopIteration return line ! def __getitem__(self, i): if i != self._lineno: --- 184,188 ---- raise StopIteration return line ! def __getitem__(self, i): if i != self._lineno: Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** gzip.py 7 Apr 2002 06:36:22 -0000 1.31 --- gzip.py 16 Apr 2002 01:38:39 -0000 1.32 *************** *** 137,141 **** import errno raise IOError(errno.EBADF, "write() on read-only GzipFile object") ! if self.fileobj is None: raise ValueError, "write() on closed GzipFile object" --- 137,141 ---- import errno raise IOError(errno.EBADF, "write() on read-only GzipFile object") ! if self.fileobj is None: raise ValueError, "write() on closed GzipFile object" *************** *** 150,154 **** import errno raise IOError(errno.EBADF, "write() on read-only GzipFile object") ! if self.extrasize <= 0 and self.fileobj is None: return '' --- 150,154 ---- import errno raise IOError(errno.EBADF, "write() on read-only GzipFile object") ! if self.extrasize <= 0 and self.fileobj is None: return '' Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** imaplib.py 8 Mar 2002 09:05:12 -0000 1.45 --- imaplib.py 16 Apr 2002 01:38:39 -0000 1.46 *************** *** 1013,1017 **** self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! self.sslobj = socket.ssl(self.sock,self.keyfile, self.certfile) --- 1013,1017 ---- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! self.sslobj = socket.ssl(self.sock,self.keyfile, self.certfile) Index: os2emxpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os2emxpath.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** os2emxpath.py 7 Apr 2002 06:36:23 -0000 1.3 --- os2emxpath.py 16 Apr 2002 01:38:39 -0000 1.4 *************** *** 1,4 **** # Module 'os2emxpath' -- common operations on OS/2 pathnames ! """Common pathname manipulations, OS/2 EMX version. Instead of importing this module directly, import os and refer to this --- 1,4 ---- # Module 'os2emxpath' -- common operations on OS/2 pathnames ! """Common pathname manipulations, OS/2 EMX version. Instead of importing this module directly, import os and refer to this Index: pre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pre.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pre.py 10 Apr 2002 21:36:11 -0000 1.11 --- pre.py 16 Apr 2002 01:38:39 -0000 1.12 *************** *** 93,97 **** _warnings.warn("Please use the 're' module, not the 'pre' module", DeprecationWarning) ! __all__ = ["match","search","sub","subn","split","findall","escape","compile", "I","L","M","S","X","IGNORECASE","LOCALE","MULTILINE","DOTALL", --- 93,97 ---- _warnings.warn("Please use the 're' module, not the 'pre' module", DeprecationWarning) ! __all__ = ["match","search","sub","subn","split","findall","escape","compile", "I","L","M","S","X","IGNORECASE","LOCALE","MULTILINE","DOTALL", Index: re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/re.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** re.py 10 Apr 2002 21:15:40 -0000 1.42 --- re.py 16 Apr 2002 01:38:39 -0000 1.43 *************** *** 19,21 **** from sre import * from sre import __all__ - --- 19,20 ---- Index: rlcompleter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rlcompleter.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** rlcompleter.py 23 Mar 2002 23:44:51 -0000 1.10 --- rlcompleter.py 16 Apr 2002 01:38:39 -0000 1.11 *************** *** 61,65 **** readline.set_completer(Completer(my_namespace).complete) """ ! if namespace and not isinstance(namespace, dict): raise TypeError,'namespace must be a dictionary' --- 61,65 ---- readline.set_completer(Completer(my_namespace).complete) """ ! if namespace and not isinstance(namespace, dict): raise TypeError,'namespace must be a dictionary' *************** *** 83,87 **** if self.use_main_ns: self.namespace = __main__.__dict__ ! if state == 0: if "." in text: --- 83,87 ---- if self.use_main_ns: self.namespace = __main__.__dict__ ! if state == 0: if "." in text: Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** smtplib.py 15 Apr 2002 20:03:30 -0000 1.52 --- smtplib.py 16 Apr 2002 01:38:39 -0000 1.53 *************** *** 228,233 **** By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised if the specified `host' doesn't respond correctly. If specified, ! `local_hostname` is used as the FQDN of the local host. By default, ! the local hostname is found using socket.getfqdn(). """ --- 228,233 ---- By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised if the specified `host' doesn't respond correctly. If specified, ! `local_hostname` is used as the FQDN of the local host. By default, ! the local hostname is found using socket.getfqdn(). """ Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** warnings.py 16 Apr 2002 01:33:59 -0000 1.11 --- warnings.py 16 Apr 2002 01:38:39 -0000 1.12 *************** *** 14,18 **** # Check if message is already a Warning object if isinstance(message, Warning): ! category = message.__class__ # Check category argument if category is None: --- 14,18 ---- # Check if message is already a Warning object if isinstance(message, Warning): ! category = message.__class__ # Check category argument if category is None: *************** *** 54,62 **** registry = {} if isinstance(message, Warning): ! text = str(message) ! category = message.__class__ else: ! text = message ! message = category(message) key = (text, category, lineno) # Quick test for common case --- 54,62 ---- registry = {} if isinstance(message, Warning): ! text = str(message) ! category = message.__class__ else: ! text = message ! message = category(message) key = (text, category, lineno) # Quick test for common case From tim_one@sourceforge.net Tue Apr 16 02:38:44 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 18:38:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.14,1.15 string_tests.py,1.13,1.14 test_cfgparser.py,1.10,1.11 test_email.py,1.27,1.28 test_longexp.py,1.5,1.6 test_mpz.py,1.2,1.3 test_netrc.py,1.1,1.2 test_robotparser.py,1.1,1.2 test_types.py,1.27,1.28 test_unicode.py,1.54,1.55 test_univnewlines.py,1.1,1.2 test_urlparse.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29959/python/Lib/test Modified Files: pickletester.py string_tests.py test_cfgparser.py test_email.py test_longexp.py test_mpz.py test_netrc.py test_robotparser.py test_types.py test_unicode.py test_univnewlines.py test_urlparse.py Log Message: Whitespace normalization. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pickletester.py 6 Mar 2002 17:11:18 -0000 1.14 --- pickletester.py 16 Apr 2002 01:38:39 -0000 1.15 *************** *** 254,258 **** s = self.dumps(t) u = self.loads(s) ! self.assertEqual(t, u) import os if hasattr(os, "stat"): --- 254,258 ---- s = self.dumps(t) u = self.loads(s) ! self.assertEqual(t, u) import os if hasattr(os, "stat"): Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** string_tests.py 15 Apr 2002 13:36:43 -0000 1.13 --- string_tests.py 16 Apr 2002 01:38:40 -0000 1.14 *************** *** 240,244 **** test('zfill', '34', '34', 1) test('zfill', '34', '0034', 4) ! # Encoding/decoding codecs = [('rot13', 'uryyb jbeyq'), --- 240,244 ---- test('zfill', '34', '34', 1) test('zfill', '34', '0034', 4) ! # Encoding/decoding codecs = [('rot13', 'uryyb jbeyq'), Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_cfgparser.py 8 Mar 2002 18:10:12 -0000 1.10 --- test_cfgparser.py 16 Apr 2002 01:38:40 -0000 1.11 *************** *** 68,72 **** likes it. """) ! def case_sensitivity(): print "Testing case sensitivity..." --- 68,72 ---- likes it. """) ! def case_sensitivity(): print "Testing case sensitivity..." Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_email.py 15 Apr 2002 22:11:55 -0000 1.27 --- test_email.py 16 Apr 2002 01:38:40 -0000 1.28 *************** *** 314,318 **** eq(msg.get_params(), [('multipart/report', ''), ! ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) msg.set_param("report-type", old_val) eq(msg.get_params(), --- 314,318 ---- eq(msg.get_params(), [('multipart/report', ''), ! ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) msg.set_param("report-type", old_val) eq(msg.get_params(), *************** *** 332,336 **** eq(msg['content-type'], 'text/html; charset="us-ascii"') ! # Test the email.Encoders module --- 332,336 ---- eq(msg['content-type'], 'text/html; charset="us-ascii"') ! # Test the email.Encoders module *************** *** 410,414 **** Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; ! spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" ''') --- 410,414 ---- Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; ! spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" ''') *************** *** 451,470 **** msg['Received'] = """\ from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) """ self.assertEqual(msg.as_string(), """\ Received: from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) --- 451,470 ---- msg['Received'] = """\ from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) """ self.assertEqual(msg.as_string(), """\ Received: from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) *************** *** 722,726 **** --BOUNDARY-- ! ''') def test_one_part_in_a_multipart(self): --- 722,726 ---- --BOUNDARY-- ! ''') def test_one_part_in_a_multipart(self): *************** *** 749,753 **** --BOUNDARY-- ! ''') def test_seq_parts_in_a_multipart(self): --- 749,753 ---- --BOUNDARY-- ! ''') def test_seq_parts_in_a_multipart(self): *************** *** 776,780 **** --BOUNDARY-- ! ''') --- 776,780 ---- --BOUNDARY-- ! ''') *************** *** 1164,1172 **** all = module.__all__ all.sort() ! self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', ! 'Header', 'Iterators', 'MIMEAudio', ! 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', ! 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME']) --- 1164,1172 ---- all = module.__all__ all.sort() ! self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', ! 'Header', 'Iterators', 'MIMEAudio', ! 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', ! 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME']) *************** *** 1314,1318 **** To: bperson@dom.ain Subject: the next line has a space on it ! Date: Mon, 8 Apr 2002 15:09:19 -0400 Message-ID: spam --- 1314,1318 ---- To: bperson@dom.ain Subject: the next line has a space on it ! Date: Mon, 8 Apr 2002 15:09:19 -0400 Message-ID: spam *************** *** 1368,1372 **** eHh4eCB4eHh4IA==\r """) ! def test_header_encode(self): eq = self.assertEqual --- 1368,1372 ---- eHh4eCB4eHh4IA==\r """) ! def test_header_encode(self): eq = self.assertEqual *************** *** 1505,1509 **** two line""") ! --- 1505,1509 ---- two line""") ! Index: test_longexp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_longexp.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_longexp.py 15 Mar 2002 13:50:54 -0000 1.5 --- test_longexp.py 16 Apr 2002 01:38:40 -0000 1.6 *************** *** 7,13 **** if sys.platform == 'mac': ! import gestalt ! if gestalt.gestalt('sysv') > 0x9ff: ! raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython' if sys.platform == "os2emx": raise TestFailed, "OS/2+EMX port has malloc problems with long expressions" --- 7,13 ---- if sys.platform == 'mac': ! import gestalt ! if gestalt.gestalt('sysv') > 0x9ff: ! raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython' if sys.platform == "os2emx": raise TestFailed, "OS/2+EMX port has malloc problems with long expressions" Index: test_mpz.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mpz.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_mpz.py 1 Apr 2002 18:59:20 -0000 1.2 --- test_mpz.py 16 Apr 2002 01:38:40 -0000 1.3 *************** *** 88,90 **** except ValueError: pass else: raise TestFailed, 'mpz(-10).binary() should raise a ValueError' - --- 88,89 ---- Index: test_netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_netrc.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_netrc.py 22 Mar 2002 02:48:57 -0000 1.1 --- test_netrc.py 16 Apr 2002 01:38:40 -0000 1.2 *************** *** 13,17 **** line4 ! default login log2 password pass2 """ --- 13,17 ---- line4 ! default login log2 password pass2 """ *************** *** 26,30 **** fp.close() self.netrc = netrc.netrc(temp_filename) ! def tearDown (self): del self.netrc --- 26,30 ---- fp.close() self.netrc = netrc.netrc(temp_filename) ! def tearDown (self): del self.netrc *************** *** 37,43 **** self.assert_(self.netrc.hosts['foo'] == ('log1', 'acct1', 'pass1')) self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2')) ! ! if __name__ == "__main__": test_support.run_unittest(NetrcTestCase) - --- 37,42 ---- self.assert_(self.netrc.hosts['foo'] == ('log1', 'acct1', 'pass1')) self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2')) ! ! if __name__ == "__main__": test_support.run_unittest(NetrcTestCase) Index: test_robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_robotparser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_robotparser.py 28 Feb 2002 15:24:47 -0000 1.1 --- test_robotparser.py 16 Apr 2002 01:38:40 -0000 1.2 *************** *** 31,42 **** def RobotTest(index, robots_txt, good_urls, bad_urls, agent="test_robotparser"): ! ! lines = StringIO.StringIO(robots_txt).readlines() ! parser = robotparser.RobotFileParser() ! parser.parse(lines) ! for url in good_urls: ! tests.addTest(RobotTestCase(index, parser, url, 1, agent)) ! for url in bad_urls: ! tests.addTest(RobotTestCase(index, parser, url, 0, agent)) # Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002) --- 31,42 ---- def RobotTest(index, robots_txt, good_urls, bad_urls, agent="test_robotparser"): ! ! lines = StringIO.StringIO(robots_txt).readlines() ! parser = robotparser.RobotFileParser() ! parser.parse(lines) ! for url in good_urls: ! tests.addTest(RobotTestCase(index, parser, url, 1, agent)) ! for url in bad_urls: ! tests.addTest(RobotTestCase(index, parser, url, 0, agent)) # Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002) *************** *** 117,121 **** bad = ['/tmp/','/tmp/a.html', '/a%3cd.html','/a%3Cd.html',"/a/b.html", ! '/%7Ejoe/index.html'] RobotTest(6, doc, good, bad) --- 117,121 ---- bad = ['/tmp/','/tmp/a.html', '/a%3cd.html','/a%3Cd.html',"/a/b.html", ! '/%7Ejoe/index.html'] RobotTest(6, doc, good, bad) Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_types.py 12 Apr 2002 15:11:59 -0000 1.27 --- test_types.py 16 Apr 2002 01:38:40 -0000 1.28 *************** *** 495,499 **** try: for i in d: ! d[i+1] = 1 except RuntimeError: pass --- 495,499 ---- try: for i in d: ! d[i+1] = 1 except RuntimeError: pass Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** test_unicode.py 15 Apr 2002 13:36:44 -0000 1.54 --- test_unicode.py 16 Apr 2002 01:38:40 -0000 1.55 *************** *** 524,528 **** u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' ! u' Nunstuck git und'.encode('utf-8') == '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' --- 524,528 ---- u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' ! u' Nunstuck git und'.encode('utf-8') == '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' Index: test_univnewlines.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_univnewlines.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_univnewlines.py 14 Apr 2002 20:17:18 -0000 1.1 --- test_univnewlines.py 16 Apr 2002 01:38:40 -0000 1.2 *************** *** 6,14 **** DATA_TEMPLATE=[ ! "line1=1", ! "line2='this is a very long line designed to go past the magic " + ! "hundred character limit that is inside fileobject.c and which " + ! "is meant to speed up the common case, but we also want to test " + ! "the uncommon case, naturally.'", "def line3():pass" ] --- 6,14 ---- DATA_TEMPLATE=[ ! "line1=1", ! "line2='this is a very long line designed to go past the magic " + ! "hundred character limit that is inside fileobject.c and which " + ! "is meant to speed up the common case, but we also want to test " + ! "the uncommon case, naturally.'", "def line3():pass" ] *************** *** 41,45 **** except: pass ! def test_read(self): fp = open(test_support.TESTFN, self.READMODE) --- 41,45 ---- except: pass ! def test_read(self): fp = open(test_support.TESTFN, self.READMODE) *************** *** 47,51 **** self.assertEqual(data, DATA_LF) self.assertEqual(`fp.newlines`, `self.NEWLINE`) ! def test_readlines(self): fp = open(test_support.TESTFN, self.READMODE) --- 47,51 ---- self.assertEqual(data, DATA_LF) self.assertEqual(`fp.newlines`, `self.NEWLINE`) ! def test_readlines(self): fp = open(test_support.TESTFN, self.READMODE) *************** *** 63,67 **** self.assertEqual(data, DATA_SPLIT) self.assertEqual(`fp.newlines`, `self.NEWLINE`) ! def test_seek(self): fp = open(test_support.TESTFN, self.READMODE) --- 63,67 ---- self.assertEqual(data, DATA_SPLIT) self.assertEqual(`fp.newlines`, `self.NEWLINE`) ! def test_seek(self): fp = open(test_support.TESTFN, self.READMODE) *************** *** 73,77 **** data = fp.readlines() self.assertEqual(data, DATA_SPLIT[1:]) ! def test_execfile(self): dict = {} --- 73,77 ---- data = fp.readlines() self.assertEqual(data, DATA_SPLIT[1:]) ! def test_execfile(self): dict = {} *************** *** 79,83 **** func = dict['line3'] self.assertEqual(func.func_code.co_firstlineno, 3) ! class TestNativeNewlines(TestGenericUnivNewlines): --- 79,83 ---- func = dict['line3'] self.assertEqual(func.func_code.co_firstlineno, 3) ! class TestNativeNewlines(TestGenericUnivNewlines): *************** *** 86,106 **** READMODE='r' WRITEMODE='w' ! class TestCRNewlines(TestGenericUnivNewlines): NEWLINE='\r' DATA=DATA_CR ! class TestLFNewlines(TestGenericUnivNewlines): NEWLINE='\n' DATA=DATA_LF ! class TestCRLFNewlines(TestGenericUnivNewlines): NEWLINE='\r\n' DATA=DATA_CRLF ! class TestMixedNewlines(TestGenericUnivNewlines): NEWLINE=('\r', '\n') DATA=DATA_MIXED ! def test_main(): --- 86,106 ---- READMODE='r' WRITEMODE='w' ! class TestCRNewlines(TestGenericUnivNewlines): NEWLINE='\r' DATA=DATA_CR ! class TestLFNewlines(TestGenericUnivNewlines): NEWLINE='\n' DATA=DATA_LF ! class TestCRLFNewlines(TestGenericUnivNewlines): NEWLINE='\r\n' DATA=DATA_CRLF ! class TestMixedNewlines(TestGenericUnivNewlines): NEWLINE=('\r', '\n') DATA=DATA_MIXED ! def test_main(): Index: test_urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urlparse.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_urlparse.py 23 Mar 2002 05:32:10 -0000 1.4 --- test_urlparse.py 16 Apr 2002 01:38:40 -0000 1.5 *************** *** 124,126 **** if __name__ == "__main__": test_main() - --- 124,125 ---- From tim_one@sourceforge.net Tue Apr 16 02:51:27 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 18:51:27 -0700 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32571/python/Lib Modified Files: warnings.py Log Message: resetwarnings(): Remove extra space from docstring guts. Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** warnings.py 16 Apr 2002 01:38:39 -0000 1.12 --- warnings.py 16 Apr 2002 01:51:25 -0000 1.13 *************** *** 140,144 **** def resetwarnings(): ! """Clear the list of warning filters, so that no filters are active.""" filters[:] = [] --- 140,144 ---- def resetwarnings(): ! """Clear the list of warning filters, so that no filters are active.""" filters[:] = [] From tim_one@sourceforge.net Tue Apr 16 02:59:20 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 18:59:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2166/python/Lib/test Modified Files: test_descr.py Log Message: Fewer deprecation warnings. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** test_descr.py 15 Apr 2002 01:03:30 -0000 1.129 --- test_descr.py 16 Apr 2002 01:59:17 -0000 1.130 *************** *** 3,6 **** --- 3,11 ---- from test_support import verify, vereq, verbose, TestFailed, TESTFN from copy import deepcopy + import warnings + + warnings.filterwarnings("ignore", + r'complex divmod\(\), // and % are deprecated$', + DeprecationWarning, r'(|test_descr)$') def veris(a, b): From fdrake@sourceforge.net Tue Apr 16 03:03:08 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 19:03:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv3453/Doc/ref Modified Files: ref3.tex Log Message: Remove repeated index entry; adds nothing different. Closes SF bug #518985. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** ref3.tex 11 Apr 2002 12:39:35 -0000 1.86 --- ref3.tex 16 Apr 2002 02:03:05 -0000 1.87 *************** *** 144,149 **** It is used to indicate the presence of the \samp{...} syntax in a slice. Its truth value is true. ! \ttindex{Ellipsis} ! \obindex{Ellipsis@{\texttt{Ellipsis}}} \item[Numbers] --- 144,148 ---- It is used to indicate the presence of the \samp{...} syntax in a slice. Its truth value is true. ! \obindex{Ellipsis} \item[Numbers] From fdrake@sourceforge.net Tue Apr 16 03:03:33 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 19:03:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.82,1.82.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv3507/Doc/ref Modified Files: Tag: release22-maint ref3.tex Log Message: Remove repeated index entry; adds nothing different. Closes SF bug #518985. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.82 retrieving revision 1.82.4.1 diff -C2 -d -r1.82 -r1.82.4.1 *** ref3.tex 14 Dec 2001 22:52:41 -0000 1.82 --- ref3.tex 16 Apr 2002 02:03:31 -0000 1.82.4.1 *************** *** 144,149 **** It is used to indicate the presence of the \samp{...} syntax in a slice. Its truth value is true. ! \ttindex{Ellipsis} ! \obindex{Ellipsis@{\texttt{Ellipsis}}} \item[Numbers] --- 144,148 ---- It is used to indicate the presence of the \samp{...} syntax in a slice. Its truth value is true. ! \obindex{Ellipsis} \item[Numbers] From fdrake@sourceforge.net Tue Apr 16 03:04:22 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 15 Apr 2002 19:04:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.64.2.2,1.64.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv3620/Doc/ref Modified Files: Tag: release21-maint ref3.tex Log Message: Remove repeated index entry; adds nothing different. Closes SF bug #518985. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.64.2.2 retrieving revision 1.64.2.3 diff -C2 -d -r1.64.2.2 -r1.64.2.3 *** ref3.tex 29 May 2001 16:06:21 -0000 1.64.2.2 --- ref3.tex 16 Apr 2002 02:04:20 -0000 1.64.2.3 *************** *** 149,154 **** It is used to indicate the presence of the \samp{...} syntax in a slice. Its truth value is true. ! \ttindex{Ellipsis} ! \obindex{Ellipsis@{\texttt{Ellipsis}}} \item[Numbers] --- 149,153 ---- It is used to indicate the presence of the \samp{...} syntax in a slice. Its truth value is true. ! \obindex{Ellipsis} \item[Numbers] From tim_one@sourceforge.net Tue Apr 16 03:08:53 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 15 Apr 2002 19:08:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4267/python/Lib/test Modified Files: test_email.py Log Message: Apparently 3 of the tests here rely on trailing whitespace and/or hard tab characters, so reverting the whitespace normalization. Barry, please repair this. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_email.py 16 Apr 2002 01:38:40 -0000 1.28 --- test_email.py 16 Apr 2002 02:08:51 -0000 1.29 *************** *** 314,318 **** eq(msg.get_params(), [('multipart/report', ''), ! ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) msg.set_param("report-type", old_val) eq(msg.get_params(), --- 314,318 ---- eq(msg.get_params(), [('multipart/report', ''), ! ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) msg.set_param("report-type", old_val) eq(msg.get_params(), *************** *** 332,336 **** eq(msg['content-type'], 'text/html; charset="us-ascii"') ! # Test the email.Encoders module --- 332,336 ---- eq(msg['content-type'], 'text/html; charset="us-ascii"') ! # Test the email.Encoders module *************** *** 410,414 **** Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; ! spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" ''') --- 410,414 ---- Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; ! spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" ''') *************** *** 451,470 **** msg['Received'] = """\ from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) """ self.assertEqual(msg.as_string(), """\ Received: from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) --- 451,470 ---- msg['Received'] = """\ from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) """ self.assertEqual(msg.as_string(), """\ Received: from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) *************** *** 722,726 **** --BOUNDARY-- ! ''') def test_one_part_in_a_multipart(self): --- 722,726 ---- --BOUNDARY-- ! ''') def test_one_part_in_a_multipart(self): *************** *** 749,753 **** --BOUNDARY-- ! ''') def test_seq_parts_in_a_multipart(self): --- 749,753 ---- --BOUNDARY-- ! ''') def test_seq_parts_in_a_multipart(self): *************** *** 776,780 **** --BOUNDARY-- ! ''') --- 776,780 ---- --BOUNDARY-- ! ''') *************** *** 1164,1172 **** all = module.__all__ all.sort() ! self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', ! 'Header', 'Iterators', 'MIMEAudio', ! 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', ! 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME']) --- 1164,1172 ---- all = module.__all__ all.sort() ! self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', ! 'Header', 'Iterators', 'MIMEAudio', ! 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', ! 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME']) *************** *** 1314,1318 **** To: bperson@dom.ain Subject: the next line has a space on it ! Date: Mon, 8 Apr 2002 15:09:19 -0400 Message-ID: spam --- 1314,1318 ---- To: bperson@dom.ain Subject: the next line has a space on it ! Date: Mon, 8 Apr 2002 15:09:19 -0400 Message-ID: spam *************** *** 1368,1372 **** eHh4eCB4eHh4IA==\r """) ! def test_header_encode(self): eq = self.assertEqual --- 1368,1372 ---- eHh4eCB4eHh4IA==\r """) ! def test_header_encode(self): eq = self.assertEqual *************** *** 1505,1509 **** two line""") ! --- 1505,1509 ---- two line""") ! From gvanrossum@sourceforge.net Tue Apr 16 03:14:06 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Mon, 15 Apr 2002 19:14:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5426 Modified Files: regrtest.py Log Message: Expect test_email_codecs to be skipped -- few users or developers will have the needed optional Japanese codecs installed. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** regrtest.py 16 Apr 2002 00:29:27 -0000 1.79 --- regrtest.py 16 Apr 2002 02:14:04 -0000 1.80 *************** *** 521,524 **** --- 521,525 ---- test_curses test_dl + test_email_codecs test_gl test_imgfile From jhylton@sourceforge.net Tue Apr 16 04:18:57 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:18:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_java.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv16830 Modified Files: asdl_java.py Log Message: Fix a small typo in the doc string :-) Index: asdl_java.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_java.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asdl_java.py 14 Apr 2002 10:17:58 -0000 1.1 --- asdl_java.py 16 Apr 2002 03:18:54 -0000 1.2 *************** *** 1,3 **** ! """Generate C code from an ASDL description.""" # TO DO --- 1,3 ---- ! """Generate Java code from an ASDL description.""" # TO DO From jhylton@sourceforge.net Tue Apr 16 04:20:47 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:20:47 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv17187 Modified Files: python.asdl Log Message: Instead of extra Lvalue production, have separate constructors for the assign type. This makes sense because the code generate for an expression as the target of an assignment is quite different than an expression elsewhere. Remove LtGt (Less than, Greater than) as that's just another way to spell NotEq. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** python.asdl 14 Apr 2002 10:10:02 -0000 1.11 --- python.asdl 16 Apr 2002 03:20:45 -0000 1.12 *************** *** 53,68 **** expr? starargs, expr? kwargs) | Repr(expr value) - | Lvalue(assign lvalue) | Num(string n) -- string representation of a number | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? ! ! -- the subset of expressions that are valid as the target of ! -- assignments. ! assign = Attribute(expr value, identifier attr) | Subscript(expr value, slice slice) | Name(identifier id) | List(expr* elts) | Tuple(expr *elts) slice = Ellipsis | Slice(expr? lower, expr? upper) -- maybe Slice and ExtSlice should be merged... --- 53,71 ---- expr? starargs, expr? kwargs) | Repr(expr value) | Num(string n) -- string representation of a number | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? ! | Attribute(expr value, identifier attr) | Subscript(expr value, slice slice) | Name(identifier id) | List(expr* elts) | Tuple(expr *elts) + -- the subset of expressions that are valid as the target of + -- assignments. + assign = AssignAttribute(expr value, identifier attr) + | AssignSubscript(expr value, slice slice) + | AssignName(identifier id) + | AssignList(expr* elts) | AssignTuple(expr *elts) + slice = Ellipsis | Slice(expr? lower, expr? upper) -- maybe Slice and ExtSlice should be merged... *************** *** 76,81 **** unaryop = Invert | Not | UAdd | USub ! cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | LtGt ! | Is | IsNot | In | NotIn listcomp = (expr target, expr iter, expr* ifs) --- 79,83 ---- unaryop = Invert | Not | UAdd | USub ! cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn listcomp = (expr target, expr iter, expr* ifs) From jhylton@sourceforge.net Tue Apr 16 04:21:55 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:21:55 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.c,1.1,1.2 asdl.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv17506 Modified Files: asdl.c asdl.h Log Message: Prefix all names with asdl_seq (yuck). Fix asdl_seq_append() so that it's ++-ing the right member. Add asdl_seq_free(). Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asdl.c 12 Apr 2002 15:56:43 -0000 1.1 --- asdl.c 16 Apr 2002 03:21:52 -0000 1.2 *************** *** 2,7 **** #include "asdl.h" ! static asdl_seq * ! asdl_list_new(int size) { asdl_seq *seq = (asdl_seq *)malloc(sizeof(asdl_seq)); --- 2,7 ---- #include "asdl.h" ! asdl_seq * ! asdl_seq_new(int size) { asdl_seq *seq = (asdl_seq *)malloc(sizeof(asdl_seq)); *************** *** 18,23 **** } ! static void * ! asdl_get(asdl_seq *seq, int offset) { if (offset > seq->used) --- 18,23 ---- } ! void * ! asdl_seq_get(asdl_seq *seq, int offset) { if (offset > seq->used) *************** *** 26,31 **** } ! static int ! append(asdl_seq *seq, void *elt) { if (seq->size == seq->used) { --- 26,31 ---- } ! int ! asdl_seq_append(asdl_seq *seq, void *elt) { if (seq->size == seq->used) { *************** *** 37,41 **** seq->elements = newptr; } ! seq->elements[seq->size++] = elt; return 1; } --- 37,49 ---- seq->elements = newptr; } ! seq->elements[seq->used++] = elt; return 1; + } + + void + asdl_seq_free(asdl_seq *seq) + { + if (seq->elements) + free(seq->elements); + free(seq); } Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** asdl.h 12 Apr 2002 15:56:43 -0000 1.2 --- asdl.h 16 Apr 2002 03:21:52 -0000 1.3 *************** *** 1,5 **** #define identifier PyObject * #define bool int ! #define string const char * /* It would be nice if the code generated by asdl_c.py was completely --- 1,5 ---- #define identifier PyObject * #define bool int ! #define string PyObject * /* It would be nice if the code generated by asdl_c.py was completely *************** *** 15,20 **** } asdl_seq; ! asdl_seq *asdl_list_new(int size); ! void *asdl_get(asdl_seq *seq, int offset); ! int append(asdl_seq *seq, void *elt); --- 15,22 ---- } asdl_seq; ! asdl_seq *asdl_seq_new(int size); ! void *asdl_seq_get(asdl_seq *seq, int offset); ! int asdl_seq_append(asdl_seq *seq, void *elt); ! void asdl_seq_free(asdl_seq *); + #define asdl_seq_LEN(S) ((S)->used) From jhylton@sourceforge.net Tue Apr 16 04:22:57 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:22:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv17724 Modified Files: asdl_c.py Log Message: Generate code to handle sequences and optional types. A sequence is implemented by asdl_seq. An optional type can be NULL. For all non-optional types, raise ValueError if the argument is NULL. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** asdl_c.py 12 Apr 2002 15:50:36 -0000 1.8 --- asdl_c.py 16 Apr 2002 03:22:54 -0000 1.9 *************** *** 71,77 **** super(EmitVisitor, self).__init__() ! def emit(self, s, depth): # XXX reflow long lines? ! lines = reflow_lines(s, depth) for line in lines: line = (" " * TABSIZE * depth) + line + "\n" --- 71,80 ---- super(EmitVisitor, self).__init__() ! def emit(self, s, depth, reflow=1): # XXX reflow long lines? ! if reflow: ! lines = reflow_lines(s, depth) ! else: ! lines = [s] for line in lines: line = (" " * TABSIZE * depth) + line + "\n" *************** *** 172,176 **** ctype = get_c_type(field.type) name = field.name ! self.emit("%(ctype)s %(name)s;" % locals(), depth) def visitProduct(self, product, name, depth): --- 175,182 ---- ctype = get_c_type(field.type) name = field.name ! if field.seq: ! self.emit("asdl_seq *%(name)s;" % locals(), depth) ! else: ! self.emit("%(ctype)s %(name)s;" % locals(), depth) def visitProduct(self, product, name, depth): *************** *** 216,220 **** else: name = f.name ! args.append((get_c_type(f.type), name)) ctype = get_c_type(type) self.emit_function(cons.name, ctype, args) --- 222,231 ---- else: name = f.name ! # XXX should extend get_c_type() to handle this ! if f.seq: ! ctype = "asdl_seq *" ! else: ! ctype = get_c_type(f.type) ! args.append((ctype, name, f.opt)) ctype = get_c_type(type) self.emit_function(cons.name, ctype, args) *************** *** 223,227 **** if args: argstr = ", ".join(["%s %s" % (atype, aname) ! for atype, aname in args]) else: argstr = "void" --- 234,238 ---- if args: argstr = ", ".join(["%s %s" % (atype, aname) ! for atype, aname, opt in args]) else: argstr = "void" *************** *** 236,242 **** def emit_function(self, name, ctype, args): ! def emit(s, depth=0): ! self.emit(s, depth) ! argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname in args]) self.emit("%s" % ctype, 0) emit("%s(%s)" % (name, argstr)) --- 247,254 ---- def emit_function(self, name, ctype, args): ! def emit(s, depth=0, reflow=1): ! self.emit(s, depth, reflow) ! argstr = ", ".join(["%s %s" % (atype, aname) ! for atype, aname, opt in args]) self.emit("%s" % ctype, 0) emit("%s(%s)" % (name, argstr)) *************** *** 248,252 **** emit("}", 1) emit("p->kind = %s_kind;" % name, 1) ! for argtype, argname in args: emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) emit("return p;", 1) --- 260,272 ---- emit("}", 1) emit("p->kind = %s_kind;" % name, 1) ! for argtype, argname, opt in args: ! if not opt: ! emit("if (!%s) {" % argname, 1) ! emit("PyErr_SetString(PyExc_ValueError,", 2) ! msg = "field %s is required for %s" % (argname, name) ! emit(' "%s");' % msg, ! 2, reflow=0) ! emit('return NULL;', 2) ! emit('}', 1) emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) emit("return p;", 1) From jhylton@sourceforge.net Tue Apr 16 04:57:58 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:57:58 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast test.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23602 Added Files: test.py Log Message: Trivial little test of the parts of astmodule.c that I've finished. --- NEW FILE: test.py --- import ast ast.transform("""global a, b, c a + b - c * 3 """) From jhylton@sourceforge.net Tue Apr 16 04:58:35 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:58:35 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast setup.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23720 Modified Files: setup.py Log Message: Load the test module after building the extension Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/setup.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.py 12 Apr 2002 15:56:43 -0000 1.2 --- setup.py 16 Apr 2002 03:58:33 -0000 1.3 *************** *** 8,11 **** ext_modules=[ast]) ! import ast ! ast.transform("global xyz") --- 8,11 ---- ext_modules=[ast]) ! import test ! From jhylton@sourceforge.net Tue Apr 16 04:59:12 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:59:12 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23805 Modified Files: asdl_c.py Log Message: Factor out the simple test into a method is_simple(). Add some preliminary code (not hooked up) to generate C code to write pickles. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** asdl_c.py 16 Apr 2002 03:22:54 -0000 1.9 --- asdl_c.py 16 Apr 2002 03:59:10 -0000 1.10 *************** *** 81,84 **** --- 81,97 ---- self.file.write(line) + def is_simple(self, sum): + """Return true if a sum is a simple. + + A sum is simple if its types have no fields, e.g. + unaryop = Invert | Not | UAdd | USub + """ + simple = 1 + for t in sum.types: + if t.fields: + simple = 0 + break + return simple + class TypeDefVisitor(EmitVisitor): def visitModule(self, mod): *************** *** 90,99 **** def visitSum(self, sum, name, depth): ! simple = 1 ! for t in sum.types: ! if t.fields: ! simple = 0 ! break ! if simple: self.simple_sum(sum, name, depth) else: --- 103,107 ---- def visitSum(self, sum, name, depth): ! if self.is_simple(sum): self.simple_sum(sum, name, depth) else: *************** *** 134,143 **** def visitSum(self, sum, name, depth): ! simple = 1 ! for t in sum.types: ! if t.fields: ! simple = 0 ! break ! if not simple: self.sum_with_constructors(sum, name, depth) --- 142,146 ---- def visitSum(self, sum, name, depth): ! if not self.is_simple(sum): self.sum_with_constructors(sum, name, depth) *************** *** 198,208 **** def visitSum(self, sum, name): ! simple = 1 ! for t in sum.types: ! if t.fields: ! simple = 0 ! break ! ! if simple: pass # XXX else: --- 201,205 ---- def visitSum(self, sum, name): ! if self.is_simple(sum): pass # XXX else: *************** *** 273,277 **** emit("}") emit("") ! class ChainOfVisitors: def __init__(self, *visitors): --- 270,334 ---- emit("}") emit("") ! ! class PickleVisitor(EmitVisitor): ! ! def visitModule(self, mod): ! for dfn in mod.dfns: ! self.visit(dfn) ! ! def visitType(self, type): ! self.visit(type.value, type.name) ! ! def visitSum(self, sum, name): ! pass ! ! def visitProduct(self, sum, name): ! pass ! ! def visitConstructor(self, cons, name): ! pass ! ! def visitField(self, sum): ! pass ! ! class PicklePrototypeVisitor(PickleVisitor): ! ! def visitSum(self, sum, name): ! ctype = get_c_type(name) ! self.emit("int pkl_write_%s(PyObject *write, %s o);" % (name, ctype), ! 0) ! ! class PickleFunctionVisitor(PickleVisitor): ! ! def visitSum(self, sum, name): ! ctype = get_c_type(name) ! self.emit("int", 0) ! self.emit("pkl_write_%s(PyObject *write, %s o)" % (name, ctype), 0) ! self.emit("{", 0) ! self.emit("switch (o->kind) {", 1) ! simple = self.is_simple(sum) ! for i in range(len(sum.types)): ! t = sum.types[i] ! self.visit(t, i + 1, name, simple) ! self.emit("}", 1) ! self.emit("return 0;", 1) ! self.emit("}", 0) ! self.emit("", 0) ! ! def visitConstructor(self, cons, enum, name, simple): ! if simple: ! pass ! else: ! self.emit("case %s_kind:" % cons.name, 1) ! self.emit("pkl_write_int(write, %d);" % enum, 2) ! for f in cons.fields: ! self.visit(f, cons.name) ! self.emit("break;", 2) ! ! def visitField(self, field, name): ! # handle seq and opt ! self.emit("pkl_write_%s(write, o->v.%s.%s);" % ( ! field.type, name, field.name), 2) ! class ChainOfVisitors: def __init__(self, *visitors): *************** *** 292,296 **** c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! PrototypeVisitor(f) ) c.visit(mod) --- 349,354 ---- c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), ! PrototypeVisitor(f), ! ## PicklePrototypeVisitor(f), ) c.visit(mod) *************** *** 300,304 **** print >> f, '#include "Python.h"' print >> f, '#include "%s-ast.h"' % mod.name ! v = FunctionVisitor(f) v.visit(mod) f.close() --- 358,364 ---- print >> f, '#include "Python.h"' print >> f, '#include "%s-ast.h"' % mod.name ! v = ChainOfVisitors(FunctionVisitor(f), ! ## PickleFunctionVisitor(f), ! ) v.visit(mod) f.close() From jhylton@sourceforge.net Tue Apr 16 04:59:48 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 20:59:48 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23898 Modified Files: astmodule.c Log Message: Lots more conversion code, which handles many expressions. Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** astmodule.c 12 Apr 2002 15:55:25 -0000 1.2 --- astmodule.c 16 Apr 2002 03:59:46 -0000 1.3 *************** *** 1,3 **** --- 1,7 ---- #include "Python.h" + + #undef NDEBUG + #include + #include "Python-ast.h" *************** *** 8,14 **** #include "graminit.h" - extern grammar _PyParser_Grammar; /* From graminit.c */ ! extern stmt_ty Global(identifier name); /* XXX should be seq */ --- 12,18 ---- #include "graminit.h" ! ! extern grammar _PyParser_Grammar; /* From graminit.c */ /* XXX should be seq */ *************** *** 17,34 **** { /* global_stmt: 'global' NAME (',' NAME)* */ ! identifier *name; REQ(n, global_stmt); ! n = CHILD(n, 1); ! name = PyString_InternFromString(STR(n)); ! if (!name) return NULL; ! return Global(name); } ! static stmt_ty ! ast_for_stmt(node *n) { int i; REQ(n, stmt); assert(NCH(n) == 1); --- 21,310 ---- { /* global_stmt: 'global' NAME (',' NAME)* */ ! identifier name; ! asdl_seq *s; ! int i; ! REQ(n, global_stmt); ! s = asdl_seq_new(NCH(n) / 2); ! for (i = 1; i < NCH(n); i += 2) { ! name = PyString_InternFromString(STR(CHILD(n, i))); ! if (!name) ! return NULL; ! if (asdl_seq_append(s, name) < 0) ! return NULL; ! } ! return Global(s); ! } ! ! static cmpop_ty ! ast_for_comp_op(node *n) ! { ! /* comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is' ! |'is' 'not' ! */ ! REQ(n, comp_op); ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! switch (TYPE(n)) { ! case LESS: ! return Lt; ! case GREATER: ! return Gt; ! case EQEQUAL: /* == */ ! case EQUAL: ! return Eq; ! case LESSEQUAL: ! return LtE; ! case GREATEREQUAL: ! return GtE; ! case NOTEQUAL: ! return NotEq; ! case NAME: ! if (strcmp(STR(n), "in") == 0) ! return In; ! if (strcmp(STR(n), "is") == 0) ! return Is; ! } ! } ! else if (NCH(n) == 2) { ! switch (TYPE(CHILD(n, 0))) { ! case NAME: ! if (strcmp(STR(CHILD(n, 1)), "in") == 0) ! return NotIn; ! if (strcmp(STR(CHILD(n, 0)), "is") == 0) ! return IsNot; ! } ! } ! return 0; ! } ! ! static expr_ty ! ast_for_lambdef(node *n) ! { ! return NULL; ! } ! ! static expr_ty ! ast_for_atom(node *n) ! { ! /* atom: '(' [testlist] ')' | '[' [listmaker] ']' ! | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ ! */ ! node *ch = CHILD(n, 0); ! switch (TYPE(ch)) { ! case NAME: { ! return Name(PyString_InternFromString(STR(ch))); ! break; ! } ! case STRING: ! return Str(PyString_FromString("darn, strings are hard to parse")); ! break; ! case NUMBER: ! return Num(PyString_FromString("darn, numbers are hard too")); ! break; ! /* XXX other cases... */ ! default: ! fprintf(stderr, "unhandled atom %d\n", TYPE(ch)); ! } ! return NULL; ! } ! ! static expr_ty ! ast_for_expr(node *n) ! { ! /* handle the full range of simple expressions ! test: and_test ('or' and_test)* | lambdef ! and_test: not_test ('and' not_test)* ! not_test: 'not' not_test | comparison ! comparison: expr (comp_op expr)* ! expr: xor_expr ('|' xor_expr)* ! xor_expr: and_expr ('^' and_expr)* ! and_expr: shift_expr ('&' shift_expr)* ! shift_expr: arith_expr (('<<'|'>>') arith_expr)* ! arith_expr: term (('+'|'-') term)* ! term: factor (('*'|'/'|'%'|'//') factor)* ! factor: ('+'|'-'|'~') factor | power ! power: atom trailer* ('**' factor)* ! */ ! ! asdl_seq *seq; ! operator_ty op = 0; ! int i; ! ! loop: ! switch (TYPE(n)) { ! case test: ! if (TYPE(CHILD(n, 0)) == lambdef) ! return ast_for_lambdef(CHILD(n, 0)); ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } ! seq = asdl_seq_new(NCH(n) / 2 + 1); ! for (i = 0; i < NCH(n); i += 2) ! asdl_seq_append(seq, ast_for_expr(CHILD(n, i))); ! return BoolOp(Or, seq); ! break; ! case and_test: ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } ! seq = asdl_seq_new(NCH(n) / 2 + 1); ! for (i = 0; i < NCH(n); i += 2) ! asdl_seq_append(seq, ast_for_expr(CHILD(n, i))); ! return BoolOp(And, seq); ! break; ! case not_test: ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } ! else ! return UnaryOp(Not, ast_for_expr(CHILD(n, 1))); ! case comparison: ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } else { ! asdl_seq *ops, *cmps; ! ops = asdl_seq_new(NCH(n) / 2 + 1); ! cmps = asdl_seq_new(NCH(n) / 2 + 1); ! for (i = 1; i < NCH(n); i += 2) { ! asdl_seq_append(ops, (void *)ast_for_comp_op(CHILD(n, i))); ! asdl_seq_append(cmps, (void *)ast_for_expr(CHILD(n, i + 1))); ! } ! return Compare(ast_for_expr(CHILD(n, 0)), ops, cmps); ! } ! break; ! ! /* The next five cases all handle BinOps. The main body of code ! is the same in each case, but the switch turned inside out to ! reuse the code for each type of operator. ! */ ! case expr: ! case xor_expr: ! case and_expr: ! case shift_expr: ! case arith_expr: ! case term: ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } ! switch (TYPE(CHILD(n, 1))) { ! case VBAR: ! op = BitOr; ! break; ! case CIRCUMFLEX: ! op = BitXor; ! break; ! case AMPER: ! op = BitAnd; ! break; ! case LEFTSHIFT: ! op = LShift; ! break; ! case RIGHTSHIFT: ! op = RShift; ! break; ! case PLUS: ! op = Add; ! break; ! case MINUS: ! op = Sub; ! break; ! case STAR: ! op = Mult; ! break; ! case SLASH: ! op = Div; ! break; ! case DOUBLESLASH: ! op = FloorDiv; ! break; ! case PERCENT: ! op = Mod; ! break; ! } ! return BinOp(ast_for_expr(CHILD(n, 0)), op, ! ast_for_expr(CHILD(n, 2))); ! break; ! case factor: ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } ! switch (TYPE(CHILD(n, 0))) { ! case PLUS: ! return UnaryOp(UAdd, ast_for_expr(CHILD(n, 1))); ! break; ! case MINUS: ! return UnaryOp(USub, ast_for_expr(CHILD(n, 1))); ! break; ! case TILDE: ! return UnaryOp(Invert, ast_for_expr(CHILD(n, 1))); ! break; ! } ! break; ! case power: ! if (NCH(n) == 1) { ! expr_ty e = ast_for_atom(CHILD(n, 0)); ! assert(e); ! return e; ! } return NULL; ! break; ! } ! /* should never get here */ ! return NULL; } ! static asdl_seq * ! seq_for_testlist(node *n) { + asdl_seq *seq; int i; + REQ(n, testlist); + seq = asdl_seq_new(NCH(n) / 2); + for (i = 0; i < NCH(n); i += 2) { + asdl_seq_append(seq, ast_for_expr(CHILD(n, i))); + } + return seq; + } + + static stmt_ty + ast_for_expr_stmt(node *n) + { + REQ(n, expr_stmt); + /* expr_stmt: testlist (augassign testlist | ('=' testlist)*) + testlist: test (',' test)* [','] + augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' + | '<<=' | '>>=' | '**=' | '//=' + test: ... here starts the operator precendence dance + */ + + if (NCH(n) == 1) { + /* a bare expression */ + node *ch = CHILD(n, 0); + REQ(ch, testlist); + if (NCH(ch) == 1) { + /* a simple expression */ + return Expr(ast_for_expr(CHILD(ch, 0))); + } + else + return Expr(Tuple(seq_for_testlist(ch))); + } else if (TYPE(CHILD(n, 1)) == augassign) { + /* an augmented assignment */ + } else { + /* a normal assignment */ + } + return NULL; + } + + static stmt_ty + ast_for_stmt(node *n) + { REQ(n, stmt); assert(NCH(n) == 1); *************** *** 47,51 **** switch (TYPE(n)) { case expr_stmt: ! fprintf(stderr, "expr_stmt NCH=%d\n", NCH(n)); break; case global_stmt: --- 323,327 ---- switch (TYPE(n)) { case expr_stmt: ! return ast_for_expr_stmt(n); break; case global_stmt: *************** *** 65,78 **** { int i; REQ(n, file_input); fprintf(stderr, "file_input NCH=%d\n", NCH(n)); for (i = 0; i < NCH(n); i++) { ! if (TYPE(CHILD(n, i)) == stmt) ! ast_for_stmt(CHILD(n, i)); else fprintf(stderr, "skipping %d\n", TYPE(CHILD(n, i))); } ! return NULL; } --- 341,365 ---- { int i; + asdl_seq *stmts; + stmt_ty s; REQ(n, file_input); + stmts = asdl_seq_new(NCH(n) / 2); fprintf(stderr, "file_input NCH=%d\n", NCH(n)); for (i = 0; i < NCH(n); i++) { ! if (TYPE(CHILD(n, i)) == stmt) { ! s = ast_for_stmt(CHILD(n, i)); ! if (!s) { ! asdl_seq_free(stmts); ! return NULL; ! } ! if (asdl_seq_append(stmts, s) < 0) { ! return NULL; ! } ! } else fprintf(stderr, "skipping %d\n", TYPE(CHILD(n, i))); } ! return Module(stmts); } *************** *** 82,85 **** --- 369,373 ---- node *n; perrdetail err; + mod_ty m; if (!PyString_Check(src)) { *************** *** 98,102 **** } ! ast_for_module(n); Py_INCREF(Py_None); --- 386,394 ---- } ! m = ast_for_module(n); ! if (!m) ! return NULL; ! ! fprintf(stderr, "module %X, stmts = %d\n", m, m->v.Module.body->used); Py_INCREF(Py_None); From jhylton@sourceforge.net Tue Apr 16 05:00:06 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Mon, 15 Apr 2002 21:00:06 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast Makefile,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv24025 Modified Files: Makefile Log Message: Add ast.so as first target. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 11 Apr 2002 21:20:19 -0000 1.4 --- Makefile 16 Apr 2002 04:00:04 -0000 1.5 *************** *** 1,7 **** PYINCLUDE=/usr/local/include/python2.3 Python-ast.o: Python-ast.c python.asdl gcc -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c ! Python-ast.c: python.asdl python asdl_c.py python.asdl --- 1,11 ---- PYINCLUDE=/usr/local/include/python2.3 + ast.so: astmodule.c setup.py Python-ast.c python.asdl asdl.c asdl.h + python setup.py build_ext -i + Python-ast.o: Python-ast.c python.asdl gcc -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c ! Python-ast.c: python.asdl asdl_c.py python asdl_c.py python.asdl + From akuchling@sourceforge.net Tue Apr 16 05:23:52 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Mon, 15 Apr 2002 21:23:52 -0700 Subject: [Python-checkins] python/nondist/peps pep-0272.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv27707 Modified Files: pep-0272.txt Log Message: Prefix mode constants with MODE_ Remove PGP mode; add CTR mode, and a reference to the NIST publication Other minor changes Index: pep-0272.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0272.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0272.txt 29 Oct 2001 22:37:17 -0000 1.3 --- pep-0272.txt 16 Apr 2002 04:23:49 -0000 1.4 *************** *** 20,26 **** Encryption algorithms transform their input data (called plaintext) in some way that is dependent on a variable key, ! producing ciphertext. The transformation can easily be reversed, if and only if one knows the key. The key is a sequence of bits ! chosen from some very large space of possible keys. Block ciphers encrypt multibyte inputs of a fixed size (frequently --- 20,27 ---- Encryption algorithms transform their input data (called plaintext) in some way that is dependent on a variable key, ! producing ciphertext. The transformation can easily be reversed if and only if one knows the key. The key is a sequence of bits ! chosen from some very large space of possible keys. There are two ! classes of encryption algorithms: block ciphers and stream ciphers. Block ciphers encrypt multibyte inputs of a fixed size (frequently *************** *** 29,47 **** Number Constant Description ! 1 ECB Electronic Code Book ! 2 CBC Cipher Block Chaining ! 3 CFB Cipher FeedBack ! 4 PGP Variant of CFB ! See _Applied Cryptography_ for descriptions of the first three ! feedback modes. The PGP feedback mode is described in the OpenPGP ! RFC. In a strict formal sense, stream ciphers encrypt data bit-by-bit; practically, stream ciphers work on a character-by-character ! basis. Stream ciphers use exactly the same interface as block ! ciphers, with a block length that will always be 1; this is how ! block and stream ciphers can be distinguished. The only feedback ! mode available for stream ciphers is ECB mode. --- 30,55 ---- Number Constant Description ! 1 MODE_ECB Electronic Code Book ! 2 MODE_CBC Cipher Block Chaining ! 3 MODE_CFB Cipher FeedBack ! 5 MODE_OFB Output Feedback ! 6 MODE_CTR Counter ! These modes are to be implemented as described in NIST publication ! SP-800A[1]. Descriptions of the first three feedback modes can ! also be found in Bruce Schneier's book _Applied ! Cryptography_ [2]. ! ! (The value of 4 is reserved for MODE_PGP, a variant of CFB ! described in RFC 2440: "OpenPGP Message Format"[3]. This mode ! isn't considered important enough to make it worth requiring it ! for all block encryption ciphers.) In a strict formal sense, stream ciphers encrypt data bit-by-bit; practically, stream ciphers work on a character-by-character ! basis. Stream ciphers can use exactly the same interface as block ! ciphers, fixing the block length at 1; this is how block and ! stream ciphers can be distinguished. The only feedback mode ! available for stream ciphers is ECB mode. *************** *** 56,60 **** Returns a ciphering object, using the secret key contained in the string 'key', and using the feedback mode 'mode', which must be ! one of the constants from the following table. If 'mode' is CBC or CFB, 'IV' must be provided, and must be a --- 64,68 ---- Returns a ciphering object, using the secret key contained in the string 'key', and using the feedback mode 'mode', which must be ! one of the constants from the table above. If 'mode' is CBC or CFB, 'IV' must be provided, and must be a *************** *** 75,79 **** module. For all feedback modes, the length of strings passed to the encrypt() and decrypt() must be a multiple of the block size. ! For stream ciphers, \code{block_size} will be 1. key_size --- 83,87 ---- module. For all feedback modes, the length of strings passed to the encrypt() and decrypt() must be a multiple of the block size. ! For stream ciphers, block_size will be 1. key_size *************** *** 120,124 **** >>> import DES ! >>> obj = DES.new('abcdefgh', DES.ECB) >>> plain="Guido van Rossum is a space alien." >>> len(plain) --- 128,132 ---- >>> import DES ! >>> obj = DES.new('abcdefgh', DES.MODE_ECB) >>> plain="Guido van Rossum is a space alien." >>> len(plain) *************** *** 137,144 **** References ! RFC2440: "OpenPGP Message Format" (http://rfc2440.x42.com, http://www.faqs.org/rfcs/rfc2440.html) - Applied Cryptography --- 145,156 ---- References ! [1] NIST publication SP 800-38A, "Recommendation for Block Cipher ! Modes of Operation" (http://csrc.nist.gov/encryption/modes/) ! ! [2] Applied Cryptography ! ! [3] RFC2440: "OpenPGP Message Format" (http://rfc2440.x42.com, http://www.faqs.org/rfcs/rfc2440.html) From bwarsaw@sourceforge.net Tue Apr 16 06:06:45 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 15 Apr 2002 22:06:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3184 Modified Files: test_email.py Log Message: Whitespace normalization, while using non-whitespace literals for intended whitespace. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** test_email.py 16 Apr 2002 02:08:51 -0000 1.29 --- test_email.py 16 Apr 2002 05:06:42 -0000 1.30 *************** *** 314,318 **** eq(msg.get_params(), [('multipart/report', ''), ! ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) msg.set_param("report-type", old_val) eq(msg.get_params(), --- 314,318 ---- eq(msg.get_params(), [('multipart/report', ''), ! ('boundary', 'D1690A7AC1.996856090/mail.example.com')]) msg.set_param("report-type", old_val) eq(msg.get_params(), *************** *** 332,336 **** eq(msg['content-type'], 'text/html; charset="us-ascii"') ! # Test the email.Encoders module --- 332,336 ---- eq(msg['content-type'], 'text/html; charset="us-ascii"') ! # Test the email.Encoders module *************** *** 410,414 **** Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; ! spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" ''') --- 410,414 ---- Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; ! \tspooge="yummy"; hippos="gargantuan"; marshmallows="gooey" ''') *************** *** 451,470 **** msg['Received'] = """\ from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) """ self.assertEqual(msg.as_string(), """\ Received: from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! from babylon.socal-raves.org (localhost [127.0.0.1]); ! by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! for ; ! Sat, 2 Feb 2002 17:00:06 -0800 (PST) --- 451,470 ---- msg['Received'] = """\ from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! \tfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) ! \tfrom babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for ; Sat, 2 Feb 2002 17:00:06 -0800 (PST) """ self.assertEqual(msg.as_string(), """\ Received: from babylon.socal-raves.org (localhost [127.0.0.1]); ! \tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! \tfor ; ! \tSat, 2 Feb 2002 17:00:06 -0800 (PST) ! \tfrom babylon.socal-raves.org (localhost [127.0.0.1]); ! \tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! \tfor ; ! \tSat, 2 Feb 2002 17:00:06 -0800 (PST) ! \tfrom babylon.socal-raves.org (localhost [127.0.0.1]); ! \tby babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; ! \tfor ; ! \tSat, 2 Feb 2002 17:00:06 -0800 (PST) *************** *** 722,726 **** --BOUNDARY-- ! ''') def test_one_part_in_a_multipart(self): --- 722,726 ---- --BOUNDARY-- ! ''') def test_one_part_in_a_multipart(self): *************** *** 749,753 **** --BOUNDARY-- ! ''') def test_seq_parts_in_a_multipart(self): --- 749,753 ---- --BOUNDARY-- ! ''') def test_seq_parts_in_a_multipart(self): *************** *** 776,780 **** --BOUNDARY-- ! ''') --- 776,780 ---- --BOUNDARY-- ! ''') *************** *** 1164,1172 **** all = module.__all__ all.sort() ! self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', ! 'Header', 'Iterators', 'MIMEAudio', ! 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', ! 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME']) --- 1164,1172 ---- all = module.__all__ all.sort() ! self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', ! 'Header', 'Iterators', 'MIMEAudio', ! 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', ! 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME']) *************** *** 1314,1318 **** To: bperson@dom.ain Subject: the next line has a space on it ! Date: Mon, 8 Apr 2002 15:09:19 -0400 Message-ID: spam --- 1314,1318 ---- To: bperson@dom.ain Subject: the next line has a space on it ! \x20 Date: Mon, 8 Apr 2002 15:09:19 -0400 Message-ID: spam *************** *** 1368,1372 **** eHh4eCB4eHh4IA==\r """) ! def test_header_encode(self): eq = self.assertEqual --- 1368,1372 ---- eHh4eCB4eHh4IA==\r """) ! def test_header_encode(self): eq = self.assertEqual *************** *** 1505,1509 **** two line""") ! --- 1505,1509 ---- two line""") ! From loewis@sourceforge.net Tue Apr 16 06:51:04 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Mon, 15 Apr 2002 22:51:04 -0700 Subject: [Python-checkins] python/dist/src configure,1.300,1.301 configure.in,1.310,1.311 pyconfig.h.in,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12980 Modified Files: configure configure.in pyconfig.h.in Log Message: Move WITH_UNIVERSAL_NEWLINES template into configure.in. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.300 retrieving revision 1.301 diff -C2 -d -r1.300 -r1.301 *** configure 15 Apr 2002 19:20:23 -0000 1.300 --- configure 16 Apr 2002 05:51:01 -0000 1.301 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.309 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.310 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 10950,10954 **** if test "$with_universal_newlines" != "no" then ! cat >>confdefs.h <<\_ACEOF #define WITH_UNIVERSAL_NEWLINES 1 _ACEOF --- 10950,10955 ---- if test "$with_universal_newlines" != "no" then ! ! cat >>confdefs.h <<\_ACEOF #define WITH_UNIVERSAL_NEWLINES 1 _ACEOF Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.310 retrieving revision 1.311 diff -C2 -d -r1.310 -r1.311 *** configure.in 15 Apr 2002 19:20:23 -0000 1.310 --- configure.in 16 Apr 2002 05:51:02 -0000 1.311 *************** *** 1456,1460 **** if test "$with_universal_newlines" != "no" then ! AC_DEFINE(WITH_UNIVERSAL_NEWLINES) fi AC_MSG_RESULT($with_universal_newlines) --- 1456,1461 ---- if test "$with_universal_newlines" != "no" then ! AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1, ! [Define if you want to read files with foreign newlines.]) fi AC_MSG_RESULT($with_universal_newlines) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** pyconfig.h.in 15 Apr 2002 19:20:27 -0000 1.31 --- pyconfig.h.in 16 Apr 2002 05:51:02 -0000 1.32 *************** *** 716,722 **** #undef WITH_CYCLE_GC - /* Define if you want to read files with foreign newlines. */ - #undef WITH_UNIVERSAL_NEWLINES - /* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry --- 716,719 ---- *************** *** 747,750 **** --- 744,750 ---- /* Define if you want to compile in rudimentary thread support */ #undef WITH_THREAD + + /* Define if you want to read files with foreign newlines. */ + #undef WITH_UNIVERSAL_NEWLINES /* Define to 1 if your processor stores words with the most significant byte From bwarsaw@sourceforge.net Tue Apr 16 13:37:57 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Tue, 16 Apr 2002 05:37:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_time.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21674 Modified Files: test_time.py Log Message: test_mktime(): Removed. This wasn't really testing anything useful (or platform independent). Closes SF bug #460357. Bug fix candidate. Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_time.py 20 Sep 2001 21:33:42 -0000 1.8 --- test_time.py 16 Apr 2002 12:37:55 -0000 1.9 *************** *** 42,51 **** self.assertRaises(TypeError, time.asctime, 0) - def test_mktime(self): - self.assertRaises(OverflowError, - time.mktime, (999999, 999999, 999999, 999999, - 999999, 999999, 999999, 999999, - 999999)) - def test_main(): --- 42,45 ---- From akuchling@sourceforge.net Tue Apr 16 14:33:47 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Tue, 16 Apr 2002 06:33:47 -0700 Subject: [Python-checkins] python/nondist/peps pep-0272.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13976 Modified Files: pep-0272.txt Log Message: Describe the segment_size and counter keyword arguments. Another bunch of rewrites and clarifications. I now think this PEP is complete enough to implement. My next step will be to implement it and see if any parts turn out to be horribly complicated or inefficient. If nothing turns up, I'll finalize the PEP; if there are problems, the PEP will be revised in light of implementation experience Index: pep-0272.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0272.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0272.txt 16 Apr 2002 04:23:49 -0000 1.4 --- pep-0272.txt 16 Apr 2002 13:33:44 -0000 1.5 *************** *** 37,62 **** These modes are to be implemented as described in NIST publication ! SP-800A[1]. Descriptions of the first three feedback modes can also be found in Bruce Schneier's book _Applied Cryptography_ [2]. ! (The value of 4 is reserved for MODE_PGP, a variant of CFB ! described in RFC 2440: "OpenPGP Message Format"[3]. This mode isn't considered important enough to make it worth requiring it ! for all block encryption ciphers.) In a strict formal sense, stream ciphers encrypt data bit-by-bit; practically, stream ciphers work on a character-by-character ! basis. Stream ciphers can use exactly the same interface as block ! ciphers, fixing the block length at 1; this is how block and ! stream ciphers can be distinguished. The only feedback mode ! available for stream ciphers is ECB mode. Specification ! All cipher algorithms share a common interface. ! Secret-key encryption modules define one function: new(key, mode, [IV], **kwargs) --- 37,66 ---- These modes are to be implemented as described in NIST publication ! SP-800A [1]. Descriptions of the first three feedback modes can also be found in Bruce Schneier's book _Applied Cryptography_ [2]. ! (The numeric value 4 is reserved for MODE_PGP, a variant of CFB ! described in RFC 2440: "OpenPGP Message Format" [3]. This mode isn't considered important enough to make it worth requiring it ! for all block encryption ciphers, though supporting it is a nice ! extra feature.) In a strict formal sense, stream ciphers encrypt data bit-by-bit; practically, stream ciphers work on a character-by-character ! basis. Stream ciphers can support the API described here by using ! fixing the block length at 1; this is how block and stream ciphers ! could be distinguished. The only feedback mode available for ! stream ciphers is ECB mode. Specification ! Encryption modules can add additional functions, methods, and ! attributes beyond those described in this PEP, but all of the ! features described in this PEP must be present for a module to ! claim compliance with it. ! Secret-key encryption modules should define one function: new(key, mode, [IV], **kwargs) *************** *** 66,96 **** one of the constants from the table above. ! If 'mode' is CBC or CFB, 'IV' must be provided, and must be a ! string of the same length as the block size. Not providing a ! value of 'IV' will result in a XXXError exception being raised. ! (what exception? ValueError? ciphermodule.error?) Depending on the algorithm, a module may support additional ! keyword arguments to this function. The most common keyword ! argument will likely be 'rounds', to set the number of rounds to ! be used. ! Secret-key encryption modules define two variables: block_size An integer value; the size of the blocks encrypted by this ! module. For all feedback modes, the length of strings passed to ! the encrypt() and decrypt() must be a multiple of the block size. ! For stream ciphers, block_size will be 1. key_size An integer value; the size of the keys required by this ! module. If key_size is None, then the algorithm accepts ! arbitrary-length keys. You cannot pass a key of length 0 ! (that is, the null string '') as such a variable-length key. ! Cipher objects require two attributes: block_size --- 70,140 ---- one of the constants from the table above. ! If 'mode' is MODE_CBC or MODE_CFB, 'IV' must be provided and must ! be a string of the same length as the block size. Not providing a ! value of 'IV' will result in a ValueError exception being raised. Depending on the algorithm, a module may support additional ! keyword arguments to this function. Some keyword arguments are ! specified by this PEP, and modules are free to add additional ! keyword arguments. If a value isn't provided for a given keyword, ! a secure default value should be used. For example, if an ! algorithm has a selectable number of rounds between 1 and 16, and ! 1-round encryption is insecure and 8-round encryption is believed ! secure, the default value for 'rounds' should be 8 or more. ! (Module implementors can choose a very slow but secure value, too, ! such as 16 in this example. This decision is left up to the ! implementor.) ! The following table lists keyword arguments defined by this PEP: ! ! Keyword Meaning ! counter Callable object that returns counter blocks ! (see below; CTR mode only) ! ! rounds Number of rounds of encryption to use ! ! segment_size Size of data and ciphertext segments, ! measured in bits (see below; CFB mode only) ! ! The Counter feedback mode requires a sequence of input blocks, ! called counters, that are used to produce the output. When 'mode' ! is MODE_CTR, the 'counter' keyword argument must be provided, and ! its value must be a callable object, such as a function or method. ! Successive calls to this callable object must return a sequence of ! strings that are of the length 'block_size' and that never ! repeats. (Appendix B of the NIST publication gives a way to ! generate such a sequence, but that's beyond the scope of this ! PEP.) ! ! The CFB mode operates on segments of the plaintext and ciphertext ! that are 'segment_size' bits long. Therefore, when using this ! mode, the input and output strings must be a multiple of ! 'segment_size' bits in length. 'segment_size' must be an integer ! between 1 and block_size*8, inclusive. (The factor of 8 comes ! from 'block_size' being measured in bytes and not in bits). The ! default value for this parameter should be block_size*8. ! Implementors are allowed to constrain 'segment_size' to be a ! multiple of 8 for simplicity, but they're encouraged to support ! arbitrary values for generality. ! ! Secret-key encryption modules should define two variables: block_size An integer value; the size of the blocks encrypted by this ! module, measured in bytes. For all feedback modes, the length ! of strings passed to the encrypt() and decrypt() must be a ! multiple of the block size. For stream ciphers, block_size ! will be 1. key_size An integer value; the size of the keys required by this ! module, measured in bytes. If key_size is None, then the ! algorithm accepts arbitrary-length keys. You cannot pass a ! key of length 0 (that is, the null string '') as such a ! variable-length key. ! Cipher objects should have two attributes: block_size *************** *** 112,119 **** decrypt(string) ! Decrypts 'string, using the key-dependent data in the object, and with the appropriate feedback mode. The string's length ! must be an exact multiple of the algorithm's block size. ! Returns a string containing the plaintext. encrypt(string) --- 156,164 ---- decrypt(string) ! Decrypts 'string', using the key-dependent data in the object and with the appropriate feedback mode. The string's length ! must be an exact multiple of the algorithm's block size or, in ! CFB mode, of the segment size. Returns a string containing ! the plaintext. encrypt(string) *************** *** 122,127 **** the object, and with the appropriate feedback mode. The string's length must be an exact multiple of the algorithm's ! block size; for stream ciphers, the string can be of any ! length. Returns a string containing the ciphertext. Here's an example, using a module named 'DES': --- 167,173 ---- the object, and with the appropriate feedback mode. The string's length must be an exact multiple of the algorithm's ! block size or, in CFB mode, of the segment size. For stream ! ciphers, the string can be of any length. Returns a string ! containing the ciphertext. Here's an example, using a module named 'DES': *************** *** 129,143 **** >>> import DES >>> obj = DES.new('abcdefgh', DES.MODE_ECB) ! >>> plain="Guido van Rossum is a space alien." ! >>> len(plain) 34 ! >>> obj.encrypt(plain) Traceback (innermost last): File "", line 1, in ? ValueError: Strings for DES must be a multiple of 8 in length ! >>> ciph=obj.encrypt(plain+'XXXXXX') ! >>> ciph '\021,\343Nq\214DY\337T\342pA\372\255\311s\210\363,\300j\330\250\312\347\342I\3215w\03561\303dgb/\006' ! >>> obj.decrypt(ciph) 'Guido van Rossum is a space alien.XXXXXX' --- 175,189 ---- >>> import DES >>> obj = DES.new('abcdefgh', DES.MODE_ECB) ! >>> plaintext = "Guido van Rossum is a space alien." ! >>> len(plaintext) 34 ! >>> obj.encrypt(plaintext) Traceback (innermost last): File "", line 1, in ? ValueError: Strings for DES must be a multiple of 8 in length ! >>> ciphertext = obj.encrypt(plain+'XXXXXX') # Add padding ! >>> ciphertext '\021,\343Nq\214DY\337T\342pA\372\255\311s\210\363,\300j\330\250\312\347\342I\3215w\03561\303dgb/\006' ! >>> obj.decrypt(ciphertext) 'Guido van Rossum is a space alien.XXXXXX' *************** *** 152,156 **** [3] RFC2440: "OpenPGP Message Format" (http://rfc2440.x42.com, http://www.faqs.org/rfcs/rfc2440.html) - --- 198,201 ---- From montanaro@sourceforge.net Tue Apr 16 16:07:14 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Tue, 16 Apr 2002 08:07:14 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast README,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv22119 Modified Files: README Log Message: add reference to Dan Wang's ASDL paper Index: README =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 7 Apr 2002 00:04:53 -0000 1.1 --- README 16 Apr 2002 15:07:12 -0000 1.2 *************** *** 1,3 **** ! This sandbox contains code to support the creation of a new AST for ! the builtin Python compiler. For discussion, see ! compiler-sig@python.org. --- 1,7 ---- ! This sandbox contains code to support the creation of a new AST for the ! builtin Python compiler. For discussion, see compiler-sig@python.org. ! ! For background on the Zephyr Abstract Syntax Description Language (ASDL), ! try Dan Wang's paper on the topic: ! ! http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html From theller@sourceforge.net Tue Apr 16 16:04:58 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Tue, 16 Apr 2002 08:04:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools undoc_symbols.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv21122 Modified Files: undoc_symbols.py Log Message: Replace the simpleminded string.find with a re.search looking only for full words. Before that, something like 'PyObject_Call' was missed because 'PyObject_CallFunction' was found. Passes PyChecker now. Index: undoc_symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/undoc_symbols.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** undoc_symbols.py 29 Nov 2001 04:30:46 -0000 1.4 --- undoc_symbols.py 16 Apr 2002 15:04:56 -0000 1.5 *************** *** 47,51 **** # x extern and forward variable declarations ! import os, glob, re, sys, tempfile def findnames(file, prefixes=()): --- 47,51 ---- # x extern and forward variable declarations ! import os, glob, re, sys def findnames(file, prefixes=()): *************** *** 84,88 **** names.sort() for name in names: ! if docs.find(name) == -1: print dict[name], name --- 84,88 ---- names.sort() for name in names: ! if not re.search("%s\\W" % name, docs): print dict[name], name From montanaro@sourceforge.net Tue Apr 16 16:12:13 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Tue, 16 Apr 2002 08:12:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24810 Modified Files: libcodecs.tex Log Message: added small clarification to the descriptions of encode() and decode() Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libcodecs.tex 20 Oct 2001 04:24:09 -0000 1.7 --- libcodecs.tex 16 Apr 2002 15:12:10 -0000 1.8 *************** *** 202,206 **** \begin{methoddesc}{encode}{input\optional{, errors}} Encodes the object \var{input} and returns a tuple (output object, ! length consumed). \var{errors} defines the error handling to apply. It defaults to --- 202,209 ---- \begin{methoddesc}{encode}{input\optional{, errors}} Encodes the object \var{input} and returns a tuple (output object, ! length consumed). While codecs are not restricted to use with Unicode, in ! a Unicode context, encoding converts a Unicode object to a plain string ! using a particular character set encoding (e.g., \code{cp1252} or ! \code{iso-8859-1}). \var{errors} defines the error handling to apply. It defaults to *************** *** 217,221 **** \begin{methoddesc}{decode}{input\optional{, errors}} Decodes the object \var{input} and returns a tuple (output object, ! length consumed). \var{input} must be an object which provides the \code{bf_getreadbuf} --- 220,225 ---- \begin{methoddesc}{decode}{input\optional{, errors}} Decodes the object \var{input} and returns a tuple (output object, ! length consumed). In a Unicode context, decoding converts a plain string ! encoded using a particular character set encoding to a Unicode object. \var{input} must be an object which provides the \code{bf_getreadbuf} From fdrake@sourceforge.net Tue Apr 16 17:22:27 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 09:22:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv20593/api Modified Files: newtypes.tex Log Message: Add more text from Guido on the type structure fields. Small additional changes. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** newtypes.tex 15 Apr 2002 18:44:46 -0000 1.8 --- newtypes.tex 16 Apr 2002 16:22:24 -0000 1.9 *************** *** 389,393 **** initialized to the \member{ob_type} field of the base class. \cfunction{PyType_Ready()} will not change this field if it is ! nonzero. In Python 2.2, this field is not inherited by subtypes. In 2.2.1, --- 389,393 ---- initialized to the \member{ob_type} field of the base class. \cfunction{PyType_Ready()} will not change this field if it is ! non-zero. In Python 2.2, this field is not inherited by subtypes. In 2.2.1, *************** *** 481,493 **** the instance (using the freeing function corresponding to the allocation function used to allocate the buffer), and finally (as ! its last action) call the type's \member{tp_free} slot. If the type ! is not subtypable (doesn't have the \constant{Py_TPFLAGS_BASETYPE} ! flag bit set), it is permissible to call the object deallocator ! directly instead of via \member{tp_free}. The object deallocator ! should be the one used to allocate the instance; this is normally ! \cfunction{PyObject_Del()} if the instance was allocated using ! \cfunction{PyObject_New()} or \cfunction{PyOject_VarNew()}, or ! \cfunction{PyObject_GC_Del()} if the instance was allocated using ! \cfunction{PyObject_GC_New()} or \cfunction{PyObject_GC_VarNew()}. This field is inherited by subtypes. --- 481,494 ---- the instance (using the freeing function corresponding to the allocation function used to allocate the buffer), and finally (as ! its last action) call the type's \member{tp_free} function. If the ! type is not subtypable (doesn't have the ! \constant{Py_TPFLAGS_BASETYPE} flag bit set), it is permissible to ! call the object deallocator directly instead of via ! \member{tp_free}. The object deallocator should be the one used to ! allocate the instance; this is normally \cfunction{PyObject_Del()} ! if the instance was allocated using \cfunction{PyObject_New()} or ! \cfunction{PyOject_VarNew()}, or \cfunction{PyObject_GC_Del()} if ! the instance was allocated using \cfunction{PyObject_GC_New()} or ! \cfunction{PyObject_GC_VarNew()}. This field is inherited by subtypes. *************** *** 711,715 **** \member{tp_flags} field. The macro \cfunction{PyType_HasFeature()} takes a type and a flags value, \var{tp} and \var{f}, and checks ! whether \code{\var{tp}->tp_flags \& \var{f}} is nonzero. \begin{datadesc}{Py_TPFLAGS_HAVE_GETCHARBUFFER} --- 712,716 ---- \member{tp_flags} field. The macro \cfunction{PyType_HasFeature()} takes a type and a flags value, \var{tp} and \var{f}, and checks ! whether \code{\var{tp}->tp_flags \& \var{f}} is non-zero. \begin{datadesc}{Py_TPFLAGS_HAVE_GETCHARBUFFER} *************** *** 842,846 **** \begin{cmemberdesc}{PyTypeObject}{char*}{tp_doc} An optional pointer to a NUL-terminated C string giving the ! docstring for this type object. This field is \emph{not} inherited by subtypes. --- 843,848 ---- \begin{cmemberdesc}{PyTypeObject}{char*}{tp_doc} An optional pointer to a NUL-terminated C string giving the ! docstring for this type object. This is exposed as the ! \member{__doc__} attribute on the type and instances of the type. This field is \emph{not} inherited by subtypes. *************** *** 904,926 **** The next field only exists if the \constant{Py_TPFLAGS_HAVE_WEAKREFS} ! flag bit is set. (XXX ???) ! long tp_weaklistoffset; ! XXX ! The remaining fields only exist if the \constant{Py_TPFLAGS_HAVE_CLASS} flag bit is set. ! /* Added in release 2.2 */ ! /* Iterators */ ! getiterfunc tp_iter; ! XXX ! iternextfunc tp_iternext; ! XXX --- 906,1345 ---- The next field only exists if the \constant{Py_TPFLAGS_HAVE_WEAKREFS} ! flag bit is set. ! \begin{cmemberdesc}{PyTypeObject}{long}{tp_weaklistoffset} ! If the instances of this type are weakly referenceable, this field ! is greater than zero and contains the offset in the instance ! structure of the weak reference list head (ignoring the GC header, ! if present); this offset is used by ! \cfunction{PyObject_ClearWeakRefs()} and the ! \cfunction{PyWeakref_*()} functions. The instance structure needs ! to include a field of type \ctype{PyObject*} which is initialized to ! \NULL. ! Do not confuse this field with \member{tp_weaklist}; that is the ! list head for weak references to the type object itself. + This field is inherited by subtypes, but see the rules listed below. + A subtype may override this offset; this means that the subtype uses + a different weak reference list head than the base type. Since the + list head is always found via \member{tp_weaklistoffset}, this + should not be a problem. ! When a type defined by a class statement has no \member{__slots__} ! declaration, and none of its base types are weakly referenceable, ! the type is made weakly referenceable by adding a weak reference ! list head slot to the instance layout and setting the ! \member{tp_weaklistoffset} of that slot's offset. ! ! When a type's \member{__slots__} declaration contains a slot named ! \member{__weakref__}, that slot becomes the weak reference list head ! for instances of the type, and the slot's offset is stored in the ! type's \member{tp_weaklistoffset}. ! ! When a type's \member{__slots__} declaration does not contain a slot ! named \member{__weakref__}, the type inherits its ! \member{tp_weaklistoffset} from its base type. ! \end{cmemberdesc} ! ! The next two fields only exist if the \constant{Py_TPFLAGS_HAVE_CLASS} flag bit is set. ! \begin{cmemberdesc}{PyTypeObject}{getiterfunc}{tp_iter} ! An optional pointer to a function that returns an iterator for the ! object. Its presence normally signals that the instances of this ! type are iterable (although sequences may be iterable without this ! function, and classic instances always have this function, even if ! they don't define an \method{__iter__()} method). ! This function has the same signature as ! \cfunction{PyObject_GetIter()}. ! This field is inherited by subtypes. ! \end{cmemberdesc} ! \begin{cmemberdesc}{PyTypeObject}{iternextfunc}{tp_iternext} ! An optional pointer to a function that returns the next item in an ! iterator, or raises \exception{StopIteration} when the iterator is ! exhausted. Its presence normally signals that the instances of this ! type are iterators (although classic instances always have this ! function, even if they don't define a \method{next()} method). ! ! Iterator types should also define the \member{tp_iter} function, and ! that function should return the iterator instance itself (not a new ! iterator instance). ! ! This function has the same signature as \cfunction{PyIter_Next()}. ! ! This field is inherited by subtypes. ! \end{cmemberdesc} ! ! The next fields, up to and including \member{tp_weaklist}, only exist ! if the \constant{Py_TPFLAGS_HAVE_CLASS} flag bit is set. ! ! \begin{cmemberdesc}{PyTypeObject}{struct PyMethodDef*}{tp_methods} ! An optional pointer to a static \NULL-terminated array of ! \ctype{PyMethodDef} structures, declaring regular methods of this ! type. ! ! For each entry in the array, an entry is added to the type's ! dictionary (see \member{tp_dict} below) containing a method ! descriptor. ! ! This field is not inherited by subtypes (methods are ! inherited through a different mechanism). ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{struct PyMemberDef*}{tp_members} ! An optional pointer to a static \NULL-terminated array of ! \ctype{PyMemberDef} structures, declaring regular data members ! (fields or slots) of instances of this type. ! ! For each entry in the array, an entry is added to the type's ! dictionary (see \member{tp_dict} below) containing a member ! descriptor. ! ! This field is not inherited by subtypes (members are inherited ! through a different mechanism). ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{struct PyGetSetDef*}{tp_getset} ! An optional pointer to a static \NULL-terminated array of ! \ctype{PyGetSetDef} structures, declaring computed attributes of ! instances of this type. ! ! For each entry in the array, an entry is added to the type's ! dictionary (see \member{tp_dict} below) containing a getset ! descriptor. ! ! This field is not inherited by subtypes (computed attributes are ! inherited through a different mechanism). ! ! Docs for PyGetSetDef (XXX belong elsewhere): ! ! \begin{verbatim} ! typedef PyObject *(*getter)(PyObject *, void *); ! typedef int (*setter)(PyObject *, PyObject *, void *); ! ! typedef struct PyGetSetDef { ! char *name; /* attribute name */ ! getter get; /* C function to get the attribute */ ! setter set; /* C function to set the attribute */ ! char *doc; /* optional doc string */ ! void *closure; /* optional additional data for getter and setter */ ! } PyGetSetDef; ! \end{verbatim} ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyTypeObject*}{tp_base} ! An optional pointer to a base type from which type properties are ! inherited. At this level, only single inheritance is supported; ! multiple inheritance require dynamically creating a type object by ! calling the metatype. ! ! This field is not inherited by subtypes (obviously), but it defaults ! to \code{\&PyBaseObject_Type} (which to Python programmers is known ! as the type \class{object}). ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyObject*}{tp_dict} ! The type's dictionary is stored here by \cfunction{PyType_Ready()}. ! ! This field should normally be initialized to \NULL{} before ! PyType_Ready is called; it may also be initialized to a dictionary ! containing initial attributes for the type. Once ! \cfunction{PyType_Ready()} has initialized the type, extra ! attributes for the type may be added to this dictionary only if they ! don't correspond to overloaded operations (like \method{__add__()}). ! ! This field is not inherited by subtypes (though the attributes ! defined in here are inherited through a different mechanism). ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{descrgetfunc}{tp_descr_get} ! An optional pointer to a "descriptor get" function. ! ! XXX blah, blah. ! ! This field is inherited by subtypes. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{descrsetfunc}{tp_descr_set} ! An optional pointer to a "descriptor set" function. ! ! XXX blah, blah. ! ! This field is inherited by subtypes. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{long}{tp_dictoffset} ! If the instances of this type have a dictionary containing instance ! variables, this field is non-zero and contains the offset in the ! instances of the type of the instance variable dictionary; this ! offset is used by \cfunction{PyObject_GenericGetAttr()}. ! ! Do not confuse this field with \member{tp_dict}; that is the ! dictionary for attributes of the type object itself. ! ! If the value of this field is greater than zero, it specifies the ! offset from the start of the instance structure. If the value is ! less than zero, it specifies the offset from the *end* of the ! instance structure. A negative offset is more expensive to use, and ! should only be used when the instance structure contains a ! variable-length part. This is used for example to add an instance ! variable dictionary to subtypes of \class{str} or \class{tuple}. ! Note that the \member{tp_basicsize} field should account for the ! dictionary added to the end in that case, even though the dictionary ! is not included in the basic object layout. On a system with a ! pointer size of 4 bytes, \member{tp_dictoffset} should be set to ! \code{-4} to indicate that the dictionary is at the very end of the ! structure. ! ! The real dictionary offset in an instance can be computed from a ! negative \member{tp_dictoffset} as follows: ! ! \begin{verbatim} ! dictoffset = tp_basicsize + abs(ob_size)*tp_itemsize + tp_dictoffset ! if dictoffset is not aligned on sizeof(void*): ! round up to sizeof(void*) ! \end{verbatim} ! ! where \member{tp_basicsize}, \member{tp_itemsize} and ! \member{tp_dictoffset} are taken from the type object, and ! \member{ob_size} is taken from the instance. The absolute value is ! taken because long ints use the sign of \member{ob_size} to store ! the sign of the number. (There's never a need to do this ! calculation yourself; it is done for you by ! \cfunction{_PyObject_GetDictPtr()}.) ! ! This field is inherited by subtypes, but see the rules listed below. ! A subtype may override this offset; this means that the subtype ! instances store the dictionary at a difference offset than the base ! type. Since the dictionary is always found via ! \member{tp_dictoffset}, this should not be a problem. ! ! When a type defined by a class statement has no \member{__slots__} ! declaration, and none of its base types has an instance variable ! dictionary, a dictionary slot is added to the instance layout and ! the \member{tp_dictoffset} is set to that slot's offset. ! ! When a type defined by a class statement has a \member{__slots__} ! declaration, the type inherits its \member{tp_dictoffset} from its ! base type. ! ! (Adding a slot named \member{__dict__} to the \member{__slots__} ! declaration does not have the expected effect, it just causes ! confusion. Maybe this should be added as a feature just like ! \member{__weakref__} though.) ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{initproc}{tp_init} ! An optional pointer to an instance initialization function. ! ! This function corresponds to the \method{__init__()} method of ! classes. Like \method{__init__()}, it is possible to create an ! instance without calling \method{__init__()}, and it is possible to ! reinitialize an instance by calling its \method{__init__()} method ! again. ! ! The function signature is ! ! \begin{verbatim} ! tp_init(PyObject *self, PyObject *args, PyObject *kwds) ! \end{verbatim} ! ! The self argument is the instance to be initialized; the \var{args} ! and \var{kwds} arguments represent positional and keyword arguments ! of the call to \method{__init__()}. ! ! The \member{tp_init} function, if not \NULL, is called when an ! instance is created normally by calling its type, after the type's ! \member{tp_new} function has returned an instance of the type. If ! the \member{tp_new} function returns an instance of some other type ! that is not a subtype of the original type, no \member{tp_init} ! function is called; if \member{tp_new} returns an instance of a ! subtype of the original type, the subtype's \member{tp_init} is ! called. (VERSION NOTE: described here is what is implemented in ! Python 2.2.1 and later. In Python 2.2, the \member{tp_init} of the ! type of the object returned by \member{tp_new} was always called, if ! not \NULL.) ! ! This field is inherited by subtypes. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{allocfunc}{tp_alloc} ! An optional pointer to an instance allocation function. ! ! The function signature is ! ! \begin{verbatim} ! tp_alloc(PyTypeObject *self, int nitems) ! \end{verbatim} ! ! The purpose of this function is to separate memory allocation from ! memory initialization. It should return a pointer to a block of ! memory of adequate length for the instance, suitably aligned, and ! initialized to zeros, but with \member{ob_refcnt} set to \code{1} ! and \member{ob_type} set to the type argument. If the type's ! \member{tp_itemsize} is non-zero, the object's \member{ob_size} field ! should be initialized to \var{nitems} and the length of the ! allocated memory block should be \code{tp_basicsize + ! \var{nitems}*tp_itemsize}, rounded up to a multiple of ! \code{sizeof(void*)}; otherwise, \var{nitems} is not used and the ! length of the block should be \member{tp_basicsize}. ! ! Do not use this function to do any other instance initialization, ! not even to allocate additional memory; that should be done by ! \member{tp_new}. ! ! This field is inherited by static subtypes, but not by dynamic ! subtypes (subtypes created by a class statement); in the latter, ! this field is always set to \cfunction{PyType_GenericAlloc()}, to ! force a standard heap allocation strategy. That is also the ! recommended value for statically defined types. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{newfunc}{tp_new} ! An optional pointer to an instance creation function. ! ! If this function is \NULL{} for a particular type, that type cannot ! be called to create new instances; presumably there is some other ! way to create instances, like a factory function. ! ! The function signature is ! ! \begin{verbatim} ! tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) ! \end{verbatim} ! ! The subtype argument is the type of the object being created; the ! \var{args} and \var{kwds} arguments represent positional and keyword ! arguments of the call to the type. Note that subtype doesn't have ! to equal the type whose \member{tp_new} function is called; it may ! be a subtype of that type (but not an unrelated type). ! ! The \member{tp_new} function should call ! \code{\var{subtype}->tp_alloc(\var{subtype}, \var{nitems})} to ! allocate space for the object, and then do only as much further ! initialization as is absolutely necessary. Initialization that can ! safely be ignored or repeated should be placed in the ! \member{tp_init} handler. A good rule of thumb is that for ! immutable types, all initialization should take place in ! \member{tp_new}, while for mutable types, most initialization should ! be deferred to \member{tp_init}. ! ! This field is inherited by subtypes, except it is not inherited by ! static types whose \member{tp_base} is \NULL{} or ! \code{\&PyBaseObject_Type}. The latter exception is a precaution so ! that old extension types don't become callable simply by being ! linked with Python 2.2. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{destructor}{tp_free} ! An optional pointer to an instance deallocation function. ! ! The signature of this function has changed slightly: in Python ! 2.2 and 2.2.1, its signature is \ctype{destructor}: ! ! \begin{verbatim} ! void tp_free(PyObject *) ! \end{verbatim} ! ! In Python 2.3 and beyond, its signature is \ctype{freefunc}: ! ! \begin{verbatim} ! void tp_free(void *) ! \end{verbatim} ! ! The only initializer that is compatible with both versions is ! \code{_PyObject_Del}, whose definition has suitably adapted in ! Python 2.3. ! ! This field is inherited by static subtypes, but not by dynamic ! subtypes (subtypes created by a class statement); in the latter, ! this field is set to a deallocator suitable to match ! \cfunction{PyType_GenericAlloc()} and the value of the ! \constant{Py_TPFLAGS_HAVE_GC} flag bit. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{inquiry}{tp_is_gc} ! An optional pointer to a function called by the garbage collector. ! ! The garbage collector needs to know whether a particular object is ! collectible or not. Normally, it is sufficient to look at the ! object's type's \member{tp_flags} field, and check the ! \constant{Py_TPFLAGS_HAVE_GC} flag bit. But some types have a ! mixture of statically and dynamically allocated instances, and the ! statically allocated instances are not collectible. Such types ! should define this function; it should return \code{1} for a ! collectible instance, and \code{0} for a non-collectible instance. ! The signature is ! ! \begin{verbatim} ! int tp_is_gc(PyObject *self) ! \end{verbatim} ! ! (The only example of this are types themselves. The metatype, ! \cdata{PyType_Type}, defines this function to distinguish between ! statically and dynamically allocated types.) ! ! This field is inherited by subtypes. (VERSION NOTE: in Python ! 2.2, it was not inherited. It is inherited in 2.2.1 and later ! versions.) ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyObject*}{tp_bases} ! Tuple of base types. ! ! This is set for types created by a class statement. It should be ! \NULL{} for statically defined types. ! ! This field is not inherited. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyObject*}{tp_mro} ! Tuple containing the expanded set of base types, starting with the ! type itself and ending with \class{object}, in Method Resolution ! Order. ! ! This field is not inherited; it is calculated fresh by ! \cfunction{PyType_Ready()}. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyObject*}{tp_cache} ! Unused. Not inherited. Internal use only. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyObject*}{tp_subclasses} ! List of weak references to subclasses. Not inherited. Internal ! use only. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyObject*}{tp_weaklist} ! Weak reference list head, for weak references to this type ! object. Not inherited. Internal use only. ! \end{cmemberdesc} ! ! The remaining fields are only defined if the feature test macro ! \constant{COUNT_ALLOCS} is defined, and are for internal use only. ! They are documented here for completion. None of these fields are ! inherited by subtypes. ! ! \begin{cmemberdesc}{PyTypeObject}{int}{tp_allocs} ! Number of allocations. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{int}{tp_frees} ! Number of frees. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{int}{tp_maxalloc} ! Maximum simultaneously allocated objects. ! \end{cmemberdesc} ! ! \begin{cmemberdesc}{PyTypeObject}{PyTypeObject*}{tp_next} ! Pointer to the next type object with a non-zero \member{tp_allocs} ! field. ! \end{cmemberdesc} From gvanrossum@sourceforge.net Tue Apr 16 17:32:53 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 16 Apr 2002 09:32:53 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.98,2.99 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23788 Modified Files: abstract.c Log Message: Whitespace normalization and fold some long lines. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.98 retrieving revision 2.99 diff -C2 -d -r2.98 -r2.99 *** abstract.c 8 Mar 2002 21:28:54 -0000 2.98 --- abstract.c 16 Apr 2002 16:32:50 -0000 2.99 *************** *** 404,408 **** return Py_NotImplemented; } ! static PyObject * binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name) --- 404,408 ---- return Py_NotImplemented; } ! static PyObject * binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name) *************** *** 412,416 **** Py_DECREF(Py_NotImplemented); PyErr_Format( ! PyExc_TypeError, "unsupported operand type(s) for %s: '%s' and '%s'", op_name, --- 412,416 ---- Py_DECREF(Py_NotImplemented); PyErr_Format( ! PyExc_TypeError, "unsupported operand type(s) for %s: '%s' and '%s'", op_name, *************** *** 463,467 **** ternaryfunc slotw = NULL; ternaryfunc slotz = NULL; ! mv = v->ob_type->tp_as_number; mw = w->ob_type->tp_as_number; --- 463,467 ---- ternaryfunc slotw = NULL; ternaryfunc slotz = NULL; ! mv = v->ob_type->tp_as_number; mw = w->ob_type->tp_as_number; *************** *** 511,515 **** PyObject *v1, *z1, *w2, *z2; int c; ! c = PyNumber_Coerce(&v, &w); if (c != 0) --- 511,515 ---- PyObject *v1, *z1, *w2, *z2; int c; ! c = PyNumber_Coerce(&v, &w); if (c != 0) *************** *** 665,669 **** is the one the operation is performed on, and it's up to the function to deal with the right-hand object. ! - Otherwise, in-place modification is not supported. Handle it exactly as a non in-place operation of the same kind. --- 665,669 ---- is the one the operation is performed on, and it's up to the function to deal with the right-hand object. ! - Otherwise, in-place modification is not supported. Handle it exactly as a non in-place operation of the same kind. *************** *** 671,675 **** */ ! #define HASINPLACE(t) PyType_HasFeature((t)->ob_type, Py_TPFLAGS_HAVE_INPLACEOPS) static PyObject * --- 671,676 ---- */ ! #define HASINPLACE(t) \ ! PyType_HasFeature((t)->ob_type, Py_TPFLAGS_HAVE_INPLACEOPS) static PyObject * *************** *** 734,738 **** return (*f)(v, w); } ! return binary_iop(v, w, NB_SLOT(nb_inplace_add), NB_SLOT(nb_add), "+="); } --- 735,740 ---- return (*f)(v, w); } ! return binary_iop(v, w, NB_SLOT(nb_inplace_add), ! NB_SLOT(nb_add), "+="); } *************** *** 753,757 **** } else { ! return type_error("can't multiply sequence to non-int"); } return (*g)(v, (int)n); --- 755,760 ---- } else { ! return type_error( ! "can't multiply sequence to non-int"); } return (*g)(v, (int)n); *************** *** 761,766 **** } - - PyObject * PyNumber_InPlaceRemainder(PyObject *v, PyObject *w) --- 764,767 ---- *************** *** 777,781 **** } - PyObject * PyNumber_InPlacePower(PyObject *v, PyObject *w, PyObject *z) --- 778,781 ---- *************** *** 886,890 **** } if (PyString_Check(o)) ! return int_from_string(PyString_AS_STRING(o), PyString_GET_SIZE(o)); #ifdef Py_USING_UNICODE --- 886,890 ---- } if (PyString_Check(o)) ! return int_from_string(PyString_AS_STRING(o), PyString_GET_SIZE(o)); #ifdef Py_USING_UNICODE *************** *** 938,942 **** return _PyLong_Copy((PyLongObject *)o); if (PyString_Check(o)) ! /* need to do extra error checking that PyLong_FromString() * doesn't do. In particular long('9.5') must raise an * exception, not truncate the float. --- 938,942 ---- return _PyLong_Copy((PyLongObject *)o); if (PyString_Check(o)) ! /* need to do extra error checking that PyLong_FromString() * doesn't do. In particular long('9.5') must raise an * exception, not truncate the float. *************** *** 1939,1946 **** PyObject *cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "isinstance() arg 2 must be a class or type"); return -1; ! } Py_DECREF(cls_bases); if (__class__ == NULL) { --- 1939,1946 ---- PyObject *cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "isinstance() arg 2 must be a class or type"); return -1; ! } Py_DECREF(cls_bases); if (__class__ == NULL) { *************** *** 1971,1978 **** PyObject *derived_bases; PyObject *cls_bases; ! derived_bases = abstract_get_bases(derived); if (derived_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class"); return -1; --- 1971,1978 ---- PyObject *derived_bases; PyObject *cls_bases; ! derived_bases = abstract_get_bases(derived); if (derived_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class"); return -1; *************** *** 1982,1986 **** cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 2 must be a class"); return -1; --- 1982,1986 ---- cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 2 must be a class"); return -1; *************** *** 2009,2013 **** if (PySequence_Check(o)) return PySeqIter_New(o); ! PyErr_SetString(PyExc_TypeError, "iteration over non-sequence"); return NULL; --- 2009,2013 ---- if (PySequence_Check(o)) return PySeqIter_New(o); ! PyErr_SetString(PyExc_TypeError, "iteration over non-sequence"); return NULL; *************** *** 2051,2053 **** return result; } - --- 2051,2052 ---- From gvanrossum@sourceforge.net Tue Apr 16 17:44:54 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 16 Apr 2002 09:44:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27997/Lib/test Modified Files: test_descr.py Log Message: SF bug 544647. PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it existed, even if nb_inplace_multiply also existed and the arguments weren't right for sq_inplace_repeat. Change this to only use sq_inplace_repeat if nb_inplace_multiply isn't defined. Bugfix candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** test_descr.py 16 Apr 2002 01:59:17 -0000 1.130 --- test_descr.py 16 Apr 2002 16:44:51 -0000 1.131 *************** *** 2930,2933 **** --- 2930,2959 ---- vereq(d.foo, 1) + def imulbug(): + # SF bug 544647 + if verbose: print "Testing for __imul__ problems..." + class C(object): + def __imul__(self, other): + return (self, other) + x = C() + y = x + y *= 1.0 + vereq(y, (x, 1.0)) + y = x + y *= 2 + vereq(y, (x, 2)) + y = x + y *= 3L + vereq(y, (x, 3L)) + y = x + y *= 1L<<100 + vereq(y, (x, 1L<<100)) + y = x + y *= None + vereq(y, (x, None)) + y = x + y *= "foo" + vereq(y, (x, "foo")) + def test_main(): class_docstrings() *************** *** 2993,2996 **** --- 3019,3023 ---- pickleslots() funnynew() + imulbug() if verbose: print "All OK" From gvanrossum@sourceforge.net Tue Apr 16 17:44:54 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 16 Apr 2002 09:44:54 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.99,2.100 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27997/Objects Modified Files: abstract.c Log Message: SF bug 544647. PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it existed, even if nb_inplace_multiply also existed and the arguments weren't right for sq_inplace_repeat. Change this to only use sq_inplace_repeat if nb_inplace_multiply isn't defined. Bugfix candidate. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.99 retrieving revision 2.100 diff -C2 -d -r2.99 -r2.100 *** abstract.c 16 Apr 2002 16:32:50 -0000 2.99 --- abstract.c 16 Apr 2002 16:44:51 -0000 2.100 *************** *** 743,748 **** { PyObject * (*g)(PyObject *, int) = NULL; ! if (HASINPLACE(v) && v->ob_type->tp_as_sequence && ! (g = v->ob_type->tp_as_sequence->sq_inplace_repeat)) { long n; if (PyInt_Check(w)) { --- 743,752 ---- { PyObject * (*g)(PyObject *, int) = NULL; ! if (HASINPLACE(v) && ! v->ob_type->tp_as_sequence && ! (g = v->ob_type->tp_as_sequence->sq_inplace_repeat) && ! !(v->ob_type->tp_as_number && ! v->ob_type->tp_as_number->nb_inplace_multiply)) ! { long n; if (PyInt_Check(w)) { From fdrake@sourceforge.net Tue Apr 16 20:27:25 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 12:27:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv19306 Modified Files: __init__.py Log Message: Added docstrings to the Profile class. Avoid adding Python wrappers around the underlying C profiler if possible; the extra layer of calls can lead to confusion in interpreting the logs. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 29 Oct 2001 20:48:09 -0000 1.3 --- __init__.py 16 Apr 2002 19:27:23 -0000 1.4 *************** *** 13,26 **** --- 13,39 ---- logfn, self.lineevents, self.linetimings) + # Attempt to avoid confusing results caused by the presence of + # Python wrappers around these functions, but only if we can + # be sure the methods have not been overridden or extended. + if self.__class__ is Profile: + self.close = p.close + self.start = p.start + self.stop = p.stop + self.addinfo = p.addinfo + def close(self): + """Close the logfile and terminate the profiler.""" self._prof.close() def start(self): + """Start the profiler.""" self._prof.start() def stop(self): + """Stop the profiler.""" self._prof.stop() def addinfo(self, key, value): + """Add an arbitrary labelled value to the profile log.""" self._prof.addinfo(key, value) *************** *** 29,32 **** --- 42,51 ---- def run(self, cmd): + """Profile an exec-compatible string in the script + environment. + + The globals from the __main__ module are used as both the + globals and locals for the script. + """ import __main__ dict = __main__.__dict__ *************** *** 34,37 **** --- 53,61 ---- def runctx(self, cmd, globals, locals): + """Evaluate an exec-compatible string in a specific + environment. + + The string is compiled before profiling begins. + """ code = compile(cmd, "", "exec") self._prof.runcode(code, globals, locals) *************** *** 39,41 **** --- 63,72 ---- def runcall(self, func, *args, **kw): + """Profile a single call of a callable. + + Additional positional and keyword arguments may be passed + along; the result of the call is returned, and exceptions are + allowed to propogate cleanly, while ensuring that profiling is + disabled on the way out. + """ return self._prof.runcall(func, args, kw) From fdrake@sourceforge.net Tue Apr 16 19:48:29 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 11:48:29 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv5050 Modified Files: Makefile.deps Log Message: Update the dependencies. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Makefile.deps 11 Mar 2002 18:42:08 -0000 1.84 --- Makefile.deps 16 Apr 2002 18:48:25 -0000 1.85 *************** *** 30,33 **** --- 30,34 ---- api/utilities.tex \ api/veryhigh.tex \ + texinputs/typestruct.h \ texinputs/reportingbugs.tex *************** *** 35,39 **** # generate the typeset versions of the manuals. The list is defined # here to make it easier to ensure parallelism. ! ANNOAPIFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ paper-$(PAPER)/api.tex \ paper-$(PAPER)/abstract.tex \ --- 36,40 ---- # generate the typeset versions of the manuals. The list is defined # here to make it easier to ensure parallelism. ! ANNOAPIFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) api/refcounts.dat \ paper-$(PAPER)/api.tex \ paper-$(PAPER)/abstract.tex \ *************** *** 60,63 **** --- 61,68 ---- ext/windows.tex \ ext/embedding.tex \ + ext/cycle-gc.c \ + ext/noddy.c \ + ext/run-func.c \ + texinputs/typestruct.h \ texinputs/reportingbugs.tex From fdrake@sourceforge.net Tue Apr 16 19:32:39 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 11:32:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv32670/api Modified Files: newtypes.tex Log Message: Minor wording change. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** newtypes.tex 16 Apr 2002 16:22:24 -0000 1.9 --- newtypes.tex 16 Apr 2002 18:32:37 -0000 1.10 *************** *** 1323,1327 **** The remaining fields are only defined if the feature test macro \constant{COUNT_ALLOCS} is defined, and are for internal use only. ! They are documented here for completion. None of these fields are inherited by subtypes. --- 1323,1327 ---- The remaining fields are only defined if the feature test macro \constant{COUNT_ALLOCS} is defined, and are for internal use only. ! They are documented here for completeness. None of these fields are inherited by subtypes. From tim_one@sourceforge.net Tue Apr 16 21:48:03 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 16 Apr 2002 13:48:03 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.388,1.389 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12202/python/Misc Modified Files: NEWS Log Message: Windows installer: disabled Wise's "delete in-use files" uninstall option. It was the cause of at least one way UNWISE.EXE could vanish (install a python; uninstall it; install it again; reboot the machine; abracadabra the uinstaller is gone). Bugfix candidate, but I'll backport it myself. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.388 retrieving revision 1.389 diff -C2 -d -r1.388 -r1.389 *** NEWS 15 Apr 2002 13:36:44 -0000 1.388 --- NEWS 16 Apr 2002 20:48:01 -0000 1.389 *************** *** 185,188 **** --- 185,192 ---- Windows + - Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause + of that has been fixed in the installer (disabled Wise's "delete in- + use files" uninstall option). + - Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031] From tim_one@sourceforge.net Tue Apr 16 21:48:03 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 16 Apr 2002 13:48:03 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv12202/python/PCbuild Modified Files: python20.wse Log Message: Windows installer: disabled Wise's "delete in-use files" uninstall option. It was the cause of at least one way UNWISE.EXE could vanish (install a python; uninstall it; install it again; reboot the machine; abracadabra the uinstaller is gone). Bugfix candidate, but I'll backport it myself. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** python20.wse 4 Apr 2002 20:02:04 -0000 1.101 --- python20.wse 16 Apr 2002 20:48:01 -0000 1.102 *************** *** 2866,2870 **** item: Remark end ! item: Add Text to INSTALL.LOG Text=Delete in-use files: On end --- 2866,2879 ---- item: Remark end ! remarked item: Remark ! Text=Don't enable "Delete in-use files". Here's what happens: ! end ! remarked item: Remark ! Text=Install Python; uninstall Python; install Python again. Reboot the machine. ! end ! remarked item: Remark ! Text=Now UNWISE.EXE is missing. I think this is a Wise bug, but so it goes. ! end ! remarked item: Add Text to INSTALL.LOG Text=Delete in-use files: On end From fdrake@sourceforge.net Tue Apr 16 22:27:20 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 14:27:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools findcsyms,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv26912 Added Files: findcsyms Log Message: Start of script to locate C symbols and segregate them into lists of the documented and undocumented symbols. --- NEW FILE: findcsyms --- #! /usr/bin/env python import errno import os import sys if __name__ == "__main__": _base = sys.argv[0] else: _base = __file__ _script_home = os.path.abspath(os.path.dirname(_base)) srcdir = os.path.dirname(os.path.dirname(_script_home)) EXCLUDES = ["bitset.h", "cStringIO.h", "graminit.h", "grammar.h", "longintrepr.h", "metagrammar.h", "node.h", "opcode.h", "osdefs.h", "pgenheaders.h", "py_curses.h", "parsetok.h", "symtable.h", "token.h"] def list_headers(): """Return a list of headers.""" incdir = os.path.join(srcdir, "Include") return [fn for fn in os.listdir(incdir) if fn.endswith(".h") and fn not in EXCLUDES] def list_documented_items(): """Return a list of everything that's already documented.""" docdir = os.path.join(srcdir, "Doc") return [] def split_documented(all, documented): """Split the list of all symbols into documented and undocumented categories.""" doc = [] undoc = [] for t in all: if t[0] in documented: doc.append(t) else: undoc.append(t) return doc, undoc def print_list(L, title=None): """Dump a list to stdout.""" if title: print title + ":" print "-" * (len(title) + 1) w = 0 for sym, filename in L: w = max(w, len(sym)) if w % 4 == 0: w += 4 else: w += (4 - (w % 4)) for sym, filename in L: print "%-*s%s" % (w, sym, filename) _spcjoin = ' '.join def main(): args = sys.argv[1:] if args: headers = args documented = [] else: os.chdir(os.path.join(srcdir, "Include")) headers = list_headers() documented = list_documented_items() cmd = ("ctags -f - --file-scope=no --c-types=-mv " "-Istaticforward -Istatichere " + _spcjoin(headers)) fp = os.popen(cmd) L = [] prevsym = None while 1: line = fp.readline() if not line: break sym, filename = line.split()[:2] if sym == prevsym: continue if not sym.endswith("_H"): L.append((sym, filename)) prevsym = sym L.sort() fp.close() try: if documented: documented, undocumented = split_documented(L, documented) print_list(documented, "Documented symbols") if undocumented: print print_list(undocumented, "Undocumented symbols") else: print_list(L) except IOError, e: if e.errno != errno.EPIPE: raise if __name__ == "__main__": main() From akuchling@sourceforge.net Tue Apr 16 22:26:05 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Tue, 16 Apr 2002 14:26:05 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.179,1.180 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26402 Modified Files: pep-0000.txt Log Message: Rename PEP 272 Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.179 retrieving revision 1.180 diff -C2 -d -r1.179 -r1.180 *** pep-0000.txt 11 Apr 2002 15:34:19 -0000 1.179 --- pep-0000.txt 16 Apr 2002 21:26:01 -0000 1.180 *************** *** 48,52 **** I 248 Python Database API Specification v1.0 Lemburg I 249 Python Database API Specification v2.0 Lemburg ! I 272 API for Secret-Key Encryption Algorithms Kuchling Accepted PEPs (accepted; may not be implemented yet) --- 48,52 ---- I 248 Python Database API Specification v1.0 Lemburg I 249 Python Database API Specification v2.0 Lemburg ! I 272 API for Block Encryption Algorithms Kuchling Accepted PEPs (accepted; may not be implemented yet) *************** *** 250,254 **** S 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti ! I 272 API for Secret-Key Encryption Algorithms Kuchling S 273 Import Modules from Zip Archives Ahlstrom S 274 Dict Comprehensions Warsaw --- 250,254 ---- S 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti ! I 272 API for Block Encryption Algorithms Kuchling S 273 Import Modules from Zip Archives Ahlstrom S 274 Dict Comprehensions Warsaw From akuchling@sourceforge.net Tue Apr 16 22:24:22 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Tue, 16 Apr 2002 14:24:22 -0700 Subject: [Python-checkins] python/nondist/peps pep-0272.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv25785 Modified Files: pep-0272.txt Log Message: Remove references to stream ciphers. As a result, this is now retitled the block encryption API PEP. Index: pep-0272.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0272.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0272.txt 16 Apr 2002 13:33:44 -0000 1.5 --- pep-0272.txt 16 Apr 2002 21:24:19 -0000 1.6 *************** *** 1,4 **** PEP: 272 ! Title: API for Secret-Key Encryption Algorithms Version: $Revision$ Author: A.M. Kuchling --- 1,4 ---- PEP: 272 ! Title: API for Block Encryption Algorithms Version: $Revision$ Author: A.M. Kuchling *************** *** 10,17 **** Abstract ! This document specifies a standard API for secret-key encryption ! algorithms such as DES or Rijndael, making it easier to switch ! between different algorithms and implementations. The API is ! intended to be suitable for both block and stream ciphers. --- 10,16 ---- Abstract ! This document specifies a standard API for secret-key block ! encryption algorithms such as DES or Rijndael, making it easier to ! switch between different algorithms and implementations. *************** *** 32,36 **** 1 MODE_ECB Electronic Code Book 2 MODE_CBC Cipher Block Chaining ! 3 MODE_CFB Cipher FeedBack 5 MODE_OFB Output Feedback 6 MODE_CTR Counter --- 31,35 ---- 1 MODE_ECB Electronic Code Book 2 MODE_CBC Cipher Block Chaining ! 3 MODE_CFB Cipher Feedback 5 MODE_OFB Output Feedback 6 MODE_CTR Counter *************** *** 49,56 **** In a strict formal sense, stream ciphers encrypt data bit-by-bit; practically, stream ciphers work on a character-by-character ! basis. Stream ciphers can support the API described here by using ! fixing the block length at 1; this is how block and stream ciphers ! could be distinguished. The only feedback mode available for ! stream ciphers is ECB mode. --- 48,56 ---- In a strict formal sense, stream ciphers encrypt data bit-by-bit; practically, stream ciphers work on a character-by-character ! basis. This PEP only aims at specifying an interface for block ! ciphers, though stream ciphers can support the interface described ! here by fixing 'block_size' to 1. Feedback modes also don't make ! sense for stream ciphers, so the only reasonable feedback mode ! would be ECB mode. *************** *** 125,130 **** module, measured in bytes. For all feedback modes, the length of strings passed to the encrypt() and decrypt() must be a ! multiple of the block size. For stream ciphers, block_size ! will be 1. key_size --- 125,129 ---- module, measured in bytes. For all feedback modes, the length of strings passed to the encrypt() and decrypt() must be a ! multiple of the block size. key_size *************** *** 167,173 **** the object, and with the appropriate feedback mode. The string's length must be an exact multiple of the algorithm's ! block size or, in CFB mode, of the segment size. For stream ! ciphers, the string can be of any length. Returns a string ! containing the ciphertext. Here's an example, using a module named 'DES': --- 166,171 ---- the object, and with the appropriate feedback mode. The string's length must be an exact multiple of the algorithm's ! block size or, in CFB mode, of the segment size. Returns a ! string containing the ciphertext. Here's an example, using a module named 'DES': From jhylton@sourceforge.net Wed Apr 17 00:39:00 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 16 Apr 2002 16:39:00 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.h,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv651 Modified Files: asdl.h Log Message: Grab definition for bool from stdbool.h (C99). XXX Not sure how portable this is. Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** asdl.h 16 Apr 2002 03:21:52 -0000 1.3 --- asdl.h 16 Apr 2002 23:38:58 -0000 1.4 *************** *** 1,5 **** #define identifier PyObject * - #define bool int #define string PyObject * /* It would be nice if the code generated by asdl_c.py was completely --- 1,6 ---- #define identifier PyObject * #define string PyObject * + + #include /* It would be nice if the code generated by asdl_c.py was completely From jhylton@sourceforge.net Wed Apr 17 00:39:44 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 16 Apr 2002 16:39:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv839 Modified Files: python.asdl Log Message: Add expr_context flag to assignable expressions as suggested by Finn Bock. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** python.asdl 16 Apr 2002 03:20:45 -0000 1.12 --- python.asdl 16 Apr 2002 23:39:42 -0000 1.13 *************** *** 9,15 **** | Return(expr value) | Yield(expr value) ! | Del(assign* targets) ! | Assign(assign* targets, expr value) ! | AugAssign(assign target, operator op, expr value) -- not sure if bool is allowed, can always use int --- 9,15 ---- | Return(expr value) | Yield(expr value) ! | Delete(expr* targets) ! | Assign(expr* targets, expr value) ! | AugAssign(expr target, operator op, expr value) -- not sure if bool is allowed, can always use int *************** *** 40,44 **** | Pass | Break | Continue ! -- BoolOp() can use left & right expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) --- 40,44 ---- | Pass | Break | Continue ! -- BoolOp() can use left & right? expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) *************** *** 56,70 **** | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? - | Attribute(expr value, identifier attr) - | Subscript(expr value, slice slice) - | Name(identifier id) - | List(expr* elts) | Tuple(expr *elts) ! -- the subset of expressions that are valid as the target of ! -- assignments. ! assign = AssignAttribute(expr value, identifier attr) ! | AssignSubscript(expr value, slice slice) ! | AssignName(identifier id) ! | AssignList(expr* elts) | AssignTuple(expr *elts) slice = Ellipsis | Slice(expr? lower, expr? upper) --- 56,68 ---- | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? ! -- the following expression can appear in assignment context ! | Attribute(expr value, identifier attr, expr_context ctx) ! | Subscript(expr value, slice slice, expr_context ctx) ! | Name(identifier id, expr_context ctx) ! | List(expr* elts, expr_context ctx) ! | Tuple(expr *elts, expr_context ctx) ! ! expr_context = Load | Store | Del slice = Ellipsis | Slice(expr? lower, expr? upper) *************** *** 85,89 **** -- not sure what to call the first argument for raise and except ! except = (expr? type, assign? name, stmt* body) -- XXX need to handle 'def f((a, b)):' --- 83,87 ---- -- not sure what to call the first argument for raise and except ! except = (expr? type, expr? name, stmt* body) -- XXX need to handle 'def f((a, b)):' From jhylton@sourceforge.net Wed Apr 17 00:40:11 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 16 Apr 2002 16:40:11 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast Makefile,1.5,1.6 setup.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv949 Modified Files: Makefile setup.py Log Message: Add test target to Makefile. Remove import test from setup.py. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 16 Apr 2002 04:00:04 -0000 1.5 --- Makefile 16 Apr 2002 23:40:09 -0000 1.6 *************** *** 1,11 **** PYINCLUDE=/usr/local/include/python2.3 ast.so: astmodule.c setup.py Python-ast.c python.asdl asdl.c asdl.h python setup.py build_ext -i Python-ast.o: Python-ast.c python.asdl ! gcc -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c Python-ast.c: python.asdl asdl_c.py python asdl_c.py python.asdl --- 1,19 ---- PYINCLUDE=/usr/local/include/python2.3 + test: ast.so + python test.py + ast.so: astmodule.c setup.py Python-ast.c python.asdl asdl.c asdl.h python setup.py build_ext -i Python-ast.o: Python-ast.c python.asdl ! gcc -g -c -pedantic -Wall -I$(PYINCLUDE) -o Python-ast.o Python-ast.c Python-ast.c: python.asdl asdl_c.py python asdl_c.py python.asdl + clean: + rm Python-ast.c + rm Python-ast.h + rm ast.so + rm -rf build Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/setup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setup.py 16 Apr 2002 03:58:33 -0000 1.3 --- setup.py 16 Apr 2002 23:40:09 -0000 1.4 *************** *** 8,11 **** ext_modules=[ast]) - import test - --- 8,9 ---- From jhylton@sourceforge.net Wed Apr 17 00:41:00 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 16 Apr 2002 16:41:00 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv1112 Modified Files: asdl_c.py Log Message: Special-case bool in argument checking for ctors. It's fine for a bool to be intialized as false, so the !arg test made no sense. Not sure if there's a cleaner way to handle this. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** asdl_c.py 16 Apr 2002 03:59:10 -0000 1.10 --- asdl_c.py 16 Apr 2002 23:40:58 -0000 1.11 *************** *** 258,262 **** emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: ! if not opt: emit("if (!%s) {" % argname, 1) emit("PyErr_SetString(PyExc_ValueError,", 2) --- 258,263 ---- emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: ! # XXX hack alert: false is allowed for a bool ! if not opt and not argtype == "bool": emit("if (!%s) {" % argname, 1) emit("PyErr_SetString(PyExc_ValueError,", 2) From jhylton@sourceforge.net Wed Apr 17 00:43:03 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 16 Apr 2002 16:43:03 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,1.3,1.4 test.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv1502 Modified Files: astmodule.c test.py Log Message: Add support for many more types: tuple and repr constructors assignment augmented assignment print del break, continue yield, return raise exec assert Add placeholder for more. Add useful debugging printfs. Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** astmodule.c 16 Apr 2002 03:59:46 -0000 1.3 --- astmodule.c 16 Apr 2002 23:43:00 -0000 1.4 *************** *** 12,38 **** #include "graminit.h" ! extern grammar _PyParser_Grammar; /* From graminit.c */ ! /* XXX should be seq */ ! static stmt_ty ! ast_for_global(node *n) { ! /* global_stmt: 'global' NAME (',' NAME)* */ ! identifier name; ! asdl_seq *s; ! int i; ! REQ(n, global_stmt); ! s = asdl_seq_new(NCH(n) / 2); ! for (i = 1; i < NCH(n); i += 2) { ! name = PyString_InternFromString(STR(CHILD(n, i))); ! if (!name) ! return NULL; ! if (asdl_seq_append(s, name) < 0) ! return NULL; } - return Global(s); } --- 12,82 ---- #include "graminit.h" ! static asdl_seq *seq_for_testlist(node *); ! static expr_ty ast_for_expr(node *); extern grammar _PyParser_Grammar; /* From graminit.c */ ! static int ! set_context(expr_ty e, expr_context_ty ctx) { ! switch (e->kind) { ! case Attribute_kind: ! e->v.Attribute.ctx = ctx; ! break; ! case Subscript_kind: ! e->v.Subscript.ctx = ctx; ! break; ! case Name_kind: ! e->v.Name.ctx = ctx; ! break; ! case List_kind: ! e->v.List.ctx = ctx; ! break; ! case Tuple_kind: ! e->v.Tuple.ctx = ctx; ! break; ! default: ! fprintf(stderr, "can't set context for %d\n", e->kind); ! return -1; ! } ! return 0; ! } ! static operator_ty ! ast_for_augassign(node *n) ! { ! REQ(n, augassign); ! n = CHILD(n, 0); ! switch (STR(n)[0]) { ! case '+': ! return Add; ! case '-': ! return Sub; ! case '/': ! if (STR(n)[1] == '/') ! return FloorDiv; ! else ! return Div; ! case '%': ! return Mod; ! case '<': ! return LShift; ! case '>': ! return RShift; ! case '&': ! return BitAnd; ! case '^': ! return BitXor; ! case '|': ! return BitOr; ! case '*': ! if (STR(n)[1] == '*') ! return Pow; ! else ! return Mult; ! default: ! fprintf(stderr, "invalid augassign: %s", STR(n)); ! return 0; } } *************** *** 79,82 **** --- 123,140 ---- } + static asdl_seq * + seq_for_testlist(node *n) + { + asdl_seq *seq; + int i; + + REQ(n, testlist); + seq = asdl_seq_new(NCH(n) / 2); + for (i = 0; i < NCH(n); i += 2) { + asdl_seq_append(seq, ast_for_expr(CHILD(n, i))); + } + return seq; + } + static expr_ty ast_for_lambdef(node *n) *************** *** 92,107 **** */ node *ch = CHILD(n, 0); switch (TYPE(ch)) { ! case NAME: { ! return Name(PyString_InternFromString(STR(ch))); break; - } case STRING: ! return Str(PyString_FromString("darn, strings are hard to parse")); break; case NUMBER: ! return Num(PyString_FromString("darn, numbers are hard too")); break; /* XXX other cases... */ default: fprintf(stderr, "unhandled atom %d\n", TYPE(ch)); --- 150,178 ---- */ node *ch = CHILD(n, 0); + fprintf(stderr, "ast_for_atom((%d, %d))\n", TYPE(ch), NCH(ch)); switch (TYPE(ch)) { ! case NAME: ! /* by default, mark all names as Load context. ! change later if needed. ! */ ! return Name(PyString_InternFromString(STR(ch)), Load); break; case STRING: ! return Str(PyString_FromString(STR(ch))); break; case NUMBER: ! return Num(PyString_FromString(STR(ch))); break; /* XXX other cases... */ + case LPAR: /* tuple */ + return Tuple(seq_for_testlist(CHILD(n, 1)), Load); + break; + case LSQB: /* list (or list comprehension) */ + break; + case LBRACE: /* dict */ + break; + case BACKQUOTE: /* repr */ + return Repr(ast_for_expr(CHILD(n, 1))); + break; default: fprintf(stderr, "unhandled atom %d\n", TYPE(ch)); *************** *** 132,136 **** --- 203,209 ---- int i; + fprintf(stderr, "ast_for_expr(%d, %d)\n", TYPE(n), NCH(n)); loop: + fprintf(stderr, "\texpr %d %d\n", TYPE(n), NCH(n)); switch (TYPE(n)) { case test: *************** *** 249,257 **** break; case power: ! if (NCH(n) == 1) { ! expr_ty e = ast_for_atom(CHILD(n, 0)); ! assert(e); ! return e; ! } return NULL; break; --- 322,328 ---- break; case power: ! if (NCH(n) == 1) ! return ast_for_atom(CHILD(n, 0)); ! fprintf(stderr, "unhandled power\n"); return NULL; break; *************** *** 261,276 **** } ! static asdl_seq * ! seq_for_testlist(node *n) { - asdl_seq *seq; - int i; - REQ(n, testlist); ! seq = asdl_seq_new(NCH(n) / 2); ! for (i = 0; i < NCH(n); i += 2) { ! asdl_seq_append(seq, ast_for_expr(CHILD(n, i))); ! } ! return seq; } --- 332,343 ---- } ! static expr_ty ! ast_for_testlist(node *n) { REQ(n, testlist); ! if (NCH(n) == 1) ! return ast_for_expr(CHILD(n, 0)); ! else ! return Tuple(seq_for_testlist(n), Load); } *************** *** 286,303 **** */ if (NCH(n) == 1) { ! /* a bare expression */ ! node *ch = CHILD(n, 0); ! REQ(ch, testlist); ! if (NCH(ch) == 1) { ! /* a simple expression */ ! return Expr(ast_for_expr(CHILD(ch, 0))); ! } ! else ! return Expr(Tuple(seq_for_testlist(ch))); } else if (TYPE(CHILD(n, 1)) == augassign) { ! /* an augmented assignment */ } else { /* a normal assignment */ } return NULL; --- 353,377 ---- */ + fprintf(stderr, "ast_for_expr_stmt(%d, %d)\n", TYPE(n), NCH(n)); if (NCH(n) == 1) { ! return Expr(ast_for_testlist(CHILD(n, 0))); } else if (TYPE(CHILD(n, 1)) == augassign) { ! return AugAssign(ast_for_testlist(CHILD(n, 0)), ! ast_for_augassign(CHILD(n, 1)), ! ast_for_testlist(CHILD(n, 2))); } else { + int i; + asdl_seq *targets; + /* a normal assignment */ + REQ(CHILD(n, 1), EQUAL); + targets = asdl_seq_new(NCH(n) / 2 + 1); + for (i = 0; i < NCH(n) - 2; i += 2) { + expr_ty e = ast_for_testlist(CHILD(n, i)); + /* set context to assign */ + set_context(e, Store); + asdl_seq_append(targets, e); + } + return Assign(targets, ast_for_testlist(CHILD(n, NCH(n) - 1))); } return NULL; *************** *** 305,308 **** --- 379,587 ---- static stmt_ty + ast_for_print_stmt(node *n) + { + /* print_stmt: 'print' ( [ test (',' test)* [','] ] + | '>>' test [ (',' test)+ [','] ] ) + */ + expr_ty dest = NULL; + asdl_seq *seq; + bool nl; + int i, start = 1; + + REQ(n, print_stmt); + if (TYPE(CHILD(n, 1)) == RIGHTSHIFT) { + dest = ast_for_expr(CHILD(n, 2)); + start = 4; + } + seq = asdl_seq_new((NCH(n) + 1 - start) / 2); + for (i = start; i < NCH(n); i += 2) { + asdl_seq_append(seq, ast_for_expr(CHILD(n, i))); + } + nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true; + return Print(dest, seq, nl); + } + + static stmt_ty + ast_for_del_stmt(node *n) + { + /* del_stmt: 'del' exprlist */ + int i; + asdl_seq *seq; + expr_ty e; + node *ch; + + REQ(n, del_stmt); + ch = CHILD(n, 1); + REQ(ch, exprlist); + seq = asdl_seq_new((NCH(ch) + 1) / 2); + for (i = 0; i < NCH(ch); i += 2) { + e = ast_for_expr(CHILD(ch, i)); + set_context(e, Del); + asdl_seq_append(seq, e); + } + return Delete(seq); + } + + static stmt_ty + ast_for_flow_stmt(node *n) + { + /* + flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt + | yield_stmt + break_stmt: 'break' + continue_stmt: 'continue' + return_stmt: 'return' [testlist] + yield_stmt: 'yield' testlist + raise_stmt: 'raise' [test [',' test [',' test]]] + */ + node *ch; + + REQ(n, flow_stmt); + ch = CHILD(n, 0); + switch (TYPE(ch)) { + case break_stmt: + return Break(); + case continue_stmt: + return Continue(); + case yield_stmt: + return Yield(ast_for_testlist(CHILD(ch, 1))); + case return_stmt: + if (NCH(ch) == 1) + return Return(NULL); + else + return Return(ast_for_testlist(CHILD(ch, 1))); + case raise_stmt: + if (NCH(ch) == 1) + return Raise(NULL, NULL, NULL); + else if (NCH(ch) == 2) + return Raise(ast_for_expr(CHILD(n, 1)), NULL, NULL); + else if (NCH(ch) == 4) + return Raise(ast_for_expr(CHILD(n, 1)), + ast_for_expr(CHILD(n, 3)), + NULL); + else if (NCH(ch) == 6) + return Raise(ast_for_expr(CHILD(n, 1)), + ast_for_expr(CHILD(n, 3)), + ast_for_expr(CHILD(n, 5))); + default: + fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); + return NULL; + } + } + + static stmt_ty + ast_for_import_stmt(node *n) + { + /* + import_stmt: 'import' dotted_as_name (',' dotted_as_name)* + | 'from' dotted_name 'import' ('*' + | import_as_name (',' import_as_name)*) + import_as_name: NAME [NAME NAME] + dotted_as_name: dotted_name [NAME NAME] + dotted_name: NAME ('.' NAME)* + */ + + /* XXX how to represent dotted names? */ + + REQ(n, import_stmt); + if (STR(CHILD(n, 0))[0] == 'i') { /* import */ + } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ + } + return NULL; + } + + static stmt_ty + ast_for_global_stmt(node *n) + { + /* global_stmt: 'global' NAME (',' NAME)* */ + identifier name; + asdl_seq *s; + int i; + + REQ(n, global_stmt); + s = asdl_seq_new(NCH(n) / 2); + for (i = 1; i < NCH(n); i += 2) { + name = PyString_InternFromString(STR(CHILD(n, i))); + if (!name) + return NULL; + if (asdl_seq_append(s, name) < 0) + return NULL; + } + return Global(s); + } + + static stmt_ty + ast_for_exec_stmt(node *n) + { + /* exec_stmt: 'exec' expr ['in' test [',' test]] */ + REQ(n, exec_stmt); + if (NCH(n) == 2) + return Exec(ast_for_expr(CHILD(n, 1)), NULL, NULL); + else if (NCH(n) == 4) + return Exec(ast_for_expr(CHILD(n, 1)), + ast_for_expr(CHILD(n, 3)), NULL); + else if (NCH(n) == 6) + return Exec(ast_for_expr(CHILD(n, 1)), + ast_for_expr(CHILD(n, 3)), + ast_for_expr(CHILD(n, 5))); + return NULL; + } + + static stmt_ty + ast_for_assert_stmt(node *n) + { + /* assert_stmt: 'assert' test [',' test] */ + REQ(n, assert_stmt); + if (NCH(n) == 2) + return Assert(ast_for_expr(CHILD(n, 1)), NULL); + else if (NCH(n) == 4) + return Assert(ast_for_expr(CHILD(n, 1)), + ast_for_expr(CHILD(n, 3))); + return NULL; + } + + static stmt_ty + ast_for_if_stmt(node *n) + { + REQ(n, if_stmt); + return NULL; + } + + static stmt_ty + ast_for_while_stmt(node *n) + { + REQ(n, while_stmt); + return NULL; + } + + static stmt_ty + ast_for_for_stmt(node *n) + { + REQ(n, for_stmt); + return NULL; + } + + static stmt_ty + ast_for_try_stmt(node *n) + { + REQ(n, try_stmt); + return NULL; + } + + static stmt_ty + ast_for_funcdef(node *n) + { + REQ(n, funcdef); + return NULL; + } + + static stmt_ty + ast_for_classdef(node *n) + { + REQ(n, classdef); + return NULL; + } + + static stmt_ty ast_for_stmt(node *n) { *************** *** 321,336 **** REQ(n, small_stmt); n = CHILD(n, 0); switch (TYPE(n)) { case expr_stmt: return ast_for_expr_stmt(n); ! break; case global_stmt: ! return ast_for_global(n); default: fprintf(stderr, "TYPE=%d NCH=%d\n", TYPE(n), NCH(n)); } } else { REQ(n, compound_stmt); ! fprintf(stderr, "compound_stmt\n"); } return NULL; --- 600,651 ---- REQ(n, small_stmt); n = CHILD(n, 0); + /* small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt + | flow_stmt | import_stmt | global_stmt | exec_stmt + | assert_stmt + */ switch (TYPE(n)) { case expr_stmt: return ast_for_expr_stmt(n); ! case print_stmt: ! return ast_for_print_stmt(n); ! case del_stmt: ! return ast_for_del_stmt(n); ! case pass_stmt: ! return Pass(); ! case flow_stmt: ! return ast_for_flow_stmt(n); ! case import_stmt: ! return ast_for_import_stmt(n); case global_stmt: ! return ast_for_global_stmt(n); ! case exec_stmt: ! return ast_for_exec_stmt(n); ! case assert_stmt: ! return ast_for_assert_stmt(n); default: fprintf(stderr, "TYPE=%d NCH=%d\n", TYPE(n), NCH(n)); } } else { + /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt + | funcdef | classdef + */ + node *ch = CHILD(n, 0); REQ(n, compound_stmt); ! switch (TYPE(ch)) { ! case if_stmt: ! return ast_for_if_stmt(ch); ! case while_stmt: ! return ast_for_while_stmt(ch); ! case for_stmt: ! return ast_for_for_stmt(ch); ! case try_stmt: ! return ast_for_try_stmt(ch); ! case funcdef: ! return ast_for_funcdef(ch); ! case classdef: ! return ast_for_classdef(ch); ! default: ! return NULL; ! } } return NULL; Index: test.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/test.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.py 16 Apr 2002 03:57:55 -0000 1.1 --- test.py 16 Apr 2002 23:43:00 -0000 1.2 *************** *** 1,4 **** --- 1,27 ---- import ast ast.transform("""global a, b, c + a = 1 + d = c = 7 a + b - c * 3 + (a + b) * c % 3 + b += c + assert 1 + assert 1, "2" + exec a + exec a in b + exec a in b, c + del a + del a, b + del a, b, c, + print >> x + print >> x, 1 + print >> x, 1, + print 1 + print 1, + print 1, 2 + print 1, 2, + raise + raise x + raise x, y + raise x, y, b """) From fdrake@sourceforge.net Wed Apr 17 02:40:59 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 18:40:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/html about.html,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv29194 Modified Files: about.html Log Message: Changed last remaining use of "./" to "index.html" when referring to the index file for the top-level directory. This makes it easier to use an unpacked version of the documentation via file: URLs. This closes SF bug #541257. Index: about.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/about.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** about.html 4 Feb 2002 21:15:42 -0000 1.4 --- about.html 17 Apr 2002 01:40:56 -0000 1.5 *************** *** 31,35 **** Up: ! Python Documentation Index
--- 31,35 ---- Up: ! Python Documentation Index
From fdrake@sourceforge.net Wed Apr 17 02:43:00 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 18:43:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/html about.html,1.3,1.3.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv29902 Modified Files: Tag: release22-maint about.html Log Message: Changed last two remaining uses of "./" to "index.html" when referring to the index file for the top-level directory. This makes it easier to use an unpacked version of the documentation via file: URLs. This closes SF bug #541257. Index: about.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/about.html,v retrieving revision 1.3 retrieving revision 1.3.24.1 diff -C2 -d -r1.3 -r1.3.24.1 *** about.html 5 Oct 2000 05:17:29 -0000 1.3 --- about.html 17 Apr 2002 01:42:58 -0000 1.3.24.1 *************** *** 14,18 **** ! up ! upUp: ! Python Documentation Index
--- 31,35 ---- Up: ! Python Documentation Index
From fdrake@sourceforge.net Wed Apr 17 02:44:09 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 18:44:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/html about.html,1.3,1.3.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv30132 Modified Files: Tag: release21-maint about.html Log Message: Changed last two remaining uses of "./" to "index.html" when referring to the index file for the top-level directory. This makes it easier to use an unpacked version of the documentation via file: URLs. This closes SF bug #541257. Index: about.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/about.html,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -C2 -d -r1.3 -r1.3.6.1 *** about.html 5 Oct 2000 05:17:29 -0000 1.3 --- about.html 17 Apr 2002 01:44:07 -0000 1.3.6.1 *************** *** 14,18 **** ! up ! upUp: ! Python Documentation Index
--- 31,35 ---- Up: ! Python Documentation Index
From fdrake@sourceforge.net Wed Apr 17 04:26:08 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:26:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts,1.7,1.7.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv19327/tools Modified Files: Tag: release21-maint getpagecounts Log Message: Update the text of the README distributed with the PostScript files to reflect the changes in the user organizations in the Python community. Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** getpagecounts 28 Apr 2000 17:05:41 -0000 1.7 --- getpagecounts 17 Apr 2002 03:26:05 -0000 1.7.8.1 *************** *** 49,55 **** to print this, *please* print two-sided if you have a printer capable of it! To locate published copies of the larger manuals, or other ! Python reference material, consult the PSA Online Bookstore at: ! http://www.python.org/psa/bookstore/ The following manuals are included: --- 49,55 ---- to print this, *please* print two-sided if you have a printer capable of it! To locate published copies of the larger manuals, or other ! Python reference material, consult the Python Bookstore at: ! http://www.amk.ca/bookstore/ The following manuals are included: *************** *** 60,69 **** If you have any questions, comments, or suggestions regarding these documents, please send them via email to python-docs@python.org. - - If you would like to support the development and maintenance of - documentation for Python, please consider joining the Python Software - Activity (PSA; see http://www.python.org/psa/), or urging your - organization to join the PSA or the Python Consortium (see - http://www.python.org/consortium/). """ --- 60,63 ---- From fdrake@sourceforge.net Wed Apr 17 04:29:28 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:29:28 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts,1.7,1.7.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv19909/tools Modified Files: Tag: release22-maint getpagecounts Log Message: Remove Emacs turd; not needed with modern Emacs versions. Add a -r option; if given with a release number, the "What's New" document is included with the relevant version number. Update the text of the README distributed with the PostScript files to reflect the changes in the user organizations in the Python community. Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.7 retrieving revision 1.7.26.1 diff -C2 -d -r1.7 -r1.7.26.1 *** getpagecounts 28 Apr 2000 17:05:41 -0000 1.7 --- getpagecounts 17 Apr 2002 03:29:26 -0000 1.7.26.1 *************** *** 1,4 **** #! /usr/bin/env python - # -*- Python -*- """Generate a page count report of the PostScript version of the manuals.""" --- 1,3 ---- *************** *** 6,9 **** --- 5,11 ---- __version__ = '$Revision$' + import getopt + import sys + class PageCounter: *************** *** 12,15 **** --- 14,18 ---- self.total = 0 self.title_width = 0 + self.version = "" def add_document(self, prefix, title): *************** *** 26,30 **** --- 29,45 ---- print " Total page count: %d" % self.total + def parse_options(self): + opts, args = getopt.getopt(sys.argv[1:], "r:", ["release="]) + assert not args + for opt, arg in opts: + if opt in ("-r", "--release"): + self.version = arg + def run(self): + self.parse_options() + if self.version: + version = self.version[:3] + self.add_document("whatsnew" + version.replace(".", ""), + "What's New in Python " + version) for prefix, title in [ ("api", "Python/C API"), *************** *** 49,57 **** to print this, *please* print two-sided if you have a printer capable of it! To locate published copies of the larger manuals, or other ! Python reference material, consult the PSA Online Bookstore at: ! http://www.python.org/psa/bookstore/ ! The following manuals are included: """ SUFFIX = """\ --- 64,72 ---- to print this, *please* print two-sided if you have a printer capable of it! To locate published copies of the larger manuals, or other ! Python reference material, consult the Python Bookstore at: ! http://www.amk.ca/bookstore/ ! The following manuals are included in this package: """ SUFFIX = """\ *************** *** 60,69 **** If you have any questions, comments, or suggestions regarding these documents, please send them via email to python-docs@python.org. - - If you would like to support the development and maintenance of - documentation for Python, please consider joining the Python Software - Activity (PSA; see http://www.python.org/psa/), or urging your - organization to join the PSA or the Python Consortium (see - http://www.python.org/consortium/). """ --- 75,78 ---- From fdrake@sourceforge.net Wed Apr 17 04:29:42 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:29:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv19946/tools Modified Files: getpagecounts Log Message: Remove Emacs turd; not needed with modern Emacs versions. Add a -r option; if given with a release number, the "What's New" document is included with the relevant version number. Update the text of the README distributed with the PostScript files to reflect the changes in the user organizations in the Python community. Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** getpagecounts 28 Apr 2000 17:05:41 -0000 1.7 --- getpagecounts 17 Apr 2002 03:29:40 -0000 1.8 *************** *** 1,4 **** #! /usr/bin/env python - # -*- Python -*- """Generate a page count report of the PostScript version of the manuals.""" --- 1,3 ---- *************** *** 6,9 **** --- 5,11 ---- __version__ = '$Revision$' + import getopt + import sys + class PageCounter: *************** *** 12,15 **** --- 14,18 ---- self.total = 0 self.title_width = 0 + self.version = "" def add_document(self, prefix, title): *************** *** 26,30 **** --- 29,45 ---- print " Total page count: %d" % self.total + def parse_options(self): + opts, args = getopt.getopt(sys.argv[1:], "r:", ["release="]) + assert not args + for opt, arg in opts: + if opt in ("-r", "--release"): + self.version = arg + def run(self): + self.parse_options() + if self.version: + version = self.version[:3] + self.add_document("whatsnew" + version.replace(".", ""), + "What's New in Python " + version) for prefix, title in [ ("api", "Python/C API"), *************** *** 49,57 **** to print this, *please* print two-sided if you have a printer capable of it! To locate published copies of the larger manuals, or other ! Python reference material, consult the PSA Online Bookstore at: ! http://www.python.org/psa/bookstore/ ! The following manuals are included: """ SUFFIX = """\ --- 64,72 ---- to print this, *please* print two-sided if you have a printer capable of it! To locate published copies of the larger manuals, or other ! Python reference material, consult the Python Bookstore at: ! http://www.amk.ca/bookstore/ ! The following manuals are included in this package: """ SUFFIX = """\ *************** *** 60,69 **** If you have any questions, comments, or suggestions regarding these documents, please send them via email to python-docs@python.org. - - If you would like to support the development and maintenance of - documentation for Python, please consider joining the Python Software - Activity (PSA; see http://www.python.org/psa/), or urging your - organization to join the PSA or the Python Consortium (see - http://www.python.org/consortium/). """ --- 75,78 ---- From fdrake@sourceforge.net Wed Apr 17 04:31:10 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:31:10 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.240,1.241 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv20275 Modified Files: Makefile Log Message: Pass the -r option to getpagecounts to generate an entry for the "What's New" document. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.240 retrieving revision 1.241 diff -C2 -d -r1.240 -r1.241 *** Makefile 26 Mar 2002 20:29:10 -0000 1.240 --- Makefile 17 Apr 2002 03:31:08 -0000 1.241 *************** *** 517,521 **** paper-$(PAPER)/README: $(PSFILES) $(TOOLSDIR)/getpagecounts ! cd paper-$(PAPER) && ../$(TOOLSDIR)/getpagecounts >../$@ info-$(RELEASE).tgz: info --- 517,521 ---- paper-$(PAPER)/README: $(PSFILES) $(TOOLSDIR)/getpagecounts ! cd paper-$(PAPER) && ../$(TOOLSDIR)/getpagecounts -r $(RELEASE) >../$@ info-$(RELEASE).tgz: info From fdrake@sourceforge.net Wed Apr 17 04:31:33 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:31:33 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.6,1.235.2.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv20356 Modified Files: Tag: release22-maint Makefile Log Message: Pass the -r option to getpagecounts to generate an entry for the "What's New" document. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.6 retrieving revision 1.235.2.1.2.7 diff -C2 -d -r1.235.2.1.2.6 -r1.235.2.1.2.7 *** Makefile 1 Apr 2002 16:11:26 -0000 1.235.2.1.2.6 --- Makefile 17 Apr 2002 03:31:31 -0000 1.235.2.1.2.7 *************** *** 517,521 **** paper-$(PAPER)/README: $(PSFILES) $(TOOLSDIR)/getpagecounts ! cd paper-$(PAPER) && ../$(TOOLSDIR)/getpagecounts >../$@ info-$(RELEASE).tgz: info --- 517,521 ---- paper-$(PAPER)/README: $(PSFILES) $(TOOLSDIR)/getpagecounts ! cd paper-$(PAPER) && ../$(TOOLSDIR)/getpagecounts -r $(RELEASE) >../$@ info-$(RELEASE).tgz: info From fdrake@sourceforge.net Wed Apr 17 04:41:53 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:41:53 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22775/ref Modified Files: ref4.tex Log Message: Adjust markup to worm around tool limitations; the "m" in "model" was being dropped in the HTML formatted version. Reported by Mike Coleman. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ref4.tex 1 Apr 2002 21:33:55 -0000 1.30 --- ref4.tex 17 Apr 2002 03:41:50 -0000 1.31 *************** *** 172,176 **** executed whether an exception occurred or not in the preceding code. ! Python uses the ``termination'' \index{termination model}model of error handling: an exception handler can find out what happened and continue execution at an outer level, but it cannot repair the cause --- 172,176 ---- executed whether an exception occurred or not in the preceding code. ! Python uses the ``termination''\index{termination model} model of error handling: an exception handler can find out what happened and continue execution at an outer level, but it cannot repair the cause From fdrake@sourceforge.net Wed Apr 17 04:42:10 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:42:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.28,1.28.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22886/ref Modified Files: Tag: release22-maint ref4.tex Log Message: Adjust markup to worm around tool limitations; the "m" in "model" was being dropped in the HTML formatted version. Reported by Mike Coleman. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.28 retrieving revision 1.28.18.1 diff -C2 -d -r1.28 -r1.28.18.1 *** ref4.tex 23 Jun 2001 05:27:20 -0000 1.28 --- ref4.tex 17 Apr 2002 03:42:08 -0000 1.28.18.1 *************** *** 185,189 **** executed whether an exception occurred or not in the preceding code. ! Python uses the ``termination'' \index{termination model}model of error handling: an exception handler can find out what happened and continue execution at an outer level, but it cannot repair the cause --- 185,189 ---- executed whether an exception occurred or not in the preceding code. ! Python uses the ``termination''\index{termination model} model of error handling: an exception handler can find out what happened and continue execution at an outer level, but it cannot repair the cause From fdrake@sourceforge.net Wed Apr 17 04:42:28 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 16 Apr 2002 20:42:28 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.26.2.1,1.26.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22985/ref Modified Files: Tag: release21-maint ref4.tex Log Message: Adjust markup to worm around tool limitations; the "m" in "model" was being dropped in the HTML formatted version. Reported by Mike Coleman. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.26.2.1 retrieving revision 1.26.2.2 diff -C2 -d -r1.26.2.1 -r1.26.2.2 *** ref4.tex 29 May 2001 15:45:01 -0000 1.26.2.1 --- ref4.tex 17 Apr 2002 03:42:26 -0000 1.26.2.2 *************** *** 184,188 **** executed whether an exception occurred or not in the preceding code. ! Python uses the ``termination'' \index{termination model}model of error handling: an exception handler can find out what happened and continue execution at an outer level, but it cannot repair the cause --- 184,188 ---- executed whether an exception occurred or not in the preceding code. ! Python uses the ``termination''\index{termination model} model of error handling: an exception handler can find out what happened and continue execution at an outer level, but it cannot repair the cause From tim_one@sourceforge.net Wed Apr 17 05:36:37 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 16 Apr 2002 21:36:37 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.21,1.337.2.4.2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2219/22/Misc Modified Files: Tag: release22-maint NEWS Log Message: Windows installer: disabled Wise's "delete in-use files" uninstall option. It was the cause of at least one way UNWISE.EXE could vanish (install a python; uninstall it; install it again; reboot the machine; abracadabra the uinstaller is gone). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.21 retrieving revision 1.337.2.4.2.22 diff -C2 -d -r1.337.2.4.2.21 -r1.337.2.4.2.22 *** NEWS 13 Apr 2002 05:25:28 -0000 1.337.2.4.2.21 --- NEWS 17 Apr 2002 04:36:35 -0000 1.337.2.4.2.22 *************** *** 17,20 **** --- 17,24 ---- Windows + - Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause + of that has been fixed in the installer (disabled Wise's "delete in- + use files" uninstall option). + What's New in Python 2.2.1 final? From tim_one@sourceforge.net Wed Apr 17 05:36:37 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 16 Apr 2002 21:36:37 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.98.4.5,1.98.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv2219/22/PCbuild Modified Files: Tag: release22-maint python20.wse Log Message: Windows installer: disabled Wise's "delete in-use files" uninstall option. It was the cause of at least one way UNWISE.EXE could vanish (install a python; uninstall it; install it again; reboot the machine; abracadabra the uinstaller is gone). Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.5 retrieving revision 1.98.4.6 diff -C2 -d -r1.98.4.5 -r1.98.4.6 *** python20.wse 4 Apr 2002 21:53:07 -0000 1.98.4.5 --- python20.wse 17 Apr 2002 04:36:35 -0000 1.98.4.6 *************** *** 2870,2874 **** item: Remark end ! item: Add Text to INSTALL.LOG Text=Delete in-use files: On end --- 2870,2883 ---- item: Remark end ! remarked item: Remark ! Text=Don't enable "Delete in-use files". Here's what happens: ! end ! remarked item: Remark ! Text=Install Python; uninstall Python; install Python again. Reboot the machine. ! end ! remarked item: Remark ! Text=Now UNWISE.EXE is missing. I think this is a Wise bug, but so it goes. ! end ! remarked item: Add Text to INSTALL.LOG Text=Delete in-use files: On end From tim_one@sourceforge.net Wed Apr 17 05:36:18 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 16 Apr 2002 21:36:18 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.146.2.17,1.146.2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2142/21/dist/src/Misc Modified Files: Tag: release21-maint NEWS Log Message: Windows installer: disabled Wise's "delete in-use files" uninstall option. It was the cause of at least one way UNWISE.EXE could vanish (install a python; uninstall it; install it again; reboot the machine; abracadabra the uinstaller is gone). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146.2.17 retrieving revision 1.146.2.18 diff -C2 -d -r1.146.2.17 -r1.146.2.18 *** NEWS 9 Apr 2002 01:16:08 -0000 1.146.2.17 --- NEWS 17 Apr 2002 04:36:15 -0000 1.146.2.18 *************** *** 28,31 **** --- 28,35 ---- Windows + - Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause + of that has been fixed in the installer (disabled Wise's "delete in- + use files" uninstall option). + - The installer now installs Start menu shortcuts under (the local equivalent of) "All Users" when doing an Admin install. From tim_one@sourceforge.net Wed Apr 17 05:36:18 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 16 Apr 2002 21:36:18 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.39.2.10,1.39.2.11 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv2142/21/dist/src/PCbuild Modified Files: Tag: release21-maint python20.wse Log Message: Windows installer: disabled Wise's "delete in-use files" uninstall option. It was the cause of at least one way UNWISE.EXE could vanish (install a python; uninstall it; install it again; reboot the machine; abracadabra the uinstaller is gone). Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.39.2.10 retrieving revision 1.39.2.11 diff -C2 -d -r1.39.2.10 -r1.39.2.11 *** python20.wse 8 Apr 2002 18:37:13 -0000 1.39.2.10 --- python20.wse 17 Apr 2002 04:36:16 -0000 1.39.2.11 *************** *** 2863,2867 **** item: Remark end ! item: Add Text to INSTALL.LOG Text=Delete in-use files: On end --- 2863,2876 ---- item: Remark end ! remarked item: Remark ! Text=Don't enable "Delete in-use files". Here's what happens: ! end ! remarked item: Remark ! Text=Install Python; uninstall Python; install Python again. Reboot the machine. ! end ! remarked item: Remark ! Text=Now UNWISE.EXE is missing. I think this is a Wise bug, but so it goes. ! end ! remarked item: Add Text to INSTALL.LOG Text=Delete in-use files: On end From fdrake@sourceforge.net Wed Apr 17 13:54:07 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Wed, 17 Apr 2002 05:54:07 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22379/lib Modified Files: libfuncs.tex Log Message: Add a version annotation for the help() function. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** libfuncs.tex 3 Apr 2002 22:41:50 -0000 1.103 --- libfuncs.tex 17 Apr 2002 12:54:04 -0000 1.104 *************** *** 426,429 **** --- 426,430 ---- help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated. + \versionadded{2.2} \end{funcdesc} From fdrake@sourceforge.net Wed Apr 17 13:54:58 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Wed, 17 Apr 2002 05:54:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.2,1.100.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22658/lib Modified Files: Tag: release22-maint libfuncs.tex Log Message: Add a version annotation for the help() function. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.2 retrieving revision 1.100.4.3 diff -C2 -d -r1.100.4.2 -r1.100.4.3 *** libfuncs.tex 6 Mar 2002 02:29:50 -0000 1.100.4.2 --- libfuncs.tex 17 Apr 2002 12:54:56 -0000 1.100.4.3 *************** *** 416,419 **** --- 416,420 ---- help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated. + \versionadded{2.2} \end{funcdesc} From fdrake@sourceforge.net Wed Apr 17 14:45:00 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Wed, 17 Apr 2002 06:45:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv8824/api Modified Files: newtypes.tex Log Message: Add text on tp_as_buffer that refers tothe section that covers the topic. Additional material is still needed in that section. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** newtypes.tex 16 Apr 2002 18:32:37 -0000 1.10 --- newtypes.tex 17 Apr 2002 13:44:58 -0000 1.11 *************** *** 679,685 **** \end{cmemberdesc} ! PyBufferProcs *tp_as_buffer; ! XXX \begin{cmemberdesc}{PyTypeObject}{long}{tp_flags} --- 679,691 ---- \end{cmemberdesc} ! \begin{cmemberdesc}{PyTypeObject}{PyBufferProcs*}{tp_as_buffer} ! Pointer to an additional structure contains fields relevant only to ! objects which implement the buffer interface. These fields are ! documented in ``Buffer Object Structures'' (section ! \ref{buffer-structs}). ! The \member{tp_as_buffer} field is not inherited, but the contained ! fields are inherited individually. ! \end{cmemberdesc} \begin{cmemberdesc}{PyTypeObject}{long}{tp_flags} From montanaro@sourceforge.net Wed Apr 17 20:33:09 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Wed, 17 Apr 2002 12:33:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5881 Modified Files: libcodecs.tex Log Message: typo Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libcodecs.tex 16 Apr 2002 15:12:10 -0000 1.8 --- libcodecs.tex 17 Apr 2002 19:33:06 -0000 1.9 *************** *** 64,68 **** \end{funcdesc} ! To simply access to the various codecs, the module provides these additional functions which use \function{lookup()} for the codec lookup: --- 64,68 ---- \end{funcdesc} ! To simplify access to the various codecs, the module provides these additional functions which use \function{lookup()} for the codec lookup: From lemburg@sourceforge.net Wed Apr 17 21:30:12 2002 From: lemburg@sourceforge.net (lemburg@sourceforge.net) Date: Wed, 17 Apr 2002 13:30:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_packager.py,NONE,1.1 bdist_pkgtool.py,NONE,1.1 bdist_sdux.py,NONE,1.1 __init__.py,1.14,1.15 bdist.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv25468 Modified Files: __init__.py bdist.py Added Files: bdist_packager.py bdist_pkgtool.py bdist_sdux.py Log Message: Patch #531901 by Mark W. Alexander: adds a new distutils packager base class (in bdist_packager) and two subclasses which make use of this base class: bdist_pkgtool (for Solaris) and bdist_sdux (for HP-UX). --- NEW FILE: bdist_packager.py --- """distutils.command.bdist_ packager Modified from bdist_dumb by Mark W. Alexander Implements the Distutils 'bdist_packager' abstract command to be subclassed by binary package creation commands.""" __revision__ = "$Id: bdist_packager.py,v 0.1 2001/04/4 mwa" import os from distutils.core import Command from distutils.util import get_platform from distutils.dir_util import create_tree, remove_tree from distutils.file_util import write_file from distutils.errors import * import string, sys class bdist_packager (Command): description = "abstract base for package manager specific bdist commands" # XXX update user_options user_options = [ ('bdist-base=', None, "base directory for creating built distributions"), ('pkg-dir=', None, "base directory for creating binary packages (defaults to \"binary\" under "), ('dist-dir=', 'd', "directory to put final RPM files in " "(and .spec files if --spec-only)"), ('category=', None, "Software category (packager dependent format)"), ('revision=', None, "package revision number"), # the following have moved into the distribution class #('packager=', None, #"Package maintainer"), #('packager-mail=', None, #"Package maintainer's email address"), #('author=', None, #"Package author"), #('author-mail=', None, #"Package author's email address"), #('license=', None, #"License code"), #('licence=', None, #"alias for license"), ('icon=', None, "Package icon"), ('subpackages=', None, "Comma seperated list of seperately packaged trees"), ('preinstall=', None, "preinstall script (Bourne shell code)"), ('postinstall=', None, "postinstall script (Bourne shell code)"), ('preremove=', None, "preremove script (Bourne shell code)"), ('postremove=', None, "postremove script (Bourne shell code)"), ('requires=', None, "capabilities required by this package"), ('keep-temp', 'k', "don't clean up RPM build directory"), ('control-only', None, "Generate package control files and stop"), ('no-autorelocate', None, "Inhibit automatic relocation to installed site-packages"), ] boolean_options = ['keep-temp', 'control-only', 'no_autorelocate'] def ensure_string_not_none (self,option,default=None): val = getattr(self,option) if val is not None: return Command.ensure_string(self,option,default) val = getattr(self,option) if val is None: raise DistutilsOptionError, "'%s' must be provided" % option def ensure_script (self,arg): if not arg: return try: self.ensure_string(arg, None) except: try: self.ensure_filename(arg, None) except: raise RuntimeError, \ "cannot decipher script option (%s)" \ % arg def write_script (self,path,attr,default=None): """ write the script specified in attr to path. if attr is None, write use default instead """ val = getattr(self,attr) if not val: if not default: return else: setattr(self,attr,default) val = default if val!="": self.announce('Creating %s script', attr) self.execute(write_file, (path, self.get_script(attr)), "writing '%s'" % path) def get_binary_name(self): py_ver = sys.version[0:string.find(sys.version,' ')] return self.name + '-' + self.version + '-' + \ self.revision + '-' + py_ver def get_script (self,attr): # accept a script as a string ("line\012line\012..."), # a filename, or a list # XXX We could probably get away with copy_file, but I'm # guessing this will be more flexible later on.... val = getattr(self,attr) ret=None if val: try: os.stat(val) # script is a file ret=[] f=open(val) ret=string.split(f.read(),"\012"); f.close() #return ret except: if type(val)==type(""): # script is a string ret = string.split(val,"\012") elif type(val)==type([]): # script is a list ret = val else: raise RuntimeError, \ "cannot figure out what to do with 'request' option (%s)" \ % val return ret def initialize_options (self): d = self.distribution self.keep_temp = 0 self.control_only = 0 self.no_autorelocate = 0 self.pkg_dir = None self.plat_name = None self.icon = None self.requires = None self.subpackages = None self.category = None self.revision = None # PEP 241 Metadata self.name = None self.version = None #self.url = None #self.author = None #self.author_email = None #self.maintainer = None #self.maintainer_email = None #self.description = None #self.long_description = None #self.licence = None #self.platforms = None #self.keywords = None self.root_package = None # package installation scripts self.preinstall = None self.postinstall = None self.preremove = None self.postremove = None # initialize_options() def finalize_options (self): if self.pkg_dir is None: bdist_base = self.get_finalized_command('bdist').bdist_base self.pkg_dir = os.path.join(bdist_base, 'binary') if not self.plat_name: d = self.distribution self.plat = d.get_platforms() if self.distribution.has_ext_modules(): self.plat_name = [sys.platform,] else: self.plat_name = ["noarch",] d = self.distribution self.ensure_string_not_none('name', d.get_name()) self.ensure_string_not_none('version', d.get_version()) self.ensure_string('category') self.ensure_string('revision',"1") #self.ensure_string('url',d.get_url()) if type(self.distribution.packages) == type([]): self.root_package=self.distribution.packages[0] else: self.root_package=self.name self.ensure_string('root_package',self.root_package) #self.ensure_string_list('keywords') #self.ensure_string_not_none('author', d.get_author()) #self.ensure_string_not_none('author_email', d.get_author_email()) self.ensure_filename('icon') #self.ensure_string_not_none('maintainer', d.get_maintainer()) #self.ensure_string_not_none('maintainer_email', #d.get_maintainer_email()) #self.ensure_string_not_none('description', d.get_description()) #self.ensure_string_not_none('long_description', d.get_long_description()) #if self.long_description=='UNKNOWN': #self.long_description=self.description #self.ensure_string_not_none('license', d.get_license()) self.ensure_string_list('requires') self.ensure_filename('preinstall') self.ensure_filename('postinstall') self.ensure_filename('preremove') self.ensure_filename('postremove') # finalize_options() def run (self): raise RuntimeError, \ "abstract method -- subclass %s must override" % self.__class__ self.run_command('build') install = self.reinitialize_command('install', reinit_subcommands=1) install.root = self.pkg_dir self.announce("installing to %s" % self.pkg_dir) self.run_command('install') # And make an archive relative to the root of the # pseudo-installation tree. archive_basename = "%s.%s" % (self.distribution.get_fullname(), self.plat_name) if not self.keep_temp: remove_tree(self.pkg_dir, self.verbose, self.dry_run) # run() # class bdist_packager --- NEW FILE: bdist_pkgtool.py --- """distutils.command.bdist_pkgtool Author: Mark W. Alexander Implements the Distutils 'bdist_pkgtool' command (create Solaris pkgtool distributions).""" import os, string, sys, pwd, grp import glob from types import * from distutils.core import Command, DEBUG from distutils.util import get_platform from distutils.file_util import write_file from distutils.errors import * from distutils.command import bdist_packager from distutils import sysconfig import compileall from commands import getoutput __revision__ = "$Id: bdist_pkgtool.py,v 0.3 mwa " # default request script - Is also wrapped around user's request script # unless --no-autorelocate is requested. Finds the python site-packages # directory and prompts for verification DEFAULT_REQUEST="""#!/bin/sh ###################################################################### # Distutils internal package relocation support # ###################################################################### PRODUCT="__DISTUTILS_NAME__" trap `exit 3` 15 /usr/bin/which python 2>&1 >/dev/null if [ $? -ne 0 ]; then echo "The python interpretor needs to be on your path!" echo echo "If you have more than one, make sure the first one is where" echo "you want this module installed:" exit 1 fi PY_DIR=`python -c "import sys;print '%s/lib/python%s' % (sys.exec_prefix,sys.version[0:3])" 2>/dev/null` PY_PKG_DIR=`python -c "import sys;print '%s/lib/python%s/site-packages' % (sys.exec_prefix,sys.version[0:3])" 2>/dev/null` echo "" if [ -z "${PY_DIR}" ]; then echo "I can't seem to find the python distribution." echo "I'm assuming the default path for site-packages" else BASEDIR="${PY_PKG_DIR}" cat <&1 >/dev/null if [ $? -ne 0 ]; then echo "The python interpretor needs to be on your path!" echo echo "If you have more than one, make sure the first one is where" echo "you want this module removed from" exit 1 fi /usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__ if [ $? -eq 0 ]; then find ${BASEDIR}/__DISTUTILS_NAME__ -name "*.pyc" -exec rm {} \; find ${BASEDIR}/__DISTUTILS_NAME__ -name "*.pyo" -exec rm {} \; fi """ # default postremove removes the module directory _IF_ no files are # there (Turns out this isn't needed if the preremove does it's job # Left for posterity DEFAULT_POSTREMOVE="""#!/bin/sh /usr/bin/test -d ${BASEDIR}/__DISTUTILS_NAME__ if [ $? -eq 0 ]; then if [ `find ${BASEDIR}/__DISTUTILS_NAME__ ! -type d | wc -l` -eq 0 ]; then rm -rf ${BASEDIR}/__DISTUTILS_NAME__ fi fi """ class bdist_pkgtool (bdist_packager.bdist_packager): description = "create an pkgtool (Solaris) package" user_options = bdist_packager.bdist_packager.user_options + [ ('revision=', None, "package revision number (PSTAMP)"), ('pkg-abrev=', None, "Abbreviation (9 characters or less) of the package name"), ('compver=', None, "file containing compatible versions of this package (man compver)"), ('depend=', None, "file containing dependencies for this package (man depend)"), #('category=', None, #"Software category"), ('request=', None, "request script (Bourne shell code)"), ] def initialize_options (self): # XXX Check for pkgtools on path... bdist_packager.bdist_packager.initialize_options(self) self.compver = None self.depend = None self.vendor = None self.classes = None self.request = None self.pkg_abrev = None self.revision = None # I'm not sure I should need to do this, but the setup.cfg # settings weren't showing up.... options = self.distribution.get_option_dict('bdist_packager') for key in options.keys(): setattr(self,key,options[key][1]) # initialize_options() def finalize_options (self): global DEFAULT_REQUEST, DEFAULT_POSTINSTALL global DEFAULT_PREREMOVE, DEFAULT_POSTREMOVE if self.pkg_dir is None: dist_dir = self.get_finalized_command('bdist').dist_dir self.pkg_dir = os.path.join(dist_dir, "pkgtool") self.ensure_string('classes', None) self.ensure_string('revision', "1") self.ensure_script('request') self.ensure_script('preinstall') self.ensure_script('postinstall') self.ensure_script('preremove') self.ensure_script('postremove') self.ensure_string('vendor', None) if self.__dict__.has_key('author'): if self.__dict__.has_key('author_email'): self.ensure_string('vendor', "%s <%s>" % (self.author, self.author_email)) else: self.ensure_string('vendor', "%s" % (self.author)) self.ensure_string('category', "System,application") self.ensure_script('compver') self.ensure_script('depend') bdist_packager.bdist_packager.finalize_options(self) if self.pkg_abrev is None: self.pkg_abrev=self.name if len(self.pkg_abrev)>9: raise DistutilsOptionError, \ "pkg-abrev (%s) must be less than 9 characters" % self.pkg_abrev # Update default scripts with our metadata name DEFAULT_REQUEST = string.replace(DEFAULT_REQUEST, "__DISTUTILS_NAME__", self.root_package) DEFAULT_POSTINSTALL = string.replace(DEFAULT_POSTINSTALL, "__DISTUTILS_NAME__", self.root_package) DEFAULT_PREREMOVE = string.replace(DEFAULT_PREREMOVE, "__DISTUTILS_NAME__", self.root_package) DEFAULT_POSTREMOVE = string.replace(DEFAULT_POSTREMOVE, "__DISTUTILS_NAME__", self.root_package) # finalize_options() def make_package(self,root=None): # make directories self.mkpath(self.pkg_dir) if root: pkg_dir = self.pkg_dir+"/"+root self.mkpath(pkg_dir) else: pkg_dir = self.pkg_dir install = self.reinitialize_command('install', reinit_subcommands=1) # build package self.announce('Building package') self.run_command('build') self.announce('Creating pkginfo file') path = os.path.join(pkg_dir, "pkginfo") self.execute(write_file, (path, self._make_info_file()), "writing '%s'" % path) # request script handling if self.request==None: self.request = self._make_request_script() if self.request!="": path = os.path.join(pkg_dir, "request") self.execute(write_file, (path, self.request), "writing '%s'" % path) # Create installation scripts, since compver & depend are # user created files, they work just fine as scripts self.write_script(os.path.join(pkg_dir, "postinstall"), 'postinstall',DEFAULT_POSTINSTALL) self.write_script(os.path.join(pkg_dir, "preinstall"), 'preinstall',None) self.write_script(os.path.join(pkg_dir, "preremove"), 'preremove',DEFAULT_PREREMOVE) self.write_script(os.path.join(pkg_dir, "postremove"), 'postremove',None) self.write_script(os.path.join(pkg_dir, "compver"), 'compver',None) self.write_script(os.path.join(pkg_dir, "depend"), 'depend',None) self.announce('Creating prototype file') path = os.path.join(pkg_dir, "prototype") self.execute(write_file, (path, self._make_prototype()), "writing '%s'" % path) if self.control_only: # stop if requested return self.announce('Creating package') pkg_cmd = ['pkgmk', '-o', '-f'] pkg_cmd.append(path) pkg_cmd.append('-b') pkg_cmd.append(os.environ['PWD']) self.spawn(pkg_cmd) pkg_cmd = ['pkgtrans', '-s', '/var/spool/pkg'] path = os.path.join(os.environ['PWD'],pkg_dir, self.get_binary_name() + ".pkg") self.announce('Transferring package to ' + pkg_dir) pkg_cmd.append(path) pkg_cmd.append(self.pkg_abrev) self.spawn(pkg_cmd) os.system("rm -rf /var/spool/pkg/%s" % self.pkg_abrev) def run (self): if self.subpackages: self.subpackages=string.split(self.subpackages,",") for pkg in self.subpackages: self.make_package(subpackage) else: self.make_package() # run() def _make_prototype(self): proto_file = ["i pkginfo"] if self.request: proto_file.extend(['i request']) if self.postinstall: proto_file.extend(['i postinstall']) if self.postremove: proto_file.extend(['i postremove']) if self.preinstall: proto_file.extend(['i preinstall']) if self.preremove: proto_file.extend(['i preremove']) if self.compver: proto_file.extend(['i compver']) if self.requires: proto_file.extend(['i depend']) proto_file.extend(['!default 644 root bin']) build = self.get_finalized_command('build') try: self.distribution.packages[0] file_list=string.split( getoutput("pkgproto %s/%s=%s" % (build.build_lib, self.distribution.packages[0], self.distribution.packages[0])),"\012") except: file_list=string.split( getoutput("pkgproto %s=" % (build.build_lib)),"\012") ownership="%s %s" % (pwd.getpwuid(os.getuid())[0], grp.getgrgid(os.getgid())[0]) for i in range(len(file_list)): file_list[i] = string.replace(file_list[i],ownership,"root bin") proto_file.extend(file_list) return proto_file def _make_request_script(self): global DEFAULT_REQUEST # A little different from other scripts, if we are to automatically # relocate to the target site-packages, we have to wrap any provided # script with the autorelocation script. If no script is provided, # The request script will simply be the autorelocate script if self.no_autorelocate==0: request=string.split(DEFAULT_REQUEST,"\012") else: self.announce('Creating relocation request script') if self.request: users_request=self.get_script('request') if users_request!=None and users_request!=[]: if self.no_autorelocate==0 and users_request[0][0:2]=="#!": users_request.remove(users_request[0]) for i in users_request: request.append(i) if self.no_autorelocate==0: request.append("#############################################") request.append("# finalize relocation support #") request.append("#############################################") request.append('echo "BASEDIR=\\"${BASEDIR}\\"" >>$1') return request def _make_info_file(self): """Generate the text of a pkgtool info file and return it as a list of strings (one per line). """ # definitions and headers # PKG must be alphanumeric, < 9 characters info_file = [ 'PKG="%s"' % self.pkg_abrev, 'NAME="%s"' % self.name, 'VERSION="%s"' % self.version, 'PSTAMP="%s"' % self.revision, ] info_file.extend(['VENDOR="%s (%s)"' % (self.distribution.maintainer, \ self.distribution.license) ]) info_file.extend(['EMAIL="%s"' % self.distribution.maintainer_email ]) p = self.distribution.get_platforms() if p is None or p==['UNKNOWN']: archs=getoutput('uname -p') else: archs=string.join(self.distribution.get_platforms(),',') #else: #print "Assuming a sparc architecure" #archs='sparc' info_file.extend(['ARCH="%s"' % archs ]) if self.distribution.get_url(): info_file.extend(['HOTLINE="%s"' % self.distribution.get_url() ]) if self.classes: info_file.extend(['CLASSES="%s"' % self.classes ]) if self.category: info_file.extend(['CATEGORY="%s"' % self.category ]) site=None for i in sys.path: if i[-13:]=="site-packages": site=i break if site: info_file.extend(['BASEDIR="%s"' % site ]) return info_file # _make_info_file () def _format_changelog(self, changelog): """Format the changelog correctly and convert it to a list of strings """ if not changelog: return changelog new_changelog = [] for line in string.split(string.strip(changelog), '\n'): line = string.strip(line) if line[0] == '*': new_changelog.extend(['', line]) elif line[0] == '-': new_changelog.append(line) else: new_changelog.append(' ' + line) # strip trailing newline inserted by first changelog entry if not new_changelog[0]: del new_changelog[0] return new_changelog # _format_changelog() # class bdist_rpm --- NEW FILE: bdist_sdux.py --- """distutils.command.bdist_pkgtool Implements the Distutils 'bdist_sdux' command to create HP-UX swinstall depot""" # Mark Alexander __revision__ = "$Id: bdist_sdux.py,v 0.2 " import os, string import glob from types import * from distutils.core import Command, DEBUG from distutils.util import get_platform from distutils.file_util import write_file from distutils.errors import * from distutils.command import bdist_packager import sys from commands import getoutput DEFAULT_CHECKINSTALL="""#!/bin/sh /usr/bin/which python 2>&1 >/dev/null if [ $? -ne 0 ]; then echo "ERROR: Python must be on your PATH" &>2 echo "ERROR: (You may need to link it to /usr/bin) " &>2 exit 1 fi PY_DIR=`python -c "import sys;print '%s/lib/python%s' % (sys.exec_prefix,sys.version[0:3])" #2>/dev/null` PY_PKG_DIR=`python -c "import sys;print '%s/lib/python%s/site-packages' % (sys.exec_prefix,sys.version[0:3])" #2>/dev/null` PY_LIB_DIR=`dirname $PY_PKG_DIR` if [ "`dirname ${SW_LOCATION}`" = "__DISTUTILS_PKG_DIR__" ]; then # swinstall to default location if [ "${PY_PKG_DIR}" != "__DISTUTILS_PKG_DIR__" ]; then echo "ERROR: " &>2 echo "ERROR: Python is not installed where this package expected!" &>2 echo "ERROR: You need to manually relocate this package to your python installation." &>2 echo "ERROR: " &>2 echo "ERROR: Re-run swinstall specifying the product name:location, e.g.:" &>2 echo "ERROR: " &>2 echo "ERROR: swinstall -s [source] __DISTUTILS_NAME__:${PY_PKG_DIR}/__DISTUTILS_DIRNAME__" &>2 echo "ERROR: " &>2 echo "ERROR: to relocate this package to match your python installation" &>2 echo "ERROR: " &>2 exit 1 fi else if [ "`dirname ${SW_LOCATION}`" != "${PY_PKG_DIR}" -a "`dirname ${SWLOCATION}`" != "${PY_LIB_DIR}" ]; then echo "WARNING: " &>2 echo "WARNING: Package is being installed outside the 'normal' python search path!" &>2 echo "WARNING: Add ${SW_LOCATION} to PYTHONPATH to use this package" &>2 echo "WARNING: " &>2 fi fi """ DEFAULT_POSTINSTALL="""#!/bin/sh /usr/bin/which python 2>&1 >/dev/null if [ $? -ne 0 ]; then echo "ERROR: Python must be on your PATH" &>2 echo "ERROR: (You may need to link it to /usr/bin) " &>2 exit 1 fi python -c "import compileall;compileall.compile_dir(\\"${SW_LOCATION}\\")" """ DEFAULT_PREREMOVE="""#!/bin/sh # remove compiled bytecode files find ${SW_LOCATION} -name "*.pyc" -exec rm {} \; find ${SW_LOCATION} -name "*.pyo" -exec rm {} \; """ DEFAULT_POSTREMOVE="""#!/bin/sh if [ `find ${SW_LOCATION} ! -type d | wc -l` -eq 0 ]; then # remove if there's nothing but empty directories left rm -rf ${SW_LOCATION} fi """ class bdist_sdux(bdist_packager.bdist_packager): description = "create an HP swinstall depot" user_options = bdist_packager.bdist_packager.user_options + [ #('revision=', None, #"package revision number (PSTAMP)"), ('keep-permissions', None, "Don't reset permissions and ownership to root/bin"), # XXX ('corequisites=', None, "corequisites"), # XXX ('prerequisites=', None, "prerequisites"), # XXX #('category=', None, #"Software category"), ('checkinstall=', None, # XXX ala request "checkinstall script (Bourne shell code)"), ('configure=', None, # XXX "configure script (Bourne shell code)"), ('unconfigure=', None, # XXX "unconfigure script (Bourne shell code)"), ('verify=', None, # XXX "verify script (Bourne shell code)"), ('unpreinstall=', None, # XXX "unpreinstall script (Bourne shell code)"), ('unpostinstall=', None, # XXX "unpostinstall script (Bourne shell code)"), ] boolean_options = ['keep-permissions'] def initialize_options (self): bdist_packager.bdist_packager.initialize_options(self) self.corequisites = None self.prerequesites = None self.checkinstall = None self.configure = None self.unconfigure = None self.verify = None self.unpreinstall = None self.unpostinstall = None # More self.copyright = None self.readme = None self.machine_type = None self.os_name = None self.os_release = None self.directory = None self.readme = None self.copyright = None self.architecture= None self.keep_permissions= None options = self.distribution.get_option_dict('bdist_packager') for key in options.keys(): setattr(self,key,options[key][1]) # initialize_options() def finalize_options (self): global DEFAULT_CHECKINSTALL, DEFAULT_POSTINSTALL global DEFAULT_PREREMOVE, DEFAULT_POSTREMOVE if self.pkg_dir==None: dist_dir = self.get_finalized_command('bdist').dist_dir self.pkg_dir = os.path.join(dist_dir, "sdux") self.ensure_script('corequisites') self.ensure_script('prerequesites') self.ensure_script('checkinstall') self.ensure_script('configure') self.ensure_script('unconfigure') self.ensure_script('verify') self.ensure_script('unpreinstall') self.ensure_script('unpostinstall') self.ensure_script('copyright') self.ensure_script('readme') self.ensure_string('machine_type','*') if not self.__dict__.has_key('platforms'): # This is probably HP, but if it's not, use sys.platform if sys.platform[0:5] == "hp-ux": self.platforms = "HP-UX" else: self.platforms = string.upper(sys.platform) else: # we can only handle one self.platforms=string.join(self.platforms[0]) self.ensure_string('os_release','*') self.ensure_string('directory','%s/lib/python%s/site-packages' % \ (sys.exec_prefix, sys.version[0:3])) bdist_packager.bdist_packager.finalize_options(self) DEFAULT_CHECKINSTALL = string.replace(DEFAULT_CHECKINSTALL, "__DISTUTILS_NAME__", self.name) DEFAULT_CHECKINSTALL = string.replace(DEFAULT_CHECKINSTALL, "__DISTUTILS_DIRNAME__", self.root_package) DEFAULT_CHECKINSTALL = string.replace(DEFAULT_CHECKINSTALL, "__DISTUTILS_PKG_DIR__", self.directory) DEFAULT_POSTINSTALL = string.replace(DEFAULT_POSTINSTALL, "__DISTUTILS_DIRNAME__", self.root_package) #DEFAULT_PREREMOVE = string.replace(DEFAULT_PREREMOVE, #"__DISTUTILS_NAME__", self.root_package) #DEFAULT_POSTREMOVE = string.replace(DEFAULT_POSTREMOVE, #"__DISTUTILS_NAME__", self.root_package) # finalize_options() def run (self): # make directories self.mkpath(self.pkg_dir) psf_path = os.path.join(self.pkg_dir, "%s.psf" % self.get_binary_name()) # build package self.announce('Building package') self.run_command('build') self.announce('Creating psf file') self.execute(write_file, (psf_path, self._make_control_file()), "writing '%s'" % psf_path) if self.control_only: # stop if requested return self.announce('Creating package') spawn_cmd = ['swpackage', '-s'] spawn_cmd.append(psf_path) spawn_cmd.append('-x') spawn_cmd.append('target_type=tape') spawn_cmd.append('@') spawn_cmd.append(self.pkg_dir+"/"+self.get_binary_name()+'.depot') self.spawn(spawn_cmd) # run() def _make_control_file(self): # Generate a psf file and return it as list of strings (one per line). # definitions and headers title = "%s %s" % (self.maintainer,self.maintainer_email) title=title[0:80] #top=self.distribution.packages[0] psf_file = [ 'vendor', # Vendor information ' tag %s' % "DISTUTILS", ' title %s' % title, ' description Distutils package maintainer (%s)' % self.license, 'end', # end of vendor 'product', # Product information ' tag %s' % self.name, ' title %s' % self.description, ' description %s' % self.description, ' revision %s' % self.version, ' architecture %s' % self.platforms, ' machine_type %s' % self.machine_type, ' os_name %s' % self.platforms, ' os_release %s' % self.os_release, ' directory %s' % self.directory + "/" + self.root_package, ] self.write_script(os.path.join(self.pkg_dir, "checkinstall"), 'checkinstall',DEFAULT_CHECKINSTALL) psf_file.extend([' checkinstall %s/checkinstall' % self.pkg_dir]) self.write_script(os.path.join(self.pkg_dir, "postinstall"), 'postinstall',DEFAULT_POSTINSTALL) psf_file.extend([' postinstall %s/postinstall' % self.pkg_dir]) self.write_script(os.path.join(self.pkg_dir, "preremove"), 'preremove',DEFAULT_PREREMOVE) psf_file.extend([' preremove %s/preremove' % self.pkg_dir]) self.write_script(os.path.join(self.pkg_dir, "postremove"), 'postremove',DEFAULT_POSTREMOVE) psf_file.extend([' postremove %s/postremove' % self.pkg_dir]) if self.preinstall: self.write_script(self.pkg_dir+"/preinstall", 'preinstall', None) psf_file.extend([' preinstall %s/preinstall' % self.pkg_dir]) if self.configure: self.write_script(self.pkg_dir+"/configure", 'configure', None) psf_file.extend([' configure %s/configure' % self.pkg_dir]) if self.unconfigure: self.write_script(self.pkg_dir+"/unconfigure", 'unconfigure', None) psf_file.extend([' unconfigure %s/unconfigure' % self.pkg_dir]) if self.verify: self.write_script(self.pkg_dir+"/verify", 'verify', None) psf_file.extend([' verify %s/verify' % self.pkg_dir]) if self.unpreinstall: self.write_script(self.pkg_dir+"/unpreinstall", 'unpreinstall', None) psf_file.extend([' unpreinstall %s/unpreinstall' % self.pkg_dir]) if self.unpostinstall: self.write_script(self.pkg_dir+"/unpostinstall", 'unpostinstall', None) psf_file.extend([' unpostinstall %s/unpostinstall' % self.pkg_dir]) psf_file.extend([' is_locatable true']) #if self.long_description: #psf_file.extend([self.long_description]) if self.copyright: # XX make a copyright file XXX write_script('copyright') psf_file.extend([' copyright Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv26698/Misc Modified Files: NEWS Log Message: Added note about new distutils commands. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.389 retrieving revision 1.390 diff -C2 -d -r1.389 -r1.390 *** NEWS 16 Apr 2002 20:48:01 -0000 1.389 --- NEWS 17 Apr 2002 20:33:40 -0000 1.390 *************** *** 88,91 **** --- 88,100 ---- Library + - New distutils commands for building packagers were added to + support pkgtool on Solaris and swinstall on HP-UX. + + - distutils now has a new abstract binary packager base class + command/bdist_packager, which simplifies writing packagers. + This will hopefully provide the missing bits to encourage + people to submit more packagers, e.g. for Debian, FreeBSD + and other systems. + - The UTF-16, -LE and -BE now raise a NotImplementedError for all calls to .readline(). Previously, they used to just From doerwalter@sourceforge.net Wed Apr 17 22:34:07 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Wed, 17 Apr 2002 14:34:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.55,1.56 test_string.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16177/Lib/test Modified Files: test_unicode.py test_string.py Log Message: Apply diff3.txt from SF patch http://www.python.org/sf/536241 If a str or unicode method returns the original object, make sure that for str and unicode subclasses the original will not be returned. This should prevent SF bug http://www.python.org/sf/460020 from reappearing. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** test_unicode.py 16 Apr 2002 01:38:40 -0000 1.55 --- test_unicode.py 17 Apr 2002 21:34:05 -0000 1.56 *************** *** 53,56 **** --- 53,75 ---- else: exc = None + if value == output and type(value) is type(output): + # if the original is returned make sure that + # this doesn't happen with subclasses + if value is input: + class usub(unicode): + def __repr__(self): + return 'usub(%r)' % unicode.__repr__(self) + input = usub(input) + try: + f = getattr(input, method) + value = apply(f, args) + except: + value = sys.exc_type + exc = sys.exc_info()[:2] + if value is input: + if verbose: + print 'no' + print '*',f, `input`, `output`, `value` + return if value != output or type(value) is not type(output): if verbose: *************** *** 64,67 **** --- 83,87 ---- test('capitalize', u' hello ', u' hello ') + test('capitalize', u'Hello ', u'Hello ') test('capitalize', u'hello ', u'Hello ') test('capitalize', u'aaaa', u'Aaaa') *************** *** 76,79 **** --- 96,100 ---- test('title', u' hello ', u' Hello ') + test('title', u'Hello ', u'Hello ') test('title', u'hello ', u'Hello ') test('title', u"fOrMaT thIs aS titLe String", u'Format This As Title String') *************** *** 201,204 **** --- 222,226 ---- test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi', 4) test('expandtabs', u'abc\r\nab\tdef\ng\thi', u'abc\r\nab def\ng hi', 4) + test('expandtabs', u'abc\r\nab\r\ndef\ng\r\nhi', u'abc\r\nab\r\ndef\ng\r\nhi', 4) if 0: Index: test_string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_string.py 9 Dec 2001 16:06:29 -0000 1.15 --- test_string.py 17 Apr 2002 21:34:05 -0000 1.16 *************** *** 23,26 **** --- 23,45 ---- value = sys.exc_type f = name + if value == output: + # if the original is returned make sure that + # this doesn't happen with subclasses + if value is input: + class ssub(str): + def __repr__(self): + return 'ssub(%r)' % str.__repr__(self) + input = ssub(input) + try: + f = getattr(input, name) + value = apply(f, args) + except AttributeError: + f = getattr(string, name) + value = apply(f, (input,) + args) + if value is input: + if verbose: + print 'no' + print '*',f, `input`, `output`, `value` + return if value != output: if verbose: From akuchling@sourceforge.net Wed Apr 17 22:50:06 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 17 Apr 2002 14:50:06 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts md5sum.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv21415 Modified Files: md5sum.py Log Message: Use 2.1's .hexdigest() method Index: md5sum.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/md5sum.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** md5sum.py 22 Jun 2001 16:05:48 -0000 1.1 --- md5sum.py 17 Apr 2002 21:50:03 -0000 1.2 *************** *** 3,7 **** """Python utility to print MD5 checksums of argument files. ! Works with Python 1.5.2 and later. """ --- 3,7 ---- """Python utility to print MD5 checksums of argument files. ! Works with Python 2.1 and later. """ *************** *** 10,16 **** BLOCKSIZE = 1024*1024 - def hexify(s): - return ("%02x"*len(s)) % tuple(map(ord, s)) - def main(): args = sys.argv[1:] --- 10,13 ---- *************** *** 27,31 **** sum.update(block) f.close() ! print hexify(sum.digest()), file if __name__ == "__main__": --- 24,28 ---- sum.update(block) f.close() ! print sum.hexdigest(), file if __name__ == "__main__": From akuchling@sourceforge.net Wed Apr 17 22:52:03 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 17 Apr 2002 14:52:03 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts sum5.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv21814 Modified Files: sum5.py Log Message: Use md5.new() constructor Index: sum5.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/sum5.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sum5.py 17 Jan 2001 08:48:39 -0000 1.3 --- sum5.py 17 Apr 2002 21:52:01 -0000 1.4 *************** *** 56,60 **** def printsumfp(fp, file, out = sys.stdout): ! m = md5.md5() try: while 1: --- 56,60 ---- def printsumfp(fp, file, out = sys.stdout): ! m = md5.new() try: while 1: From akuchling@sourceforge.net Wed Apr 17 22:53:23 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 17 Apr 2002 14:53:23 -0700 Subject: [Python-checkins] python/dist/src/Demo/pdist cvslib.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/pdist In directory usw-pr-cvs1:/tmp/cvs-serv22382 Modified Files: cvslib.py Log Message: Use md5.new() constructor Index: cvslib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/cvslib.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** cvslib.py 4 Apr 2002 23:03:47 -0000 1.12 --- cvslib.py 17 Apr 2002 21:53:21 -0000 1.13 *************** *** 71,75 **** self.lmtime = self.lctime = self.lsum = None else: ! self.lsum = md5.md5(open(self.file).read()).digest() self.lseen = 1 --- 71,75 ---- self.lmtime = self.lctime = self.lsum = None else: ! self.lsum = md5.new(open(self.file).read()).digest() self.lseen = 1 From akuchling@sourceforge.net Wed Apr 17 23:27:24 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 17 Apr 2002 15:27:24 -0700 Subject: [Python-checkins] python/nondist/peps pep-0272.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1737 Modified Files: pep-0272.txt Log Message: Add acks, and use correct number for NIST document Index: pep-0272.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0272.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0272.txt 16 Apr 2002 21:24:19 -0000 1.6 --- pep-0272.txt 17 Apr 2002 22:27:21 -0000 1.7 *************** *** 36,40 **** These modes are to be implemented as described in NIST publication ! SP-800A [1]. Descriptions of the first three feedback modes can also be found in Bruce Schneier's book _Applied Cryptography_ [2]. --- 36,40 ---- These modes are to be implemented as described in NIST publication ! SP 800-38A [1]. Descriptions of the first three feedback modes can also be found in Bruce Schneier's book _Applied Cryptography_ [2]. *************** *** 196,199 **** --- 196,213 ---- [3] RFC2440: "OpenPGP Message Format" (http://rfc2440.x42.com, http://www.faqs.org/rfcs/rfc2440.html) + + + Changes + + 2002-04: Remove references to stream ciphers; retitled PEP; + prefixed feedback mode constants with MODE_; removed PGP feedback + mode; added CTR and OFB feedback modes; clarify where numbers + are measured in bytes and where in bits. + + + Acknowledgements + + Thanks to the readers of the python-crypto list for their comments on + this PEP. From akuchling@sourceforge.net Thu Apr 18 00:11:21 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 17 Apr 2002 16:11:21 -0700 Subject: [Python-checkins] python/nondist/peps pep-0272.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv15196 Modified Files: pep-0272.txt Log Message: Update posting history Make some tenses match Index: pep-0272.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0272.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0272.txt 17 Apr 2002 22:27:21 -0000 1.7 --- pep-0272.txt 17 Apr 2002 23:11:18 -0000 1.8 *************** *** 6,10 **** Type: Informational Created: 18-Sep-2001 ! Post-History: Abstract --- 6,10 ---- Type: Informational Created: 18-Sep-2001 ! Post-History: 17-Apr-2002 Abstract *************** *** 200,206 **** Changes ! 2002-04: Remove references to stream ciphers; retitled PEP; prefixed feedback mode constants with MODE_; removed PGP feedback ! mode; added CTR and OFB feedback modes; clarify where numbers are measured in bytes and where in bits. --- 200,206 ---- Changes ! 2002-04: Removed references to stream ciphers; retitled PEP; prefixed feedback mode constants with MODE_; removed PGP feedback ! mode; added CTR and OFB feedback modes; clarified where numbers are measured in bytes and where in bits. From gvanrossum@sourceforge.net Thu Apr 18 01:22:03 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Wed, 17 Apr 2002 17:22:03 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.142,2.143 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5252 Modified Files: typeobject.c Log Message: SF bug 542984. Change type_get_doc (the get function for __doc__) to look in tp_dict more often, and if it finds a descriptor in tp_dict, to call it (with a NULL instance). This means you can add a __doc__ descriptor to a new-style class that returns instance docs when called on an instance, and class docs when called on a class -- or the same docs in either case, but lazily computed. I'll also check this into the 2.2 maintenance branch. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.142 retrieving revision 2.143 diff -C2 -d -r2.142 -r2.143 *** typeobject.c 15 Apr 2002 01:02:12 -0000 2.142 --- typeobject.c 18 Apr 2002 00:22:00 -0000 2.143 *************** *** 83,95 **** { PyObject *result; ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { ! if (type->tp_doc == NULL) { ! Py_INCREF(Py_None); ! return Py_None; ! } return PyString_FromString(type->tp_doc); - } result = PyDict_GetItemString(type->tp_dict, "__doc__"); ! Py_INCREF(result); return result; } --- 83,99 ---- { PyObject *result; ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) return PyString_FromString(type->tp_doc); result = PyDict_GetItemString(type->tp_dict, "__doc__"); ! if (result == NULL) { ! result = Py_None; ! Py_INCREF(result); ! } ! else if (result->ob_type->tp_descr_get) { ! result = result->ob_type->tp_descr_get(result, NULL, type); ! } ! else { ! Py_INCREF(result); ! } return result; } From gvanrossum@sourceforge.net Thu Apr 18 01:27:35 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Wed, 17 Apr 2002 17:27:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6764 Modified Files: test_descr.py Log Message: SF bug 542984. Change type_get_doc (the get function for __doc__) to look in tp_dict more often, and if it finds a descriptor in tp_dict, to call it (with a NULL instance). This means you can add a __doc__ descriptor to a new-style class that returns instance docs when called on an instance, and class docs when called on a class -- or the same docs in either case, but lazily computed. I'll also check this into the 2.2 maintenance branch. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** test_descr.py 16 Apr 2002 16:44:51 -0000 1.131 --- test_descr.py 18 Apr 2002 00:27:33 -0000 1.132 *************** *** 2956,2959 **** --- 2956,2978 ---- vereq(y, (x, "foo")) + def docdescriptor(): + # SF bug 542984 + if verbose: print "Testing __doc__ descriptor..." + class DocDescr(object): + def __get__(self, object, otype): + if object: + object = object.__class__.__name__ + ' instance' + if otype: + otype = otype.__name__ + return 'object=%s; type=%s' % (object, otype) + class OldClass: + __doc__ = DocDescr() + class NewClass(object): + __doc__ = DocDescr() + vereq(OldClass.__doc__, 'object=None; type=OldClass') + vereq(OldClass().__doc__, 'object=OldClass instance; type=OldClass') + vereq(NewClass.__doc__, 'object=None; type=NewClass') + vereq(NewClass().__doc__, 'object=NewClass instance; type=NewClass') + def test_main(): class_docstrings() *************** *** 3020,3023 **** --- 3039,3043 ---- funnynew() imulbug() + docdescriptor() if verbose: print "All OK" From gvanrossum@sourceforge.net Thu Apr 18 01:36:19 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Wed, 17 Apr 2002 17:36:19 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.7,2.126.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9531 Modified Files: Tag: release22-maint typeobject.c Log Message: Backport rev 2.143 (note: some earlier bugfix candidates still TBD). SF bug 542984. Change type_get_doc (the get function for __doc__) to look in tp_dict more often, and if it finds a descriptor in tp_dict, to call it (with a NULL instance). This means you can add a __doc__ descriptor to a new-style class that returns instance docs when called on an instance, and class docs when called on a class -- or the same docs in either case, but lazily computed. I'll also check this into the 2.2 maintenance branch. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.7 retrieving revision 2.126.4.8 diff -C2 -d -r2.126.4.7 -r2.126.4.8 *** typeobject.c 8 Apr 2002 01:39:56 -0000 2.126.4.7 --- typeobject.c 18 Apr 2002 00:36:17 -0000 2.126.4.8 *************** *** 84,96 **** { PyObject *result; ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { ! if (type->tp_doc == NULL) { ! Py_INCREF(Py_None); ! return Py_None; ! } return PyString_FromString(type->tp_doc); - } result = PyDict_GetItemString(type->tp_dict, "__doc__"); ! Py_INCREF(result); return result; } --- 84,100 ---- { PyObject *result; ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) return PyString_FromString(type->tp_doc); result = PyDict_GetItemString(type->tp_dict, "__doc__"); ! if (result == NULL) { ! result = Py_None; ! Py_INCREF(result); ! } ! else if (result->ob_type->tp_descr_get) { ! result = result->ob_type->tp_descr_get(result, NULL, type); ! } ! else { ! Py_INCREF(result); ! } return result; } From gvanrossum@sourceforge.net Thu Apr 18 01:37:12 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Wed, 17 Apr 2002 17:37:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.10,1.113.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9829 Modified Files: Tag: release22-maint test_descr.py Log Message: Backport rev 2.132 (note: some earlier bugfix candidates still TBD). SF bug 542984. Change type_get_doc (the get function for __doc__) to look in tp_dict more often, and if it finds a descriptor in tp_dict, to call it (with a NULL instance). This means you can add a __doc__ descriptor to a new-style class that returns instance docs when called on an instance, and class docs when called on a class -- or the same docs in either case, but lazily computed. I'll also check this into the 2.2 maintenance branch. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.10 retrieving revision 1.113.4.11 diff -C2 -d -r1.113.4.10 -r1.113.4.11 *** test_descr.py 5 Apr 2002 15:42:50 -0000 1.113.4.10 --- test_descr.py 18 Apr 2002 00:37:10 -0000 1.113.4.11 *************** *** 2844,2847 **** --- 2844,2866 ---- vereq(m.__dict__, {"foo": 1}) + def docdescriptor(): + # SF bug 542984 + if verbose: print "Testing __doc__ descriptor..." + class DocDescr(object): + def __get__(self, object, otype): + if object: + object = object.__class__.__name__ + ' instance' + if otype: + otype = otype.__name__ + return 'object=%s; type=%s' % (object, otype) + class OldClass: + __doc__ = DocDescr() + class NewClass(object): + __doc__ = DocDescr() + vereq(OldClass.__doc__, 'object=None; type=OldClass') + vereq(OldClass().__doc__, 'object=OldClass instance; type=OldClass') + vereq(NewClass.__doc__, 'object=None; type=NewClass') + vereq(NewClass().__doc__, 'object=NewClass instance; type=NewClass') + def test_main(): class_docstrings() *************** *** 2901,2904 **** --- 2920,2924 ---- modules() pickleslots() + docdescriptor() if verbose: print "All OK" From akuchling@sourceforge.net Thu Apr 18 03:18:29 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Wed, 17 Apr 2002 19:18:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew20.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv5120 Modified Files: whatsnew20.tex Log Message: Long-forgotten change: Update first paragraph with actual release date Index: whatsnew20.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew20.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** whatsnew20.tex 3 Apr 2002 02:52:50 -0000 1.43 --- whatsnew20.tex 18 Apr 2002 02:18:27 -0000 1.44 *************** *** 12,20 **** \section{Introduction} ! A new release of Python, version 2.0, will be released some time this ! autumn. Beta versions are already available from ! \url{http://www.pythonlabs.com/products/python2.0/}. This article ! covers the exciting new features in 2.0, highlights some other useful ! changes, and points out a few incompatible changes that may require rewriting code. --- 12,18 ---- \section{Introduction} ! A new release of Python, version 2.0, was released on October 16, 2000. This ! article covers the exciting new features in 2.0, highlights some other ! useful changes, and points out a few incompatible changes that may require rewriting code. From anthonybaxter@sourceforge.net Thu Apr 18 03:19:23 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 19:19:23 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.135.6.2,1.135.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5517/Lib Modified Files: Tag: release22-maint urllib.py Log Message: backport gvanrossum's patch Fix from SF bug #541980 (Jacques A. Vidrine). When os.stat() for a file raises OSError, turn it into IOError per documentation. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.135.6.2 retrieving revision 1.135.6.3 diff -C2 -d -r1.135.6.2 -r1.135.6.3 *** urllib.py 5 Apr 2002 15:35:35 -0000 1.135.6.2 --- urllib.py 18 Apr 2002 02:19:19 -0000 1.135.6.3 *************** *** 410,414 **** host, file = splithost(url) localname = url2pathname(file) ! stats = os.stat(localname) size = stats[stat.ST_SIZE] modified = rfc822.formatdate(stats[stat.ST_MTIME]) --- 410,417 ---- host, file = splithost(url) localname = url2pathname(file) ! try: ! stats = os.stat(localname) ! except OSError, e: ! raise IOError(e.errno, e.strerror, e.filename) size = stats[stat.ST_SIZE] modified = rfc822.formatdate(stats[stat.ST_MTIME]) From anthonybaxter@sourceforge.net Thu Apr 18 03:19:38 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 19:19:38 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.53.4.2,2.53.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5587/Objects Modified Files: Tag: release22-maint complexobject.c Log Message: backport tim_one's patch: SF bug 543840: complex(string) accepts strings with \0 complex_subtype_from_string(): this stopped parsing at the first 0 byte, as if that were the end of the input string. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.53.4.2 retrieving revision 2.53.4.3 diff -C2 -d -r2.53.4.2 -r2.53.4.3 *** complexobject.c 25 Mar 2002 13:21:41 -0000 2.53.4.2 --- complexobject.c 18 Apr 2002 02:19:36 -0000 2.53.4.3 *************** *** 788,792 **** } /* end of switch */ ! } while (*s!='\0' && !sw_error); if (sw_error) { --- 788,792 ---- } /* end of switch */ ! } while (s - start < len && !sw_error); if (sw_error) { From anthonybaxter@sourceforge.net Thu Apr 18 03:19:38 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 19:19:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.42.4.1,1.42.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5587/Lib/test Modified Files: Tag: release22-maint test_b1.py Log Message: backport tim_one's patch: SF bug 543840: complex(string) accepts strings with \0 complex_subtype_from_string(): this stopped parsing at the first 0 byte, as if that were the end of the input string. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.42.4.1 retrieving revision 1.42.4.2 diff -C2 -d -r1.42.4.1 -r1.42.4.2 *** test_b1.py 28 Feb 2002 10:14:24 -0000 1.42.4.1 --- test_b1.py 18 Apr 2002 02:19:36 -0000 1.42.4.2 *************** *** 125,138 **** --- 125,151 ---- if complex("1") != 1+0j: raise TestFailed, 'complex("1")' if complex("1j") != 1j: raise TestFailed, 'complex("1j")' + try: complex("1", "1") except TypeError: pass else: raise TestFailed, 'complex("1", "1")' + try: complex(1, "1") except TypeError: pass else: raise TestFailed, 'complex(1, "1")' + if complex(" 3.14+J ") != 3.14+1j: raise TestFailed, 'complex(" 3.14+J )"' if have_unicode: if complex(unicode(" 3.14+J ")) != 3.14+1j: raise TestFailed, 'complex(u" 3.14+J )"' + + # SF bug 543840: complex(string) accepts strings with \0 + # Fixed in 2.3. + try: + complex('1+1j\0j') + except ValueError: + pass + else: + raise TestFailed("complex('1+1j\0j') should have raised ValueError") + class Z: def __complex__(self): return 3.14j From anthonybaxter@sourceforge.net Thu Apr 18 03:19:49 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 19:19:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_dumb.py,1.16,1.16.26.1 bdist_wininst.py,1.27.4.1,1.27.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv5636/Lib/distutils/command Modified Files: Tag: release22-maint bdist_dumb.py bdist_wininst.py Log Message: backport tim_one's patch: SF bug 543840: complex(string) accepts strings with \0 complex_subtype_from_string(): this stopped parsing at the first 0 byte, as if that were the end of the input string. Index: bdist_dumb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_dumb.py,v retrieving revision 1.16 retrieving revision 1.16.26.1 diff -C2 -d -r1.16 -r1.16.26.1 *** bdist_dumb.py 30 Sep 2000 18:27:54 -0000 1.16 --- bdist_dumb.py 18 Apr 2002 02:19:46 -0000 1.16.26.1 *************** *** 82,85 **** --- 82,86 ---- # And make an archive relative to the root of the # pseudo-installation tree. + install.warn_dir = 0 archive_basename = "%s.%s" % (self.distribution.get_fullname(), self.plat_name) Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.27.4.1 retrieving revision 1.27.4.2 diff -C2 -d -r1.27.4.1 -r1.27.4.2 *** bdist_wininst.py 25 Mar 2002 13:14:23 -0000 1.27.4.1 --- bdist_wininst.py 18 Apr 2002 02:19:46 -0000 1.27.4.2 *************** *** 99,102 **** --- 99,103 ---- setattr(install, 'install_' + key, + install.warn_dir = 0 value) From Anthony Baxter Thu Apr 18 03:25:38 2002 From: Anthony Baxter (Anthony Baxter) Date: Thu, 18 Apr 2002 12:25:38 +1000 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_dumb.py,1.16,1.16.26.1 bdist_wininst.py,1.27.4.1,1.27.4.2 In-Reply-To: Message from anthonybaxter@sourceforge.net of "Wed, 17 Apr 2002 19:19:49 MST." Message-ID: <200204180225.g3I2Pci07237@localhost.localdomain> >>> anthonybaxter@sourceforge.net wrote > Update of /cvsroot/python/python/dist/src/Lib/distutils/command > In directory usw-pr-cvs1:/tmp/cvs-serv5636/Lib/distutils/command > > Modified Files: > Tag: release22-maint > bdist_dumb.py bdist_wininst.py > Log Message: > backport tim_one's patch: > > SF bug 543840: complex(string) accepts strings with \0 > complex_subtype_from_string(): this stopped parsing at the first 0 > byte, as if that were the end of the input string. > Sigh. Sorry about the bogus commit message - creating a new backport-a-riffic tool, and missed one earlier messed up message. The real message is: backport theller's patch Set the warn_dir option to 0 before running the install command. This suppresses bogus warnings about modules installed into a directory not in sys.path. Bugfix candidate I'll try to remember the cvs options to fix the commit message now... Anthony From anthonybaxter@sourceforge.net Thu Apr 18 03:30:41 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 19:30:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_wininst.py,1.27.4.2,1.27.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv8709 Modified Files: Tag: release22-maint bdist_wininst.py Log Message: corrected backport. 'patch' made me sad, it got it horribly wrong (no idea why, or how) backport theller's patch Set the warn_dir option to 0 before running the install command. This suppresses bogus warnings about modules installed into a directory not in sys.path. Bugfix candidate. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.27.4.2 retrieving revision 1.27.4.3 diff -C2 -d -r1.27.4.2 -r1.27.4.3 *** bdist_wininst.py 18 Apr 2002 02:19:46 -0000 1.27.4.2 --- bdist_wininst.py 18 Apr 2002 02:30:39 -0000 1.27.4.3 *************** *** 85,88 **** --- 85,89 ---- install = self.reinitialize_command('install') install.root = self.bdist_dir + install.warn_dir = 0 install_lib = self.reinitialize_command('install_lib') *************** *** 99,103 **** setattr(install, 'install_' + key, - install.warn_dir = 0 value) --- 100,103 ---- From anthonybaxter@sourceforge.net Thu Apr 18 03:32:27 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 19:32:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_dumb.py,1.16.26.1,1.16.26.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv9662 Modified Files: Tag: release22-maint bdist_dumb.py Log Message: corrected backport. 'patch' made me sad, it got it horribly wrong (no idea why, or how) backport theller's patch Set the warn_dir option to 0 before running the install command. This suppresses bogus warnings about modules installed into a directory not in sys.path. Bugfix candidate. Index: bdist_dumb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_dumb.py,v retrieving revision 1.16.26.1 retrieving revision 1.16.26.2 diff -C2 -d -r1.16.26.1 -r1.16.26.2 *** bdist_dumb.py 18 Apr 2002 02:19:46 -0000 1.16.26.1 --- bdist_dumb.py 18 Apr 2002 02:32:25 -0000 1.16.26.2 *************** *** 76,79 **** --- 76,80 ---- install = self.reinitialize_command('install', reinit_subcommands=1) install.root = self.bdist_dir + install.warn_dir = 0 self.announce("installing to %s" % self.bdist_dir) *************** *** 82,86 **** # And make an archive relative to the root of the # pseudo-installation tree. - install.warn_dir = 0 archive_basename = "%s.%s" % (self.distribution.get_fullname(), self.plat_name) --- 83,86 ---- From barry@zope.com Thu Apr 18 04:38:02 2002 From: barry@zope.com (Barry A. Warsaw) Date: Wed, 17 Apr 2002 23:38:02 -0400 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_dumb.py,1.16,1.16.26.1 bdist_wininst.py,1.27.4.1,1.27.4.2 References: <200204180225.g3I2Pci07237@localhost.localdomain> Message-ID: <15550.16282.139092.309405@anthem.wooz.org> >>>>> "AB" == Anthony Baxter writes: AB> Set the warn_dir option to 0 before running the install AB> command. This suppresses bogus warnings about modules AB> installed into a directory not in sys.path. Ah cool, so does this mean I can remove the PYTHONPATH=... prefix from this make command now? :) -------------------- snip snip -------------------- SETUPCMD= setup.py --quiet install --install-lib ... install-packages: for p in $(PACKAGES); \ do \ gunzip -c $$p.tar.gz | tar xf -; \ (cd $$p ; PYTHONPATH=$(PYTHONLIBDIR) $(PYTHON) $(SETUPCMD) $(PYTHONLIBDIR)); \ done -------------------- snip snip -------------------- -Barry From anthonybaxter@sourceforge.net Thu Apr 18 04:47:42 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 20:47:42 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts md5sum.py,1.1,1.1.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv28406/Tools/scripts Modified Files: Tag: release22-maint md5sum.py Log Message: backport akuchling's patch: Use 2.1's .hexdigest() method Index: md5sum.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/md5sum.py,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -C2 -d -r1.1 -r1.1.18.1 *** md5sum.py 22 Jun 2001 16:05:48 -0000 1.1 --- md5sum.py 18 Apr 2002 03:47:40 -0000 1.1.18.1 *************** *** 3,7 **** """Python utility to print MD5 checksums of argument files. ! Works with Python 1.5.2 and later. """ --- 3,7 ---- """Python utility to print MD5 checksums of argument files. ! Works with Python 2.1 and later. """ *************** *** 10,16 **** BLOCKSIZE = 1024*1024 - def hexify(s): - return ("%02x"*len(s)) % tuple(map(ord, s)) - def main(): args = sys.argv[1:] --- 10,13 ---- *************** *** 27,31 **** sum.update(block) f.close() ! print hexify(sum.digest()), file if __name__ == "__main__": --- 24,28 ---- sum.update(block) f.close() ! print sum.hexdigest(), file if __name__ == "__main__": From tim_one@sourceforge.net Thu Apr 18 05:12:30 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Wed, 17 Apr 2002 21:12:30 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.143,2.144 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv653/python/Objects Modified Files: typeobject.c Log Message: type_get_doc(): Squash compiler wng about incompatible ptr types. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.143 retrieving revision 2.144 diff -C2 -d -r2.143 -r2.144 *** typeobject.c 18 Apr 2002 00:22:00 -0000 2.143 --- typeobject.c 18 Apr 2002 04:12:28 -0000 2.144 *************** *** 91,95 **** } else if (result->ob_type->tp_descr_get) { ! result = result->ob_type->tp_descr_get(result, NULL, type); } else { --- 91,96 ---- } else if (result->ob_type->tp_descr_get) { ! result = result->ob_type->tp_descr_get(result, NULL, ! (PyObject *)type); } else { From tim_one@sourceforge.net Thu Apr 18 05:30:20 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Wed, 17 Apr 2002 21:30:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3370/python/Lib/test Modified Files: test_mmap.py Log Message: SF bug 544733: Cygwin test_mmap fix for Python 2.2.1 Close a file before trying to unlink it, and apparently Cygwin needs writes to an mmap'ed file to get flushed before they're visible. Bugfix candidate, but I think only for the 2.2 line (it's testing features that I think were new in 2.2). Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_mmap.py 8 Mar 2002 05:43:32 -0000 1.20 --- test_mmap.py 18 Apr 2002 04:30:18 -0000 1.21 *************** *** 239,242 **** --- 239,243 ---- else: verify(0, "Incompatible parameters should raise ValueError.") + f.close() finally: try: *************** *** 253,256 **** --- 254,258 ---- n = len(data) f.write(data) + f.flush() m = mmap.mmap(f.fileno(), n) f.close() From anthonybaxter@sourceforge.net Thu Apr 18 05:40:08 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 21:40:08 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.93.6.3,2.93.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5621/Objects Modified Files: Tag: release22-maint abstract.c Log Message: backport gvanrossum's patch: SF bug 544647. PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it existed, even if nb_inplace_multiply also existed and the arguments weren't right for sq_inplace_repeat. Change this to only use sq_inplace_repeat if nb_inplace_multiply isn't defined. Bugfix candidate. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.93.6.3 retrieving revision 2.93.6.4 diff -C2 -d -r2.93.6.3 -r2.93.6.4 *** abstract.c 11 Mar 2002 10:12:58 -0000 2.93.6.3 --- abstract.c 18 Apr 2002 04:40:05 -0000 2.93.6.4 *************** *** 741,746 **** { PyObject * (*g)(PyObject *, int) = NULL; ! if (HASINPLACE(v) && v->ob_type->tp_as_sequence && ! (g = v->ob_type->tp_as_sequence->sq_inplace_repeat)) { long n; if (PyInt_Check(w)) { --- 741,750 ---- { PyObject * (*g)(PyObject *, int) = NULL; ! if (HASINPLACE(v) && ! v->ob_type->tp_as_sequence && ! (g = v->ob_type->tp_as_sequence->sq_inplace_repeat) && ! !(v->ob_type->tp_as_number && ! v->ob_type->tp_as_number->nb_inplace_multiply)) ! { long n; if (PyInt_Check(w)) { From anthonybaxter@sourceforge.net Thu Apr 18 05:46:51 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 21:46:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.11,1.113.4.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6820/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: backport gvanrossum's patch: SF bug 544647. PyNumber_InPlaceMultiply insisted on calling sq_inplace_repeat if it existed, even if nb_inplace_multiply also existed and the arguments weren't right for sq_inplace_repeat. Change this to only use sq_inplace_repeat if nb_inplace_multiply isn't defined. Bugfix candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.11 retrieving revision 1.113.4.12 diff -C2 -d -r1.113.4.11 -r1.113.4.12 *** test_descr.py 18 Apr 2002 00:37:10 -0000 1.113.4.11 --- test_descr.py 18 Apr 2002 04:46:49 -0000 1.113.4.12 *************** *** 2863,2866 **** --- 2863,2892 ---- vereq(NewClass().__doc__, 'object=NewClass instance; type=NewClass') + def imulbug(): + # SF bug 544647 + if verbose: print "Testing for __imul__ problems..." + class C(object): + def __imul__(self, other): + return (self, other) + x = C() + y = x + y *= 1.0 + vereq(y, (x, 1.0)) + y = x + y *= 2 + vereq(y, (x, 2)) + y = x + y *= 3L + vereq(y, (x, 3L)) + y = x + y *= 1L<<100 + vereq(y, (x, 1L<<100)) + y = x + y *= None + vereq(y, (x, None)) + y = x + y *= "foo" + vereq(y, (x, "foo")) + def test_main(): class_docstrings() *************** *** 2921,2924 **** --- 2947,2951 ---- pickleslots() docdescriptor() + imulbug() if verbose: print "All OK" From gvanrossum@sourceforge.net Thu Apr 18 05:47:12 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Wed, 17 Apr 2002 21:47:12 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.8,2.126.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6974 Modified Files: Tag: release22-maint typeobject.c Log Message: Darn. Of course the warning that Tim killed on the trunk must also be killed in the branch. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.8 retrieving revision 2.126.4.9 diff -C2 -d -r2.126.4.8 -r2.126.4.9 *** typeobject.c 18 Apr 2002 00:36:17 -0000 2.126.4.8 --- typeobject.c 18 Apr 2002 04:47:10 -0000 2.126.4.9 *************** *** 92,96 **** } else if (result->ob_type->tp_descr_get) { ! result = result->ob_type->tp_descr_get(result, NULL, type); } else { --- 92,97 ---- } else if (result->ob_type->tp_descr_get) { ! result = result->ob_type->tp_descr_get(result, NULL, ! (PyObject *)type); } else { From anthonybaxter@sourceforge.net Thu Apr 18 05:48:16 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 21:48:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_time.py,1.8,1.8.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7190/Lib/test Modified Files: Tag: release22-maint test_time.py Log Message: backport bwarsaw's patch: test_mktime(): Removed. This wasn't really testing anything useful (or platform independent). Closes SF bug #460357. Bug fix candidate. Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.8 retrieving revision 1.8.12.1 diff -C2 -d -r1.8 -r1.8.12.1 *** test_time.py 20 Sep 2001 21:33:42 -0000 1.8 --- test_time.py 18 Apr 2002 04:48:14 -0000 1.8.12.1 *************** *** 42,51 **** self.assertRaises(TypeError, time.asctime, 0) - def test_mktime(self): - self.assertRaises(OverflowError, - time.mktime, (999999, 999999, 999999, 999999, - 999999, 999999, 999999, 999999, - 999999)) - def test_main(): --- 42,45 ---- From anthonybaxter@sourceforge.net Thu Apr 18 05:52:12 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 21:52:12 -0700 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.9,1.9.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8038/Lib Modified Files: Tag: release22-maint warnings.py Log Message: backport tim_one's patch: resetwarnings(): change the docstring to reflect what the code actually does. Note that the description in the Library Reference manual is already accurate. Bugfix candidate. Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.9 retrieving revision 1.9.14.1 diff -C2 -d -r1.9 -r1.9.14.1 *** warnings.py 31 Aug 2001 17:46:35 -0000 1.9 --- warnings.py 18 Apr 2002 04:52:10 -0000 1.9.14.1 *************** *** 131,135 **** def resetwarnings(): ! """Reset the list of warnings filters to its default state.""" filters[:] = [] --- 131,135 ---- def resetwarnings(): ! """Clear the list of warning filters, so that no filters are active.""" filters[:] = [] From anthonybaxter@sourceforge.net Thu Apr 18 05:54:49 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 21:54:49 -0700 Subject: [Python-checkins] python/dist/src/PC w9xpopen.c,1.2.6.1,1.2.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv8349/PC Modified Files: Tag: release21-maint w9xpopen.c Log Message: backport nnorwitz's patch: Fix grammar Index: w9xpopen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/w9xpopen.c,v retrieving revision 1.2.6.1 retrieving revision 1.2.6.2 diff -C2 -d -r1.2.6.1 -r1.2.6.2 *** w9xpopen.c 8 Apr 2002 04:42:09 -0000 1.2.6.1 --- w9xpopen.c 18 Apr 2002 04:54:47 -0000 1.2.6.2 *************** *** 20,26 **** const char *usage = ! "This program is used by Python's os.popen function to\n" "to work around a limitation in Windows 95/98. It is\n" ! "not designed to be used as stand-alone program."; int main(int argc, char *argv[]) --- 20,26 ---- const char *usage = ! "This program is used by Python's os.popen function\n" "to work around a limitation in Windows 95/98. It is\n" ! "not designed to be used as a stand-alone program."; int main(int argc, char *argv[]) From anthonybaxter@sourceforge.net Thu Apr 18 05:59:46 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 21:59:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librandom.tex,1.25,1.25.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9165/Doc/lib Modified Files: Tag: release22-maint librandom.tex Log Message: backport fdrake's patch: BDFL agreed with Tim: rehabilitate randint(). Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.25 retrieving revision 1.25.18.1 diff -C2 -d -r1.25 -r1.25.18.1 *** librandom.tex 21 Apr 2001 05:56:06 -0000 1.25 --- librandom.tex 18 Apr 2002 04:59:44 -0000 1.25.18.1 *************** *** 157,161 **** \begin{funcdesc}{randint}{a, b} - \deprecated{2.0}{Use \function{randrange()} instead.} Return a random integer \var{N} such that \code{\var{a} <= \var{N} <= \var{b}}. --- 157,160 ---- From anthonybaxter@sourceforge.net Thu Apr 18 06:00:47 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:00:47 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.26,1.26.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9462/Lib Modified Files: Tag: release22-maint random.py Log Message: backport nnorwitz's patch: BDFL agreed with Tim: rehabilitate randint(). Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.26 retrieving revision 1.26.6.1 diff -C2 -d -r1.26 -r1.26.6.1 *** random.py 25 Nov 2001 21:12:43 -0000 1.26 --- random.py 18 Apr 2002 05:00:45 -0000 1.26.6.1 *************** *** 316,321 **** def randint(self, a, b): """Return random integer in range [a, b], including both end points. - - (Deprecated; use randrange(a, b+1).) """ --- 316,319 ---- From anthonybaxter@sourceforge.net Thu Apr 18 06:08:31 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:08:31 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.4,1.4.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv11126/Tools/idle Modified Files: Tag: release22-maint IOBinding.py Log Message: backport gvanrossum's patch: Provisional fix for writefile() [SF bug # 541730]. The problem was that an exception can occur in the text.get() call or in the write() call, when the text buffer contains non-ASCII characters. This causes the previous contents of the file to be lost. The provisional fix is to call str(self.text.get(...)) *before* opening the file, so that if the exception occurs, we never open the file. Two orthogonal better solutions have to wait for policy decisions: 1. We could try to encode the data as Latin-1 or as UTF-8; but that would require IDLE to grow a notion of file encoding which requires more thought. 2. We could make backups before overwriting a file. This requires more thought because it needs to be fast and cross-platform and configurable. Original patches were: python/dist/src/Tools/idle/IOBinding.py:1.6 Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.4 retrieving revision 1.4.22.1 diff -C2 -d -r1.4 -r1.4.22.1 *** IOBinding.py 2 Feb 2001 20:07:46 -0000 1.4 --- IOBinding.py 18 Apr 2002 05:08:28 -0000 1.4.22.1 *************** *** 149,155 **** def writefile(self, filename): self.fixlastline() try: f = open(filename, "w") - chars = self.text.get("1.0", "end-1c") f.write(chars) f.close() --- 149,155 ---- def writefile(self, filename): self.fixlastline() + chars = str(self.text.get("1.0", "end-1c")) try: f = open(filename, "w") f.write(chars) f.close() From anthonybaxter@sourceforge.net Thu Apr 18 06:09:08 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:09:08 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.4,1.4.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv11244/Tools/idle Modified Files: Tag: release21-maint IOBinding.py Log Message: backport gvanrossum's patch: Provisional fix for writefile() [SF bug # 541730]. The problem was that an exception can occur in the text.get() call or in the write() call, when the text buffer contains non-ASCII characters. This causes the previous contents of the file to be lost. The provisional fix is to call str(self.text.get(...)) *before* opening the file, so that if the exception occurs, we never open the file. Two orthogonal better solutions have to wait for policy decisions: 1. We could try to encode the data as Latin-1 or as UTF-8; but that would require IDLE to grow a notion of file encoding which requires more thought. 2. We could make backups before overwriting a file. This requires more thought because it needs to be fast and cross-platform and configurable. Original patches were: python/dist/src/Tools/idle/IOBinding.py:1.6 Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** IOBinding.py 2 Feb 2001 20:07:46 -0000 1.4 --- IOBinding.py 18 Apr 2002 05:09:06 -0000 1.4.4.1 *************** *** 149,155 **** def writefile(self, filename): self.fixlastline() try: f = open(filename, "w") - chars = self.text.get("1.0", "end-1c") f.write(chars) f.close() --- 149,155 ---- def writefile(self, filename): self.fixlastline() + chars = str(self.text.get("1.0", "end-1c")) try: f = open(filename, "w") f.write(chars) f.close() From anthonybaxter@sourceforge.net Thu Apr 18 06:11:00 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:11:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.12,1.113.4.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11705/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: backport gvanrossum's patch: SF bug #541883 (Vincent Fiack). A stupid bug in object_set_class(): didn't check for value==NULL before checking its type. Bugfix candidate. Original patches were: python/dist/src/Lib/test/test_descr.py:1.129 Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.12 retrieving revision 1.113.4.13 diff -C2 -d -r1.113.4.12 -r1.113.4.13 *** test_descr.py 18 Apr 2002 04:46:49 -0000 1.113.4.12 --- test_descr.py 18 Apr 2002 05:10:58 -0000 1.113.4.13 *************** *** 2325,2328 **** --- 2325,2334 ---- else: raise TestFailed, "shouldn't allow %r.__class__ = %r" % (x, C) + try: + delattr(x, "__class__") + except TypeError: + pass + else: + raise TestFailed, "shouldn't allow del %r.__class__" % x cant(C(), list) cant(list(), C) From anthonybaxter@sourceforge.net Thu Apr 18 06:11:52 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:11:52 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.9,2.126.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11964/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: backport gvanrossum's patch: SF bug #541883 (Vincent Fiack). A stupid bug in object_set_class(): didn't check for value==NULL before checking its type. Bugfix candidate. Original patches were: python/dist/src/Objects/typeobject.c:2.142 Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.9 retrieving revision 2.126.4.10 diff -C2 -d -r2.126.4.9 -r2.126.4.10 *** typeobject.c 18 Apr 2002 04:47:10 -0000 2.126.4.9 --- typeobject.c 18 Apr 2002 05:11:50 -0000 2.126.4.10 *************** *** 1590,1593 **** --- 1590,1598 ---- PyTypeObject *new, *newbase, *oldbase; + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, + "can't delete __class__ attribute"); + return -1; + } if (!PyType_Check(value)) { PyErr_Format(PyExc_TypeError, From anthonybaxter@sourceforge.net Thu Apr 18 06:13:40 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:13:40 -0700 Subject: [Python-checkins] python/dist/src/Lib SocketServer.py,1.24.2.1,1.24.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12479/Lib Modified Files: Tag: release21-maint SocketServer.py Log Message: backport gvanrossum's patch: SF bug #543318 (Frank J. Tobin). In DatagramRequestHandler.setup(), the wfile initialization should be StringIO.StringIO(), not StringIO.StringIO(slf.packet). Bugfix candidate (all the way back to Python 1.5.2 :-). Original patches were: python/dist/src/Lib/SocketServer.py:1.31 Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.24.2.1 retrieving revision 1.24.2.2 diff -C2 -d -r1.24.2.1 -r1.24.2.2 *** SocketServer.py 11 Jul 2001 12:05:49 -0000 1.24.2.1 --- SocketServer.py 18 Apr 2002 05:13:38 -0000 1.24.2.2 *************** *** 561,565 **** self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) ! self.wfile = StringIO.StringIO(self.packet) def finish(self): --- 561,565 ---- self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) ! self.wfile = StringIO.StringIO() def finish(self): From anthonybaxter@sourceforge.net Thu Apr 18 06:13:43 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:13:43 -0700 Subject: [Python-checkins] python/dist/src/Lib SocketServer.py,1.29,1.29.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12475/Lib Modified Files: Tag: release22-maint SocketServer.py Log Message: backport gvanrossum's patch: SF bug #543318 (Frank J. Tobin). In DatagramRequestHandler.setup(), the wfile initialization should be StringIO.StringIO(), not StringIO.StringIO(slf.packet). Bugfix candidate (all the way back to Python 1.5.2 :-). Original patches were: python/dist/src/Lib/SocketServer.py:1.31 Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.29 retrieving revision 1.29.8.1 diff -C2 -d -r1.29 -r1.29.8.1 *** SocketServer.py 23 Oct 2001 21:42:45 -0000 1.29 --- SocketServer.py 18 Apr 2002 05:13:41 -0000 1.29.8.1 *************** *** 571,575 **** self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) ! self.wfile = StringIO.StringIO(self.packet) def finish(self): --- 571,575 ---- self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) ! self.wfile = StringIO.StringIO() def finish(self): From anthonybaxter@sourceforge.net Thu Apr 18 06:16:40 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:16:40 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.147,2.147.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13183/Objects Modified Files: Tag: release22-maint stringobject.c Log Message: backport gvanrossum's patch: Partially implement SF feature request 444708. Add optional arg to string methods strip(), lstrip(), rstrip(). The optional arg specifies characters to delete. Also for UserString. Still to do: - Misc/NEWS - LaTeX docs (I did the docstrings though) - Unicode methods, and Unicode support in the string methods. Original patches were: python/dist/src/Objects/stringobject.c:2.156 Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147 retrieving revision 2.147.6.1 diff -C2 -d -r2.147 -r2.147.6.1 *** stringobject.c 10 Dec 2001 15:45:54 -0000 2.147 --- stringobject.c 18 Apr 2002 05:16:37 -0000 2.147.6.1 *************** *** 1036,1039 **** --- 1036,1042 ---- #define BOTHSTRIP 2 + /* Arrays indexed by above */ + static const char *stripname[] = {"lstrip", "rstrip", "strip"}; + static PyObject * *************** *** 1411,1414 **** --- 1414,1450 ---- static PyObject * + do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) + { + char *s = PyString_AS_STRING(self); + int len = PyString_GET_SIZE(self); + char *sep = PyString_AS_STRING(sepobj); + int seplen = PyString_GET_SIZE(sepobj); + int i, j; + + i = 0; + if (striptype != RIGHTSTRIP) { + while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { + i++; + } + } + + j = len; + if (striptype != LEFTSTRIP) { + do { + j--; + } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); + j++; + } + + if (i == 0 && j == len && PyString_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyString_FromStringAndSize(s+i, j-i); + } + + + static PyObject * do_strip(PyStringObject *self, int striptype) { *************** *** 1440,1477 **** static char strip__doc__[] = ! "S.strip() -> string\n\ \n\ Return a copy of the string S with leading and trailing\n\ ! whitespace removed."; static PyObject * ! string_strip(PyStringObject *self) { ! return do_strip(self, BOTHSTRIP); } static char lstrip__doc__[] = ! "S.lstrip() -> string\n\ \n\ ! Return a copy of the string S with leading whitespace removed."; static PyObject * ! string_lstrip(PyStringObject *self) { ! return do_strip(self, LEFTSTRIP); } static char rstrip__doc__[] = ! "S.rstrip() -> string\n\ \n\ ! Return a copy of the string S with trailing whitespace removed."; static PyObject * ! string_rstrip(PyStringObject *self) { ! return do_strip(self, RIGHTSTRIP); } --- 1476,1548 ---- + static PyObject * + do_argstrip(PyStringObject *self, int striptype, PyObject *args) + { + PyObject *sep = NULL; + + if (!PyArg_ParseTuple(args, "|O:[lr]strip", &sep)) + return NULL; + + if (sep != NULL && sep != Py_None) { + /* XXX What about Unicode? */ + if (!PyString_Check(sep)) { + PyErr_Format(PyExc_TypeError, + "%s arg must be None or string", + stripname[striptype]); + return NULL; + } + return do_xstrip(self, striptype, sep); + } + + return do_strip(self, striptype); + } + + static char strip__doc__[] = ! "S.strip([sep]) -> string\n\ \n\ Return a copy of the string S with leading and trailing\n\ ! whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * ! string_strip(PyStringObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, BOTHSTRIP); /* Common case */ ! else ! return do_argstrip(self, BOTHSTRIP, args); } static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string\n\ \n\ ! Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * ! string_lstrip(PyStringObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, LEFTSTRIP); /* Common case */ ! else ! return do_argstrip(self, LEFTSTRIP, args); } static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string\n\ \n\ ! Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * ! string_rstrip(PyStringObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, RIGHTSTRIP); /* Common case */ ! else ! return do_argstrip(self, RIGHTSTRIP, args); } *************** *** 2678,2688 **** {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, ! {"lstrip", (PyCFunction)string_lstrip, METH_NOARGS, lstrip__doc__}, {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, ! {"rstrip", (PyCFunction)string_rstrip, METH_NOARGS, rstrip__doc__}, {"startswith", (PyCFunction)string_startswith, METH_VARARGS, startswith__doc__}, ! {"strip", (PyCFunction)string_strip, METH_NOARGS, strip__doc__}, {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction)string_translate, METH_VARARGS, translate__doc__}, --- 2749,2759 ---- {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, ! {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, ! {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, {"startswith", (PyCFunction)string_startswith, METH_VARARGS, startswith__doc__}, ! {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction)string_translate, METH_VARARGS, translate__doc__}, From anthonybaxter@sourceforge.net Thu Apr 18 06:17:55 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:17:55 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.10,1.10.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13404/Lib Modified Files: Tag: release22-maint UserString.py Log Message: backport gvanrossum's patch: Partially implement SF feature request 444708. Add optional arg to string methods strip(), lstrip(), rstrip(). The optional arg specifies characters to delete. Also for UserString. Still to do: - Misc/NEWS - LaTeX docs (I did the docstrings though) - Unicode methods, and Unicode support in the string methods. Original patches were: python/dist/src/Lib/UserString.py:1.11 Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.10 retrieving revision 1.10.18.1 diff -C2 -d -r1.10 -r1.10.18.1 *** UserString.py 15 May 2001 11:58:05 -0000 1.10 --- UserString.py 18 Apr 2002 05:17:53 -0000 1.10.18.1 *************** *** 109,113 **** def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self): return self.__class__(self.data.lstrip()) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) --- 109,113 ---- def ljust(self, width): return self.__class__(self.data.ljust(width)) def lower(self): return self.__class__(self.data.lower()) ! def lstrip(self, sep=None): return self.__class__(self.data.lstrip(sep)) def replace(self, old, new, maxsplit=-1): return self.__class__(self.data.replace(old, new, maxsplit)) *************** *** 117,121 **** return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self): return self.__class__(self.data.rstrip()) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) --- 117,121 ---- return self.data.rindex(sub, start, end) def rjust(self, width): return self.__class__(self.data.rjust(width)) ! def rstrip(self, sep=None): return self.__class__(self.data.rstrip(sep)) def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) *************** *** 123,127 **** def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self): return self.__class__(self.data.strip()) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) --- 123,127 ---- def startswith(self, prefix, start=0, end=sys.maxint): return self.data.startswith(prefix, start, end) ! def strip(self, sep=None): return self.__class__(self.data.strip(sep)) def swapcase(self): return self.__class__(self.data.swapcase()) def title(self): return self.__class__(self.data.title()) From anthonybaxter@sourceforge.net Thu Apr 18 06:18:58 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:18:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.10,1.10.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13642/Lib/test Modified Files: Tag: release22-maint string_tests.py Log Message: backport gvanrossum's patch: Partially implement SF feature request 444708. Add optional arg to string methods strip(), lstrip(), rstrip(). The optional arg specifies characters to delete. Also for UserString. Still to do: - Misc/NEWS - LaTeX docs (I did the docstrings though) - Unicode methods, and Unicode support in the string methods. Original patches were: python/dist/src/Lib/test/string_tests.py:1.12 Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.10 retrieving revision 1.10.16.1 diff -C2 -d -r1.10 -r1.10.16.1 *** string_tests.py 17 Aug 2001 18:39:24 -0000 1.10 --- string_tests.py 18 Apr 2002 05:18:56 -0000 1.10.16.1 *************** *** 164,167 **** --- 164,179 ---- test('strip', 'hello', 'hello') + # strip/lstrip/rstrip with None arg + test('strip', ' hello ', 'hello', None) + test('lstrip', ' hello ', 'hello ', None) + test('rstrip', ' hello ', ' hello', None) + test('strip', 'hello', 'hello', None) + + # strip/lstrip/rstrip with real arg + test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz') + test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz') + test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz') + test('strip', 'hello', 'hello', 'xyz') + test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') test('translate', 'xyzabcdef', 'xyzxyz', transtable, 'def') From anthonybaxter@sourceforge.net Thu Apr 18 06:21:21 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:21:21 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.22,1.337.2.4.2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv14078/Misc Modified Files: Tag: release22-maint NEWS Log Message: News for new strip method argument. Made the news message a bit more informative. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.22 retrieving revision 1.337.2.4.2.23 diff -C2 -d -r1.337.2.4.2.22 -r1.337.2.4.2.23 *** NEWS 17 Apr 2002 04:36:35 -0000 1.337.2.4.2.22 --- NEWS 18 Apr 2002 05:21:16 -0000 1.337.2.4.2.23 *************** *** 9,12 **** --- 9,18 ---- SourceForge as bug 543148. + - String methods lstrip(), rstrip() and strip() now take an optional + argument that specifies the characters to strip. For example, + "Foo!!!?!?!?".rstrip("?!") -> "Foo". In addition, "200L".strip("L") + will return "200". This is useful for replacing code that assumed + longs will always be printed with a trailing "L". + Library From anthonybaxter@sourceforge.net Thu Apr 18 06:22:36 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:22:36 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.3,1.80.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14496/Doc/lib Modified Files: Tag: release22-maint libstdtypes.tex Log Message: backport fdrake's patch: Document the optional argument to the .strip(), .rstrip(), .strip() string methods. Part of SF feature #444708. Original patches were: python/dist/src/Doc/lib/libstdtypes.tex:1.87 Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.3 retrieving revision 1.80.6.4 diff -C2 -d -r1.80.6.3 -r1.80.6.4 *** libstdtypes.tex 17 Mar 2002 15:55:50 -0000 1.80.6.3 --- libstdtypes.tex 18 Apr 2002 05:22:33 -0000 1.80.6.4 *************** *** 599,604 **** \end{methoddesc} ! \begin{methoddesc}[string]{lstrip}{} ! Return a copy of the string with leading whitespace removed. \end{methoddesc} --- 599,608 ---- \end{methoddesc} ! \begin{methoddesc}[string]{lstrip}{\optional{chars}} ! Return a copy of the string with leading characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the beginning of ! the string this method is called on. \end{methoddesc} *************** *** 628,633 **** \end{methoddesc} ! \begin{methoddesc}[string]{rstrip}{} ! Return a copy of the string with trailing whitespace removed. \end{methoddesc} --- 632,641 ---- \end{methoddesc} ! \begin{methoddesc}[string]{rstrip}{\optional{chars}} ! Return a copy of the string with trailing characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the end of the ! string this method is called on. \end{methoddesc} *************** *** 645,649 **** \end{methoddesc} ! \begin{methoddesc}[string]{startswith}{prefix\optional{, start\optional{, end}}} Return true if string starts with the \var{prefix}, otherwise return false. With optional \var{start}, test string beginning at --- 653,658 ---- \end{methoddesc} ! \begin{methoddesc}[string]{startswith}{prefix\optional{, ! start\optional{, end}}} Return true if string starts with the \var{prefix}, otherwise return false. With optional \var{start}, test string beginning at *************** *** 652,658 **** \end{methoddesc} ! \begin{methoddesc}[string]{strip}{} ! Return a copy of the string with leading and trailing whitespace ! removed. \end{methoddesc} --- 661,670 ---- \end{methoddesc} ! \begin{methoddesc}[string]{strip}{\optional{chars}} ! Return a copy of the string with leading and trailing characters ! removed. If \var{chars} is omitted or \code{None}, whitespace ! characters are removed. If given and not \code{None}, \var{chars} ! must be a string; the characters in the string will be stripped from ! the both ends of the string this method is called on. \end{methoddesc} From anthonybaxter@sourceforge.net Thu Apr 18 06:37:53 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:37:53 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.53.4.3,2.53.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17786/Objects Modified Files: Tag: release22-maint complexobject.c Log Message: backport gvanrossum's patch: SF bug #543387. Complex numbers implement divmod() and //, neither of which makes one lick of sense. Unfortunately this is documented, so I'm adding a deprecation warning now, so we can delete this silliness, oh, around 2005 or so. Bugfix candidate (At least for 2.2.2, I think.) Original patches were: python/dist/src/Objects/complexobject.c:2.58 Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.53.4.3 retrieving revision 2.53.4.4 diff -C2 -d -r2.53.4.3 -r2.53.4.4 *** complexobject.c 18 Apr 2002 02:19:36 -0000 2.53.4.3 --- complexobject.c 18 Apr 2002 05:37:51 -0000 2.53.4.4 *************** *** 419,422 **** --- 419,427 ---- Py_complex div, mod; PyObject *d, *m, *z; + + if (PyErr_Warn(PyExc_DeprecationWarning, + "complex divmod() and // are deprecated") < 0) + return NULL; + errno = 0; div = c_quot(v->cval,w->cval); /* The raw divisor value. */ From anthonybaxter@sourceforge.net Thu Apr 18 06:38:55 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:38:55 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.23,1.337.2.4.2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18021/Misc Modified Files: Tag: release22-maint NEWS Log Message: backport gvanrossum's patch: Add news about deprecated complex ops. Original patches were: python/dist/src/Misc/NEWS:1.387 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.23 retrieving revision 1.337.2.4.2.24 diff -C2 -d -r1.337.2.4.2.23 -r1.337.2.4.2.24 *** NEWS 18 Apr 2002 05:21:16 -0000 1.337.2.4.2.23 --- NEWS 18 Apr 2002 05:38:53 -0000 1.337.2.4.2.24 *************** *** 9,12 **** --- 9,16 ---- SourceForge as bug 543148. + - Complex numbers supported divmod() and the // and % operators, but + these make no sense. Since this was documented, they're being + deprecated now. + - String methods lstrip(), rstrip() and strip() now take an optional argument that specifies the characters to strip. For example, From anthonybaxter@sourceforge.net Thu Apr 18 06:39:57 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Wed, 17 Apr 2002 22:39:57 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.53.4.4,2.53.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18227/Objects Modified Files: Tag: release22-maint complexobject.c Log Message: backport gvanrossum's patch: Deprecate % as well. The message for deprecation of //, % and divmod is the same in all three cases (mostly because // calls divmod :-). Original patches were: python/dist/src/Objects/complexobject.c:2.59 Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.53.4.4 retrieving revision 2.53.4.5 diff -C2 -d -r2.53.4.4 -r2.53.4.5 *** complexobject.c 18 Apr 2002 05:37:51 -0000 2.53.4.4 --- complexobject.c 18 Apr 2002 05:39:54 -0000 2.53.4.5 *************** *** 400,403 **** --- 400,408 ---- { Py_complex div, mod; + + if (PyErr_Warn(PyExc_DeprecationWarning, + "complex divmod(), // and % are deprecated") < 0) + return NULL; + errno = 0; div = c_quot(v->cval,w->cval); /* The raw divisor value. */ *************** *** 421,425 **** if (PyErr_Warn(PyExc_DeprecationWarning, ! "complex divmod() and // are deprecated") < 0) return NULL; --- 426,430 ---- if (PyErr_Warn(PyExc_DeprecationWarning, ! "complex divmod(), // and % are deprecated") < 0) return NULL; From loewis@sourceforge.net Thu Apr 18 15:51:39 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Thu, 18 Apr 2002 07:51:39 -0700 Subject: [Python-checkins] python/dist/src configure,1.301,1.302 configure.in,1.311,1.312 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19924 Modified Files: configure configure.in Log Message: Test for --export-dynamic directly to avoid problems with binutils 2.12. Will backport to 2.1 and 2.2. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.301 retrieving revision 1.302 diff -C2 -d -r1.301 -r1.302 *** configure 16 Apr 2002 05:51:01 -0000 1.301 --- configure 18 Apr 2002 14:51:33 -0000 1.302 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.310 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.311 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 8850,8854 **** SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" --- 8850,8854 ---- SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.311 retrieving revision 1.312 diff -C2 -d -r1.311 -r1.312 *** configure.in 16 Apr 2002 05:51:02 -0000 1.311 --- configure.in 18 Apr 2002 14:51:36 -0000 1.312 *************** *** 985,989 **** SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" --- 985,989 ---- SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" From jhylton@sourceforge.net Thu Apr 18 17:02:54 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Thu, 18 Apr 2002 09:02:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/compiler visitor.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory usw-pr-cvs1:/tmp/cvs-serv27384 Modified Files: visitor.py Log Message: Remove out-of-date explanation in doc strings, as reported by Eric C. Newton. Index: visitor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/visitor.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** visitor.py 18 Oct 2001 21:57:37 -0000 1.9 --- visitor.py 18 Apr 2002 16:02:48 -0000 1.10 *************** *** 27,33 **** the walk has occurred.) The ASTVisitor modifies the visitor argument by adding a visit method to the visitor; this method can ! be used to visit a particular child node. If the visitor method ! returns a true value, the ASTVisitor will not traverse the child ! nodes. XXX The interface for controlling the preorder walk needs to be --- 27,31 ---- the walk has occurred.) The ASTVisitor modifies the visitor argument by adding a visit method to the visitor; this method can ! be used to visit a particular child node. XXX The interface for controlling the preorder walk needs to be From loewis@sourceforge.net Thu Apr 18 15:55:57 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Thu, 18 Apr 2002 07:55:57 -0700 Subject: [Python-checkins] python/dist/src configure,1.207.2.7,1.207.2.8 configure.in,1.215.2.7,1.215.2.8 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv23314 Modified Files: Tag: release21-maint configure configure.in Log Message: Test for --export-dynamic directly to avoid problems with binutils 2.12. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.207.2.7 retrieving revision 1.207.2.8 diff -C2 -d -r1.207.2.7 -r1.207.2.8 *** configure 27 Dec 2001 21:55:46 -0000 1.207.2.7 --- configure 18 Apr 2002 14:55:48 -0000 1.207.2.8 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.215.2.6 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.215.2.7 # Guess values for system-dependent variables and create Makefiles. *************** *** 3050,3054 **** SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" --- 3050,3054 ---- SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.215.2.7 retrieving revision 1.215.2.8 diff -C2 -d -r1.215.2.7 -r1.215.2.8 *** configure.in 27 Dec 2001 21:55:46 -0000 1.215.2.7 --- configure.in 18 Apr 2002 14:55:52 -0000 1.215.2.8 *************** *** 704,708 **** SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" --- 704,708 ---- SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" From loewis@sourceforge.net Thu Apr 18 15:55:12 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Thu, 18 Apr 2002 07:55:12 -0700 Subject: [Python-checkins] python/dist/src configure,1.279.6.4,1.279.6.5 configure.in,1.288.6.4,1.288.6.5 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv22577 Modified Files: Tag: release22-maint configure configure.in Log Message: Test for --export-dynamic directly to avoid problems with binutils 2.12. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279.6.4 retrieving revision 1.279.6.5 diff -C2 -d -r1.279.6.4 -r1.279.6.5 *** configure 22 Mar 2002 11:22:24 -0000 1.279.6.4 --- configure 18 Apr 2002 14:55:05 -0000 1.279.6.5 *************** *** 3278,3282 **** SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" --- 3278,3282 ---- SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.288.6.4 retrieving revision 1.288.6.5 diff -C2 -d -r1.288.6.4 -r1.288.6.5 *** configure.in 11 Mar 2002 10:14:23 -0000 1.288.6.4 --- configure.in 18 Apr 2002 14:55:08 -0000 1.288.6.5 *************** *** 890,894 **** SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" --- 890,894 ---- SunOS/5*) case $CC in *gcc*) ! if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then LINKFORSHARED="-Xlinker --export-dynamic" From akuchling@sourceforge.net Thu Apr 18 17:27:09 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Thu, 18 Apr 2002 09:27:09 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.31,1.32 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv3243 Modified Files: pep-0001.txt Log Message: Clarify significance of informational PEPs Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** pep-0001.txt 5 Apr 2002 19:42:56 -0000 1.31 --- pep-0001.txt 18 Apr 2002 16:27:07 -0000 1.32 *************** *** 36,40 **** describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new ! feature. --- 36,42 ---- describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new ! feature. Informational PEPs do not represent a Python community ! consensus or recommendation, so users and implementors are free to ! ignore informational PEPs or follow their advice. From jhylton@sourceforge.net Thu Apr 18 17:26:43 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Thu, 18 Apr 2002 09:26:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/compiler visitor.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory usw-pr-cvs1:/tmp/cvs-serv3214 Modified Files: visitor.py Log Message: Remove more out-of-date comments and clarify explanation of visit(). Index: visitor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/visitor.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** visitor.py 18 Apr 2002 16:02:48 -0000 1.10 --- visitor.py 18 Apr 2002 16:26:40 -0000 1.11 *************** *** 27,37 **** the walk has occurred.) The ASTVisitor modifies the visitor argument by adding a visit method to the visitor; this method can ! be used to visit a particular child node. ! ! XXX The interface for controlling the preorder walk needs to be ! re-considered. The current interface is convenient for visitors ! that mostly let the ASTVisitor do everything. For something like ! a code generator, where you want to walk to occur in a specific ! order, it's a pain to add "return 1" to the end of each method. """ --- 27,31 ---- the walk has occurred.) The ASTVisitor modifies the visitor argument by adding a visit method to the visitor; this method can ! be used to visit a child node of arbitrary type. """ From bckfnn@sourceforge.net Thu Apr 18 19:48:01 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Thu, 18 Apr 2002 11:48:01 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv18664 Modified Files: python.asdl Log Message: Make global parameter plural. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** python.asdl 18 Apr 2002 18:04:28 -0000 1.14 --- python.asdl 18 Apr 2002 18:47:58 -0000 1.15 *************** *** 36,40 **** | Exec(expr body, expr? locals, expr? globals) ! | Global(identifier* name) | Expr(expr value) | Pass | Break | Continue --- 36,40 ---- | Exec(expr body, expr? locals, expr? globals) ! | Global(identifier* names) | Expr(expr value) | Pass | Break | Continue From bckfnn@sourceforge.net Thu Apr 18 19:49:35 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Thu, 18 Apr 2002 11:49:35 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv19625 Modified Files: python.asdl Log Message: Added AugStore to expr_context list. Must be used for the AugAssign target expr. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** python.asdl 18 Apr 2002 18:47:58 -0000 1.15 --- python.asdl 18 Apr 2002 18:49:33 -0000 1.16 *************** *** 64,68 **** | Tuple(expr *elts, expr_context ctx) ! expr_context = Load | Store | Del slice = Ellipsis | Slice(expr? lower, expr? upper) --- 64,68 ---- | Tuple(expr *elts, expr_context ctx) ! expr_context = Load | Store | Del | AugStore slice = Ellipsis | Slice(expr? lower, expr? upper) From bckfnn@sourceforge.net Thu Apr 18 19:55:41 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Thu, 18 Apr 2002 11:55:41 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv22589 Modified Files: python.asdl Log Message: Added some toplevel productions. Names are taken from the compiler package. The 'Suite' production is an experiment that so far have been very useful for Jython, I'm not yet sure that it should stay. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** python.asdl 18 Apr 2002 18:49:33 -0000 1.16 --- python.asdl 18 Apr 2002 18:55:38 -0000 1.17 *************** *** 4,7 **** --- 4,12 ---- { mod = Module(stmt* body) + | Interactive(stmt body) + | Expression(expr body) + + -- not really an actual node but usefull in Jython's typesystem. + | Suite(stmt* body) stmt = FunctionDef(identifier name, arguments args, stmt* body) From akuchling@sourceforge.net Thu Apr 18 20:19:38 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Thu, 18 Apr 2002 12:19:38 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.32,1.33 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1802 Modified Files: pep-0001.txt Log Message: Change "not" -> "not necessarily" as Jeremy suggested Fix typo Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pep-0001.txt 18 Apr 2002 16:27:07 -0000 1.32 --- pep-0001.txt 18 Apr 2002 19:19:35 -0000 1.33 *************** *** 36,42 **** describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new ! feature. Informational PEPs do not represent a Python community ! consensus or recommendation, so users and implementors are free to ! ignore informational PEPs or follow their advice. --- 36,42 ---- describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new ! feature. Informational PEPs do not necessarily represent a Python ! community consensus or recommendation, so users and implementors ! are free to ignore informational PEPs or follow their advice. *************** *** 50,54 **** idea. The more focussed the PEP, the more successfully it tends to be. The PEP editor reserves the right to reject PEP proposals ! if they appear to unfocussed or too broad. If in doubt, split your PEP into several well-focussed ones. --- 50,54 ---- idea. The more focussed the PEP, the more successfully it tends to be. The PEP editor reserves the right to reject PEP proposals ! if they appear too unfocussed or too broad. If in doubt, split your PEP into several well-focussed ones. From bckfnn@sourceforge.net Thu Apr 18 19:57:32 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Thu, 18 Apr 2002 11:57:32 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_java.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv24279 Modified Files: asdl_java.py Log Message: Added names instead of number for enums in toString(). Creates Visitor base classes. Index: asdl_java.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_java.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** asdl_java.py 16 Apr 2002 03:18:54 -0000 1.2 --- asdl_java.py 18 Apr 2002 18:57:30 -0000 1.3 *************** *** 52,57 **** --- 52,59 ---- def open(self, name): self.file = open("%s.java" % name, "wb") + print >> self.file, "// Autogenerated AST node" print >> self.file, 'package org.python.p2.ast;' print >> self.file, 'import org.python.p2.SimpleNode;' + print >> self.file def close(self): *************** *** 128,131 **** --- 130,140 ---- self.emit("public static final int %s = %d;" % (type.name, i+1), depth + 1) + self.emit("", 0) + self.emit("public static final String[] %sTypeNames = new String[] {" % + name, depth+1); + self.emit('"",', depth+2); + for type in sum.types: + self.emit('"%s",' % type.name, depth+2) + self.emit("};", depth+1) self.emit("}", depth) self.close() *************** *** 174,197 **** def javaMethods(self, clsname, ctorname, fields, depth): ! # The java ctor ! self.emit("public %s(%s) {" % (ctorname, ! ", ".join([self.fieldDef(f) for f in fields])), depth) ! for f in fields: ! self.emit("this.%s = %s;" % (f.name, f.name), depth+1) ! self.emit("}", depth) ! # The toString() method ! self.emit("public String toString() {", depth) ! self.emit('StringBuffer sb = new StringBuffer("%s[");' % clsname, ! depth+1) ! for f in fields: ! self.emit('sb.append("%s=");' % f.name, depth+1); self.emit("sb.append(dumpThis(this.%s));" % f.name, depth+1) ! if f != fields[-1]: ! self.emit('sb.append(", ");', depth+1) ! self.emit('sb.append("]");', depth+1) ! self.emit("return sb.toString();", depth+1) self.emit("}", depth) def visitField(self, field, depth): --- 183,237 ---- def javaMethods(self, clsname, ctorname, fields, depth): ! # The java ctor ! self.emit("public %s(%s) {" % (ctorname, ! ", ".join([self.fieldDef(f) for f in fields])), depth) ! for f in fields: ! self.emit("this.%s = %s;" % (f.name, f.name), depth+1) ! self.emit("}", depth) ! self.emit("", 0); ! # The toString() method ! self.emit("public String toString() {", depth) ! self.emit('StringBuffer sb = new StringBuffer("%s[");' % clsname, ! depth+1) ! for f in fields: ! self.emit('sb.append("%s=");' % f.name, depth+1); ! if not self.bltinnames.has_key(str(f.type)) and f.typedef.simple: ! self.emit("sb.append(dumpThis(this.%s, %sType.%sTypeNames));" % ! (f.name, f.type, f.type), depth+1); ! else: self.emit("sb.append(dumpThis(this.%s));" % f.name, depth+1) ! if f != fields[-1]: ! self.emit('sb.append(", ");', depth+1) ! self.emit('sb.append("]");', depth+1) ! self.emit("return sb.toString();", depth+1) ! self.emit("}", depth) ! self.emit("", 0); ! ! if clsname == ctorname: ! # The accept() method ! self.emit("public Object accept(Visitor visitor) throws Exception {", depth) ! self.emit('return visitor.visit%s(this);' % clsname, depth+1) self.emit("}", depth) + self.emit("", 0); + # The visitChildren() method + self.emit("public void traverse(Visitor visitor) throws Exception {", depth) + for f in fields: + if self.bltinnames.has_key(str(f.type)): + continue + if f.typedef.simple: + continue + if f.seq: + self.emit('for (int i = 0; i < %s.length; i++) {' % f.name, + depth+1); + self.emit('if (%s[i] != null)' % f.name, depth+2) + self.emit('%s[i].accept(visitor);' % f.name, depth+3) + self.emit('}', depth+1) + else: + self.emit('if (%s != null)' % f.name, depth+1) + self.emit('%s.accept(visitor);' % f.name, depth+2) + self.emit('}', depth) + self.emit("", 0); def visitField(self, field, depth): *************** *** 215,218 **** --- 255,306 ---- + class VisitorVisitor(EmitVisitor): + def __init__(self): + EmitVisitor.__init__(self) + self.ctors = [] + + + def visitModule(self, mod): + for dfn in mod.dfns: + self.visit(dfn) + self.open("Visitor") + self.emit('public interface Visitor {', 0) + for ctor in self.ctors: + self.emit("public Object visit%s(%s node) throws Exception;" % + (ctor, ctor), 1) + self.emit('}', 0) + self.close() + + self.open("VisitorBase") + self.emit('public abstract class VisitorBase implements Visitor {', 0) + for ctor in self.ctors: + self.emit("public Object visit%s(%s node) throws Exception {" % + (ctor, ctor), 1) + self.emit("Object ret = unhandled_node(node);", 2) + self.emit("traverse(node);", 2) + self.emit("return ret;", 2) + self.emit('}', 1) + self.emit('', 0) + + self.emit("abstract protected Object unhandled_node(SimpleNode node) throws Exception;", 1); + self.emit("abstract public void traverse(SimpleNode node) throws Exception;", 1); + self.emit('}', 0) + self.close() + + def visitType(self, type, depth=1): + self.visit(type.value, type.name, depth) + + def visitSum(self, sum, name, depth): + if not sum.simple: + for t in sum.types: + self.visit(t, name, depth) + + def visitProduct(self, product, name, depth): + pass + + def visitConstructor(self, cons, name, depth): + self.ctors.append(cons.name) + + class ChainOfVisitors: *************** *** 231,234 **** sys.exit(1) c = ChainOfVisitors(AnalyzeVisitor(), ! JavaVisitor()) c.visit(mod) --- 319,323 ---- sys.exit(1) c = ChainOfVisitors(AnalyzeVisitor(), ! JavaVisitor(), ! VisitorVisitor()) c.visit(mod) From akuchling@sourceforge.net Thu Apr 18 21:08:20 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Thu, 18 Apr 2002 13:08:20 -0700 Subject: [Python-checkins] python/nondist/peps pep-0251.txt,1.10,1.11 pep-0010.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19633 Modified Files: pep-0251.txt pep-0010.txt Log Message: Update two links to amk.ca Index: pep-0251.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0251.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0251.txt 24 Dec 2001 20:58:36 -0000 1.10 --- pep-0251.txt 18 Apr 2002 20:08:17 -0000 1.11 *************** *** 74,78 **** [3] Andrew Kuchling, What's New in Python 2.2 ! http://www.amk.ca/python/2.2/ --- 74,78 ---- [3] Andrew Kuchling, What's New in Python 2.2 ! http://www.python.org/doc/2.2.1/whatsnew/whatsnew22.html Index: pep-0010.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0010.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0010.txt 7 Mar 2002 19:26:07 -0000 1.2 --- pep-0010.txt 18 Apr 2002 20:08:17 -0000 1.3 *************** *** 55,60 **** References ! [1] Becoming a Python Developer, Andrew Kuchling ! http://www.amk.ca/python/writing/python-dev.html [2] Apache Project Guidelines and Voting Rules --- 55,60 ---- References ! [1] Python Developer's Guide, ! http://www.python.org/dev/ [2] Apache Project Guidelines and Voting Rules From tim_one@sourceforge.net Thu Apr 18 22:37:05 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 18 Apr 2002 14:37:05 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17970/python/Objects Modified Files: obmalloc.c Log Message: Remove some long-disabled debugging boilerplate. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** obmalloc.c 13 Apr 2002 08:29:14 -0000 2.40 --- obmalloc.c 18 Apr 2002 21:37:03 -0000 2.41 *************** *** 417,441 **** static block *arenabase = NULL; - #if 0 - static ulong wasmine = 0; - static ulong wasntmine = 0; - - static void - dumpem(void *ptr) - { - if (ptr) - printf("inserted new arena at %08x\n", ptr); - printf("# arenas %u\n", narenas); - printf("was mine %lu wasn't mine %lu\n", wasmine, wasntmine); - } - #define INCMINE ++wasmine - #define INCTHEIRS ++wasntmine - - #else - #define dumpem(ptr) - #define INCMINE - #define INCTHEIRS - #endif - /* Allocate a new arena and return its base address. If we run out of * memory, return NULL. --- 417,420 ---- *************** *** 528,532 **** arenas[narenas] = (uptr)bp; ++narenas; /* can't overflow, since narenas < maxarenas before */ - dumpem(bp); return bp; --- 507,510 ---- *************** *** 729,733 **** /* We allocated this address. */ LOCK(); - INCMINE; /* * Link p to the start of the pool's freeblock list. Since --- 707,710 ---- *************** *** 790,794 **** /* We didn't allocate this address. */ - INCTHEIRS; free(p); } --- 767,770 ---- *************** *** 813,817 **** if (ADDRESS_IN_RANGE(p, pool->arenaindex)) { /* We're in charge of this block */ - INCMINE; size = INDEX2SIZE(pool->szidx); if (size >= nbytes) --- 789,792 ---- *************** *** 828,832 **** } /* We're not managing this block. */ - INCTHEIRS; if (nbytes <= SMALL_REQUEST_THRESHOLD) { /* Take over this block. */ --- 803,806 ---- From tim_one@sourceforge.net Thu Apr 18 22:58:58 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 18 Apr 2002 14:58:58 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23982/python/Objects Modified Files: obmalloc.c Log Message: PyObject_Malloc: make a tiny bit faster for platforms where malloc(0) doesn't return NULL. PyObject_Realloc: better comment for why we don't call PyObject_Malloc(0). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** obmalloc.c 18 Apr 2002 21:37:03 -0000 2.41 --- obmalloc.c 18 Apr 2002 21:58:56 -0000 2.42 *************** *** 686,690 **** * has been reached. */ ! return (void *)malloc(nbytes ? nbytes : 1); } --- 686,694 ---- * has been reached. */ ! #ifdef MALLOC_ZERO_RETURNS_NULL ! if (nbytes == 0) ! nbytes = 1; ! #endif ! return (void *)malloc(nbytes); } *************** *** 804,808 **** /* We're not managing this block. */ if (nbytes <= SMALL_REQUEST_THRESHOLD) { ! /* Take over this block. */ bp = PyObject_Malloc(nbytes ? nbytes : 1); if (bp != NULL) { --- 808,815 ---- /* We're not managing this block. */ if (nbytes <= SMALL_REQUEST_THRESHOLD) { ! /* Take over this block -- ask for at least one byte so ! * we really do take it over (PyObject_Malloc(0) goes to ! * the system malloc). ! */ bp = PyObject_Malloc(nbytes ? nbytes : 1); if (bp != NULL) { From tim_one@sourceforge.net Thu Apr 18 23:25:05 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Thu, 18 Apr 2002 15:25:05 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31559/python/Objects Modified Files: obmalloc.c Log Message: _PyObject_DebugMallocStats(): Added some potentially expensive internal consistency checks, enabled only in a debug (Py_DEBUG) build. Note that this never gets called automatically unless PYMALLOC_DEBUG is #define'd too, and the envar PYTHONMALLOCSTATS exists. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** obmalloc.c 18 Apr 2002 21:58:56 -0000 2.42 --- obmalloc.c 18 Apr 2002 22:25:03 -0000 2.43 *************** *** 909,912 **** --- 909,937 ---- } + #ifdef Py_DEBUG + /* Is target in the list? The list is traversed via the nextpool pointers. + * The list may be NULL-terminated, or circular. Return 1 if target is in + * list, else 0. + */ + static int + pool_is_in_list(const poolp target, poolp list) + { + poolp origlist = list; + assert(target != NULL); + if (list == NULL) + return 0; + do { + if (target == list) + return 1; + list = list->nextpool; + } while (list != NULL && list != origlist); + return 0; + } + + #else + #define pool_is_in_list(X, Y) 1 + + #endif /* Py_DEBUG */ + /* The debug malloc asks for 16 extra bytes and fills them with useful stuff, here calling the underlying malloc's result p: *************** *** 1201,1205 **** } ! /* Print summary info to stderr about the state of pymalloc's structures. */ void _PyObject_DebugMallocStats(void) --- 1226,1233 ---- } ! /* Print summary info to stderr about the state of pymalloc's structures. ! * In Py_DEBUG mode, also perform some expensive internal consistency ! * checks. ! */ void _PyObject_DebugMallocStats(void) *************** *** 1263,1275 **** for (j = 0; j < poolsinarena; ++j, base += POOL_SIZE) { poolp p = (poolp)base; if (p->ref.count == 0) { /* currently unused */ ++numfreepools; continue; } ! ++numpools[p->szidx]; ! numblocks[p->szidx] += p->ref.count; ! numfreeblocks[p->szidx] += NUMBLOCKS(p->szidx) - ! p->ref.count; } } --- 1291,1311 ---- for (j = 0; j < poolsinarena; ++j, base += POOL_SIZE) { poolp p = (poolp)base; + const uint sz = p->szidx; + uint freeblocks; + if (p->ref.count == 0) { /* currently unused */ ++numfreepools; + assert(pool_is_in_list(p, freepools)); continue; } ! ++numpools[sz]; ! numblocks[sz] += p->ref.count; ! freeblocks = NUMBLOCKS(sz) - p->ref.count; ! numfreeblocks[sz] += freeblocks; ! #ifdef Py_DEBUG ! if (freeblocks > 0) ! assert(pool_is_in_list(p, usedpools[sz + sz])); ! #endif } } From mhammond@sourceforge.net Fri Apr 19 01:11:37 2002 From: mhammond@sourceforge.net (mhammond@sourceforge.net) Date: Thu, 18 Apr 2002 17:11:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_queue.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3478/test Added Files: test_queue.py Log Message: Fix bug 544473 - "Queue module can deadlock". Use try/finally to ensure all Queue locks remain stable. Includes test case. Bugfix candidate. --- NEW FILE: test_queue.py --- # Some simple Queue module tests, plus some failure conditions # to ensure the Queue locks remain stable import Queue import sys import threading import time from test_support import verify, TestFailed, verbose queue_size = 5 # Execute a function that blocks, and in a seperate thread, a function that # triggers the release. Returns the result of the blocking function. class _TriggerThread(threading.Thread): def __init__(self, fn, args): self.fn = fn self.args = args self.startedEvent = threading.Event() threading.Thread.__init__(self) def run(self): time.sleep(.1) self.startedEvent.set() self.fn(*self.args) def _doBlockingTest( block_func, block_args, trigger_func, trigger_args): t = _TriggerThread(trigger_func, trigger_args) t.start() try: return block_func(*block_args) finally: # If we unblocked before our thread made the call, we failed! if not t.startedEvent.isSet(): raise TestFailed("blocking function '%r' appeared not to block" % (block_func,)) t.join(1) # make sure the thread terminates if t.isAlive(): raise TestFailed("trigger function '%r' appeared to not return" % (trigger_func,)) # A Queue subclass that can provoke failure at a moment's notice :) class FailingQueueException(Exception): pass class FailingQueue(Queue.Queue): def __init__(self, *args): self.fail_next_put = False self.fail_next_get = False Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: self.fail_next_put = False raise FailingQueueException, "You Lose" return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: self.fail_next_get = False raise FailingQueueException, "You Lose" return Queue.Queue._get(self) def FailingQueueTest(q): if not q.empty(): raise RuntimeError, "Call this function with an empty queue" for i in range(queue_size-1): q.put(i) q.fail_next_put = True # Test a failing non-blocking put. try: q.put("oops", block=0) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass q.put("last") verify(q.full(), "Queue should be full") q.fail_next_put = True # Test a failing blocking put try: _doBlockingTest( q.put, ("full",), q.get, ()) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass # Check the Queue isn't damaged. # put failed, but get succeeded - re-add q.put("last") verify(q.full(), "Queue should be full") q.get() verify(not q.full(), "Queue should not be full") q.put("last") verify(q.full(), "Queue should be full") # Test a blocking put _doBlockingTest( q.put, ("full",), q.get, ()) # Empty it for i in range(queue_size): q.get() verify(q.empty(), "Queue should be empty") q.put("first") q.fail_next_get = True try: q.get() raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") q.fail_next_get = True try: _doBlockingTest( q.get, (), q.put, ('empty',)) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass # put succeeded, but get failed. verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") def SimpleQueueTest(q): if not q.empty(): raise RuntimeError, "Call this function with an empty queue" # I guess we better check things actually queue correctly a little :) q.put(111) q.put(222) verify(q.get()==111 and q.get()==222, "Didn't seem to queue the correct data!") for i in range(queue_size-1): q.put(i) verify(not q.full(), "Queue should not be full") q.put("last") verify(q.full(), "Queue should be full") try: q.put("full", block=0) raise TestFailed("Didn't appear to block with a full queue") except Queue.Full: pass # Test a blocking put _doBlockingTest( q.put, ("full",), q.get, ()) # Empty it for i in range(queue_size): q.get() verify(q.empty(), "Queue should be empty") try: q.get(block=0) raise TestFailed("Didn't appear to block with an empty queue") except Queue.Empty: pass # Test a blocking get _doBlockingTest( q.get, (), q.put, ('empty',)) def test(): q=Queue.Queue(queue_size) # Do it a couple of times on the same queue SimpleQueueTest(q) SimpleQueueTest(q) if verbose: print "Simple Queue tests seemed to work" q = FailingQueue(queue_size) FailingQueueTest(q) FailingQueueTest(q) if verbose: print "Failing Queue tests seemed to work" test() From mhammond@sourceforge.net Fri Apr 19 01:11:37 2002 From: mhammond@sourceforge.net (mhammond@sourceforge.net) Date: Thu, 18 Apr 2002 17:11:37 -0700 Subject: [Python-checkins] python/dist/src/Lib Queue.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3478 Modified Files: Queue.py Log Message: Fix bug 544473 - "Queue module can deadlock". Use try/finally to ensure all Queue locks remain stable. Includes test case. Bugfix candidate. Index: Queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Queue.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Queue.py 18 Feb 2001 03:30:53 -0000 1.14 --- Queue.py 19 Apr 2002 00:11:31 -0000 1.15 *************** *** 56,66 **** raise Full self.mutex.acquire() ! was_empty = self._empty() ! self._put(item) ! if was_empty: ! self.esema.release() ! if not self._full(): ! self.fsema.release() ! self.mutex.release() def put_nowait(self, item): --- 56,77 ---- raise Full self.mutex.acquire() ! release_fsema = True ! try: ! was_empty = self._empty() ! self._put(item) ! # If we fail before here, the empty state has ! # not changed, so we can skip the release of esema ! if was_empty: ! self.esema.release() ! # If we fail before here, the queue can not be full, so ! # release_full_sema remains True ! release_fsema = not self._full() ! finally: ! # Catching system level exceptions here (RecursionDepth, ! # OutOfMemory, etc) - so do as little as possible in terms ! # of Python calls. ! if release_fsema: ! self.fsema.release() ! self.mutex.release() def put_nowait(self, item): *************** *** 85,95 **** raise Empty self.mutex.acquire() ! was_full = self._full() ! item = self._get() ! if was_full: ! self.fsema.release() ! if not self._empty(): ! self.esema.release() ! self.mutex.release() return item --- 96,114 ---- raise Empty self.mutex.acquire() ! release_esema = True ! try: ! was_full = self._full() ! item = self._get() ! # If we fail before here, the full state has ! # not changed, so we can skip the release of fsema ! if was_full: ! self.fsema.release() ! # Failure means empty state also unchanged - release_esema ! # remains True. ! release_esema = not self._empty() ! finally: ! if release_esema: ! self.esema.release() ! self.mutex.release() return item From anthonybaxter@sourceforge.net Fri Apr 19 04:54:39 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Thu, 18 Apr 2002 20:54:39 -0700 Subject: [Python-checkins] python/dist/src/Lib Queue.py,1.14,1.14.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17170 Modified Files: Tag: release22-maint Queue.py Log Message: backport mhammond's patch: Fix bug 544473 - "Queue module can deadlock". Use try/finally to ensure all Queue locks remain stable. Includes test case. Bugfix candidate. Original patch(es): python/dist/src/Lib/Queue.py:1.15 Index: Queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Queue.py,v retrieving revision 1.14 retrieving revision 1.14.24.1 diff -C2 -d -r1.14 -r1.14.24.1 *** Queue.py 18 Feb 2001 03:30:53 -0000 1.14 --- Queue.py 19 Apr 2002 03:54:37 -0000 1.14.24.1 *************** *** 56,66 **** raise Full self.mutex.acquire() ! was_empty = self._empty() ! self._put(item) ! if was_empty: ! self.esema.release() ! if not self._full(): ! self.fsema.release() ! self.mutex.release() def put_nowait(self, item): --- 56,77 ---- raise Full self.mutex.acquire() ! release_fsema = True ! try: ! was_empty = self._empty() ! self._put(item) ! # If we fail before here, the empty state has ! # not changed, so we can skip the release of esema ! if was_empty: ! self.esema.release() ! # If we fail before here, the queue can not be full, so ! # release_full_sema remains True ! release_fsema = not self._full() ! finally: ! # Catching system level exceptions here (RecursionDepth, ! # OutOfMemory, etc) - so do as little as possible in terms ! # of Python calls. ! if release_fsema: ! self.fsema.release() ! self.mutex.release() def put_nowait(self, item): *************** *** 85,95 **** raise Empty self.mutex.acquire() ! was_full = self._full() ! item = self._get() ! if was_full: ! self.fsema.release() ! if not self._empty(): ! self.esema.release() ! self.mutex.release() return item --- 96,114 ---- raise Empty self.mutex.acquire() ! release_esema = True ! try: ! was_full = self._full() ! item = self._get() ! # If we fail before here, the full state has ! # not changed, so we can skip the release of fsema ! if was_full: ! self.fsema.release() ! # Failure means empty state also unchanged - release_esema ! # remains True. ! release_esema = not self._empty() ! finally: ! if release_esema: ! self.esema.release() ! self.mutex.release() return item From fdrake@sourceforge.net Fri Apr 19 05:04:59 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 18 Apr 2002 21:04:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext windows.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv19552/ext Modified Files: windows.tex Log Message: Clean up the use of version numbers in filenames; always use an "abstract" version number, and explain what it is at the top of the chapter. This closes SF bug #225003. Index: windows.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/windows.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** windows.tex 5 Apr 2002 19:54:19 -0000 1.5 --- windows.tex 19 Apr 2002 04:04:57 -0000 1.6 *************** *** 15,18 **** --- 15,29 ---- Python; typically Microsoft Visual \Cpp. + \begin{notice} + This chapter mentions a number of filenames that include an encoded + Python version number. These filenames are represented with the + version number shown as \samp{XY}; in practive, \character{X} will + be the major version number and \character{Y} will be the minor + version number of the Python release you're working with. For + example, if you are using Python 2.2.1, \samp{XY} will actually be + \samp{22}. + \end{notice} + + \section{A Cookbook Approach \label{win-cookbook}} *************** *** 168,176 **** Select ``Win32 Release'' in the ``Settings for'' dropdown list. Click the Link tab, choose the Input Category, and append ! \code{python22.lib} to the list in the ``Object/library modules'' box. Select ``Win32 Debug'' in the ``Settings for'' dropdown list, and ! append \code{python22_d.lib} to the list in the ``Object/library modules'' box. Then click the C/\Cpp{} tab, select ``Code Generation'' from the Category dropdown list, and select ``Debug --- 179,187 ---- Select ``Win32 Release'' in the ``Settings for'' dropdown list. Click the Link tab, choose the Input Category, and append ! \code{pythonXY.lib} to the list in the ``Object/library modules'' box. Select ``Win32 Debug'' in the ``Settings for'' dropdown list, and ! append \code{pythonXY_d.lib} to the list in the ``Object/library modules'' box. Then click the C/\Cpp{} tab, select ``Code Generation'' from the Category dropdown list, and select ``Debug *************** *** 276,286 **** this section is MSV\Cpp{} specific. ! When creating DLLs in Windows, you must pass \file{python15.lib} to the linker. To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands: \begin{verbatim} ! cl /LD /I/python/include spam.c ../libs/python15.lib ! cl /LD /I/python/include ni.c spam.lib ../libs/python15.lib \end{verbatim} --- 287,297 ---- this section is MSV\Cpp{} specific. ! When creating DLLs in Windows, you must pass \file{pythonXY.lib} to the linker. To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands: \begin{verbatim} ! cl /LD /I/python/include spam.c ../libs/pythonXY.lib ! cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib \end{verbatim} *************** *** 288,292 **** \file{spam.dll} and \file{spam.lib}. \file{Spam.dll} does not contain any Python functions (such as \cfunction{PyArg_ParseTuple()}), but it ! does know how to find the Python code thanks to \file{python15.lib}. The second command created \file{ni.dll} (and \file{.obj} and --- 299,303 ---- \file{spam.dll} and \file{spam.lib}. \file{Spam.dll} does not contain any Python functions (such as \cfunction{PyArg_ParseTuple()}), but it ! does know how to find the Python code thanks to \file{pythonXY.lib}. The second command created \file{ni.dll} (and \file{.obj} and From fdrake@sourceforge.net Fri Apr 19 05:06:08 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 18 Apr 2002 21:06:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext windows.tex,1.3.6.1,1.3.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv19851/ext Modified Files: Tag: release22-maint windows.tex Log Message: Clean up the use of version numbers in filenames; always use an "abstract" version number, and explain what it is at the top of the chapter. This closes SF bug #225003. Index: windows.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/windows.tex,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 *** windows.tex 15 Mar 2002 10:29:08 -0000 1.3.6.1 --- windows.tex 19 Apr 2002 04:06:06 -0000 1.3.6.2 *************** *** 15,18 **** --- 15,29 ---- Python; typically Microsoft Visual \Cpp. + \begin{notice} + This chapter mentions a number of filenames that include an encoded + Python version number. These filenames are represented with the + version number shown as \samp{XY}; in practive, \character{X} will + be the major version number and \character{Y} will be the minor + version number of the Python release you're working with. For + example, if you are using Python 2.2.1, \samp{XY} will actually be + \samp{22}. + \end{notice} + + \section{A Cookbook Approach \label{win-cookbook}} *************** *** 168,176 **** Select ``Win32 Release'' in the ``Settings for'' dropdown list. Click the Link tab, choose the Input Category, and append ! \code{python22.lib} to the list in the ``Object/library modules'' box. Select ``Win32 Debug'' in the ``Settings for'' dropdown list, and ! append \code{python22_d.lib} to the list in the ``Object/library modules'' box. Then click the C/\Cpp{} tab, select ``Code Generation'' from the Category dropdown list, and select ``Debug --- 179,187 ---- Select ``Win32 Release'' in the ``Settings for'' dropdown list. Click the Link tab, choose the Input Category, and append ! \code{pythonXY.lib} to the list in the ``Object/library modules'' box. Select ``Win32 Debug'' in the ``Settings for'' dropdown list, and ! append \code{pythonXY_d.lib} to the list in the ``Object/library modules'' box. Then click the C/\Cpp{} tab, select ``Code Generation'' from the Category dropdown list, and select ``Debug *************** *** 276,286 **** this section is MSV\Cpp{} specific. ! When creating DLLs in Windows, you must pass \file{python15.lib} to the linker. To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands: \begin{verbatim} ! cl /LD /I/python/include spam.c ../libs/python15.lib ! cl /LD /I/python/include ni.c spam.lib ../libs/python15.lib \end{verbatim} --- 287,297 ---- this section is MSV\Cpp{} specific. ! When creating DLLs in Windows, you must pass \file{pythonXY.lib} to the linker. To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands: \begin{verbatim} ! cl /LD /I/python/include spam.c ../libs/pythonXY.lib ! cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib \end{verbatim} *************** *** 288,292 **** \file{spam.dll} and \file{spam.lib}. \file{Spam.dll} does not contain any Python functions (such as \cfunction{PyArg_ParseTuple()}), but it ! does know how to find the Python code thanks to \file{python15.lib}. The second command created \file{ni.dll} (and \file{.obj} and --- 299,303 ---- \file{spam.dll} and \file{spam.lib}. \file{Spam.dll} does not contain any Python functions (such as \cfunction{PyArg_ParseTuple()}), but it ! does know how to find the Python code thanks to \file{pythonXY.lib}. The second command created \file{ni.dll} (and \file{.obj} and From montanaro@sourceforge.net Fri Apr 19 05:50:48 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Thu, 18 Apr 2002 21:50:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv28758 Modified Files: doc.tex Log Message: fix duplicate label add index turds Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** doc.tex 15 Apr 2002 20:10:23 -0000 1.62 --- doc.tex 19 Apr 2002 04:50:44 -0000 1.63 *************** *** 4,7 **** --- 4,9 ---- \title{Documenting Python} + \makeindex + \input{boilerplate} *************** *** 410,414 **** ! \subsection{Hierarchical Structure \label{latex-syntax}} \LaTeX{} expects documents to be arranged in a conventional, --- 412,416 ---- ! \subsection{Hierarchical Structure \label{latex-structure}} \LaTeX{} expects documents to be arranged in a conventional, *************** *** 1847,1850 **** --- 1849,1854 ---- this document. You can also send comments on this document directly to the author at \email{fdrake@acm.org}. + + \input{doc.ind} \end{document} From montanaro@sourceforge.net Fri Apr 19 05:52:46 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Thu, 18 Apr 2002 21:52:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs ltxmarkup.sty,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv29175 Modified Files: ltxmarkup.sty Log Message: \idxcode -> \py@idxcode (mimics index stuff in python.sty - problem only revealed itself when i added index generating lines to doc/doc.tex) Index: ltxmarkup.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/ltxmarkup.sty,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ltxmarkup.sty 21 Sep 2000 15:53:54 -0000 1.5 --- ltxmarkup.sty 19 Apr 2002 04:52:44 -0000 1.6 *************** *** 22,27 **** #2}}] \item[\code{\e end\{{\bfseries #1}\}}] ! \index{#1 environment@\idxcode{#1} environment} ! \index{environments!#1@\idxcode{#1}} }{\end{fulllineitems}} --- 22,27 ---- #2}}] \item[\code{\e end\{{\bfseries #1}\}}] ! \index{#1 environment@\py@idxcode{#1} environment} ! \index{environments!#1@\py@idxcode{#1}} }{\end{fulllineitems}} *************** *** 34,38 **** \let\moreargs=\py@moreargs% #2}}] ! \index{#1@\idxcode{\e #1}} }{\end{fulllineitems}} --- 34,38 ---- \let\moreargs=\py@moreargs% #2}}] ! \index{#1@\py@idxcode{#1}} }{\end{fulllineitems}} From loewis@sourceforge.net Fri Apr 19 10:47:25 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 19 Apr 2002 02:47:25 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21343 Modified Files: Setup.dist Log Message: Document the build process more precisely. Suggested by Hugh Sasse. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Setup.dist 4 Apr 2002 17:52:50 -0000 1.26 --- Setup.dist 19 Apr 2002 09:47:23 -0000 1.27 *************** *** 37,43 **** # Finally, if a line contains just the word "*shared*" (without the # quotes but with the stars), then the following modules will not be # included in the config.c file, nor in the list of objects to be # added to the library archive, and their linker options won't be ! # added to the linker options, but rules to create their .o files and # their shared libraries will still be added to the Makefile, and # their names will be collected in the Make variable SHAREDMODS. This --- 37,54 ---- # Finally, if a line contains just the word "*shared*" (without the # quotes but with the stars), then the following modules will not be + # built statically. The build process works like this: + # + # 1. Build all modules that are declared as static in Modules/Setup, + # combine them into libpythonxy.a, combine that into python. + # 2. Build all modules that are listed as shared in Modules/Setup. + # 3. Invoke setup.py. That builds all modules that + # a) are not builtin, and + # b) are not listed in Modules/Setup, and + # c) can be build on the target + # + # Therefore, modules declared to be shared will not be # included in the config.c file, nor in the list of objects to be # added to the library archive, and their linker options won't be ! # added to the linker options. Rules to create their .o files and # their shared libraries will still be added to the Makefile, and # their names will be collected in the Make variable SHAREDMODS. This *************** *** 47,52 **** # *noconfig* has the same effect as *shared*.) # ! # In addition, *static* reverses this effect (negating a previous ! # *shared* line). # NOTE: As a standard policy, as many modules as can be supported by a --- 58,64 ---- # *noconfig* has the same effect as *shared*.) # ! # In addition, *static* explicitly declares the following modules to ! # be static. Lines containing "*static*" and "*shared*" may thus ! # alternate thoughout this file. # NOTE: As a standard policy, as many modules as can be supported by a From nnorwitz@sourceforge.net Fri Apr 19 13:35:24 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 19 Apr 2002 05:35:24 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv2458 Modified Files: asdl.py Log Message: Little cleanup Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** asdl.py 13 Apr 2002 13:21:23 -0000 1.6 --- asdl.py 19 Apr 2002 12:35:21 -0000 1.7 *************** *** 304,308 **** else: meth = getattr(self, methname) ! self.cache[object.__class__] = meth return meth --- 304,308 ---- else: meth = getattr(self, methname) ! self.cache[klass] = meth return meth *************** *** 357,364 **** print "Undefined type %s, used in %s" % (t, uses) ! if v.errors: ! return False ! else: ! return True def parse(file): --- 357,361 ---- print "Undefined type %s, used in %s" % (t, uses) ! return not v.errors def parse(file): From nnorwitz@sourceforge.net Fri Apr 19 13:37:00 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 19 Apr 2002 05:37:00 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv3175 Modified Files: asdl_c.py Log Message: Cleanup, sys was imported twice, and there is no line, I think s is correct Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** asdl_c.py 16 Apr 2002 23:40:58 -0000 1.11 --- asdl_c.py 19 Apr 2002 12:36:58 -0000 1.12 *************** *** 44,48 **** while len(cur) > size: i = cur.rfind(' ', 0, size) ! assert i != -1, "Impossible line to reflow: %s" % `line` lines.append(padding + cur[:i]) if len(lines) == 1: --- 44,48 ---- while len(cur) > size: i = cur.rfind(' ', 0, size) ! assert i != -1, "Impossible line to reflow: %s" % `s` lines.append(padding + cur[:i]) if len(lines) == 1: *************** *** 152,156 **** type = sum.types[i] enum.append("%s_kind=%d" % (type.name, i + 1)) ! emit("struct _%(name)s {") emit("enum { " + ", ".join(enum) + " } kind;", depth + 1) --- 152,156 ---- type = sum.types[i] enum.append("%s_kind=%d" % (type.name, i + 1)) ! emit("struct _%(name)s {") emit("enum { " + ", ".join(enum) + " } kind;", depth + 1) *************** *** 341,346 **** if __name__ == "__main__": - import sys - mod = asdl.parse(sys.argv[1]) if not asdl.check(mod): --- 341,344 ---- From nnorwitz@sourceforge.net Fri Apr 19 14:08:50 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 19 Apr 2002 06:08:50 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.17,1.18 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv14448 Modified Files: python.asdl Log Message: Spell useful correctly Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** python.asdl 18 Apr 2002 18:55:38 -0000 1.17 --- python.asdl 19 Apr 2002 13:08:47 -0000 1.18 *************** *** 7,11 **** | Expression(expr body) ! -- not really an actual node but usefull in Jython's typesystem. | Suite(stmt* body) --- 7,11 ---- | Expression(expr body) ! -- not really an actual node but useful in Jython's typesystem. | Suite(stmt* body) From nnorwitz@sourceforge.net Fri Apr 19 13:56:15 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 19 Apr 2002 05:56:15 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv9754 Modified Files: asdl_c.py Log Message: Don't leak memory if the arguments are bad, add autogen msg Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** asdl_c.py 19 Apr 2002 12:36:58 -0000 1.12 --- asdl_c.py 19 Apr 2002 12:56:08 -0000 1.13 *************** *** 251,260 **** emit("%s(%s)" % (name, argstr)) emit("{") ! emit("%s p = (%s)malloc(sizeof(*p));" % (ctype, ctype), 1) ! emit("if (!p) {", 1) ! emit("PyErr_SetString(PyExc_MemoryError, \"no memory\");", 2) ! emit("return NULL;", 2) ! emit("}", 1) ! emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: # XXX hack alert: false is allowed for a bool --- 251,255 ---- emit("%s(%s)" % (name, argstr)) emit("{") ! emit("%s p;" % ctype, 1) for argtype, argname, opt in args: # XXX hack alert: false is allowed for a bool *************** *** 267,271 **** --- 262,275 ---- emit('return NULL;', 2) emit('}', 1) + + emit("p = (%s)malloc(sizeof(*p));" % ctype, 1) + emit("if (!p) {", 1) + emit("PyErr_SetString(PyExc_MemoryError, \"no memory\");", 2) + emit("return NULL;", 2) + emit("}", 1) + emit("p->kind = %s_kind;" % name, 1) + for argtype, argname, opt in args: emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) + emit("return p;", 1) emit("}") *************** *** 341,348 **** --- 345,354 ---- if __name__ == "__main__": + auto_gen_msg = '/* File automagically generated by %s */\n' % sys.argv[0] mod = asdl.parse(sys.argv[1]) if not asdl.check(mod): sys.exit(1) f = open("%s-ast.h" % mod.name, "wb") + print >> f, auto_gen_msg print >> f, '#include "asdl.h"\n' c = ChainOfVisitors(TypeDefVisitor(f), *************** *** 355,360 **** --- 361,368 ---- f = open("%s-ast.c" % mod.name, "wb") + print >> f, auto_gen_msg print >> f, '#include "Python.h"' print >> f, '#include "%s-ast.h"' % mod.name + print >> f v = ChainOfVisitors(FunctionVisitor(f), ## PickleFunctionVisitor(f), From nnorwitz@sourceforge.net Fri Apr 19 15:58:43 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 19 Apr 2002 07:58:43 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.229,2.230 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17565/Modules Modified Files: posixmodule.c Log Message: #546155, remove posix_int() it is not used Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.229 retrieving revision 2.230 diff -C2 -d -r2.229 -r2.230 *** posixmodule.c 15 Apr 2002 19:40:07 -0000 2.229 --- posixmodule.c 19 Apr 2002 14:58:40 -0000 2.230 *************** *** 461,480 **** static PyObject * - posix_int(PyObject *args, char *format, int (*func)(int)) - { - int fd; - int res; - if (!PyArg_ParseTuple(args, format, &fd)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = (*func)(fd); - Py_END_ALLOW_THREADS - if (res < 0) - return posix_error(); - Py_INCREF(Py_None); - return Py_None; - } - - static PyObject * posix_fildes(PyObject *fdobj, int (*func)(int)) { --- 461,464 ---- From jhylton@sourceforge.net Fri Apr 19 15:58:59 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 07:58:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_zlib.py,1.16,1.16.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17651 Modified Files: Tag: release22-maint test_zlib.py Log Message: [backport bug fix from the trunk] Fix SF #544995 (zlib crash on second flush call) Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1. Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.16 retrieving revision 1.16.10.1 diff -C2 -d -r1.16 -r1.16.10.1 *** test_zlib.py 18 Oct 2001 21:57:37 -0000 1.16 --- test_zlib.py 19 Apr 2002 14:58:57 -0000 1.16.10.1 *************** *** 42,45 **** --- 42,51 ---- x1 = co.compress(buf) x2 = co.flush() + try: + co.flush() + print "Oops - second flush worked when it should not have!" + except zlib.error: + pass + x = x1 + x2 From jhylton@sourceforge.net Fri Apr 19 15:59:10 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 07:59:10 -0700 Subject: [Python-checkins] python/dist/src/Modules zlibmodule.c,2.57,2.57.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17711 Modified Files: Tag: release22-maint zlibmodule.c Log Message: [backport bug fix from the trunk] Fix SF #544995 (zlib crash on second flush call) Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1. Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.57 retrieving revision 2.57.6.1 diff -C2 -d -r2.57 -r2.57.6.1 *** zlibmodule.c 8 Dec 2001 18:02:58 -0000 2.57 --- zlibmodule.c 19 Apr 2002 14:59:08 -0000 2.57.6.1 *************** *** 649,652 **** --- 649,653 ---- Py_DECREF(RetVal); RetVal = NULL; + goto error; } From jhylton@sourceforge.net Fri Apr 19 15:37:04 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 07:37:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_zlib.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10978 Modified Files: test_zlib.py Log Message: Fix SF #544995 (zlib crash on second flush call) Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1. Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_zlib.py 18 Oct 2001 21:57:37 -0000 1.16 --- test_zlib.py 19 Apr 2002 14:36:57 -0000 1.17 *************** *** 42,45 **** --- 42,51 ---- x1 = co.compress(buf) x2 = co.flush() + try: + co.flush() + print "Oops - second flush worked when it should not have!" + except zlib.error: + pass + x = x1 + x2 From jhylton@sourceforge.net Fri Apr 19 15:37:09 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 07:37:09 -0700 Subject: [Python-checkins] python/dist/src/Modules zlibmodule.c,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11054 Modified Files: zlibmodule.c Log Message: Fix SF #544995 (zlib crash on second flush call) Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1. Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** zlibmodule.c 1 Apr 2002 14:53:37 -0000 2.59 --- zlibmodule.c 19 Apr 2002 14:37:07 -0000 2.60 *************** *** 649,652 **** --- 649,653 ---- Py_DECREF(RetVal); RetVal = NULL; + goto error; } From tim_one@sourceforge.net Fri Apr 19 16:59:03 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 08:59:03 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.168,1.169 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11985/python/Misc Modified Files: ACKS Log Message: Get the right funny characters in Hernan's name. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -d -r1.168 -r1.169 *** ACKS 15 Apr 2002 01:05:01 -0000 1.168 --- ACKS 19 Apr 2002 15:59:01 -0000 1.169 *************** *** 145,148 **** --- 145,149 ---- Vincent Fiack Nils Fischbeck + Hernán Martínez Foffani Doug Fort Robin Friedrich From tim_one@sourceforge.net Fri Apr 19 16:59:03 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 08:59:03 -0700 Subject: [Python-checkins] python/dist/src/Doc ACKS,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv11985/python/Doc Modified Files: ACKS Log Message: Get the right funny characters in Hernan's name. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ACKS,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ACKS 27 Dec 2001 18:40:18 -0000 1.35 --- ACKS 19 Apr 2002 15:59:00 -0000 1.36 *************** *** 54,58 **** Martijn Faassen Carl Feynman ! Hernan Martinez Foffani Stefan Franke Jim Fulton --- 54,58 ---- Martijn Faassen Carl Feynman ! Hernán Martínez Foffani Stefan Franke Jim Fulton From tim_one@sourceforge.net Fri Apr 19 17:46:57 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 09:46:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv32179 Modified Files: prechm.py Log Message: + Changed TOC to folder-tree style. + Increased size of the window the user sees the first time. + Arranged for the display to remember its last size and position. + Added a Favorites (bookmarks) tab. + Added the "Advanced Search" decorations. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** prechm.py 19 Apr 2002 16:09:26 -0000 1.1 --- prechm.py 19 Apr 2002 16:46:43 -0000 1.2 *************** *** 52,56 **** [WINDOWS] %s="Python %s Documentation","%s.hhc","%s.hhk","index.html","index.html",\ ! ,,,,0x2520,220,0x384e,,,,,0,,, [FILES] --- 52,56 ---- [WINDOWS] %s="Python %s Documentation","%s.hhc","%s.hhk","index.html","index.html",\ ! ,,,,0x63520,220,0x384e,[271,372,740,718],,,,,,,0 [FILES] *************** *** 60,63 **** --- 60,64 ---- +
    From nnorwitz@sourceforge.net Fri Apr 19 17:24:35 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Fri, 19 Apr 2002 09:24:35 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_java.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23895 Modified Files: asdl_java.py Log Message: Cleanup, sys was imported twice, and there is no line, I think s is correct Index: asdl_java.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_java.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** asdl_java.py 18 Apr 2002 18:57:30 -0000 1.3 --- asdl_java.py 19 Apr 2002 16:24:31 -0000 1.4 *************** *** 30,34 **** while len(cur) > size: i = cur.rfind(' ', 0, size) ! assert i != -1, "Impossible line to reflow: %s" % `line` lines.append(padding + cur[:i]) if len(lines) == 1: --- 30,34 ---- while len(cur) > size: i = cur.rfind(' ', 0, size) ! assert i != -1, "Impossible line to reflow: %s" % `s` lines.append(padding + cur[:i]) if len(lines) == 1: *************** *** 313,318 **** if __name__ == "__main__": - import sys - mod = asdl.parse(sys.argv[1]) if not asdl.check(mod): --- 313,316 ---- From loewis@sourceforge.net Fri Apr 19 18:32:23 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 19 Apr 2002 10:32:23 -0700 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20500 Modified Files: pep-0263.txt Log Message: Use Hisao's strategy of converting to UTF-8. Index: pep-0263.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0263.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0263.txt 15 Mar 2002 17:07:12 -0000 1.11 --- pep-0263.txt 19 Apr 2002 17:32:14 -0000 1.12 *************** *** 2,6 **** Title: Defining Python Source Code Encodings Version: $Revision$ ! Author: mal@lemburg.com (Marc-André Lemburg) Status: Draft Type: Standards Track --- 2,7 ---- Title: Defining Python Source Code Encodings Version: $Revision$ ! Author: mal@lemburg.com (Marc-André Lemburg), ! loewis@informatik.hu-berlin.de (Martin v. Löwis) Status: Draft Type: Standards Track *************** *** 26,30 **** and work in non-Latin-1 locales such as many of the Asian countries. Programmers can write their 8-bit strings using the ! favourite encoding, but are bound to the "unicode-escape" encoding for Unicode literals. --- 27,31 ---- and work in non-Latin-1 locales such as many of the Asian countries. Programmers can write their 8-bit strings using the ! favorite encoding, but are bound to the "unicode-escape" encoding for Unicode literals. *************** *** 36,40 **** To make Python aware of this encoding declaration a number of ! concept changes are necessary with repect to the handling of Python source code data. --- 37,41 ---- To make Python aware of this encoding declaration a number of ! concept changes are necessary with respect to the handling of Python source code data. *************** *** 96,147 **** 2. decode it into Unicode assuming a fixed per-file encoding ! 3. tokenize the Unicode content ! 4. compile it, creating Unicode objects from the given Unicode data and creating string objects from the Unicode literal data ! by first reencoding the Unicode data into 8-bit string data using the given file encoding - 5. variable names and other identifiers will be reencoded into - 8-bit strings using the file encoding to assure backward - compatibility with the existing implementation - Note that Python identifiers are restricted to the ASCII ! subset of the encoding. Implementation ! Since changing the Python tokenizer/parser combination will ! require major changes in the internals of the interpreter and ! enforcing the use of magic comments in source code files which ! place non-ASCII characters in string literals, comments ! and Unicode literals, the proposed solution should be implemented ! in two phases: ! ! 1. Implement the magic comment detection, but only apply the ! detected encoding to Unicode literals in the source file. ! ! If no magic comment is used, Python should continue to ! use the standard [raw-]unicode-escape codecs for Unicode ! literals. ! In addition to this step and to aid in the transition to ! explicit encoding declaration, the tokenizer must check the ! complete source file for compliance with the declared ! encoding. If the source file does not properly decode, a single ! warning is generated per file. ! 2. Change the tokenizer/compiler base string type from char* to ! Py_UNICODE* and apply the encoding to the complete file. ! Source files which fail to decode cause an error to be raised ! during compilation. ! The builtin compile() API will be enhanced to accept Unicode as ! input. 8-bit string input is subject to the standard procedure ! for encoding detection as decsribed above. ! Martin v. Loewis is working on a patch which implements phase 1. ! See [1] for details. Scope --- 97,137 ---- 2. decode it into Unicode assuming a fixed per-file encoding ! 3. convert it into a UTF-8 byte string ! 4. tokenize the UTF-8 content ! ! 5. compile it, creating Unicode objects from the given Unicode data and creating string objects from the Unicode literal data ! by first reencoding the UTF-8 data into 8-bit string data using the given file encoding Note that Python identifiers are restricted to the ASCII ! subset of the encoding, and thus need no further conversion ! after step 4. Implementation ! For backwards-compatibility with existing code which currently ! uses non-ASCII in string literals without declaring an encoding, ! the implementation will be introduced in two phases: ! 1. Allow non-ASCII in string literals and comments, by internally ! treating a missing encoding declaration as a declaration of ! "iso-8859-1". This will cause arbitrary byte strings to ! correctly round-trip between step 2 and step 5 of the ! processing, and provide compatibility with Python 2.2 for ! Unicode literals that contain non-ASCII bytes. ! A warning will be issued if non-ASCII bytes are found in the ! input, once per improperly encoded input file. ! 2. Remove the warning, and change the default encoding to "ascii". ! The builtin compile() API will be enhanced to accept Unicode as ! input. 8-bit string input is subject to the standard procedure for ! encoding detection as described above. ! SUZUKI Hisao is working on a patch; see [2] for details. A patch ! implementing only phase 1 is available at [1]. Scope *************** *** 154,158 **** [1] Phase 1 implementation: ! http://sourceforge.net/tracker/?func=detail&atid=305470&aid=526840&group_id=5470 History --- 144,150 ---- [1] Phase 1 implementation: ! http://python.org/sf/526840 ! [2] Phase 2 implementation: ! http://python.org/sf/534304 History From tim_one@sourceforge.net Fri Apr 19 17:09:29 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 09:09:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv16715 Added Files: prechm.py Log Message: Generates inputs to the Microsoft Help Compiler, which creates compiled HTML help files (.chm). Obtained from Robin Dunn's packaging of the 2.2 docs at , obtained in turn from Hernán Martínez Foffani's original work at . --- NEW FILE: prechm.py --- ''' Makes the necesary files to convert from plain html of Python 1.5 and 1.5.x Documentation to Microsoft HTML Help format version 1.1 Doesn't change the html's docs. by hernan.foffani@iname.com no copyright and no responsabilities. modified by Dale Nagata for Python 1.5.2 Renamed from make_chm.py to prechm.py, and checked into the Python project, 19-Apr-2002 by Tim Peters. Assorted modifications by Tim and Fred Drake. Obtained from Robin Dunn's .chm packaging of the Python 2.2 docs, at . ''' import sys import os import formatter import htmllib import string import getopt # moved all the triple_quote up here because my syntax-coloring editor # sucks a little bit. usage_mode = ''' Usage: make_chm.py [-c] [-k] [-p] [-v 1.5[.x]] filename -c: does not build filename.hhc (Table of Contents) -k: does not build filename.hhk (Index) -p: does not build filename.hhp (Project File) -v 1.5[.x]: makes help for the python 1.5[.x] docs (default is python 1.5.2 docs) ''' # project file (*.hhp) template. there are seven %s project_template = ''' [OPTIONS] Compatibility=1.1 Compiled file=%s.chm Contents file=%s.hhc Default Window=%s Default topic=index.html Display compile progress=No Full-text search=Yes Index file=%s.hhk Language=0x409 Title=Python %s Documentation [WINDOWS] %s="Python %s Documentation","%s.hhc","%s.hhk","index.html","index.html",\ ,,,,0x2520,220,0x384e,,,,,0,,, [FILES] ''' contents_header = '''
      • ''' contents_footer = '''
    ''' object_sitemap = '''
  • ''' # Library Doc list of tuples: # each 'book' : ( Dir, Title, First page, Content page, Index page) # supported_libraries = { '2.2': ### Beta!!! fix for actual release [ ('.', 'Global Module Index', 'modindex.html', None, None), ('tut','Tutorial','tut.html','node2.html',None), ('lib','Library Reference','lib.html','contents.html','genindex.html'), ('ref','Language Reference','ref.html','contents.html','genindex.html'), ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ('ext','Extending and Embedding','ext.html','contents.html',None), ('api','Python/C API','api.html','contents.html','genindex.html'), ('doc','Documenting Python','doc.html','contents.html',None), ('inst','Installing Python Modules', 'inst.html', 'index.html', None), ('dist','Distributing Python Modules', 'dist.html', 'index.html', None), ], '2.1.1': [ ('.', 'Global Module Index', 'modindex.html', None, None), ('tut','Tutorial','tut.html','node2.html',None), ('lib','Library Reference','lib.html','contents.html','genindex.html'), ('ref','Language Reference','ref.html','contents.html','genindex.html'), ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ('ext','Extending and Embedding','ext.html','contents.html',None), ('api','Python/C API','api.html','contents.html','genindex.html'), ('doc','Documenting Python','doc.html','contents.html',None), ('inst','Installing Python Modules', 'inst.html', 'index.html', None), ('dist','Distributing Python Modules', 'dist.html', 'index.html', None), ], '2.0.0': [ ('.', 'Global Module Index', 'modindex.html', None, None), ('tut','Tutorial','tut.html','node2.html',None), ('lib','Library Reference','lib.html','contents.html','genindex.html'), ('ref','Language Reference','ref.html','contents.html','genindex.html'), ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ('ext','Extending and Embedding','ext.html','contents.html',None), ('api','Python/C API','api.html','contents.html','genindex.html'), ('doc','Documenting Python','doc.html','contents.html',None), ('inst','Installing Python Modules', 'inst.html', 'contents.html', None), ('dist','Distributing Python Modules', 'dist.html', 'contents.html', None), ], # Apr 17/99: library for 1.5.2 version: # May 01/99: library for 1.5.2 (04/30/99): '1.5.2': [ ('tut','Tutorial','tut.html','node2.html',None), ('lib','Library Reference','lib.html','contents.html','genindex.html'), ('ref','Language Reference','ref.html','contents.html','genindex.html'), ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ('ext','Extending and Embedding','ext.html','contents.html',None), ('api','Python/C API','api.html','contents.html','genindex.html'), ('doc','Documenting Python','doc.html','contents.html',None) ], # library for 1.5.1 version: '1.5.1': [ ('tut','Tutorial','tut.html','contents.html',None), ('lib','Library Reference','lib.html','contents.html','genindex.html'), ('ref','Language Reference','ref-1.html','ref-2.html','ref-11.html'), ('ext','Extending and Embedding','ext.html','contents.html',None), ('api','Python/C API','api.html','contents.html','genindex.html') ], # library for 1.5 version: '1.5': [ ('tut','Tutorial','tut.html','node1.html',None), ('lib','Library Reference','lib.html','node1.html','node268.html'), ('ref','Language Reference','ref-1.html','ref-2.html','ref-11.html'), ('ext','Extending and Embedding','ext.html','node1.html',None), ('api','Python/C API','api.html','node1.html','node48.html') ] } class AlmostNullWriter(formatter.NullWriter) : savedliteral = '' def send_flowing_data(self, data) : # need the text tag for later datastriped = string.strip(data) if self.savedliteral == '': self.savedliteral = datastriped else: self.savedliteral = string.strip(self.savedliteral + ' ' + datastriped) class HelpHtmlParser(htmllib.HTMLParser) : indent = 0 # number of tabs for pritty printing of files ft = None # output file path = None # relative path proc = 0 # if true I process, if false I skip # (some headers, footers, etc.) def begin_group(self) : if not self.proc : # first level, start processing self.proc = 1 self.indent = self.indent + 1 def finnish_group(self) : self.indent = self.indent - 1 if self.proc and self.indent == 0 : # if processing and back to root, then stop self.proc = 0 def anchor_bgn(self, href, name, type) : if self.proc : self.formatter.writer.savedliteral = '' self.ft.write('\n') self.ft.write('\t' * self.indent + \ '\t\n') def anchor_end(self) : if self.proc : self.ft.write('\t' * self.indent + \ '\t\n') self.ft.write('\t' * self.indent + '\t\n' ) def start_dl(self, atr_val) : self.begin_group() def end_dl(self) : self.finnish_group() def do_dt(self, atr_val) : # no trailing newline on pourpose! self.ft.write("\t" * self.indent + "
  • ") class IdxHlpHtmlParser(HelpHtmlParser) : # nothing special here, seems enough with parent class pass class TocHlpHtmlParser(HelpHtmlParser) : def start_dl(self, atr_val) : self.begin_group() self.ft.write('\t' * self.indent + '
      \n') def end_dl(self) : self.finnish_group() self.ft.write('
    \n') def start_ul(self, atr_val) : self.begin_group() self.ft.write('\t' * self.indent + '
      \n') def end_ul(self) : self.finnish_group() self.ft.write('
    \n') def do_li(self, atr_val) : # no trailing newline on pourpose! self.ft.write("\t" * self.indent + "
  • ") def index(path, archivo, output) : f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) parser.path = path parser.ft = output fil = path + '/' + archivo parser.feed(open(fil).read()) parser.close() def content(path, archivo, output) : f = formatter.AbstractFormatter(AlmostNullWriter()) parser = TocHlpHtmlParser(f) parser.path = path parser.ft = output fil = path + '/' + archivo parser.feed(open(fil).read()) parser.close() def do_index(library, output) : output.write('
      \n') for book in library : print '\t', book[2] if book[4] : index(book[0], book[4], output) output.write('
    \n') def do_content(library, version, output) : output.write(contents_header % version) for book in library : print '\t', book[2] output.write(object_sitemap % (book[0]+"/"+book[2], book[1])) if book[3] : content(book[0], book[3], output) output.write(contents_footer) def do_project( library, output, arch, version) : output.write( project_template % \ (arch, arch, arch, arch, version, arch, version, arch, arch) ) for book in library : for page in os.listdir(book[0]) : if page[string.rfind(page, '.'):] == '.html' or \ page[string.rfind(page, '.'):] == '.css': output.write(book[0]+ '\\' + page + '\n') def openfile(file) : try : p = open(file, "w") except IOError, msg : print file, ":", msg sys.exit(1) return p def usage() : print usage_mode sys.exit(0) def do_it(args = None) : if not args : args = sys.argv[1:] if not args : usage() try : optlist, args = getopt.getopt(args, 'ckpv:') except getopt.error, msg : print msg usage() if not args or len(args) > 1 : usage() arch = args[0] version = None for opt in optlist: if opt[0] == '-v': version = opt[1] break if not version: usage() library = supported_libraries[ version ] if not (('-p','') in optlist) : f = openfile(arch + '.hhp') print "Building Project..." do_project(library, f, arch, version) if version == '2.0.0': for image in os.listdir('icons'): f.write('icons'+ '\\' + image + '\n') f.close() if not (('-c','') in optlist) : f = openfile(arch + '.hhc') print "Building Table of Content..." do_content(library, version, f) f.close() if not (('-k','') in optlist) : f = openfile(arch + '.hhk') print "Building Index..." do_index(library, f) f.close() if __name__ == '__main__' : do_it() From tim_one@sourceforge.net Fri Apr 19 19:07:54 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 11:07:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv2564 Modified Files: prechm.py Log Message: project_template: use dict interpolation instead of giant tuples. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** prechm.py 19 Apr 2002 16:46:43 -0000 1.2 --- prechm.py 19 Apr 2002 18:07:52 -0000 1.3 *************** *** 23,30 **** import getopt - - - # moved all the triple_quote up here because my syntax-coloring editor - # sucks a little bit. usage_mode = ''' Usage: make_chm.py [-c] [-k] [-p] [-v 1.5[.x]] filename --- 23,26 ---- *************** *** 36,56 **** ''' ! # project file (*.hhp) template. there are seven %s project_template = ''' [OPTIONS] Compatibility=1.1 ! Compiled file=%s.chm ! Contents file=%s.hhc ! Default Window=%s Default topic=index.html Display compile progress=No Full-text search=Yes ! Index file=%s.hhk Language=0x409 ! Title=Python %s Documentation [WINDOWS] ! %s="Python %s Documentation","%s.hhc","%s.hhk","index.html","index.html",\ ! ,,,,0x63520,220,0x384e,[271,372,740,718],,,,,,,0 [FILES] --- 32,56 ---- ''' ! # Project file (*.hhp) template. 'arch' is the file basename (like ! # the pythlp in pythlp.hhp); 'version' is the doc version number (like ! # the 2.2 in Python 2.2). ! # The magical numbers in the long line under [WINDOWS] set most of the ! # user-visible features (visible buttons, tabs, etc). project_template = ''' [OPTIONS] Compatibility=1.1 ! Compiled file=%(arch)s.chm ! Contents file=%(arch)s.hhc ! Default Window=%(arch)s Default topic=index.html Display compile progress=No Full-text search=Yes ! Index file=%(arch)s.hhk Language=0x409 ! Title=Python %(version)s Documentation [WINDOWS] ! %(arch)s="Python %(version)s Documentation","%(arch)s.hhc","%(arch)s.hhk",\ ! "index.html","index.html",,,,,0x63520,220,0x384e,[271,372,740,718],,,,,,,0 [FILES] *************** *** 286,291 **** def do_project( library, output, arch, version) : ! output.write( project_template % \ ! (arch, arch, arch, arch, version, arch, version, arch, arch) ) for book in library : for page in os.listdir(book[0]) : --- 286,290 ---- def do_project( library, output, arch, version) : ! output.write(project_template % locals()) for book in library : for page in os.listdir(book[0]) : From tim_one@sourceforge.net Fri Apr 19 19:41:49 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 11:41:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv16402 Modified Files: prechm.py Log Message: Added a stop-list to reduce the size of the full text search index. Fred, populate the "stop_list" triple-quoted string with your favorite handful of stop words. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** prechm.py 19 Apr 2002 18:07:52 -0000 1.3 --- prechm.py 19 Apr 2002 18:41:46 -0000 1.4 *************** *** 1,3 **** ! ''' Makes the necesary files to convert from plain html of Python 1.5 and 1.5.x Documentation to --- 1,3 ---- ! """ Makes the necesary files to convert from plain html of Python 1.5 and 1.5.x Documentation to *************** *** 14,18 **** and Fred Drake. Obtained from Robin Dunn's .chm packaging of the Python 2.2 docs, at . ! ''' import sys --- 14,18 ---- and Fred Drake. Obtained from Robin Dunn's .chm packaging of the Python 2.2 docs, at . ! """ import sys *************** *** 39,43 **** project_template = ''' [OPTIONS] - Compatibility=1.1 Compiled file=%(arch)s.chm Contents file=%(arch)s.hhc --- 39,42 ---- *************** *** 45,48 **** --- 44,48 ---- Default topic=index.html Display compile progress=No + Full text search stop list file=%(arch)s.stp Full-text search=Yes Index file=%(arch)s.hhk *************** *** 81,84 **** --- 81,101 ---- ''' + + # List of words the full text search facility shouldn't index. This + # becomes file ARCH.stp. Note that this list must be pretty small! + # Different versions of the MS docs claim the file has a maximum size of + # 256 or 512 bytes (including \r\n at the end of each line). + # Note that "and", "or", "not" and "near" are operators in the search + # language, so not point indexing them even if wanted to. + stop_list = ''' + a an and + is + near + not + of + or + the + ''' + # Library Doc list of tuples: # each 'book' : ( Dir, Title, First page, Content page, Index page) *************** *** 336,339 **** --- 353,365 ---- if not (('-p','') in optlist) : + fname = arch + '.stp' + f = openfile(fname) + print "Building stoplist", fname, "..." + words = stop_list.split() + words.sort() + for word in words: + print >> f, word + f.close() + f = openfile(arch + '.hhp') print "Building Project..." From loewis@sourceforge.net Fri Apr 19 22:04:44 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 19 Apr 2002 14:04:44 -0700 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23809 Modified Files: _localemodule.c Log Message: Patch #546194: Check constants individually. Fixes 534143 on OpenBSD. Will backport to 2.2. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** _localemodule.c 27 Mar 2002 18:49:02 -0000 2.29 --- _localemodule.c 19 Apr 2002 21:04:41 -0000 2.30 *************** *** 483,488 **** LANGINFO(PM_STR), ! /* The following constants are available only with XPG4. AIX 3.2. only has ! CODESET. */ #ifdef CODESET LANGINFO(CODESET), --- 483,491 ---- LANGINFO(PM_STR), ! /* The following constants are available only with XPG4, but... ! AIX 3.2. only has CODESET. ! OpenBSD doesn't have CODESET but has T_FMT_AMPM, and doesn't have ! a few of the others. ! Solution: ifdef-test them all. */ #ifdef CODESET LANGINFO(CODESET), *************** *** 490,499 **** --- 493,516 ---- #ifdef T_FMT_AMPM LANGINFO(T_FMT_AMPM), + #endif + #ifdef ERA LANGINFO(ERA), + #endif + #ifdef ERA_D_FMT LANGINFO(ERA_D_FMT), + #endif + #ifdef ERA_D_T_FMT LANGINFO(ERA_D_T_FMT), + #endif + #ifdef ERA_T_FMT LANGINFO(ERA_T_FMT), + #endif + #ifdef ALT_DIGITS LANGINFO(ALT_DIGITS), + #endif + #ifdef YESEXPR LANGINFO(YESEXPR), + #endif + #ifdef NOEXPR LANGINFO(NOEXPR), #endif From loewis@sourceforge.net Fri Apr 19 22:06:15 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Fri, 19 Apr 2002 14:06:15 -0700 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.25.6.2,2.25.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25168 Modified Files: Tag: release22-maint _localemodule.c Log Message: Patch #546194: Check constants individually. Fixes 534143 on OpenBSD. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.25.6.2 retrieving revision 2.25.6.3 diff -C2 -d -r2.25.6.2 -r2.25.6.3 *** _localemodule.c 5 Apr 2002 15:26:55 -0000 2.25.6.2 --- _localemodule.c 19 Apr 2002 21:06:13 -0000 2.25.6.3 *************** *** 485,490 **** LANGINFO(PM_STR), ! /* The following constants are available only with XPG4. AIX 3.2. only has ! CODESET. */ #ifdef CODESET LANGINFO(CODESET), --- 485,493 ---- LANGINFO(PM_STR), ! /* The following constants are available only with XPG4, but... ! AIX 3.2. only has CODESET. ! OpenBSD doesn't have CODESET but has T_FMT_AMPM, and doesn't have ! a few of the others. ! Solution: ifdef-test them all. */ #ifdef CODESET LANGINFO(CODESET), *************** *** 492,501 **** --- 495,518 ---- #ifdef T_FMT_AMPM LANGINFO(T_FMT_AMPM), + #endif + #ifdef ERA LANGINFO(ERA), + #endif + #ifdef ERA_D_FMT LANGINFO(ERA_D_FMT), + #endif + #ifdef ERA_D_T_FMT LANGINFO(ERA_D_T_FMT), + #endif + #ifdef ERA_T_FMT LANGINFO(ERA_T_FMT), + #endif + #ifdef ALT_DIGITS LANGINFO(ALT_DIGITS), + #endif + #ifdef YESEXPR LANGINFO(YESEXPR), + #endif + #ifdef NOEXPR LANGINFO(NOEXPR), #endif From jhylton@sourceforge.net Fri Apr 19 23:12:45 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 15:12:45 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv23816 Modified Files: asdl_c.py Log Message: Create "constructor" functions for product types like alias. Also, don't generate NULL tests for * types, since 0 is valid for * and it would be a pain to pass an empty asdl_seq *. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** asdl_c.py 19 Apr 2002 12:56:08 -0000 1.13 --- asdl_c.py 19 Apr 2002 22:12:43 -0000 1.14 *************** *** 207,232 **** self.visit(t, name) ! def visitConstructor(self, cons, type): args = [] ! if cons.fields: ! unnamed = {} ! for f in cons.fields: ! if f.name is None: ! name = f.type ! c = unnamed[name] = unnamed.get(name, 0) + 1 ! if c > 1: ! name = "name%d" % (c - 1) ! else: ! name = f.name ! # XXX should extend get_c_type() to handle this ! if f.seq: ! ctype = "asdl_seq *" ! else: ! ctype = get_c_type(f.type) ! args.append((ctype, name, f.opt)) ctype = get_c_type(type) self.emit_function(cons.name, ctype, args) ! def emit_function(self, name, ctype, args): if args: argstr = ", ".join(["%s %s" % (atype, aname) --- 207,235 ---- self.visit(t, name) ! def get_args(self, fields): args = [] ! unnamed = {} ! for f in fields: ! if f.name is None: ! name = f.type ! c = unnamed[name] = unnamed.get(name, 0) + 1 ! if c > 1: ! name = "name%d" % (c - 1) ! else: ! name = f.name ! # XXX should extend get_c_type() to handle this ! if f.seq: ! ctype = "asdl_seq *" ! else: ! ctype = get_c_type(f.type) ! args.append((ctype, name, f.opt or f.seq)) ! return args ! ! def visitConstructor(self, cons, type): ! args = self.get_args(cons.fields) ctype = get_c_type(type) self.emit_function(cons.name, ctype, args) ! def emit_function(self, name, ctype, args, union=1): if args: argstr = ", ".join(["%s %s" % (atype, aname) *************** *** 236,247 **** self.emit("%s %s(%s);" % (ctype, name, argstr), 0) - # XXX or just set skip=1 in constructor? def visitProduct(self, prod, name): ! pass class FunctionVisitor(PrototypeVisitor): """Visitor to generate constructor functions for AST.""" ! def emit_function(self, name, ctype, args): def emit(s, depth=0, reflow=1): self.emit(s, depth, reflow) --- 239,250 ---- self.emit("%s %s(%s);" % (ctype, name, argstr), 0) def visitProduct(self, prod, name): ! self.emit_function(name, get_c_type(name), ! self.get_args(prod.fields), union=0) class FunctionVisitor(PrototypeVisitor): """Visitor to generate constructor functions for AST.""" ! def emit_function(self, name, ctype, args, union=1): def emit(s, depth=0, reflow=1): self.emit(s, depth, reflow) *************** *** 268,278 **** emit("return NULL;", 2) emit("}", 1) emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) ! emit("return p;", 1) ! emit("}") ! emit("") class PickleVisitor(EmitVisitor): --- 271,294 ---- emit("return NULL;", 2) emit("}", 1) + if union: + self.emit_body_union(name, args) + else: + self.emit_body_struct(name, args) + emit("return p;", 1) + emit("}") + emit("") + + def emit_body_union(self, name, args): + def emit(s, depth=0, reflow=1): + self.emit(s, depth, reflow) emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) ! def emit_body_struct(self, name, args): ! def emit(s, depth=0, reflow=1): ! self.emit(s, depth, reflow) ! for argtype, argname, opt in args: ! emit("p->%s = %s;" % (argname, argname), 1) class PickleVisitor(EmitVisitor): From jhylton@sourceforge.net Fri Apr 19 23:15:14 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 15:15:14 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,1.4,1.5 test.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv24712 Modified Files: astmodule.c test.py Log Message: Several new statement types handled & misc changes. Handle Delete(), Import(), ImportFrom(), If(), For(). ast_for_exprlist() also takes a context argument used to set the context flag on the expressions. Add tests for new statements. Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** astmodule.c 16 Apr 2002 23:43:00 -0000 1.4 --- astmodule.c 19 Apr 2002 22:15:12 -0000 1.5 *************** *** 14,17 **** --- 14,18 ---- static asdl_seq *seq_for_testlist(node *); static expr_ty ast_for_expr(node *); + static stmt_ty ast_for_stmt(node *); extern grammar _PyParser_Grammar; /* From graminit.c */ *************** *** 112,115 **** --- 113,117 ---- } else if (NCH(n) == 2) { + /* handle "not in" and "is not" */ switch (TYPE(CHILD(n, 0))) { case NAME: *************** *** 402,424 **** } ! static stmt_ty ! ast_for_del_stmt(node *n) { - /* del_stmt: 'del' exprlist */ - int i; asdl_seq *seq; expr_ty e; - node *ch; ! REQ(n, del_stmt); ! ch = CHILD(n, 1); ! REQ(ch, exprlist); ! seq = asdl_seq_new((NCH(ch) + 1) / 2); ! for (i = 0; i < NCH(ch); i += 2) { ! e = ast_for_expr(CHILD(ch, i)); ! set_context(e, Del); asdl_seq_append(seq, e); } ! return Delete(seq); } --- 404,432 ---- } ! static asdl_seq * ! ast_for_exprlist(node *n, int context) { asdl_seq *seq; + int i; expr_ty e; ! REQ(n, exprlist); ! ! seq = asdl_seq_new((NCH(n) + 1) / 2); ! for (i = 0; i < NCH(n); i += 2) { ! e = ast_for_expr(CHILD(n, i)); ! if (context) ! set_context(e, context); asdl_seq_append(seq, e); } ! return seq; ! } ! ! static stmt_ty ! ast_for_del_stmt(node *n) ! { ! /* del_stmt: 'del' exprlist */ ! REQ(n, del_stmt); ! return Delete(ast_for_exprlist(CHILD(n, 1), Del)); } *************** *** 470,473 **** --- 478,546 ---- } + static alias_ty + alias_for_import_name(node *n) + { + /* + import_as_name: NAME [NAME NAME] + dotted_as_name: dotted_name [NAME NAME] + dotted_name: NAME ('.' NAME)* + */ + loop: + switch (TYPE(n)) { + case import_as_name: + if (NCH(n) == 3) + return alias(PyString_InternFromString(STR(CHILD(n, 0))), + PyString_InternFromString(STR(CHILD(n, 2)))); + else + return alias(PyString_InternFromString(STR(CHILD(n, 0))), + NULL); + break; + case dotted_as_name: + if (NCH(n) == 1) { + n = CHILD(n, 0); + goto loop; + } else { + alias_ty a = alias_for_import_name(CHILD(n, 0)); + assert(!a->asname); + a->asname = PyString_InternFromString(STR(CHILD(n, 2))); + return a; + } + break; + case dotted_name: + if (NCH(n) == 1) + return alias(PyString_InternFromString(STR(CHILD(n, 0))), NULL); + else { + /* Create a string of the form "a.b.c" */ + int i, len; + PyObject *str; + char *s; + + len = 0; + for (i = 0; i < NCH(n); i += 2) + /* length of string plus one for the dot */ + len += strlen(STR(CHILD(n, i))) + 1; + len--; /* the last name doesn't have a dot */ + str = PyString_FromStringAndSize(NULL, len); + s = PyString_AS_STRING(str); + for (i = 0; i < NCH(n); i += 2) { + char *sch = STR(CHILD(n, i)); + strcpy(s, STR(CHILD(n, i))); + s += strlen(sch); + *s++ = '.'; + } + --s; + *s = '\0'; + PyString_InternInPlace(&str); + return alias(str, NULL); + } + break; + case STAR: + return alias(PyString_InternFromString("*"), NULL); + default: + return NULL; + } + return NULL; + } + static stmt_ty ast_for_import_stmt(node *n) *************** *** 477,490 **** | 'from' dotted_name 'import' ('*' | import_as_name (',' import_as_name)*) - import_as_name: NAME [NAME NAME] - dotted_as_name: dotted_name [NAME NAME] - dotted_name: NAME ('.' NAME)* */ ! ! /* XXX how to represent dotted names? */ REQ(n, import_stmt); if (STR(CHILD(n, 0))[0] == 'i') { /* import */ } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ } return NULL; --- 550,569 ---- | 'from' dotted_name 'import' ('*' | import_as_name (',' import_as_name)*) */ ! int i; ! asdl_seq *aliases; REQ(n, import_stmt); if (STR(CHILD(n, 0))[0] == 'i') { /* import */ + aliases = asdl_seq_new(NCH(n) / 2); + for (i = 1; i < NCH(n); i += 2) + asdl_seq_append(aliases, alias_for_import_name(CHILD(n, i))); + return Import(aliases); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ + alias_ty mod = alias_for_import_name(CHILD(n, 1)); + aliases = asdl_seq_new((NCH(n) - 2) / 2); + for (i = 3; i <= NCH(n); i += 2) + asdl_seq_append(aliases, alias_for_import_name(CHILD(n, i))); + return ImportFrom(mod->name, aliases); } return NULL; *************** *** 541,548 **** --- 620,709 ---- } + static asdl_seq * + ast_for_suite(node *n) + { + /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */ + asdl_seq *seq; + int i; + fprintf(stderr, "ast_for_suite(%d)\n", TYPE(n)); + REQ(n, suite); + + fprintf(stderr, "ast_for_suite(CHILD(n, 0)==%d)\n", TYPE(CHILD(n, 0))); + + if (NCH(n) == 1) { + /* XXX punt on stmt; stmt */ + REQ(CHILD(n, 0), simple_stmt); + seq = asdl_seq_new(1); + asdl_seq_append(seq, ast_for_stmt(CHILD(n, 0))); + return seq; + } + fprintf(stderr, "\t%d\n", NCH(n)); + /* one child node for each stmt, plus 3 children for NL, {, & } */ + seq = asdl_seq_new(NCH(n) - 3); + for (i = 2; i < NCH(n) - 1; i++) { + fprintf(stderr, "\t%d: %d %d\n", i, TYPE(CHILD(n, i)), + NCH(CHILD(n, i))); + REQ(CHILD(n, i), stmt); + asdl_seq_append(seq, ast_for_stmt(CHILD(n, i))); + } + return seq; + } + static stmt_ty ast_for_if_stmt(node *n) { + /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)* + ['else' ':' suite] + */ REQ(n, if_stmt); + char *s; + + if (NCH(n) == 4) + return If(ast_for_expr(CHILD(n, 1)), + ast_for_suite(CHILD(n, 3)), NULL); + s = STR(CHILD(n, 4)); + /* s[2], the third character in the string, will be + 's' for el_s_e, or + 'i' for el_i_f + */ + if (s[2] == 's') + return If(ast_for_expr(CHILD(n, 1)), + ast_for_suite(CHILD(n, 3)), + ast_for_suite(CHILD(n, 6))); + else { + int i, n_elif, has_else = 0; + asdl_seq *orelse = NULL; + n_elif = NCH(n) - 4; + if (TYPE(CHILD(n, n_elif)) == NAME + && STR(CHILD(n, n_elif))[2] == 's') { + has_else = 1; + n_elif -= 3; + } + n_elif /= 4; + + if (has_else) { + orelse = asdl_seq_new(1); + asdl_seq_append(orelse, + If(ast_for_expr(CHILD(n, NCH(n) - 6)), + ast_for_suite(CHILD(n, NCH(n) - 4)), + ast_for_suite(CHILD(n, NCH(n) - 1)))); + /* the just-created orelse handled the last elif */ + n_elif--; + } else + orelse = NULL; + + for (i = 0; i < n_elif; i++) { + int off = 5 + (n_elif - i - 1) * 4; + orelse = asdl_seq_new(1); + asdl_seq_append(orelse, + If(ast_for_expr(CHILD(n, off)), + ast_for_suite(CHILD(n, off + 2)), + orelse)); + } + return If(ast_for_expr(CHILD(n, 1)), + ast_for_suite(CHILD(n, 3)), + orelse); + } + return NULL; } *************** *** 551,555 **** --- 712,720 ---- ast_for_while_stmt(node *n) { + /* while_stmt: 'while' test ':' suite ['else' ':' suite] */ REQ(n, while_stmt); + + + return NULL; } *************** *** 558,562 **** --- 723,746 ---- ast_for_for_stmt(node *n) { + asdl_seq *_target = NULL, *seq = NULL; + expr_ty target; + /* for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] */ REQ(n, for_stmt); + + if (NCH(n) == 9) + seq = ast_for_suite(CHILD(n, 8)); + + _target = ast_for_exprlist(CHILD(n, 1), 0); + if (asdl_seq_LEN(_target) == 1) { + target = asdl_seq_get(_target, 0); + asdl_seq_free(_target); + } + else + target = Tuple(_target, Store); + + return For(target, + ast_for_testlist(CHILD(n, 3)), + ast_for_suite(CHILD(n, 5)), + seq); return NULL; } Index: test.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/test.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test.py 16 Apr 2002 23:43:00 -0000 1.2 --- test.py 19 Apr 2002 22:15:12 -0000 1.3 *************** *** 25,27 **** --- 25,62 ---- raise x, y raise x, y, b + import a + import a, b + import a as b + import a as b, c + import as as as, c + import a, b as c + from a import b + from a import b as c + from a import b, c + from a import b as c, d + from a import b, c as d + import a.b + from a.b import c + if a: + print b + a + if a: + a + else: + print b + c + if a: + a + elif b: + b + if a == 1: + a + elif b == 1: + b + elif c == c: + a + b + c + else: + pass """) From jhylton@sourceforge.net Fri Apr 19 23:56:40 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 15:56:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/compiler transformer.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory usw-pr-cvs1:/tmp/cvs-serv15229 Modified Files: transformer.py Log Message: Fix com_arglist() and update grammar fragment. SF bug #522264 reported by Evelyn Mitchell. The code included a comment about "STAR STAR" which was translated into the code as the bogus attribute token.STARSTAR. This name never caused an attribute error because it was never retrieved. The code was based on an old version of the grammar that specified kwargs as two tokens ('*' '*'). I checked as far back as 2.1 and didn't find this production. The fix is simple, because token.DOUBLESTAR is the only token allowed. Also update the grammar fragment in com_arglist(). XXX I'll bet lots of other grammar fragments in comments are out of date, probably in this module and in compile.c. Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** transformer.py 28 Feb 2002 17:48:48 -0000 1.32 --- transformer.py 19 Apr 2002 22:56:37 -0000 1.33 *************** *** 747,753 **** def com_arglist(self, nodelist): # varargslist: ! # (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] ! # | fpdef ['=' test] (',' fpdef ['=' test])* [','] ! # | ('**'|'*' '*') NAME) # fpdef: NAME | '(' fplist ')' # fplist: fpdef (',' fpdef)* [','] --- 747,752 ---- def com_arglist(self, nodelist): # varargslist: ! # (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) ! # | fpdef ['=' test] (',' fpdef ['=' test])* [','] # fpdef: NAME | '(' fplist ')' # fplist: fpdef (',' fpdef)* [','] *************** *** 768,777 **** if i < len(nodelist): ! # should be DOUBLESTAR or STAR STAR t = nodelist[i][0] if t == token.DOUBLESTAR: node = nodelist[i+1] - elif t == token.STARSTAR: - node = nodelist[i+2] else: raise ValueError, "unexpected token: %s" % t --- 767,774 ---- if i < len(nodelist): ! # should be DOUBLESTAR t = nodelist[i][0] if t == token.DOUBLESTAR: node = nodelist[i+1] else: raise ValueError, "unexpected token: %s" % t From jhylton@sourceforge.net Fri Apr 19 23:58:13 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 15:58:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/compiler transformer.py,1.30.8.1,1.30.8.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory usw-pr-cvs1:/tmp/cvs-serv15903 Modified Files: Tag: release22-maint transformer.py Log Message: Backport fix for SF #522274 from trunk. Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v retrieving revision 1.30.8.1 retrieving revision 1.30.8.1.2.1 diff -C2 -d -r1.30.8.1 -r1.30.8.1.2.1 *** transformer.py 21 Dec 2001 16:11:33 -0000 1.30.8.1 --- transformer.py 19 Apr 2002 22:58:11 -0000 1.30.8.1.2.1 *************** *** 747,753 **** def com_arglist(self, nodelist): # varargslist: ! # (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] ! # | fpdef ['=' test] (',' fpdef ['=' test])* [','] ! # | ('**'|'*' '*') NAME) # fpdef: NAME | '(' fplist ')' # fplist: fpdef (',' fpdef)* [','] --- 747,752 ---- def com_arglist(self, nodelist): # varargslist: ! # (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) ! # | fpdef ['=' test] (',' fpdef ['=' test])* [','] # fpdef: NAME | '(' fplist ')' # fplist: fpdef (',' fpdef)* [','] *************** *** 768,777 **** if i < len(nodelist): ! # should be DOUBLESTAR or STAR STAR t = nodelist[i][0] if t == token.DOUBLESTAR: node = nodelist[i+1] - elif t == token.STARSTAR: - node = nodelist[i+2] else: raise ValueError, "unexpected token: %s" % t --- 767,774 ---- if i < len(nodelist): ! # should be DOUBLESTAR t = nodelist[i][0] if t == token.DOUBLESTAR: node = nodelist[i+1] else: raise ValueError, "unexpected token: %s" % t From tim_one@sourceforge.net Sat Apr 20 03:08:00 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 19:08:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv31070 Modified Files: prechm.py Log Message: Added "What's New" to the 2.2 doc set. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** prechm.py 19 Apr 2002 18:41:46 -0000 1.4 --- prechm.py 20 Apr 2002 02:07:58 -0000 1.5 *************** *** 105,108 **** --- 105,109 ---- [ ('.', 'Global Module Index', 'modindex.html', None, None), + ('whatsnew', "What's New", 'index.html', 'contents.html', None), ('tut','Tutorial','tut.html','node2.html',None), ('lib','Library Reference','lib.html','contents.html','genindex.html'), From tim_one@sourceforge.net Sat Apr 20 03:37:09 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 19:37:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv4375 Modified Files: prechm.py Log Message: do_project(): Modernized the code. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** prechm.py 20 Apr 2002 02:07:58 -0000 1.5 --- prechm.py 20 Apr 2002 02:37:07 -0000 1.6 *************** *** 302,313 **** output.write(contents_footer) ! ! def do_project( library, output, arch, version) : output.write(project_template % locals()) ! for book in library : ! for page in os.listdir(book[0]) : ! if page[string.rfind(page, '.'):] == '.html' or \ ! page[string.rfind(page, '.'):] == '.css': ! output.write(book[0]+ '\\' + page + '\n') --- 302,316 ---- output.write(contents_footer) ! # Fill in the [FILES] section of the project (.hhp) file. ! # 'library' is the list of directory description tuples from ! # supported_libraries for the version of the docs getting generated. ! def do_project(library, output, arch, version): output.write(project_template % locals()) ! for book in library: ! directory = book[0] ! path = directory + '\\%s\n' ! for page in os.listdir(directory): ! if page.endswith('.html') or page.endswith('.css'): ! output.write(path % page) *************** *** 386,389 **** if __name__ == '__main__' : do_it() - - --- 389,390 ---- From tim_one@sourceforge.net Sat Apr 20 03:39:46 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 19:39:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv4713 Modified Files: prechm.py Log Message: All over: get rid of blanks before colons that open code blocks. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** prechm.py 20 Apr 2002 02:37:07 -0000 1.6 --- prechm.py 20 Apr 2002 02:39:44 -0000 1.7 *************** *** 99,103 **** # Library Doc list of tuples: ! # each 'book' : ( Dir, Title, First page, Content page, Index page) # supported_libraries = { --- 99,103 ---- # Library Doc list of tuples: ! # each 'book' : (Dir, Title, First page, Content page, Index page) # supported_libraries = { *************** *** 179,186 **** } ! class AlmostNullWriter(formatter.NullWriter) : savedliteral = '' ! def send_flowing_data(self, data) : # need the text tag for later datastriped = string.strip(data) --- 179,186 ---- } ! class AlmostNullWriter(formatter.NullWriter): savedliteral = '' ! def send_flowing_data(self, data): # need the text tag for later datastriped = string.strip(data) *************** *** 192,196 **** ! class HelpHtmlParser(htmllib.HTMLParser) : indent = 0 # number of tabs for pritty printing of files ft = None # output file --- 192,196 ---- ! class HelpHtmlParser(htmllib.HTMLParser): indent = 0 # number of tabs for pritty printing of files ft = None # output file *************** *** 199,216 **** # (some headers, footers, etc.) ! def begin_group(self) : ! if not self.proc : # first level, start processing self.proc = 1 self.indent = self.indent + 1 ! def finnish_group(self) : self.indent = self.indent - 1 ! if self.proc and self.indent == 0 : # if processing and back to root, then stop self.proc = 0 ! def anchor_bgn(self, href, name, type) : ! if self.proc : self.formatter.writer.savedliteral = '' self.ft.write('\n') --- 199,216 ---- # (some headers, footers, etc.) ! def begin_group(self): ! if not self.proc: # first level, start processing self.proc = 1 self.indent = self.indent + 1 ! def finnish_group(self): self.indent = self.indent - 1 ! if self.proc and self.indent == 0: # if processing and back to root, then stop self.proc = 0 ! def anchor_bgn(self, href, name, type): ! if self.proc: self.formatter.writer.savedliteral = '' self.ft.write('\n') *************** *** 219,268 **** '/' + href + '">\n') ! def anchor_end(self) : ! if self.proc : self.ft.write('\t' * self.indent + \ '\t\n') ! self.ft.write('\t' * self.indent + '\t\n' ) ! def start_dl(self, atr_val) : self.begin_group() ! def end_dl(self) : self.finnish_group() ! def do_dt(self, atr_val) : # no trailing newline on pourpose! self.ft.write("\t" * self.indent + "
  • ") ! class IdxHlpHtmlParser(HelpHtmlParser) : # nothing special here, seems enough with parent class pass ! class TocHlpHtmlParser(HelpHtmlParser) : ! def start_dl(self, atr_val) : self.begin_group() self.ft.write('\t' * self.indent + '
      \n') ! def end_dl(self) : self.finnish_group() self.ft.write('
    \n') ! def start_ul(self, atr_val) : self.begin_group() self.ft.write('\t' * self.indent + '
      \n') ! def end_ul(self) : self.finnish_group() self.ft.write('
    \n') ! def do_li(self, atr_val) : # no trailing newline on pourpose! self.ft.write("\t" * self.indent + "
  • ") ! def index(path, archivo, output) : f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) --- 219,268 ---- '/' + href + '">\n') ! def anchor_end(self): ! if self.proc: self.ft.write('\t' * self.indent + \ '\t\n') ! self.ft.write('\t' * self.indent + '\t
  • \n') ! def start_dl(self, atr_val): self.begin_group() ! def end_dl(self): self.finnish_group() ! def do_dt(self, atr_val): # no trailing newline on pourpose! self.ft.write("\t" * self.indent + "
  • ") ! class IdxHlpHtmlParser(HelpHtmlParser): # nothing special here, seems enough with parent class pass ! class TocHlpHtmlParser(HelpHtmlParser): ! def start_dl(self, atr_val): self.begin_group() self.ft.write('\t' * self.indent + '
      \n') ! def end_dl(self): self.finnish_group() self.ft.write('
    \n') ! def start_ul(self, atr_val): self.begin_group() self.ft.write('\t' * self.indent + '
      \n') ! def end_ul(self): self.finnish_group() self.ft.write('
    \n') ! def do_li(self, atr_val): # no trailing newline on pourpose! self.ft.write("\t" * self.indent + "
  • ") ! def index(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) *************** *** 274,278 **** ! def content(path, archivo, output) : f = formatter.AbstractFormatter(AlmostNullWriter()) parser = TocHlpHtmlParser(f) --- 274,278 ---- ! def content(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = TocHlpHtmlParser(f) *************** *** 284,302 **** ! def do_index(library, output) : output.write('
      \n') ! for book in library : print '\t', book[2] ! if book[4] : index(book[0], book[4], output) output.write('
    \n') ! def do_content(library, version, output) : output.write(contents_header % version) ! for book in library : print '\t', book[2] output.write(object_sitemap % (book[0]+"/"+book[2], book[1])) ! if book[3] : content(book[0], book[3], output) output.write(contents_footer) --- 284,302 ---- ! def do_index(library, output): output.write('
      \n') ! for book in library: print '\t', book[2] ! if book[4]: index(book[0], book[4], output) output.write('
    \n') ! def do_content(library, version, output): output.write(contents_header % version) ! for book in library: print '\t', book[2] output.write(object_sitemap % (book[0]+"/"+book[2], book[1])) ! if book[3]: content(book[0], book[3], output) output.write(contents_footer) *************** *** 315,327 **** ! def openfile(file) : ! try : p = open(file, "w") ! except IOError, msg : print file, ":", msg sys.exit(1) return p ! def usage() : print usage_mode sys.exit(0) --- 315,327 ---- ! def openfile(file): ! try: p = open(file, "w") ! except IOError, msg: print file, ":", msg sys.exit(1) return p ! def usage(): print usage_mode sys.exit(0) *************** *** 329,346 **** ! def do_it(args = None) : ! if not args : args = sys.argv[1:] ! if not args : usage() ! try : optlist, args = getopt.getopt(args, 'ckpv:') ! except getopt.error, msg : print msg usage() ! if not args or len(args) > 1 : usage() arch = args[0] --- 329,346 ---- ! def do_it(args = None): ! if not args: args = sys.argv[1:] ! if not args: usage() ! try: optlist, args = getopt.getopt(args, 'ckpv:') ! except getopt.error, msg: print msg usage() ! if not args or len(args) > 1: usage() arch = args[0] *************** *** 356,360 **** library = supported_libraries[ version ] ! if not (('-p','') in optlist) : fname = arch + '.stp' f = openfile(fname) --- 356,360 ---- library = supported_libraries[ version ] ! if not (('-p','') in optlist): fname = arch + '.stp' f = openfile(fname) *************** *** 375,379 **** f.close() ! if not (('-c','') in optlist) : f = openfile(arch + '.hhc') print "Building Table of Content..." --- 375,379 ---- f.close() ! if not (('-c','') in optlist): f = openfile(arch + '.hhc') print "Building Table of Content..." *************** *** 381,385 **** f.close() ! if not (('-k','') in optlist) : f = openfile(arch + '.hhk') print "Building Index..." --- 381,385 ---- f.close() ! if not (('-k','') in optlist): f = openfile(arch + '.hhk') print "Building Index..." *************** *** 387,390 **** f.close() ! if __name__ == '__main__' : do_it() --- 387,390 ---- f.close() ! if __name__ == '__main__': do_it() From tim_one@sourceforge.net Sat Apr 20 03:56:22 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 19:56:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv7819 Modified Files: prechm.py Log Message: Fixed a comment. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** prechm.py 20 Apr 2002 02:39:44 -0000 1.7 --- prechm.py 20 Apr 2002 02:56:20 -0000 1.8 *************** *** 87,91 **** # 256 or 512 bytes (including \r\n at the end of each line). # Note that "and", "or", "not" and "near" are operators in the search ! # language, so not point indexing them even if wanted to. stop_list = ''' a an and --- 87,91 ---- # 256 or 512 bytes (including \r\n at the end of each line). # Note that "and", "or", "not" and "near" are operators in the search ! # language, so no point indexing them even if we wanted to. stop_list = ''' a an and From tim_one@sourceforge.net Sat Apr 20 04:25:04 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 19 Apr 2002 20:25:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv14735 Modified Files: prechm.py Log Message: Replaced the fiddly 5-tuples with a new Book convenience class, allowing to reference fields via names instead of meaningless little integers. This turned up one case where the wrong little integer was being used, in informative progress output. Fixed that too. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** prechm.py 20 Apr 2002 02:56:20 -0000 1.8 --- prechm.py 20 Apr 2002 03:25:02 -0000 1.9 *************** *** 98,146 **** ''' ! # Library Doc list of tuples: # each 'book' : (Dir, Title, First page, Content page, Index page) - # supported_libraries = { '2.2': ### Beta!!! fix for actual release [ ! ('.', 'Global Module Index', 'modindex.html', None, None), ! ('whatsnew', "What's New", 'index.html', 'contents.html', None), ! ('tut','Tutorial','tut.html','node2.html',None), ! ('lib','Library Reference','lib.html','contents.html','genindex.html'), ! ('ref','Language Reference','ref.html','contents.html','genindex.html'), ! ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ! ('ext','Extending and Embedding','ext.html','contents.html',None), ! ('api','Python/C API','api.html','contents.html','genindex.html'), ! ('doc','Documenting Python','doc.html','contents.html',None), ! ('inst','Installing Python Modules', 'inst.html', 'index.html', None), ! ('dist','Distributing Python Modules', 'dist.html', 'index.html', None), ], '2.1.1': [ ! ('.', 'Global Module Index', 'modindex.html', None, None), ! ('tut','Tutorial','tut.html','node2.html',None), ! ('lib','Library Reference','lib.html','contents.html','genindex.html'), ! ('ref','Language Reference','ref.html','contents.html','genindex.html'), ! ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ! ('ext','Extending and Embedding','ext.html','contents.html',None), ! ('api','Python/C API','api.html','contents.html','genindex.html'), ! ('doc','Documenting Python','doc.html','contents.html',None), ! ('inst','Installing Python Modules', 'inst.html', 'index.html', None), ! ('dist','Distributing Python Modules', 'dist.html', 'index.html', None), ], '2.0.0': [ ! ('.', 'Global Module Index', 'modindex.html', None, None), ! ('tut','Tutorial','tut.html','node2.html',None), ! ('lib','Library Reference','lib.html','contents.html','genindex.html'), ! ('ref','Language Reference','ref.html','contents.html','genindex.html'), ! ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ! ('ext','Extending and Embedding','ext.html','contents.html',None), ! ('api','Python/C API','api.html','contents.html','genindex.html'), ! ('doc','Documenting Python','doc.html','contents.html',None), ! ('inst','Installing Python Modules', 'inst.html', 'contents.html', None), ! ('dist','Distributing Python Modules', 'dist.html', 'contents.html', None), ], --- 98,164 ---- ''' ! # s is a string or None. If None or empty, return None. Else tack '.html' ! # on to the end, unless it's already there. ! def addhtml(s): ! if s: ! if not s.endswith('.html'): ! s += '.html' ! return s ! ! # Convenience class to hold info about "a book" in HTMLHelp terms == a doc ! # directory in Python terms. ! class Book: ! def __init__(self, directory, title, firstpage, ! contentpage=None, indexpage=None): ! self.directory = directory ! self.title = title ! self.firstpage = addhtml(firstpage) ! self.contentpage = addhtml(contentpage) ! self.indexpage = addhtml(indexpage) ! ! # Library Doc list of books: # each 'book' : (Dir, Title, First page, Content page, Index page) supported_libraries = { '2.2': ### Beta!!! fix for actual release [ ! Book('.', 'Global Module Index', 'modindex'), ! Book('whatsnew', "What's New", 'index', 'contents'), ! Book('tut','Tutorial','tut','node2'), ! Book('lib','Library Reference','lib','contents','genindex'), ! Book('ref','Language Reference','ref','contents','genindex'), ! Book('mac','Macintosh Reference','mac','contents','genindex'), ! Book('ext','Extending and Embedding','ext','contents'), ! Book('api','Python/C API','api','contents','genindex'), ! Book('doc','Documenting Python','doc','contents'), ! Book('inst','Installing Python Modules', 'inst', 'index'), ! Book('dist','Distributing Python Modules', 'dist', 'index'), ], '2.1.1': [ ! Book('.', 'Global Module Index', 'modindex'), ! Book('tut','Tutorial','tut','node2'), ! Book('lib','Library Reference','lib','contents','genindex'), ! Book('ref','Language Reference','ref','contents','genindex'), ! Book('mac','Macintosh Reference','mac','contents','genindex'), ! Book('ext','Extending and Embedding','ext','contents'), ! Book('api','Python/C API','api','contents','genindex'), ! Book('doc','Documenting Python','doc','contents'), ! Book('inst','Installing Python Modules', 'inst', 'index'), ! Book('dist','Distributing Python Modules', 'dist', 'index'), ], '2.0.0': [ ! Book('.', 'Global Module Index', 'modindex'), ! Book('tut','Tutorial','tut','node2'), ! Book('lib','Library Reference','lib','contents','genindex'), ! Book('ref','Language Reference','ref','contents','genindex'), ! Book('mac','Macintosh Reference','mac','contents','genindex'), ! Book('ext','Extending and Embedding','ext','contents'), ! Book('api','Python/C API','api','contents','genindex'), ! Book('doc','Documenting Python','doc','contents'), ! Book('inst','Installing Python Modules', 'inst', 'contents'), ! Book('dist','Distributing Python Modules', 'dist', 'contents'), ], *************** *** 149,159 **** '1.5.2': [ ! ('tut','Tutorial','tut.html','node2.html',None), ! ('lib','Library Reference','lib.html','contents.html','genindex.html'), ! ('ref','Language Reference','ref.html','contents.html','genindex.html'), ! ('mac','Macintosh Reference','mac.html','contents.html','genindex.html'), ! ('ext','Extending and Embedding','ext.html','contents.html',None), ! ('api','Python/C API','api.html','contents.html','genindex.html'), ! ('doc','Documenting Python','doc.html','contents.html',None) ], --- 167,177 ---- '1.5.2': [ ! Book('tut','Tutorial','tut','node2'), ! Book('lib','Library Reference','lib','contents','genindex'), ! Book('ref','Language Reference','ref','contents','genindex'), ! Book('mac','Macintosh Reference','mac','contents','genindex'), ! Book('ext','Extending and Embedding','ext','contents'), ! Book('api','Python/C API','api','contents','genindex'), ! Book('doc','Documenting Python','doc','contents') ], *************** *** 161,169 **** '1.5.1': [ ! ('tut','Tutorial','tut.html','contents.html',None), ! ('lib','Library Reference','lib.html','contents.html','genindex.html'), ! ('ref','Language Reference','ref-1.html','ref-2.html','ref-11.html'), ! ('ext','Extending and Embedding','ext.html','contents.html',None), ! ('api','Python/C API','api.html','contents.html','genindex.html') ], --- 179,187 ---- '1.5.1': [ ! Book('tut','Tutorial','tut','contents'), ! Book('lib','Library Reference','lib','contents','genindex'), ! Book('ref','Language Reference','ref-1','ref-2','ref-11'), ! Book('ext','Extending and Embedding','ext','contents'), ! Book('api','Python/C API','api','contents','genindex') ], *************** *** 171,179 **** '1.5': [ ! ('tut','Tutorial','tut.html','node1.html',None), ! ('lib','Library Reference','lib.html','node1.html','node268.html'), ! ('ref','Language Reference','ref-1.html','ref-2.html','ref-11.html'), ! ('ext','Extending and Embedding','ext.html','node1.html',None), ! ('api','Python/C API','api.html','node1.html','node48.html') ] } --- 189,197 ---- '1.5': [ ! Book('tut','Tutorial','tut','node1'), ! Book('lib','Library Reference','lib','node1','node268'), ! Book('ref','Language Reference','ref-1','ref-2','ref-11'), ! Book('ext','Extending and Embedding','ext','node1'), ! Book('api','Python/C API','api','node1','node48') ] } *************** *** 264,285 **** ! def index(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) parser.path = path parser.ft = output ! fil = path + '/' + archivo ! parser.feed(open(fil).read()) parser.close() ! def content(path, archivo, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = TocHlpHtmlParser(f) parser.path = path parser.ft = output ! fil = path + '/' + archivo ! parser.feed(open(fil).read()) parser.close() --- 282,305 ---- ! def index(path, indexpage, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = IdxHlpHtmlParser(f) parser.path = path parser.ft = output ! f = open(path + '/' + indexpage) ! parser.feed(f.read()) parser.close() + f.close() ! def content(path, contentpage, output): f = formatter.AbstractFormatter(AlmostNullWriter()) parser = TocHlpHtmlParser(f) parser.path = path parser.ft = output ! f = open(path + '/' + contentpage) ! parser.feed(f.read()) parser.close() + f.close() *************** *** 287,293 **** output.write('
      \n') for book in library: ! print '\t', book[2] ! if book[4]: ! index(book[0], book[4], output) output.write('
    \n') --- 307,313 ---- output.write('
      \n') for book in library: ! print '\t', book.title, '-', book.indexpage ! if book.indexpage: ! index(book.directory, book.indexpage, output) output.write('
    \n') *************** *** 296,303 **** output.write(contents_header % version) for book in library: ! print '\t', book[2] ! output.write(object_sitemap % (book[0]+"/"+book[2], book[1])) ! if book[3]: ! content(book[0], book[3], output) output.write(contents_footer) --- 316,324 ---- output.write(contents_header % version) for book in library: ! print '\t', book.title, '-', book.firstpage ! output.write(object_sitemap % (book.directory + "/" + book.firstpage, ! book.title)) ! if book.contentpage: ! content(book.directory, book.contentpage, output) output.write(contents_footer) *************** *** 308,312 **** output.write(project_template % locals()) for book in library: ! directory = book[0] path = directory + '\\%s\n' for page in os.listdir(directory): --- 329,333 ---- output.write(project_template % locals()) for book in library: ! directory = book.directory path = directory + '\\%s\n' for page in os.listdir(directory): *************** *** 354,358 **** usage() ! library = supported_libraries[ version ] if not (('-p','') in optlist): --- 375,379 ---- usage() ! library = supported_libraries[version] if not (('-p','') in optlist): From jhylton@sourceforge.net Sat Apr 20 05:46:57 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 21:46:57 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30827 Modified Files: frameobject.c Log Message: Fix SF bug #505315: Make free and cell vars show up consistently in locals(). PyFrame_FastToLocals() and PyFrame_LocalsToFast() had a return if f_nlocals was 0. I think this was a holdover from the pre 2.1 days when regular locals were the only kind of local variables. The change makes it possible to use a free variable in eval or exec if it the variable is also used elsewhere in the same block, which is what the documentation says. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** frameobject.c 13 Apr 2002 05:21:47 -0000 2.61 --- frameobject.c 20 Apr 2002 04:46:55 -0000 2.62 *************** *** 417,422 **** } } - if (f->f_nlocals == 0) - return; map = f->f_code->co_varnames; if (!PyDict_Check(locals) || !PyTuple_Check(map)) --- 417,420 ---- *************** *** 427,431 **** if (j > f->f_nlocals) j = f->f_nlocals; ! map_to_dict(map, j, locals, fast, 0); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) --- 425,430 ---- if (j > f->f_nlocals) j = f->f_nlocals; ! if (f->f_nlocals) ! map_to_dict(map, j, locals, fast, 0); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) *************** *** 456,460 **** locals = f->f_locals; map = f->f_code->co_varnames; ! if (locals == NULL || f->f_code->co_nlocals == 0) return; if (!PyDict_Check(locals) || !PyTuple_Check(map)) --- 455,459 ---- locals = f->f_locals; map = f->f_code->co_varnames; ! if (locals == NULL) return; if (!PyDict_Check(locals) || !PyTuple_Check(map)) *************** *** 465,469 **** if (j > f->f_nlocals) j = f->f_nlocals; ! dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) --- 464,469 ---- if (j > f->f_nlocals) j = f->f_nlocals; ! if (f->f_nlocals) ! dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) *************** *** 475,479 **** dict_to_map(f->f_code->co_freevars, PyTuple_GET_SIZE(f->f_code->co_freevars), ! locals, fast + f->f_nlocals + f->f_ncells, 1, clear); } PyErr_Restore(error_type, error_value, error_traceback); --- 475,480 ---- dict_to_map(f->f_code->co_freevars, PyTuple_GET_SIZE(f->f_code->co_freevars), ! locals, fast + f->f_nlocals + f->f_ncells, 1, ! clear); } PyErr_Restore(error_type, error_value, error_traceback); From jhylton@sourceforge.net Sat Apr 20 05:51:38 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 21:51:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_scope.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31718 Modified Files: test_scope.py Log Message: Add test for eval() w/ free variables. Related to SF bug #505315 Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_scope.py 3 Mar 2002 15:12:58 -0000 1.25 --- test_scope.py 20 Apr 2002 04:51:36 -0000 1.26 *************** *** 513,514 **** --- 513,524 ---- except NameError: pass + + print "22. eval with free variables" + + def f(x): + def g(): + x + eval("x + 1") + return g + + f(4)() From jhylton@sourceforge.net Sat Apr 20 05:51:41 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 21:51:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_scope,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv31731 Modified Files: test_scope Log Message: Add test for eval() w/ free variables. Related to SF bug #505315 Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_scope 13 Dec 2001 19:47:51 -0000 1.11 --- test_scope 20 Apr 2002 04:51:39 -0000 1.12 *************** *** 22,23 **** --- 22,24 ---- 20. eval and exec with free variables 21. list comprehension with local variables + 22. eval with free variables From jhylton@sourceforge.net Sat Apr 20 06:06:39 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 22:06:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_scope.py,1.24.4.1,1.24.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2429 Modified Files: Tag: release22-maint test_scope.py Log Message: backport fix for SF buf #505315 from trunk Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.24.4.1 retrieving revision 1.24.4.2 diff -C2 -d -r1.24.4.1 -r1.24.4.2 *** test_scope.py 3 Mar 2002 15:17:07 -0000 1.24.4.1 --- test_scope.py 20 Apr 2002 05:06:36 -0000 1.24.4.2 *************** *** 513,514 **** --- 513,524 ---- except NameError: pass + + print "22. eval with free variables" + + def f(x): + def g(): + x + eval("x + 1") + return g + + f(4)() From jhylton@sourceforge.net Sat Apr 20 06:06:52 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 22:06:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_scope,1.11,1.11.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv2496 Modified Files: Tag: release22-maint test_scope Log Message: backport fix for SF buf #505315 from trunk Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.11 retrieving revision 1.11.6.1 diff -C2 -d -r1.11 -r1.11.6.1 *** test_scope 13 Dec 2001 19:47:51 -0000 1.11 --- test_scope 20 Apr 2002 05:06:50 -0000 1.11.6.1 *************** *** 22,23 **** --- 22,24 ---- 20. eval and exec with free variables 21. list comprehension with local variables + 22. eval with free variables From jhylton@sourceforge.net Sat Apr 20 06:07:07 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Fri, 19 Apr 2002 22:07:07 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.59.6.2,2.59.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2588 Modified Files: Tag: release22-maint frameobject.c Log Message: backport fix for SF buf #505315 from trunk Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.59.6.2 retrieving revision 2.59.6.3 diff -C2 -d -r2.59.6.2 -r2.59.6.3 *** frameobject.c 13 Apr 2002 05:25:28 -0000 2.59.6.2 --- frameobject.c 20 Apr 2002 05:07:05 -0000 2.59.6.3 *************** *** 417,422 **** } } - if (f->f_nlocals == 0) - return; map = f->f_code->co_varnames; if (!PyDict_Check(locals) || !PyTuple_Check(map)) --- 417,420 ---- *************** *** 427,431 **** if (j > f->f_nlocals) j = f->f_nlocals; ! map_to_dict(map, j, locals, fast, 0); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) --- 425,430 ---- if (j > f->f_nlocals) j = f->f_nlocals; ! if (f->f_nlocals) ! map_to_dict(map, j, locals, fast, 0); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) *************** *** 456,460 **** locals = f->f_locals; map = f->f_code->co_varnames; ! if (locals == NULL || f->f_code->co_nlocals == 0) return; if (!PyDict_Check(locals) || !PyTuple_Check(map)) --- 455,459 ---- locals = f->f_locals; map = f->f_code->co_varnames; ! if (locals == NULL) return; if (!PyDict_Check(locals) || !PyTuple_Check(map)) *************** *** 465,469 **** if (j > f->f_nlocals) j = f->f_nlocals; ! dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) --- 464,469 ---- if (j > f->f_nlocals) j = f->f_nlocals; ! if (f->f_nlocals) ! dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) From loewis@sourceforge.net Sat Apr 20 08:45:27 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sat, 20 Apr 2002 00:45:27 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.42.10.4,1.42.10.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5498/Lib Modified Files: Tag: release22-maint httplib.py Log Message: Patch #500311: Work around for buggy https servers. Fixes #494762. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.42.10.4 retrieving revision 1.42.10.5 diff -C2 -d -r1.42.10.4 -r1.42.10.5 *** httplib.py 25 Mar 2002 12:24:58 -0000 1.42.10.4 --- httplib.py 20 Apr 2002 07:45:24 -0000 1.42.10.5 *************** *** 632,636 **** or 0): continue ! if err[0] == socket.SSL_ERROR_ZERO_RETURN: break raise --- 632,637 ---- or 0): continue ! if (err[0] == socket.SSL_ERROR_ZERO_RETURN ! or err[0] == socket.SSL_ERROR_EOF): break raise From loewis@sourceforge.net Sat Apr 20 08:45:27 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sat, 20 Apr 2002 00:45:27 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.200.6.3,1.200.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5498/Modules Modified Files: Tag: release22-maint socketmodule.c Log Message: Patch #500311: Work around for buggy https servers. Fixes #494762. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.200.6.3 retrieving revision 1.200.6.4 diff -C2 -d -r1.200.6.3 -r1.200.6.4 *** socketmodule.c 25 Mar 2002 17:40:43 -0000 1.200.6.3 --- socketmodule.c 20 Apr 2002 07:45:25 -0000 1.200.6.4 *************** *** 283,286 **** --- 283,300 ---- #ifdef USE_SSL static PyObject *PySSLErrorObject; + enum py_ssl_error { + /* these mirror ssl.h */ + PY_SSL_ERROR_NONE, + PY_SSL_ERROR_SSL, + PY_SSL_ERROR_WANT_READ, + PY_SSL_ERROR_WANT_WRITE, + PY_SSL_ERROR_WANT_X509_LOOKUP, + PY_SSL_ERROR_SYSCALL, /* look at error stack/return value/errno */ + PY_SSL_ERROR_ZERO_RETURN, + PY_SSL_ERROR_WANT_CONNECT, + /* start of non ssl.h errorcodes */ + PY_SSL_ERROR_EOF, /* special case of SSL_ERROR_SYSCALL */ + PY_SSL_ERROR_INVALID_ERROR_CODE + }; #endif /* USE_SSL */ *************** *** 2632,2682 **** char *errstr; int err; assert(ret <= 0); err = SSL_get_error(ssl, ret); - n = PyInt_FromLong(err); - if (n == NULL) - return NULL; - v = PyTuple_New(2); - if (v == NULL) { - Py_DECREF(n); - return NULL; - } ! switch (SSL_get_error(ssl, ret)) { case SSL_ERROR_ZERO_RETURN: errstr = "TLS/SSL connection has been closed"; break; case SSL_ERROR_WANT_READ: errstr = "The operation did not complete (read)"; break; case SSL_ERROR_WANT_WRITE: errstr = "The operation did not complete (write)"; break; case SSL_ERROR_WANT_X509_LOOKUP: errstr = "The operation did not complete (X509 lookup)"; break; case SSL_ERROR_SYSCALL: - case SSL_ERROR_SSL: { unsigned long e = ERR_get_error(); ! if (e == 0) { ! /* an EOF was observed that violates the protocol */ ! errstr = "EOF occurred in violation of protocol"; ! } else if (e == -1) { ! /* the underlying BIO reported an I/O error */ ! Py_DECREF(v); ! Py_DECREF(n); ! return PySocket_Err(); } else { /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); } break; } default: errstr = "Invalid error code"; } s = PyString_FromString(errstr); if (s == NULL) { --- 2646,2722 ---- char *errstr; int err; + enum py_ssl_error p; assert(ret <= 0); err = SSL_get_error(ssl, ret); ! switch (err) { case SSL_ERROR_ZERO_RETURN: errstr = "TLS/SSL connection has been closed"; + p=PY_SSL_ERROR_ZERO_RETURN; break; case SSL_ERROR_WANT_READ: errstr = "The operation did not complete (read)"; + p=PY_SSL_ERROR_WANT_READ; break; case SSL_ERROR_WANT_WRITE: + p=PY_SSL_ERROR_WANT_WRITE; errstr = "The operation did not complete (write)"; break; case SSL_ERROR_WANT_X509_LOOKUP: + p=PY_SSL_ERROR_WANT_X509_LOOKUP; errstr = "The operation did not complete (X509 lookup)"; break; + case SSL_ERROR_WANT_CONNECT: + p=PY_SSL_ERROR_WANT_CONNECT; + errstr = "The operation did not complete (connect)"; + break; case SSL_ERROR_SYSCALL: { unsigned long e = ERR_get_error(); ! if(e==0){ ! if(ret==0){ ! p=PY_SSL_ERROR_EOF; ! errstr = "EOF occurred in violation of protocol"; ! }else if(ret==-1){ ! /* the underlying BIO reported an I/O error */ ! return PySocket_Err(); ! }else{ /* possible? */ ! p=PY_SSL_ERROR_SYSCALL; ! errstr = "Some I/O error occurred"; ! } } else { + p=PY_SSL_ERROR_SYSCALL; + /* XXX Protected by global interpreter lock */ + errstr = ERR_error_string(e, NULL); + } + break; + } + case SSL_ERROR_SSL: + { + unsigned long e = ERR_get_error(); + p=PY_SSL_ERROR_SSL; + if (e !=0) { /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); + } else { /* possible? */ + errstr="A failure in the SSL library occurred"; } break; } default: + p=PY_SSL_ERROR_INVALID_ERROR_CODE; errstr = "Invalid error code"; } + n = PyInt_FromLong((long) p); + if (n == NULL) + return NULL; + v = PyTuple_New(2); + if (v == NULL) { + Py_DECREF(n); + return NULL; + } + s = PyString_FromString(errstr); if (s == NULL) { *************** *** 3176,3190 **** return; PyModule_AddIntConstant(m, "SSL_ERROR_ZERO_RETURN", ! SSL_ERROR_ZERO_RETURN); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_READ", ! SSL_ERROR_WANT_READ); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_WRITE", ! SSL_ERROR_WANT_WRITE); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_X509_LOOKUP", ! SSL_ERROR_WANT_X509_LOOKUP); PyModule_AddIntConstant(m, "SSL_ERROR_SYSCALL", ! SSL_ERROR_SYSCALL); PyModule_AddIntConstant(m, "SSL_ERROR_SSL", ! SSL_ERROR_SSL); #endif /* USE_SSL */ if (PyDict_SetItemString(d, "SocketType", --- 3216,3238 ---- return; PyModule_AddIntConstant(m, "SSL_ERROR_ZERO_RETURN", ! PY_SSL_ERROR_ZERO_RETURN); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_READ", ! PY_SSL_ERROR_WANT_READ); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_WRITE", ! PY_SSL_ERROR_WANT_WRITE); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_X509_LOOKUP", ! PY_SSL_ERROR_WANT_X509_LOOKUP); PyModule_AddIntConstant(m, "SSL_ERROR_SYSCALL", ! PY_SSL_ERROR_SYSCALL); PyModule_AddIntConstant(m, "SSL_ERROR_SSL", ! PY_SSL_ERROR_SSL); ! PyModule_AddIntConstant(m, "SSL_ERROR_WANT_CONNECT", ! PY_SSL_ERROR_WANT_CONNECT); ! /* non ssl.h errorcodes */ ! PyModule_AddIntConstant(m, "SSL_ERROR_EOF", ! PY_SSL_ERROR_EOF); ! PyModule_AddIntConstant(m, "SSL_ERROR_INVALID_ERROR_CODE", ! PY_SSL_ERROR_INVALID_ERROR_CODE); ! #endif /* USE_SSL */ if (PyDict_SetItemString(d, "SocketType", From loewis@sourceforge.net Sat Apr 20 08:47:41 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sat, 20 Apr 2002 00:47:41 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5973/Lib Modified Files: httplib.py Log Message: Forward port of patch # 500311: Work around for buggy https servers. Fixes #494762. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** httplib.py 24 Mar 2002 16:56:45 -0000 1.49 --- httplib.py 20 Apr 2002 07:47:39 -0000 1.50 *************** *** 634,638 **** or err[0] == socket.SSL_ERROR_WANT_WRITE): continue ! if err[0] == socket.SSL_ERROR_ZERO_RETURN: break raise --- 634,639 ---- or err[0] == socket.SSL_ERROR_WANT_WRITE): continue ! if (err[0] == socket.SSL_ERROR_ZERO_RETURN ! or err[0] == socket.SSL_ERROR_EOF): break raise From loewis@sourceforge.net Sat Apr 20 08:47:42 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sat, 20 Apr 2002 00:47:42 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.169,1.170 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5973/Misc Modified Files: ACKS Log Message: Forward port of patch # 500311: Work around for buggy https servers. Fixes #494762. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** ACKS 19 Apr 2002 15:59:01 -0000 1.169 --- ACKS 20 Apr 2002 07:47:39 -0000 1.170 *************** *** 39,42 **** --- 39,43 ---- Juan M. Bello Rivas Andy Bensky + Michel Van den Bergh Eric Beser Stephen Bevan From loewis@sourceforge.net Sat Apr 20 08:47:42 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sat, 20 Apr 2002 00:47:42 -0700 Subject: [Python-checkins] python/dist/src/Modules _ssl.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5973/Modules Modified Files: _ssl.c Log Message: Forward port of patch # 500311: Work around for buggy https servers. Fixes #494762. Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _ssl.c 16 Feb 2002 18:23:30 -0000 1.1 --- _ssl.c 20 Apr 2002 07:47:40 -0000 1.2 *************** *** 9,12 **** --- 9,26 ---- #include "Python.h" + enum py_ssl_error { + /* these mirror ssl.h */ + PY_SSL_ERROR_NONE, + PY_SSL_ERROR_SSL, + PY_SSL_ERROR_WANT_READ, + PY_SSL_ERROR_WANT_WRITE, + PY_SSL_ERROR_WANT_X509_LOOKUP, + PY_SSL_ERROR_SYSCALL, /* look at error stack/return value/errno */ + PY_SSL_ERROR_ZERO_RETURN, + PY_SSL_ERROR_WANT_CONNECT, + /* start of non ssl.h errorcodes */ + PY_SSL_ERROR_EOF, /* special case of SSL_ERROR_SYSCALL */ + PY_SSL_ERROR_INVALID_ERROR_CODE + }; /* Include symbols from _socket module */ *************** *** 65,115 **** char *errstr; int err; assert(ret <= 0); err = SSL_get_error(obj->ssl, ret); - n = PyInt_FromLong(err); - if (n == NULL) - return NULL; - v = PyTuple_New(2); - if (v == NULL) { - Py_DECREF(n); - return NULL; - } ! switch (SSL_get_error(obj->ssl, ret)) { case SSL_ERROR_ZERO_RETURN: errstr = "TLS/SSL connection has been closed"; break; case SSL_ERROR_WANT_READ: errstr = "The operation did not complete (read)"; break; case SSL_ERROR_WANT_WRITE: errstr = "The operation did not complete (write)"; break; case SSL_ERROR_WANT_X509_LOOKUP: errstr = "The operation did not complete (X509 lookup)"; break; case SSL_ERROR_SYSCALL: - case SSL_ERROR_SSL: { unsigned long e = ERR_get_error(); ! if (e == 0) { ! /* an EOF was observed that violates the protocol */ ! errstr = "EOF occurred in violation of protocol"; ! } else if (e == -1) { ! /* the underlying BIO reported an I/O error */ ! Py_DECREF(v); ! Py_DECREF(n); ! return obj->Socket->errorhandler(); } else { /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); } break; } default: errstr = "Invalid error code"; } s = PyString_FromString(errstr); if (s == NULL) { --- 79,155 ---- char *errstr; int err; + enum py_ssl_error p; assert(ret <= 0); err = SSL_get_error(obj->ssl, ret); ! switch (err) { case SSL_ERROR_ZERO_RETURN: errstr = "TLS/SSL connection has been closed"; + p=PY_SSL_ERROR_ZERO_RETURN; break; case SSL_ERROR_WANT_READ: errstr = "The operation did not complete (read)"; + p=PY_SSL_ERROR_WANT_READ; break; case SSL_ERROR_WANT_WRITE: + p=PY_SSL_ERROR_WANT_WRITE; errstr = "The operation did not complete (write)"; break; case SSL_ERROR_WANT_X509_LOOKUP: + p=PY_SSL_ERROR_WANT_X509_LOOKUP; errstr = "The operation did not complete (X509 lookup)"; break; + case SSL_ERROR_WANT_CONNECT: + p=PY_SSL_ERROR_WANT_CONNECT; + errstr = "The operation did not complete (connect)"; + break; case SSL_ERROR_SYSCALL: { unsigned long e = ERR_get_error(); ! if(e==0){ ! if(ret==0){ ! p=PY_SSL_ERROR_EOF; ! errstr = "EOF occurred in violation of protocol"; ! }else if(ret==-1){ ! /* the underlying BIO reported an I/O error */ ! return obj->Socket->errorhandler(); ! }else{ /* possible? */ ! p=PY_SSL_ERROR_SYSCALL; ! errstr = "Some I/O error occurred"; ! } } else { + p=PY_SSL_ERROR_SYSCALL; + /* XXX Protected by global interpreter lock */ + errstr = ERR_error_string(e, NULL); + } + break; + } + case SSL_ERROR_SSL: + { + unsigned long e = ERR_get_error(); + p=PY_SSL_ERROR_SSL; + if (e !=0) { /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); + } else { /* possible? */ + errstr="A failure in the SSL library occurred"; } break; } default: + p=PY_SSL_ERROR_INVALID_ERROR_CODE; errstr = "Invalid error code"; } + n = PyInt_FromLong((long) p); + if (n == NULL) + return NULL; + v = PyTuple_New(2); + if (v == NULL) { + Py_DECREF(n); + return NULL; + } + s = PyString_FromString(errstr); if (s == NULL) { *************** *** 448,461 **** return; PyModule_AddIntConstant(m, "SSL_ERROR_ZERO_RETURN", ! SSL_ERROR_ZERO_RETURN); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_READ", ! SSL_ERROR_WANT_READ); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_WRITE", ! SSL_ERROR_WANT_WRITE); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_X509_LOOKUP", ! SSL_ERROR_WANT_X509_LOOKUP); PyModule_AddIntConstant(m, "SSL_ERROR_SYSCALL", ! SSL_ERROR_SYSCALL); PyModule_AddIntConstant(m, "SSL_ERROR_SSL", ! SSL_ERROR_SSL); } --- 488,509 ---- return; PyModule_AddIntConstant(m, "SSL_ERROR_ZERO_RETURN", ! PY_SSL_ERROR_ZERO_RETURN); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_READ", ! PY_SSL_ERROR_WANT_READ); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_WRITE", ! PY_SSL_ERROR_WANT_WRITE); PyModule_AddIntConstant(m, "SSL_ERROR_WANT_X509_LOOKUP", ! PY_SSL_ERROR_WANT_X509_LOOKUP); PyModule_AddIntConstant(m, "SSL_ERROR_SYSCALL", ! PY_SSL_ERROR_SYSCALL); PyModule_AddIntConstant(m, "SSL_ERROR_SSL", ! PY_SSL_ERROR_SSL); ! PyModule_AddIntConstant(m, "SSL_ERROR_WANT_CONNECT", ! PY_SSL_ERROR_WANT_CONNECT); ! /* non ssl.h errorcodes */ ! PyModule_AddIntConstant(m, "SSL_ERROR_EOF", ! PY_SSL_ERROR_EOF); ! PyModule_AddIntConstant(m, "SSL_ERROR_INVALID_ERROR_CODE", ! PY_SSL_ERROR_INVALID_ERROR_CODE); ! } From tim_one@sourceforge.net Sat Apr 20 09:36:45 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 01:36:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv14323 Modified Files: prechm.py Log Message: Widespread: Used classes in a more natural way. Added convenience methods to squash code duplication. Simplified several overly complex chunks of logic. Built output strings more with string interpolation instead of infix '+'. Added comments. Exploited recent Python features (chiefly bool and augmented assignment). Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** prechm.py 20 Apr 2002 03:25:02 -0000 1.9 --- prechm.py 20 Apr 2002 08:36:42 -0000 1.10 *************** *** 18,23 **** import sys import os ! import formatter ! import htmllib import string import getopt --- 18,23 ---- import sys import os ! from formatter import NullWriter, AbstractFormatter ! from htmllib import HTMLParser import string import getopt *************** *** 197,246 **** } ! class AlmostNullWriter(formatter.NullWriter): ! savedliteral = '' def send_flowing_data(self, data): ! # need the text tag for later ! datastriped = string.strip(data) ! if self.savedliteral == '': ! self.savedliteral = datastriped ! else: ! self.savedliteral = string.strip(self.savedliteral + ! ' ' + datastriped) ! class HelpHtmlParser(htmllib.HTMLParser): ! indent = 0 # number of tabs for pritty printing of files ! ft = None # output file ! path = None # relative path ! proc = 0 # if true I process, if false I skip ! # (some headers, footers, etc.) def begin_group(self): ! if not self.proc: ! # first level, start processing ! self.proc = 1 ! self.indent = self.indent + 1 ! def finnish_group(self): ! self.indent = self.indent - 1 ! if self.proc and self.indent == 0: ! # if processing and back to root, then stop ! self.proc = 0 def anchor_bgn(self, href, name, type): if self.proc: ! self.formatter.writer.savedliteral = '' ! self.ft.write('\n') ! self.ft.write('\t' * self.indent + \ ! '\t\n') def anchor_end(self): if self.proc: ! self.ft.write('\t' * self.indent + \ ! '\t\n') ! self.ft.write('\t' * self.indent + '\t\n') def start_dl(self, atr_val): --- 197,253 ---- } ! # AlmostNullWriter doesn't print anything; it just arranges to save the ! # text sent to send_flowing_data(). This is used to capture the text ! # between an anchor begin/end pair, e.g. for TOC entries. ! ! class AlmostNullWriter(NullWriter): ! ! def __init__(self): ! NullWriter.__init__(self) ! self.saved_clear() def send_flowing_data(self, data): ! stripped = data.strip() ! if stripped: # don't bother to save runs of whitespace ! self.saved.append(stripped) + # Forget all saved text. + def saved_clear(self): + self.saved = [] ! # Return all saved text as a string. ! def saved_get(self): ! return ' '.join(self.saved) ! ! class HelpHtmlParser(HTMLParser): ! ! def __init__(self, formatter, path, output): ! HTMLParser.__init__(self, formatter) ! self.path = path # relative path ! self.ft = output # output file ! self.indent = 0 # number of tabs for pretty printing of files ! self.proc = False # True when actively processing, else False ! # (headers, footers, etc) def begin_group(self): ! self.indent += 1 ! self.proc = True ! def finish_group(self): ! self.indent -= 1 ! # stop processing when back to top level ! self.proc = self.indent > 0 def anchor_bgn(self, href, name, type): if self.proc: ! self.saved_clear() ! self.write('\n') ! self.tab('\t\n' % ! (self.path, href)) def anchor_end(self): if self.proc: ! self.tab('\t\n' % self.saved_get()) ! self.tab('\t\n') def start_dl(self, atr_val): *************** *** 248,257 **** def end_dl(self): ! self.finnish_group() def do_dt(self, atr_val): ! # no trailing newline on pourpose! ! self.ft.write("\t" * self.indent + "
  • ") class IdxHlpHtmlParser(HelpHtmlParser): --- 255,281 ---- def end_dl(self): ! self.finish_group() def do_dt(self, atr_val): ! # no trailing newline on purpose! ! self.tab("
  • ") ! ! # Write text to output file. ! def write(self, text): ! self.ft.write(text) + # Write text to output file after indenting by self.indent tabs. + def tab(self, text=''): + self.write('\t' * self.indent) + if text: + self.write(text) + + # Forget all saved text. + def saved_clear(self): + self.formatter.writer.saved_clear() + + # Return all saved text as a string. + def saved_get(self): + return self.formatter.writer.saved_get() class IdxHlpHtmlParser(HelpHtmlParser): *************** *** 263,290 **** def start_dl(self, atr_val): self.begin_group() ! self.ft.write('\t' * self.indent + '
      \n') def end_dl(self): ! self.finnish_group() ! self.ft.write('
    \n') def start_ul(self, atr_val): self.begin_group() ! self.ft.write('\t' * self.indent + '
      \n') def end_ul(self): ! self.finnish_group() ! self.ft.write('
    \n') def do_li(self, atr_val): ! # no trailing newline on pourpose! ! self.ft.write("\t" * self.indent + "
  • ") ! def index(path, indexpage, output): ! f = formatter.AbstractFormatter(AlmostNullWriter()) ! parser = IdxHlpHtmlParser(f) ! parser.path = path ! parser.ft = output f = open(path + '/' + indexpage) parser.feed(f.read()) --- 287,311 ---- def start_dl(self, atr_val): self.begin_group() ! self.tab('
      \n') def end_dl(self): ! self.finish_group() ! self.tab('
    \n') def start_ul(self, atr_val): self.begin_group() ! self.tab('
      \n') def end_ul(self): ! self.finish_group() ! self.tab('
    \n') def do_li(self, atr_val): ! # no trailing newline on purpose! ! self.tab("
  • ") def index(path, indexpage, output): ! parser = IdxHlpHtmlParser(AbstractFormatter(AlmostNullWriter()), ! path, output) f = open(path + '/' + indexpage) parser.feed(f.read()) *************** *** 292,301 **** f.close() - def content(path, contentpage, output): ! f = formatter.AbstractFormatter(AlmostNullWriter()) ! parser = TocHlpHtmlParser(f) ! parser.path = path ! parser.ft = output f = open(path + '/' + contentpage) parser.feed(f.read()) --- 313,319 ---- f.close() def content(path, contentpage, output): ! parser = TocHlpHtmlParser(AbstractFormatter(AlmostNullWriter()), ! path, output) f = open(path + '/' + contentpage) parser.feed(f.read()) *************** *** 303,307 **** f.close() - def do_index(library, output): output.write('
      \n') --- 321,324 ---- *************** *** 312,316 **** output.write('
    \n') - def do_content(library, version, output): output.write(contents_header % version) --- 329,332 ---- *************** *** 335,339 **** output.write(path % page) - def openfile(file): try: --- 351,354 ---- *************** *** 347,352 **** print usage_mode sys.exit(0) - - def do_it(args = None): --- 362,365 ---- From loewis@sourceforge.net Sat Apr 20 14:44:03 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sat, 20 Apr 2002 06:44:03 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.139,2.140 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30961 Modified Files: unicodeobject.c Log Message: Patch #495401: Count number of required bytes for encoding UTF-8 before allocating the target buffer. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.139 retrieving revision 2.140 diff -C2 -d -r2.139 -r2.140 *** unicodeobject.c 15 Apr 2002 18:42:15 -0000 2.139 --- unicodeobject.c 20 Apr 2002 13:44:01 -0000 2.140 *************** *** 1173,1182 **** #endif - /* Allocation strategy: we default to Latin-1, then do one resize - whenever we hit an order boundary. The assumption is that - characters from higher orders usually occur often enough to warrant - this. - */ - PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, int size, --- 1173,1176 ---- *************** *** 1185,1211 **** PyObject *v; char *p; ! int i = 0; ! int overalloc = 2; ! int len; ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! v = PyString_FromStringAndSize(NULL, overalloc * size); if (v == NULL) return NULL; p = PyString_AS_STRING(v); ! ! while (i < size) { Py_UCS4 ch = s[i++]; ! if (ch < 0x80) ! /* Encode ASCII */ *p++ = (char) ch; else if (ch < 0x0800) { - /* Encode Latin-1 */ *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); --- 1179,1221 ---- PyObject *v; char *p; ! unsigned int allocated = 0; ! int i; ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! for (i = 0; i < size; ) { ! Py_UCS4 ch = s[i++]; ! if (ch < 0x80) ! allocated += 1; ! else if (ch < 0x0800) ! allocated += 2; ! else if (ch < 0x10000) { ! /* Check for high surrogate */ ! if (0xD800 <= ch && ch <= 0xDBFF && ! i != size && ! 0xDC00 <= s[i] && s[i] <= 0xDFFF) { ! allocated += 1; ! i++; ! } ! allocated += 3; ! } else ! allocated += 4; ! } ! ! v = PyString_FromStringAndSize(NULL, allocated); if (v == NULL) return NULL; p = PyString_AS_STRING(v); ! for (i = 0; i < size; ) { Py_UCS4 ch = s[i++]; ! if (ch < 0x80) { *p++ = (char) ch; + } else if (ch < 0x0800) { *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); *************** *** 1213,1268 **** else { ! /* Encode UCS2 Unicode ordinals */ if (ch < 0x10000) { ! ! /* Special case: check for high surrogate */ if (0xD800 <= ch && ch <= 0xDBFF && i != size) { Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate and combine the two to ! form a UCS4 value */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; ! i++; ! goto encodeUCS4; } /* Fall through: handles isolated high surrogates */ } - - if (overalloc < 3) { - len = (int)(p - PyString_AS_STRING(v)); - overalloc = 3; - if (_PyString_Resize(&v, overalloc * size)) - goto onError; - p = PyString_AS_STRING(v) + len; - } *p++ = (char)(0xe0 | (ch >> 12)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); ! continue; ! } ! ! /* Encode UCS4 Unicode ordinals */ ! encodeUCS4: ! if (overalloc < 4) { ! len = (int)(p - PyString_AS_STRING(v)); ! overalloc = 4; ! if (_PyString_Resize(&v, overalloc * size)) ! goto onError; ! p = PyString_AS_STRING(v) + len; } - *p++ = (char)(0xf0 | (ch >> 18)); - *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); - *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); - *p++ = (char)(0x80 | (ch & 0x3f)); } } ! *p = '\0'; ! if (_PyString_Resize(&v, (int)(p - PyString_AS_STRING(v)))) ! goto onError; return v; - - onError: - Py_DECREF(v); - return NULL; } --- 1223,1257 ---- else { ! if (ch < 0x10000) { ! /* Check for high surrogate */ if (0xD800 <= ch && ch <= 0xDBFF && i != size) { Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000; ! *p++ = (char)((ch >> 18) | 0xf0); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! i++; ! continue; } /* Fall through: handles isolated high surrogates */ } *p++ = (char)(0xe0 | (ch >> 12)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); ! ! } else { ! *p++ = (char)(0xf0 | (ch>>18)); ! *p++ = (char)(0x80 | ((ch>>12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch>>6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); } } } ! assert(p - PyString_AS_STRING(v) == allocated); return v; } From nnorwitz@sourceforge.net Sat Apr 20 14:46:46 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sat, 20 Apr 2002 06:46:46 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.230,2.231 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31932/Modules Modified Files: posixmodule.c Log Message: #546163, fix link problem on Solaris 8 for makedev when using mknod Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.230 retrieving revision 2.231 diff -C2 -d -r2.230 -r2.231 *** posixmodule.c 19 Apr 2002 14:58:40 -0000 2.230 --- posixmodule.c 20 Apr 2002 13:46:43 -0000 2.231 *************** *** 279,282 **** --- 279,285 ---- #endif + #if defined(HAVE_MKNOD) && defined(HAVE_SYS_MKDEV_H) + #include + #endif /* Return a dictionary corresponding to the POSIX environment table */ From nnorwitz@sourceforge.net Sat Apr 20 14:46:46 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sat, 20 Apr 2002 06:46:46 -0700 Subject: [Python-checkins] python/dist/src configure,1.302,1.303 configure.in,1.312,1.313 pyconfig.h.in,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv31932 Modified Files: configure configure.in pyconfig.h.in Log Message: #546163, fix link problem on Solaris 8 for makedev when using mknod Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.302 retrieving revision 1.303 diff -C2 -d -r1.302 -r1.303 *** configure 18 Apr 2002 14:51:33 -0000 1.302 --- configure 20 Apr 2002 13:46:42 -0000 1.303 *************** *** 3855,3862 **** for ac_header in dlfcn.h fcntl.h grp.h limits.h langinfo.h \ libintl.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ --- 3855,3863 ---- + for ac_header in dlfcn.h fcntl.h grp.h limits.h langinfo.h \ libintl.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h db_185.h db.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.312 retrieving revision 1.313 diff -C2 -d -r1.312 -r1.313 *** configure.in 18 Apr 2002 14:51:36 -0000 1.312 --- configure.in 20 Apr 2002 13:46:43 -0000 1.313 *************** *** 595,599 **** libintl.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ --- 595,599 ---- libintl.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h db_185.h db.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pyconfig.h.in 16 Apr 2002 05:51:02 -0000 1.32 --- pyconfig.h.in 20 Apr 2002 13:46:43 -0000 1.33 *************** *** 476,479 **** --- 476,482 ---- #undef HAVE_SYS_LOCK_H + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_MKDEV_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MODEM_H From mal@lemburg.com Sat Apr 20 16:26:05 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Sat, 20 Apr 2002 17:26:05 +0200 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.139,2.140 References: Message-ID: <3CC1888D.D434DDB3@lemburg.com> loewis@sourceforge.net wrote: > > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv30961 > > Modified Files: > unicodeobject.c > Log Message: > Patch #495401: Count number of required bytes for encoding UTF-8 before > allocating the target buffer. Martin, please back out this change again. We have discussed this quite a few times and I am against using your strategy since it introduces a performance hit which does not relate to the gained advantage of (temporarily) using less memory. Your timings also show this, so I wonder why you checked in this patch, e.g. from the patch log: """ For the current CVS (unicodeobject.c 2.136: MAL's change to use a variable overalloc), I get 10 spaces 20.060 100 spaces 2.600 200 spaces 2.030 1000 spaces 0.930 10000 spaces 0.690 10 spaces, 3 bytes 23.520 100 spaces, 3 bytes 3.730 200 spaces, 3 bytes 2.470 1000 spaces, 3 bytes 0.980 10000 spaces, 3 bytes 0.690 30 bytes 24.800 300 bytes 5.220 600 bytes 3.830 3000 bytes 2.480 30000 bytes 2.230 With unicode3.diff (that's the one you checked in), I get 10 spaces 19.940 100 spaces 3.260 200 spaces 2.340 1000 spaces 1.650 10000 spaces 1.450 10 spaces, 3 bytes 21.420 100 spaces, 3 bytes 3.410 200 spaces, 3 bytes 2.420 1000 spaces, 3 bytes 1.660 10000 spaces, 3 bytes 1.450 30 bytes 22.260 300 bytes 5.830 600 bytes 4.700 3000 bytes 3.740 30000 bytes 3.540 """ The only case where your patch is faster is for very short strings and then only by a few percent, whereas for all longer strings you get worse timings, e.g. 3.74 seconds compared to 2.48 seconds -- that's a 50% increase in run-time ! Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From jhylton@sourceforge.net Sat Apr 20 19:21:01 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sat, 20 Apr 2002 11:21:01 -0700 Subject: [Python-checkins] python/dist/src/Include compile.h,2.29,2.29.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv7175 Modified Files: Tag: release21-maint compile.h Log Message: Backport fixes for two nested scopes bugs. frameobject.c: make sure free and cell vars make it into locals, which makes eval work. bltinmodule.c & ceval.c: make sure a code object with free variables that is passed to exec or eval raises an exception. Also duplicate the current trunk test suite in the 2.1 branch, except for certain necessary changes: different warnings raised by 2.1, need for __future__. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.29 retrieving revision 2.29.2.1 diff -C2 -d -r2.29 -r2.29.2.1 *** compile.h 22 Mar 2001 02:32:48 -0000 2.29 --- compile.h 20 Apr 2002 18:20:59 -0000 2.29.2.1 *************** *** 38,41 **** --- 38,42 ---- #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) + #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ From jhylton@sourceforge.net Sat Apr 20 19:21:05 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sat, 20 Apr 2002 11:21:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_scope.py,1.14.2.2,1.14.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7217 Modified Files: Tag: release21-maint test_scope.py Log Message: Backport fixes for two nested scopes bugs. frameobject.c: make sure free and cell vars make it into locals, which makes eval work. bltinmodule.c & ceval.c: make sure a code object with free variables that is passed to exec or eval raises an exception. Also duplicate the current trunk test suite in the 2.1 branch, except for certain necessary changes: different warnings raised by 2.1, need for __future__. Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.14.2.2 retrieving revision 1.14.2.3 diff -C2 -d -r1.14.2.2 -r1.14.2.3 *** test_scope.py 23 May 2001 13:26:29 -0000 1.14.2.2 --- test_scope.py 20 Apr 2002 18:21:03 -0000 1.14.2.3 *************** *** 1,5 **** from __future__ import nested_scopes ! from test.test_support import verify, TestFailed, check_syntax print "1. simple nesting" --- 1,9 ---- from __future__ import nested_scopes ! from test_support import verify, TestFailed, check_syntax ! ! import warnings ! warnings.filterwarnings("ignore", r"(import \*|local name|unqualified)", ! SyntaxWarning, "") print "1. simple nesting" *************** *** 180,184 **** print "11. unoptimized namespaces" ! check_syntax("""from __future__ import nested_scopes def unoptimized_clash1(strip): def f(s): --- 184,189 ---- print "11. unoptimized namespaces" ! check_syntax("""\ ! from __future__ import nested_scopes def unoptimized_clash1(strip): def f(s): *************** *** 188,192 **** """) ! check_syntax("""from __future__ import nested_scopes def unoptimized_clash2(): from string import * --- 193,198 ---- """) ! check_syntax("""\ ! from __future__ import nested_scopes def unoptimized_clash2(): from string import * *************** *** 196,200 **** """) ! check_syntax("""from __future__ import nested_scopes def unoptimized_clash2(): from string import * --- 202,207 ---- """) ! check_syntax("""\ ! from __future__ import nested_scopes def unoptimized_clash2(): from string import * *************** *** 206,210 **** # XXX could allow this for exec with const argument, but what's the point ! check_syntax("""from __future__ import nested_scopes def error(y): exec "a = 1" --- 213,218 ---- # XXX could allow this for exec with const argument, but what's the point ! check_syntax("""\ ! from __future__ import nested_scopes def error(y): exec "a = 1" *************** *** 214,218 **** """) ! check_syntax("""from __future__ import nested_scopes def f(x): def g(): --- 222,227 ---- """) ! check_syntax("""\ ! from __future__ import nested_scopes def f(x): def g(): *************** *** 221,225 **** """) ! check_syntax("""from __future__ import nested_scopes def f(): def g(): --- 230,235 ---- """) ! check_syntax("""\ ! from __future__ import nested_scopes def f(): def g(): *************** *** 230,233 **** --- 240,244 ---- # and verify a few cases that should work + exec """ def noproblem1(): from string import * *************** *** 244,247 **** --- 255,259 ---- global y y = x + """ print "12. lambdas" *************** *** 468,469 **** --- 480,533 ---- adaptgetter("foo", TestClass, (1, "")) sys.settrace(None) + + ##try: sys.settrace() + ##except TypeError: pass + ##else: raise TestFailed, 'sys.settrace() did not raise TypeError' + + print "20. eval and exec with free variables" + + def f(x): + return lambda: x + 1 + + g = f(3) + try: + eval(g.func_code) + except TypeError: + pass + else: + print "eval() should have failed, because code contained free vars" + + try: + exec g.func_code + except TypeError: + pass + else: + print "exec should have failed, because code contained free vars" + + print "21. list comprehension with local variables" + + try: + print bad + except NameError: + pass + else: + print "bad should not be defined" + + def x(): + [bad for s in 'a b' for bad in s.split()] + + x() + try: + print bad + except NameError: + pass + + print "22. eval with free variables" + + def f(free): + def g(): + free + eval("free + 1") + return g + + f(4)() From jhylton@sourceforge.net Sat Apr 20 19:21:09 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sat, 20 Apr 2002 11:21:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_scope,1.6.2.2,1.6.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv7244 Modified Files: Tag: release21-maint test_scope Log Message: Backport fixes for two nested scopes bugs. frameobject.c: make sure free and cell vars make it into locals, which makes eval work. bltinmodule.c & ceval.c: make sure a code object with free variables that is passed to exec or eval raises an exception. Also duplicate the current trunk test suite in the 2.1 branch, except for certain necessary changes: different warnings raised by 2.1, need for __future__. Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -C2 -d -r1.6.2.2 -r1.6.2.3 *** test_scope 23 May 2001 13:26:29 -0000 1.6.2.2 --- test_scope 20 Apr 2002 18:21:07 -0000 1.6.2.3 *************** *** 20,21 **** --- 20,24 ---- 19. var is bound and free in class 20. interaction with trace function + 20. eval and exec with free variables + 21. list comprehension with local variables + 22. eval with free variables From jhylton@sourceforge.net Sat Apr 20 19:21:18 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sat, 20 Apr 2002 11:21:18 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.49.2.1,2.49.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7282 Modified Files: Tag: release21-maint frameobject.c Log Message: Backport fixes for two nested scopes bugs. frameobject.c: make sure free and cell vars make it into locals, which makes eval work. bltinmodule.c & ceval.c: make sure a code object with free variables that is passed to exec or eval raises an exception. Also duplicate the current trunk test suite in the 2.1 branch, except for certain necessary changes: different warnings raised by 2.1, need for __future__. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.49.2.1 retrieving revision 2.49.2.2 diff -C2 -d -r2.49.2.1 -r2.49.2.2 *** frameobject.c 23 May 2001 13:26:29 -0000 2.49.2.1 --- frameobject.c 20 Apr 2002 18:21:16 -0000 2.49.2.2 *************** *** 313,318 **** } } - if (f->f_nlocals == 0) - return; map = f->f_code->co_varnames; if (!PyDict_Check(locals) || !PyTuple_Check(map)) --- 313,316 ---- *************** *** 323,327 **** if (j > f->f_nlocals) j = f->f_nlocals; ! map_to_dict(map, j, locals, fast, 0); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) --- 321,326 ---- if (j > f->f_nlocals) j = f->f_nlocals; ! if (f->f_nlocals) ! map_to_dict(map, j, locals, fast, 0); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) *************** *** 352,356 **** locals = f->f_locals; map = f->f_code->co_varnames; ! if (locals == NULL || f->f_code->co_nlocals == 0) return; if (!PyDict_Check(locals) || !PyTuple_Check(map)) --- 351,355 ---- locals = f->f_locals; map = f->f_code->co_varnames; ! if (locals == NULL) return; if (!PyDict_Check(locals) || !PyTuple_Check(map)) *************** *** 361,365 **** if (j > f->f_nlocals) j = f->f_nlocals; ! dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) --- 360,365 ---- if (j > f->f_nlocals) j = f->f_nlocals; ! if (f->f_nlocals) ! dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear); if (f->f_ncells || f->f_nfreevars) { if (!(PyTuple_Check(f->f_code->co_cellvars) From jhylton@sourceforge.net Sat Apr 20 19:21:31 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sat, 20 Apr 2002 11:21:31 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.197.2.1,2.197.2.2 ceval.c,2.238.2.6,2.238.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7304 Modified Files: Tag: release21-maint bltinmodule.c ceval.c Log Message: Backport fixes for two nested scopes bugs. frameobject.c: make sure free and cell vars make it into locals, which makes eval work. bltinmodule.c & ceval.c: make sure a code object with free variables that is passed to exec or eval raises an exception. Also duplicate the current trunk test suite in the 2.1 branch, except for certain necessary changes: different warnings raised by 2.1, need for __future__. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.197.2.1 retrieving revision 2.197.2.2 diff -C2 -d -r2.197.2.1 -r2.197.2.2 *** bltinmodule.c 23 May 2001 12:46:45 -0000 2.197.2.1 --- bltinmodule.c 20 Apr 2002 18:21:29 -0000 2.197.2.2 *************** *** 757,762 **** return NULL; } ! if (PyCode_Check(cmd)) return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); if (!PyString_Check(cmd) && !PyUnicode_Check(cmd)) { --- 757,768 ---- return NULL; } ! if (PyCode_Check(cmd)) { ! if (PyCode_GetNumFree((PyCodeObject *)cmd) > 0) { ! PyErr_SetString(PyExc_TypeError, ! "code object passed to eval() may not contain free variables"); ! return NULL; ! } return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); + } if (!PyString_Check(cmd) && !PyUnicode_Check(cmd)) { Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.238.2.6 retrieving revision 2.238.2.7 diff -C2 -d -r2.238.2.6 -r2.238.2.7 *** ceval.c 28 Mar 2002 20:21:21 -0000 2.238.2.6 --- ceval.c 20 Apr 2002 18:21:29 -0000 2.238.2.7 *************** *** 3515,3518 **** --- 3515,3523 ---- PyDict_SetItemString(globals, "__builtins__", f->f_builtins); if (PyCode_Check(prog)) { + if (PyCode_GetNumFree((PyCodeObject *)prog) > 0) { + PyErr_SetString(PyExc_TypeError, + "code object passed to exec may not contain free variables"); + return -1; + } v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals); } From tim_one@sourceforge.net Sat Apr 20 21:26:29 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 13:26:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv4632 Modified Files: prechm.py Log Message: Stopped all warnings from the HTML Help Compiler, by generating proper HTML (or, at least, proper in its view). The TOC file is now identical to what the HTML compiler itself generates, except for whitespace and a glitch identified below. The pretty-printing done by prechm.py is pretty much destroyed for now; if you need it pretty-printed, just make the Help Compiler save the files (it's got its own idea of pretty- printing anyway). Glitch: The title of Ref Man "2.1.6 Blank lines" shows up as a blank for now. This is because the relevant entry in ref/index.html contains nested anchors, and pychm really has no idea what to do with that. I hacked it for now to avoid any error messages or worse insanity, and filed a bug report against the docs. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** prechm.py 20 Apr 2002 08:36:42 -0000 1.10 --- prechm.py 20 Apr 2002 20:26:26 -0000 1.11 *************** *** 20,25 **** from formatter import NullWriter, AbstractFormatter from htmllib import HTMLParser - import string import getopt usage_mode = ''' --- 20,25 ---- from formatter import NullWriter, AbstractFormatter from htmllib import HTMLParser import getopt + import cgi usage_mode = ''' *************** *** 57,61 **** ''' ! contents_header = ''' --- 57,67 ---- ''' ! contents_header = '''\ ! ! ! ! ! ! *************** *** 63,85 ****
      !
    • ! ! !
        ''' ! contents_footer = ''' !
    ''' ! object_sitemap = ''' !
  • ! ! ! ''' - # List of words the full text search facility shouldn't index. This # becomes file ARCH.stp. Note that this list must be pretty small! --- 69,90 ----
    • !
    • ! ! !
        ''' ! contents_footer = '''\ !
    ''' ! object_sitemap = '''\ ! ! ! ! ''' # List of words the full text search facility shouldn't index. This # becomes file ARCH.stp. Note that this list must be pretty small! *************** *** 229,232 **** --- 234,240 ---- self.proc = False # True when actively processing, else False # (headers, footers, etc) + # XXX This shouldn't need to be a stack -- anchors shouldn't nest. + # XXX See SF bug . + self.hrefstack = [] # stack of hrefs from anchor begins def begin_group(self): *************** *** 242,253 **** if self.proc: self.saved_clear() ! self.write('\n') ! self.tab('\t\n' % ! (self.path, href)) def anchor_end(self): if self.proc: ! self.tab('\t\n' % self.saved_get()) ! self.tab('\t\n') def start_dl(self, atr_val): --- 250,265 ---- if self.proc: self.saved_clear() ! self.hrefstack.append(href) def anchor_end(self): if self.proc: ! title = cgi.escape(self.saved_get(), True) ! path = self.path + '/' + self.hrefstack.pop() ! # XXX See SF bug . ! # XXX index.html for the 2.2 language reference manual contains ! # XXX nested tags in the entry for the section on blank ! # XXX lines. We want to ignore the nested part completely. ! if len(self.hrefstack) == 0: ! self.tab(object_sitemap % (title, path)) def start_dl(self, atr_val): *************** *** 333,338 **** for book in library: print '\t', book.title, '-', book.firstpage ! output.write(object_sitemap % (book.directory + "/" + book.firstpage, ! book.title)) if book.contentpage: content(book.directory, book.contentpage, output) --- 345,351 ---- for book in library: print '\t', book.title, '-', book.firstpage ! path = book.directory + "/" + book.firstpage ! output.write('
  • ') ! output.write(object_sitemap % (book.title, path)) if book.contentpage: content(book.directory, book.contentpage, output) From tim_one@sourceforge.net Sat Apr 20 22:34:38 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 14:34:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv22988/python/Doc/tools Modified Files: prechm.py Log Message: Move "everything left one": the TOC now shows each doc directory as a distinct top-level node. Before they were all nested under an artificial top-level node, uselessly chewing up horizontal space, and ensuring that the only thing the user saw in the TOC upon opening the file was a single collapsed top-level folder. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** prechm.py 20 Apr 2002 20:26:26 -0000 1.11 --- prechm.py 20 Apr 2002 21:34:34 -0000 1.12 *************** *** 69,81 ****
      -
    • - - - -
        ''' contents_footer = '''\ !
    ''' --- 69,76 ----
      ''' contents_footer = '''\ !
    ''' *************** *** 125,130 **** # each 'book' : (Dir, Title, First page, Content page, Index page) supported_libraries = { ! '2.2': ### Beta!!! fix for actual release [ Book('.', 'Global Module Index', 'modindex'), Book('whatsnew', "What's New", 'index', 'contents'), --- 120,126 ---- # each 'book' : (Dir, Title, First page, Content page, Index page) supported_libraries = { ! '2.2': [ + Book('.', 'Main page', 'index'), Book('.', 'Global Module Index', 'modindex'), Book('whatsnew', "What's New", 'index', 'contents'), *************** *** 142,145 **** --- 138,142 ---- '2.1.1': [ + Book('.', 'Main page', 'index'), Book('.', 'Global Module Index', 'modindex'), Book('tut','Tutorial','tut','node2'), *************** *** 342,346 **** def do_content(library, version, output): ! output.write(contents_header % version) for book in library: print '\t', book.title, '-', book.firstpage --- 339,343 ---- def do_content(library, version, output): ! output.write(contents_header) for book in library: print '\t', book.title, '-', book.firstpage *************** *** 357,360 **** --- 354,358 ---- def do_project(library, output, arch, version): output.write(project_template % locals()) + pathseen = {} for book in library: directory = book.directory *************** *** 362,366 **** for page in os.listdir(directory): if page.endswith('.html') or page.endswith('.css'): ! output.write(path % page) def openfile(file): --- 360,367 ---- for page in os.listdir(directory): if page.endswith('.html') or page.endswith('.css'): ! fullpath = path % page ! if fullpath not in pathseen: ! output.write(fullpath) ! pathseen[fullpath] = True def openfile(file): From tim_one@sourceforge.net Sun Apr 21 03:01:04 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 19:01:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv8922 Modified Files: prechm.py Log Message: Give the Help viewer a font-size button. This isn't documented by MS, but is documented by others on the web, and the defn of the magic flag needed appears in MS's htmlhelp.h header file. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** prechm.py 20 Apr 2002 21:34:34 -0000 1.12 --- prechm.py 21 Apr 2002 02:01:01 -0000 1.13 *************** *** 37,40 **** --- 37,69 ---- # The magical numbers in the long line under [WINDOWS] set most of the # user-visible features (visible buttons, tabs, etc). + # About 0x10384e: This defines the buttons in the help viewer. The + # following defns are taken from htmlhelp.h. Not all possibilities + # actually work, and not all those that work are available from the Help + # Workshop GUI. In particular, the Zoom/Font button works and is not + # available from the GUI. The ones we're using are marked with 'x': + # + # 0x000002 Hide/Show x + # 0x000004 Back x + # 0x000008 Forward x + # 0x000010 Stop + # 0x000020 Refresh + # 0x000040 Home x + # 0x000080 Forward + # 0x000100 Back + # 0x000200 Notes + # 0x000400 Contents + # 0x000800 Locate x + # 0x001000 Options x + # 0x002000 Print x + # 0x004000 Index + # 0x008000 Search + # 0x010000 History + # 0x020000 Favorites + # 0x040000 Jump 1 + # 0x080000 Jump 2 + # 0x100000 Zoom/Font x + # 0x200000 TOC Next + # 0x400000 TOC Prev + project_template = ''' [OPTIONS] *************** *** 52,56 **** [WINDOWS] %(arch)s="Python %(version)s Documentation","%(arch)s.hhc","%(arch)s.hhk",\ ! "index.html","index.html",,,,,0x63520,220,0x384e,[271,372,740,718],,,,,,,0 [FILES] --- 81,85 ---- [WINDOWS] %(arch)s="Python %(version)s Documentation","%(arch)s.hhc","%(arch)s.hhk",\ ! "index.html","index.html",,,,,0x63520,220,0x10384e,[271,372,740,718],,,,,,,0 [FILES] From tim_one@sourceforge.net Sun Apr 21 04:26:39 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 20:26:39 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.140,2.141 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18503/python/objects Modified Files: unicodeobject.c Log Message: PyUnicode_EncodeUTF8: squash compiler wng. The difference of two pointers is a signed type. Changing "allocated" to a signed int makes undetected overflow more likely, but there was no overflow detection before either. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.140 retrieving revision 2.141 diff -C2 -d -r2.140 -r2.141 *** unicodeobject.c 20 Apr 2002 13:44:01 -0000 2.140 --- unicodeobject.c 21 Apr 2002 03:26:37 -0000 2.141 *************** *** 1173,1183 **** #endif ! PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, ! int size, ! const char *errors) { PyObject *v; char *p; ! unsigned int allocated = 0; int i; --- 1173,1184 ---- #endif ! PyObject * ! PyUnicode_EncodeUTF8(const Py_UNICODE *s, ! int size, ! const char *errors) { PyObject *v; char *p; ! int allocated = 0; int i; From tim_one@sourceforge.net Sun Apr 21 05:44:13 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 21:44:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv30013 Modified Files: prechm.py Log Message: Hack around the "2.1.6 Blank lines" bug in a way that the TOC still displays a recognizable section title (there are extra blanks at the end of it now, due to the nested anchor, but that's fine). Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** prechm.py 21 Apr 2002 02:01:01 -0000 1.13 --- prechm.py 21 Apr 2002 04:44:11 -0000 1.14 *************** *** 275,290 **** def anchor_bgn(self, href, name, type): if self.proc: - self.saved_clear() - self.hrefstack.append(href) - - def anchor_end(self): - if self.proc: - title = cgi.escape(self.saved_get(), True) - path = self.path + '/' + self.hrefstack.pop() # XXX See SF bug . ! # XXX index.html for the 2.2 language reference manual contains # XXX nested tags in the entry for the section on blank # XXX lines. We want to ignore the nested part completely. if len(self.hrefstack) == 0: self.tab(object_sitemap % (title, path)) --- 275,292 ---- def anchor_bgn(self, href, name, type): if self.proc: # XXX See SF bug . ! # XXX index.html for the 2.2.1 language reference manual contains # XXX nested tags in the entry for the section on blank # XXX lines. We want to ignore the nested part completely. if len(self.hrefstack) == 0: + self.saved_clear() + self.hrefstack.append(href) + + def anchor_end(self): + if self.proc: + # XXX See XXX above. + if self.hrefstack: + title = cgi.escape(self.saved_get(), True) + path = self.path + '/' + self.hrefstack.pop() self.tab(object_sitemap % (title, path)) From tim_one@sourceforge.net Sun Apr 21 07:12:04 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 20 Apr 2002 23:12:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_univnewlines.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10396 Modified Files: test_univnewlines.py Log Message: Assorted code cleanups for readability. Greatly boosted the size of the test data: this test fails on WIndows now if universal newlines are enabled (which they aren't yet, by default). I don't know whether the test will also fail on Linux now. Index: test_univnewlines.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_univnewlines.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_univnewlines.py 16 Apr 2002 01:38:40 -0000 1.2 --- test_univnewlines.py 21 Apr 2002 06:12:02 -0000 1.3 *************** *** 5,27 **** import sys ! DATA_TEMPLATE=[ "line1=1", ! "line2='this is a very long line designed to go past the magic " + ! "hundred character limit that is inside fileobject.c and which " + ! "is meant to speed up the common case, but we also want to test " + ! "the uncommon case, naturally.'", ! "def line3():pass" ] DATA_LF = "\n".join(DATA_TEMPLATE) + "\n" DATA_CR = "\r".join(DATA_TEMPLATE) + "\r" DATA_CRLF = "\r\n".join(DATA_TEMPLATE) + "\r\n" # Note that DATA_MIXED also tests the ability to recognize a lone \r # before end-of-file. DATA_MIXED = "\n".join(DATA_TEMPLATE) + "\r" ! DATA_SPLIT = map(lambda x: x+"\n", DATA_TEMPLATE) ! ! if not hasattr(sys.stdin, 'newlines'): ! raise test_support.TestSkipped, \ ! "This Python does not have universal newline support" class TestGenericUnivNewlines(unittest.TestCase): --- 5,33 ---- import sys ! if not hasattr(sys.stdin, 'newlines'): ! raise test_support.TestSkipped, \ ! "This Python does not have universal newline support" ! ! FATX = 'x' * (2**14) ! ! DATA_TEMPLATE = [ "line1=1", ! "line2='this is a very long line designed to go past the magic " + ! "hundred character limit that is inside fileobject.c and which " + ! "is meant to speed up the common case, but we also want to test " + ! "the uncommon case, naturally.'", ! "def line3():pass", ! "line4 = '%s'" % FATX, ] + DATA_LF = "\n".join(DATA_TEMPLATE) + "\n" DATA_CR = "\r".join(DATA_TEMPLATE) + "\r" DATA_CRLF = "\r\n".join(DATA_TEMPLATE) + "\r\n" + # Note that DATA_MIXED also tests the ability to recognize a lone \r # before end-of-file. DATA_MIXED = "\n".join(DATA_TEMPLATE) + "\r" ! DATA_SPLIT = [x + "\n" for x in DATA_TEMPLATE] ! del x class TestGenericUnivNewlines(unittest.TestCase): *************** *** 75,105 **** def test_execfile(self): ! dict = {} ! execfile(test_support.TESTFN, dict) ! func = dict['line3'] self.assertEqual(func.func_code.co_firstlineno, 3) class TestNativeNewlines(TestGenericUnivNewlines): ! NEWLINE=None ! DATA=DATA_LF ! READMODE='r' ! WRITEMODE='w' class TestCRNewlines(TestGenericUnivNewlines): ! NEWLINE='\r' ! DATA=DATA_CR class TestLFNewlines(TestGenericUnivNewlines): ! NEWLINE='\n' ! DATA=DATA_LF class TestCRLFNewlines(TestGenericUnivNewlines): ! NEWLINE='\r\n' ! DATA=DATA_CRLF class TestMixedNewlines(TestGenericUnivNewlines): ! NEWLINE=('\r', '\n') ! DATA=DATA_MIXED --- 81,112 ---- def test_execfile(self): ! namespace = {} ! execfile(test_support.TESTFN, namespace) ! func = namespace['line3'] self.assertEqual(func.func_code.co_firstlineno, 3) + self.assertEqual(namespace['line4'], FATX) class TestNativeNewlines(TestGenericUnivNewlines): ! NEWLINE = None ! DATA = DATA_LF ! READMODE = 'r' ! WRITEMODE = 'w' class TestCRNewlines(TestGenericUnivNewlines): ! NEWLINE = '\r' ! DATA = DATA_CR class TestLFNewlines(TestGenericUnivNewlines): ! NEWLINE = '\n' ! DATA = DATA_LF class TestCRLFNewlines(TestGenericUnivNewlines): ! NEWLINE = '\r\n' ! DATA = DATA_CRLF class TestMixedNewlines(TestGenericUnivNewlines): ! NEWLINE = ('\r', '\n') ! DATA = DATA_MIXED From tim_one@sourceforge.net Sun Apr 21 08:29:16 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 00:29:16 -0700 Subject: [Python-checkins] python/dist/src/Include fileobject.h,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23161/Include Modified Files: fileobject.h Log Message: Py_UniversalNewlineFread(): Many changes. + Continued looping until n bytes in the buffer have been filled, not just when n bytes have been read from the file. This repairs the bug that f.readlines() only sucked up the first 8192 bytes of the file on Windows when universal newlines was enabled and f was opened in U mode (see Python-Dev -- this was the ultimate cause of the test_inspect.py failure). + Changed prototye to take a char* buffer (void* doesn't make much sense). + Squashed size_t vs int mismatches (in particular, besides the unsigned vs signed distinction, size_t may be larger than int). + Gets out under all error conditions now (it's possible for fread() to suffer an error even if it returns a number larger than 0 -- any "short read" is an error or EOF condition). + Rearranged and simplified declarations. Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** fileobject.h 14 Apr 2002 20:12:39 -0000 2.27 --- fileobject.h 21 Apr 2002 07:29:13 -0000 2.28 *************** *** 42,46 **** /* The default encoding used by the platform file system APIs ! If non-NULL, this is different than the default encoding for strings */ extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding; --- 42,46 ---- /* The default encoding used by the platform file system APIs ! If non-NULL, this is different than the default encoding for strings */ extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding; *************** *** 52,61 **** #define PY_STDIOTEXTMODE "b" char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); ! size_t Py_UniversalNewlineFread(void *, size_t, FILE *, PyObject *); #else #define PY_STDIOTEXTMODE "" ! #define Py_UniversalNewlineFgets(buf, len, fp, obj) (fgets((buf), (len), (fp))) ! #define Py_UniversalNewlineFread(buf, len, fp, obj) \ ! (fread((buf), 1, (len), (fp))) #endif /* WITH_UNIVERSAL_NEWLINES */ #ifdef __cplusplus --- 52,61 ---- #define PY_STDIOTEXTMODE "b" char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); ! size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); #else #define PY_STDIOTEXTMODE "" ! #define Py_UniversalNewlineFgets(buf, len, fp, obj) fgets((buf), (len), (fp)) ! #define Py_UniversalNewlineFread(buf, len, fp, obj) ! fread((buf), 1, (len), (fp)) #endif /* WITH_UNIVERSAL_NEWLINES */ #ifdef __cplusplus From tim_one@sourceforge.net Sun Apr 21 08:29:16 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 00:29:16 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.158,2.159 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23161/Objects Modified Files: fileobject.c Log Message: Py_UniversalNewlineFread(): Many changes. + Continued looping until n bytes in the buffer have been filled, not just when n bytes have been read from the file. This repairs the bug that f.readlines() only sucked up the first 8192 bytes of the file on Windows when universal newlines was enabled and f was opened in U mode (see Python-Dev -- this was the ultimate cause of the test_inspect.py failure). + Changed prototye to take a char* buffer (void* doesn't make much sense). + Squashed size_t vs int mismatches (in particular, besides the unsigned vs signed distinction, size_t may be larger than int). + Gets out under all error conditions now (it's possible for fread() to suffer an error even if it returns a number larger than 0 -- any "short read" is an error or EOF condition). + Rearranged and simplified declarations. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.158 retrieving revision 2.159 diff -C2 -d -r2.158 -r2.159 *** fileobject.c 14 Apr 2002 20:12:40 -0000 2.158 --- fileobject.c 21 Apr 2002 07:29:14 -0000 2.159 *************** *** 1229,1233 **** Py_BEGIN_ALLOW_THREADS errno = 0; ! nread = Py_UniversalNewlineFread(buffer+nfilled, buffersize-nfilled, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS --- 1229,1233 ---- Py_BEGIN_ALLOW_THREADS errno = 0; ! nread = Py_UniversalNewlineFread(buffer+nfilled, buffersize-nfilled, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS *************** *** 1944,1948 **** int skipnextlf = 0; int univ_newline = 1; ! if (fobj) { if (!PyFile_Check(fobj)) { --- 1944,1948 ---- int skipnextlf = 0; int univ_newline = 1; ! if (fobj) { if (!PyFile_Check(fobj)) { *************** *** 2025,2072 **** */ size_t ! Py_UniversalNewlineFread(void *buf, size_t n, FILE *stream, PyObject *fobj) { ! char *src = buf, *dst = buf, c; ! int nread, ntodo=n; ! int newlinetypes, skipnextlf, univ_newline; ! if (!fobj || !PyFile_Check(fobj)) { errno = ENXIO; /* What can you do... */ return -1; } ! univ_newline = ((PyFileObject *)fobj)->f_univ_newline; ! if ( !univ_newline ) return fread(buf, 1, n, stream); ! newlinetypes = ((PyFileObject *)fobj)->f_newlinetypes; ! skipnextlf = ((PyFileObject *)fobj)->f_skipnextlf; ! while (ntodo > 0) { ! if (ferror(stream)) ! break; ! nread = fread(dst, 1, ntodo, stream); ! src = dst; ! if (nread <= 0) { ! if (skipnextlf) ! newlinetypes |= NEWLINE_CR; ! break; ! } ! ntodo -= nread; ! while ( nread-- ) { ! c = *src++; if (c == '\r') { ! /* Save CR as LF and set flag to skip next newline ! */ *dst++ = '\n'; skipnextlf = 1; ! } else if (skipnextlf && c == '\n') { ! /* Skip an LF, and remember that we saw CR LF ! */ skipnextlf = 0; newlinetypes |= NEWLINE_CRLF; ! } else { ! /* Normal char to be stored in buffer. Also update ! ** the newlinetypes flag if either this is an LF ! ** or the previous char was a CR. ! */ if (c == '\n') newlinetypes |= NEWLINE_LF; --- 2025,2075 ---- */ size_t ! Py_UniversalNewlineFread(char *buf, size_t n, FILE *stream, PyObject *fobj) { ! char *dst = buf; ! PyFileObject *f = (PyFileObject *)fobj; ! int newlinetypes, skipnextlf; ! ! assert(buf != NULL); ! assert(stream != NULL); ! if (!fobj || !PyFile_Check(fobj)) { errno = ENXIO; /* What can you do... */ return -1; } ! if (!f->f_univ_newline) return fread(buf, 1, n, stream); ! newlinetypes = f->f_newlinetypes; ! skipnextlf = f->f_skipnextlf; ! /* Invariant: n is the number of bytes remaining to be filled ! * in the buffer. ! */ ! while (n) { ! size_t nread; ! int shortread; ! char *src = dst; ! ! nread = fread(dst, 1, n, stream); ! assert(nread <= n); ! shortread = nread != n; /* true iff EOF or error */ ! while (nread--) { ! char c = *src++; if (c == '\r') { ! /* Save as LF and set flag to skip next LF. */ *dst++ = '\n'; + --n; skipnextlf = 1; ! } ! else if (skipnextlf && c == '\n') { ! /* Skip LF, and remember we saw CR LF. */ skipnextlf = 0; newlinetypes |= NEWLINE_CRLF; ! } ! else { ! /* Normal char to be stored in buffer. Also ! * update the newlinetypes flag if either this ! * is an LF or the previous char was a CR. ! */ if (c == '\n') newlinetypes |= NEWLINE_LF; *************** *** 2074,2084 **** newlinetypes |= NEWLINE_CR; *dst++ = c; skipnextlf = 0; } } } ! ((PyFileObject *)fobj)->f_newlinetypes = newlinetypes; ! ((PyFileObject *)fobj)->f_skipnextlf = skipnextlf; ! return dst - (char *)buf; } #endif --- 2077,2094 ---- newlinetypes |= NEWLINE_CR; *dst++ = c; + --n; skipnextlf = 0; } } + if (shortread) { + /* If this is EOF, update type flags. */ + if (skipnextlf && feof(stream)) + newlinetypes |= NEWLINE_CR; + break; + } } ! f->f_newlinetypes = newlinetypes; ! f->f_skipnextlf = skipnextlf; ! return dst - buf; } #endif From tim_one@sourceforge.net Sun Apr 21 08:30:32 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 00:30:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.80,1.81 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24320/python/Lib/test Modified Files: regrtest.py Log Message: Enable universal newlines on Windows. Note that NEWS needs more words! Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** regrtest.py 16 Apr 2002 02:14:04 -0000 1.80 --- regrtest.py 21 Apr 2002 07:30:28 -0000 1.81 *************** *** 512,516 **** test_sunaudiodev test_timing - test_univnewlines """, 'linux2': --- 512,515 ---- From tim_one@sourceforge.net Sun Apr 21 08:30:32 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 00:30:32 -0700 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv24320/python/PC Modified Files: pyconfig.h Log Message: Enable universal newlines on Windows. Note that NEWS needs more words! Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pyconfig.h 22 Mar 2002 06:32:32 -0000 1.8 --- pyconfig.h 21 Apr 2002 07:30:30 -0000 1.9 *************** *** 510,513 **** --- 510,516 ---- #define WITH_PYMALLOC 1 + /* Enable \n, \r, \r\n line ends on import; also the 'U' mode flag for open. */ + #define WITH_UNIVERSAL_NEWLINES 1 + /* Define if you have clock. */ /* #define HAVE_CLOCK */ From tim_one@sourceforge.net Sun Apr 21 08:30:32 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 00:30:32 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.390,1.391 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24320/python/Misc Modified Files: NEWS Log Message: Enable universal newlines on Windows. Note that NEWS needs more words! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.390 retrieving revision 1.391 diff -C2 -d -r1.390 -r1.391 *** NEWS 17 Apr 2002 20:33:40 -0000 1.390 --- NEWS 21 Apr 2002 07:30:30 -0000 1.391 *************** *** 143,146 **** --- 143,149 ---- Build + - XXX WITH_UNIVERSAL_NEWLINES Somebody fill this in; the PEP doesn't + say how or when to configure it, or how to turn it off. + - On Unix, a shared libpython2.3.so can be created with --enable-shared. From loewis@sourceforge.net Sun Apr 21 10:59:48 2002 From: loewis@sourceforge.net (loewis@sourceforge.net) Date: Sun, 21 Apr 2002 02:59:48 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.141,2.142 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22440 Modified Files: unicodeobject.c Log Message: Back out 2.140. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.141 retrieving revision 2.142 diff -C2 -d -r2.141 -r2.142 *** unicodeobject.c 21 Apr 2002 03:26:37 -0000 2.141 --- unicodeobject.c 21 Apr 2002 09:59:45 -0000 2.142 *************** *** 1173,1176 **** --- 1173,1182 ---- #endif + /* Allocation strategy: we default to Latin-1, then do one resize + whenever we hit an order boundary. The assumption is that + characters from higher orders usually occur often enough to warrant + this. + */ + PyObject * PyUnicode_EncodeUTF8(const Py_UNICODE *s, *************** *** 1180,1222 **** PyObject *v; char *p; ! int allocated = 0; ! int i; ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! for (i = 0; i < size; ) { ! Py_UCS4 ch = s[i++]; ! if (ch < 0x80) ! allocated += 1; ! else if (ch < 0x0800) ! allocated += 2; ! else if (ch < 0x10000) { ! /* Check for high surrogate */ ! if (0xD800 <= ch && ch <= 0xDBFF && ! i != size && ! 0xDC00 <= s[i] && s[i] <= 0xDFFF) { ! allocated += 1; ! i++; ! } ! allocated += 3; ! } else ! allocated += 4; ! } ! ! v = PyString_FromStringAndSize(NULL, allocated); if (v == NULL) return NULL; p = PyString_AS_STRING(v); ! for (i = 0; i < size; ) { Py_UCS4 ch = s[i++]; ! if (ch < 0x80) { *p++ = (char) ch; - } else if (ch < 0x0800) { *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); --- 1186,1212 ---- PyObject *v; char *p; ! int i = 0; ! int overalloc = 2; ! int len; ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! v = PyString_FromStringAndSize(NULL, overalloc * size); if (v == NULL) return NULL; p = PyString_AS_STRING(v); ! ! while (i < size) { Py_UCS4 ch = s[i++]; ! if (ch < 0x80) ! /* Encode ASCII */ *p++ = (char) ch; else if (ch < 0x0800) { + /* Encode Latin-1 */ *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); *************** *** 1224,1258 **** else { ! if (ch < 0x10000) { ! /* Check for high surrogate */ if (0xD800 <= ch && ch <= 0xDBFF && i != size) { Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000; ! *p++ = (char)((ch >> 18) | 0xf0); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! i++; ! continue; } /* Fall through: handles isolated high surrogates */ } *p++ = (char)(0xe0 | (ch >> 12)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); ! ! } else { ! *p++ = (char)(0xf0 | (ch>>18)); ! *p++ = (char)(0x80 | ((ch>>12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch>>6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); } } } ! assert(p - PyString_AS_STRING(v) == allocated); return v; } --- 1214,1270 ---- else { ! /* Encode UCS2 Unicode ordinals */ if (ch < 0x10000) { ! ! /* Special case: check for high surrogate */ if (0xD800 <= ch && ch <= 0xDBFF && i != size) { Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate and combine the two to ! form a UCS4 value */ if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ! ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; ! i++; ! goto encodeUCS4; } /* Fall through: handles isolated high surrogates */ } + + if (overalloc < 3) { + len = (int)(p - PyString_AS_STRING(v)); + overalloc = 3; + if (_PyString_Resize(&v, overalloc * size)) + goto onError; + p = PyString_AS_STRING(v) + len; + } *p++ = (char)(0xe0 | (ch >> 12)); *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); *p++ = (char)(0x80 | (ch & 0x3f)); ! continue; ! } ! ! /* Encode UCS4 Unicode ordinals */ ! encodeUCS4: ! if (overalloc < 4) { ! len = (int)(p - PyString_AS_STRING(v)); ! overalloc = 4; ! if (_PyString_Resize(&v, overalloc * size)) ! goto onError; ! p = PyString_AS_STRING(v) + len; } + *p++ = (char)(0xf0 | (ch >> 18)); + *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); + *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); + *p++ = (char)(0x80 | (ch & 0x3f)); } } ! *p = '\0'; ! assert((p - PyString_AS_STRING(v)) <= overalloc*size); ! if (_PyString_Resize(&v, (int)(p - PyString_AS_STRING(v)))) ! goto onError; return v; + + onError: + Py_DECREF(v); + return NULL; } From bckfnn@sourceforge.net Sun Apr 21 12:22:25 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 21 Apr 2002 04:22:25 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv4366 Modified Files: asdl.py Log Message: Added 'object' as a standard asdl builtin type. Index: asdl.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** asdl.py 19 Apr 2002 12:35:21 -0000 1.7 --- asdl.py 21 Apr 2002 11:22:23 -0000 1.8 *************** *** 200,204 **** return Field(type, opt=1) ! builtin_types = ("identifier", "string", "int", "bool") # below is a collection of classes to capture the AST of an AST :-) --- 200,204 ---- return Field(type, opt=1) ! builtin_types = ("identifier", "string", "int", "bool", "object") # below is a collection of classes to capture the AST of an AST :-) From bckfnn@sourceforge.net Sun Apr 21 12:24:35 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 21 Apr 2002 04:24:35 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl_java.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv4637 Modified Files: asdl_java.py Log Message: Cleanup, added support for 'object' and added null check. Index: asdl_java.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_java.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** asdl_java.py 19 Apr 2002 16:24:31 -0000 1.4 --- asdl_java.py 21 Apr 2002 11:24:33 -0000 1.5 *************** *** 132,137 **** self.emit("", 0) self.emit("public static final String[] %sTypeNames = new String[] {" % ! name, depth+1); ! self.emit('"",', depth+2); for type in sum.types: self.emit('"%s",' % type.name, depth+2) --- 132,137 ---- self.emit("", 0) self.emit("public static final String[] %sTypeNames = new String[] {" % ! name, depth+1) ! self.emit('"",', depth+2) for type in sum.types: self.emit('"%s",' % type.name, depth+2) *************** *** 154,158 **** for f in product.fields: self.visit(f, depth + 1) ! self.emit("", depth); self.javaMethods(name, "%sType" % name, product.fields, depth+1) --- 154,158 ---- for f in product.fields: self.visit(f, depth + 1) ! self.emit("", depth) self.javaMethods(name, "%sType" % name, product.fields, depth+1) *************** *** 189,193 **** self.emit("this.%s = %s;" % (f.name, f.name), depth+1) self.emit("}", depth) ! self.emit("", 0); # The toString() method --- 189,193 ---- self.emit("this.%s = %s;" % (f.name, f.name), depth+1) self.emit("}", depth) ! self.emit("", 0) # The toString() method *************** *** 196,203 **** depth+1) for f in fields: ! self.emit('sb.append("%s=");' % f.name, depth+1); if not self.bltinnames.has_key(str(f.type)) and f.typedef.simple: self.emit("sb.append(dumpThis(this.%s, %sType.%sTypeNames));" % ! (f.name, f.type, f.type), depth+1); else: self.emit("sb.append(dumpThis(this.%s));" % f.name, depth+1) --- 196,203 ---- depth+1) for f in fields: ! self.emit('sb.append("%s=");' % f.name, depth+1) if not self.bltinnames.has_key(str(f.type)) and f.typedef.simple: self.emit("sb.append(dumpThis(this.%s, %sType.%sTypeNames));" % ! (f.name, f.type, f.type), depth+1) else: self.emit("sb.append(dumpThis(this.%s));" % f.name, depth+1) *************** *** 207,218 **** self.emit("return sb.toString();", depth+1) self.emit("}", depth) ! self.emit("", 0); if clsname == ctorname: - # The accept() method - self.emit("public Object accept(Visitor visitor) throws Exception {", depth) self.emit('return visitor.visit%s(this);' % clsname, depth+1) ! self.emit("}", depth) ! self.emit("", 0); # The visitChildren() method --- 207,221 ---- self.emit("return sb.toString();", depth+1) self.emit("}", depth) ! self.emit("", 0) + # The accept() method + self.emit("public Object accept(Visitor visitor) throws Exception {", depth) if clsname == ctorname: self.emit('return visitor.visit%s(this);' % clsname, depth+1) ! else: ! self.emit('traverse(visitor);' % clsname, depth+1) ! self.emit('return null;' % clsname, depth+1) ! self.emit("}", depth) ! self.emit("", 0) # The visitChildren() method *************** *** 224,231 **** continue if f.seq: self.emit('for (int i = 0; i < %s.length; i++) {' % f.name, ! depth+1); ! self.emit('if (%s[i] != null)' % f.name, depth+2) ! self.emit('%s[i].accept(visitor);' % f.name, depth+3) self.emit('}', depth+1) else: --- 227,236 ---- continue if f.seq: + self.emit('if (%s != null) {' % f.name, depth+1) self.emit('for (int i = 0; i < %s.length; i++) {' % f.name, ! depth+2) ! self.emit('if (%s[i] != null)' % f.name, depth+3) ! self.emit('%s[i].accept(visitor);' % f.name, depth+4) ! self.emit('}', depth+2) self.emit('}', depth+1) else: *************** *** 233,237 **** self.emit('%s.accept(visitor);' % f.name, depth+2) self.emit('}', depth) ! self.emit("", 0); def visitField(self, field, depth): --- 238,242 ---- self.emit('%s.accept(visitor);' % f.name, depth+2) self.emit('}', depth) ! self.emit("", 0) def visitField(self, field, depth): *************** *** 242,245 **** --- 247,251 ---- 'identifier' : 'String', 'string' : 'String', + 'object' : 'org.python.core.PyObject', } *************** *** 283,288 **** self.emit('', 0) ! self.emit("abstract protected Object unhandled_node(SimpleNode node) throws Exception;", 1); ! self.emit("abstract public void traverse(SimpleNode node) throws Exception;", 1); self.emit('}', 0) self.close() --- 289,294 ---- self.emit('', 0) ! self.emit("abstract protected Object unhandled_node(SimpleNode node) throws Exception;", 1) ! self.emit("abstract public void traverse(SimpleNode node) throws Exception;", 1) self.emit('}', 0) self.close() From bckfnn@sourceforge.net Sun Apr 21 12:33:59 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 21 Apr 2002 04:33:59 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.18,1.19 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv6128 Modified Files: python.asdl Log Message: Fixed order of globals/locals args. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** python.asdl 19 Apr 2002 13:08:47 -0000 1.18 --- python.asdl 21 Apr 2002 11:33:56 -0000 1.19 *************** *** 39,43 **** -- defined if globals is -- still supports use as a function! ! | Exec(expr body, expr? locals, expr? globals) | Global(identifier* names) --- 39,43 ---- -- defined if globals is -- still supports use as a function! ! | Exec(expr body, expr? globals, expr? locals) | Global(identifier* names) From bckfnn@sourceforge.net Sun Apr 21 12:37:18 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 21 Apr 2002 04:37:18 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv6470 Modified Files: python.asdl Log Message: Added my suggested changes to slice. - ExtSlice is used to capture a comma separated list of slices - Index is used to capture a single index value. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** python.asdl 21 Apr 2002 11:33:56 -0000 1.19 --- python.asdl 21 Apr 2002 11:37:15 -0000 1.20 *************** *** 73,77 **** slice = Ellipsis | Slice(expr? lower, expr? upper) -- maybe Slice and ExtSlice should be merged... ! | ExtSlice(expr* dims) boolop = And | Or --- 73,78 ---- slice = Ellipsis | Slice(expr? lower, expr? upper) -- maybe Slice and ExtSlice should be merged... ! | ExtSlice(slice* dims) ! | Index(expr value) boolop = And | Or From bckfnn@sourceforge.net Sun Apr 21 12:39:51 2002 From: bckfnn@sourceforge.net (bckfnn@sourceforge.net) Date: Sun, 21 Apr 2002 04:39:51 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv6930 Modified Files: python.asdl Log Message: Changed the Num() argument to use 'object'. This breaks the C codegen, I'm sorry about that. Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** python.asdl 21 Apr 2002 11:37:15 -0000 1.20 --- python.asdl 21 Apr 2002 11:39:48 -0000 1.21 *************** *** 58,62 **** expr? starargs, expr? kwargs) | Repr(expr value) ! | Num(string n) -- string representation of a number | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? --- 58,62 ---- expr? starargs, expr? kwargs) | Repr(expr value) ! | Num(object n) -- a number as a PyObject. | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? From nnorwitz@sourceforge.net Sun Apr 21 15:45:44 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sun, 21 Apr 2002 07:45:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.h,1.4,1.5 astmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv14158 Modified Files: asdl.h astmodule.c Log Message: Get build working again, also fix warning Protect header file from multiple inclusion Should we protect from c++? Add XXX question about why we are using #define rather than typedef Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** asdl.h 16 Apr 2002 23:38:58 -0000 1.4 --- asdl.h 21 Apr 2002 14:45:41 -0000 1.5 *************** *** 1,4 **** --- 1,9 ---- + #ifndef Py_ASDL_H + #define Py_ASDL_H + + /* XXX why are these #def'd rather than typedef'd? */ #define identifier PyObject * #define string PyObject * + #define object PyObject * #include *************** *** 22,23 **** --- 27,30 ---- #define asdl_seq_LEN(S) ((S)->used) + + #endif /* !Py_ASDL_H */ Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** astmodule.c 19 Apr 2002 22:15:12 -0000 1.5 --- astmodule.c 21 Apr 2002 14:45:41 -0000 1.6 *************** *** 656,661 **** ['else' ':' suite] */ - REQ(n, if_stmt); char *s; if (NCH(n) == 4) --- 656,661 ---- ['else' ':' suite] */ char *s; + REQ(n, if_stmt); if (NCH(n) == 4) *************** *** 889,893 **** return NULL; ! fprintf(stderr, "module %X, stmts = %d\n", m, m->v.Module.body->used); Py_INCREF(Py_None); --- 889,894 ---- return NULL; ! fprintf(stderr, "module %X, stmts = %d\n", ! (unsigned)m, m->v.Module.body->used); Py_INCREF(Py_None); From nnorwitz@sourceforge.net Sun Apr 21 15:46:38 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sun, 21 Apr 2002 07:46:38 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast Makefile,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv14895 Modified Files: Makefile Log Message: Fix clean rule to work even when already clean Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 16 Apr 2002 23:40:09 -0000 1.6 --- Makefile 21 Apr 2002 14:46:36 -0000 1.7 *************** *** 14,19 **** clean: ! rm Python-ast.c ! rm Python-ast.h ! rm ast.so rm -rf build --- 14,17 ---- clean: ! rm -f Python-ast.c Python-ast.h ast.so rm -rf build From nnorwitz@sourceforge.net Sun Apr 21 16:03:21 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sun, 21 Apr 2002 08:03:21 -0700 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22252/Modules Modified Files: readline.c Log Message: #544265, Remove warnings for passing const to free() Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** readline.c 31 Mar 2002 16:13:39 -0000 2.47 --- readline.c 21 Apr 2002 15:03:18 -0000 2.48 *************** *** 271,275 **** return NULL; } ! free(rl_completer_word_break_characters); rl_completer_word_break_characters = strdup(break_chars); Py_INCREF(Py_None); --- 271,275 ---- return NULL; } ! free((void*)rl_completer_word_break_characters); rl_completer_word_break_characters = strdup(break_chars); Py_INCREF(Py_None); From tim_one@sourceforge.net Sun Apr 21 18:28:09 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 10:28:09 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.142,2.143 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv412/python/Objects Modified Files: unicodeobject.c Log Message: PyUnicode_EncodeUTF8(): tightened the memory asserts a bit, and at least tried to catch some possible arithmetic overflows in the debug build. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.142 retrieving revision 2.143 diff -C2 -d -r2.142 -r2.143 *** unicodeobject.c 21 Apr 2002 09:59:45 -0000 2.142 --- unicodeobject.c 21 Apr 2002 17:28:06 -0000 2.143 *************** *** 1186,1198 **** PyObject *v; char *p; - int i = 0; - int overalloc = 2; int len; ! ! /* Short-cut for emtpy strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! v = PyString_FromStringAndSize(NULL, overalloc * size); if (v == NULL) return NULL; --- 1186,1200 ---- PyObject *v; char *p; int len; ! int i = 0; ! long overalloc = 2; ! int nallocated; /* overalloc * size; PyString_ adds one more for \0 */ ! ! /* Short-cut for empty strings */ if (size == 0) return PyString_FromStringAndSize(NULL, 0); ! nallocated = Py_SAFE_DOWNCAST(overalloc * size, long, int); ! v = PyString_FromStringAndSize(NULL, nallocated); if (v == NULL) return NULL; *************** *** 1212,1216 **** *p++ = (char)(0x80 | (ch & 0x3f)); } ! else { /* Encode UCS2 Unicode ordinals */ --- 1214,1218 ---- *p++ = (char)(0x80 | (ch & 0x3f)); } ! else { /* Encode UCS2 Unicode ordinals */ *************** *** 1231,1237 **** if (overalloc < 3) { ! len = (int)(p - PyString_AS_STRING(v)); overalloc = 3; ! if (_PyString_Resize(&v, overalloc * size)) goto onError; p = PyString_AS_STRING(v) + len; --- 1233,1241 ---- if (overalloc < 3) { ! len = Py_SAFE_DOWNCAST(p-PyString_AS_STRING(v), long, int); ! assert(len <= nallocated); overalloc = 3; ! nallocated = Py_SAFE_DOWNCAST(overalloc * size, long, int); ! if (_PyString_Resize(&v, nallocated)) goto onError; p = PyString_AS_STRING(v) + len; *************** *** 1246,1252 **** encodeUCS4: if (overalloc < 4) { ! len = (int)(p - PyString_AS_STRING(v)); overalloc = 4; ! if (_PyString_Resize(&v, overalloc * size)) goto onError; p = PyString_AS_STRING(v) + len; --- 1250,1258 ---- encodeUCS4: if (overalloc < 4) { ! len = Py_SAFE_DOWNCAST(p - PyString_AS_STRING(v), long, int); ! assert(len <= nallocated); overalloc = 4; ! nallocated = Py_SAFE_DOWNCAST(overalloc * size, long, int); ! if (_PyString_Resize(&v, nallocated)) goto onError; p = PyString_AS_STRING(v) + len; *************** *** 1258,1264 **** } } *p = '\0'; ! assert((p - PyString_AS_STRING(v)) <= overalloc*size); ! if (_PyString_Resize(&v, (int)(p - PyString_AS_STRING(v)))) goto onError; return v; --- 1264,1272 ---- } } + *p = '\0'; ! len = Py_SAFE_DOWNCAST(p - PyString_AS_STRING(v), long, int); ! assert(len <= nallocated); ! if (_PyString_Resize(&v, len)) goto onError; return v; From tim_one@sourceforge.net Sun Apr 21 19:15:23 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 11:15:23 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.159,2.160 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12127/python/Objects Modified Files: fileobject.c Log Message: Py_UniversalNewlineFread(): small speed boost on non-Windows boxes. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** fileobject.c 21 Apr 2002 07:29:14 -0000 2.159 --- fileobject.c 21 Apr 2002 18:15:20 -0000 2.160 *************** *** 2053,2057 **** nread = fread(dst, 1, n, stream); assert(nread <= n); ! shortread = nread != n; /* true iff EOF or error */ while (nread--) { char c = *src++; --- 2053,2058 ---- nread = fread(dst, 1, n, stream); assert(nread <= n); ! n -= nread; /* assuming 1 byte out for each in; will adjust */ ! shortread = n != 0; /* true iff EOF or error */ while (nread--) { char c = *src++; *************** *** 2059,2063 **** /* Save as LF and set flag to skip next LF. */ *dst++ = '\n'; - --n; skipnextlf = 1; } --- 2060,2063 ---- *************** *** 2066,2069 **** --- 2066,2070 ---- skipnextlf = 0; newlinetypes |= NEWLINE_CRLF; + ++n; } else { *************** *** 2077,2081 **** newlinetypes |= NEWLINE_CR; *dst++ = c; - --n; skipnextlf = 0; } --- 2078,2081 ---- From nnorwitz@sourceforge.net Mon Apr 22 00:44:42 2002 From: nnorwitz@sourceforge.net (nnorwitz@sourceforge.net) Date: Sun, 21 Apr 2002 16:44:42 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27406/Modules Modified Files: cPickle.c Log Message: #546156, Remove load_false()/load_true(), they are not used Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -d -r2.81 -r2.82 *** cPickle.c 5 Apr 2002 19:30:08 -0000 2.81 --- cPickle.c 21 Apr 2002 23:44:34 -0000 2.82 *************** *** 2610,2627 **** static int - load_false(Unpicklerobject *self) - { - PDATA_APPEND(self->stack, Py_False, -1); - return 0; - } - - static int - load_true(Unpicklerobject *self) - { - PDATA_APPEND(self->stack, Py_True, -1); - return 0; - } - - static int bad_readline(void) { --- 2610,2613 ---- From guido@python.org Mon Apr 22 00:48:46 2002 From: guido@python.org (Guido van Rossum) Date: Sun, 21 Apr 2002 19:48:46 -0400 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.139,2.140 In-Reply-To: Your message of "Sat, 20 Apr 2002 17:26:05 +0200." <3CC1888D.D434DDB3@lemburg.com> References: <3CC1888D.D434DDB3@lemburg.com> Message-ID: <200204212348.g3LNmk524530@pcp742651pcs.reston01.va.comcast.net> > The only case where your patch is faster is for very short > strings and then only by a few percent, whereas for all > longer strings you get worse timings, e.g. 3.74 seconds > compared to 2.48 seconds -- that's a 50% increase in > run-time ! First decide what's worse -- overallocating memory or slowing down. This is not at all clear! If the normal use case is that strings to be encoded are significantly smaller than memory, overallocating is worth it. If we expect this to happen for strings close to the VM size, overallocating may cause problems. Does Linux still have the problem that its malloc() will let you allocate more memory than the system has available, and then crash hard when you try to touch all of it? --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@sourceforge.net Mon Apr 22 01:39:46 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 17:39:46 -0700 Subject: [Python-checkins] python/dist/src/Parser grammar.mak,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv3766 Modified Files: grammar.mak Log Message: Update the Windows makefile for 2.3. Index: grammar.mak =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/grammar.mak,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** grammar.mak 13 Oct 2001 20:16:17 -0000 1.1 --- grammar.mak 22 Apr 2002 00:39:44 -0000 1.2 *************** *** 8,17 **** # # I don't understand the maze of preprocessor #define's on Windows, and ! # as a result this requires linking with python22.lib, so it's of no use # for bootstrapping (the cause appears to be a useless-- in this # particular case --pragma in PC\pyconfig.h, which demands that ! # python22.lib get linked in). ! LIBS= ..\PCbuild\python22.lib CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL --- 8,17 ---- # # I don't understand the maze of preprocessor #define's on Windows, and ! # as a result this requires linking with python23.lib, so it's of no use # for bootstrapping (the cause appears to be a useless-- in this # particular case --pragma in PC\pyconfig.h, which demands that ! # python23.lib get linked in). ! LIBS= ..\PCbuild\python23.lib CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL From tim_one@sourceforge.net Mon Apr 22 03:33:29 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 19:33:29 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.240,2.241 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24773/python/Python Modified Files: compile.c Log Message: Moving pymalloc along. + Redirect PyMem_{Del, DEL} to the object allocator's free() when pymalloc is enabled. Needed so old extensions can continue to mix PyObject_New with PyMem_DEL. + This implies that pgen needs to be able to see the PyObject_XYZ declarations too. pgenheaders.h now includes Python.h. An implication is that I expect obmalloc.o needs to get linked into pgen on non-Windows boxes. + When PYMALLOC_DEBUG is defined, *all* Py memory API functions now funnel through the debug allocator wrapper around pymalloc. This is the default in a debug build. + That caused compile.c to fail: it indirectly mixed PyMem_Malloc with raw platform free() in one place. This is verbotten. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.240 retrieving revision 2.241 diff -C2 -d -r2.240 -r2.241 *** compile.c 14 Apr 2002 09:53:49 -0000 2.240 --- compile.c 22 Apr 2002 02:33:27 -0000 2.241 *************** *** 1955,1959 **** } if (childtype == MINUS) { ! char *s = malloc(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); --- 1955,1959 ---- } if (childtype == MINUS) { ! char *s = PyMem_Malloc(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); *************** *** 1963,1967 **** s[0] = '-'; strcpy(s + 1, STR(pnum)); ! free(STR(pnum)); STR(pnum) = s; } --- 1963,1967 ---- s[0] = '-'; strcpy(s + 1, STR(pnum)); ! PyMem_Free(STR(pnum)); STR(pnum) = s; } From tim_one@sourceforge.net Mon Apr 22 03:33:29 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 21 Apr 2002 19:33:29 -0700 Subject: [Python-checkins] python/dist/src/Include pgenheaders.h,2.27,2.28 pymem.h,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv24773/python/Include Modified Files: pgenheaders.h pymem.h Log Message: Moving pymalloc along. + Redirect PyMem_{Del, DEL} to the object allocator's free() when pymalloc is enabled. Needed so old extensions can continue to mix PyObject_New with PyMem_DEL. + This implies that pgen needs to be able to see the PyObject_XYZ declarations too. pgenheaders.h now includes Python.h. An implication is that I expect obmalloc.o needs to get linked into pgen on non-Windows boxes. + When PYMALLOC_DEBUG is defined, *all* Py memory API functions now funnel through the debug allocator wrapper around pymalloc. This is the default in a debug build. + That caused compile.c to fail: it indirectly mixed PyMem_Malloc with raw platform free() in one place. This is verbotten. Index: pgenheaders.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pgenheaders.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** pgenheaders.h 23 Oct 2001 02:18:35 -0000 2.27 --- pgenheaders.h 22 Apr 2002 02:33:27 -0000 2.28 *************** *** 8,28 **** /* Include files and extern declarations used by most of the parser. */ ! #include "pyconfig.h" ! ! /* pyconfig.h may or may not define DL_IMPORT */ ! #ifndef DL_IMPORT /* declarations for DLL import/export */ ! #define DL_IMPORT(RTYPE) RTYPE ! #endif ! ! #include ! #include ! ! #ifdef HAVE_STDLIB_H ! #include ! #endif ! ! #include "pymem.h" ! ! #include "pydebug.h" DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) --- 8,12 ---- /* Include files and extern declarations used by most of the parser. */ ! #include "Python.h" DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** pymem.h 12 Apr 2002 07:22:56 -0000 2.13 --- pymem.h 22 Apr 2002 02:33:27 -0000 2.14 *************** *** 53,57 **** /* Macros. */ ! #ifndef PyMem_MALLOC #ifdef MALLOC_ZERO_RETURNS_NULL #define PyMem_MALLOC(n) malloc((n) ? (n) : 1) --- 53,64 ---- /* Macros. */ ! #ifdef PYMALLOC_DEBUG ! /* Redirect all memory operations to Python's debugging allocator. */ ! #define PyMem_MALLOC PyObject_MALLOC ! #define PyMem_REALLOC PyObject_REALLOC ! #define PyMem_FREE PyObject_FREE ! ! #else /* ! PYMALLOC_DEBUG */ ! #ifdef MALLOC_ZERO_RETURNS_NULL #define PyMem_MALLOC(n) malloc((n) ? (n) : 1) *************** *** 59,63 **** #define PyMem_MALLOC malloc #endif - /* Caution: whether MALLOC_ZERO_RETURNS_NULL is #defined has nothing to do with whether platform realloc(non-NULL, 0) normally frees the memory --- 66,69 ---- *************** *** 67,71 **** #define PyMem_FREE free ! #endif /* PyMem_MALLOC */ /* --- 73,77 ---- #define PyMem_FREE free ! #endif /* PYMALLOC_DEBUG */ /* *************** *** 86,95 **** PyMem_{Del, DEL} (there was no choice about this in 1.5.2), the latter have to be redirected to the object allocator. */ - /* XXX The parser module needs rework before this can be enabled. */ - #if 0 #define PyMem_Del PyObject_Free - #else - #define PyMem_Del PyMem_Free - #endif /* Macros */ --- 92,96 ---- *************** *** 99,108 **** ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) - /* XXX The parser module needs rework before this can be enabled. */ - #if 0 #define PyMem_DEL PyObject_FREE - #else - #define PyMem_DEL PyMem_FREE - #endif #ifdef __cplusplus --- 100,104 ---- From nascheme@sourceforge.net Mon Apr 22 04:05:28 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Sun, 21 Apr 2002 20:05:28 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.80,1.81 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv31827a Modified Files: Makefile.pre.in Log Message: pgen now needs pymalloc Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** Makefile.pre.in 5 Apr 2002 16:50:52 -0000 1.80 --- Makefile.pre.in 22 Apr 2002 03:05:25 -0000 1.81 *************** *** 198,201 **** --- 198,202 ---- PGOBJS= \ + Objects/obmalloc.o \ Python/mysnprintf.o \ Parser/firstsets.o \ From nascheme@sourceforge.net Mon Apr 22 04:29:34 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Sun, 21 Apr 2002 20:29:34 -0700 Subject: [Python-checkins] python/dist/src/Parser pgen.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv3690/Parser Modified Files: pgen.c Log Message: Py_GETENV is used by obmalloc and needs Py_IgnoreEnvironmentFlag. Provide it. Index: pgen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/pgen.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** pgen.c 4 Dec 2001 03:18:48 -0000 2.20 --- pgen.c 22 Apr 2002 03:29:32 -0000 2.21 *************** *** 14,17 **** --- 14,18 ---- extern int Py_DebugFlag; + int Py_IgnoreEnvironmentFlag; /* needed by Py_GETENV */ From tim.one@comcast.net Mon Apr 22 04:59:54 2002 From: tim.one@comcast.net (Tim Peters) Date: Sun, 21 Apr 2002 23:59:54 -0400 Subject: [Python-checkins] python/dist/src/Parser pgen.c,2.20,2.21 In-Reply-To: Message-ID: [NeilS] > Modified Files: > pgen.c > Log Message: > Py_GETENV is used by obmalloc and needs Py_IgnoreEnvironmentFlag. > Provide it. Oooh -- wouldn't have guessed that one! Thanks for the sanity. From tim.one@comcast.net Mon Apr 22 05:19:30 2002 From: tim.one@comcast.net (Tim Peters) Date: Mon, 22 Apr 2002 00:19:30 -0400 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.139,2.140 In-Reply-To: <200204212348.g3LNmk524530@pcp742651pcs.reston01.va.comcast.net> Message-ID: [Guido] > First decide what's worse -- overallocating memory or slowing down. > This is not at all clear! If the normal use case is that strings to > be encoded are significantly smaller than memory, overallocating is > worth it. If we expect this to happen for strings close to the VM > size, overallocating may cause problems. I'd be surprised if people are slinging individual multi-hundred megabyte Unicode strings. Martin's timing program went up to 10K characters/string max. Then again, I'm surprised when anyone slings a Unicode string, regardless of size . > Does Linux still have the problem that its malloc() will let you > allocate more memory than the system has available, and then crash > hard when you try to touch all of it? Apparently so, and apparently the memory characteristics of popular applications running on large servers are such that Linux wouldn't be usable in that market without overcommitment. Or so some people say. A google search turns up many inflamed arguments. From jhylton@sourceforge.net Mon Apr 22 05:19:57 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sun, 21 Apr 2002 21:19:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast asdl.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv12981 Modified Files: asdl.h Log Message: use typedefs for object, string, identifier Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** asdl.h 21 Apr 2002 14:45:41 -0000 1.5 --- asdl.h 22 Apr 2002 04:19:54 -0000 1.6 *************** *** 2,9 **** #define Py_ASDL_H ! /* XXX why are these #def'd rather than typedef'd? */ ! #define identifier PyObject * ! #define string PyObject * ! #define object PyObject * #include --- 2,8 ---- #define Py_ASDL_H ! typedef PyObject * identifier; ! typedef PyObject * string; ! typedef PyObject * object; #include From jhylton@sourceforge.net Mon Apr 22 05:21:42 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sun, 21 Apr 2002 21:21:42 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast python.asdl,1.21,1.22 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv13262 Modified Files: python.asdl Log Message: Arguments to a lambda are optional; making the slot optional seems easier than filling in an empty arguments object. Dict should have keys & values, I think. (Perhaps Finn use a single list of elts with alternating keys & values?) Index: python.asdl =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** python.asdl 21 Apr 2002 11:39:48 -0000 1.21 --- python.asdl 22 Apr 2002 04:21:40 -0000 1.22 *************** *** 49,54 **** | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) ! | Lambda(arguments args, expr body) ! | Dict(expr* elts) | ListComp(expr target, listcomp* generators) -- need sequences for compare to distinguish between --- 49,54 ---- | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) ! | Lambda(arguments? args, expr body) ! | Dict(expr* keys, expr *values) | ListComp(expr target, listcomp* generators) -- need sequences for compare to distinguish between From jhylton@sourceforge.net Mon Apr 22 05:25:22 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Sun, 21 Apr 2002 21:25:22 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,1.6,1.7 test.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv13934 Modified Files: astmodule.c test.py Log Message: New statements & expressions supported, plus some code cleanup. New statements: FunctionDef, ClassDef, TryExcept, TryFinally, While argument handling is incomplete; don't handle fplist yet New expressions: Lambda, Attribute, ListComp, Dict, List XXX I don't think List is right Cleanups: Add NEW_IDENTIFIER() macro, which saves a lot of typing & reading. Move operator_ty lookup to get_operator() function. Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** astmodule.c 21 Apr 2002 14:45:41 -0000 1.6 --- astmodule.c 22 Apr 2002 04:25:19 -0000 1.7 *************** *** 12,21 **** --- 12,57 ---- #include "graminit.h" + #define NEW_IDENTIFIER(n) PyString_InternFromString(STR(n)) + static asdl_seq *seq_for_testlist(node *); static expr_ty ast_for_expr(node *); static stmt_ty ast_for_stmt(node *); + static asdl_seq *ast_for_suite(node *); + static asdl_seq *ast_for_exprlist(node *, int); + static expr_ty ast_for_testlist(node *); extern grammar _PyParser_Grammar; /* From graminit.c */ + static operator_ty + get_operator(node *n) + { + switch (TYPE(n)) { + case VBAR: + return BitOr; + case CIRCUMFLEX: + return BitXor; + case AMPER: + return BitAnd; + case LEFTSHIFT: + return LShift; + case RIGHTSHIFT: + return RShift; + case PLUS: + return Add; + case MINUS: + return Sub; + case STAR: + return Mult; + case SLASH: + return Div; + case DOUBLESLASH: + return FloorDiv; + case PERCENT: + return Mod; + default: + return 0; + } + } + static int set_context(expr_ty e, expr_context_ty ctx) *************** *** 131,135 **** int i; - REQ(n, testlist); seq = asdl_seq_new(NCH(n) / 2); for (i = 0; i < NCH(n); i += 2) { --- 167,170 ---- *************** *** 139,146 **** } static expr_ty ast_for_lambdef(node *n) { ! return NULL; } --- 174,372 ---- } + static arguments_ty + ast_for_arguments(node *n) + { + + /* XXX TO DO + check for invalid argument lists like normal after default + handle nested tuple arguments + */ + + /* parameters: '(' [varargslist] ')' + varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] + | '**' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [','] + */ + int i, n_args = 0, n_defaults = 0; + asdl_seq *args, *defaults; + identifier vararg = NULL, kwarg = NULL; + node *ch; + + if (TYPE(n) == parameters) { + if (NCH(n) == 2) + return arguments(NULL, NULL, NULL, NULL); + n = CHILD(n, 1); + } + REQ(n, varargslist); + + /* first count the number of normal args & defaults */ + for (i = 0; i < NCH(n); i++) { + ch = CHILD(n, i); + if (TYPE(ch) == fpdef) + n_args++; + if (TYPE(ch) == EQUAL) + n_defaults++; + } + args = n_args ? asdl_seq_new(n_args) : NULL; + defaults = n_defaults? asdl_seq_new(n_defaults) : NULL; + + /* fpdef: NAME | '(' fplist ')' + fplist: fpdef (',' fpdef)* [','] + */ + i = 0; + while (i < NCH(n)) { + ch = CHILD(n, i); + switch (TYPE(ch)) { + case fpdef: + if (NCH(ch) == 3) { + /* XXX don't handle fplist yet */ + return NULL; + } + if (TYPE(CHILD(ch, 0)) == NAME) + asdl_seq_append(args, NEW_IDENTIFIER(CHILD(ch, 0))); + if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) { + asdl_seq_append(defaults, ast_for_expr(CHILD(n, i + 2))); + i += 2; + } + i += 2; /* the name and the comma */ + break; + case STAR: + vararg = NEW_IDENTIFIER(CHILD(n, i+1)); + i += 3; + break; + case DOUBLESTAR: + kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); + i += 3; + break; + default: + fprintf(stderr, "unexpected node in varargslist: %d @ %d\n", + TYPE(ch), i); + } + } + + return arguments(args, vararg, kwarg, defaults); + } + + static stmt_ty + ast_for_funcdef(node *n) + { + /* funcdef: 'def' NAME parameters ':' suite */ + identifier name = NEW_IDENTIFIER(CHILD(n, 1)); + REQ(n, funcdef); + return FunctionDef(name, ast_for_arguments(CHILD(n, 2)), + ast_for_suite(CHILD(n, 4))); + } + static expr_ty ast_for_lambdef(node *n) { ! /* lambdef: 'lambda' [varargslist] ':' test */ ! if (NCH(n) == 3) ! return Lambda(NULL, ast_for_expr(CHILD(n, 2))); ! else ! return Lambda(ast_for_arguments(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3))); ! } ! ! static int ! count_list_fors(node *n) ! { ! int n_fors = 0; ! node *ch = CHILD(n, 1); ! count_list_for: ! n_fors++; ! REQ(ch, list_for); ! if (NCH(ch) == 5) ! ch = CHILD(ch, 4); ! else ! return n_fors; ! count_list_iter: ! REQ(ch, list_iter); ! ch = CHILD(ch, 0); ! if (TYPE(ch) == list_for) ! goto count_list_for; ! else if (TYPE(ch) == list_if) { ! if (NCH(ch) == 3) { ! ch = CHILD(ch, 2); ! goto count_list_iter; ! } else ! return n_fors; ! } ! assert(0); /* can't get here */ ! return -1; ! } ! ! static int ! count_list_ifs(node *n) ! { ! int n_ifs = 0; ! count_list_iter: ! REQ(n, list_iter); ! if (TYPE(CHILD(n, 0)) == list_for) ! return n_ifs; ! n = CHILD(n, 0); ! REQ(n, list_if); ! n_ifs++; ! if (NCH(n) == 2) ! return n_ifs; ! n = CHILD(n, 2); ! goto count_list_iter; ! } ! ! static expr_ty ! ast_for_listcomp(node *n) ! { ! /* listmaker: test ( list_for | (',' test)* [','] ) ! list_for: 'for' exprlist 'in' testlist_safe [list_iter] ! list_iter: list_for | list_if ! list_if: 'if' test [list_iter] ! testlist_safe: test [(',' test)+ [',']] ! */ ! expr_ty target; ! asdl_seq *listcomps; ! int i, n_fors; ! node *ch; ! ! REQ(n, listmaker); ! assert(NCH(n) > 1); ! ! target = ast_for_expr(CHILD(n, 0)); ! set_context(target, Store); ! ! n_fors = count_list_fors(n); ! listcomps = asdl_seq_new(n_fors); ! ch = CHILD(n, 1); ! for (i = 0; i < n_fors; i++) { ! listcomp_ty c; ! asdl_seq *t; ! REQ(ch, list_for); ! t = ast_for_exprlist(CHILD(ch, 1), Store); ! if (asdl_seq_LEN(t) == 1) ! c = listcomp(asdl_seq_get(t, 0), ! ast_for_testlist(CHILD(ch, 3)), NULL); ! else ! c = listcomp(Tuple(t, Store), ! ast_for_testlist(CHILD(ch, 3)), NULL); ! if (NCH(ch) == 5) { ! int j, n_ifs; ! asdl_seq *ifs; ! ch = CHILD(ch, 4); ! n_ifs = count_list_ifs(ch); ! ifs = asdl_seq_new(n_ifs); ! for (j = 0; j < n_ifs; j++) { ! REQ(ch, list_iter); ! ch = CHILD(ch, 0); ! REQ(ch, list_if); ! asdl_seq_append(ifs, CHILD(ch, 1)); ! if (NCH(ch) == 3) ! ch = CHILD(ch, 2); ! } ! /* on exit, must guarantee that ch is a list_for */ ! if (TYPE(ch) == list_iter) ! ch = CHILD(ch, 0); ! } ! asdl_seq_append(listcomps, c); ! } ! ! return ListComp(target, listcomps); } *************** *** 158,162 **** change later if needed. */ ! return Name(PyString_InternFromString(STR(ch)), Load); break; case STRING: --- 384,388 ---- change later if needed. */ ! return Name(NEW_IDENTIFIER(ch), Load); break; case STRING: *************** *** 171,177 **** break; case LSQB: /* list (or list comprehension) */ break; ! case LBRACE: /* dict */ break; case BACKQUOTE: /* repr */ return Repr(ast_for_expr(CHILD(n, 1))); --- 397,422 ---- break; case LSQB: /* list (or list comprehension) */ + ch = CHILD(n, 1); + REQ(ch, listmaker); + if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) + return List(ast_for_testlist(ch), Load); + else + return ast_for_listcomp(ch); break; ! case LBRACE: { ! /* dictmaker: test ':' test (',' test ':' test)* [','] */ ! int i, size; ! asdl_seq *keys, *values; ! ch = CHILD(n, 1); ! size = (NCH(ch) + 1) / 4; /* plus one in case no trailing comma */ ! keys = asdl_seq_new(size); ! values = asdl_seq_new(size); ! for (i = 0; i < NCH(ch); i += 4) { ! asdl_seq_append(keys, ast_for_expr(CHILD(ch, i))); ! asdl_seq_append(values, ast_for_expr(CHILD(ch, i + 2))); ! } ! return Dict(keys, values); break; + } case BACKQUOTE: /* repr */ return Repr(ast_for_expr(CHILD(n, 1))); *************** *** 202,211 **** asdl_seq *seq; - operator_ty op = 0; int i; fprintf(stderr, "ast_for_expr(%d, %d)\n", TYPE(n), NCH(n)); loop: - fprintf(stderr, "\texpr %d %d\n", TYPE(n), NCH(n)); switch (TYPE(n)) { case test: --- 447,454 ---- *************** *** 268,307 **** goto loop; } ! switch (TYPE(CHILD(n, 1))) { ! case VBAR: ! op = BitOr; ! break; ! case CIRCUMFLEX: ! op = BitXor; ! break; ! case AMPER: ! op = BitAnd; ! break; ! case LEFTSHIFT: ! op = LShift; ! break; ! case RIGHTSHIFT: ! op = RShift; ! break; ! case PLUS: ! op = Add; ! break; ! case MINUS: ! op = Sub; ! break; ! case STAR: ! op = Mult; ! break; ! case SLASH: ! op = Div; ! break; ! case DOUBLESLASH: ! op = FloorDiv; ! break; ! case PERCENT: ! op = Mod; ! break; ! } ! return BinOp(ast_for_expr(CHILD(n, 0)), op, ast_for_expr(CHILD(n, 2))); break; --- 511,515 ---- goto loop; } ! return BinOp(ast_for_expr(CHILD(n, 0)), get_operator(CHILD(n, 1)), ast_for_expr(CHILD(n, 2))); break; *************** *** 326,330 **** if (NCH(n) == 1) return ast_for_atom(CHILD(n, 0)); ! fprintf(stderr, "unhandled power\n"); return NULL; break; --- 534,550 ---- if (NCH(n) == 1) return ast_for_atom(CHILD(n, 0)); ! /* power: atom trailer* ('**' factor)* ! trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME */ ! if (NCH(n) == 2 && TYPE(CHILD(n, 1)) == trailer) { ! node *ch = CHILD(n, 1); ! if (TYPE(CHILD(ch, 0)) == LPAR) { ! /* XXX a call */ ! } else if (TYPE(CHILD(ch, 0)) == LSQB) { ! /* XXX a subscript */ ! } else if (TYPE(CHILD(ch, 0)) == DOT) { ! return Attribute(ast_for_atom(CHILD(n, 0)), ! NEW_IDENTIFIER(CHILD(ch, 1)), Load); ! } ! } return NULL; break; *************** *** 337,341 **** ast_for_testlist(node *n) { ! REQ(n, testlist); if (NCH(n) == 1) return ast_for_expr(CHILD(n, 0)); --- 557,561 ---- ast_for_testlist(node *n) { ! /* could be a testlist or a listmaker with no list_for */ if (NCH(n) == 1) return ast_for_expr(CHILD(n, 0)); *************** *** 411,414 **** --- 631,635 ---- expr_ty e; + fprintf(stderr, "ast_for_exprlist(%d, %d)\n", TYPE(n), context); REQ(n, exprlist); *************** *** 490,497 **** case import_as_name: if (NCH(n) == 3) ! return alias(PyString_InternFromString(STR(CHILD(n, 0))), ! PyString_InternFromString(STR(CHILD(n, 2)))); else ! return alias(PyString_InternFromString(STR(CHILD(n, 0))), NULL); break; --- 711,718 ---- case import_as_name: if (NCH(n) == 3) ! return alias(NEW_IDENTIFIER(CHILD(n, 0)), ! NEW_IDENTIFIER(CHILD(n, 2))); else ! return alias(NEW_IDENTIFIER(CHILD(n, 0)), NULL); break; *************** *** 503,507 **** alias_ty a = alias_for_import_name(CHILD(n, 0)); assert(!a->asname); ! a->asname = PyString_InternFromString(STR(CHILD(n, 2))); return a; } --- 724,728 ---- alias_ty a = alias_for_import_name(CHILD(n, 0)); assert(!a->asname); ! a->asname = NEW_IDENTIFIER(CHILD(n, 2)); return a; } *************** *** 509,513 **** case dotted_name: if (NCH(n) == 1) ! return alias(PyString_InternFromString(STR(CHILD(n, 0))), NULL); else { /* Create a string of the form "a.b.c" */ --- 730,734 ---- case dotted_name: if (NCH(n) == 1) ! return alias(NEW_IDENTIFIER(CHILD(n, 0)), NULL); else { /* Create a string of the form "a.b.c" */ *************** *** 581,585 **** s = asdl_seq_new(NCH(n) / 2); for (i = 1; i < NCH(n); i += 2) { ! name = PyString_InternFromString(STR(CHILD(n, i))); if (!name) return NULL; --- 802,806 ---- s = asdl_seq_new(NCH(n) / 2); for (i = 1; i < NCH(n); i += 2) { ! name = NEW_IDENTIFIER(CHILD(n, i)); if (!name) return NULL; *************** *** 715,719 **** REQ(n, while_stmt); ! return NULL; --- 936,946 ---- REQ(n, while_stmt); ! if (NCH(n) == 4) ! return While(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), NULL); ! else ! return While(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), ! ast_for_suite(CHILD(n, 6))); return NULL; *************** *** 746,760 **** } ! static stmt_ty ! ast_for_try_stmt(node *n) { ! REQ(n, try_stmt); ! return NULL; } static stmt_ty ! ast_for_funcdef(node *n) { ! REQ(n, funcdef); return NULL; } --- 973,1022 ---- } ! static except_ty ! ast_for_except_clause(node *exc, node *body) { ! /* except_clause: 'except' [test [',' test]] */ ! REQ(exc, except_clause); ! REQ(body, suite); ! ! if (NCH(exc) == 1) ! return except(NULL, NULL, ast_for_suite(body)); ! else if (NCH(exc) == 2) ! return except(ast_for_expr(CHILD(exc, 1)), NULL, ast_for_suite(body)); ! else { ! expr_ty e = ast_for_expr(CHILD(exc, 3)); ! set_context(e, Store); ! return except(ast_for_expr(CHILD(exc, 1)), e, ! ast_for_suite(body)); ! } } static stmt_ty ! ast_for_try_stmt(node *n) { ! REQ(n, try_stmt); ! if (TYPE(CHILD(n, 3)) == NAME) {/* must be 'finally' */ ! /* try_stmt: 'try' ':' suite 'finally' ':' suite) */ ! return TryFinally(ast_for_suite(CHILD(n, 2)), ! ast_for_suite(CHILD(n, 5))); ! } else { ! /* try_stmt: ('try' ':' suite (except_clause ':' suite)+ ! ['else' ':' suite] ! */ ! asdl_seq *handlers; ! int i, has_else = 0, n_except = NCH(n) - 3; ! if (TYPE(CHILD(n, NCH(n) - 3)) == NAME) { ! has_else = 1; ! n_except -= 3; ! } ! n_except /= 3; ! handlers = asdl_seq_new(n_except); ! for (i = 0; i < n_except; i++) ! asdl_seq_append(handlers, ! ast_for_except_clause(CHILD(n, 3 + i * 3), ! CHILD(n, 5 + i * 3))); ! return TryExcept(ast_for_suite(CHILD(n, 2)), handlers, ! has_else ? ast_for_suite(CHILD(n, NCH(n) - 1)): NULL); ! } return NULL; } *************** *** 763,767 **** --- 1025,1045 ---- ast_for_classdef(node *n) { + /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */ + expr_ty _bases; + asdl_seq *bases; REQ(n, classdef); + if (NCH(n) == 4) + return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, + ast_for_suite(CHILD(n, 3))); + /* else handle the base class list */ + _bases = ast_for_testlist(CHILD(n, 3)); + if (_bases->kind == Tuple_kind) + bases = _bases->v.Tuple.elts; + else { + bases = asdl_seq_new(1); + asdl_seq_append(bases, _bases); + } + return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, + ast_for_suite(CHILD(n, 6))); return NULL; } *************** *** 770,776 **** ast_for_stmt(node *n) { ! REQ(n, stmt); ! assert(NCH(n) == 1); ! n = CHILD(n, 0); if (TYPE(n) == simple_stmt) { /* I'm explicitly punting on multiple statements joined by a --- 1048,1056 ---- ast_for_stmt(node *n) { ! if (TYPE(n) == stmt) { ! assert(NCH(n) == 1); ! n = CHILD(n, 0); ! } ! fprintf(stderr, "stmt lineno %d\n", n->n_lineno); if (TYPE(n) == simple_stmt) { /* I'm explicitly punting on multiple statements joined by a Index: test.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/test.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test.py 19 Apr 2002 22:15:12 -0000 1.3 --- test.py 22 Apr 2002 04:25:19 -0000 1.4 *************** *** 1,4 **** import ast ! ast.transform("""global a, b, c a = 1 d = c = 7 --- 1,20 ---- import ast ! ast.transform("""# let's start with a whole bunch of argument lists ! def f(x): pass ! def f(x, y): pass ! def f(x, y,): pass ! def f(x, y=1): pass ! def f(x=1, y=1): pass ! def f(*x): pass ! def f(**x): pass ! def f(*x, **y): pass ! lambda:1 ! lambda x:1 ! lambda x:x ! lambda x, y: 1 ! lambda x, y, z,: y ! lambda x=lambda x:1 : 1 ! def f(x, y, z=None, f=lambda x: lambda y: x + y): pass ! global a, b, c a = 1 d = c = 7 *************** *** 60,62 **** --- 76,125 ---- else: pass + while 1: + 1 + 2 + while 1: + pass + while 1 and 2: + pass + else: + 1 + try: + 1 + finally: + 2 + try: + a + b + except: + pass + try: + a + b + except E: + pass + except: + pass + try: + a + b + except E, b: + pass + except: + pass + try: + a + b + except (E, E2), b: + pass + except: + pass + class C: pass + class C(A): pass + class C(A, B): pass + class C(A, B, (C,)): pass + d = {} + d = {1:2} + d = {1:2,} + d = {1:2, 3:4,} + [1,2,3,4] + [x for x in x if x if x for y in y if y] + [x for x in x] + obj.attr """) From anthonybaxter@sourceforge.net Mon Apr 22 12:22:01 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 04:22:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_queue.py,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31364/Lib/test Added Files: Tag: release22-maint test_queue.py Log Message: backport mhammond's patch: Fix bug 544473 - "Queue module can deadlock". Use try/finally to ensure all Queue locks remain stable. Includes test case. Bugfix candidate. (and branchpatch can now handle adding files :) --- NEW FILE: test_queue.py --- # Some simple Queue module tests, plus some failure conditions # to ensure the Queue locks remain stable import Queue import sys import threading import time from test_support import verify, TestFailed, verbose queue_size = 5 # Execute a function that blocks, and in a seperate thread, a function that # triggers the release. Returns the result of the blocking function. class _TriggerThread(threading.Thread): def __init__(self, fn, args): self.fn = fn self.args = args self.startedEvent = threading.Event() threading.Thread.__init__(self) def run(self): time.sleep(.1) self.startedEvent.set() self.fn(*self.args) def _doBlockingTest( block_func, block_args, trigger_func, trigger_args): t = _TriggerThread(trigger_func, trigger_args) t.start() try: return block_func(*block_args) finally: # If we unblocked before our thread made the call, we failed! if not t.startedEvent.isSet(): raise TestFailed("blocking function '%r' appeared not to block" % (block_func,)) t.join(1) # make sure the thread terminates if t.isAlive(): raise TestFailed("trigger function '%r' appeared to not return" % (trigger_func,)) # A Queue subclass that can provoke failure at a moment's notice :) class FailingQueueException(Exception): pass class FailingQueue(Queue.Queue): def __init__(self, *args): self.fail_next_put = False self.fail_next_get = False Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: self.fail_next_put = False raise FailingQueueException, "You Lose" return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: self.fail_next_get = False raise FailingQueueException, "You Lose" return Queue.Queue._get(self) def FailingQueueTest(q): if not q.empty(): raise RuntimeError, "Call this function with an empty queue" for i in range(queue_size-1): q.put(i) q.fail_next_put = True # Test a failing non-blocking put. try: q.put("oops", block=0) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass q.put("last") verify(q.full(), "Queue should be full") q.fail_next_put = True # Test a failing blocking put try: _doBlockingTest( q.put, ("full",), q.get, ()) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass # Check the Queue isn't damaged. # put failed, but get succeeded - re-add q.put("last") verify(q.full(), "Queue should be full") q.get() verify(not q.full(), "Queue should not be full") q.put("last") verify(q.full(), "Queue should be full") # Test a blocking put _doBlockingTest( q.put, ("full",), q.get, ()) # Empty it for i in range(queue_size): q.get() verify(q.empty(), "Queue should be empty") q.put("first") q.fail_next_get = True try: q.get() raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") q.fail_next_get = True try: _doBlockingTest( q.get, (), q.put, ('empty',)) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass # put succeeded, but get failed. verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") def SimpleQueueTest(q): if not q.empty(): raise RuntimeError, "Call this function with an empty queue" # I guess we better check things actually queue correctly a little :) q.put(111) q.put(222) verify(q.get()==111 and q.get()==222, "Didn't seem to queue the correct data!") for i in range(queue_size-1): q.put(i) verify(not q.full(), "Queue should not be full") q.put("last") verify(q.full(), "Queue should be full") try: q.put("full", block=0) raise TestFailed("Didn't appear to block with a full queue") except Queue.Full: pass # Test a blocking put _doBlockingTest( q.put, ("full",), q.get, ()) # Empty it for i in range(queue_size): q.get() verify(q.empty(), "Queue should be empty") try: q.get(block=0) raise TestFailed("Didn't appear to block with an empty queue") except Queue.Empty: pass # Test a blocking get _doBlockingTest( q.get, (), q.put, ('empty',)) def test(): q=Queue.Queue(queue_size) # Do it a couple of times on the same queue SimpleQueueTest(q) SimpleQueueTest(q) if verbose: print "Simple Queue tests seemed to work" q = FailingQueue(queue_size) FailingQueueTest(q) FailingQueueTest(q) if verbose: print "Failing Queue tests seemed to work" test() From jackjansen@sourceforge.net Mon Apr 22 12:44:28 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Mon, 22 Apr 2002 04:44:28 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts mkestrres-macerrors.h,NONE,1.1 mkestrres.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv12197 Modified Files: mkestrres.py Added Files: mkestrres-macerrors.h Log Message: Added an optional file with MacErrors.h extensions: IC errors aren't in there. Bugfix candidate. --- NEW FILE: mkestrres-macerrors.h --- /* Errors from InternetConfig.h */ icPrefNotFoundErr = -666, /* Internet preference not found */ icPermErr = -667, /* cannot set preference */ icPrefDataErr = -668, /* problem with preference data */ icInternalErr = -669, /* Internet Config internal error */ icTruncatedErr = -670, /* more data was present than was returned */ icNoMoreWritersErr = -671, /* you cannot begin a write session because someone else is already doing it */ icNothingToOverrideErr = -672, /* no component for the override component to capture */ icNoURLErr = -673, /* no URL found */ icConfigNotFoundErr = -674, /* no internet configuration was found */ icConfigInappropriateErr = -675, /* incorrect manufacturer code */ icProfileNotFoundErr = -676, /* profile not found */ icTooManyProfilesErr = -677 /* too many profiles in database */ Index: mkestrres.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/mkestrres.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mkestrres.py 22 Jan 2002 23:25:12 -0000 1.8 --- mkestrres.py 22 Apr 2002 11:44:26 -0000 1.9 *************** *** 124,127 **** --- 124,133 ---- fp.close() + fss, ok = macfs.PromptGetFile("Where is mkestrres-MacErrors.h?") + if not ok: return + fp = open(fss.as_pathname()) + parse_errors_h(fp, dict) + fp.close() + if not dict: return From jackjansen@sourceforge.net Mon Apr 22 12:45:24 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Mon, 22 Apr 2002 04:45:24 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib macerrors.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12558 Modified Files: macerrors.py Log Message: Regenerated to include Internet Config error strings. Bugfix candidate. Index: macerrors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macerrors.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** macerrors.py 17 May 2001 12:38:12 -0000 1.6 --- macerrors.py 22 Apr 2002 11:45:22 -0000 1.7 *************** *** 229,232 **** --- 229,234 ---- errKCNotAvailable = -25291 #errKCNotAvailable printerStatusOpCodeNotSupportedErr = -25280 #printerStatusOpCodeNotSupportedErr + kTXNOutsideOfFrameErr = -22018 #kTXNOutsideOfFrameErr + kTXNOutsideOfLineErr = -22017 #kTXNOutsideOfLineErr kTXNATSUIIsNotInstalledErr = -22016 #kTXNATSUIIsNotInstalledErr kTXNDataTypeNotAllowedErr = -22015 #kTXNDataTypeNotAllowedErr *************** *** 249,252 **** --- 251,257 ---- recordDataTooBigErr = -20001 #The record data is bigger than buffer size (1024 bytes). unknownInsertModeErr = -20000 #There is no such an insert mode. + kModemScriptMissing = -14002 #kModemScriptMissing + kModemPreferencesMissing = -14001 #kModemPreferencesMissing + kModemOutOfMemory = -14000 #kModemOutOfMemory kHIDBaseError = -13950 #kHIDBaseError kHIDNullStateErr = -13949 #kHIDNullStateErr *************** *** 287,290 **** --- 292,296 ---- debuggingDuplicateSignatureErr = -13881 #componentSignature already registered debuggingExecutionContextErr = -13880 #routine cannot be called at this time + kBridgeSoftwareRunningCantSleep = -13038 #kBridgeSoftwareRunningCantSleep kNoSuchPowerSource = -13020 #kNoSuchPowerSource kProcessorTempRoutineRequiresMPLib2 = -13014 #kProcessorTempRoutineRequiresMPLib2 *************** *** 307,310 **** --- 313,317 ---- pictInfoIDErr = -11001 #the internal consistancy check for the PictInfoID is wrong pictInfoVersionErr = -11000 #wrong version of the PictInfo structure + errTaskNotFound = -10780 #no task with that task id exists telNotEnoughdspBW = -10116 #not enough real-time for allocation telBadSampleRate = -10115 #incompatible sample rate *************** *** 545,565 **** kTextMalformedInputErr = -8739 #in DBCS, for example, high byte followed by invalid low byte kTextUnsupportedEncodingErr = -8738 #specified encoding not supported for this operation dcmBufferOverflowErr = -7127 #data is larger than buffer size ! dcmIterationCompleteErr = -7126 #no more item in iterator ! dcmBadFeatureErr = -7124 #invalid AccessMethod feature ! dcmNoAccessMethodErr = -7122 #no such AccessMethod dcmProtectedErr = -7121 #need keyword to use dictionary ! dcmBadPropertyErr = -7119 #no such property exist dcmBadFindMethodErr = -7118 #no such find method supported ! dcmBadDataSizeErr = -7117 #too big data size ! dcmTooManyKeyErr = -7116 #too many key field dcmBadKeyErr = -7115 #bad key information ! dcmNoFieldErr = -7113 #no such field exist dcmBadFieldTypeErr = -7112 #no such field type supported dcmBadFieldInfoErr = -7111 #incomplete information dcmNecessaryFieldErr = -7110 #lack required/identify field dcmDupRecordErr = -7109 #same record already exist ! dcmNoRecordErr = -7108 #no such record dcmBlockFullErr = -7107 #dictionary block full dcmDictionaryBusyErr = -7105 #dictionary is busy dcmDictionaryNotOpenErr = -7104 #dictionary not opened --- 552,589 ---- kTextMalformedInputErr = -8739 #in DBCS, for example, high byte followed by invalid low byte kTextUnsupportedEncodingErr = -8738 #specified encoding not supported for this operation + kRANotEnabled = -7139 #kRANotEnabled + kRACallBackFailed = -7138 #kRACallBackFailed + kRADuplicateIPAddr = -7137 #kRADuplicateIPAddr + kRANCPRejectedbyPeer = -7136 #kRANCPRejectedbyPeer + kRAExtAuthenticationFailed = -7135 #kRAExtAuthenticationFailed + kRAATalkInactive = -7134 #kRAATalkInactive + kRAPeerNotResponding = -7133 #kRAPeerNotResponding + kRAPPPPeerDisconnected = -7132 #kRAPPPPeerDisconnected + kRAPPPUserDisconnected = -7131 #kRAPPPUserDisconnected + kRAPPPNegotiationFailed = -7130 #kRAPPPNegotiationFailed + kRAPPPAuthenticationFailed = -7129 #kRAPPPAuthenticationFailed + kRAPPPProtocolRejected = -7128 #kRAPPPProtocolRejected dcmBufferOverflowErr = -7127 #data is larger than buffer size ! kRANotPrimaryInterface = -7126 #when IPCP is not primary TCP/IP intf. ! kRATCPIPNotConfigured = -7125 #TCP/IP not configured, could be loaded ! kRATCPIPInactive = -7124 #TCP/IP inactive, cannot be loaded ! kRARemoteAccessNotReady = -7123 #kRARemoteAccessNotReady ! kRAInitOpenTransportFailed = -7122 #kRAInitOpenTransportFailed dcmProtectedErr = -7121 #need keyword to use dictionary ! kRAUserPwdEntryRequired = -7120 #kRAUserPwdEntryRequired ! kRAUserPwdChangeRequired = -7119 #kRAUserPwdChangeRequired dcmBadFindMethodErr = -7118 #no such find method supported ! kRAInvalidSerialProtocol = -7117 #kRAInvalidSerialProtocol ! kRAInvalidPortState = -7116 #kRAInvalidPortState dcmBadKeyErr = -7115 #bad key information ! kRAPortBusy = -7114 #kRAPortBusy ! kRAInstallationDamaged = -7113 #kRAInstallationDamaged dcmBadFieldTypeErr = -7112 #no such field type supported dcmBadFieldInfoErr = -7111 #incomplete information dcmNecessaryFieldErr = -7110 #lack required/identify field dcmDupRecordErr = -7109 #same record already exist ! kRANotConnected = -7108 #kRANotConnected dcmBlockFullErr = -7107 #dictionary block full + kRAMissingResources = -7106 #kRAMissingResources dcmDictionaryBusyErr = -7105 #dictionary is busy dcmDictionaryNotOpenErr = -7104 #dictionary not opened *************** *** 567,571 **** dcmBadDictionaryErr = -7102 #invalid dictionary dcmNotDictionaryErr = -7101 #not dictionary ! dcmParamErr = -7100 #bad parameter laEngineNotFoundErr = -7000 #can't find the engine laPropertyErr = -6999 #Error in properties --- 591,595 ---- dcmBadDictionaryErr = -7102 #invalid dictionary dcmNotDictionaryErr = -7101 #not dictionary ! kRAInvalidParameter = -7100 #kRAInvalidParameter laEngineNotFoundErr = -7000 #can't find the engine laPropertyErr = -6999 #Error in properties *************** *** 641,644 **** --- 665,670 ---- kNavCustomControlMessageFailedErr = -5697 #kNavCustomControlMessageFailedErr kNavInvalidSystemConfigErr = -5696 #kNavInvalidSystemConfigErr + kNavWrongDialogClassErr = -5695 #kNavWrongDialogClassErr + kNavWrongDialogStateErr = -5694 #kNavWrongDialogStateErr dialogNoTimeoutErr = -5640 #dialogNoTimeoutErr menuInvalidErr = -5623 #menu is invalid *************** *** 646,649 **** --- 672,680 ---- menuUsesSystemDefErr = -5621 #GetMenuDefinition failed because the menu uses the system MDEF menuNotFoundErr = -5620 #specified menu or menu ID wasn't found + windowWrongStateErr = -5615 #window is not in a state that is valid for the current action + windowManagerInternalErr = -5614 #something really weird happened inside the window manager + windowAttributesConflictErr = -5613 #passed some attributes that are mutually exclusive + windowAttributeImmutableErr = -5612 #tried to change attributes which can't be changed + errWindowDoesNotFitOnscreen = -5611 #ConstrainWindowToScreen could not make the window fit onscreen errWindowNotFound = -5610 #returned from FindWindowOfClass errFloatingWindowsNotInitialized = -5609 #called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows *************** *** 684,687 **** --- 715,719 ---- errIAAllocationErr = -5381 #errIAAllocationErr errIAUnknownErr = -5380 #errIAUnknownErr + hrURLNotHandledErr = -5363 #hrURLNotHandledErr hrUnableToResizeHandleErr = -5362 #hrUnableToResizeHandleErr hrMiscellaneousExceptionErr = -5361 #hrMiscellaneousExceptionErr *************** *** 938,941 **** --- 970,974 ---- couldNotParseSourceFileErr = -3026 #Source document does not contain source type invalidTranslationPathErr = -3025 #Source type to destination type not a valid path + retryComponentRegistrationErr = -3005 #retryComponentRegistrationErr unresolvedComponentDLLErr = -3004 #unresolvedComponentDLLErr componentDontRegister = -3003 #componentDontRegister *************** *** 1085,1088 **** --- 1118,1123 ---- qtParamErr = -2202 #bad input parameter (out of range, etc) digiUnimpErr = -2201 #feature unimplemented + qtXMLApplicationErr = -2159 #qtXMLApplicationErr + qtXMLParseErr = -2158 #qtXMLParseErr qtActionNotHandledErr = -2157 #qtActionNotHandledErr notEnoughDataErr = -2149 #notEnoughDataErr *************** *** 1231,1234 **** --- 1266,1270 ---- badImageDescription = -2001 #badImageDescription couldNotResolveDataRef = -2000 #couldNotResolveDataRef + nonDragOriginatorErr = -1862 #illegal attempt at originator only data badImageErr = -1861 #bad translucent image PixMap badImageRgnErr = -1860 #bad translucent image region *************** *** 1260,1263 **** --- 1296,1301 ---- errOSAInvalidID = -1751 #errOSAInvalidID errOSASystemError = -1750 #errOSASystemError + errAEBufferTooSmall = -1741 #buffer for AEFlattenDesc too small + errAEBuildSyntaxError = -1740 #AEBuildDesc and friends detected a syntax error errAEDescIsNull = -1739 #attempting to perform an invalid operation on a null descriptor errAEStreamAlreadyConverted = -1738 #attempt to convert a stream that has already been converted *************** *** 1401,1404 **** --- 1439,1443 ---- nameTypeErr = -902 #Invalid or inappropriate locationKindSelector in locationName notInitErr = -900 #PPCToolBox not initialized + notAppropriateForClassic = -877 #This application won't or shouldn't run on Classic (Problem 2481058). appVersionTooOld = -876 #The application's creator and version are incompatible with the current version of Mac OS. wrongApplicationPlatform = -875 #The application could not launch because the required platform is not available *************** *** 1427,1430 **** --- 1466,1490 ---- rcDBValue = -801 #rcDBValue rcDBNull = -800 #rcDBNull + icTooManyProfilesErr = -677 #too many profiles in database + icProfileNotFoundErr = -676 #profile not found + icConfigInappropriateErr = -675 #incorrect manufacturer code + icConfigNotFoundErr = -674 #no internet configuration was found + icNoURLErr = -673 #no URL found + icNothingToOverrideErr = -672 #no component for the override component to capture + icNoMoreWritersErr = -671 #you cannot begin a write session because someone else is already doing it + icTruncatedErr = -670 #more data was present than was returned + icInternalErr = -669 #Internet Config internal error + icPrefDataErr = -668 #problem with preference data + icPermErr = -667 #cannot set preference + icPrefNotFoundErr = -666 #Internet preference not found + vmInvalidOwningProcessErr = -648 #current process does not own the BackingFileID or FileViewID + vmAddressNotInFileViewErr = -647 #address is not in a FileView + vmNoMoreFileViewsErr = -646 #no more FileViews were found + vmFileViewAccessErr = -645 #requested FileViewAccess cannot be obtained + vmInvalidFileViewIDErr = -644 #invalid FileViewID + vmNoMoreBackingFilesErr = -643 #no more BackingFiles were found + vmBusyBackingFileErr = -642 #open views found on BackingFile + vmMappingPrivilegesErr = -641 #requested MappingPrivileges cannot be obtained + vmInvalidBackingFileIDErr = -640 #invalid BackingFileID noMMUErr = -626 #no MMU present cannotDeferErr = -625 #unable to defer additional functions *************** *** 1745,1748 **** --- 1805,1809 ---- EMFILE = 24 #Too many open files ENOTTY = 25 #Inappropriate ioctl for device + ESIGPARM = 26 #Signal error EFBIG = 27 #File too large ENOSPC = 28 #No space left on device *************** *** 1788,1789 **** --- 1849,1852 ---- ENOLCK = 77 #No locks available ENOSYS = 78 #Function not implemented + EILSEQ = 88 #Wide character encoding error + EUNKNOWN = 99 #Unknown error From jackjansen@sourceforge.net Mon Apr 22 12:45:36 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Mon, 22 Apr 2002 04:45:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/Resources errors.rsrc,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Resources In directory usw-pr-cvs1:/tmp/cvs-serv12660 Modified Files: errors.rsrc Log Message: Regenerated to include Internet Config error strings. Bugfix candidate. Index: errors.rsrc =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Resources/errors.rsrc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvsJfuqCg and /tmp/cvs6y8dFm differ From jackjansen@sourceforge.net Mon Apr 22 12:45:49 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Mon, 22 Apr 2002 04:45:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts errors.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv12706 Modified Files: errors.txt Log Message: Regenerated to include Internet Config error strings. Bugfix candidate. Index: errors.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/errors.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** errors.txt 15 May 2001 20:22:08 -0000 1.7 --- errors.txt 22 Apr 2002 11:45:46 -0000 1.8 *************** *** 229,232 **** --- 229,234 ---- -25291 errKCNotAvailable errKCNotAvailable -25280 printerStatusOpCodeNotSupportedErr printerStatusOpCodeNotSupportedErr + -22018 kTXNOutsideOfFrameErr kTXNOutsideOfFrameErr + -22017 kTXNOutsideOfLineErr kTXNOutsideOfLineErr -22016 kTXNATSUIIsNotInstalledErr kTXNATSUIIsNotInstalledErr -22015 kTXNDataTypeNotAllowedErr kTXNDataTypeNotAllowedErr *************** *** 249,252 **** --- 251,257 ---- -20001 recordDataTooBigErr The record data is bigger than buffer size (1024 bytes). -20000 unknownInsertModeErr There is no such an insert mode. + -14002 kModemScriptMissing kModemScriptMissing + -14001 kModemPreferencesMissing kModemPreferencesMissing + -14000 kModemOutOfMemory kModemOutOfMemory -13950 kHIDBaseError kHIDBaseError -13949 kHIDNullStateErr kHIDNullStateErr *************** *** 287,290 **** --- 292,296 ---- -13881 debuggingDuplicateSignatureErr componentSignature already registered -13880 debuggingExecutionContextErr routine cannot be called at this time + -13038 kBridgeSoftwareRunningCantSleep kBridgeSoftwareRunningCantSleep -13020 kNoSuchPowerSource kNoSuchPowerSource -13014 kProcessorTempRoutineRequiresMPLib2 kProcessorTempRoutineRequiresMPLib2 *************** *** 307,310 **** --- 313,317 ---- -11001 pictInfoIDErr the internal consistancy check for the PictInfoID is wrong -11000 pictInfoVersionErr wrong version of the PictInfo structure + -10780 errTaskNotFound no task with that task id exists -10116 telNotEnoughdspBW not enough real-time for allocation -10115 telBadSampleRate incompatible sample rate *************** *** 545,565 **** -8739 kTextMalformedInputErr in DBCS, for example, high byte followed by invalid low byte -8738 kTextUnsupportedEncodingErr specified encoding not supported for this operation -7127 dcmBufferOverflowErr data is larger than buffer size ! -7126 dcmIterationCompleteErr no more item in iterator ! -7124 dcmBadFeatureErr invalid AccessMethod feature ! -7122 dcmNoAccessMethodErr no such AccessMethod -7121 dcmProtectedErr need keyword to use dictionary ! -7119 dcmBadPropertyErr no such property exist -7118 dcmBadFindMethodErr no such find method supported ! -7117 dcmBadDataSizeErr too big data size ! -7116 dcmTooManyKeyErr too many key field -7115 dcmBadKeyErr bad key information ! -7113 dcmNoFieldErr no such field exist -7112 dcmBadFieldTypeErr no such field type supported -7111 dcmBadFieldInfoErr incomplete information -7110 dcmNecessaryFieldErr lack required/identify field -7109 dcmDupRecordErr same record already exist ! -7108 dcmNoRecordErr no such record -7107 dcmBlockFullErr dictionary block full -7105 dcmDictionaryBusyErr dictionary is busy -7104 dcmDictionaryNotOpenErr dictionary not opened --- 552,589 ---- -8739 kTextMalformedInputErr in DBCS, for example, high byte followed by invalid low byte -8738 kTextUnsupportedEncodingErr specified encoding not supported for this operation + -7139 kRANotEnabled kRANotEnabled + -7138 kRACallBackFailed kRACallBackFailed + -7137 kRADuplicateIPAddr kRADuplicateIPAddr + -7136 kRANCPRejectedbyPeer kRANCPRejectedbyPeer + -7135 kRAExtAuthenticationFailed kRAExtAuthenticationFailed + -7134 kRAATalkInactive kRAATalkInactive + -7133 kRAPeerNotResponding kRAPeerNotResponding + -7132 kRAPPPPeerDisconnected kRAPPPPeerDisconnected + -7131 kRAPPPUserDisconnected kRAPPPUserDisconnected + -7130 kRAPPPNegotiationFailed kRAPPPNegotiationFailed + -7129 kRAPPPAuthenticationFailed kRAPPPAuthenticationFailed + -7128 kRAPPPProtocolRejected kRAPPPProtocolRejected -7127 dcmBufferOverflowErr data is larger than buffer size ! -7126 kRANotPrimaryInterface when IPCP is not primary TCP/IP intf. ! -7125 kRATCPIPNotConfigured TCP/IP not configured, could be loaded ! -7124 kRATCPIPInactive TCP/IP inactive, cannot be loaded ! -7123 kRARemoteAccessNotReady kRARemoteAccessNotReady ! -7122 kRAInitOpenTransportFailed kRAInitOpenTransportFailed -7121 dcmProtectedErr need keyword to use dictionary ! -7120 kRAUserPwdEntryRequired kRAUserPwdEntryRequired ! -7119 kRAUserPwdChangeRequired kRAUserPwdChangeRequired -7118 dcmBadFindMethodErr no such find method supported ! -7117 kRAInvalidSerialProtocol kRAInvalidSerialProtocol ! -7116 kRAInvalidPortState kRAInvalidPortState -7115 dcmBadKeyErr bad key information ! -7114 kRAPortBusy kRAPortBusy ! -7113 kRAInstallationDamaged kRAInstallationDamaged -7112 dcmBadFieldTypeErr no such field type supported -7111 dcmBadFieldInfoErr incomplete information -7110 dcmNecessaryFieldErr lack required/identify field -7109 dcmDupRecordErr same record already exist ! -7108 kRANotConnected kRANotConnected -7107 dcmBlockFullErr dictionary block full + -7106 kRAMissingResources kRAMissingResources -7105 dcmDictionaryBusyErr dictionary is busy -7104 dcmDictionaryNotOpenErr dictionary not opened *************** *** 567,571 **** -7102 dcmBadDictionaryErr invalid dictionary -7101 dcmNotDictionaryErr not dictionary ! -7100 dcmParamErr bad parameter -7000 laEngineNotFoundErr can't find the engine -6999 laPropertyErr Error in properties --- 591,595 ---- -7102 dcmBadDictionaryErr invalid dictionary -7101 dcmNotDictionaryErr not dictionary ! -7100 kRAInvalidParameter kRAInvalidParameter -7000 laEngineNotFoundErr can't find the engine -6999 laPropertyErr Error in properties *************** *** 641,644 **** --- 665,670 ---- -5697 kNavCustomControlMessageFailedErr kNavCustomControlMessageFailedErr -5696 kNavInvalidSystemConfigErr kNavInvalidSystemConfigErr + -5695 kNavWrongDialogClassErr kNavWrongDialogClassErr + -5694 kNavWrongDialogStateErr kNavWrongDialogStateErr -5640 dialogNoTimeoutErr dialogNoTimeoutErr -5623 menuInvalidErr menu is invalid *************** *** 646,649 **** --- 672,680 ---- -5621 menuUsesSystemDefErr GetMenuDefinition failed because the menu uses the system MDEF -5620 menuNotFoundErr specified menu or menu ID wasn't found + -5615 windowWrongStateErr window is not in a state that is valid for the current action + -5614 windowManagerInternalErr something really weird happened inside the window manager + -5613 windowAttributesConflictErr passed some attributes that are mutually exclusive + -5612 windowAttributeImmutableErr tried to change attributes which can't be changed + -5611 errWindowDoesNotFitOnscreen ConstrainWindowToScreen could not make the window fit onscreen -5610 errWindowNotFound returned from FindWindowOfClass -5609 errFloatingWindowsNotInitialized called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows *************** *** 684,687 **** --- 715,719 ---- -5381 errIAAllocationErr errIAAllocationErr -5380 errIAUnknownErr errIAUnknownErr + -5363 hrURLNotHandledErr hrURLNotHandledErr -5362 hrUnableToResizeHandleErr hrUnableToResizeHandleErr -5361 hrMiscellaneousExceptionErr hrMiscellaneousExceptionErr *************** *** 938,941 **** --- 970,974 ---- -3026 couldNotParseSourceFileErr Source document does not contain source type -3025 invalidTranslationPathErr Source type to destination type not a valid path + -3005 retryComponentRegistrationErr retryComponentRegistrationErr -3004 unresolvedComponentDLLErr unresolvedComponentDLLErr -3003 componentDontRegister componentDontRegister *************** *** 1085,1088 **** --- 1118,1123 ---- -2202 qtParamErr bad input parameter (out of range, etc) -2201 digiUnimpErr feature unimplemented + -2159 qtXMLApplicationErr qtXMLApplicationErr + -2158 qtXMLParseErr qtXMLParseErr -2157 qtActionNotHandledErr qtActionNotHandledErr -2149 notEnoughDataErr notEnoughDataErr *************** *** 1231,1234 **** --- 1266,1270 ---- -2001 badImageDescription badImageDescription -2000 couldNotResolveDataRef couldNotResolveDataRef + -1862 nonDragOriginatorErr illegal attempt at originator only data -1861 badImageErr bad translucent image PixMap -1860 badImageRgnErr bad translucent image region *************** *** 1260,1263 **** --- 1296,1301 ---- -1751 errOSAInvalidID errOSAInvalidID -1750 errOSASystemError errOSASystemError + -1741 errAEBufferTooSmall buffer for AEFlattenDesc too small + -1740 errAEBuildSyntaxError AEBuildDesc and friends detected a syntax error -1739 errAEDescIsNull attempting to perform an invalid operation on a null descriptor -1738 errAEStreamAlreadyConverted attempt to convert a stream that has already been converted *************** *** 1401,1404 **** --- 1439,1443 ---- -902 nameTypeErr Invalid or inappropriate locationKindSelector in locationName -900 notInitErr PPCToolBox not initialized + -877 notAppropriateForClassic This application won't or shouldn't run on Classic (Problem 2481058). -876 appVersionTooOld The application's creator and version are incompatible with the current version of Mac OS. -875 wrongApplicationPlatform The application could not launch because the required platform is not available *************** *** 1427,1430 **** --- 1466,1490 ---- -801 rcDBValue rcDBValue -800 rcDBNull rcDBNull + -677 icTooManyProfilesErr too many profiles in database + -676 icProfileNotFoundErr profile not found + -675 icConfigInappropriateErr incorrect manufacturer code + -674 icConfigNotFoundErr no internet configuration was found + -673 icNoURLErr no URL found + -672 icNothingToOverrideErr no component for the override component to capture + -671 icNoMoreWritersErr you cannot begin a write session because someone else is already doing it + -670 icTruncatedErr more data was present than was returned + -669 icInternalErr Internet Config internal error + -668 icPrefDataErr problem with preference data + -667 icPermErr cannot set preference + -666 icPrefNotFoundErr Internet preference not found + -648 vmInvalidOwningProcessErr current process does not own the BackingFileID or FileViewID + -647 vmAddressNotInFileViewErr address is not in a FileView + -646 vmNoMoreFileViewsErr no more FileViews were found + -645 vmFileViewAccessErr requested FileViewAccess cannot be obtained + -644 vmInvalidFileViewIDErr invalid FileViewID + -643 vmNoMoreBackingFilesErr no more BackingFiles were found + -642 vmBusyBackingFileErr open views found on BackingFile + -641 vmMappingPrivilegesErr requested MappingPrivileges cannot be obtained + -640 vmInvalidBackingFileIDErr invalid BackingFileID -626 noMMUErr no MMU present -625 cannotDeferErr unable to defer additional functions *************** *** 1745,1748 **** --- 1805,1809 ---- 24 EMFILE Too many open files 25 ENOTTY Inappropriate ioctl for device + 26 ESIGPARM Signal error 27 EFBIG File too large 28 ENOSPC No space left on device *************** *** 1788,1789 **** --- 1849,1852 ---- 77 ENOLCK No locks available 78 ENOSYS Function not implemented + 88 EILSEQ Wide character encoding error + 99 EUNKNOWN Unknown error From jackjansen@sourceforge.net Mon Apr 22 12:46:18 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Mon, 22 Apr 2002 04:46:18 -0700 Subject: [Python-checkins] python/dist/src/Mac ReadMe,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Mac In directory usw-pr-cvs1:/tmp/cvs-serv12873 Modified Files: ReadMe Log Message: Removed note on test_time failing. Bugfix candidate. Index: ReadMe =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/ReadMe,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ReadMe 25 Jan 2002 16:13:38 -0000 1.41 --- ReadMe 22 Apr 2002 11:46:16 -0000 1.42 *************** *** 141,147 **** frozen modules. This should not be a problem in normal use. - test_time will fail because MacPython accepts bogus values for - mktime(), this will be fixed later (it is not a very serious problem). - Three tests will fail on MacOS9 with MemoryErrors: test_longexp, test_sha and test_zlib (on MacOSX these should pass). --- 141,144 ---- From doerwalter@sourceforge.net Mon Apr 22 12:57:06 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 04:57:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.4,1.80.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17892/Doc/lib Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Backport the following changes: Misc/NEWS 1.387->1.388 Lib/test/string_tests.py 1.10->1.11, 1.12->1.14, Lib/test/test_unicode.py 1.50->1.51, 1.53->1.54, 1.55->1.56 Lib/test/test_string.py 1.15->1.16 Lib/string.py 1.61->1.63 Lib/test/test_userstring.py 1.5->1.6, 1.11, 1.12 Objects/stringobject.c 2.156->2.159 Objects/unicodeobject.c 2.137->2.139 Doc/lib/libstdtypes.tec 1.87->1.88 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly (see SF patch http://www.python.org/sf/536241) This also adds Guido's fix to test_userstring.py and the subinstance checks in test_string.py and test_unicode.py. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.4 retrieving revision 1.80.6.5 diff -C2 -d -r1.80.6.4 -r1.80.6.5 *** libstdtypes.tex 18 Apr 2002 05:22:33 -0000 1.80.6.4 --- libstdtypes.tex 22 Apr 2002 11:57:04 -0000 1.80.6.5 *************** *** 690,693 **** --- 690,699 ---- \end{methoddesc} + \begin{methoddesc}[string]{zfill}{width} + Return the numeric string left filled with zeros in a string + of length \var{width}. The original string is returned if + \var{width} is less than \code{len(\var{s})}. + \end{methoddesc} + \subsubsection{String Formatting Operations \label{typesseq-strings}} From doerwalter@sourceforge.net Mon Apr 22 12:57:07 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 04:57:07 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.24,1.337.2.4.2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17892/Misc Modified Files: Tag: release22-maint NEWS Log Message: Backport the following changes: Misc/NEWS 1.387->1.388 Lib/test/string_tests.py 1.10->1.11, 1.12->1.14, Lib/test/test_unicode.py 1.50->1.51, 1.53->1.54, 1.55->1.56 Lib/test/test_string.py 1.15->1.16 Lib/string.py 1.61->1.63 Lib/test/test_userstring.py 1.5->1.6, 1.11, 1.12 Objects/stringobject.c 2.156->2.159 Objects/unicodeobject.c 2.137->2.139 Doc/lib/libstdtypes.tec 1.87->1.88 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly (see SF patch http://www.python.org/sf/536241) This also adds Guido's fix to test_userstring.py and the subinstance checks in test_string.py and test_unicode.py. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.24 retrieving revision 1.337.2.4.2.25 diff -C2 -d -r1.337.2.4.2.24 -r1.337.2.4.2.25 *** NEWS 18 Apr 2002 05:38:53 -0000 1.337.2.4.2.24 --- NEWS 22 Apr 2002 11:57:05 -0000 1.337.2.4.2.25 *************** *** 9,12 **** --- 9,16 ---- SourceForge as bug 543148. + - A method zfill() was added to str and unicode, that fills a numeric + string to the left with zeros. For example, + "+123".zfill(6) -> "+00123". + - Complex numbers supported divmod() and the // and % operators, but these make no sense. Since this was documented, they're being From doerwalter@sourceforge.net Mon Apr 22 12:57:07 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 04:57:07 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.10.18.1,1.10.18.2 string.py,1.60.16.1,1.60.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17892/Lib Modified Files: Tag: release22-maint UserString.py string.py Log Message: Backport the following changes: Misc/NEWS 1.387->1.388 Lib/test/string_tests.py 1.10->1.11, 1.12->1.14, Lib/test/test_unicode.py 1.50->1.51, 1.53->1.54, 1.55->1.56 Lib/test/test_string.py 1.15->1.16 Lib/string.py 1.61->1.63 Lib/test/test_userstring.py 1.5->1.6, 1.11, 1.12 Objects/stringobject.c 2.156->2.159 Objects/unicodeobject.c 2.137->2.139 Doc/lib/libstdtypes.tec 1.87->1.88 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly (see SF patch http://www.python.org/sf/536241) This also adds Guido's fix to test_userstring.py and the subinstance checks in test_string.py and test_unicode.py. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.10.18.1 retrieving revision 1.10.18.2 diff -C2 -d -r1.10.18.1 -r1.10.18.2 *** UserString.py 18 Apr 2002 05:17:53 -0000 1.10.18.1 --- UserString.py 22 Apr 2002 11:57:04 -0000 1.10.18.2 *************** *** 129,132 **** --- 129,133 ---- return self.__class__(self.data.translate(*args)) def upper(self): return self.__class__(self.data.upper()) + def zfill(self, width): return self.__class__(self.data.zfill(width)) class MutableString(UserString): Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.60.16.1 retrieving revision 1.60.16.2 diff -C2 -d -r1.60.16.1 -r1.60.16.2 *** string.py 30 Jan 2002 16:15:59 -0000 1.60.16.1 --- string.py 22 Apr 2002 11:57:05 -0000 1.60.16.2 *************** *** 191,195 **** _int = int _long = long ! _StringType = type('') # Convert string to float --- 191,198 ---- _int = int _long = long ! try: ! _StringTypes = (str, unicode) ! except NameError: ! _StringTypes = (str,) # Convert string to float *************** *** 277,288 **** """ ! if type(x) == type(''): s = x ! else: s = `x` ! n = len(s) ! if n >= width: return s ! sign = '' ! if s[0] in ('-', '+'): ! sign, s = s[0], s[1:] ! return sign + '0'*(width-n) + s # Expand tabs in a string. --- 280,286 ---- """ ! if not isinstance(x, _StringTypes): ! x = repr(x) ! return x.zfill(width) # Expand tabs in a string. From doerwalter@sourceforge.net Mon Apr 22 12:57:07 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 04:57:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.10.16.1,1.10.16.2 test_string.py,1.15,1.15.6.1 test_unicode.py,1.47.6.1,1.47.6.2 test_userstring.py,1.5,1.5.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17892/Lib/test Modified Files: Tag: release22-maint string_tests.py test_string.py test_unicode.py test_userstring.py Log Message: Backport the following changes: Misc/NEWS 1.387->1.388 Lib/test/string_tests.py 1.10->1.11, 1.12->1.14, Lib/test/test_unicode.py 1.50->1.51, 1.53->1.54, 1.55->1.56 Lib/test/test_string.py 1.15->1.16 Lib/string.py 1.61->1.63 Lib/test/test_userstring.py 1.5->1.6, 1.11, 1.12 Objects/stringobject.c 2.156->2.159 Objects/unicodeobject.c 2.137->2.139 Doc/lib/libstdtypes.tec 1.87->1.88 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly (see SF patch http://www.python.org/sf/536241) This also adds Guido's fix to test_userstring.py and the subinstance checks in test_string.py and test_unicode.py. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.10.16.1 retrieving revision 1.10.16.2 diff -C2 -d -r1.10.16.1 -r1.10.16.2 *** string_tests.py 18 Apr 2002 05:18:56 -0000 1.10.16.1 --- string_tests.py 22 Apr 2002 11:57:05 -0000 1.10.16.2 *************** *** 228,231 **** --- 228,244 ---- test('endswith', 'ab', 0, 'ab', 0, 0) + test('zfill', '123', '123', 2) + test('zfill', '123', '123', 3) + test('zfill', '123', '0123', 4) + test('zfill', '+123', '+123', 3) + test('zfill', '+123', '+123', 4) + test('zfill', '+123', '+0123', 5) + test('zfill', '-123', '-123', 3) + test('zfill', '-123', '-123', 4) + test('zfill', '-123', '-0123', 5) + test('zfill', '', '000', 3) + test('zfill', '34', '34', 1) + test('zfill', '34', '0034', 4) + # Encoding/decoding codecs = [('rot13', 'uryyb jbeyq'), Index: test_string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.15 retrieving revision 1.15.6.1 diff -C2 -d -r1.15 -r1.15.6.1 *** test_string.py 9 Dec 2001 16:06:29 -0000 1.15 --- test_string.py 22 Apr 2002 11:57:05 -0000 1.15.6.1 *************** *** 23,26 **** --- 23,45 ---- value = sys.exc_type f = name + if value == output: + # if the original is returned make sure that + # this doesn't happen with subclasses + if value is input: + class ssub(str): + def __repr__(self): + return 'ssub(%r)' % str.__repr__(self) + input = ssub(input) + try: + f = getattr(input, name) + value = apply(f, args) + except AttributeError: + f = getattr(string, name) + value = apply(f, (input,) + args) + if value is input: + if verbose: + print 'no' + print '*',f, `input`, `output`, `value` + return if value != output: if verbose: Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.47.6.1 retrieving revision 1.47.6.2 diff -C2 -d -r1.47.6.1 -r1.47.6.2 *** test_unicode.py 18 Mar 2002 12:54:51 -0000 1.47.6.1 --- test_unicode.py 22 Apr 2002 11:57:05 -0000 1.47.6.2 *************** *** 7,11 **** """#" from test_support import verify, verbose, TestFailed ! import sys if not sys.platform.startswith('java'): --- 7,11 ---- """#" from test_support import verify, verbose, TestFailed ! import sys, string if not sys.platform.startswith('java'): *************** *** 204,207 **** --- 204,220 ---- test('capwords', u'abc\tdef\nghi', u'Abc Def Ghi') test('capwords', u'abc\t def \nghi', u'Abc Def Ghi') + + test('zfill', u'123', u'123', 2) + test('zfill', u'123', u'123', 3) + test('zfill', u'123', u'0123', 4) + test('zfill', u'+123', u'+123', 3) + test('zfill', u'+123', u'+123', 4) + test('zfill', u'+123', u'+0123', 5) + test('zfill', u'-123', u'-123', 3) + test('zfill', u'-123', u'-123', 4) + test('zfill', u'-123', u'-0123', 5) + test('zfill', u'', u'000', 3) + test('zfill', u'34', u'34', 1) + test('zfill', u'34', u'00034', 5) # Comparisons: Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.5 retrieving revision 1.5.24.1 diff -C2 -d -r1.5 -r1.5.24.1 *** test_userstring.py 9 Feb 2001 12:00:47 -0000 1.5 --- test_userstring.py 22 Apr 2002 11:57:05 -0000 1.5.24.1 *************** *** 9,21 **** if __name__ == "__main__": ! verbose = 0 tested_methods = {} ! def test(methodname, input, *args): global tested_methods tested_methods[methodname] = 1 if verbose: ! print '%s.%s(%s) ' % (input, methodname, args), u = UserString(input) objects = [input, u, UserString(u)] --- 9,21 ---- if __name__ == "__main__": ! verbose = '-v' in sys.argv tested_methods = {} ! def test(methodname, input, output, *args): global tested_methods tested_methods[methodname] = 1 if verbose: ! print '%r.%s(%s)' % (input, methodname, ", ".join(map(repr, args))), u = UserString(input) objects = [input, u, UserString(u)] *************** *** 25,45 **** try: f = getattr(object, methodname) ! res[i] = apply(f, args) ! except: ! res[i] = sys.exc_type ! if res[0] != res[1]: ! if verbose: ! print 'no' ! print `input`, f, `res[0]`, "<>", `res[1]` ! else: if verbose: print 'yes' - if res[1] != res[2]: - if verbose: - print 'no' - print `input`, f, `res[1]`, "<>", `res[2]` else: if verbose: ! print 'yes' string_tests.run_method_tests(test) --- 25,43 ---- try: f = getattr(object, methodname) ! except AttributeError: ! f = None ! res[i] = AttributeError ! else: ! try: ! res[i] = apply(f, args) ! except: ! res[i] = sys.exc_type ! if res[0] == res[1] == res[2] == output: if verbose: print 'yes' else: if verbose: ! print 'no' ! print (methodname, input, output, args, res[0], res[1], res[2]) string_tests.run_method_tests(test) From doerwalter@sourceforge.net Mon Apr 22 12:57:08 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 04:57:08 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.147.6.1,2.147.6.2 unicodeobject.c,2.124.6.6,2.124.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17892/Objects Modified Files: Tag: release22-maint stringobject.c unicodeobject.c Log Message: Backport the following changes: Misc/NEWS 1.387->1.388 Lib/test/string_tests.py 1.10->1.11, 1.12->1.14, Lib/test/test_unicode.py 1.50->1.51, 1.53->1.54, 1.55->1.56 Lib/test/test_string.py 1.15->1.16 Lib/string.py 1.61->1.63 Lib/test/test_userstring.py 1.5->1.6, 1.11, 1.12 Objects/stringobject.c 2.156->2.159 Objects/unicodeobject.c 2.137->2.139 Doc/lib/libstdtypes.tec 1.87->1.88 Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly (see SF patch http://www.python.org/sf/536241) This also adds Guido's fix to test_userstring.py and the subinstance checks in test_string.py and test_unicode.py. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.1 retrieving revision 2.147.6.2 diff -C2 -d -r2.147.6.1 -r2.147.6.2 *** stringobject.c 18 Apr 2002 05:16:37 -0000 2.147.6.1 --- stringobject.c 22 Apr 2002 11:57:05 -0000 2.147.6.2 *************** *** 1,3 **** - /* String object implementation */ --- 1,2 ---- *************** *** 606,610 **** /* figure out which quote to use; single is preferred */ quote = '\''; ! if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"')) quote = '"'; --- 605,610 ---- /* figure out which quote to use; single is preferred */ quote = '\''; ! if (strchr(op->ob_sval, '\'') && ! !strchr(op->ob_sval, '"')) quote = '"'; *************** *** 650,654 **** /* figure out which quote to use; single is preferred */ quote = '\''; ! if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"')) quote = '"'; --- 650,655 ---- /* figure out which quote to use; single is preferred */ quote = '\''; ! if (strchr(op->ob_sval, '\'') && ! !strchr(op->ob_sval, '"')) quote = '"'; *************** *** 2415,2418 **** --- 2416,2465 ---- } + static char zfill__doc__[] = + "S.zfill(width) -> string\n" + "\n" + "Pad a numeric string S with zeros on the left, to fill a field\n" + "of the specified width. The string S is never truncated."; + + static PyObject * + string_zfill(PyStringObject *self, PyObject *args) + { + int fill; + PyObject *s; + char *p; + + int width; + if (!PyArg_ParseTuple(args, "i:zfill", &width)) + return NULL; + + if (PyString_GET_SIZE(self) >= width) { + if (PyString_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*) self; + } + else + return PyString_FromStringAndSize( + PyString_AS_STRING(self), + PyString_GET_SIZE(self) + ); + } + + fill = width - PyString_GET_SIZE(self); + + s = pad(self, fill, 0, '0'); + + if (s == NULL) + return NULL; + + p = PyString_AS_STRING(s); + if (p[fill] == '+' || p[fill] == '-') { + /* move sign to beginning of string */ + p[0] = p[fill]; + p[fill] = '0'; + } + + return (PyObject*) s; + } + static char isspace__doc__[] = "S.isspace() -> int\n" *************** *** 2744,2750 **** {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, ! {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, capitalize__doc__}, {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, ! {"endswith", (PyCFunction)string_endswith, METH_VARARGS, endswith__doc__}, {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, --- 2791,2799 ---- {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, ! {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, ! capitalize__doc__}, {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, ! {"endswith", (PyCFunction)string_endswith, METH_VARARGS, ! endswith__doc__}, {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, *************** *** 2754,2772 **** {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, ! {"startswith", (PyCFunction)string_startswith, METH_VARARGS, startswith__doc__}, {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, ! {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, swapcase__doc__}, ! {"translate", (PyCFunction)string_translate, METH_VARARGS, translate__doc__}, {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, ! {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, expandtabs__doc__}, ! {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, splitlines__doc__}, ! #if 0 ! {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, ! #endif {NULL, NULL} /* sentinel */ }; --- 2803,2824 ---- {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, ! {"startswith", (PyCFunction)string_startswith, METH_VARARGS, ! startswith__doc__}, {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, ! {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, ! swapcase__doc__}, ! {"translate", (PyCFunction)string_translate, METH_VARARGS, ! translate__doc__}, {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, + {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, ! {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, ! expandtabs__doc__}, ! {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, ! splitlines__doc__}, {NULL, NULL} /* sentinel */ }; *************** *** 3263,3267 **** int sign; int len; ! char formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ #ifdef Py_USING_UNICODE char *fmt_start = fmt; --- 3315,3320 ---- int sign; int len; ! char formatbuf[FORMATBUFLEN]; ! /* For format{float,int,char}() */ #ifdef Py_USING_UNICODE char *fmt_start = fmt; *************** *** 3461,3465 **** else { pbuf = formatbuf; ! len = formatint(pbuf, sizeof(formatbuf), flags, prec, c, v); if (len < 0) --- 3514,3519 ---- else { pbuf = formatbuf; ! len = formatint(pbuf, ! sizeof(formatbuf), flags, prec, c, v); if (len < 0) *************** *** 3477,3481 **** case 'G': pbuf = formatbuf; ! len = formatfloat(pbuf, sizeof(formatbuf), flags, prec, c, v); if (len < 0) goto error; --- 3531,3536 ---- case 'G': pbuf = formatbuf; ! len = formatfloat(pbuf, sizeof(formatbuf), ! flags, prec, c, v); if (len < 0) goto error; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.6 retrieving revision 2.124.6.7 diff -C2 -d -r2.124.6.6 -r2.124.6.7 *** unicodeobject.c 18 Mar 2002 12:47:52 -0000 2.124.6.6 --- unicodeobject.c 22 Apr 2002 11:57:06 -0000 2.124.6.7 *************** *** 4811,4815 **** } - #if 0 static char zfill__doc__[] = "S.zfill(width) -> unicode\n\ --- 4811,4814 ---- *************** *** 4829,4834 **** if (self->length >= width) { ! Py_INCREF(self); ! return (PyObject*) self; } --- 4828,4840 ---- if (self->length >= width) { ! if (PyUnicode_CheckExact(self)) { ! Py_INCREF(self); ! return (PyObject*) self; ! } ! else ! return PyUnicode_FromUnicode( ! PyUnicode_AS_UNICODE(self), ! PyUnicode_GET_SIZE(self) ! ); } *************** *** 4837,4840 **** --- 4843,4849 ---- u = pad(self, fill, 0, '0'); + if (u == NULL) + return NULL; + if (u->str[fill] == '+' || u->str[fill] == '-') { /* move sign to beginning of string */ *************** *** 4845,4849 **** return (PyObject*) u; } - #endif #if 0 --- 4854,4857 ---- *************** *** 4957,4962 **** {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__}, - #if 0 {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, #endif --- 4965,4970 ---- {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__}, {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, + #if 0 {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, #endif From jackjansen@sourceforge.net Mon Apr 22 14:55:48 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Mon, 22 Apr 2002 06:55:48 -0700 Subject: [Python-checkins] python/dist/src/Lib macpath.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29352 Modified Files: macpath.py Log Message: Fixes based on ideas from Christopher Smith: - islink() now returns true for alias files - walk() no longer follows aliases while traversing - realpath() implemented, returning an alias-free pathname. As this could conceivably break existing code I think it isn't a bugfix candidate. Index: macpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** macpath.py 7 Apr 2002 06:36:23 -0000 1.35 --- macpath.py 22 Apr 2002 13:55:43 -0000 1.36 *************** *** 123,130 **** def islink(s): ! """Return true if the pathname refers to a symbolic link. ! Always false on the Mac, until we understand Aliases.)""" ! return False --- 123,133 ---- def islink(s): ! """Return true if the pathname refers to a symbolic link.""" ! try: ! import macfs ! return macfs.ResolveAliasFile(s)[2] ! except: ! return False *************** *** 224,228 **** for name in names: name = join(top, name) ! if isdir(name): walk(name, func, arg) --- 227,231 ---- for name in names: name = join(top, name) ! if isdir(name) and not islink(name): walk(name, func, arg) *************** *** 235,237 **** # realpath is a no-op on systems without islink support ! realpath = abspath --- 238,253 ---- # realpath is a no-op on systems without islink support ! def realpath(path): ! path = abspath(path) ! try: ! import macfs ! except ImportError: ! return path ! if not path: ! return path ! components = path.split(':') ! path = components[0] + ':' ! for c in components[1:]: ! path = join(path, c) ! path = macfs.ResolveAliasFile(path)[0].as_pathname() ! return path From bwarsaw@sourceforge.net Mon Apr 22 16:29:31 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 22 Apr 2002 08:29:31 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.8,4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv3651 Modified Files: python-mode.el Log Message: (py-execute-region): If you ran this without having visited a python-mode file, py-which-shell would have been nil and the command to use would not get set correctly. This changes things so that 1) the temporary file has a .py extension, 2) the temporary file is put into python-mode, and 3) the temporary file's py-which-shell is captured in a local `shell' variable, which is used to calculate the command to use. Closes SF bug #545436. (py-parse-state): Rip out the XEmacs-specific calls to buffer-syntactic-context, which can get quite confused if there's an open paren in column zero say, embedded in a triple quoted string. This was always a performance hack anyway, and computers are fast enough now that we should be able to get away with the slower, more portable, full-parse branch. Closes SF bug #451841. Update the comments at the top of the file. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.8 retrieving revision 4.9 diff -C2 -d -r4.8 -r4.9 *** python-mode.el 18 Mar 2002 18:53:56 -0000 4.8 --- python-mode.el 22 Apr 2002 15:29:27 -0000 4.9 *************** *** 3,7 **** ;; Copyright (C) 1992,1993,1994 Tim Peters ! ;; Author: 1995-2001 Barry A. Warsaw ;; 1992-1994 Tim Peters ;; Maintainer: python-mode@python.org --- 3,7 ---- ;; Copyright (C) 1992,1993,1994 Tim Peters ! ;; Author: 1995-2002 Barry A. Warsaw ;; 1992-1994 Tim Peters ;; Maintainer: python-mode@python.org *************** *** 28,37 **** ;; pdbtrack support contributed by Ken Manheimer, April 2001. ! ;; This version of python-mode.el has only been tested with XEmacs ! ;; 21.1.14 and Emacs 20.7 as these are the latest versions of these ! ;; Emacsen as of this writing (11-Apr-2001). I have no intent to test ! ;; it with earlier Emacsen, but I will accept patches if they are ! ;; small and reasonable. Please use the SourceForge Python project to ! ;; submit bugs or patches: ;; ;; http://sourceforge.net/projects/python --- 28,33 ---- ;; pdbtrack support contributed by Ken Manheimer, April 2001. ! ;; Please use the SourceForge Python project to submit bugs or ! ;; patches: ;; ;; http://sourceforge.net/projects/python *************** *** 43,50 **** ;; http://www.python.org/emacs/python-mode/ ;; ! ;; but this link is fairly out of date, due to the current difficulty ! ;; in updating that site. It does contain links to other packages that ! ;; you might find useful, such as pdb interfaces, OO-Browser links, ! ;; etc. Eventually, we'll be able to update it much more easily. ;; BUG REPORTING: --- 39,44 ---- ;; http://www.python.org/emacs/python-mode/ ;; ! ;; It does contain links to other packages that you might find useful, ! ;; such as pdb interfaces, OO-Browser links, etc. ;; BUG REPORTING: *************** *** 1356,1362 **** (format "python-%d" sn))) (make-temp-name "python-"))) ! (file (expand-file-name temp py-temp-directory)) (cur (current-buffer)) ! (buf (get-buffer-create file))) ;; Write the contents of the buffer, watching out for indented regions. (save-excursion --- 1350,1357 ---- (format "python-%d" sn))) (make-temp-name "python-"))) ! (file (concat (expand-file-name temp py-temp-directory) ".py")) (cur (current-buffer)) ! (buf (get-buffer-create file)) ! shell) ;; Write the contents of the buffer, watching out for indented regions. (save-excursion *************** *** 1364,1367 **** --- 1359,1364 ---- (let ((needs-if (/= (py-point 'bol) (py-point 'boi)))) (set-buffer buf) + (python-mode) + (setq shell py-which-shell) (when needs-if (insert "if 1:\n")) *************** *** 1378,1382 **** (arg (if (string-equal py-which-bufname "Python") "-u" ""))) ! (start-process py-which-bufname buf py-which-shell arg file) (pop-to-buffer buf) (py-postprocess-output-buffer buf) --- 1375,1379 ---- (arg (if (string-equal py-which-bufname "Python") "-u" ""))) ! (start-process py-which-bufname buf shell arg file) (pop-to-buffer buf) (py-postprocess-output-buffer buf) *************** *** 1397,1401 **** (t ;; TBD: a horrible hack, buy why create new Custom variables? ! (let ((cmd (concat py-which-shell (if (string-equal py-which-bufname "JPython") " -" "")))) --- 1394,1398 ---- (t ;; TBD: a horrible hack, buy why create new Custom variables? ! (let ((cmd (concat shell (if (string-equal py-which-bufname "JPython") " -" "")))) *************** *** 2910,2914 **** (save-excursion (let ((here (point)) ! in-listcomp pps done) (while (not done) ;; back up to the first preceding line (if any; else start of --- 2907,2911 ---- (save-excursion (let ((here (point)) ! pps done) (while (not done) ;; back up to the first preceding line (if any; else start of *************** *** 2919,2929 **** ;; write huge code blocks or huge lists ... tough beans. (re-search-backward py-parse-state-re nil 'move) - ;; Watch out for landing inside a list comprehension - (save-excursion - (if (and (looking-at "[ \t]*\\<\\(if\\|for\\)\\>") - (py-safe (progn (up-list -1) t)) - (eq (char-after) ?\[)) - (setq in-listcomp (point)) - (setq in-listcomp nil))) (beginning-of-line) ;; In XEmacs, we have a much better way to test for whether --- 2916,2919 ---- *************** *** 2932,2957 **** ;; without scanning from the beginning of the buffer, there's ;; no accurate way to determine this otherwise. ! (if (not (fboundp 'buffer-syntactic-context)) ! ;; Emacs ! (progn ! (save-excursion (setq pps (parse-partial-sexp (point) here))) ! ;; make sure we don't land inside a triple-quoted string ! (setq done (or (not (nth 3 pps)) ! (bobp))) ! ;; Just go ahead and short circuit the test back to the ! ;; beginning of the buffer. This will be slow, but not ! ;; nearly as slow as looping through many ! ;; re-search-backwards. ! (if (not done) ! (goto-char (point-min)))) ! ;; XEmacs ! (setq done (or (not (buffer-syntactic-context)) ! (bobp))) ! (when in-listcomp ! (goto-char in-listcomp) ! (setq done nil)) ! (when done ! (setq pps (parse-partial-sexp (point) here))) ! )) pps))) --- 2922,2935 ---- ;; without scanning from the beginning of the buffer, there's ;; no accurate way to determine this otherwise. ! (save-excursion (setq pps (parse-partial-sexp (point) here))) ! ;; make sure we don't land inside a triple-quoted string ! (setq done (or (not (nth 3 pps)) ! (bobp))) ! ;; Just go ahead and short circuit the test back to the ! ;; beginning of the buffer. This will be slow, but not ! ;; nearly as slow as looping through many ! ;; re-search-backwards. ! (if (not done) ! (goto-char (point-min)))) pps))) From bwarsaw@sourceforge.net Mon Apr 22 17:23:31 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 22 Apr 2002 09:23:31 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.9,4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24429 Modified Files: python-mode.el Log Message: (py-execute-region): If the line at the beginning of the region is a #! line, use the command on that line as the shell command to use to execute the region. I.e. if the region looks like ---------------- #! /usr/bin/env python1.5 print 'hello world'.startswith('hello') ---------------- you'll get an exception! :) This closes SF bug #232398. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.9 retrieving revision 4.10 diff -C2 -d -r4.9 -r4.10 *** python-mode.el 22 Apr 2002 15:29:27 -0000 4.9 --- python-mode.el 22 Apr 2002 16:23:29 -0000 4.10 *************** *** 1360,1367 **** (set-buffer buf) (python-mode) - (setq shell py-which-shell) (when needs-if (insert "if 1:\n")) ! (insert-buffer-substring cur start end))) (cond ;; always run the code in its own asynchronous subprocess --- 1360,1373 ---- (set-buffer buf) (python-mode) (when needs-if (insert "if 1:\n")) ! (insert-buffer-substring cur start end) ! ;; Set the shell either to the #! line command, or to the ! ;; py-which-shell buffer local variable. ! (goto-char (point-min)) ! (if (looking-at "^#!\\s *\\(.*\\)$") ! (setq shell (match-string 1)) ! ;; No useable #! line ! (setq shell py-which-shell)))) (cond ;; always run the code in its own asynchronous subprocess *************** *** 1393,1400 **** (setq py-exception-buffer (cons file (current-buffer)))) (t ! ;; TBD: a horrible hack, buy why create new Custom variables? ! (let ((cmd (concat shell ! (if (string-equal py-which-bufname "JPython") ! " -" "")))) ;; otherwise either run it synchronously in a subprocess (save-excursion --- 1399,1405 ---- (setq py-exception-buffer (cons file (current-buffer)))) (t ! ;; TBD: a horrible hack, but why create new Custom variables? ! (let ((cmd (concat shell (if (string-equal py-which-bufname "JPython") ! " -" "")))) ;; otherwise either run it synchronously in a subprocess (save-excursion From bwarsaw@sourceforge.net Mon Apr 22 18:15:22 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 22 Apr 2002 10:15:22 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.10,4.11 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15084 Modified Files: python-mode.el Log Message: Skip Montanaro's contribution (slightly mod'd by Barry) to provide a "help-on-symbol-at-point" feature which uses pydoc to provide help on the symbol under point, if available. Mods include some name changes, a port to Emacs, binding the command to C-c C-h, and providing a more informative error message if the symbol's help can't be found (through use of a nasty bare except). Note also that py-describe-mode has been moved off of C-c C-h m; it's now just available on C-c ? Closes SF patch #545439. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.10 retrieving revision 4.11 diff -C2 -d -r4.10 -r4.11 *** python-mode.el 22 Apr 2002 16:23:29 -0000 4.10 --- python-mode.el 22 Apr 2002 17:15:19 -0000 4.11 *************** *** 499,503 **** (define-key py-mode-map "\C-c#" 'py-comment-region) (define-key py-mode-map "\C-c?" 'py-describe-mode) ! (define-key py-mode-map "\C-c\C-hm" 'py-describe-mode) (define-key py-mode-map "\e\C-a" 'py-beginning-of-def-or-class) (define-key py-mode-map "\e\C-e" 'py-end-of-def-or-class) --- 499,503 ---- (define-key py-mode-map "\C-c#" 'py-comment-region) (define-key py-mode-map "\C-c?" 'py-describe-mode) ! (define-key py-mode-map "\C-c\C-h" 'py-help-at-point) (define-key py-mode-map "\e\C-a" 'py-beginning-of-def-or-class) (define-key py-mode-map "\e\C-e" 'py-end-of-def-or-class) *************** *** 554,559 **** (defvar py-mode-syntax-table nil "Syntax table used in `python-mode' buffers.") ! (if py-mode-syntax-table ! nil (setq py-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\( "()" py-mode-syntax-table) --- 554,558 ---- (defvar py-mode-syntax-table nil "Syntax table used in `python-mode' buffers.") ! (when (not py-mode-syntax-table) (setq py-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\( "()" py-mode-syntax-table) *************** *** 596,603 **** ) ;; Utilities - (defmacro py-safe (&rest body) "Safely execute BODY, return nil if an error occurred." --- 595,611 ---- ) + ;; An auxiliary syntax table which places underscore and dot in the + ;; symbol class for simplicity + (defvar py-dotted-expression-syntax-table nil + "Syntax table used to identify Python dotted expressions.") + (when (not py-dotted-expression-syntax-table) + (setq py-dotted-expression-syntax-table + (copy-syntax-table py-mode-syntax-table)) + (modify-syntax-entry ?_ "_" py-dotted-expression-syntax-table) + (modify-syntax-entry ?. "_" py-dotted-expression-syntax-table)) + ;; Utilities (defmacro py-safe (&rest body) "Safely execute BODY, return nil if an error occurred." *************** *** 2599,2602 **** --- 2607,2652 ---- (interactive) (py-pdbtrack-toggle-stack-tracking 0)) + + + + ;; Skip's python-help commands. The guts of this function is stolen + ;; from XEmacs's symbol-near-point, but without the useless + ;; regexp-quote call on the results, nor the interactive bit. Also, + ;; we've added the temporary syntax table setting, which Skip + ;; originally had broken out into a separate function. Note that + ;; Emacs doesn't have the original function. + (defun py-symbol-near-point () + "Return the first textual item to the nearest point." + ;; alg stolen from etag.el + (save-excursion + (with-syntax-table py-dotted-expression-syntax-table + (if (or (bobp) (not (memq (char-syntax (char-before)) '(?w ?_)))) + (while (not (looking-at "\\sw\\|\\s_\\|\\'")) + (forward-char 1))) + (while (looking-at "\\sw\\|\\s_") + (forward-char 1)) + (if (re-search-backward "\\sw\\|\\s_" nil t) + (progn (forward-char 1) + (buffer-substring (point) + (progn (forward-sexp -1) + (while (looking-at "\\s'") + (forward-char 1)) + (point)))) + nil)))) + + (defun py-help-at-point () + "Get help from Python based on the symbol nearest point." + (interactive) + (let* ((sym (py-symbol-near-point)) + (base (substring sym 0 (or (search "." sym :from-end t) 0))) + cmd) + (if (not (equal base "")) + (setq cmd (concat "import " base "\n"))) + (setq cmd (concat "import pydoc\n" + cmd + "try: pydoc.help(" sym ")\n" + "except: print 'No help available on:', \"" sym "\"")) + (message cmd) + (py-execute-string cmd))) From doerwalter@sourceforge.net Mon Apr 22 18:42:39 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 10:42:39 -0700 Subject: [Python-checkins] python/dist/src/Include unicodeobject.h,2.36,2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv30740/Include Modified Files: unicodeobject.h Log Message: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** unicodeobject.h 19 Oct 2001 02:01:31 -0000 2.36 --- unicodeobject.h 22 Apr 2002 17:42:37 -0000 2.37 *************** *** 1041,1044 **** --- 1041,1051 ---- ); + /* Externally visible for str.strip(unicode) */ + extern DL_IMPORT(PyObject *) _PyUnicode_XStrip( + PyUnicodeObject *self, + int striptype, + PyObject *sepobj + ); + /* === Characters Type APIs =============================================== */ From doerwalter@sourceforge.net Mon Apr 22 18:42:39 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 10:42:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.14,1.15 test_unicode.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30740/Lib/test Modified Files: string_tests.py test_unicode.py Log Message: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** string_tests.py 16 Apr 2002 01:38:40 -0000 1.14 --- string_tests.py 22 Apr 2002 17:42:37 -0000 1.15 *************** *** 170,178 **** test('strip', 'hello', 'hello', None) ! # strip/lstrip/rstrip with real arg test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz') test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz') test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz') test('strip', 'hello', 'hello', 'xyz') test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') --- 170,184 ---- test('strip', 'hello', 'hello', None) ! # strip/lstrip/rstrip with str arg test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz') test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz') test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz') test('strip', 'hello', 'hello', 'xyz') + + # strip/lstrip/rstrip with unicode arg + test('strip', 'xyzzyhelloxyzzy', u'hello', u'xyz') + test('lstrip', 'xyzzyhelloxyzzy', u'helloxyzzy', u'xyz') + test('rstrip', 'xyzzyhelloxyzzy', u'xyzzyhello', u'xyz') + test('strip', 'hello', u'hello', u'xyz') test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** test_unicode.py 17 Apr 2002 21:34:05 -0000 1.56 --- test_unicode.py 22 Apr 2002 17:42:37 -0000 1.57 *************** *** 170,173 **** --- 170,191 ---- test('strip', u'hello', u'hello') + # strip/lstrip/rstrip with None arg + test('strip', u' hello ', u'hello', None) + test('lstrip', u' hello ', u'hello ', None) + test('rstrip', u' hello ', u' hello', None) + test('strip', u'hello', u'hello', None) + + # strip/lstrip/rstrip with unicode arg + test('strip', u'xyzzyhelloxyzzy', u'hello', u'xyz') + test('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', u'xyz') + test('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', u'xyz') + test('strip', u'hello', u'hello', u'xyz') + + # strip/lstrip/rstrip with str arg + test('strip', u'xyzzyhelloxyzzy', u'hello', 'xyz') + test('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', 'xyz') + test('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', 'xyz') + test('strip', u'hello', u'hello', 'xyz') + test('swapcase', u'HeLLo cOmpUteRs', u'hEllO CoMPuTErS') From doerwalter@sourceforge.net Mon Apr 22 18:42:39 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 10:42:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv30740/Doc/lib Modified Files: libstring.tex Log Message: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** libstring.tex 20 Oct 2001 04:24:09 -0000 1.45 --- libstring.tex 22 Apr 2002 17:42:36 -0000 1.46 *************** *** 236,250 **** \end{funcdesc} ! \begin{funcdesc}{lstrip}{s} ! Return a copy of \var{s} but without leading whitespace characters. \end{funcdesc} ! \begin{funcdesc}{rstrip}{s} ! Return a copy of \var{s} but without trailing whitespace ! characters. \end{funcdesc} ! \begin{funcdesc}{strip}{s} ! Return a copy of \var{s} without leading or trailing whitespace. \end{funcdesc} --- 236,261 ---- \end{funcdesc} ! \begin{funcdesc}{lstrip}{s\optional{, chars}} ! Return a copy of the string with leading characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the beginning of ! the string this method is called on. \end{funcdesc} ! \begin{funcdesc}{rstrip}{s\optional{, chars}} ! Return a copy of the string with trailing characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the end of the ! string this method is called on. \end{funcdesc} ! \begin{funcdesc}{strip}{s\optional{, chars}} ! Return a copy of the string with leading and trailing characters ! removed. If \var{chars} is omitted or \code{None}, whitespace ! characters are removed. If given and not \code{None}, \var{chars} ! must be a string; the characters in the string will be stripped from ! the both ends of the string this method is called on. \end{funcdesc} From doerwalter@sourceforge.net Mon Apr 22 18:42:40 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 10:42:40 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.159,2.160 unicodeobject.c,2.143,2.144 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30740/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** stringobject.c 15 Apr 2002 18:42:15 -0000 2.159 --- stringobject.c 22 Apr 2002 17:42:37 -0000 2.160 *************** *** 1006,1010 **** /* Arrays indexed by above */ ! static const char *stripname[] = {"lstrip", "rstrip", "strip"}; --- 1006,1012 ---- /* Arrays indexed by above */ ! static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; ! ! #define STRIPNAME(i) (stripformat[i]+3) *************** *** 1450,1462 **** PyObject *sep = NULL; ! if (!PyArg_ParseTuple(args, "|O:[lr]strip", &sep)) return NULL; if (sep != NULL && sep != Py_None) { ! /* XXX What about Unicode? */ ! if (!PyString_Check(sep)) { PyErr_Format(PyExc_TypeError, ! "%s arg must be None or string", ! stripname[striptype]); return NULL; } --- 1452,1475 ---- PyObject *sep = NULL; ! if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) return NULL; if (sep != NULL && sep != Py_None) { ! if (PyString_Check(sep)) ! return do_xstrip(self, striptype, sep); ! else if (PyUnicode_Check(sep)) { ! PyObject *uniself = PyUnicode_FromObject((PyObject *)self); ! PyObject *res; ! if (uniself==NULL) ! return NULL; ! res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, ! striptype, sep); ! Py_DECREF(uniself); ! return res; ! } ! else { PyErr_Format(PyExc_TypeError, ! "%s arg must be None, str or unicode", ! STRIPNAME(striptype)); return NULL; } *************** *** 1469,1477 **** static char strip__doc__[] = ! "S.strip([sep]) -> string\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * --- 1482,1491 ---- static char strip__doc__[] = ! "S.strip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * *************** *** 1486,1493 **** static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * --- 1500,1508 ---- static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * *************** *** 1502,1509 **** static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * --- 1517,1525 ---- static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.143 retrieving revision 2.144 diff -C2 -d -r2.143 -r2.144 *** unicodeobject.c 21 Apr 2002 17:28:06 -0000 2.143 --- unicodeobject.c 22 Apr 2002 17:42:37 -0000 2.144 *************** *** 3505,3537 **** static - PyObject *strip(PyUnicodeObject *self, - int left, - int right) - { - Py_UNICODE *p = self->str; - int start = 0; - int end = self->length; - - if (left) - while (start < end && Py_UNICODE_ISSPACE(p[start])) - start++; - - if (right) - while (end > start && Py_UNICODE_ISSPACE(p[end-1])) - end--; - - if (start == 0 && end == self->length && PyUnicode_CheckExact(self)) { - /* couldn't strip anything off, return original string */ - Py_INCREF(self); - return (PyObject*) self; - } - - return (PyObject*) PyUnicode_FromUnicode( - self->str + start, - end - start - ); - } - - static PyObject *replace(PyUnicodeObject *self, PyUnicodeObject *str1, --- 3505,3508 ---- *************** *** 4465,4479 **** } static char lstrip__doc__[] = ! "S.lstrip() -> unicode\n\ \n\ ! Return a copy of the string S with leading whitespace removed."; static PyObject * ! unicode_lstrip(PyUnicodeObject *self) { ! return strip(self, 1, 0); } static PyObject* unicode_repeat(PyUnicodeObject *str, int len) --- 4436,4606 ---- } + #define LEFTSTRIP 0 + #define RIGHTSTRIP 1 + #define BOTHSTRIP 2 + + /* Arrays indexed by above */ + static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; + + #define STRIPNAME(i) (stripformat[i]+3) + + static const Py_UNICODE * + unicode_memchr(const Py_UNICODE *s, Py_UNICODE c, size_t n) + { + int i; + for (i = 0; i= i && unicode_memchr(sep, s[j], seplen)); + j++; + } + + if (i == 0 && j == len && PyUnicode_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyUnicode_FromUnicode(s+i, j-i); + } + + + static PyObject * + do_strip(PyUnicodeObject *self, int striptype) + { + Py_UNICODE *s = PyUnicode_AS_UNICODE(self); + int len = PyUnicode_GET_SIZE(self), i, j; + + i = 0; + if (striptype != RIGHTSTRIP) { + while (i < len && Py_UNICODE_ISSPACE(s[i])) { + i++; + } + } + + j = len; + if (striptype != LEFTSTRIP) { + do { + j--; + } while (j >= i && Py_UNICODE_ISSPACE(s[j])); + j++; + } + + if (i == 0 && j == len && PyUnicode_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyUnicode_FromUnicode(s+i, j-i); + } + + + static PyObject * + do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args) + { + PyObject *sep = NULL; + + if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) + return NULL; + + if (sep != NULL && sep != Py_None) { + if (PyUnicode_Check(sep)) + return _PyUnicode_XStrip(self, striptype, sep); + else if (PyString_Check(sep)) { + PyObject *res; + sep = PyUnicode_FromObject(sep); + if (sep==NULL) + return NULL; + res = _PyUnicode_XStrip(self, striptype, sep); + Py_DECREF(sep); + return res; + } + else { + PyErr_Format(PyExc_TypeError, + "%s arg must be None, unicode or str", + STRIPNAME(striptype)); + return NULL; + } + } + + return do_strip(self, striptype); + } + + + static char strip__doc__[] = + "S.strip([sep]) -> unicode\n\ + \n\ + Return a copy of the string S with leading and trailing\n\ + whitespace removed.\n\ + If sep is given and not None, remove characters in sep instead.\n\ + If sep is a str, it will be converted to unicode before stripping"; + + static PyObject * + unicode_strip(PyUnicodeObject *self, PyObject *args) + { + if (PyTuple_GET_SIZE(args) == 0) + return do_strip(self, BOTHSTRIP); /* Common case */ + else + return do_argstrip(self, BOTHSTRIP, args); + } + + static char lstrip__doc__[] = ! "S.lstrip([sep]) -> unicode\n\ \n\ ! Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; static PyObject * ! unicode_lstrip(PyUnicodeObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, LEFTSTRIP); /* Common case */ ! else ! return do_argstrip(self, LEFTSTRIP, args); ! } ! ! ! static char rstrip__doc__[] = ! "S.rstrip([sep]) -> unicode\n\ ! \n\ ! Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; ! ! static PyObject * ! unicode_rstrip(PyUnicodeObject *self, PyObject *args) ! { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, RIGHTSTRIP); /* Common case */ ! else ! return do_argstrip(self, RIGHTSTRIP, args); } + static PyObject* unicode_repeat(PyUnicodeObject *str, int len) *************** *** 4678,4692 **** } - static char rstrip__doc__[] = - "S.rstrip() -> unicode\n\ - \n\ - Return a copy of the string S with trailing whitespace removed."; - - static PyObject * - unicode_rstrip(PyUnicodeObject *self) - { - return strip(self, 0, 1); - } - static PyObject* unicode_slice(PyUnicodeObject *self, int start, int end) --- 4805,4808 ---- *************** *** 4784,4798 **** } - static char strip__doc__[] = - "S.strip() -> unicode\n\ - \n\ - Return a copy of S with leading and trailing whitespace removed."; - - static PyObject * - unicode_strip(PyUnicodeObject *self) - { - return strip(self, 1, 1); - } - static char swapcase__doc__[] = "S.swapcase() -> unicode\n\ --- 4900,4903 ---- *************** *** 4967,4978 **** {"ljust", (PyCFunction) unicode_ljust, METH_VARARGS, ljust__doc__}, {"lower", (PyCFunction) unicode_lower, METH_NOARGS, lower__doc__}, ! {"lstrip", (PyCFunction) unicode_lstrip, METH_NOARGS, lstrip__doc__}, /* {"maketrans", (PyCFunction) unicode_maketrans, METH_VARARGS, maketrans__doc__}, */ {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS, rindex__doc__}, {"rjust", (PyCFunction) unicode_rjust, METH_VARARGS, rjust__doc__}, ! {"rstrip", (PyCFunction) unicode_rstrip, METH_NOARGS, rstrip__doc__}, {"splitlines", (PyCFunction) unicode_splitlines, METH_VARARGS, splitlines__doc__}, ! {"strip", (PyCFunction) unicode_strip, METH_NOARGS, strip__doc__}, {"swapcase", (PyCFunction) unicode_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction) unicode_translate, METH_O, translate__doc__}, --- 5072,5083 ---- {"ljust", (PyCFunction) unicode_ljust, METH_VARARGS, ljust__doc__}, {"lower", (PyCFunction) unicode_lower, METH_NOARGS, lower__doc__}, ! {"lstrip", (PyCFunction) unicode_lstrip, METH_VARARGS, lstrip__doc__}, /* {"maketrans", (PyCFunction) unicode_maketrans, METH_VARARGS, maketrans__doc__}, */ {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS, rindex__doc__}, {"rjust", (PyCFunction) unicode_rjust, METH_VARARGS, rjust__doc__}, ! {"rstrip", (PyCFunction) unicode_rstrip, METH_VARARGS, rstrip__doc__}, {"splitlines", (PyCFunction) unicode_splitlines, METH_VARARGS, splitlines__doc__}, ! {"strip", (PyCFunction) unicode_strip, METH_VARARGS, strip__doc__}, {"swapcase", (PyCFunction) unicode_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction) unicode_translate, METH_O, translate__doc__}, From doerwalter@sourceforge.net Mon Apr 22 19:42:46 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 11:42:46 -0700 Subject: [Python-checkins] python/dist/src/Include unicodeobject.h,2.36,2.36.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23553/Include Modified Files: Tag: release22-maint unicodeobject.h Log Message: Backport checkin: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.36 retrieving revision 2.36.10.1 diff -C2 -d -r2.36 -r2.36.10.1 *** unicodeobject.h 19 Oct 2001 02:01:31 -0000 2.36 --- unicodeobject.h 22 Apr 2002 18:42:44 -0000 2.36.10.1 *************** *** 1041,1044 **** --- 1041,1051 ---- ); + /* Externally visible for str.strip(unicode) */ + extern DL_IMPORT(PyObject *) _PyUnicode_XStrip( + PyUnicodeObject *self, + int striptype, + PyObject *sepobj + ); + /* === Characters Type APIs =============================================== */ From doerwalter@sourceforge.net Mon Apr 22 19:42:46 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 11:42:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.45,1.45.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23553/Doc/lib Modified Files: Tag: release22-maint libstring.tex Log Message: Backport checkin: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.45 retrieving revision 1.45.8.1 diff -C2 -d -r1.45 -r1.45.8.1 *** libstring.tex 20 Oct 2001 04:24:09 -0000 1.45 --- libstring.tex 22 Apr 2002 18:42:44 -0000 1.45.8.1 *************** *** 236,250 **** \end{funcdesc} ! \begin{funcdesc}{lstrip}{s} ! Return a copy of \var{s} but without leading whitespace characters. \end{funcdesc} ! \begin{funcdesc}{rstrip}{s} ! Return a copy of \var{s} but without trailing whitespace ! characters. \end{funcdesc} ! \begin{funcdesc}{strip}{s} ! Return a copy of \var{s} without leading or trailing whitespace. \end{funcdesc} --- 236,261 ---- \end{funcdesc} ! \begin{funcdesc}{lstrip}{s\optional{, chars}} ! Return a copy of the string with leading characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the beginning of ! the string this method is called on. \end{funcdesc} ! \begin{funcdesc}{rstrip}{s\optional{, chars}} ! Return a copy of the string with trailing characters removed. If ! \var{chars} is omitted or \code{None}, whitespace characters are ! removed. If given and not \code{None}, \var{chars} must be a string; ! the characters in the string will be stripped from the end of the ! string this method is called on. \end{funcdesc} ! \begin{funcdesc}{strip}{s\optional{, chars}} ! Return a copy of the string with leading and trailing characters ! removed. If \var{chars} is omitted or \code{None}, whitespace ! characters are removed. If given and not \code{None}, \var{chars} ! must be a string; the characters in the string will be stripped from ! the both ends of the string this method is called on. \end{funcdesc} From doerwalter@sourceforge.net Mon Apr 22 19:42:47 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 11:42:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.10.16.2,1.10.16.3 test_unicode.py,1.47.6.2,1.47.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23553/Lib/test Modified Files: Tag: release22-maint string_tests.py test_unicode.py Log Message: Backport checkin: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.10.16.2 retrieving revision 1.10.16.3 diff -C2 -d -r1.10.16.2 -r1.10.16.3 *** string_tests.py 22 Apr 2002 11:57:05 -0000 1.10.16.2 --- string_tests.py 22 Apr 2002 18:42:44 -0000 1.10.16.3 *************** *** 170,178 **** test('strip', 'hello', 'hello', None) ! # strip/lstrip/rstrip with real arg test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz') test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz') test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz') test('strip', 'hello', 'hello', 'xyz') test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') --- 170,184 ---- test('strip', 'hello', 'hello', None) ! # strip/lstrip/rstrip with str arg test('strip', 'xyzzyhelloxyzzy', 'hello', 'xyz') test('lstrip', 'xyzzyhelloxyzzy', 'helloxyzzy', 'xyz') test('rstrip', 'xyzzyhelloxyzzy', 'xyzzyhello', 'xyz') test('strip', 'hello', 'hello', 'xyz') + + # strip/lstrip/rstrip with unicode arg + test('strip', 'xyzzyhelloxyzzy', u'hello', u'xyz') + test('lstrip', 'xyzzyhelloxyzzy', u'helloxyzzy', u'xyz') + test('rstrip', 'xyzzyhelloxyzzy', u'xyzzyhello', u'xyz') + test('strip', 'hello', u'hello', u'xyz') test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.47.6.2 retrieving revision 1.47.6.3 diff -C2 -d -r1.47.6.2 -r1.47.6.3 *** test_unicode.py 22 Apr 2002 11:57:05 -0000 1.47.6.2 --- test_unicode.py 22 Apr 2002 18:42:44 -0000 1.47.6.3 *************** *** 147,150 **** --- 147,168 ---- test('strip', u'hello', u'hello') + # strip/lstrip/rstrip with None arg + test('strip', u' hello ', u'hello', None) + test('lstrip', u' hello ', u'hello ', None) + test('rstrip', u' hello ', u' hello', None) + test('strip', u'hello', u'hello', None) + + # strip/lstrip/rstrip with unicode arg + test('strip', u'xyzzyhelloxyzzy', u'hello', u'xyz') + test('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', u'xyz') + test('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', u'xyz') + test('strip', u'hello', u'hello', u'xyz') + + # strip/lstrip/rstrip with str arg + test('strip', u'xyzzyhelloxyzzy', u'hello', 'xyz') + test('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', 'xyz') + test('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', 'xyz') + test('strip', u'hello', u'hello', 'xyz') + test('swapcase', u'HeLLo cOmpUteRs', u'hEllO CoMPuTErS') From doerwalter@sourceforge.net Mon Apr 22 19:42:47 2002 From: doerwalter@sourceforge.net (doerwalter@sourceforge.net) Date: Mon, 22 Apr 2002 11:42:47 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.147.6.2,2.147.6.3 unicodeobject.c,2.124.6.7,2.124.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23553/Objects Modified Files: Tag: release22-maint stringobject.c unicodeobject.c Log Message: Backport checkin: Apply patch diff.txt from SF feature request http://www.python.org/sf/444708 This adds the optional argument for str.strip to unicode.strip too and makes it possible to call str.strip with a unicode argument and unicode.strip with a str argument. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.2 retrieving revision 2.147.6.3 diff -C2 -d -r2.147.6.2 -r2.147.6.3 *** stringobject.c 22 Apr 2002 11:57:05 -0000 2.147.6.2 --- stringobject.c 22 Apr 2002 18:42:44 -0000 2.147.6.3 *************** *** 1038,1042 **** /* Arrays indexed by above */ ! static const char *stripname[] = {"lstrip", "rstrip", "strip"}; --- 1038,1044 ---- /* Arrays indexed by above */ ! static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; ! ! #define STRIPNAME(i) (stripformat[i]+3) *************** *** 1482,1494 **** PyObject *sep = NULL; ! if (!PyArg_ParseTuple(args, "|O:[lr]strip", &sep)) return NULL; if (sep != NULL && sep != Py_None) { ! /* XXX What about Unicode? */ ! if (!PyString_Check(sep)) { PyErr_Format(PyExc_TypeError, ! "%s arg must be None or string", ! stripname[striptype]); return NULL; } --- 1484,1507 ---- PyObject *sep = NULL; ! if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) return NULL; if (sep != NULL && sep != Py_None) { ! if (PyString_Check(sep)) ! return do_xstrip(self, striptype, sep); ! else if (PyUnicode_Check(sep)) { ! PyObject *uniself = PyUnicode_FromObject((PyObject *)self); ! PyObject *res; ! if (uniself==NULL) ! return NULL; ! res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, ! striptype, sep); ! Py_DECREF(uniself); ! return res; ! } ! else { PyErr_Format(PyExc_TypeError, ! "%s arg must be None, str or unicode", ! STRIPNAME(striptype)); return NULL; } *************** *** 1501,1509 **** static char strip__doc__[] = ! "S.strip([sep]) -> string\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * --- 1514,1523 ---- static char strip__doc__[] = ! "S.strip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading and trailing\n\ whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * *************** *** 1518,1525 **** static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * --- 1532,1540 ---- static char lstrip__doc__[] = ! "S.lstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * *************** *** 1534,1541 **** static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead."; static PyObject * --- 1549,1557 ---- static char rstrip__doc__[] = ! "S.rstrip([sep]) -> string or unicode\n\ \n\ Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is unicode, S will be converted to unicode before stripping"; static PyObject * Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.7 retrieving revision 2.124.6.8 diff -C2 -d -r2.124.6.7 -r2.124.6.8 *** unicodeobject.c 22 Apr 2002 11:57:06 -0000 2.124.6.7 --- unicodeobject.c 22 Apr 2002 18:42:45 -0000 2.124.6.8 *************** *** 3481,3513 **** static - PyObject *strip(PyUnicodeObject *self, - int left, - int right) - { - Py_UNICODE *p = self->str; - int start = 0; - int end = self->length; - - if (left) - while (start < end && Py_UNICODE_ISSPACE(p[start])) - start++; - - if (right) - while (end > start && Py_UNICODE_ISSPACE(p[end-1])) - end--; - - if (start == 0 && end == self->length && PyUnicode_CheckExact(self)) { - /* couldn't strip anything off, return original string */ - Py_INCREF(self); - return (PyObject*) self; - } - - return (PyObject*) PyUnicode_FromUnicode( - self->str + start, - end - start - ); - } - - static PyObject *replace(PyUnicodeObject *self, PyUnicodeObject *str1, --- 3481,3484 ---- *************** *** 4441,4455 **** } static char lstrip__doc__[] = ! "S.lstrip() -> unicode\n\ \n\ ! Return a copy of the string S with leading whitespace removed."; static PyObject * ! unicode_lstrip(PyUnicodeObject *self) { ! return strip(self, 1, 0); } static PyObject* unicode_repeat(PyUnicodeObject *str, int len) --- 4412,4582 ---- } + #define LEFTSTRIP 0 + #define RIGHTSTRIP 1 + #define BOTHSTRIP 2 + + /* Arrays indexed by above */ + static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; + + #define STRIPNAME(i) (stripformat[i]+3) + + static const Py_UNICODE * + unicode_memchr(const Py_UNICODE *s, Py_UNICODE c, size_t n) + { + int i; + for (i = 0; i= i && unicode_memchr(sep, s[j], seplen)); + j++; + } + + if (i == 0 && j == len && PyUnicode_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyUnicode_FromUnicode(s+i, j-i); + } + + + static PyObject * + do_strip(PyUnicodeObject *self, int striptype) + { + Py_UNICODE *s = PyUnicode_AS_UNICODE(self); + int len = PyUnicode_GET_SIZE(self), i, j; + + i = 0; + if (striptype != RIGHTSTRIP) { + while (i < len && Py_UNICODE_ISSPACE(s[i])) { + i++; + } + } + + j = len; + if (striptype != LEFTSTRIP) { + do { + j--; + } while (j >= i && Py_UNICODE_ISSPACE(s[j])); + j++; + } + + if (i == 0 && j == len && PyUnicode_CheckExact(self)) { + Py_INCREF(self); + return (PyObject*)self; + } + else + return PyUnicode_FromUnicode(s+i, j-i); + } + + + static PyObject * + do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args) + { + PyObject *sep = NULL; + + if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) + return NULL; + + if (sep != NULL && sep != Py_None) { + if (PyUnicode_Check(sep)) + return _PyUnicode_XStrip(self, striptype, sep); + else if (PyString_Check(sep)) { + PyObject *res; + sep = PyUnicode_FromObject(sep); + if (sep==NULL) + return NULL; + res = _PyUnicode_XStrip(self, striptype, sep); + Py_DECREF(sep); + return res; + } + else { + PyErr_Format(PyExc_TypeError, + "%s arg must be None, unicode or str", + STRIPNAME(striptype)); + return NULL; + } + } + + return do_strip(self, striptype); + } + + + static char strip__doc__[] = + "S.strip([sep]) -> unicode\n\ + \n\ + Return a copy of the string S with leading and trailing\n\ + whitespace removed.\n\ + If sep is given and not None, remove characters in sep instead.\n\ + If sep is a str, it will be converted to unicode before stripping"; + + static PyObject * + unicode_strip(PyUnicodeObject *self, PyObject *args) + { + if (PyTuple_GET_SIZE(args) == 0) + return do_strip(self, BOTHSTRIP); /* Common case */ + else + return do_argstrip(self, BOTHSTRIP, args); + } + + static char lstrip__doc__[] = ! "S.lstrip([sep]) -> unicode\n\ \n\ ! Return a copy of the string S with leading whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; static PyObject * ! unicode_lstrip(PyUnicodeObject *self, PyObject *args) { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, LEFTSTRIP); /* Common case */ ! else ! return do_argstrip(self, LEFTSTRIP, args); ! } ! ! ! static char rstrip__doc__[] = ! "S.rstrip([sep]) -> unicode\n\ ! \n\ ! Return a copy of the string S with trailing whitespace removed.\n\ ! If sep is given and not None, remove characters in sep instead.\n\ ! If sep is a str, it will be converted to unicode before stripping"; ! ! static PyObject * ! unicode_rstrip(PyUnicodeObject *self, PyObject *args) ! { ! if (PyTuple_GET_SIZE(args) == 0) ! return do_strip(self, RIGHTSTRIP); /* Common case */ ! else ! return do_argstrip(self, RIGHTSTRIP, args); } + static PyObject* unicode_repeat(PyUnicodeObject *str, int len) *************** *** 4654,4668 **** } - static char rstrip__doc__[] = - "S.rstrip() -> unicode\n\ - \n\ - Return a copy of the string S with trailing whitespace removed."; - - static PyObject * - unicode_rstrip(PyUnicodeObject *self) - { - return strip(self, 0, 1); - } - static PyObject* unicode_slice(PyUnicodeObject *self, int start, int end) --- 4781,4784 ---- *************** *** 4760,4774 **** } - static char strip__doc__[] = - "S.strip() -> unicode\n\ - \n\ - Return a copy of S with leading and trailing whitespace removed."; - - static PyObject * - unicode_strip(PyUnicodeObject *self) - { - return strip(self, 1, 1); - } - static char swapcase__doc__[] = "S.swapcase() -> unicode\n\ --- 4876,4879 ---- *************** *** 4943,4954 **** {"ljust", (PyCFunction) unicode_ljust, METH_VARARGS, ljust__doc__}, {"lower", (PyCFunction) unicode_lower, METH_NOARGS, lower__doc__}, ! {"lstrip", (PyCFunction) unicode_lstrip, METH_NOARGS, lstrip__doc__}, /* {"maketrans", (PyCFunction) unicode_maketrans, METH_VARARGS, maketrans__doc__}, */ {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS, rindex__doc__}, {"rjust", (PyCFunction) unicode_rjust, METH_VARARGS, rjust__doc__}, ! {"rstrip", (PyCFunction) unicode_rstrip, METH_NOARGS, rstrip__doc__}, {"splitlines", (PyCFunction) unicode_splitlines, METH_VARARGS, splitlines__doc__}, ! {"strip", (PyCFunction) unicode_strip, METH_NOARGS, strip__doc__}, {"swapcase", (PyCFunction) unicode_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction) unicode_translate, METH_O, translate__doc__}, --- 5048,5059 ---- {"ljust", (PyCFunction) unicode_ljust, METH_VARARGS, ljust__doc__}, {"lower", (PyCFunction) unicode_lower, METH_NOARGS, lower__doc__}, ! {"lstrip", (PyCFunction) unicode_lstrip, METH_VARARGS, lstrip__doc__}, /* {"maketrans", (PyCFunction) unicode_maketrans, METH_VARARGS, maketrans__doc__}, */ {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS, rfind__doc__}, {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS, rindex__doc__}, {"rjust", (PyCFunction) unicode_rjust, METH_VARARGS, rjust__doc__}, ! {"rstrip", (PyCFunction) unicode_rstrip, METH_VARARGS, rstrip__doc__}, {"splitlines", (PyCFunction) unicode_splitlines, METH_VARARGS, splitlines__doc__}, ! {"strip", (PyCFunction) unicode_strip, METH_VARARGS, strip__doc__}, {"swapcase", (PyCFunction) unicode_swapcase, METH_NOARGS, swapcase__doc__}, {"translate", (PyCFunction) unicode_translate, METH_O, translate__doc__}, From tim_one@sourceforge.net Mon Apr 22 19:43:52 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 22 Apr 2002 11:43:52 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle CallTipWindow.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv23115/python/Tools/idle Modified Files: CallTipWindow.py Log Message: SF bug 546078: IDLE calltips cause application error. Assorted crashes on Windows and Linux when trying to display a very long calltip, most likely a Tk bug. Wormed around by clamping the calltip display to a maximum of 79 characters (why 79? why not ...). Bugfix candidate, for all Python releases. Index: CallTipWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTipWindow.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CallTipWindow.py 17 Jan 2001 08:48:39 -0000 1.3 --- CallTipWindow.py 22 Apr 2002 18:43:49 -0000 1.4 *************** *** 15,19 **** --- 15,25 ---- def showtip(self, text): + # SF bug 546078: IDLE calltips cause application error. + # There were crashes on various Windows flavors, and even a + # crashing X server on Linux, with very long calltips. + if len(text) >= 79: + text = text[:75] + ' ...' self.text = text + if self.tipwindow or not self.text: return From tim_one@sourceforge.net Mon Apr 22 20:00:14 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 22 Apr 2002 12:00:14 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.144,2.145 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30166/python/Objects Modified Files: unicodeobject.c Log Message: unicode_memchr(): Squashed gratuitous int-vs-size_t mismatch (which gives a compiler wng under MSVC because of the resulting signed-vs- unsigned comparison). Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.144 retrieving revision 2.145 diff -C2 -d -r2.144 -r2.145 *** unicodeobject.c 22 Apr 2002 17:42:37 -0000 2.144 --- unicodeobject.c 22 Apr 2002 19:00:10 -0000 2.145 *************** *** 4448,4454 **** unicode_memchr(const Py_UNICODE *s, Py_UNICODE c, size_t n) { ! int i; ! for (i = 0; i Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29250 Modified Files: python-mode.el Log Message: Some contributions and ideas by Alexander Schmolck: add a keybinding to call pychecker on the current file, add a face for pseudo keywords self, None, True, False, and Ellipsis. Specifically, (py-pychecker-command, py-pychecker-command-args): New variables. (py-pseudo-keyword-face): New face variable, defaulting to a copy of font-lock-keyword-face. (python-font-lock-keywords): Add an entry for self, None, True, False, Ellipsis to be rendered in py-pseudo-keyword-face. (py-pychecker-history): New variable. (py-mode-map): Bind C-c C-w to py-pychecker-run. (py-pychecker-run): New command. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.11 retrieving revision 4.12 diff -C2 -d -r4.11 -r4.12 *** python-mode.el 22 Apr 2002 17:15:19 -0000 4.11 --- python-mode.el 22 Apr 2002 21:48:20 -0000 4.12 *************** *** 287,290 **** --- 287,302 ---- (make-variable-buffer-local 'py-master-file) + (defcustom py-pychecker-command "pychecker" + "*Shell command used to run Pychecker." + :type 'string + :group 'python + :tag "Pychecker Command") + + (defcustom py-pychecker-command-args '("--stdlib") + "*List of string arguments to be passed to pychecker." + :type '(repeat string) + :group 'python + :tag "Pychecker Command Args") + *************** *** 299,302 **** --- 311,324 ---- support for features needed by `python-mode'.") + ;; Face for None, True, False, self, and Ellipsis + (defvar py-pseudo-keyword-face 'py-pseudo-keyword-face + "Face for pseudo keywords in Python mode, like self, True, False, Ellipsis.") + (make-face 'py-pseudo-keyword-face) + + (defun py-font-lock-mode-hook () + (or (face-differs-from-default-p 'py-pseudo-keyword-face) + (copy-face 'font-lock-keyword-face 'py-pseudo-keyword-face))) + (add-hook 'font-lock-mode-hook 'py-font-lock-mode-hook) + (defvar python-font-lock-keywords (let ((kw1 (mapconcat 'identity *************** *** 328,331 **** --- 350,356 ---- '("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)" 1 font-lock-function-name-face) + ;; pseudo-keywords + '("\\b\\(self\\|None\\|True\\|False\\|Ellipsis\\)\\b" + 1 py-pseudo-keyword-face) )) "Additional expressions to highlight in Python mode.") *************** *** 338,341 **** --- 363,367 ---- (defvar py-pdbtrack-is-tracking-p nil) + (defvar py-pychecker-history nil) *************** *** 510,513 **** --- 536,540 ---- (define-key py-mode-map "\C-c\C-b" 'py-submit-bug-report) (define-key py-mode-map "\C-c\C-v" 'py-version) + (define-key py-mode-map "\C-c\C-w" 'py-pychecker-run) ;; shadow global bindings for newline-and-indent w/ the py- version. ;; BAW - this is extremely bad form, but I'm not going to change it *************** *** 1425,1431 **** (pop-to-buffer py-exception-buffer))) )) ! ;; TBD: delete the buffer ! ) ! ) ;; Clean up after ourselves. (kill-buffer buf))) --- 1452,1456 ---- (pop-to-buffer py-exception-buffer))) )) ! )) ;; Clean up after ourselves. (kill-buffer buf))) *************** *** 2610,2619 **** ! ;; Skip's python-help commands. The guts of this function is stolen ! ;; from XEmacs's symbol-near-point, but without the useless ! ;; regexp-quote call on the results, nor the interactive bit. Also, ! ;; we've added the temporary syntax table setting, which Skip ! ;; originally had broken out into a separate function. Note that ! ;; Emacs doesn't have the original function. (defun py-symbol-near-point () "Return the first textual item to the nearest point." --- 2635,2662 ---- ! ;; Pychecker ! (defun py-pychecker-run (command) ! "*Run pychecker (default on the file currently visited)." ! (interactive ! (let ((default ! (format "%s %s %s" py-pychecker-command ! (mapconcat 'identity py-pychecker-command-args " ") ! (buffer-file-name)))) ! ! (list ! (read-shell-command "Run pychecker like this: " ! default ! py-pychecker-history)))) ! (save-some-buffers (not py-ask-about-save) nil) ! (compile command)) ! ! ! ! ;; pydoc commands. The guts of this function is stolen from XEmacs's ! ;; symbol-near-point, but without the useless regexp-quote call on the ! ;; results, nor the interactive bit. Also, we've added the temporary ! ;; syntax table setting, which Skip originally had broken out into a ! ;; separate function. Note that Emacs doesn't have the original ! ;; function. (defun py-symbol-near-point () "Return the first textual item to the nearest point." From tim.one@comcast.net Mon Apr 22 23:03:56 2002 From: tim.one@comcast.net (Tim Peters) Date: Mon, 22 Apr 2002 18:03:56 -0400 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.11,4.12 In-Reply-To: Message-ID: [Barry] > Modified Files: > python-mode.el Don't stop now! With just a little more effort, I'm sure you can boost it over the magical 128KB size. All the other language modes always picked on python-mode.el for being so small . From bwarsaw@sourceforge.net Mon Apr 22 23:05:54 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Mon, 22 Apr 2002 15:05:54 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.12,4.13 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2206 Modified Files: python-mode.el Log Message: Merge in Skip's last few updates w.r.t. py-help-at-point: (py-mode-map): Bind py-help-at-point to f1 as well as C-c C-h (py-help-at-point): Make sure the symbol is quoted so things like pydoc.help('sys.platform') work correctly. Also, leave the *Python Output* buffer in help-mode; this may be a bit more controversial. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.12 retrieving revision 4.13 diff -C2 -d -r4.12 -r4.13 *** python-mode.el 22 Apr 2002 21:48:20 -0000 4.12 --- python-mode.el 22 Apr 2002 22:05:49 -0000 4.13 *************** *** 525,528 **** --- 525,529 ---- (define-key py-mode-map "\C-c#" 'py-comment-region) (define-key py-mode-map "\C-c?" 'py-describe-mode) + (define-key py-mode-map [f1] 'py-help-at-point) (define-key py-mode-map "\C-c\C-h" 'py-help-at-point) (define-key py-mode-map "\e\C-a" 'py-beginning-of-def-or-class) *************** *** 2688,2695 **** (setq cmd (concat "import pydoc\n" cmd ! "try: pydoc.help(" sym ")\n" "except: print 'No help available on:', \"" sym "\"")) (message cmd) ! (py-execute-string cmd))) --- 2689,2699 ---- (setq cmd (concat "import pydoc\n" cmd ! "try: pydoc.help('" sym "')\n" "except: print 'No help available on:', \"" sym "\"")) (message cmd) ! (py-execute-string cmd) ! (set-buffer "*Python Output*") ! ;; BAW: Should we really be leaving the output buffer in help-mode? ! (help-mode))) From barry@zope.com Mon Apr 22 23:13:48 2002 From: barry@zope.com (Barry A. Warsaw) Date: Mon, 22 Apr 2002 18:13:48 -0400 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.11,4.12 References: Message-ID: <15556.35612.198890.608566@anthem.wooz.org> >>>>> "TP" == Tim Peters writes: TP> [Barry] >> Modified Files: python-mode.el TP> Don't stop now! With just a little more effort, I'm sure you TP> can boost it over the magical 128KB size. All the other TP> language modes always picked on python-mode.el for being so TP> small . Oh don't worry, I've still got about 70 more messages sitting in my inbox. I don't think we'll quite approach the size of C mode, but I'll do my best. -Barry From anthonybaxter@sourceforge.net Tue Apr 23 02:53:27 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 18:53:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_queue.py,NONE,1.1.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25345/Lib/test Added Files: Tag: release21-maint test_queue.py Log Message: backport mhammond's patch: Fix bug 544473 - "Queue module can deadlock". Use try/finally to ensure all Queue locks remain stable. Includes test case. Bugfix candidate. Original patch(es): python/dist/src/Lib/test/test_queue.py:1.1 --- NEW FILE: test_queue.py --- # Some simple Queue module tests, plus some failure conditions # to ensure the Queue locks remain stable import Queue import sys import threading import time from test_support import verify, TestFailed, verbose queue_size = 5 # Execute a function that blocks, and in a seperate thread, a function that # triggers the release. Returns the result of the blocking function. class _TriggerThread(threading.Thread): def __init__(self, fn, args): self.fn = fn self.args = args self.startedEvent = threading.Event() threading.Thread.__init__(self) def run(self): time.sleep(.1) self.startedEvent.set() self.fn(*self.args) def _doBlockingTest( block_func, block_args, trigger_func, trigger_args): t = _TriggerThread(trigger_func, trigger_args) t.start() try: return block_func(*block_args) finally: # If we unblocked before our thread made the call, we failed! if not t.startedEvent.isSet(): raise TestFailed("blocking function '%r' appeared not to block" % (block_func,)) t.join(1) # make sure the thread terminates if t.isAlive(): raise TestFailed("trigger function '%r' appeared to not return" % (trigger_func,)) # A Queue subclass that can provoke failure at a moment's notice :) class FailingQueueException(Exception): pass class FailingQueue(Queue.Queue): def __init__(self, *args): self.fail_next_put = False self.fail_next_get = False Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: self.fail_next_put = False raise FailingQueueException, "You Lose" return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: self.fail_next_get = False raise FailingQueueException, "You Lose" return Queue.Queue._get(self) def FailingQueueTest(q): if not q.empty(): raise RuntimeError, "Call this function with an empty queue" for i in range(queue_size-1): q.put(i) q.fail_next_put = True # Test a failing non-blocking put. try: q.put("oops", block=0) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass q.put("last") verify(q.full(), "Queue should be full") q.fail_next_put = True # Test a failing blocking put try: _doBlockingTest( q.put, ("full",), q.get, ()) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass # Check the Queue isn't damaged. # put failed, but get succeeded - re-add q.put("last") verify(q.full(), "Queue should be full") q.get() verify(not q.full(), "Queue should not be full") q.put("last") verify(q.full(), "Queue should be full") # Test a blocking put _doBlockingTest( q.put, ("full",), q.get, ()) # Empty it for i in range(queue_size): q.get() verify(q.empty(), "Queue should be empty") q.put("first") q.fail_next_get = True try: q.get() raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") q.fail_next_get = True try: _doBlockingTest( q.get, (), q.put, ('empty',)) raise TestFailed("The queue didn't fail when it should have") except FailingQueueException: pass # put succeeded, but get failed. verify(not q.empty(), "Queue should not be empty") q.get() verify(q.empty(), "Queue should be empty") def SimpleQueueTest(q): if not q.empty(): raise RuntimeError, "Call this function with an empty queue" # I guess we better check things actually queue correctly a little :) q.put(111) q.put(222) verify(q.get()==111 and q.get()==222, "Didn't seem to queue the correct data!") for i in range(queue_size-1): q.put(i) verify(not q.full(), "Queue should not be full") q.put("last") verify(q.full(), "Queue should be full") try: q.put("full", block=0) raise TestFailed("Didn't appear to block with a full queue") except Queue.Full: pass # Test a blocking put _doBlockingTest( q.put, ("full",), q.get, ()) # Empty it for i in range(queue_size): q.get() verify(q.empty(), "Queue should be empty") try: q.get(block=0) raise TestFailed("Didn't appear to block with an empty queue") except Queue.Empty: pass # Test a blocking get _doBlockingTest( q.get, (), q.put, ('empty',)) def test(): q=Queue.Queue(queue_size) # Do it a couple of times on the same queue SimpleQueueTest(q) SimpleQueueTest(q) if verbose: print "Simple Queue tests seemed to work" q = FailingQueue(queue_size) FailingQueueTest(q) FailingQueueTest(q) if verbose: print "Failing Queue tests seemed to work" test() From anthonybaxter@sourceforge.net Tue Apr 23 02:55:31 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 18:55:31 -0700 Subject: [Python-checkins] python/dist/src/Lib Queue.py,1.14,1.14.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25739/Lib Modified Files: Tag: release21-maint Queue.py Log Message: backport mhammond's patch: Fix bug 544473 - "Queue module can deadlock". Use try/finally to ensure all Queue locks remain stable. Includes test case. Bugfix candidate. Original patch(es): python/dist/src/Lib/Queue.py:1.15 Index: Queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Queue.py,v retrieving revision 1.14 retrieving revision 1.14.4.1 diff -C2 -d -r1.14 -r1.14.4.1 *** Queue.py 18 Feb 2001 03:30:53 -0000 1.14 --- Queue.py 23 Apr 2002 01:55:29 -0000 1.14.4.1 *************** *** 56,66 **** raise Full self.mutex.acquire() ! was_empty = self._empty() ! self._put(item) ! if was_empty: ! self.esema.release() ! if not self._full(): ! self.fsema.release() ! self.mutex.release() def put_nowait(self, item): --- 56,77 ---- raise Full self.mutex.acquire() ! release_fsema = True ! try: ! was_empty = self._empty() ! self._put(item) ! # If we fail before here, the empty state has ! # not changed, so we can skip the release of esema ! if was_empty: ! self.esema.release() ! # If we fail before here, the queue can not be full, so ! # release_full_sema remains True ! release_fsema = not self._full() ! finally: ! # Catching system level exceptions here (RecursionDepth, ! # OutOfMemory, etc) - so do as little as possible in terms ! # of Python calls. ! if release_fsema: ! self.fsema.release() ! self.mutex.release() def put_nowait(self, item): *************** *** 85,95 **** raise Empty self.mutex.acquire() ! was_full = self._full() ! item = self._get() ! if was_full: ! self.fsema.release() ! if not self._empty(): ! self.esema.release() ! self.mutex.release() return item --- 96,114 ---- raise Empty self.mutex.acquire() ! release_esema = True ! try: ! was_full = self._full() ! item = self._get() ! # If we fail before here, the full state has ! # not changed, so we can skip the release of fsema ! if was_full: ! self.fsema.release() ! # Failure means empty state also unchanged - release_esema ! # remains True. ! release_esema = not self._empty() ! finally: ! if release_esema: ! self.esema.release() ! self.mutex.release() return item From anthonybaxter@sourceforge.net Tue Apr 23 03:11:11 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:11:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29550/Lib/test Modified Files: test_bsddb.py Log Message: SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL) closes SF #514433 can now pass 'None' as the filename for the bsddb.*open functions, and you'll get an in-memory temporary store. docs are ripped out of the bsddb dbopen man page. Fred may want to clean them up. Considering this for 2.2, but not 2.1. Index: test_bsddb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_bsddb.py 7 Dec 2001 16:43:19 -0000 1.9 --- test_bsddb.py 23 Apr 2002 02:11:03 -0000 1.10 *************** *** 3,7 **** Roger E. Masse """ - import os import bsddb --- 3,6 ---- *************** *** 10,19 **** from test_support import verbose, verify ! def test(openmethod, what): if verbose: ! print '\nTesting: ', what ! fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) --- 9,21 ---- from test_support import verbose, verify ! def test(openmethod, what, ondisk=1): if verbose: ! print '\nTesting: ', what, (ondisk and "on disk" or "in memory") ! if ondisk: ! fname = tempfile.mktemp() ! else: ! fname = None f = openmethod(fname, 'c') verify(f.keys() == []) *************** *** 48,71 **** f.sync() f.close() ! if verbose: ! print 'modification...' ! f = openmethod(fname, 'w') ! f['d'] = 'discovered' - if verbose: - print 'access...' - for key in f.keys(): - word = f[key] if verbose: ! print word ! f.close() ! try: ! os.remove(fname) ! except os.error: ! pass types = [(bsddb.btopen, 'BTree'), (bsddb.hashopen, 'Hash Table'), # (bsddb.rnopen,'Record Numbers'), 'put' for RECNO for bsddb 1.85 # appears broken... at least on --- 50,78 ---- f.sync() f.close() ! if ondisk: ! # if we're using an in-memory only db, we can't reopen it ! # so finish here. ! if verbose: ! print 'modification...' ! f = openmethod(fname, 'w') ! f['d'] = 'discovered' if verbose: ! print 'access...' ! for key in f.keys(): ! word = f[key] ! if verbose: ! print word ! f.close() ! try: ! os.remove(fname) ! except os.error: ! pass types = [(bsddb.btopen, 'BTree'), (bsddb.hashopen, 'Hash Table'), + (bsddb.btopen, 'BTree', 0), + (bsddb.hashopen, 'Hash Table', 0), # (bsddb.rnopen,'Record Numbers'), 'put' for RECNO for bsddb 1.85 # appears broken... at least on *************** *** 74,76 **** for type in types: ! test(type[0], type[1]) --- 81,83 ---- for type in types: ! test(*type) From anthonybaxter@sourceforge.net Tue Apr 23 03:11:11 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:11:11 -0700 Subject: [Python-checkins] python/dist/src/Modules bsddbmodule.c,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29550/Modules Modified Files: bsddbmodule.c Log Message: SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL) closes SF #514433 can now pass 'None' as the filename for the bsddb.*open functions, and you'll get an in-memory temporary store. docs are ripped out of the bsddb dbopen man page. Fred may want to clean them up. Considering this for 2.2, but not 2.1. Index: bsddbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bsddbmodule.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** bsddbmodule.c 31 Mar 2002 15:43:28 -0000 1.34 --- bsddbmodule.c 23 Apr 2002 02:11:03 -0000 1.35 *************** *** 688,692 **** int lorder = 0; ! if (!PyArg_ParseTuple(args, "s|siiiiiii:hashopen", &file, &flag, &mode, &bsize, &ffactor, &nelem, &cachesize, --- 688,692 ---- int lorder = 0; ! if (!PyArg_ParseTuple(args, "z|siiiiiii:hashopen", &file, &flag, &mode, &bsize, &ffactor, &nelem, &cachesize, *************** *** 739,743 **** int lorder = 0; ! if (!PyArg_ParseTuple(args, "s|siiiiiii:btopen", &file, &flag, &mode, &btflags, &cachesize, &maxkeypage, &minkeypage, --- 739,743 ---- int lorder = 0; ! if (!PyArg_ParseTuple(args, "z|siiiiiii:btopen", &file, &flag, &mode, &btflags, &cachesize, &maxkeypage, &minkeypage, *************** *** 792,796 **** char *bfname = NULL; ! if (!PyArg_ParseTuple(args, "s|siiiiiiss:rnopen", &file, &flag, &mode, &rnflags, &cachesize, &psize, &lorder, --- 792,796 ---- char *bfname = NULL; ! if (!PyArg_ParseTuple(args, "z|siiiiiiss:rnopen", &file, &flag, &mode, &rnflags, &cachesize, &psize, &lorder, From anthonybaxter@sourceforge.net Tue Apr 23 03:11:11 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:11:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv29550/Doc/lib Modified Files: libbsddb.tex Log Message: SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL) closes SF #514433 can now pass 'None' as the filename for the bsddb.*open functions, and you'll get an in-memory temporary store. docs are ripped out of the bsddb dbopen man page. Fred may want to clean them up. Considering this for 2.2, but not 2.1. Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libbsddb.tex 5 Jan 2001 06:44:19 -0000 1.6 --- libbsddb.tex 23 Apr 2002 02:11:03 -0000 1.7 *************** *** 38,42 **** cachesize\optional{, hash\optional{, lorder}}}}}}}}} ! Open the hash format file named \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be \character{r} (read only), \character{w} (read-write), --- 38,44 ---- cachesize\optional{, hash\optional{, lorder}}}}}}}}} ! Open the hash format file named \var{filename}. Files never intended ! to be preserved on disk may be created by passing \code{None} as the ! \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be \character{r} (read only), \character{w} (read-write), *************** *** 52,56 **** minkeypage\optional{, psize\optional{, lorder}}}}}}}}} ! Open the btree format file named \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be \character{r} (read only), \character{w} (read-write), --- 54,60 ---- minkeypage\optional{, psize\optional{, lorder}}}}}}}}} ! Open the btree format file named \var{filename}. Files never intended ! to be preserved on disk may be created by passing \code{None} as the ! \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be \character{r} (read only), \character{w} (read-write), *************** *** 66,70 **** reclen\optional{, bval\optional{, bfname}}}}}}}}}} ! Open a DB record format file named \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be \character{r} (read only), \character{w} (read-write), --- 70,76 ---- reclen\optional{, bval\optional{, bfname}}}}}}}}}} ! Open a DB record format file named \var{filename}. Files never intended ! to be preserved on disk may be created by passing \code{None} as the ! \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be \character{r} (read only), \character{w} (read-write), From anthonybaxter@sourceforge.net Tue Apr 23 03:11:12 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:11:12 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.391,1.392 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29550/Misc Modified Files: NEWS Log Message: SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL) closes SF #514433 can now pass 'None' as the filename for the bsddb.*open functions, and you'll get an in-memory temporary store. docs are ripped out of the bsddb dbopen man page. Fred may want to clean them up. Considering this for 2.2, but not 2.1. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.391 retrieving revision 1.392 diff -C2 -d -r1.391 -r1.392 *** NEWS 21 Apr 2002 07:30:30 -0000 1.391 --- NEWS 23 Apr 2002 02:11:05 -0000 1.392 *************** *** 65,68 **** --- 65,72 ---- Extension modules + - The bsddb.*open functions can now take 'None' as a filename. + This will create a temporary in-memory bsddb that won't be + written to disk. + - posix.mknod was added. From anthonybaxter@sourceforge.net Tue Apr 23 03:19:05 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:19:05 -0700 Subject: [Python-checkins] python/dist/src/Lib Queue.py,1.14.4.1,1.14.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31328/Lib Modified Files: Tag: release21-maint Queue.py Log Message: *sigh* did a 'make test' in the wrong window. fixing this up to not include 'True'. test_queue passes again. Index: Queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Queue.py,v retrieving revision 1.14.4.1 retrieving revision 1.14.4.2 diff -C2 -d -r1.14.4.1 -r1.14.4.2 *** Queue.py 23 Apr 2002 01:55:29 -0000 1.14.4.1 --- Queue.py 23 Apr 2002 02:19:02 -0000 1.14.4.2 *************** *** 56,60 **** raise Full self.mutex.acquire() ! release_fsema = True try: was_empty = self._empty() --- 56,60 ---- raise Full self.mutex.acquire() ! release_fsema = 1 try: was_empty = self._empty() *************** *** 65,69 **** self.esema.release() # If we fail before here, the queue can not be full, so ! # release_full_sema remains True release_fsema = not self._full() finally: --- 65,69 ---- self.esema.release() # If we fail before here, the queue can not be full, so ! # release_full_sema remains true release_fsema = not self._full() finally: *************** *** 96,100 **** raise Empty self.mutex.acquire() ! release_esema = True try: was_full = self._full() --- 96,100 ---- raise Empty self.mutex.acquire() ! release_esema = 1 try: was_full = self._full() *************** *** 105,109 **** self.fsema.release() # Failure means empty state also unchanged - release_esema ! # remains True. release_esema = not self._empty() finally: --- 105,109 ---- self.fsema.release() # Failure means empty state also unchanged - release_esema ! # remains true. release_esema = not self._empty() finally: From anthonybaxter@sourceforge.net Tue Apr 23 03:19:05 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:19:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_queue.py,1.1.4.1,1.1.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31328/Lib/test Modified Files: Tag: release21-maint test_queue.py Log Message: *sigh* did a 'make test' in the wrong window. fixing this up to not include 'True'. test_queue passes again. Index: test_queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_queue.py,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** test_queue.py 23 Apr 2002 01:53:23 -0000 1.1.4.1 --- test_queue.py 23 Apr 2002 02:19:03 -0000 1.1.4.2 *************** *** 42,56 **** class FailingQueue(Queue.Queue): def __init__(self, *args): ! self.fail_next_put = False ! self.fail_next_get = False Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: ! self.fail_next_put = False raise FailingQueueException, "You Lose" return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: ! self.fail_next_get = False raise FailingQueueException, "You Lose" return Queue.Queue._get(self) --- 42,56 ---- class FailingQueue(Queue.Queue): def __init__(self, *args): ! self.fail_next_put = 0 ! self.fail_next_get = 0 Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: ! self.fail_next_put = 0 raise FailingQueueException, "You Lose" return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: ! self.fail_next_get = 0 raise FailingQueueException, "You Lose" return Queue.Queue._get(self) *************** *** 61,65 **** for i in range(queue_size-1): q.put(i) ! q.fail_next_put = True # Test a failing non-blocking put. try: --- 61,65 ---- for i in range(queue_size-1): q.put(i) ! q.fail_next_put = 1 # Test a failing non-blocking put. try: *************** *** 70,74 **** q.put("last") verify(q.full(), "Queue should be full") ! q.fail_next_put = True # Test a failing blocking put try: --- 70,74 ---- q.put("last") verify(q.full(), "Queue should be full") ! q.fail_next_put = 1 # Test a failing blocking put try: *************** *** 92,96 **** verify(q.empty(), "Queue should be empty") q.put("first") ! q.fail_next_get = True try: q.get() --- 92,96 ---- verify(q.empty(), "Queue should be empty") q.put("first") ! q.fail_next_get = 1 try: q.get() *************** *** 101,105 **** q.get() verify(q.empty(), "Queue should be empty") ! q.fail_next_get = True try: _doBlockingTest( q.get, (), q.put, ('empty',)) --- 101,105 ---- q.get() verify(q.empty(), "Queue should be empty") ! q.fail_next_get = 1 try: _doBlockingTest( q.get, (), q.put, ('empty',)) From anthonybaxter@sourceforge.net Tue Apr 23 03:20:48 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:20:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_linuxaudiodev.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31621 Modified Files: test_linuxaudiodev.py Log Message: don't fail if the audio device is busy, just skip. SF patch 545486 Index: test_linuxaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_linuxaudiodev.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_linuxaudiodev.py 8 Oct 2000 00:20:20 -0000 1.6 --- test_linuxaudiodev.py 23 Apr 2002 02:20:46 -0000 1.7 *************** *** 26,30 **** a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: ! if msg[0] in (errno.EACCES, errno.ENODEV): raise TestSkipped, msg raise TestFailed, msg --- 26,30 ---- a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: ! if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg From anthonybaxter@sourceforge.net Tue Apr 23 03:21:02 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:21:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_linuxaudiodev.py,1.6,1.6.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31881a/test Modified Files: Tag: release22-maint test_linuxaudiodev.py Log Message: backport: don't fail if the audio device is busy, just skip. SF patch 545486 Index: test_linuxaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_linuxaudiodev.py,v retrieving revision 1.6 retrieving revision 1.6.26.1 diff -C2 -d -r1.6 -r1.6.26.1 *** test_linuxaudiodev.py 8 Oct 2000 00:20:20 -0000 1.6 --- test_linuxaudiodev.py 23 Apr 2002 02:21:00 -0000 1.6.26.1 *************** *** 26,30 **** a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: ! if msg[0] in (errno.EACCES, errno.ENODEV): raise TestSkipped, msg raise TestFailed, msg --- 26,30 ---- a = linuxaudiodev.open('w') except linuxaudiodev.error, msg: ! if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg From anthonybaxter@sourceforge.net Tue Apr 23 03:38:42 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 19:38:42 -0700 Subject: [Python-checkins] python/dist/src/Lib macpath.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3948/Lib Modified Files: macpath.py Log Message: whitespace fixup. test__all__ and test_sundry were failing for me on linux because of the inconsistent whitespace. Index: macpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** macpath.py 22 Apr 2002 13:55:43 -0000 1.36 --- macpath.py 23 Apr 2002 02:38:39 -0000 1.37 *************** *** 126,130 **** try: ! import macfs return macfs.ResolveAliasFile(s)[2] except: --- 126,130 ---- try: ! import macfs return macfs.ResolveAliasFile(s)[2] except: From anthonybaxter@sourceforge.net Tue Apr 23 05:02:58 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 22 Apr 2002 21:02:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.13,1.113.4.14 test_coercion.py,1.2,1.2.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23134 Modified Files: Tag: release22-maint test_descr.py test_coercion.py Log Message: backport some warnings filters to shut up complaints about complex divmod &c. Should probably be cleaned up properly so that the tests don't call that. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.13 retrieving revision 1.113.4.14 diff -C2 -d -r1.113.4.13 -r1.113.4.14 *** test_descr.py 18 Apr 2002 05:10:58 -0000 1.113.4.13 --- test_descr.py 23 Apr 2002 04:02:54 -0000 1.113.4.14 *************** *** 3,6 **** --- 3,11 ---- from test_support import verify, vereq, verbose, TestFailed, TESTFN from copy import deepcopy + import warnings + + warnings.filterwarnings("ignore", + r'complex divmod\(\), // and % are deprecated$', + DeprecationWarning, r'(|test_descr)$') def veris(a, b): Index: test_coercion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_coercion.py,v retrieving revision 1.2 retrieving revision 1.2.24.1 diff -C2 -d -r1.2 -r1.2.24.1 *** test_coercion.py 3 Jan 2001 01:52:10 -0000 1.2 --- test_coercion.py 23 Apr 2002 04:02:55 -0000 1.2.24.1 *************** *** 1,4 **** --- 1,5 ---- import copy import sys + import warnings # Fake a number that implements numeric methods through __coerce__ *************** *** 110,113 **** --- 111,118 ---- print '=', x + warnings.filterwarnings("ignore", + r'complex divmod\(\), // and % are deprecated', + DeprecationWarning, + r'test_coercion$') do_infix_binops() do_prefix_binops() From tim.one@comcast.net Tue Apr 23 06:44:56 2002 From: tim.one@comcast.net (Tim Peters) Date: Tue, 23 Apr 2002 01:44:56 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.13,1.113.4.14 test_coercion.py,1.2,1.2.24.1 In-Reply-To: Message-ID: > Modified Files: > Tag: release22-maint > test_descr.py test_coercion.py > Log Message: > backport some warnings filters to shut up complaints about complex > divmod &c. Should probably be cleaned up properly so that the tests > don't call that. Deprecated features remain supported until they go away, so we should continue testing them until they do go away. From jackjansen@sourceforge.net Tue Apr 23 11:52:48 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 03:52:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32010 Modified Files: test_email.py Log Message: There was a non-ascii character in the source. Replaced by a hex escape. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** test_email.py 16 Apr 2002 05:06:42 -0000 1.30 --- test_email.py 23 Apr 2002 10:52:44 -0000 1.31 *************** *** 1458,1462 **** eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?q?hello=0Aworld?=') # Test a non-ASCII character ! eq(he('helloÇthere'), '=?iso-8859-1?q?hello=C7there?=') # Test the maxlinelen argument eq(he('xxxx ' * 20, maxlinelen=40), """\ --- 1458,1462 ---- eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?q?hello=0Aworld?=') # Test a non-ASCII character ! eq(he('hello\xc7there'), '=?iso-8859-1?q?hello=C7there?=') # Test the maxlinelen argument eq(he('xxxx ' * 20, maxlinelen=40), """\ From gvanrossum@sourceforge.net Tue Apr 23 14:06:10 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 23 Apr 2002 06:06:10 -0700 Subject: [Python-checkins] python/dist/src README,1.144,1.145 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12034 Modified Files: README Log Message: Add warning about the HP PA-RISC 2.0 C compiler's optimizer. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** README 14 Apr 2002 20:12:37 -0000 1.144 --- README 23 Apr 2002 13:06:07 -0000 1.145 *************** *** 300,303 **** --- 300,308 ---- even though config.h defines it. + HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) + suggests that the C compiler in this 64-bit system has bugs + in the optimizer that break Python. Compiling without + optimization solves the problems. + Minix: When using ack, use "CC=cc AR=aal RANLIB=: ./configure"! From gvanrossum@sourceforge.net Tue Apr 23 14:27:27 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 23 Apr 2002 06:27:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.161,1.162 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv20509 Modified Files: Tkinter.py Log Message: SF patch 546244 by John Williams: add Text.dump() method. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** Tkinter.py 27 Mar 2002 17:15:57 -0000 1.161 --- Tkinter.py 23 Apr 2002 13:27:24 -0000 1.162 *************** *** 2628,2632 **** class Text(Widget): """Text widget which can display text in various forms.""" - # XXX Add dump() def __init__(self, master=None, cnf={}, **kw): """Construct a text widget with the parent MASTER. --- 2628,2631 ---- *************** *** 2672,2675 **** --- 2671,2712 ---- the character at INDEX.""" return self._getints(self.tk.call(self._w, 'dlineinfo', index)) + def dump(self, index1, index2=None, command=None, **kw): + """Return the contents of the widget between index1 and index2. + + The type of contents returned in filtered based on the keyword + parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are + given and true, then the corresponding items are returned. The result + is a list of triples of the form (key, value, index). If none of the + keywords are true then 'all' is used by default. + + If the 'command' argument is given, it is called once for each element + of the list of triples, with the values of each triple serving as the + arguments to the function. In this case the list is not returned.""" + args = [] + func_name = None + result = None + if not command: + # Never call the dump command without the -command flag, since the + # output could involve Tcl quoting and would be a pain to parse + # right. Instead just set the command to build a list of triples + # as if we had done the parsing. + result = [] + def append_triple(key, value, index, result=result): + result.append((key, value, index)) + command = append_triple + try: + if not isinstance(command, str): + func_name = command = self._register(command) + args += ["-command", command] + for key in kw: + if kw[key]: args.append("-" + key) + args.append(index1) + if index2: + args.append(index2) + self.tk.call(self._w, "dump", *args) + return result + finally: + if func_name: + self.deletecommand(func_name) def get(self, index1, index2=None): """Return the text from INDEX1 to INDEX2 (not included).""" From gvanrossum@sourceforge.net Tue Apr 23 14:29:46 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Tue, 23 Apr 2002 06:29:46 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.170,1.171 NEWS,1.392,1.393 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21099 Modified Files: ACKS NEWS Log Message: SF patch 546244 by John Williams: add Text.dump() method. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** ACKS 20 Apr 2002 07:47:39 -0000 1.170 --- ACKS 23 Apr 2002 13:29:43 -0000 1.171 *************** *** 488,491 **** --- 488,492 ---- Bryce "Zooko" Wilcox-O'Hearn Gerald S. Williams + John Williams Sue Williams Frank Willison Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.392 retrieving revision 1.393 diff -C2 -d -r1.392 -r1.393 *** NEWS 23 Apr 2002 02:11:05 -0000 1.392 --- NEWS 23 Apr 2002 13:29:43 -0000 1.393 *************** *** 92,95 **** --- 92,97 ---- Library + - New Text.dump() method in Tkinter module. + - New distutils commands for building packagers were added to support pkgtool on Solaris and swinstall on HP-UX. From fdrake@sourceforge.net Tue Apr 23 16:58:05 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 08:58:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11124/Doc/lib Modified Files: libos.tex Log Message: WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New. isatty(), WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(): Changed to return bools instead of ints. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** libos.tex 15 Apr 2002 19:46:40 -0000 1.81 --- libos.tex 23 Apr 2002 15:58:02 -0000 1.82 *************** *** 421,426 **** \begin{funcdesc}{isatty}{fd} ! Return \code{1} if the file descriptor \var{fd} is open and connected to a ! tty(-like) device, else \code{0}. Availability: \UNIX. \end{funcdesc} --- 421,426 ---- \begin{funcdesc}{isatty}{fd} ! Return \code{True} if the file descriptor \var{fd} is open and ! connected to a tty(-like) device, else \code{False}. Availability: \UNIX. \end{funcdesc} *************** *** 1226,1229 **** --- 1226,1245 ---- \end{datadesc} + \begin{datadesc}{WCONTINUED} + This option causes child processes to be reported if they have been + continued from a job control stop since their status was last + reported. + Availability: Some \UNIX{} systems. + \versionadded{2.3} + \end{datadesc} + + \begin{datadesc}{WUNTRACED} + This option causes child processes to be reported if they have been + stopped but their current state has not been reported since they were + stopped. + Availability: \UNIX. + \versionadded{2.3} + \end{datadesc} + The following functions take a process status code as returned by \function{system()}, \function{wait()}, or \function{waitpid()} as a *************** *** 1231,1247 **** process. \begin{funcdesc}{WIFSTOPPED}{status} ! Return true if the process has been stopped. Availability: \UNIX. \end{funcdesc} \begin{funcdesc}{WIFSIGNALED}{status} ! Return true if the process exited due to a signal. Availability: \UNIX. \end{funcdesc} \begin{funcdesc}{WIFEXITED}{status} ! Return true if the process exited using the \manpage{exit}{2} system ! call. Availability: \UNIX. \end{funcdesc} --- 1247,1279 ---- process. + \begin{funcdesc}{WCOREDUMP}{status} + Returns \code{True} if a core dump was generated for the process, + otherwise it returns \code{False}. + Availability: \UNIX. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{WIFCONTINUED}{status} + Returns \code{True} if the process has been continued from a job + control stop, otherwise it returns \code{False}. + Availability: \UNIX. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{WIFSTOPPED}{status} ! Returns \code{True} if the process has been stopped, otherwise it ! returns \code{False}. Availability: \UNIX. \end{funcdesc} \begin{funcdesc}{WIFSIGNALED}{status} ! Returns \code{True} if the process exited due to a signal, otherwise ! it returns \code{False}. Availability: \UNIX. \end{funcdesc} \begin{funcdesc}{WIFEXITED}{status} ! Returns \code{True} if the process exited using the \manpage{exit}{2} ! system call, otherwise it returns \code{False}. Availability: \UNIX. \end{funcdesc} From fdrake@sourceforge.net Tue Apr 23 16:58:05 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 08:58:05 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.231,2.232 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11124/Modules Modified Files: posixmodule.c Log Message: WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New. isatty(), WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(): Changed to return bools instead of ints. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.231 retrieving revision 2.232 diff -C2 -d -r2.231 -r2.232 *** posixmodule.c 20 Apr 2002 13:46:43 -0000 2.231 --- posixmodule.c 23 Apr 2002 15:58:01 -0000 2.232 *************** *** 4530,4535 **** static char posix_isatty__doc__[] = ! "isatty(fd) -> Boolean\n\ ! Return true if the file descriptor 'fd' is an open file descriptor\n\ connected to the slave end of a terminal."; --- 4530,4535 ---- static char posix_isatty__doc__[] = ! "isatty(fd) -> bool\n\ ! Return True if the file descriptor 'fd' is an open file descriptor\n\ connected to the slave end of a terminal."; *************** *** 4540,4544 **** if (!PyArg_ParseTuple(args, "i:isatty", &fd)) return NULL; ! return Py_BuildValue("i", isatty(fd)); } --- 4540,4544 ---- if (!PyArg_ParseTuple(args, "i:isatty", &fd)) return NULL; ! return PyBool_FromLong(isatty(fd)); } *************** *** 4824,4831 **** #ifdef HAVE_SYS_WAIT_H #ifdef WIFSTOPPED static char posix_WIFSTOPPED__doc__[] = ! "WIFSTOPPED(status) -> Boolean\n\ ! Return true if the process returning 'status' was stopped."; static PyObject * --- 4824,4886 ---- #ifdef HAVE_SYS_WAIT_H + #ifdef WCOREDUMP + static char posix_WCOREDUMP__doc__[] = + "WCOREDUMP(status) -> bool\n\ + Return True if the process returning 'status' was dumped to a core file."; + + static PyObject * + posix_WCOREDUMP(PyObject *self, PyObject *args) + { + #ifdef UNION_WAIT + union wait status; + #define status_i (status.w_status) + #else + int status; + #define status_i status + #endif + status_i = 0; + + if (!PyArg_ParseTuple(args, "i:WCOREDUMP", &status_i)) + { + return NULL; + } + + return PyBool_FromLong(WCOREDUMP(status)); + #undef status_i + } + #endif /* WCOREDUMP */ + + #ifdef WIFCONTINUED + static char posix_WIFCONTINUED__doc__[] = + "WIFCONTINUED(status) -> bool\n\ + Return True if the process returning 'status' was continued from a\n\ + job control stop."; + + static PyObject * + posix_WCONTINUED(PyObject *self, PyObject *args) + { + #ifdef UNION_WAIT + union wait status; + #define status_i (status.w_status) + #else + int status; + #define status_i status + #endif + status_i = 0; + + if (!PyArg_ParseTuple(args, "i:WCONTINUED", &status_i)) + { + return NULL; + } + + return PyBool_FromLong(WCONTINUED(status)); + #undef status_i + } + #endif /* WIFCONTINUED */ + #ifdef WIFSTOPPED static char posix_WIFSTOPPED__doc__[] = ! "WIFSTOPPED(status) -> bool\n\ ! Return True if the process returning 'status' was stopped."; static PyObject * *************** *** 4846,4850 **** } ! return Py_BuildValue("i", WIFSTOPPED(status)); #undef status_i } --- 4901,4905 ---- } ! return PyBool_FromLong(WIFSTOPPED(status)); #undef status_i } *************** *** 4853,4858 **** #ifdef WIFSIGNALED static char posix_WIFSIGNALED__doc__[] = ! "WIFSIGNALED(status) -> Boolean\n\ ! Return true if the process returning 'status' was terminated by a signal."; static PyObject * --- 4908,4913 ---- #ifdef WIFSIGNALED static char posix_WIFSIGNALED__doc__[] = ! "WIFSIGNALED(status) -> bool\n\ ! Return True if the process returning 'status' was terminated by a signal."; static PyObject * *************** *** 4873,4877 **** } ! return Py_BuildValue("i", WIFSIGNALED(status)); #undef status_i } --- 4928,4932 ---- } ! return PyBool_FromLong(WIFSIGNALED(status)); #undef status_i } *************** *** 4880,4884 **** #ifdef WIFEXITED static char posix_WIFEXITED__doc__[] = ! "WIFEXITED(status) -> Boolean\n\ Return true if the process returning 'status' exited using the exit()\n\ system call."; --- 4935,4939 ---- #ifdef WIFEXITED static char posix_WIFEXITED__doc__[] = ! "WIFEXITED(status) -> bool\n\ Return true if the process returning 'status' exited using the exit()\n\ system call."; *************** *** 4901,4905 **** } ! return Py_BuildValue("i", WIFEXITED(status)); #undef status_i } --- 4956,4960 ---- } ! return PyBool_FromLong(WIFEXITED(status)); #undef status_i } *************** *** 6408,6411 **** --- 6463,6469 ---- #endif #ifdef HAVE_SYS_WAIT_H + #ifdef WCOREDUMP + {"WCOREDUMP", posix_WCOREDUMP, METH_VARARGS, posix_WCOREDUMP__doc__}, + #endif /* WCOREDUMP */ #ifdef WIFSTOPPED {"WIFSTOPPED", posix_WIFSTOPPED, METH_VARARGS, posix_WIFSTOPPED__doc__}, *************** *** 6542,6547 **** --- 6600,6611 ---- if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; #endif + #ifdef WCONTINUED + if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1; + #endif #ifdef WNOHANG if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; + #endif + #ifdef WUNTRACED + if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1; #endif #ifdef O_RDONLY From fdrake@sourceforge.net Tue Apr 23 19:15:46 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 11:15:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv23455/api Modified Files: abstract.tex Log Message: Clarify the return value of PyObject_IsInstance(). Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** abstract.tex 15 Apr 2002 20:51:19 -0000 1.12 --- abstract.tex 23 Apr 2002 18:15:44 -0000 1.13 *************** *** 130,141 **** \begin{cfuncdesc}{int}{PyObject_IsInstance}{PyObject *inst, PyObject *cls} ! Return \code{1} if \var{inst} is an instance of the class \var{cls} ! or a subclass of \var{cls}. If \var{cls} is a type object rather ! than a class object, \cfunction{PyObject_IsInstance()} returns ! \code{1} if \var{inst} is of type \var{cls}. If \var{inst} is not a ! class instance and \var{cls} is neither a type object or class ! object, \var{inst} must have a \member{__class__} attribute --- the ! class relationship of the value of that attribute with \var{cls} ! will be used to determine the result of this function. \versionadded{2.1} \end{cfuncdesc} --- 130,142 ---- \begin{cfuncdesc}{int}{PyObject_IsInstance}{PyObject *inst, PyObject *cls} ! Returns \code{1} if \var{inst} is an instance of the class \var{cls} ! or a subclass of \var{cls}, or \code{0} if not. On error, returns ! \code{-1} and sets an exception. If \var{cls} is a type object ! rather than a class object, \cfunction{PyObject_IsInstance()} ! returns \code{1} if \var{inst} is of type \var{cls}. If \var{inst} ! is not a class instance and \var{cls} is neither a type object or ! class object, \var{inst} must have a \member{__class__} attribute ! --- the class relationship of the value of that attribute with ! \var{cls} will be used to determine the result of this function. \versionadded{2.1} \end{cfuncdesc} From bwarsaw@sourceforge.net Tue Apr 23 19:18:45 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Tue, 23 Apr 2002 11:18:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_packager.py,1.1,1.2 bdist_pkgtool.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv24299/Lib/distutils/command Modified Files: bdist_packager.py bdist_pkgtool.py Log Message: Whitespace normalization. Unka Timmy would be proud. Index: bdist_packager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_packager.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bdist_packager.py 17 Apr 2002 20:30:10 -0000 1.1 --- bdist_packager.py 23 Apr 2002 18:18:43 -0000 1.2 *************** *** 3,7 **** Modified from bdist_dumb by Mark W. Alexander ! Implements the Distutils 'bdist_packager' abstract command to be subclassed by binary package creation commands.""" --- 3,7 ---- Modified from bdist_dumb by Mark W. Alexander ! Implements the Distutils 'bdist_packager' abstract command to be subclassed by binary package creation commands.""" *************** *** 34,38 **** ('revision=', None, "package revision number"), ! # the following have moved into the distribution class #('packager=', None, #"Package maintainer"), --- 34,38 ---- ('revision=', None, "package revision number"), ! # the following have moved into the distribution class #('packager=', None, #"Package maintainer"), *************** *** 200,207 **** self.ensure_string('revision',"1") #self.ensure_string('url',d.get_url()) ! if type(self.distribution.packages) == type([]): ! self.root_package=self.distribution.packages[0] ! else: ! self.root_package=self.name self.ensure_string('root_package',self.root_package) #self.ensure_string_list('keywords') --- 200,207 ---- self.ensure_string('revision',"1") #self.ensure_string('url',d.get_url()) ! if type(self.distribution.packages) == type([]): ! self.root_package=self.distribution.packages[0] ! else: ! self.root_package=self.name self.ensure_string('root_package',self.root_package) #self.ensure_string_list('keywords') Index: bdist_pkgtool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_pkgtool.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bdist_pkgtool.py 17 Apr 2002 20:30:10 -0000 1.1 --- bdist_pkgtool.py 23 Apr 2002 18:18:43 -0000 1.2 *************** *** 24,28 **** # unless --no-autorelocate is requested. Finds the python site-packages # directory and prompts for verification ! DEFAULT_REQUEST="""#!/bin/sh ###################################################################### # Distutils internal package relocation support # --- 24,28 ---- # unless --no-autorelocate is requested. Finds the python site-packages # directory and prompts for verification ! DEFAULT_REQUEST="""#!/bin/sh ###################################################################### # Distutils internal package relocation support # *************** *** 35,39 **** if [ $? -ne 0 ]; then echo "The python interpretor needs to be on your path!" ! echo echo "If you have more than one, make sure the first one is where" echo "you want this module installed:" --- 35,39 ---- if [ $? -ne 0 ]; then echo "The python interpretor needs to be on your path!" ! echo echo "If you have more than one, make sure the first one is where" echo "you want this module installed:" *************** *** 46,63 **** echo "" if [ -z "${PY_DIR}" ]; then ! echo "I can't seem to find the python distribution." ! echo "I'm assuming the default path for site-packages" else ! BASEDIR="${PY_PKG_DIR}" ! cat <" % (self.author, ! self.author_email)) ! else: ! self.ensure_string('vendor', ! "%s" % (self.author)) self.ensure_string('category', "System,application") self.ensure_script('compver') --- 172,182 ---- self.ensure_string('vendor', None) if self.__dict__.has_key('author'): ! if self.__dict__.has_key('author_email'): ! self.ensure_string('vendor', ! "%s <%s>" % (self.author, ! self.author_email)) ! else: ! self.ensure_string('vendor', ! "%s" % (self.author)) self.ensure_string('category', "System,application") self.ensure_script('compver') *************** *** 189,193 **** "pkg-abrev (%s) must be less than 9 characters" % self.pkg_abrev # Update default scripts with our metadata name ! DEFAULT_REQUEST = string.replace(DEFAULT_REQUEST, "__DISTUTILS_NAME__", self.root_package) DEFAULT_POSTINSTALL = string.replace(DEFAULT_POSTINSTALL, --- 189,193 ---- "pkg-abrev (%s) must be less than 9 characters" % self.pkg_abrev # Update default scripts with our metadata name ! DEFAULT_REQUEST = string.replace(DEFAULT_REQUEST, "__DISTUTILS_NAME__", self.root_package) DEFAULT_POSTINSTALL = string.replace(DEFAULT_POSTINSTALL, *************** *** 244,248 **** self.write_script(os.path.join(pkg_dir, "depend"), 'depend',None) ! self.announce('Creating prototype file') path = os.path.join(pkg_dir, "prototype") --- 244,248 ---- self.write_script(os.path.join(pkg_dir, "depend"), 'depend',None) ! self.announce('Creating prototype file') path = os.path.join(pkg_dir, "prototype") *************** *** 264,269 **** self.spawn(pkg_cmd) pkg_cmd = ['pkgtrans', '-s', '/var/spool/pkg'] ! path = os.path.join(os.environ['PWD'],pkg_dir, ! self.get_binary_name() + ".pkg") self.announce('Transferring package to ' + pkg_dir) pkg_cmd.append(path) --- 264,269 ---- self.spawn(pkg_cmd) pkg_cmd = ['pkgtrans', '-s', '/var/spool/pkg'] ! path = os.path.join(os.environ['PWD'],pkg_dir, ! self.get_binary_name() + ".pkg") self.announce('Transferring package to ' + pkg_dir) pkg_cmd.append(path) *************** *** 271,275 **** self.spawn(pkg_cmd) os.system("rm -rf /var/spool/pkg/%s" % self.pkg_abrev) ! def run (self): --- 271,275 ---- self.spawn(pkg_cmd) os.system("rm -rf /var/spool/pkg/%s" % self.pkg_abrev) ! def run (self): *************** *** 282,286 **** # run() ! def _make_prototype(self): proto_file = ["i pkginfo"] --- 282,286 ---- # run() ! def _make_prototype(self): proto_file = ["i pkginfo"] *************** *** 303,315 **** try: ! self.distribution.packages[0] ! file_list=string.split( ! getoutput("pkgproto %s/%s=%s" % (build.build_lib, ! self.distribution.packages[0], ! self.distribution.packages[0])),"\012") except: ! file_list=string.split( ! getoutput("pkgproto %s=" % (build.build_lib)),"\012") ! ownership="%s %s" % (pwd.getpwuid(os.getuid())[0], grp.getgrgid(os.getgid())[0]) for i in range(len(file_list)): --- 303,315 ---- try: ! self.distribution.packages[0] ! file_list=string.split( ! getoutput("pkgproto %s/%s=%s" % (build.build_lib, ! self.distribution.packages[0], ! self.distribution.packages[0])),"\012") except: ! file_list=string.split( ! getoutput("pkgproto %s=" % (build.build_lib)),"\012") ! ownership="%s %s" % (pwd.getpwuid(os.getuid())[0], grp.getgrgid(os.getgid())[0]) for i in range(len(file_list)): *************** *** 325,329 **** # The request script will simply be the autorelocate script if self.no_autorelocate==0: ! request=string.split(DEFAULT_REQUEST,"\012") else: self.announce('Creating relocation request script') --- 325,329 ---- # The request script will simply be the autorelocate script if self.no_autorelocate==0: ! request=string.split(DEFAULT_REQUEST,"\012") else: self.announce('Creating relocation request script') *************** *** 335,339 **** for i in users_request: request.append(i) ! if self.no_autorelocate==0: request.append("#############################################") --- 335,339 ---- for i in users_request: request.append(i) ! if self.no_autorelocate==0: request.append("#############################################") *************** *** 356,365 **** ] info_file.extend(['VENDOR="%s (%s)"' % (self.distribution.maintainer, \ ! self.distribution.license) ]) info_file.extend(['EMAIL="%s"' % self.distribution.maintainer_email ]) ! p = self.distribution.get_platforms() ! if p is None or p==['UNKNOWN']: ! archs=getoutput('uname -p') else: archs=string.join(self.distribution.get_platforms(),',') --- 356,365 ---- ] info_file.extend(['VENDOR="%s (%s)"' % (self.distribution.maintainer, \ ! self.distribution.license) ]) info_file.extend(['EMAIL="%s"' % self.distribution.maintainer_email ]) ! p = self.distribution.get_platforms() ! if p is None or p==['UNKNOWN']: ! archs=getoutput('uname -p') else: archs=string.join(self.distribution.get_platforms(),',') *************** *** 382,386 **** if site: info_file.extend(['BASEDIR="%s"' % site ]) ! return info_file --- 382,386 ---- if site: info_file.extend(['BASEDIR="%s"' % site ]) ! return info_file *************** *** 401,409 **** else: new_changelog.append(' ' + line) ! # strip trailing newline inserted by first changelog entry if not new_changelog[0]: del new_changelog[0] ! return new_changelog --- 401,409 ---- else: new_changelog.append(' ' + line) ! # strip trailing newline inserted by first changelog entry if not new_changelog[0]: del new_changelog[0] ! return new_changelog From jackjansen@sourceforge.net Tue Apr 23 20:50:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 12:50:56 -0700 Subject: [Python-checkins] python/dist/src/Mac ReadMe,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Mac In directory usw-pr-cvs1:/tmp/cvs-serv27485 Modified Files: ReadMe Log Message: Backport of select parts of release22-maint (up to 1.38.4.2.2.3). Index: ReadMe =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/ReadMe,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** ReadMe 22 Apr 2002 13:56:25 -0000 1.43 --- ReadMe 23 Apr 2002 19:50:53 -0000 1.44 *************** *** 1,3 **** ! How to install Python 2.2 on your Macintosh --------------------------------------------- --- 1,3 ---- ! How to install Python 2.2.1 on your Macintosh --------------------------------------------- *************** *** 36,96 **** If you want 68k support you will have get MacPython 1.5.2. - Toolbox module reorganization and more - -------------------------------------- - - You can safely skip this section if this is your first encounter with MacPython. - - This release has a new organization of the mac-specific modules, and in - general brings the MacPython folder structure more in line with - unix-Python. This is not only a good idea, it will also immensely - facilitate moving MacPython functionality to an OSX Python that is based - on Mach-O and the unix-Python distribution. But don't worry: MacPython - is definitely not dead yet, and the hope is that the transition will be - as seamless as possible. - - First a change that should not cause too much concern: :Mac:Plugins has - gone, and most of the dynamically loaded modules have moved to - :Lib:lib-dynload. - - Second, and more important: the toolbox modules, such as Res and - Resource, have moved to a Carbon package. So, in stead of "import Res" - you should now say "from Carbon import Res" and in stead of "from Res - import *" you should use "from Carbon.Res import *". For the lifetime of - MacPython 2.2 there is a folder :Mac:Lib:lib-compat on sys.path that - contains modules with the old names which imports the new names after - issuing a warning. - - Note that although the package is called Carbon the modules work fine under - classic PPC, and they are normal classic modules. Also note that some - modules you may think of as toolbox modules (such as Waste) really are not, - and they are not in the Carbon package. - - Also, all toolbox modules have been updated to Universal Headers 3.4, and - are (for classic PPC) weak-linked against InterfaceLib so that they should - work on all systems back to MacOS 8.1. Calling an unimplemented function will - raise an exception, not crash your interpreter. - - Another change related to the OSX growth path is that there is a new module - macresource that you can use to easily open a resource file accompanying your - script. Use "macresource.need("DLOG", MY_DIALOG_ID, "name.rsrc") and if the - given resource is not available (it _is_ available if your script has been - turned into an applet) the given resource file will be opened. This method will - eventually also contain the magic needed to open the resource file on - OSX MachO Python. - - Another feature to help with the OSX transition is that if you open a - textfile for reading MacPython will now accept either unix linefeeds - (LF, '\n') or Macintosh linefeeds (CR, '\r') and present both of them - as '\n'. This is done on a low level, so it works for files opened by - scripts as well as for your scripts and modules itself. This can be - turned off with a preference/startup option. - - But: - - this works only for input, and there's no way to find out what the original - linefeed convention of the file was. - - Windows \r\n linefeeds are not supported and get turned into \n\n. - - in 2.3 this feature will be replaced by a more general, platform independent - way of handling files with foreign newline conventions. - What to install --------------- --- 36,39 ---- *************** *** 163,166 **** --- 106,126 ---- ways. + OSX Multiple users note + ----------------------- + + Interaction with Mac OS X multiple users has been tested only very lightly. + If you install as a privileged user everything installs fine. + + If you install as a non-privileged user everything should install in your local + per-user folders. But: as there is no global PythonCore you can only run applets + if they reside in your toplevel Python folder. + + If you install as a privileged user and then try to run + Python as another (non-privileged) user you may encounter a problem with + not having a preference file: the symptom is failing to import all sorts + of standard modules. If you remove your per-user Python preference files + (in ~/Library/Preferences) and then run PythonIntpreter once everything should + be fine. + Uninstalling ------------ *************** *** 168,172 **** Up to three items are installed in the system folder: the interpreter shared libraries PythonCore and PythonCoreCarbon live in the Extensions ! folder and the "Python 2.2 Preferences" file in the Python subfolder in the Preferences folder. All the rest of Python lives in the folder you installed in. --- 128,132 ---- Up to three items are installed in the system folder: the interpreter shared libraries PythonCore and PythonCoreCarbon live in the Extensions ! folder and the "Python 2.2.1 Preferences" file in the Python subfolder in the Preferences folder. All the rest of Python lives in the folder you installed in. *************** *** 216,222 **** are lost and you have to set them again. ! After you are satisfied that 2.2 works as expected you can trash anything in the system folder that has "python" in the name and not ! "2.2". The ConfigurePython... applets will try to detect incompatible --- 176,182 ---- are lost and you have to set them again. ! After you are satisfied that 2.2.1 works as expected you can trash anything in the system folder that has "python" in the name and not ! "2.2.1". The ConfigurePython... applets will try to detect incompatible From jackjansen@sourceforge.net Tue Apr 23 20:56:27 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 12:56:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions readme.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory usw-pr-cvs1:/tmp/cvs-serv29274 Modified Files: readme.txt Log Message: Updated URL. Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/readme.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** readme.txt 25 Oct 2001 22:26:00 -0000 1.6 --- readme.txt 23 Apr 2002 19:56:20 -0000 1.7 *************** *** 52,56 **** adcnews@apple.com http://www.macupdate.com ! http://guide.apple.com/usindex.html http://www.versiontracker.com/ (userid Jack.Jansen@oratrix.com) - Open PythonX.Y.vct again, use the "remove compressed files" command to trim down --- 52,56 ---- adcnews@apple.com http://www.macupdate.com ! http://guide.apple.com/usindex.lasso http://www.versiontracker.com/ (userid Jack.Jansen@oratrix.com) - Open PythonX.Y.vct again, use the "remove compressed files" command to trim down From jackjansen@sourceforge.net Tue Apr 23 20:59:07 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 12:59:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.2.vct,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory usw-pr-cvs1:/tmp/cvs-serv29935 Modified Files: Python 2.2.vct Log Message: Backport of 1.6.4.2.2.3 from release22-maint branch. Index: Python 2.2.vct =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/(vise)/Python 2.2.vct,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 Binary files /tmp/cvsA33KqB and /tmp/cvsmASl28 differ From jhylton@sourceforge.net Tue Apr 23 21:01:22 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 23 Apr 2002 13:01:22 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.116,1.117 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31257a/Objects Modified Files: longobject.c Log Message: Clarify return value of PyLong_AsLongLong(). The function is documented to return -1 on error. If res was < 0, it returned res. It wasn't clear that the invariant was res < 0 iff res == -1. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** longobject.c 12 Apr 2002 02:44:10 -0000 1.116 --- longobject.c 23 Apr 2002 20:01:20 -0000 1.117 *************** *** 697,701 **** /* Plan 9 can't handle LONG_LONG in ? : expressions */ if (res < 0) ! return (LONG_LONG)res; else return bytes; --- 697,701 ---- /* Plan 9 can't handle LONG_LONG in ? : expressions */ if (res < 0) ! return (LONG_LONG)-1; else return bytes; From fdrake@sourceforge.net Tue Apr 23 21:04:48 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 13:04:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv322a/ref Modified Files: ref2.tex Log Message: Minor change to an index entry. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ref2.tex 15 Mar 2002 23:21:37 -0000 1.35 --- ref2.tex 23 Apr 2002 20:04:46 -0000 1.36 *************** *** 457,461 **** \index{decimal literal} \index{imaginary literal} ! \index{complex literal} Note that numeric literals do not include a sign; a phrase like --- 457,461 ---- \index{decimal literal} \index{imaginary literal} ! \index{complex!literal} Note that numeric literals do not include a sign; a phrase like From jhylton@sourceforge.net Tue Apr 23 21:15:07 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 23 Apr 2002 13:15:07 -0700 Subject: [Python-checkins] python/dist/src/Modules resource.c,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv4408/Modules Modified Files: resource.c Log Message: Check for overflow errors in setrlimit(), and reflow a long line. Index: resource.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** resource.c 8 Apr 2002 21:28:20 -0000 2.24 --- resource.c 23 Apr 2002 20:15:04 -0000 2.25 *************** *** 143,147 **** PyObject *curobj, *maxobj; ! if (!PyArg_ParseTuple(args, "i(OO):setrlimit", &resource, &curobj, &maxobj)) return NULL; --- 143,148 ---- PyObject *curobj, *maxobj; ! if (!PyArg_ParseTuple(args, "i(OO):setrlimit", ! &resource, &curobj, &maxobj)) return NULL; *************** *** 154,164 **** --- 155,173 ---- #if !defined(HAVE_LARGEFILE_SUPPORT) rl.rlim_cur = PyInt_AsLong(curobj); + if (rl.rlim_cur == -1 && PyErr_Occurred()) + return NULL; rl.rlim_max = PyInt_AsLong(maxobj); + if (rl.rlim_max == -1 && PyErr_Occurred()) + return NULL; #else /* The limits are probably bigger than a long */ rl.rlim_cur = PyLong_Check(curobj) ? PyLong_AsLongLong(curobj) : PyInt_AsLong(curobj); + if (rl.rlim_cur == -1 && PyErr_Occurred()) + return NULL; rl.rlim_max = PyLong_Check(maxobj) ? PyLong_AsLongLong(maxobj) : PyInt_AsLong(maxobj); + if (rl.rlim_max == -1 && PyErr_Occurred()) + return NULL; #endif From jhylton@sourceforge.net Tue Apr 23 21:21:24 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 23 Apr 2002 13:21:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_resource.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6686/Lib/test Added Files: test_resource.py Log Message: Add tests for the recent resource module change. Also add a test that Python doesn't die with SIGXFSZ if it exceeds the file rlimit. (Assuming this will also test the behavior when the 2GB limit is exceed on a platform that doesn't have large file support.) --- NEW FILE: test_resource.py --- import os import resource from test_support import TESTFN # This test is checking a few specific problem spots. RLIMIT_FSIZE # should be RLIM_INFINITY, which will be a really big number on a # platform with large file support. On these platforms, we need to # test that the get/setrlimit functions properly convert the number to # a C long long and that the conversion doesn't raise an error. try: cur, max = resource.getrlimit(resource.RLIMIT_FSIZE) except AttributeError: pass else: print resource.RLIM_INFINITY == max resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) # Now check to see what happens when the RLIMIT_FSIZE is small. Some # versions of Python were terminated by an uncaught SIGXFSZ, but # pythonrun.c has been fixed to ignore that exception. If so, the # write() should return EFBIG when the limit is exceeded. try: resource.setrlimit(resource.RLIMIT_FSIZE, (1024, max)) f = open(TESTFN, "wb") f.write("X" * 1024) try: f.write("Y") f.flush() except IOError: pass f.close() os.unlink(TESTFN) finally: resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) # And be sure that setrlimit is checking for really large values too_big = 10L**50 try: resource.setrlimit(resource.RLIMIT_FSIZE, (too_big, max)) except OverflowError: pass try: resource.setrlimit(resource.RLIMIT_FSIZE, (max, too_big)) except OverflowError: pass From jhylton@sourceforge.net Tue Apr 23 21:21:24 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 23 Apr 2002 13:21:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_resource,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv6686/Lib/test/output Added Files: test_resource Log Message: Add tests for the recent resource module change. Also add a test that Python doesn't die with SIGXFSZ if it exceeds the file rlimit. (Assuming this will also test the behavior when the 2GB limit is exceed on a platform that doesn't have large file support.) --- NEW FILE: test_resource --- test_resource True From jhylton@sourceforge.net Tue Apr 23 21:31:03 2002 From: jhylton@sourceforge.net (jhylton@sourceforge.net) Date: Tue, 23 Apr 2002 13:31:03 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.159,2.160 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10266/Python Modified Files: pythonrun.c Log Message: Ignore SIGXFSZ. The SIGXFSZ signal is sent when the maximum file size limit is exceeded (RLIMIT_FSIZE). Apparently, it is also sent when the 2GB file limit is reached on platforms without large file support. The default action for SIGXFSZ is to terminate the process and dump core. When it is ignored, the system call that caused the limit to be exceeded returns an error and sets errno to EFBIG. Python always checks errno on I/O syscalls, so there is nothing to do with the signal. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** pythonrun.c 13 Apr 2002 08:29:14 -0000 2.159 --- pythonrun.c 23 Apr 2002 20:31:01 -0000 2.160 *************** *** 1358,1361 **** --- 1358,1364 ---- signal(SIGXFZ, SIG_IGN); #endif + #ifdef SIGXFSZ + signal(SIGXFSZ, SIG_IGN); + #endif #endif /* HAVE_SIGNAL_H */ PyOS_InitInterrupts(); /* May imply initsignal() */ From jackjansen@sourceforge.net Tue Apr 23 22:07:20 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Finder_Basics.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv23186/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Finder_Basics.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Finder_Basics.py 17 May 2001 12:40:24 -0000 1.2 --- Finder_Basics.py 23 Apr 2002 21:07:18 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 33,37 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 33,37 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 52,56 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 52,56 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 71,75 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 71,75 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 90,94 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 90,94 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 109,113 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 109,113 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 135,139 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 135,139 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 197,200 **** --- 197,204 ---- which = 'desk' want = 'cdsk' + class execution_state(aetools.NProperty): + """execution state - the current execution state of the Finder """ + which = 'exec' + want = 'ese0' class Finder_preferences(aetools.NProperty): """Finder preferences - Various preferences that apply to the Finder as a whole """ *************** *** 225,228 **** --- 229,233 ---- # element 'cwnd' as ['indx', 'name'] # element 'iwnd' as ['indx', 'name'] + # element 'vwnd' as ['indx', 'name'] # element 'lwnd' as ['indx', 'name'] # element 'dwnd' as ['indx', 'name'] *************** *** 286,289 **** --- 291,295 ---- 'about_this_computer' : about_this_computer, 'desktop' : desktop, + 'execution_state' : execution_state, 'Finder_preferences' : Finder_preferences, } *************** *** 313,316 **** --- 319,323 ---- 'container_window' : Earlier_terms.container_window, 'information_window' : Earlier_terms.information_window, + 'view_options_window' : Window_classes.view_options_window, 'clipping_window' : Window_classes.clipping_window, 'content_space' : Window_classes.content_space, *************** *** 334,365 **** # _classdeclarations = { - 'spfl' : special_folders, 'capp' : application, } _propdeclarations = { ! 'amnu' : apple_menu_items_folder, ! 'extn' : extensions_folder, ! 'pnam' : name, ! 'fshr' : file_sharing, ! 'pcli' : clipboard, ! 'strt' : startup_items_folder, ! 'pref' : preferences_folder, ! 'pisf' : frontmost, ! 'pins' : insertion_location, ! 'pvis' : visible, ! 'abbx' : about_this_computer, ! 'temp' : temporary_items_folder, ! 'font' : fonts_folder, 'pfrp' : Finder_preferences, ! 'desk' : desktop, ! 'fsup' : sharing_starting_up, 'mfre' : largest_free_block, 'ctrl' : control_panels_folder, - 'sele' : selection, - 'shdf' : shutdown_items_folder, 'macs' : system_folder, ! 'ver2' : product_version, ! 'vers' : version, } --- 341,373 ---- # _classdeclarations = { 'capp' : application, + 'spfl' : special_folders, } _propdeclarations = { ! 'vers' : version, ! 'ver2' : product_version, 'pfrp' : Finder_preferences, ! 'exec' : execution_state, ! 'pins' : insertion_location, 'mfre' : largest_free_block, + 'fsup' : sharing_starting_up, + 'desk' : desktop, 'ctrl' : control_panels_folder, 'macs' : system_folder, ! 'font' : fonts_folder, ! 'abbx' : about_this_computer, ! 'shdf' : shutdown_items_folder, ! 'temp' : temporary_items_folder, ! 'pvis' : visible, ! 'sele' : selection, ! 'pisf' : frontmost, ! 'pref' : preferences_folder, ! 'strt' : startup_items_folder, ! 'pcli' : clipboard, ! 'fshr' : file_sharing, ! 'pnam' : name, ! 'extn' : extensions_folder, ! 'amnu' : apple_menu_items_folder, } From jackjansen@sourceforge.net Tue Apr 23 22:07:25 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:25 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Standard_Suite.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv23218/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Standard_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 22 Aug 2000 20:35:17 -0000 1.2 --- Standard_Suite.py 23 Apr 2002 21:07:23 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 11,15 **** _code = 'CoRe' ! class Standard_Suite_Events: _argmap_open = { --- 11,16 ---- _code = 'CoRe' ! from StdSuites.Standard_Suite import * ! class Standard_Suite_Events(Standard_Suite_Events): _argmap_open = { *************** *** 34,38 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 35,39 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 59,63 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 60,64 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 78,82 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 79,83 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 98,102 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 99,103 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 124,128 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 125,129 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 150,154 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 151,155 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 171,175 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 172,176 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 203,207 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 204,208 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 224,228 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 225,229 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 255,259 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 256,260 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 290,294 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 291,295 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 310,314 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 311,315 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 316,319 **** --- 317,322 ---- return _arguments['----'] + import AppleScript_Suite + import AppleScript_Suite _Enum_list = None # XXXX enum list not found!! _Enum_bool = None # XXXX enum bool not found!! From jackjansen@sourceforge.net Tue Apr 23 22:07:29 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23241/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: __init__.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 17 May 2001 12:38:48 -0000 1.3 --- __init__.py 23 Apr 2002 21:07:27 -0000 1.4 *************** *** 1,7 **** """ ! Package generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ Resource aete resid 0 """ import aetools import Required_suite import Standard_Suite --- 1,8 ---- """ ! Package generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ Resource aete resid 0 """ import aetools + Error = aetools.Error import Required_suite import Standard_Suite From jackjansen@sourceforge.net Tue Apr 23 22:07:35 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23286/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Mozilla_suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mozilla_suite.py 17 May 2001 12:39:32 -0000 1.2 --- Mozilla_suite.py 23 Apr 2002 21:07:33 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 34,38 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 34,38 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 54,58 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 54,58 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 80,84 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 80,84 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 100,104 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 100,104 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 119,123 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 119,123 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 139,143 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 139,143 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 159,163 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 159,163 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 178,182 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 178,182 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 198,202 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 198,202 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 218,222 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 218,222 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 241,251 **** _Enum_ncmd = { ! 'Get_new_mail' : '\000\000\004W', # ! 'Send_queued_messages' : '\000\000\004X', # ! 'Read_newsgroups' : '\000\000\004\004', # ! 'Show_Inbox' : '\000\000\004\005', # ! 'Show_Bookmarks_window' : '\000\000\004\006', # ! 'Show_History_window' : '\000\000\004\007', # ! 'Show_Address_Book_window' : '\000\000\004\011', # } --- 241,251 ---- _Enum_ncmd = { ! 'Get_new_mail' : '\x00\x00\x04W', # ! 'Send_queued_messages' : '\x00\x00\x04X', # ! 'Read_newsgroups' : '\x00\x00\x04\x04', # ! 'Show_Inbox' : '\x00\x00\x04\x05', # ! 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # ! 'Show_History_window' : '\x00\x00\x04\x07', # ! 'Show_Address_Book_window' : '\x00\x00\x04\t', # } *************** *** 264,269 **** _enumdeclarations = { - 'dire' : _Enum_dire, 'comp' : _Enum_comp, 'ncmd' : _Enum_ncmd, } --- 264,269 ---- _enumdeclarations = { 'comp' : _Enum_comp, 'ncmd' : _Enum_ncmd, + 'dire' : _Enum_dire, } From jackjansen@sourceforge.net Tue Apr 23 22:07:39 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape PowerPlant.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23311/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: PowerPlant.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PowerPlant.py 17 May 2001 12:39:27 -0000 1.2 --- PowerPlant.py 23 Apr 2002 21:07:37 -0000 1.3 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 32,36 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 32,36 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 56,60 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 56,60 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 63,70 **** _Enum_dbac = { ! 'DoNothing' : '\000\000\000\000', # No debugging action is taken. ! 'PostAlert' : '\000\000\000\001', # Post an alert. ! 'LowLevelDebugger' : '\000\000\000\002', # Break into the low level debugger (MacsBug). ! 'SourceDebugger' : '\000\000\000\003', # Break into the source level debugger (if source debugger is executing). } --- 63,70 ---- _Enum_dbac = { ! 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. ! 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. ! 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). ! 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). } From jackjansen@sourceforge.net Tue Apr 23 22:07:44 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Standard_URL_suite.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23336/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Standard_URL_suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_URL_suite.py 17 May 2001 12:39:15 -0000 1.2 --- Standard_URL_suite.py 23 Apr 2002 21:07:41 -0000 1.3 *************** *** 5,9 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 5,9 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 40,44 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 40,44 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:07:53 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:53 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Text.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23385/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Text.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Text.py 17 May 2001 12:39:11 -0000 1.3 --- Text.py 23 Apr 2002 21:07:51 -0000 1.4 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 96,115 **** # _classdeclarations = { - 'stys' : styleset, 'ctxt' : text, } _propdeclarations = { - 'pAft' : justbehind, - 'psct' : writing_code, - 'txst' : style, - 'colr' : color, 'pBef' : infront, ! 'pnam' : name, 'ptsz' : size, 'pUpL' : updateLevel, ! 'bgng' : beginning, 'font' : font, - 'end ' : end, } --- 96,115 ---- # _classdeclarations = { 'ctxt' : text, + 'stys' : styleset, } _propdeclarations = { 'pBef' : infront, ! 'bgng' : beginning, ! 'colr' : color, ! 'txst' : style, ! 'psct' : writing_code, ! 'pAft' : justbehind, ! 'end ' : end, 'ptsz' : size, 'pUpL' : updateLevel, ! 'pnam' : name, 'font' : font, } From jackjansen@sourceforge.net Tue Apr 23 22:07:58 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape WorldWideWeb_suite.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23413/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: WorldWideWeb_suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WorldWideWeb_suite.py 17 May 2001 12:39:07 -0000 1.2 --- WorldWideWeb_suite.py 23 Apr 2002 21:07:56 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 43,47 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 43,47 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 73,77 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 73,77 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 99,103 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 99,103 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 124,128 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 124,128 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 145,149 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 145,149 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 165,169 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 165,169 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 185,189 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 185,189 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 206,210 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 206,210 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 226,230 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 226,230 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 246,250 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 246,250 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 274,278 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 274,278 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 300,304 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 300,304 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 326,330 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 326,330 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 352,356 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 352,356 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 378,382 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 378,382 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 404,408 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 404,408 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:06:11 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv22758/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: __init__.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 22 Aug 2000 20:35:17 -0000 1.2 --- __init__.py 23 Apr 2002 21:06:08 -0000 1.3 *************** *** 1,4 **** """ ! Package generated from Macintosh HD:Systeemmap:Finder Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from Moes:Systeemmap:Finder Resource aete resid 0 """ From jackjansen@sourceforge.net Tue Apr 23 22:06:27 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Files_and_suitcases.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv22866/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Files_and_suitcases.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Files_and_suitcases.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Files_and_suitcases.py 17 May 2001 12:40:28 -0000 1.3 --- Files_and_suitcases.py 23 Apr 2002 21:06:25 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 244,278 **** # _classdeclarations = { 'clpf' : clipping, - 'docf' : document_file, - 'stcs' : suitcase, - 'appf' : application_file, - 'file' : file, - 'fsut' : font_suitcase, - 'pack' : package, - 'dafi' : desk_accessory_file, 'alia' : alias_file, 'dsut' : desk_accessory_suitcase, ! 'inlf' : internet_location_file, ! 'fntf' : font_file, ! 'sndf' : sound_file, } _propdeclarations = { ! 'orig' : original_item, ! 'pspd' : stationery, ! 'aslk' : locked, ! 'iloc' : location, ! 'mprt' : minimum_size, ! 'fcrt' : creator_type, ! 'c@#^' : _3c_Inheritance_3e_, ! 'asty' : file_type, ! 'hscr' : has_scripting_terminology, ! 'sprt' : suggested_size, 'appt' : preferred_size, 'isab' : accepts_high_level_events, ! 'snd ' : sound, ! 'ver2' : product_version, ! 'vers' : version, } --- 244,278 ---- # _classdeclarations = { + 'sndf' : sound_file, + 'fntf' : font_file, + 'inlf' : internet_location_file, 'clpf' : clipping, 'alia' : alias_file, + 'dafi' : desk_accessory_file, 'dsut' : desk_accessory_suitcase, ! 'fsut' : font_suitcase, ! 'file' : file, ! 'appf' : application_file, ! 'stcs' : suitcase, ! 'docf' : document_file, ! 'pack' : package, } _propdeclarations = { ! 'vers' : version, ! 'ver2' : product_version, ! 'snd ' : sound, 'appt' : preferred_size, + 'sprt' : suggested_size, 'isab' : accepts_high_level_events, ! 'hscr' : has_scripting_terminology, ! 'asty' : file_type, ! 'c@#^' : _3c_Inheritance_3e_, ! 'fcrt' : creator_type, ! 'mprt' : minimum_size, ! 'pspd' : stationery, ! 'iloc' : location, ! 'aslk' : locked, ! 'orig' : original_item, } From jackjansen@sourceforge.net Tue Apr 23 22:07:07 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Window_classes.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv23107/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Window_classes.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Window_classes.py 17 May 2001 12:39:36 -0000 1.3 --- Window_classes.py 23 Apr 2002 21:07:04 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 51,56 **** which = 'pmod' want = 'bool' ! ! resizable = titled class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ --- 51,58 ---- which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 228,231 **** --- 230,239 ---- information_windows = information_window + class view_options_window(aetools.ComponentItem): + """view options window - A View Options window """ + want = 'vwnd' + + view_options_windows = view_options_window + class preferences_window(aetools.ComponentItem): """preferences window - The Finder Preferences window """ *************** *** 306,309 **** --- 314,323 ---- information_window._elemdict = { } + view_options_window._propdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + 'item' : item, + } + view_options_window._elemdict = { + } preferences_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, *************** *** 326,386 **** # _classdeclarations = { 'dwnd' : content_space, 'iwnd' : information_window, 'lwnd' : clipping_window, - 'cwnd' : container_window, - 'cwin' : window, - 'pwnd' : preferences_window, } _propdeclarations = { ! 'pidx' : index, ! 'scda' : shows_creation_date, ! 'vers' : version, ! 'aslk' : locked, ! 'pvew' : view, ! 'sdat' : shows_modification_date, ! 'drwr' : popup, ! 'sprt' : suggested_size, ! 'pvis' : visible, ! 'ptsz' : size, ! 'pull' : pulled_open, ! 'slbl' : shows_label, ! 'wshd' : collapsed, ! 'ctnr' : container, ! 'ascd' : creation_date, ! 'warn' : warns_before_emptying, ! 'sord' : sort_direction, ! 'iszm' : zoomable, ! 'comt' : comment, ! 'svew' : previous_list_view, ! 'svrs' : shows_version, ! 'sknd' : shows_kind, ! 'phys' : physical_size, 'iarr' : spatial_view_arrangement, ! 'posn' : position, ! 'ptit' : titled, ! 'cobj' : item, ! 'asmo' : modification_date, ! 'ssiz' : shows_size, ! 'pnam' : name, 'pbnd' : bounds, - 'mprt' : minimum_size, 'iimg' : icon, 'cuss' : has_custom_view_settings, ! 'appt' : preferred_size, ! 'scom' : shows_comments, ! 'pmod' : modal, ! 'panl' : current_panel, ! 'urdt' : uses_relative_dates, ! 'zumf' : zoomed_full_size, ! 'sfsz' : calculates_folder_sizes, ! 'c@#^' : _3c_Inheritance_3e_, 'isfl' : floating, ! 'hclb' : closeable, ! 'pspd' : stationery, ! 'pzum' : zoomed, ! 'barr' : button_view_arrangement, ! 'ver2' : product_version, } --- 340,402 ---- # _classdeclarations = { + 'pwnd' : preferences_window, + 'vwnd' : view_options_window, + 'cwin' : window, + 'cwnd' : container_window, 'dwnd' : content_space, 'iwnd' : information_window, 'lwnd' : clipping_window, } _propdeclarations = { ! 'prsz' : resizable, ! 'barr' : button_view_arrangement, ! 'pzum' : zoomed, 'iarr' : spatial_view_arrangement, ! 'hclb' : closeable, ! 'c@#^' : _3c_Inheritance_3e_, ! 'ver2' : product_version, ! 'sfsz' : calculates_folder_sizes, ! 'sprt' : suggested_size, ! 'zumf' : zoomed_full_size, ! 'urdt' : uses_relative_dates, ! 'panl' : current_panel, ! 'pmod' : modal, ! 'pspd' : stationery, ! 'scom' : shows_comments, ! 'appt' : preferred_size, ! 'aslk' : locked, 'pbnd' : bounds, 'iimg' : icon, + 'mprt' : minimum_size, + 'pnam' : name, + 'ssiz' : shows_size, + 'asmo' : modification_date, + 'cobj' : item, + 'ptit' : titled, + 'posn' : position, 'cuss' : has_custom_view_settings, ! 'phys' : physical_size, ! 'sknd' : shows_kind, ! 'svrs' : shows_version, ! 'svew' : previous_list_view, ! 'comt' : comment, ! 'iszm' : zoomable, ! 'sord' : sort_direction, ! 'ascd' : creation_date, ! 'ctnr' : container, ! 'wshd' : collapsed, ! 'slbl' : shows_label, ! 'pull' : pulled_open, ! 'ptsz' : size, ! 'pvis' : visible, ! 'pidx' : index, 'isfl' : floating, ! 'warn' : warns_before_emptying, ! 'drwr' : popup, ! 'sdat' : shows_modification_date, ! 'pvew' : view, ! 'scda' : shows_creation_date, ! 'vers' : version, } From jackjansen@sourceforge.net Tue Apr 23 22:06:59 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Type_Definitions.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv23054/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Type_Definitions.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Type_Definitions.py 17 May 2001 12:39:44 -0000 1.3 --- Type_Definitions.py 23 Apr 2002 21:06:57 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 222,265 **** # _classdeclarations = { - 'clbl' : label, - 'ifam' : icon_family, - 'alst' : alias_list, 'cprf' : preferences, } _propdeclarations = { 'ics#' : small_monochrome_icon_and_mask, ! 'scda' : shows_creation_date, ! 'uswg' : uses_wide_grid, 'sprg' : spring_open_folders, ! 'is32' : small_32_bit_icon, ! 'ICN#' : large_monochrome_icon_and_mask, ! 'cwin' : window, ! 'sdat' : shows_modification_date, ! 'iisz' : spatial_view_icon_size, ! 'barr' : button_view_arrangement, ! 'il32' : large_32_bit_icon, 'l8mk' : large_8_bit_mask, - 'scom' : shows_comments, - 'bisz' : button_view_icon_size, - 'lisz' : list_view_icon_size, - 'slbl' : shows_label, - 'icl4' : large_4_bit_icon, - 'usme' : uses_simple_menus, - 'urdt' : uses_relative_dates, 'vfnt' : view_font, ! 'sfsz' : calculates_folder_sizes, 'pidx' : index, ! 'icl8' : large_8_bit_icon, ! 'ssiz' : shows_size, ! 'ics8' : small_8_bit_mask, ! 'colr' : color, ! 'svrs' : shows_version, 'pnam' : name, ! 'sknd' : shows_kind, ! 'vfsz' : view_font_size, ! 'iarr' : spatial_view_arrangement, ! 'ics4' : small_4_bit_icon, ! 'dela' : delay_before_springing, } --- 222,265 ---- # _classdeclarations = { 'cprf' : preferences, + 'alst' : alias_list, + 'ifam' : icon_family, + 'clbl' : label, } _propdeclarations = { + 'dela' : delay_before_springing, + 'ics4' : small_4_bit_icon, + 'iarr' : spatial_view_arrangement, + 'barr' : button_view_arrangement, 'ics#' : small_monochrome_icon_and_mask, ! 'sknd' : shows_kind, ! 'svrs' : shows_version, ! 'colr' : color, ! 'ics8' : small_8_bit_mask, ! 'icl8' : large_8_bit_icon, 'sprg' : spring_open_folders, ! 'vfsz' : view_font_size, ! 'sfsz' : calculates_folder_sizes, 'l8mk' : large_8_bit_mask, 'vfnt' : view_font, ! 'urdt' : uses_relative_dates, ! 'usme' : uses_simple_menus, ! 'icl4' : large_4_bit_icon, ! 'slbl' : shows_label, ! 'lisz' : list_view_icon_size, ! 'scda' : shows_creation_date, ! 'bisz' : button_view_icon_size, 'pidx' : index, ! 'scom' : shows_comments, ! 'iisz' : spatial_view_icon_size, ! 'sdat' : shows_modification_date, ! 'cwin' : window, ! 'ICN#' : large_monochrome_icon_and_mask, ! 'is32' : small_32_bit_icon, 'pnam' : name, ! 'il32' : large_32_bit_icon, ! 'uswg' : uses_wide_grid, ! 'ssiz' : shows_size, } From jackjansen@sourceforge.net Tue Apr 23 22:06:21 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:21 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Enumerations.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv22841/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Enumerations.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Enumerations.py 22 Aug 2000 20:35:16 -0000 1.2 --- Enumerations.py 23 Apr 2002 21:06:19 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 17,44 **** _Enum_ipnl = { ! 'General Information panel' : 'gpnl', # ! 'Sharing panel' : 'spnl', # ! 'Memory panel' : 'mpnl', # ! 'Status and Configuration panel' : 'scnl', # ! 'Fonts panel' : 'fpnl', # } _Enum_pple = { ! 'General Preferences panel' : 'pgnp', # ! 'Label Preferences panel' : 'plbp', # ! 'Icon View Preferences panel' : 'pivp', # ! 'Button View Preferences panel' : 'pbvp', # ! 'List View Preferences panel' : 'plvp', # } _Enum_earr = { ! 'not arranged' : 'narr', # ! 'snap to grid' : 'grda', # ! 'arranged by name' : 'nama', # ! 'arranged by modification date' : 'mdta', # ! 'arranged by creation date' : 'cdta', # ! 'arranged by size' : 'siza', # ! 'arranged by kind' : 'kina', # ! 'arranged by label' : 'laba', # } --- 17,44 ---- _Enum_ipnl = { ! 'General_Information_panel' : 'gpnl', # ! 'Sharing_panel' : 'spnl', # ! 'Memory_panel' : 'mpnl', # ! 'Status_and_Configuration_panel' : 'scnl', # ! 'Fonts_panel' : 'fpnl', # } _Enum_pple = { ! 'General_Preferences_panel' : 'pgnp', # ! 'Label_Preferences_panel' : 'plbp', # ! 'Icon_View_Preferences_panel' : 'pivp', # ! 'Button_View_Preferences_panel' : 'pbvp', # ! 'List_View_Preferences_panel' : 'plvp', # } _Enum_earr = { ! 'not_arranged' : 'narr', # ! 'snap_to_grid' : 'grda', # ! 'arranged_by_name' : 'nama', # ! 'arranged_by_modification_date' : 'mdta', # ! 'arranged_by_creation_date' : 'cdta', # ! 'arranged_by_size' : 'siza', # ! 'arranged_by_kind' : 'kina', # ! 'arranged_by_label' : 'laba', # } *************** *** 56,64 **** _Enum_vwby = { 'conflicts' : 'cflc', # ! 'existing items' : 'exsi', # ! 'small icon' : 'smic', # 'icon' : 'iimg', # 'name' : 'pnam', # ! 'modification date' : 'asmo', # 'size' : 'ptsz', # 'kind' : 'kind', # --- 56,64 ---- _Enum_vwby = { 'conflicts' : 'cflc', # ! 'existing_items' : 'exsi', # ! 'small_icon' : 'smic', # 'icon' : 'iimg', # 'name' : 'pnam', # ! 'modification_date' : 'asmo', # 'size' : 'ptsz', # 'kind' : 'kind', # *************** *** 66,72 **** 'label' : 'labi', # 'version' : 'vers', # ! 'creation date' : 'ascd', # ! 'small button' : 'smbu', # ! 'large button' : 'lgbu', # 'grid' : 'grid', # 'all' : 'kyal', # --- 66,72 ---- 'label' : 'labi', # 'version' : 'vers', # ! 'creation_date' : 'ascd', # ! 'small_button' : 'smbu', # ! 'large_button' : 'lgbu', # 'grid' : 'grid', # 'all' : 'kyal', # *************** *** 78,85 **** 'MMU' : 'mmu ', # 'hardware' : 'hdwr', # ! 'operating system' : 'os ', # ! 'sound system' : 'snd ', # ! 'memory available' : 'lram', # ! 'memory installed' : 'ram ', # } --- 78,94 ---- 'MMU' : 'mmu ', # 'hardware' : 'hdwr', # ! 'operating_system' : 'os ', # ! 'sound_system' : 'snd ', # ! 'memory_available' : 'lram', # ! 'memory_installed' : 'ram ', # ! } ! ! _Enum_ese0 = { ! 'starting_up' : 'ese2', # ! 'running' : 'ese3', # ! 'rebuilding_desktop' : 'ese5', # ! 'copying' : 'ese4', # ! 'restarting' : 'ese6', # ! 'quitting' : 'ese7', # } *************** *** 98,107 **** _enumdeclarations = { 'gsen' : _Enum_gsen, - 'earr' : _Enum_earr, 'isiz' : _Enum_isiz, ! 'vwby' : _Enum_vwby, 'pple' : _Enum_pple, - 'ipnl' : _Enum_ipnl, - 'sodr' : _Enum_sodr, } --- 107,117 ---- _enumdeclarations = { + 'sodr' : _Enum_sodr, + 'ipnl' : _Enum_ipnl, + 'ese0' : _Enum_ese0, + 'vwby' : _Enum_vwby, 'gsen' : _Enum_gsen, 'isiz' : _Enum_isiz, ! 'earr' : _Enum_earr, 'pple' : _Enum_pple, } From jackjansen@sourceforge.net Tue Apr 23 22:06:16 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Containers_and_folders.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv22807/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Containers_and_folders.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Containers_and_folders.py 17 May 2001 12:40:38 -0000 1.3 --- Containers_and_folders.py 23 Apr 2002 21:06:14 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 47,50 **** --- 47,54 ---- which = 'lvis' want = 'long' + class view_options_window(aetools.NProperty): + """view options window - the view options window for the container (can only be opened when the container window is open) """ + which = 'vwnd' + want = 'vwnd' # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] *************** *** 277,280 **** --- 281,285 ---- 'icon_size' : icon_size, 'icon_size' : icon_size, + 'view_options_window' : view_options_window, } container._elemdict = { *************** *** 438,479 **** # _classdeclarations = { 'priv' : sharing_privileges, - 'cfol' : folder, 'cdis' : disk, ! 'sctr' : sharable_container, 'ctnr' : container, - 'cdsk' : desktop_2d_object, - 'ctrs' : trash_2d_object, } _propdeclarations = { ! 'ownr' : owner_privileges, ! 'spro' : protected, 'frsp' : free_space, - 'sgrp' : group, - 'pexc' : completely_expanded, - 'sele' : selection, - 'smou' : mounted, 'pexa' : expandable, ! 'istd' : startup, ! 'sdsk' : startup_disk, ! 'gppr' : group_privileges, ! 'shar' : shared, ! 'capa' : capacity, ! 'isej' : ejectable, ! 'gstp' : guest_privileges, 'warn' : warns_before_emptying, 'sown' : owner, ! 'c@#^' : _3c_Inheritance_3e_, 'sexp' : exported, ! 'isrv' : local_volume, ! 'iprv' : privileges_inherited, ! 'lvis' : icon_size, 'trsh' : trash, 'prvs' : see_folders, ! 'prvr' : see_files, ! 'prvw' : make_changes, ! 'pexp' : expanded, ! 'ects' : entire_contents, } --- 443,485 ---- # _classdeclarations = { + 'ctrs' : trash_2d_object, + 'cdsk' : desktop_2d_object, + 'sctr' : sharable_container, 'priv' : sharing_privileges, 'cdis' : disk, ! 'cfol' : folder, 'ctnr' : container, } _propdeclarations = { ! 'pexp' : expanded, ! 'gppr' : group_privileges, ! 'prvr' : see_files, ! 'ects' : entire_contents, ! 'lvis' : icon_size, ! 'iprv' : privileges_inherited, ! 'isrv' : local_volume, 'frsp' : free_space, 'pexa' : expandable, ! 'pexc' : completely_expanded, ! 'vwnd' : view_options_window, 'warn' : warns_before_emptying, 'sown' : owner, ! 'prvw' : make_changes, ! 'isej' : ejectable, ! 'capa' : capacity, ! 'shar' : shared, 'sexp' : exported, ! 'sdsk' : startup_disk, ! 'istd' : startup, ! 'gstp' : guest_privileges, 'trsh' : trash, + 'smou' : mounted, + 'sele' : selection, 'prvs' : see_folders, ! 'sgrp' : group, ! 'c@#^' : _3c_Inheritance_3e_, ! 'spro' : protected, ! 'ownr' : owner_privileges, } From jackjansen@sourceforge.net Tue Apr 23 22:05:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:05:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Explorer Required_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer In directory usw-pr-cvs1:/tmp/cvs-serv22645/Python/Mac/Lib/lib-scriptpackages/Explorer Modified Files: Required_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Required_Suite.py 20 Aug 2000 20:23:57 -0000 1.1 --- Required_Suite.py 23 Apr 2002 21:05:54 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 27,31 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 47,51 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 47,51 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 67,71 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 67,71 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 86,90 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 86,90 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:06:43 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Obsolete_terms.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv22975/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Obsolete_terms.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Obsolete_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Obsolete_terms.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Obsolete_terms.py 17 May 2001 12:39:48 -0000 1.3 --- Obsolete_terms.py 23 Apr 2002 21:06:40 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 176,204 **** # _classdeclarations = { ! 'ccdv' : control_panel, ! 'iwnd' : information_window, ! 'ctnr' : container, 'capp' : application, ! 'sctr' : sharable_container, ! 'cwnd' : container_window, 'prcs' : process, - 'file' : file, 'cobj' : item, ! 'qwnd' : status_window, ! 'swnd' : sharing_window, } _propdeclarations = { ! 'crtd' : creation_date_obsolete, ! 'cfol' : folder_obsolete, ! 'ctnr' : container, ! 'cwnd' : container_window, ! 'pvwp' : view_preferences, 'swnd' : sharing_window, 'sctr' : sharable_container, 'cobj' : item, - 'modd' : modification_date_obsolete, - 'islk' : locked_obsolete, - 'fitp' : file_type_obsolete, } --- 176,204 ---- # _classdeclarations = { ! 'qwnd' : status_window, 'capp' : application, ! 'swnd' : sharing_window, ! 'ccdv' : control_panel, 'prcs' : process, 'cobj' : item, ! 'file' : file, ! 'sctr' : sharable_container, ! 'cwnd' : container_window, ! 'ctnr' : container, ! 'iwnd' : information_window, } _propdeclarations = { ! 'fitp' : file_type_obsolete, 'swnd' : sharing_window, + 'cfol' : folder_obsolete, + 'crtd' : creation_date_obsolete, + 'islk' : locked_obsolete, + 'modd' : modification_date_obsolete, 'sctr' : sharable_container, + 'pvwp' : view_preferences, + 'cwnd' : container_window, + 'ctnr' : container, 'cobj' : item, } From jackjansen@sourceforge.net Tue Apr 23 22:05:52 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:05:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Explorer URL_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer In directory usw-pr-cvs1:/tmp/cvs-serv22605/Python/Mac/Lib/lib-scriptpackages/Explorer Modified Files: URL_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** URL_Suite.py 20 Aug 2000 20:23:58 -0000 1.1 --- URL_Suite.py 23 Apr 2002 21:05:49 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 19,24 **** def GetURL(self, _object, _attributes={}, **_arguments): """GetURL: Open the URL (and optionally save it to disk) ! Required argument: The URL ! Keyword argument to: Save the resolved URL contents to this file. Keyword argument _attributes: AppleEvent attribute dictionary """ --- 19,24 ---- def GetURL(self, _object, _attributes={}, **_arguments): """GetURL: Open the URL (and optionally save it to disk) ! Required argument: URL to open ! Keyword argument to: File into which to save resource located at URL. Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 32,36 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 32,36 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:07:15 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:07:15 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Earlier_terms.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv23141/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Earlier_terms.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Earlier_terms.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Earlier_terms.py 17 May 2001 12:40:33 -0000 1.3 --- Earlier_terms.py 23 Apr 2002 21:07:12 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 402,407 **** which = 'pmod' want = 'bool' ! ! resizable = titled class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ --- 402,409 ---- which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 616,723 **** # _classdeclarations = { 'iwnd' : information_window, - 'cwnd' : container_window, - 'inlf' : internet_location, - 'appf' : application_file, 'prcs' : process, 'cobj' : item, - 'cwin' : window, - 'pcda' : accessory_process, - 'ctrs' : trash_2d_object, - 'capp' : application, - 'cprf' : preferences, - 'sctr' : sharable_container, - 'dsut' : accessory_suitcase, } _propdeclarations = { 'pidx' : index, ! 'scda' : show_creation_date, ! 'qpro' : properties, ! 'fshr' : file_sharing, ! 'pvew' : view, ! 'pusd' : partition_space_used, ! 'aslk' : locked, ! 'sdat' : show_modification_date, ! 'issl' : selected, ! 'pvis' : visible, ! 'slbl' : show_label, ! 'wshd' : collapsed, ! 'cdis' : disk, ! 'usme' : use_simple_menus, 'sord' : sort_direction, ! 'sexp' : exported, ! 'comt' : comment, ! 'dscr' : description, ! 'svew' : previous_list_view, ! 'svrs' : show_version, ! 'sknd' : show_kind, ! 'phys' : physical_size, ! 'iarr' : spatial_view_arrangement, ! 'smou' : mounted, ! 'posn' : position, ! 'cobj' : item, 'revt' : remote_events, ! 'asmo' : modification_date, ! 'ssiz' : show_size, ! 'pnam' : name, ! 'mprt' : minimum_partition_size, ! 'cwin' : window, ! 'pcli' : clipboard, ! 'spro' : protected, ! 'sprt' : suggested_partition_size, ! 'pisf' : frontmost, ! 'sele' : selection, ! 'pmod' : modal, ! 'fcrt' : creator_type, ! 'shar' : shared, ! 'dwnd' : content_space, 'zumf' : zoomed_full_size, - 'sfsz' : calculate_folder_sizes, - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'pspd' : stationery, 'iprv' : inherited_privileges, - 'pfrp' : Finder_preferences, - 'barr' : button_view_arrangement, - 'ownr' : owner_privileges, - 'drwr' : popup, - 'sgrp' : group, - 'ptsz' : size, - 'kind' : kind, - 'pull' : pulled_open, - 'abbx' : about_this_computer, - 'ctnr' : container, - 'ascd' : creation_date, - 'desk' : desktop, - 'warn' : warn_before_emptying, - 'iszm' : zoomable, - 'isab' : scriptable, - 'gstp' : guest_privileges, 'vers' : version, ! 'dela' : delay_before_springing, ! 'ptit' : titled, ! 'uswg' : use_wide_grid, ! 'cuss' : has_custom_view_settings, ! 'labi' : label_index, ! 'iwnd' : information_window, 'file' : file, ! 'asty' : file_type, ! 'appt' : partition_size, ! 'scom' : show_comments, ! 'pins' : insertion_location, ! 'pbnd' : bounds, ! 'urdt' : use_relative_dates, ! 'fsup' : sharing_starting_up, ! 'sown' : owner, ! 'isfl' : floating, ! 'hclb' : closeable, ! 'iimg' : icon, ! 'gppr' : group_privileges, ! 'asdr' : folder, 'sprg' : spring_open_folders, ! 'pzum' : zoomed, ! 'ver2' : product_version, ! 'mfre' : largest_free_block, } --- 618,726 ---- # _classdeclarations = { + 'dsut' : accessory_suitcase, + 'cprf' : preferences, + 'sctr' : sharable_container, + 'capp' : application, + 'ctrs' : trash_2d_object, + 'pcda' : accessory_process, + 'cwin' : window, 'iwnd' : information_window, 'prcs' : process, + 'appf' : application_file, + 'inlf' : internet_location, + 'cwnd' : container_window, 'cobj' : item, } _propdeclarations = { + 'ver2' : product_version, + 'pbnd' : bounds, + 'asdr' : folder, + 'gppr' : group_privileges, 'pidx' : index, ! 'isfl' : floating, ! 'sown' : owner, ! 'fsup' : sharing_starting_up, ! 'urdt' : use_relative_dates, ! 'scom' : show_comments, ! 'appt' : partition_size, ! 'iimg' : icon, ! 'asty' : file_type, ! 'uswg' : use_wide_grid, ! 'ptit' : titled, ! 'dela' : delay_before_springing, ! 'cuss' : has_custom_view_settings, ! 'gstp' : guest_privileges, ! 'isab' : scriptable, ! 'iszm' : zoomable, 'sord' : sort_direction, ! 'pins' : insertion_location, ! 'pspd' : stationery, ! 'desk' : desktop, ! 'ascd' : creation_date, ! 'ctnr' : container, ! 'abbx' : about_this_computer, ! 'pull' : pulled_open, ! 'kind' : kind, ! 'ptsz' : size, ! 'hclb' : closeable, ! 'sgrp' : group, ! 'mfre' : largest_free_block, 'revt' : remote_events, ! 'drwr' : popup, ! 'iwnd' : information_window, ! 'ownr' : owner_privileges, ! 'pzum' : zoomed, ! 'prsz' : resizable, ! 'barr' : button_view_arrangement, ! 'pfrp' : Finder_preferences, 'zumf' : zoomed_full_size, 'iprv' : inherited_privileges, 'vers' : version, ! 'c@#^' : _3c_Inheritance_3e_, ! 'ID ' : id, ! 'sfsz' : calculate_folder_sizes, 'file' : file, ! 'dwnd' : content_space, ! 'shar' : shared, ! 'pmod' : modal, ! 'sele' : selection, ! 'pisf' : frontmost, ! 'sprt' : suggested_partition_size, ! 'spro' : protected, ! 'pcli' : clipboard, ! 'cwin' : window, ! 'mprt' : minimum_partition_size, 'sprg' : spring_open_folders, ! 'ssiz' : show_size, ! 'asmo' : modification_date, ! 'svrs' : show_version, ! 'cobj' : item, ! 'posn' : position, ! 'iarr' : spatial_view_arrangement, ! 'phys' : physical_size, ! 'sknd' : show_kind, ! 'labi' : label_index, ! 'svew' : previous_list_view, ! 'dscr' : description, ! 'comt' : comment, ! 'sexp' : exported, ! 'usme' : use_simple_menus, ! 'cdis' : disk, ! 'wshd' : collapsed, ! 'slbl' : show_label, ! 'warn' : warn_before_emptying, ! 'scda' : show_creation_date, ! 'pvis' : visible, ! 'issl' : selected, ! 'smou' : mounted, ! 'sdat' : show_modification_date, ! 'fcrt' : creator_type, ! 'pusd' : partition_space_used, ! 'pvew' : view, ! 'fshr' : file_sharing, ! 'qpro' : properties, ! 'aslk' : locked, ! 'pnam' : name, } From jackjansen@sourceforge.net Tue Apr 23 22:06:52 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Process_classes.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv23009/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Process_classes.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Process_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Process_classes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Process_classes.py 22 Aug 2000 20:35:17 -0000 1.2 --- Process_classes.py 23 Apr 2002 21:06:49 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 121,144 **** # _classdeclarations = { 'pcda' : desk_accessory_process, 'pcap' : application_process, - 'prcs' : process, } _propdeclarations = { - 'revt' : accepts_remote_events, - 'appf' : application_file, - 'pnam' : name, - 'file' : file, - 'pusd' : partition_space_used, - 'fcrt' : creator_type, - 'c@#^' : _3c_Inheritance_3e_, - 'asty' : file_type, - 'hscr' : has_scripting_terminology, - 'dafi' : desk_accessory_file, - 'isab' : accepts_high_level_events, - 'appt' : total_partition_size, - 'pisf' : frontmost, 'pvis' : visible, } --- 121,144 ---- # _classdeclarations = { + 'prcs' : process, 'pcda' : desk_accessory_process, 'pcap' : application_process, } _propdeclarations = { 'pvis' : visible, + 'pisf' : frontmost, + 'appt' : total_partition_size, + 'isab' : accepts_high_level_events, + 'dafi' : desk_accessory_file, + 'hscr' : has_scripting_terminology, + 'asty' : file_type, + 'c@#^' : _3c_Inheritance_3e_, + 'fcrt' : creator_type, + 'pusd' : partition_space_used, + 'file' : file, + 'pnam' : name, + 'appf' : application_file, + 'revt' : accepts_remote_events, } From jackjansen@sourceforge.net Tue Apr 23 22:08:04 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:08:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Required_suite.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23444/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Required_suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Required_suite.py 17 May 2001 12:39:23 -0000 1.3 --- Required_suite.py 23 Apr 2002 21:08:02 -0000 1.4 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 28,32 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 48,52 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 48,52 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 67,71 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 67,71 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 86,90 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 86,90 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:06:35 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Finder_items.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv22902/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Finder_items.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Finder_items.py 17 May 2001 12:39:53 -0000 1.2 --- Finder_items.py 23 Apr 2002 21:06:31 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 27,31 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 52,56 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 52,56 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 72,76 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 72,76 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 92,96 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 92,96 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 112,116 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 112,116 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 118,124 **** --- 118,129 ---- return _arguments['----'] + _argmap_put_away = { + 'asking' : 'fask', + } + def put_away(self, _object, _attributes={}, **_arguments): """put away: Put away the specified object(s) Required argument: the items to put away + Keyword argument asking: Specifies whether or not to present a dialog to confirm putting this item away. Keyword argument _attributes: AppleEvent attribute dictionary Returns: the object put away in its put-away location *************** *** 127,137 **** _subcode = 'ptwy' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 132,143 ---- _subcode = 'ptwy' ! aetools.keysubst(_arguments, self._argmap_put_away) _arguments['----'] = _object + aetools.enumsubst(_arguments, 'fask', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 153,157 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 159,163 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 173,177 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 179,183 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 294,297 **** --- 300,304 ---- item._elemdict = { } + _Enum_bool = None # XXXX enum bool not found!! # *************** *** 303,327 **** _propdeclarations = { ! 'iwnd' : information_window, ! 'cdis' : disk, ! 'asmo' : modification_date, ! 'ascd' : creation_date, ! 'pnam' : name, 'labi' : label_index, ! 'ID ' : id, ! 'iimg' : icon, 'pidx' : index, ! 'dwnd' : content_space, 'cwin' : window, ! 'comt' : comment, ! 'dscr' : description, 'asdr' : folder, ! 'issl' : selected, ! 'pbnd' : bounds, ! 'ctnr' : container, ! 'phys' : physical_size, ! 'ptsz' : size, ! 'kind' : kind, ! 'posn' : position, } --- 310,334 ---- _propdeclarations = { ! 'posn' : position, ! 'kind' : kind, ! 'ptsz' : size, ! 'phys' : physical_size, ! 'dwnd' : content_space, ! 'pbnd' : bounds, ! 'issl' : selected, 'labi' : label_index, ! 'dscr' : description, ! 'comt' : comment, ! 'ctnr' : container, 'pidx' : index, ! 'iimg' : icon, ! 'ID ' : id, 'cwin' : window, ! 'pnam' : name, ! 'ascd' : creation_date, ! 'cdis' : disk, ! 'asmo' : modification_date, 'asdr' : folder, ! 'iwnd' : information_window, } From jackjansen@sourceforge.net Tue Apr 23 22:06:02 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:06:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Explorer Web_Browser_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer In directory usw-pr-cvs1:/tmp/cvs-serv22679/Python/Mac/Lib/lib-scriptpackages/Explorer Modified Files: Web_Browser_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Web_Browser_Suite.py 20 Aug 2000 20:23:58 -0000 1.1 --- Web_Browser_Suite.py 23 Apr 2002 21:06:00 -0000 1.2 *************** *** 1,6 **** ! """Suite Web Browser Suite: Class of events which are sent to Web Browser applications Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 1,6 ---- ! """Suite Web Browser Suite: Class of events supported by Web Browser applications Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 18,38 **** 'Flags' : 'FLGS', 'FormData' : 'POST', ! 'MIMEType' : 'MIME', ! 'ProgressApp' : 'PROG', ! 'ResultApp' : 'RSLT', } def OpenURL(self, _object, _attributes={}, **_arguments): """OpenURL: Retrieves URL off the Web. ! Required argument: Fully specified URL ! Keyword argument to: File to save downloaded data into. ! Keyword argument toWindow: Window to open this URL into. (Use -1 for top window, 0 for new window) Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. ! Keyword argument FormData: Posting of forms of a given MIMEType. ! Keyword argument MIMEType: MIME type for the FormData. ! Keyword argument ProgressApp: If specified, ProgressApp can be named to handle the user interface for process messages. ! Keyword argument ResultApp: When the requested URL has been accessed and all associated documents loaded, the Web browser will issue an OpenURLResult to the ResultApp. Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TransactionID """ _code = 'WWW!' --- 18,33 ---- 'Flags' : 'FLGS', 'FormData' : 'POST', ! 'MIME_Type' : 'MIME', } def OpenURL(self, _object, _attributes={}, **_arguments): """OpenURL: Retrieves URL off the Web. ! Required argument: Fully-qualified URL ! Keyword argument to: Target file for saving downloaded data ! Keyword argument toWindow: Target window for resource at URL (-1 for top window, 0 for new window) Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. ! Keyword argument FormData: data to post ! Keyword argument MIME_Type: MIME type of data being posted Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' *************** *** 45,49 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 40,44 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 52,70 **** _argmap_ShowFile = { ! 'MIME_type' : 'MIME', ! 'Window_ID' : 'WIND', 'URL' : 'URL ', - 'ResultApp' : 'RSLT', } def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: Passes FileSpec containing data of a given MIME type to be rendered in a given WindowID. ! Required argument: The file to show. ! Keyword argument MIME_type: MIME type ! Keyword argument Window_ID: ID of the window to open the file into. (Can use -1 for top window) ! Keyword argument URL: A URL which allows this document to be reloaded if necessary. ! Keyword argument ResultApp: When the requested URL has been accessed and all associated documents loaded, the Web browser will issue a ShowFileResult to the ResultApp. Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TransactionID """ _code = 'WWW!' --- 47,62 ---- _argmap_ShowFile = { ! 'MIME_Type' : 'MIME', ! 'Window_Identifier' : 'WIND', 'URL' : 'URL ', } def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: FileSpec containing data of specified MIME type to be rendered in window specified by Window Identifier. ! Required argument: The file ! Keyword argument MIME_Type: MIME type ! Keyword argument Window_Identifier: Identifier of the target window for the URL. (Can use -1 for top window) ! Keyword argument URL: URL that allows this document to be reloaded. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' *************** *** 77,128 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def CancelTransaction(self, _object, _attributes={}, **_arguments): ! """CancelTransaction: Tells the Web browser to cancel a TransactionID is progress which the application has initiated via an OpenURL or ShowFile command. ! Required argument: TransactionID ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'CANT' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_QueryVersion = { ! 'Major_Version' : 'MAJV', ! 'Minor_Version' : 'MINV', ! } ! ! def QueryVersion(self, _no_object=None, _attributes={}, **_arguments): ! """QueryVersion: Tells the Web browser that an application which wishes to communicate with it supports a specific version (major.minor) of this SDI specification ! Keyword argument Major_Version: Major version of the SDI specification the sending application supports. ! Keyword argument Minor_Version: Minor version of the SDI specification the sending application supports. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: ! """ ! _code = 'WWW!' ! _subcode = 'QVER' ! ! aetools.keysubst(_arguments, self._argmap_QueryVersion) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 69,73 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 131,135 **** def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): ! """CloseAllWindows: Tells the Web browser to close all windows Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success --- 76,80 ---- def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): ! """CloseAllWindows: Closes all windows Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success *************** *** 144,148 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 89,93 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 156,162 **** def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): ! """CloseWindow: Tells the Web browser to close the window specified either by Window ID or Title. If no parameters are specified, the top window will be closed. Keyword argument ID: ID of the window to close. (Can use -1 for top window) ! Keyword argument Title: Title of the window to close. Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success --- 101,107 ---- def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): ! """CloseWindow: Close the window specified by either Window Identifier or Title. If no parameter is specified, close the top window. Keyword argument ID: ID of the window to close. (Can use -1 for top window) ! Keyword argument Title: Title of the window to close Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success *************** *** 171,175 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 116,120 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 177,195 **** return _arguments['----'] - _argmap_Activate = { - 'Flags' : 'FLGS', - } - def Activate(self, _object=None, _attributes={}, **_arguments): ! """Activate: Tells the Web browser to bring itself to the front and show WindowID. (Can use -1 for top window) ! Required argument: WindowID ! Keyword argument Flags: Reserved for future use Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: WindowID of the front window """ _code = 'WWW!' _subcode = 'ACTV' ! aetools.keysubst(_arguments, self._argmap_Activate) _arguments['----'] = _object --- 122,135 ---- return _arguments['----'] def Activate(self, _object=None, _attributes={}, **_arguments): ! """Activate: Activate Internet Explorer and optionally select window designated by Window Identifier. ! Required argument: Window Identifier Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Window Identifier of window to activate """ _code = 'WWW!' _subcode = 'ACTV' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object *************** *** 197,201 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 137,141 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 204,208 **** def ListWindows(self, _no_object=None, _attributes={}, **_arguments): ! """ListWindows: Return a list of WindowIDs representing each windows currently being used by the Web browser. Keyword argument _attributes: AppleEvent attribute dictionary Returns: undocumented, typecode 'list' --- 144,148 ---- def ListWindows(self, _no_object=None, _attributes={}, **_arguments): ! """ListWindows: Returns list of Window Identifiers for all open windows. Keyword argument _attributes: AppleEvent attribute dictionary Returns: undocumented, typecode 'list' *************** *** 217,221 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 157,161 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 224,229 **** def GetWindowInfo(self, _object, _attributes={}, **_arguments): ! """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. ! Required argument: WindowID of the window to get info about Keyword argument _attributes: AppleEvent attribute dictionary Returns: --- 164,169 ---- def GetWindowInfo(self, _object, _attributes={}, **_arguments): ! """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. ! Required argument: Window Identifier of the window Keyword argument _attributes: AppleEvent attribute dictionary Returns: *************** *** 238,242 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 178,182 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 249,257 **** def ParseAnchor(self, _object, _attributes={}, **_arguments): ! """ParseAnchor: Combine a base URL and a relative URL to produce a fully-specified URL ! Required argument: MainURL.The base URL. ! Keyword argument withURL: RelativeURL, which, when combined with the MainURL (in the direct object), is used to produce a fully-specified URL. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The Fully specified URL """ _code = 'WWW!' --- 189,197 ---- def ParseAnchor(self, _object, _attributes={}, **_arguments): ! """ParseAnchor: Combines a base URL and a relative URL to produce a fully-qualified URL ! Required argument: Base URL ! Keyword argument withURL: Relative URL that is combined with the Base URL (in the direct object) to produce a fully-qualified URL. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Fully-qualified URL """ _code = 'WWW!' *************** *** 264,614 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_BeginProgress = { ! 'with_Message' : 'PMSG', ! } ! ! def BeginProgress(self, _object, _attributes={}, **_arguments): ! """BeginProgress: Initialize a progress indicator. ! Required argument: TransactionID ! Keyword argument with_Message: Message to display with the progress indicator. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'PRBG' ! ! aetools.keysubst(_arguments, self._argmap_BeginProgress) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_SetProgressRange = { ! 'Max' : 'MAXV', ! } ! ! def SetProgressRange(self, _object, _attributes={}, **_arguments): ! """SetProgressRange: Sets a max value for the progress indicator associated with TransactionID ! Required argument: TransactionID ! Keyword argument Max: Max value for this progress indicator ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'PRSR' ! ! aetools.keysubst(_arguments, self._argmap_SetProgressRange) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_MakingProgress = { ! 'with_message' : 'PMSG', ! 'current_setting' : 'CURR', ! } ! ! def MakingProgress(self, _object, _attributes={}, **_arguments): ! """MakingProgress: Updates the progress indicator associated with TransactionID ! Required argument: TransactionID ! Keyword argument with_message: Message to display in the progress indicator ! Keyword argument current_setting: Current value of the progress indicator ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Cancel ! """ ! _code = 'WWW!' ! _subcode = 'PRMK' ! ! aetools.keysubst(_arguments, self._argmap_MakingProgress) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def EndProgress(self, _object, _attributes={}, **_arguments): ! """EndProgress: Nortifies the application that the progress indicator associated with TransactionID is no longer needed. ! Required argument: TransactionID ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'PREN' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterDone(self, _object, _attributes={}, **_arguments): ! """RegisterDone: Signals that all processing initiated by the RegisteNow event associated by TransactionID has finished. ! Required argument: TransactionID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: 0 = failure; 1 = success; 2 = sending application needs more time to complete operation. ! """ ! _code = 'WWW!' ! _subcode = 'RGDN' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_RegisterProtocol = { ! '_for' : 'PROT', ! } ! ! def RegisterProtocol(self, _object, _attributes={}, **_arguments): ! """RegisterProtocol: Notifies that the sending application is able to handle all URLs for the specified protocol. ! Required argument: application ! Keyword argument _for: Protocol, such as NEWS, MAILTO, etc... ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'RGPR' ! ! aetools.keysubst(_arguments, self._argmap_RegisterProtocol) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_UnRegisterProtocol = { ! '_for' : 'PROT', ! } ! ! def UnRegisterProtocol(self, _object, _attributes={}, **_arguments): ! """UnRegisterProtocol: Notifies that the sending application is no longer wishes to handle URLs for the specified protocol. ! Required argument: application ! Keyword argument _for: Protocol, such as NEWS, MAILTO, etc... ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRP' ! ! aetools.keysubst(_arguments, self._argmap_UnRegisterProtocol) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_RegisterViewer = { ! '_for' : 'MIME', ! 'as' : 'FTYP', ! 'Flags' : 'MTHD', ! } ! ! def RegisterViewer(self, _object, _attributes={}, **_arguments): ! """RegisterViewer: Notifies that the sending application is able to handle all documents for the specified MIMEType. ! Required argument: application ! Keyword argument _for: MIMEType ! Keyword argument as: File type for saved documents ! Keyword argument Flags: undocumented, typecode 'shor' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGVW' ! ! aetools.keysubst(_arguments, self._argmap_RegisterViewer) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_UnRegisterViewer = { ! '_for' : 'MIME', ! } ! ! def UnRegisterViewer(self, _object, _attributes={}, **_arguments): ! """UnRegisterViewer: Notifies that the sending application is no longer wishes to handle documents of the specified MIMEType. ! Required argument: application ! Keyword argument _for: MIMEType ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNVW' ! ! aetools.keysubst(_arguments, self._argmap_UnRegisterViewer) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterURLEcho(self, _object, _attributes={}, **_arguments): ! """RegisterURLEcho: Notifies that the sending application would like to receive EchoURL events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'RGUE' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def UnRegisterURLEcho(self, _object, _attributes={}, **_arguments): ! """UnRegisterURLEcho: Notifies that the sending application would no longer like to receive EchoURL events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRU' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterWindowClose(self, _object, _attributes={}, **_arguments): ! """RegisterWindowClose: Notifies that the sending application would like to receive WindowClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGWC' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def UnRegisterWindowClose(self, _object, _attributes={}, **_arguments): ! """UnRegisterWindowClose: Notifies that the sending application would no longer like to receive WindowClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRC' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterAppClose(self, _object, _attributes={}, **_arguments): ! """RegisterAppClose: Notifies that the sending application would like to receive AppClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGAC' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def UnRegisterAppClose(self, _object, _attributes={}, **_arguments): ! """UnRegisterAppClose: Notifies that the sending application would no longer like to receive AppClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRA' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 204,208 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:08:08 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:08:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Standard_Suite.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv23526/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Standard_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 17 May 2001 12:39:19 -0000 1.2 --- Standard_Suite.py 23 Apr 2002 21:08:06 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 11,15 **** _code = 'CoRe' ! class Standard_Suite_Events: def close(self, _object, _attributes={}, **_arguments): --- 11,16 ---- _code = 'CoRe' ! from StdSuites.Standard_Suite import * ! class Standard_Suite_Events(Standard_Suite_Events): def close(self, _object, _attributes={}, **_arguments): *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 48,52 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 49,53 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 69,73 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 70,74 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 94,98 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 95,99 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 213,233 **** _propdeclarations = { ! 'ptit' : titled, 'pidx' : index, 'ppos' : position, 'curl' : URL, - 'pnam' : name, - 'pbnd' : bounds, - 'isfl' : floating, - 'hclb' : closeable, - 'ALAP' : alert_application, - 'iszm' : zoomable, - 'pmod' : modal, 'pzum' : zoomed, ! 'pvis' : visible, ! 'KOSK' : kiosk_mode, ! 'busy' : busy, ! 'prsz' : resizable, ! 'wiid' : unique_ID, } --- 214,234 ---- _propdeclarations = { ! 'prsz' : resizable, ! 'busy' : busy, ! 'KOSK' : kiosk_mode, ! 'pvis' : visible, ! 'hclb' : closeable, ! 'pmod' : modal, ! 'wiid' : unique_ID, ! 'pbnd' : bounds, ! 'iszm' : zoomable, ! 'ALAP' : alert_application, 'pidx' : index, + 'isfl' : floating, + 'pnam' : name, 'ppos' : position, 'curl' : URL, 'pzum' : zoomed, ! 'ptit' : titled, } From jackjansen@sourceforge.net Tue Apr 23 22:08:39 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:08:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv23718/Python/Mac/Lib/lib-scriptpackages/StdSuites Modified Files: AppleScript_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AppleScript_Suite.py 22 Jan 2002 23:21:56 -0000 1.3 --- AppleScript_Suite.py 23 Apr 2002 21:08:37 -0000 1.4 *************** *** 26,30 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 26,30 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 46,50 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 46,50 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 65,69 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 65,69 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 84,88 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 84,88 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 104,108 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 104,108 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 123,127 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 123,127 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 142,146 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 142,146 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 161,165 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 161,165 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 192,196 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 192,196 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 272,276 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 272,276 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 293,297 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 293,297 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 314,318 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 314,318 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 335,339 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 335,339 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 356,360 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 356,360 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 377,381 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 377,381 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 398,402 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 398,402 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 419,423 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 419,423 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 440,444 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 440,444 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 461,465 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 461,465 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 482,486 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 482,486 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 503,507 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 503,507 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 524,528 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 524,528 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 545,549 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 545,549 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 566,570 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 566,570 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 587,591 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 587,591 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 608,612 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 608,612 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 629,633 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 629,633 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 650,654 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 650,654 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 671,675 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 671,675 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 692,696 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 692,696 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 713,717 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 713,717 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 734,738 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 734,738 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:08:48 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:08:48 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites Standard_Suite.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv23789/Python/Mac/Lib/lib-scriptpackages/StdSuites Modified Files: Standard_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 22 Jan 2002 23:22:18 -0000 1.3 --- Standard_Suite.py 23 Apr 2002 21:08:46 -0000 1.4 *************** *** 28,32 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 47,51 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 47,51 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 66,70 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 66,70 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 86,90 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 86,90 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 111,115 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 111,115 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 139,143 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 139,143 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 165,169 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 165,169 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 185,189 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 185,189 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 213,217 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 213,217 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 234,238 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 234,238 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 265,269 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 265,269 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 291,295 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 291,295 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 318,322 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 318,322 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 338,342 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 338,342 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 364,368 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 364,368 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 390,394 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 390,394 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 416,420 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 416,420 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 442,446 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 442,446 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Tue Apr 23 22:08:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 14:08:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/_builtinSuites builtin_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/_builtinSuites In directory usw-pr-cvs1:/tmp/cvs-serv23841/Python/Mac/Lib/lib-scriptpackages/_builtinSuites Modified Files: builtin_Suite.py Log Message: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. Bugfix candidate. Index: builtin_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/_builtinSuites/builtin_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** builtin_Suite.py 22 Jan 2002 23:20:12 -0000 1.1 --- builtin_Suite.py 23 Apr 2002 21:08:54 -0000 1.2 *************** *** 24,28 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 24,28 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 43,47 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 43,47 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 62,66 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 62,66 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 82,86 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 82,86 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 107,111 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 107,111 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From fdrake@sourceforge.net Tue Apr 23 22:19:57 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 14:19:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.3,1.3.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27025/lib Modified Files: Tag: release21-maint libinspect.tex Log Message: Add text about circular references caused by storing frames in local variables. This closes SF bug #543148. Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** libinspect.tex 10 Apr 2001 15:12:34 -0000 1.3 --- libinspect.tex 23 Apr 2002 21:19:55 -0000 1.3.2.1 *************** *** 288,289 **** --- 288,304 ---- exception. \end{funcdesc} + + Stackframes stored directly or indirectly in local variables can + easily cause reference cycles the garbage collector can't collect, + leading to memory leaks. To avoid this, it's a good idea to + explicitly remove the cycle in a \keyword{finally} clause. For + example: + + \begin{verbatim} + def handle_stackframe_without_leak(): + frame = inspect.currentframe() + try: + # do something with the frame + finally: + del frame + \end{verbatim} From fdrake@sourceforge.net Tue Apr 23 22:20:47 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 14:20:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.10,1.10.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27310/lib Modified Files: Tag: release22-maint libinspect.tex Log Message: Add text about circular references caused by storing frames in local variables. This closes SF bug #543148. Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.10 retrieving revision 1.10.6.1 diff -C2 -d -r1.10 -r1.10.6.1 *** libinspect.tex 7 Dec 2001 23:13:53 -0000 1.10 --- libinspect.tex 23 Apr 2002 21:20:44 -0000 1.10.6.1 *************** *** 322,323 **** --- 322,339 ---- exception. \end{funcdesc} + + Stackframes stored directly or indirectly in local variables can + easily cause reference cycles. Though the cycle detector will catch + these, destruction of the frames (and local variables) can be made + deterministic by removing the cycle in a \keyword{finally} clause. + This is also important if the cycle detector was disabled when Python + was compiled or using \function{gc.disable()}. For example: + + \begin{verbatim} + def handle_stackframe_without_leak(): + frame = inspect.currentframe() + try: + # do something with the frame + finally: + del frame + \end{verbatim} From fdrake@sourceforge.net Tue Apr 23 22:21:22 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 23 Apr 2002 14:21:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27491/lib Modified Files: libinspect.tex Log Message: Add text about circular references caused by storing frames in local variables. This closes SF bug #543148. Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libinspect.tex 7 Dec 2001 23:13:53 -0000 1.10 --- libinspect.tex 23 Apr 2002 21:21:20 -0000 1.11 *************** *** 322,323 **** --- 322,339 ---- exception. \end{funcdesc} + + Stackframes stored directly or indirectly in local variables can + easily cause reference cycles. Though the cycle detector will catch + these, destruction of the frames (and local variables) can be made + deterministic by removing the cycle in a \keyword{finally} clause. + This is also important if the cycle detector was disabled when Python + was compiled or using \function{gc.disable()}. For example: + + \begin{verbatim} + def handle_stackframe_without_leak(): + frame = inspect.currentframe() + try: + # do something with the frame + finally: + del frame + \end{verbatim} From guido@python.org Tue Apr 23 22:20:56 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 23 Apr 2002 17:20:56 -0400 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.2,1.3 In-Reply-To: Your message of "Tue, 23 Apr 2002 14:07:35 PDT." References: Message-ID: <200204232120.g3NLKuZ13340@odiug.zope.com> > Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. > > Bugfix candidate. Since this all appears to be generated code, maybe it would be easier if you backported this yourself by running the generator with the previous version(s?), rather than letting Anthony struggle with the patches? --Guido van Rossum (home page: http://www.python.org/~guido/) From bwarsaw@sourceforge.net Tue Apr 23 22:39:10 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Tue, 23 Apr 2002 14:39:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test README,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv416 Modified Files: README Log Message: Rewrote the PyUnit description so that it now recommends to use run_suite() instead of run_unittest(). Best practice is to plan for multiple test classes. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** README 28 Sep 2001 20:05:25 -0000 1.12 --- README 23 Apr 2002 21:39:00 -0000 1.13 *************** *** 41,47 **** run_unittest() takes a unittest.TestCase derived class as a parameter and runs the tests defined in that class, and run_suite() takes a ! populated TestSuite instance and runs the tests.. All test methods in ! the Python regression framework have names that start with "test_" and ! use lower-case names with words separated with underscores. All PyUnit-based tests in the Python test suite use boilerplate that --- 41,51 ---- run_unittest() takes a unittest.TestCase derived class as a parameter and runs the tests defined in that class, and run_suite() takes a ! populated TestSuite instance and runs the tests. run_suite() is ! preferred because unittest files typically grow multiple test classes, ! and you might as well be prepared. ! ! All test methods in the Python regression framework have names that ! start with "test_" and use lower-case names with words separated with ! underscores. All PyUnit-based tests in the Python test suite use boilerplate that *************** *** 51,59 **** import test_support ! class MyTestCase(unittest.TestCase): # define test methods here... def test_main(): ! test_support.run_unittest(MyTestCase) if __name__ == "__main__": --- 55,69 ---- import test_support ! class MyTestCase1(unittest.TestCase): # define test methods here... + class MyTestCase2(unittest.TestCase): + # define more test methods here... + def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(MyTestCase1)) ! suite.addTest(unittest.makeSuite(MyTestCase2)) ! test_support.run_suite(suite) if __name__ == "__main__": *************** *** 154,158 **** make test ! {WINDOWS] Run rt.bat from your PCBuild directory. Read the comments at the top of rt.bat for the use of special -d, -O and -q options processed by rt.bat. --- 164,168 ---- make test ! [WINDOWS] Run rt.bat from your PCBuild directory. Read the comments at the top of rt.bat for the use of special -d, -O and -q options processed by rt.bat. From jackjansen@sourceforge.net Tue Apr 23 23:42:31 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:42:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt _CarbonEvtmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory usw-pr-cvs1:/tmp/cvs-serv18502/Python/Mac/Modules/carbonevt Modified Files: _CarbonEvtmodule.c Log Message: Regenerated. Index: _CarbonEvtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/_CarbonEvtmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _CarbonEvtmodule.c 9 Jan 2002 18:54:16 -0000 1.8 --- _CarbonEvtmodule.c 23 Apr 2002 22:42:28 -0000 1.9 *************** *** 172,176 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 172,176 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 479,483 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 479,483 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 662,666 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 662,666 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 754,758 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 754,758 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 869,873 **** Py_DECREF(self->ob_callback); } ! PyMem_DEL(self); } --- 869,873 ---- Py_DECREF(self->ob_callback); } ! PyObject_Del(self); } *************** *** 1019,1023 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 1019,1023 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 1114,1118 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 1114,1118 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 1231,1235 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 1231,1235 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:42:42 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:42:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/win _Winmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv18558/Python/Mac/Modules/win Modified Files: _Winmodule.c Log Message: Regenerated. Index: _Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/_Winmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Winmodule.c 18 Mar 2002 15:41:32 -0000 1.8 --- _Winmodule.c 23 Apr 2002 22:42:40 -0000 1.9 *************** *** 121,125 **** self->ob_itself = NULL; self->ob_freeit = NULL; ! PyMem_DEL(self); } --- 121,125 ---- self->ob_itself = NULL; self->ob_freeit = NULL; ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:42:52 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:42:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastemodule.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv18647/Python/Mac/Modules/waste Modified Files: wastemodule.c Log Message: Regenerated. Index: wastemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** wastemodule.c 11 Jan 2002 12:36:50 -0000 1.22 --- wastemodule.c 23 Apr 2002 22:42:50 -0000 1.23 *************** *** 240,244 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 240,244 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 457,461 **** { WEDispose(self->ob_itself); ! PyMem_DEL(self); } --- 457,461 ---- { WEDispose(self->ob_itself); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:42:59 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:42:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/te _TEmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv18737/Python/Mac/Modules/te Modified Files: _TEmodule.c Log Message: Regenerated. Index: _TEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/_TEmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _TEmodule.c 24 Mar 2002 23:02:01 -0000 1.8 --- _TEmodule.c 23 Apr 2002 22:42:57 -0000 1.9 *************** *** 101,105 **** { TEDispose(self->ob_itself); ! PyMem_DEL(self); } --- 101,105 ---- { TEDispose(self->ob_itself); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:43:16 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:43:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/res _Resmodule.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv18906/Python/Mac/Modules/res Modified Files: _Resmodule.c Log Message: Regenerated. Index: _Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Resmodule.c 22 Mar 2002 14:16:39 -0000 1.11 --- _Resmodule.c 23 Apr 2002 22:43:14 -0000 1.12 *************** *** 99,103 **** } self->ob_itself = NULL; ! PyMem_DEL(self); } --- 99,103 ---- } self->ob_itself = NULL; ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:43:08 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:43:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/snd _Sndmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv18836/Python/Mac/Modules/snd Modified Files: _Sndmodule.c Log Message: Regenerated. Index: _Sndmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/_Sndmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _Sndmodule.c 5 Feb 2002 22:34:35 -0000 1.7 --- _Sndmodule.c 23 Apr 2002 22:43:06 -0000 1.8 *************** *** 91,95 **** SndDisposeChannel(self->ob_itself, 1); Py_XDECREF(self->ob_callback); ! PyMem_DEL(self); } --- 91,95 ---- SndDisposeChannel(self->ob_itself, 1); Py_XDECREF(self->ob_callback); ! PyObject_Del(self); } *************** *** 385,389 **** Py_XDECREF(self->ob_completion); Py_XDECREF(self->ob_interrupt); ! PyMem_DEL(self); } --- 385,389 ---- Py_XDECREF(self->ob_completion); Py_XDECREF(self->ob_interrupt); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:43:39 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:43:39 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen scantools.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv19111/Python/Tools/bgen/bgen Modified Files: scantools.py Log Message: Converted to use re in stead of regex and regsub (finally:-). Index: scantools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** scantools.py 12 Apr 2002 13:21:49 -0000 1.26 --- scantools.py 23 Apr 2002 22:43:37 -0000 1.27 *************** *** 15,20 **** """ ! import regex ! import regsub import string import sys --- 15,19 ---- """ ! import re import string import sys *************** *** 34,38 **** # Set to 1 in subclass to debug your scanner patterns. ! debug = 0 def __init__(self, input = None, output = None, defsoutput = None): --- 33,37 ---- # Set to 1 in subclass to debug your scanner patterns. ! debug = 0 def __init__(self, input = None, output = None, defsoutput = None): *************** *** 241,259 **** def initpatterns(self): ! self.head_pat = "^EXTERN_API[^_]" ! self.tail_pat = "[;={}]" ! self.type_pat = "EXTERN_API" + \ ! "[ \t\n]*([ \t\n]*" + \ ! "\([a-zA-Z0-9_* \t]*[a-zA-Z0-9_*]\)" + \ ! "[ \t\n]*)[ \t\n]*" ! self.name_pat = "\([a-zA-Z0-9_]+\)[ \t\n]*" ! self.args_pat = "(\(\([^(;=)]+\|([^(;=)]*)\)*\))" self.whole_pat = self.type_pat + self.name_pat + self.args_pat ! self.sym_pat = "^[ \t]*\([a-zA-Z0-9_]+\)[ \t]*=" + \ ! "[ \t]*\([-0-9_a-zA-Z'\"(][^\t\n,;}]*\),?" ! self.asplit_pat = "^\(.*[^a-zA-Z0-9_]\)\([a-zA-Z0-9_]+\)\(\[\]\)?$" ! self.comment1_pat = "\(.*\)//.*" # note that the next pattern only removes comments that are wholly within one line ! self.comment2_pat = "\(.*\)/\*.*\*/\(.*\)" def compilepatterns(self): --- 240,258 ---- def initpatterns(self): ! self.head_pat = r"^EXTERN_API[^_]" ! self.tail_pat = r"[;={}]" ! self.type_pat = r"EXTERN_API" + \ ! r"[ \t\n]*\([ \t\n]*" + \ ! r"(?P[a-zA-Z0-9_* \t]*[a-zA-Z0-9_*])" + \ ! r"[ \t\n]*\)[ \t\n]*" ! self.name_pat = r"(?P[a-zA-Z0-9_]+)[ \t\n]*" ! self.args_pat = r"\((?P([^\(;=\)]+|\([^\(;=\)]*\))*)\)" self.whole_pat = self.type_pat + self.name_pat + self.args_pat ! self.sym_pat = r"^[ \t]*(?P[a-zA-Z0-9_]+)[ \t]*=" + \ ! r"[ \t]*(?P[-0-9_a-zA-Z'\"\(][^\t\n,;}]*),?" ! self.asplit_pat = r"^(?P.*[^a-zA-Z0-9_])(?P[a-zA-Z0-9_]+)(?P\[\])?$" ! self.comment1_pat = r"(?P.*)//.*" # note that the next pattern only removes comments that are wholly within one line ! self.comment2_pat = r"(?P.*)/\*.*\*/(?P.*)" def compilepatterns(self): *************** *** 261,265 **** if name[-4:] == "_pat": pat = getattr(self, name) ! prog = regex.symcomp(pat) setattr(self, name[:-4], prog) --- 260,264 ---- if name[-4:] == "_pat": pat = getattr(self, name) ! prog = re.compile(pat) setattr(self, name[:-4], prog) *************** *** 405,422 **** if self.debug: self.report("LINE: %s" % `line`) ! if self.comment1.match(line) >= 0: ! line = self.comment1.group('rest') if self.debug: self.report("\tafter comment1: %s" % `line`) ! while self.comment2.match(line) >= 0: ! line = self.comment2.group('rest1')+self.comment2.group('rest2') if self.debug: self.report("\tafter comment2: %s" % `line`) ! if self.defsfile and self.sym.match(line) >= 0: ! if self.debug: ! self.report("\tmatches sym.") ! self.dosymdef() ! continue ! if self.head.match(line) >= 0: if self.debug: self.report("\tmatches head.") --- 404,427 ---- if self.debug: self.report("LINE: %s" % `line`) ! match = self.comment1.match(line) ! if match: ! line = match.group('rest') if self.debug: self.report("\tafter comment1: %s" % `line`) ! match = self.comment2.match(line) ! while match: ! line = match.group('rest1')+match.group('rest2') if self.debug: self.report("\tafter comment2: %s" % `line`) ! match = self.comment2.match(line) ! if self.defsfile: ! match = self.sym.match(line) ! if match: ! if self.debug: ! self.report("\tmatches sym.") ! self.dosymdef(match) ! continue ! match = self.head.match(line) ! if match: if self.debug: self.report("\tmatches head.") *************** *** 427,432 **** self.reportusedtypes() ! def dosymdef(self): ! name, defn = self.sym.group('name', 'defn') if self.debug: self.report("\tsym: name=%s, defn=%s" % (`name`, `defn`)) --- 432,437 ---- self.reportusedtypes() ! def dosymdef(self, match): ! name, defn = match.group('name', 'defn') if self.debug: self.report("\tsym: name=%s, defn=%s" % (`name`, `defn`)) *************** *** 439,454 **** def dofuncspec(self): raw = self.line ! while self.tail.search(raw) < 0: line = self.getline() if self.debug: self.report("* CONTINUATION LINE: %s" % `line`) ! if self.comment1.match(line) >= 0: ! line = self.comment1.group('rest') if self.debug: self.report("\tafter comment1: %s" % `line`) ! while self.comment2.match(line) >= 0: ! line = self.comment2.group('rest1')+self.comment2.group('rest2') if self.debug: self.report("\tafter comment1: %s" % `line`) raw = raw + line if self.debug: --- 444,462 ---- def dofuncspec(self): raw = self.line ! while not self.tail.search(raw): line = self.getline() if self.debug: self.report("* CONTINUATION LINE: %s" % `line`) ! match = self.comment1.match(line) ! if match: ! line = match.group('rest') if self.debug: self.report("\tafter comment1: %s" % `line`) ! match = self.comment2.match(line) ! while match: ! line = match.group('rest1')+match.group('rest2') if self.debug: self.report("\tafter comment1: %s" % `line`) + match = self.comment2.match(line) raw = raw + line if self.debug: *************** *** 457,471 **** def processrawspec(self, raw): ! if self.whole.search(raw) < 0: self.report("Bad raw spec: %s", `raw`) if self.debug: ! if self.type.search(raw) < 0: self.report("(Type already doesn't match)") else: ! self.report("(Type matched: %s)" % `self.type.group('type')`) return ! type, name, args = self.whole.group('type', 'name', 'args') ! type = regsub.gsub("\*", " ptr", type) ! type = regsub.gsub("[ \t]+", "_", type) if name in self.alreadydone: self.report("Name has already been defined: %s", `name`) --- 465,480 ---- def processrawspec(self, raw): ! match = self.whole.search(raw) ! if not match: self.report("Bad raw spec: %s", `raw`) if self.debug: ! if not self.type.search(raw): self.report("(Type already doesn't match)") else: ! self.report("(but type matched)") return ! type, name, args = match.group('type', 'name', 'args') ! type = re.sub("\*", " ptr", type) ! type = re.sub("[ \t]+", "_", type) if name in self.alreadydone: self.report("Name has already been defined: %s", `name`) *************** *** 501,514 **** def extractarg(self, part): mode = "InMode" ! if self.asplit.match(part) < 0: self.error("Indecipherable argument: %s", `part`) return ("unknown", part, mode) ! type, name, array = self.asplit.group('type', 'name', 'array') if array: # array matches an optional [] after the argument name type = type + " ptr " ! type = regsub.gsub("\*", " ptr ", type) type = string.strip(type) ! type = regsub.gsub("[ \t]+", "_", type) return self.modifyarg(type, name, mode) --- 510,525 ---- def extractarg(self, part): mode = "InMode" ! part = part.strip() ! match = self.asplit.match(part) ! if not match: self.error("Indecipherable argument: %s", `part`) return ("unknown", part, mode) ! type, name, array = match.group('type', 'name', 'array') if array: # array matches an optional [] after the argument name type = type + " ptr " ! type = re.sub("\*", " ptr ", type) type = string.strip(type) ! type = re.sub("[ \t]+", "_", type) return self.modifyarg(type, name, mode) *************** *** 611,618 **** Scanner.initpatterns(self) self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific! ! self.type_pat = "pascal[ \t\n]+\([a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+" self.whole_pat = self.type_pat + self.name_pat + self.args_pat ! self.sym_pat = "^[ \t]*\([a-zA-Z0-9_]+\)[ \t]*=" + \ ! "[ \t]*\([-0-9'\"][^\t\n,;}]*\),?" class Scanner_OSX(Scanner): --- 622,629 ---- Scanner.initpatterns(self) self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific! ! self.type_pat = "pascal[ \t\n]+(?P[a-zA-Z0-9_ \t]*[a-zA-Z0-9_])[ \t\n]+" self.whole_pat = self.type_pat + self.name_pat + self.args_pat ! self.sym_pat = "^[ \t]*(?P[a-zA-Z0-9_]+)[ \t]*=" + \ ! "[ \t]*(?P[-0-9'\"][^\t\n,;}]*),?" class Scanner_OSX(Scanner): *************** *** 620,631 **** def initpatterns(self): Scanner.initpatterns(self) ! self.head_pat = "^EXTERN_API\(_C\)?" ! self.type_pat = "EXTERN_API\(_C\)?" + \ ! "[ \t\n]*([ \t\n]*" + \ ! "\([a-zA-Z0-9_* \t]*[a-zA-Z0-9_*]\)" + \ ! "[ \t\n]*)[ \t\n]*" self.whole_pat = self.type_pat + self.name_pat + self.args_pat ! self.sym_pat = "^[ \t]*\([a-zA-Z0-9_]+\)[ \t]*=" + \ ! "[ \t]*\([-0-9_a-zA-Z'\"(][^\t\n,;}]*\),?" def test(): --- 631,642 ---- def initpatterns(self): Scanner.initpatterns(self) ! self.head_pat = "^EXTERN_API(_C)?" ! self.type_pat = "EXTERN_API(_C)?" + \ ! "[ \t\n]*\([ \t\n]*" + \ ! "(?P[a-zA-Z0-9_* \t]*[a-zA-Z0-9_*])" + \ ! "[ \t\n]*\)[ \t\n]*" self.whole_pat = self.type_pat + self.name_pat + self.args_pat ! self.sym_pat = "^[ \t]*(?P[a-zA-Z0-9_]+)[ \t]*=" + \ ! "[ \t]*(?P[-0-9_a-zA-Z'\"\(][^\t\n,;}]*),?" def test(): From jackjansen@sourceforge.net Tue Apr 23 23:43:46 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:43:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qt _Qtmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv19025/Python/Mac/Modules/qt Modified Files: _Qtmodule.c Log Message: Regenerated. Index: _Qtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/_Qtmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _Qtmodule.c 24 Mar 2002 23:02:37 -0000 1.7 --- _Qtmodule.c 23 Apr 2002 22:43:44 -0000 1.8 *************** *** 131,135 **** { DisposeMovieController(self->ob_itself); ! PyMem_DEL(self); } --- 131,135 ---- { DisposeMovieController(self->ob_itself); ! PyObject_Del(self); } *************** *** 1165,1169 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 1165,1169 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 1616,1620 **** { DisposeUserData(self->ob_itself); ! PyMem_DEL(self); } --- 1616,1620 ---- { DisposeUserData(self->ob_itself); ! PyObject_Del(self); } *************** *** 1920,1924 **** { DisposeTrackMedia(self->ob_itself); ! PyMem_DEL(self); } --- 1920,1924 ---- { DisposeTrackMedia(self->ob_itself); ! PyObject_Del(self); } *************** *** 3095,3099 **** { DisposeMovieTrack(self->ob_itself); ! PyMem_DEL(self); } --- 3095,3099 ---- { DisposeMovieTrack(self->ob_itself); ! PyObject_Del(self); } *************** *** 4376,4380 **** { DisposeMovie(self->ob_itself); ! PyMem_DEL(self); } --- 4376,4380 ---- { DisposeMovie(self->ob_itself); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:43:52 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:43:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qdoffs _Qdoffsmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv19218/Python/Mac/Modules/qdoffs Modified Files: _Qdoffsmodule.c Log Message: Regenerated. Index: _Qdoffsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/_Qdoffsmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _Qdoffsmodule.c 24 Mar 2002 23:02:42 -0000 1.7 --- _Qdoffsmodule.c 23 Apr 2002 22:43:50 -0000 1.8 *************** *** 74,78 **** { DisposeGWorld(self->ob_itself); ! PyMem_DEL(self); } --- 74,78 ---- { DisposeGWorld(self->ob_itself); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:44:17 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:44:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv19362/Python/Mac/Modules/mlte Modified Files: _Mltemodule.c Log Message: Regenerated. Index: _Mltemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Mltemodule.c 1 Jan 2002 22:42:19 -0000 1.9 --- _Mltemodule.c 23 Apr 2002 22:44:15 -0000 1.10 *************** *** 126,130 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 126,130 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 1367,1371 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 1367,1371 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:44:57 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:44:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag _Dragmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv19554/Python/Mac/Modules/drag Modified Files: _Dragmodule.c Log Message: Regenerated. Index: _Dragmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/_Dragmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Dragmodule.c 24 Mar 2002 23:03:41 -0000 1.8 --- _Dragmodule.c 23 Apr 2002 22:44:55 -0000 1.9 *************** *** 85,89 **** { Py_XDECREF(self->sendproc); ! PyMem_DEL(self); } --- 85,89 ---- { Py_XDECREF(self->sendproc); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:45:22 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:22 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv19654/Python/Mac/Modules/ctl Modified Files: _Ctlmodule.c Log Message: Regenerated. Index: _Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _Ctlmodule.c 4 Jan 2002 19:45:15 -0000 1.16 --- _Ctlmodule.c 23 Apr 2002 22:45:20 -0000 1.17 *************** *** 184,188 **** Py_XDECREF(self->ob_callbackdict); if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */ ! PyMem_DEL(self); } --- 184,188 ---- Py_XDECREF(self->ob_callbackdict); if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */ ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:44:28 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:44:28 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu _Menumodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv19413/Python/Mac/Modules/menu Modified Files: _Menumodule.c Log Message: Regenerated. Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Menumodule.c 3 Jan 2002 12:16:18 -0000 1.10 --- _Menumodule.c 23 Apr 2002 22:44:26 -0000 1.11 *************** *** 109,113 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 109,113 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:44:10 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:44:10 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd _Qdmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv19261/Python/Mac/Modules/qd Modified Files: _Qdmodule.c Log Message: Regenerated. Index: _Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/_Qdmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Qdmodule.c 24 Mar 2002 23:03:00 -0000 1.8 --- _Qdmodule.c 23 Apr 2002 22:44:08 -0000 1.9 *************** *** 203,207 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 203,207 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 434,438 **** Py_XDECREF(self->referred_object); if (self->referred_bitmap) free(self->referred_bitmap); ! PyMem_DEL(self); } --- 434,438 ---- Py_XDECREF(self->referred_object); if (self->referred_bitmap) free(self->referred_bitmap); ! PyObject_Del(self); } *************** *** 546,550 **** static void QDGA_dealloc(QDGlobalsAccessObject *self) { ! PyMem_DEL(self); } --- 546,550 ---- static void QDGA_dealloc(QDGlobalsAccessObject *self) { ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:44:34 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:44:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/list _Listmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv19462/Python/Mac/Modules/list Modified Files: _Listmodule.c Log Message: Regenerated. Index: _Listmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/_Listmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Listmodule.c 18 Dec 2001 15:37:25 -0000 1.9 --- _Listmodule.c 23 Apr 2002 22:44:32 -0000 1.10 *************** *** 151,155 **** SetListRefCon(self->ob_itself, (long)0); if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); ! PyMem_DEL(self); } --- 151,155 ---- SetListRefCon(self->ob_itself, (long)0); if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:45:05 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/dlg _Dlgmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv19596/Python/Mac/Modules/dlg Modified Files: _Dlgmodule.c Log Message: Regenerated. Index: _Dlgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/_Dlgmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Dlgmodule.c 18 Dec 2001 15:38:00 -0000 1.9 --- _Dlgmodule.c 23 Apr 2002 22:45:03 -0000 1.10 *************** *** 180,184 **** { DisposeDialog(self->ob_itself); ! PyMem_DEL(self); } --- 180,184 ---- { DisposeDialog(self->ob_itself); ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:45:27 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cm _Cmmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv19787/Python/Mac/Modules/cm Modified Files: _Cmmodule.c Log Message: Regenerated. Index: _Cmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/_Cmmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Cmmodule.c 24 Mar 2002 23:04:08 -0000 1.8 --- _Cmmodule.c 23 Apr 2002 22:45:25 -0000 1.9 *************** *** 103,107 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 103,107 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } *************** *** 385,389 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 385,389 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:45:35 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg _CGmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory usw-pr-cvs1:/tmp/cvs-serv19824/Python/Mac/Modules/cg Modified Files: _CGmodule.c Log Message: Regenerated. Index: _CGmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/_CGmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _CGmodule.c 4 Mar 2002 10:31:32 -0000 1.5 --- _CGmodule.c 23 Apr 2002 22:45:33 -0000 1.6 *************** *** 242,246 **** { CGContextRelease(self->ob_itself); ! PyMem_DEL(self); } --- 242,246 ---- { CGContextRelease(self->ob_itself); ! PyObject_Del(self); } From bwarsaw@sourceforge.net Tue Apr 23 23:45:46 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:46 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.100,2.101 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19866 Modified Files: abstract.c Log Message: abstract_get_bases(): Clarify exactly what the return values and states can be for this function, and ensure that only AttributeErrors are masked. Any other exception raised via the equivalent of getattr(cls, '__bases__') should be propagated up. abstract_issubclass(): If abstract_get_bases() returns NULL, we must call PyErr_Occurred() to see if an exception is being propagated, and return -1 or 0 as appropriate. This is the specific fix for a problem whereby if getattr(derived, '__bases__') raised an exception, an "undetected error" would occur (under a debug build). This nasty situation was uncovered when writing a security proxy extension type for the Zope3 project, where the security proxy raised a Forbidden exception on getattr of __bases__. PyObject_IsInstance(), PyObject_IsSubclass(): After both calls to abstract_get_bases(), where we're setting the TypeError if the return value is NULL, we must first check to see if an exception occurred, and /not/ mask an existing exception. Neil Schemenauer should double check that these changes don't break his ExtensionClass examples (there aren't any test cases for those examples and abstract_get_bases() was added by him in response to problems with ExtensionClass). Neil, please add test cases if possible! I belive this is a bug fix candidate for Python 2.2.2. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.100 retrieving revision 2.101 diff -C2 -d -r2.100 -r2.101 *** abstract.c 16 Apr 2002 16:44:51 -0000 2.100 --- abstract.c 23 Apr 2002 22:45:44 -0000 2.101 *************** *** 1862,1865 **** --- 1862,1891 ---- /* isinstance(), issubclass() */ + /* abstract_get_bases() has logically 4 return states, with a sort of 0th + * state that will almost never happen. + * + * 0. creating the __bases__ static string could get a MemoryError + * 1. getattr(cls, '__bases__') could raise an AttributeError + * 2. getattr(cls, '__bases__') could raise some other exception + * 3. getattr(cls, '__bases__') could return a tuple + * 4. getattr(cls, '__bases__') could return something other than a tuple + * + * Only state #3 is a non-error state and only it returns a non-NULL object + * (it returns the retrieved tuple). + * + * Any raised AttributeErrors are masked by clearing the exception and + * returning NULL. If an object other than a tuple comes out of __bases__, + * then again, the return value is NULL. So yes, these two situations + * produce exactly the same results: NULL is returned and no error is set. + * + * If some exception other than AttributeError is raised, then NULL is also + * returned, but the exception is not cleared. That's because we want the + * exception to be propagated along. + * + * Callers are expected to test for PyErr_Occurred() when the return value + * is NULL to decide whether a valid exception should be propagated or not. + * When there's no exception to propagate, it's customary for the caller to + * set a TypeError. + */ static PyObject * abstract_get_bases(PyObject *cls) *************** *** 1873,1883 **** return NULL; } - bases = PyObject_GetAttr(cls, __bases__); ! if (bases == NULL || !PyTuple_Check(bases)) { ! Py_XDECREF(bases); return NULL; } - return bases; } --- 1899,1912 ---- return NULL; } bases = PyObject_GetAttr(cls, __bases__); ! if (bases == NULL) { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! return NULL; ! } ! if (!PyTuple_Check(bases)) { ! Py_DECREF(bases); return NULL; } return bases; } *************** *** 1896,1902 **** bases = abstract_get_bases(derived); ! if (bases == NULL) return 0; ! n = PyTuple_GET_SIZE(bases); for (i = 0; i < n; i++) { --- 1925,1933 ---- bases = abstract_get_bases(derived); ! if (bases == NULL) { ! if (PyErr_Occurred()) ! return -1; return 0; ! } n = PyTuple_GET_SIZE(bases); for (i = 0; i < n; i++) { *************** *** 1943,1947 **** PyObject *cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "isinstance() arg 2 must be a class or type"); return -1; --- 1974,1980 ---- PyObject *cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! /* Do not mask errors. */ ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "isinstance() arg 2 must be a class or type"); return -1; *************** *** 1978,1982 **** derived_bases = abstract_get_bases(derived); if (derived_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class"); return -1; --- 2011,2017 ---- derived_bases = abstract_get_bases(derived); if (derived_bases == NULL) { ! /* Do not mask errors */ ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class"); return -1; *************** *** 1986,1990 **** cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 2 must be a class"); return -1; --- 2021,2027 ---- cls_bases = abstract_get_bases(cls); if (cls_bases == NULL) { ! /* Do not mask errors */ ! if (!PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "issubclass() arg 2 must be a class"); return -1; From jackjansen@sourceforge.net Tue Apr 23 23:45:49 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv19850/Python/Mac/Modules/cf Modified Files: _CFmodule.c Log Message: Regenerated. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _CFmodule.c 18 Mar 2002 15:40:48 -0000 1.11 --- _CFmodule.c 23 Apr 2002 22:45:47 -0000 1.12 *************** *** 164,168 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 164,168 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 403,407 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 403,407 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 555,559 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 555,559 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 736,740 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 736,740 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 870,874 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 870,874 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 988,992 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 988,992 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 1140,1144 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 1140,1144 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 1359,1363 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 1359,1363 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 2027,2031 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 2027,2031 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } *************** *** 2356,2360 **** self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyMem_DEL(self); } --- 2356,2360 ---- self->ob_freeit((CFTypeRef)self->ob_itself); } ! PyObject_Del(self); } From jackjansen@sourceforge.net Tue Apr 23 23:45:56 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:45:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/app _Appmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv19907/Python/Mac/Modules/app Modified Files: _Appmodule.c Log Message: Regenerated. Index: _Appmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Appmodule.c 24 Mar 2002 23:01:51 -0000 1.10 --- _Appmodule.c 23 Apr 2002 22:45:54 -0000 1.11 *************** *** 70,74 **** { /* Cleanup of self->ob_itself goes here */ ! PyMem_DEL(self); } --- 70,74 ---- { /* Cleanup of self->ob_itself goes here */ ! PyObject_Del(self); } From bwarsaw@sourceforge.net Tue Apr 23 23:48:44 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Tue, 23 Apr 2002 15:48:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_isinstance.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20676 Added Files: test_isinstance.py Log Message: Unit tests for the changes in abstract.c version 2.101. The debug build's "undetected error" problems were originally detected with extension types, but we can whitebox test the same situations with new-style classes. --- NEW FILE: test_isinstance.py --- # Tests some corner cases with isinstance() and issubclass(). While these # tests use new style classes and properties, they actually do whitebox # testing of error conditions uncovered when using extension types. import unittest import test_support class TestIsInstanceWhitebox(unittest.TestCase): # Test to make sure that an AttributeError when accessing the instance's # class's bases is masked. This was actually a bug in Python 2.2 and # 2.2.1 where the exception wasn't caught but it also wasn't being cleared # (leading to an "undetected error" in the debug build). Set up is, # isinstance(inst, cls) where: # # - inst isn't an InstanceType # - cls isn't a ClassType, a TypeType, or a TupleType # - cls has a __bases__ attribute # - inst has a __class__ attribute # - inst.__class__ as no __bases__ attribute # # Sounds complicated, I know, but this mimics a situation where an # extension type raises an AttributeError when its __bases__ attribute is # gotten. In that case, isinstance() should return False. def test_class_has_no_bases(self): class I(object): def getclass(self): # This must return an object that has no __bases__ attribute return None __class__ = property(getclass) class C(object): def getbases(self): return () __bases__ = property(getbases) self.assertEqual(False, isinstance(I(), C())) # Like above except that inst.__class__.__bases__ raises an exception # other than AttributeError def test_bases_raises_other_than_attribute_error(self): class E(object): def getbases(self): raise RuntimeError __bases__ = property(getbases) class I(object): def getclass(self): return E() __class__ = property(getclass) class C(object): def getbases(self): return () __bases__ = property(getbases) self.assertRaises(RuntimeError, isinstance, I(), C()) # Here's a situation where getattr(cls, '__bases__') raises an exception. # If that exception is not AttributeError, it should not get masked def test_dont_mask_non_attribute_error(self): class I: pass class C(object): def getbases(self): raise RuntimeError __bases__ = property(getbases) self.assertRaises(RuntimeError, isinstance, I(), C()) # Like above, except that getattr(cls, '__bases__') raises an # AttributeError, which /should/ get masked as a TypeError def test_mask_attribute_error(self): class I: pass class C(object): def getbases(self): raise AttributeError __bases__ = property(getbases) self.assertRaises(TypeError, isinstance, I(), C()) # These tests are similar to above, but tickle certain code paths in # issubclass() instead of isinstance() -- really PyObject_IsSubclass() # vs. PyObject_IsInstance(). class TestIsSubclassWhitebox(unittest.TestCase): def test_dont_mask_non_attribute_error(self): class C(object): def getbases(self): raise RuntimeError __bases__ = property(getbases) class S(C): pass self.assertRaises(RuntimeError, issubclass, C(), S()) def test_mask_attribute_error(self): class C(object): def getbases(self): raise AttributeError __bases__ = property(getbases) class S(C): pass self.assertRaises(TypeError, issubclass, C(), S()) # Like above, but test the second branch, where the __bases__ of the # second arg (the cls arg) is tested. This means the first arg must # return a valid __bases__, and it's okay for it to be a normal -- # unrelated by inheritance -- class. def test_dont_mask_non_attribute_error_in_cls_arg(self): class B: pass class C(object): def getbases(self): raise RuntimeError __bases__ = property(getbases) self.assertRaises(RuntimeError, issubclass, B, C()) def test_mask_attribute_error_in_cls_arg(self): class B: pass class C(object): def getbases(self): raise AttributeError __bases__ = property(getbases) self.assertRaises(TypeError, issubclass, B, C()) def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestIsInstanceWhitebox)) suite.addTest(unittest.makeSuite(TestIsSubclassWhitebox)) test_support.run_suite(suite) if __name__ == '__main__': test_main() From jackjansen@sourceforge.net Tue Apr 23 23:46:03 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Tue, 23 Apr 2002 15:46:03 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ae _AEmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv19954/Python/Mac/Modules/ae Modified Files: _AEmodule.c Log Message: Regenerated. Index: _AEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/_AEmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _AEmodule.c 24 Mar 2002 23:04:18 -0000 1.10 --- _AEmodule.c 23 Apr 2002 22:46:01 -0000 1.11 *************** *** 90,94 **** { AEDisposeDesc(&self->ob_itself); ! PyMem_DEL(self); } --- 90,94 ---- { AEDisposeDesc(&self->ob_itself); ! PyObject_Del(self); } From tim_one@sourceforge.net Wed Apr 24 00:07:30 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 23 Apr 2002 16:07:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25035/python/Lib/test Modified Files: test_mmap.py Log Message: test_mmap started breaking on Windows, only when run after test_bsddb. On Win2K it thought 'foo' started at byte offset 0 instead of at the pagesize, and on Win98 it thought 'foo' didn't exist at all. Somehow or other this is related to the new "in memory file" gimmicks in bsddb, but the old bsddb we use on Windows sucks so bad anyway I don't want to bother digging deeper. Flushing the file in test_mmap after writing to it makes the problem go away, so good enough. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_mmap.py 18 Apr 2002 04:30:18 -0000 1.21 --- test_mmap.py 23 Apr 2002 23:07:28 -0000 1.22 *************** *** 18,22 **** f.write('foo') f.write('\0'* (PAGESIZE-3) ) ! m = mmap.mmap(f.fileno(), 2 * PAGESIZE) f.close() --- 18,22 ---- f.write('foo') f.write('\0'* (PAGESIZE-3) ) ! f.flush() m = mmap.mmap(f.fileno(), 2 * PAGESIZE) f.close() From tim_one@sourceforge.net Wed Apr 24 00:09:04 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Tue, 23 Apr 2002 16:09:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25986/python/Lib/test Modified Files: regrtest.py Log Message: test_resource has no chance of running on Windows. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** regrtest.py 21 Apr 2002 07:30:28 -0000 1.81 --- regrtest.py 23 Apr 2002 23:09:02 -0000 1.82 *************** *** 507,510 **** --- 507,511 ---- test_pty test_pwd + test_resource test_signal test_socket_ssl From Anthony Baxter Wed Apr 24 01:57:50 2002 From: Anthony Baxter (Anthony Baxter) Date: Wed, 24 Apr 2002 10:57:50 +1000 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.2,1.3 In-Reply-To: Message from Guido van Rossum of "Tue, 23 Apr 2002 17:20:56 -0400." <200204232120.g3NLKuZ13340@odiug.zope.com> Message-ID: <200204240057.g3O0voL07848@localhost.localdomain> >>> Guido van Rossum wrote > > Second part of fix for #493826: regenerated suite modules so errn exists bu t == 0 doesn't signal an error. > > > > Bugfix candidate. > > Since this all appears to be generated code, maybe it would be easier > if you backported this yourself by running the generator with the > previous version(s?), rather than letting Anthony struggle with the > patches? I was just about to post something about this - I have no way of testing that I've backported it correctly, either... :/ -- Anthony Baxter It's never too late to have a happy childhood. From nascheme@sourceforge.net Wed Apr 24 04:33:04 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Tue, 23 Apr 2002 20:33:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_isinstance.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14984/Lib/test Modified Files: test_isinstance.py Log Message: Add more tests for abstract isinstance() and issubclass(). Index: test_isinstance.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_isinstance.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_isinstance.py 23 Apr 2002 22:48:42 -0000 1.1 --- test_isinstance.py 24 Apr 2002 03:33:02 -0000 1.2 *************** *** 8,12 **** ! class TestIsInstanceWhitebox(unittest.TestCase): # Test to make sure that an AttributeError when accessing the instance's # class's bases is masked. This was actually a bug in Python 2.2 and --- 8,12 ---- ! class TestIsInstanceExceptions(unittest.TestCase): # Test to make sure that an AttributeError when accessing the instance's # class's bases is masked. This was actually a bug in Python 2.2 and *************** *** 87,91 **** # issubclass() instead of isinstance() -- really PyObject_IsSubclass() # vs. PyObject_IsInstance(). ! class TestIsSubclassWhitebox(unittest.TestCase): def test_dont_mask_non_attribute_error(self): class C(object): --- 87,91 ---- # issubclass() instead of isinstance() -- really PyObject_IsSubclass() # vs. PyObject_IsInstance(). ! class TestIsSubclassExceptions(unittest.TestCase): def test_dont_mask_non_attribute_error(self): class C(object): *************** *** 134,141 **** def test_main(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestIsInstanceWhitebox)) ! suite.addTest(unittest.makeSuite(TestIsSubclassWhitebox)) test_support.run_suite(suite) --- 134,230 ---- + # meta classes for creating abstract classes and instances + class AbstractClass(object): + def __init__(self, bases): + self.bases = bases + + def getbases(self): + return self.bases + __bases__ = property(getbases) + + def __call__(self): + return AbstractInstance(self) + + class AbstractInstance(object): + def __init__(self, klass): + self.klass = klass + + def getclass(self): + return self.klass + __class__ = property(getclass) + + # abstract classes + AbstractSuper = AbstractClass(bases=()) + + AbstractChild = AbstractClass(bases=(AbstractSuper,)) + + # normal classes + class Super: + pass + + class Child(Super): + pass + + + + class TestIsInstanceIsSubclass(unittest.TestCase): + # Tests to ensure that isinstance and issubclass work on abstract + # classes and instances. Before the 2.2 release, TypeErrors were + # raised when boolean values should have been returned. The bug was + # triggered by mixing 'normal' classes and instances were with + # 'abstract' classes and instances. This case tries to test all + # combinations. + + def test_isinstance_normal(self): + # normal instances + self.assertEqual(True, isinstance(Super(), Super)) + self.assertEqual(False, isinstance(Super(), Child)) + self.assertEqual(False, isinstance(Super(), AbstractSuper)) + self.assertEqual(False, isinstance(Super(), AbstractChild)) + + self.assertEqual(True, isinstance(Child(), Super)) + self.assertEqual(False, isinstance(Child(), AbstractSuper)) + + def test_isinstance_abstract(self): + # abstract instances + self.assertEqual(True, isinstance(AbstractSuper(), AbstractSuper)) + self.assertEqual(False, isinstance(AbstractSuper(), AbstractChild)) + self.assertEqual(False, isinstance(AbstractSuper(), Super)) + self.assertEqual(False, isinstance(AbstractSuper(), Child)) + + self.assertEqual(True, isinstance(AbstractChild(), AbstractChild)) + self.assertEqual(True, isinstance(AbstractChild(), AbstractSuper)) + self.assertEqual(False, isinstance(AbstractChild(), Super)) + self.assertEqual(False, isinstance(AbstractChild(), Child)) + + def test_subclass_normal(self): + # normal classes + self.assertEqual(True, issubclass(Super, Super)) + self.assertEqual(False, issubclass(Super, AbstractSuper)) + self.assertEqual(False, issubclass(Super, Child)) + + self.assertEqual(True, issubclass(Child, Child)) + self.assertEqual(True, issubclass(Child, Super)) + self.assertEqual(False, issubclass(Child, AbstractSuper)) + + def test_subclass_abstract(self): + # abstract classes + self.assertEqual(True, issubclass(AbstractSuper, AbstractSuper)) + self.assertEqual(False, issubclass(AbstractSuper, AbstractChild)) + self.assertEqual(False, issubclass(AbstractSuper, Child)) + + self.assertEqual(True, issubclass(AbstractChild, AbstractChild)) + self.assertEqual(True, issubclass(AbstractChild, AbstractSuper)) + self.assertEqual(False, issubclass(AbstractChild, Super)) + self.assertEqual(False, issubclass(AbstractChild, Child)) + + + + def test_main(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestIsInstanceExceptions)) ! suite.addTest(unittest.makeSuite(TestIsSubclassExceptions)) ! suite.addTest(unittest.makeSuite(TestIsInstanceIsSubclass)) test_support.run_suite(suite) From nas@python.ca Wed Apr 24 04:38:54 2002 From: nas@python.ca (Neil Schemenauer) Date: Tue, 23 Apr 2002 20:38:54 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.100,2.101 In-Reply-To: ; from bwarsaw@sourceforge.net on Tue, Apr 23, 2002 at 03:45:46PM -0700 References: Message-ID: <20020423203854.A28240@glacier.arctrix.com> bwarsaw@sourceforge.net wrote: > Neil Schemenauer should double check that these changes don't break > his ExtensionClass examples No breakage. > Neil, please add test cases if possible! Well, it was possible so it's done. :-) Neil From barry@zope.com Wed Apr 24 04:45:29 2002 From: barry@zope.com (Barry A. Warsaw) Date: Tue, 23 Apr 2002 23:45:29 -0400 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.100,2.101 References: <20020423203854.A28240@glacier.arctrix.com> Message-ID: <15558.10841.216313.11006@anthem.wooz.org> >>>>> "NS" == Neil Schemenauer writes: >> Neil Schemenauer should double check that these changes don't >> break his ExtensionClass examples NS> No breakage. Phew! >> Neil, please add test cases if possible! NS> Well, it was possible so it's done. :-) Thanks! -Barry From theller@sourceforge.net Wed Apr 24 07:35:13 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Tue, 23 Apr 2002 23:35:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv30336 Modified Files: newtypes.tex Log Message: Fix a small mistake and complete some function prototypes. SF Patch #547813. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** newtypes.tex 17 Apr 2002 13:44:58 -0000 1.11 --- newtypes.tex 24 Apr 2002 06:35:11 -0000 1.12 *************** *** 227,231 **** \begin{datadesc}{METH_VARARGS} This is the typical calling convention, where the methods have the ! type \ctype{PyMethodDef}. The function expects two \ctype{PyObject*} values. The first one is the \var{self} object for methods; for module functions, it has the value given to --- 227,231 ---- \begin{datadesc}{METH_VARARGS} This is the typical calling convention, where the methods have the ! type \ctype{PyCFunction}. The function expects two \ctype{PyObject*} values. The first one is the \var{self} object for methods; for module functions, it has the value given to *************** *** 1152,1156 **** \begin{verbatim} ! tp_init(PyObject *self, PyObject *args, PyObject *kwds) \end{verbatim} --- 1152,1156 ---- \begin{verbatim} ! int tp_init(PyObject *self, PyObject *args, PyObject *kwds) \end{verbatim} *************** *** 1180,1184 **** \begin{verbatim} ! tp_alloc(PyTypeObject *self, int nitems) \end{verbatim} --- 1180,1184 ---- \begin{verbatim} ! PyObject *tp_alloc(PyTypeObject *self, int nitems) \end{verbatim} *************** *** 1216,1220 **** \begin{verbatim} ! tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) \end{verbatim} --- 1216,1220 ---- \begin{verbatim} ! PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) \end{verbatim} From Jack.Jansen@cwi.nl Wed Apr 24 09:31:33 2002 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 24 Apr 2002 10:31:33 +0200 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.2,1.3 In-Reply-To: <200204232120.g3NLKuZ13340@odiug.zope.com> Message-ID: On Tuesday, April 23, 2002, at 11:20 , Guido van Rossum wrote: >> Second part of fix for #493826: regenerated suite modules so errn >> exists but == 0 doesn't signal an error. >> >> Bugfix candidate. > > Since this all appears to be generated code, maybe it would be easier > if you backported this yourself by running the generator with the > previous version(s?), rather than letting Anthony struggle with the > patches? I was definitely planning to backport it myself, that's what I've always done for the Mac subtree. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From jackjansen@sourceforge.net Wed Apr 24 10:13:26 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:13:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Terminal Terminal_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Terminal In directory usw-pr-cvs1:/tmp/cvs-serv17391 Modified Files: Terminal_Suite.py Log Message: Regenerated. Bugfix candidate. Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Terminal_Suite.py 30 Mar 2002 23:46:16 -0000 1.1 --- Terminal_Suite.py 24 Apr 2002 09:13:24 -0000 1.2 *************** *** 26,30 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 26,30 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 45,49 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 45,49 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 66,70 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 66,70 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 90,94 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 90,94 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result From jackjansen@sourceforge.net Wed Apr 24 10:21:50 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:21:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/_builtinSuites __init__.py,NONE,1.1.2.1 builtin_Suite.py,NONE,1.2.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/_builtinSuites In directory usw-pr-cvs1:/tmp/cvs-serv19565/_builtinSuites Added Files: Tag: release22-maint __init__.py builtin_Suite.py Log Message: Backport of trunk fix: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. This also picked up a few other changes, but they should be harmless. --- NEW FILE: __init__.py --- """ Manually generated suite used as base class for StdSuites Required and Standard suites. This is needed because the events and enums in this suite belong in the Required suite according to the Apple docs, but they often seem to be in the Standard suite. """ import aetools import builtin_Suite _code_to_module = { 'reqd' : builtin_Suite, 'core' : builtin_Suite, } _code_to_fullname = { 'reqd' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), 'core' : ('_builtinSuites.builtin_Suite', 'builtin_Suite'), } from builtin_Suite import * class _builtinSuites(builtin_Suite_Events, aetools.TalkTo): _signature = 'ascr' --- NEW FILE: builtin_Suite.py --- """Suite builtin_Suite: Every application supports open, reopen, print, run, and quit Level 1, version 1 """ import aetools import MacOS _code = 'aevt' class builtin_Suite_Events: def open(self, _object, _attributes={}, **_arguments): """open: Open the specified object(s) Required argument: list of objects to open Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'odoc' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def run(self, _no_object=None, _attributes={}, **_arguments): """run: Run an application. Most applications will open an empty, untitled window. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'oapp' if _arguments: raise TypeError, 'No optional args expected' if _no_object != None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def reopen(self, _no_object=None, _attributes={}, **_arguments): """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'rapp' if _arguments: raise TypeError, 'No optional args expected' if _no_object != None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def _print(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'pdoc' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_quit = { 'saving' : 'savo', } def quit(self, _no_object=None, _attributes={}, **_arguments): """quit: Quit an application Keyword argument saving: specifies whether to save currently open documents Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'quit' aetools.keysubst(_arguments, self._argmap_quit) if _no_object != None: raise TypeError, 'No direct arg expected' aetools.enumsubst(_arguments, 'savo', _Enum_savo) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_close = { 'saving' : 'savo', 'saving_in' : 'kfil', } _Enum_savo = { 'yes' : 'yes ', # Save objects now 'no' : 'no ', # Do not save objects 'ask' : 'ask ', # Ask the user whether to save } # # Indices of types declared in this module # _classdeclarations = { } _propdeclarations = { } _compdeclarations = { } _enumdeclarations = { 'savo' : _Enum_savo, } From jackjansen@sourceforge.net Wed Apr 24 10:21:49 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:21:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.2,1.2.20.1 Metrowerks_Shell_Suite.py,1.2,1.2.20.1 Required.py,1.2,1.2.20.1 Standard_Suite.py,1.3,1.3.8.1 __init__.py,1.2,1.2.20.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior In directory usw-pr-cvs1:/tmp/cvs-serv19565/CodeWarrior Modified Files: Tag: release22-maint CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Backport of trunk fix: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. This also picked up a few other changes, but they should be harmless. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** CodeWarrior_suite.py 17 May 2001 12:40:59 -0000 1.2 --- CodeWarrior_suite.py 24 Apr 2002 09:21:46 -0000 1.2.20.1 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:SWdev:CodeWarrior 6 MPTP:Metrowerks CodeWarrior:CodeWarrior IDE 4.1B9 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 38,42 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 38,42 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 62,66 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 62,66 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 81,85 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 81,85 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 101,105 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 101,105 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 121,125 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 121,125 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 141,145 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 141,145 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 160,164 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 160,164 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 180,184 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 180,184 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 199,203 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 199,203 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 218,222 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 218,222 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 238,242 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 238,242 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 258,262 **** """catalog document - a browser catalog document """ want = 'CTLG' - # repeated property inherits all properties and elements of the given class are inherited by this class. catalog_documents = catalog_document --- 258,261 ---- *************** *** 265,269 **** """class browser - a class browser """ want = 'BROW' - # repeated property inherits all properties and elements of the given class are inherited by this class. class_browsers = class_browser --- 264,267 ---- *************** *** 272,276 **** """class hierarchy - a class hierarchy document """ want = 'HIER' - # repeated property inherits all properties and elements of the given class are inherited by this class. class_hierarchies = class_hierarchy --- 270,273 ---- *************** *** 279,283 **** """editor document - an editor document """ want = 'EDIT' - # repeated property inherits all properties and elements of the given class are inherited by this class. editor_documents = editor_document --- 276,279 ---- *************** *** 286,290 **** """file compare document - a file compare document """ want = 'COMP' - # repeated property inherits all properties and elements of the given class are inherited by this class. file_compare_documents = file_compare_document --- 282,285 ---- *************** *** 293,297 **** """message document - a message document """ want = 'MSSG' - # repeated property inherits all properties and elements of the given class are inherited by this class. message_documents = message_document --- 288,291 ---- *************** *** 300,304 **** """project document - a project document """ want = 'PRJD' - # repeated property inherits all properties and elements of the given class are inherited by this class. class current_target(aetools.NProperty): """current target - the current target """ --- 294,297 ---- *************** *** 312,316 **** """project inspector - the project inspector """ want = 'INSP' - # repeated property inherits all properties and elements of the given class are inherited by this class. project_inspectors = project_inspector --- 305,308 ---- *************** *** 319,323 **** """single class browser - a single class browser """ want = '1BRW' - # repeated property inherits all properties and elements of the given class are inherited by this class. single_class_browsers = single_class_browser --- 311,314 ---- *************** *** 326,330 **** """single class hierarchy - a single class hierarchy document """ want = '1HIR' - # repeated property inherits all properties and elements of the given class are inherited by this class. single_class_hierarchies = single_class_hierarchy --- 317,320 ---- *************** *** 333,337 **** """subtarget - a target that is prerequisite for another target """ want = 'SBTG' - # repeated property inherits all properties and elements of the given class are inherited by this class. class target(aetools.NProperty): """target - the target that is dependent on this subtarget """ --- 323,326 ---- *************** *** 348,352 **** """symbol browser - a symbol browser """ want = 'SYMB' - # repeated property inherits all properties and elements of the given class are inherited by this class. symbol_browsers = symbol_browser --- 337,340 ---- *************** *** 359,366 **** which = 'pnam' want = 'itxt' - class index(aetools.NProperty): - """index - the number of the target """ - which = 'pidx' - want = 'long' class project_document(aetools.NProperty): """project document - the project document that contains this target """ --- 347,350 ---- *************** *** 383,387 **** which = 'FTYP' want = 'FTYP' - # repeated property index the number of the target file class location(aetools.NProperty): """location - the location of the target file on disk """ --- 367,370 ---- *************** *** 446,450 **** """text document - a document that contains text """ want = 'TXTD' - # repeated property inherits all properties and elements of the given class are inherited by this class. class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ --- 429,432 ---- *************** *** 465,469 **** """ToolServer worksheet - a ToolServer worksheet """ want = 'TOOL' - # repeated property inherits all properties and elements of the given class are inherited by this class. ToolServer_worksheets = ToolServer_worksheet --- 447,450 ---- *************** *** 539,543 **** target._propdict = { 'name' : name, - 'index' : index, 'project_document' : project_document, } --- 520,523 ---- *************** *** 549,553 **** 'id' : id, 'type' : type, - 'index' : index, 'location' : location, 'path' : path, --- 529,532 ---- *************** *** 630,678 **** # _classdeclarations = { - 'TOOL' : ToolServer_worksheet, - '1HIR' : single_class_hierarchy, - 'SRCF' : target_file, - 'TXTD' : text_document, - 'TRGT' : target, - 'HIER' : class_hierarchy, - 'CTLG' : catalog_document, '1BRW' : single_class_browser, - 'MSSG' : message_document, - 'INSP' : project_inspector, - 'BROW' : class_browser, - 'COMP' : file_compare_document, - 'EDIT' : editor_document, 'PRJD' : project_document, - 'SBTG' : subtarget, 'SYMB' : symbol_browser, 'PRGS' : build_progress_document, } _propdeclarations = { ! 'PRER' : prerequisites, ! 'DBUG' : debug, ! 'CSZE' : code_size, 'Path' : path, ! 'pnam' : name, ! 'TrgT' : target, 'DSZE' : data_size, - 'FTYP' : type, - 'MODD' : modified_date, 'INIT' : init_before, ! 'sele' : selection, ! 'imod' : modified, ! 'DPND' : dependents, ! 'FILE' : location, ! 'LIDX' : link_index, 'LINK' : linked, ! 'ID ' : id, ! 'c@#^' : inherits, ! 'pidx' : index, ! 'LNKO' : link_against_output, ! 'WEAK' : weak_link, ! 'MRGE' : merge_output, ! 'CMPD' : compiled_date, ! 'PrjD' : project_document, ! 'CURT' : current_target, } --- 609,656 ---- # _classdeclarations = { '1BRW' : single_class_browser, 'PRJD' : project_document, 'SYMB' : symbol_browser, + 'EDIT' : editor_document, + 'COMP' : file_compare_document, + 'BROW' : class_browser, + 'SBTG' : subtarget, + 'MSSG' : message_document, + 'INSP' : project_inspector, + 'TXTD' : text_document, + 'CTLG' : catalog_document, + 'HIER' : class_hierarchy, + 'TRGT' : target, 'PRGS' : build_progress_document, + 'SRCF' : target_file, + 'TOOL' : ToolServer_worksheet, + '1HIR' : single_class_hierarchy, } _propdeclarations = { ! 'CURT' : current_target, ! 'PrjD' : project_document, ! 'MRGE' : merge_output, ! 'WEAK' : weak_link, ! 'DPND' : dependents, ! 'c@#^' : inherits, ! 'ID ' : id, ! 'CMPD' : compiled_date, ! 'LIDX' : link_index, ! 'FILE' : location, 'Path' : path, ! 'LNKO' : link_against_output, ! 'imod' : modified, ! 'sele' : selection, 'DSZE' : data_size, 'INIT' : init_before, ! 'MODD' : modified_date, ! 'FTYP' : type, ! 'TrgT' : target, ! 'pnam' : name, 'LINK' : linked, ! 'CSZE' : code_size, ! 'DBUG' : debug, ! 'PRER' : prerequisites, } *************** *** 681,687 **** _enumdeclarations = { - 'PERM' : _Enum_PERM, - 'FTYP' : _Enum_FTYP, - 'DKND' : _Enum_DKND, 'Inte' : _Enum_Inte, } --- 659,665 ---- _enumdeclarations = { 'Inte' : _Enum_Inte, + 'DKND' : _Enum_DKND, + 'FTYP' : _Enum_FTYP, + 'PERM' : _Enum_PERM, } Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Metrowerks_Shell_Suite.py 17 May 2001 12:40:54 -0000 1.2 --- Metrowerks_Shell_Suite.py 24 Apr 2002 09:21:46 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:SWdev:CodeWarrior 6 MPTP:Metrowerks CodeWarrior:CodeWarrior IDE 4.1B9 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 [...1070 lines suppressed...] --- 2319,2337 ---- _enumdeclarations = { 'Lang' : _Enum_Lang, ! 'Inte' : _Enum_Inte, 'STKd' : _Enum_STKd, 'DgBL' : _Enum_DgBL, ! 'Acce' : _Enum_Acce, ! 'RefP' : _Enum_RefP, ! 'TxtF' : _Enum_TxtF, ! 'DbSA' : _Enum_DbSA, ! 'TmpB' : _Enum_TmpB, ! 'savo' : _Enum_savo, ! 'PthF' : _Enum_PthF, ! 'SrcT' : _Enum_SrcT, ! 'PXdg' : _Enum_PXdg, ! 'ErrT' : _Enum_ErrT, ! 'BXbr' : _Enum_BXbr, ! 'PPrm' : _Enum_PPrm, } Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Required.py 20 Aug 2000 19:28:25 -0000 1.2 --- Required.py 24 Apr 2002 09:21:46 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:SWdev:CodeWarrior 6 MPTP:Metrowerks CodeWarrior:CodeWarrior IDE 4.1B9 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 34,38 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 34,38 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -C2 -d -r1.3 -r1.3.8.1 *** Standard_Suite.py 23 Oct 2001 22:23:02 -0000 1.3 --- Standard_Suite.py 24 Apr 2002 09:21:46 -0000 1.3.8.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:SWdev:CodeWarrior 6 MPTP:Metrowerks CodeWarrior:CodeWarrior IDE 4.1B9 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 36,40 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 36,40 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 62,66 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 62,66 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 88,92 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 88,92 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 121,125 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 121,125 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 141,145 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 141,145 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 166,170 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 166,170 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 234,246 **** """insertion point - An insertion location between two objects """ want = 'cins' - # repeated property length length of text object (in characters) - # repeated property offset offset of a text object from the beginning of the document (first char has offset 1) class line(aetools.ComponentItem): """line - lines of text """ want = 'clin' - # repeated property index index of a line object from the beginning of the document (first line has index 1) - # repeated property offset offset (in characters) of a line object from the beginning of the document - # repeated property length length in characters of this object # element 'cha ' as ['indx', 'rang', 'rele'] --- 234,241 ---- *************** *** 254,259 **** which = 'pcnt' want = 'type' - # repeated property length length of text object (in characters) - # repeated property offset offset of a text object from the beginning of the document (first char has offset 1) # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'clin' as ['indx', 'rang', 'rele'] --- 249,252 ---- *************** *** 263,268 **** """text - Text """ want = 'ctxt' - # repeated property length length of text object (in characters) - # repeated property offset offset of a text object from the beginning of the document (first char has offset 1) # element 'cha ' as ['indx', 'rele', 'rang'] # element 'cins' as ['rele'] --- 256,259 ---- *************** *** 273,278 **** """window - A window """ want = 'cwin' - # repeated property name the title of the window - # repeated property index the number of the window class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ --- 264,267 ---- *************** *** 369,374 **** window._elemdict = { } - import Metrowerks_Shell_Suite - from Metrowerks_Shell_Suite import _Enum_savo # --- 358,361 ---- *************** *** 376,406 **** # _classdeclarations = { ! 'docu' : document, ! 'cins' : insertion_point, ! 'capp' : application, 'ctxt' : text, - 'csel' : selection_2d_object, - 'clin' : line, - 'file' : file, 'cwin' : window, ! 'cha ' : character, } _propdeclarations = { ! 'pzum' : zoomed, 'DKND' : kind, 'pOff' : offset, - 'pLen' : length, - 'pnam' : name, - 'FILE' : location, - 'pcnt' : contents, 'cwin' : window, 'ppos' : position, ! 'pidx' : index, ! 'docu' : document, ! 'PERM' : file_permissions, ! 'pbnd' : bounds, ! 'pvis' : visible, ! 'inte' : user_interaction, } --- 363,393 ---- # _classdeclarations = { ! 'cha ' : character, 'ctxt' : text, 'cwin' : window, ! 'file' : file, ! 'clin' : line, ! 'csel' : selection_2d_object, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, } _propdeclarations = { ! 'inte' : user_interaction, ! 'pvis' : visible, 'DKND' : kind, + 'pbnd' : bounds, + 'PERM' : file_permissions, + 'docu' : document, + 'pidx' : index, 'pOff' : offset, 'cwin' : window, + 'FILE' : location, + 'pnam' : name, + 'pLen' : length, 'ppos' : position, ! 'pzum' : zoomed, ! 'pcnt' : contents, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** __init__.py 20 Aug 2000 19:28:25 -0000 1.2 --- __init__.py 24 Apr 2002 09:21:46 -0000 1.2.20.1 *************** *** 1,7 **** """ ! Package generated from Macintosh HD:SWdev:CodeWarrior 6 MPTP:Metrowerks CodeWarrior:CodeWarrior IDE 4.1B9 Resource aete resid 0 AppleEvent Suites """ import aetools import Required import Standard_Suite --- 1,8 ---- """ ! Package generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 Resource aete resid 0 AppleEvent Suites """ import aetools + Error = aetools.Error import Required import Standard_Suite From jackjansen@sourceforge.net Wed Apr 24 10:21:49 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:21:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.2,1.2.20.1 PowerPlant.py,1.2,1.2.20.1 Required_suite.py,1.3,1.3.20.1 Standard_Suite.py,1.2,1.2.20.1 Standard_URL_suite.py,1.2,1.2.20.1 Text.py,1.3,1.3.20.1 WorldWideWeb_suite.py,1.2,1.2.20.1 __init__.py,1.3,1.3.20.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv19565/Netscape Modified Files: Tag: release22-maint Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Backport of trunk fix: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. This also picked up a few other changes, but they should be harmless. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Mozilla_suite.py 17 May 2001 12:39:32 -0000 1.2 --- Mozilla_suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 34,38 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 34,38 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 54,58 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 54,58 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 80,84 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 80,84 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 100,104 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 100,104 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 119,123 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 119,123 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 139,143 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 139,143 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 159,163 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 159,163 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 178,182 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 178,182 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 198,202 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 198,202 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 218,222 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 218,222 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 241,251 **** _Enum_ncmd = { ! 'Get_new_mail' : '\000\000\004W', # ! 'Send_queued_messages' : '\000\000\004X', # ! 'Read_newsgroups' : '\000\000\004\004', # ! 'Show_Inbox' : '\000\000\004\005', # ! 'Show_Bookmarks_window' : '\000\000\004\006', # ! 'Show_History_window' : '\000\000\004\007', # ! 'Show_Address_Book_window' : '\000\000\004\011', # } --- 241,251 ---- _Enum_ncmd = { ! 'Get_new_mail' : '\x00\x00\x04W', # ! 'Send_queued_messages' : '\x00\x00\x04X', # ! 'Read_newsgroups' : '\x00\x00\x04\x04', # ! 'Show_Inbox' : '\x00\x00\x04\x05', # ! 'Show_Bookmarks_window' : '\x00\x00\x04\x06', # ! 'Show_History_window' : '\x00\x00\x04\x07', # ! 'Show_Address_Book_window' : '\x00\x00\x04\t', # } *************** *** 264,269 **** _enumdeclarations = { - 'dire' : _Enum_dire, 'comp' : _Enum_comp, 'ncmd' : _Enum_ncmd, } --- 264,269 ---- _enumdeclarations = { 'comp' : _Enum_comp, 'ncmd' : _Enum_ncmd, + 'dire' : _Enum_dire, } Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** PowerPlant.py 17 May 2001 12:39:27 -0000 1.2 --- PowerPlant.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 32,36 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 32,36 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 56,60 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 56,60 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 63,70 **** _Enum_dbac = { ! 'DoNothing' : '\000\000\000\000', # No debugging action is taken. ! 'PostAlert' : '\000\000\000\001', # Post an alert. ! 'LowLevelDebugger' : '\000\000\000\002', # Break into the low level debugger (MacsBug). ! 'SourceDebugger' : '\000\000\000\003', # Break into the source level debugger (if source debugger is executing). } --- 63,70 ---- _Enum_dbac = { ! 'DoNothing' : '\x00\x00\x00\x00', # No debugging action is taken. ! 'PostAlert' : '\x00\x00\x00\x01', # Post an alert. ! 'LowLevelDebugger' : '\x00\x00\x00\x02', # Break into the low level debugger (MacsBug). ! 'SourceDebugger' : '\x00\x00\x00\x03', # Break into the source level debugger (if source debugger is executing). } Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Required_suite.py 17 May 2001 12:39:23 -0000 1.3 --- Required_suite.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 28,32 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 48,52 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 48,52 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 67,71 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 67,71 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 86,90 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 86,90 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Standard_Suite.py 17 May 2001 12:39:19 -0000 1.2 --- Standard_Suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 11,15 **** _code = 'CoRe' ! class Standard_Suite_Events: def close(self, _object, _attributes={}, **_arguments): --- 11,16 ---- _code = 'CoRe' ! from StdSuites.Standard_Suite import * ! class Standard_Suite_Events(Standard_Suite_Events): def close(self, _object, _attributes={}, **_arguments): *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 48,52 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 49,53 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 69,73 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 70,74 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 94,98 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 95,99 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 213,233 **** _propdeclarations = { ! 'ptit' : titled, 'pidx' : index, 'ppos' : position, 'curl' : URL, - 'pnam' : name, - 'pbnd' : bounds, - 'isfl' : floating, - 'hclb' : closeable, - 'ALAP' : alert_application, - 'iszm' : zoomable, - 'pmod' : modal, 'pzum' : zoomed, ! 'pvis' : visible, ! 'KOSK' : kiosk_mode, ! 'busy' : busy, ! 'prsz' : resizable, ! 'wiid' : unique_ID, } --- 214,234 ---- _propdeclarations = { ! 'prsz' : resizable, ! 'busy' : busy, ! 'KOSK' : kiosk_mode, ! 'pvis' : visible, ! 'hclb' : closeable, ! 'pmod' : modal, ! 'wiid' : unique_ID, ! 'pbnd' : bounds, ! 'iszm' : zoomable, ! 'ALAP' : alert_application, 'pidx' : index, + 'isfl' : floating, + 'pnam' : name, 'ppos' : position, 'curl' : URL, 'pzum' : zoomed, ! 'ptit' : titled, } Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Standard_URL_suite.py 17 May 2001 12:39:15 -0000 1.2 --- Standard_URL_suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 5,9 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 5,9 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 40,44 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 40,44 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Text.py 17 May 2001 12:39:11 -0000 1.3 --- Text.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 96,115 **** # _classdeclarations = { - 'stys' : styleset, 'ctxt' : text, } _propdeclarations = { - 'pAft' : justbehind, - 'psct' : writing_code, - 'txst' : style, - 'colr' : color, 'pBef' : infront, ! 'pnam' : name, 'ptsz' : size, 'pUpL' : updateLevel, ! 'bgng' : beginning, 'font' : font, - 'end ' : end, } --- 96,115 ---- # _classdeclarations = { 'ctxt' : text, + 'stys' : styleset, } _propdeclarations = { 'pBef' : infront, ! 'bgng' : beginning, ! 'colr' : color, ! 'txst' : style, ! 'psct' : writing_code, ! 'pAft' : justbehind, ! 'end ' : end, 'ptsz' : size, 'pUpL' : updateLevel, ! 'pnam' : name, 'font' : font, } Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** WorldWideWeb_suite.py 17 May 2001 12:39:07 -0000 1.2 --- WorldWideWeb_suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 43,47 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 43,47 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 73,77 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 73,77 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 99,103 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 99,103 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 124,128 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 124,128 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 145,149 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 145,149 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 165,169 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 165,169 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 185,189 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 185,189 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 206,210 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 206,210 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 226,230 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 226,230 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 246,250 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 246,250 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 274,278 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 274,278 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 300,304 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 300,304 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 326,330 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 326,330 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 352,356 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 352,356 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 378,382 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 378,382 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 404,408 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 404,408 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** __init__.py 17 May 2001 12:38:48 -0000 1.3 --- __init__.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 1,7 **** """ ! Package generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ Resource aete resid 0 """ import aetools import Required_suite import Standard_Suite --- 1,8 ---- """ ! Package generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ Resource aete resid 0 """ import aetools + Error = aetools.Error import Required_suite import Standard_Suite From jackjansen@sourceforge.net Wed Apr 24 10:21:49 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:21:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.1,1.1.20.1 Netscape_Suite.py,1.1,1.1.20.1 Required_Suite.py,1.1,1.1.20.1 URL_Suite.py,1.1,1.1.20.1 Web_Browser_Suite.py,1.1,1.1.20.1 __init__.py,1.1,1.1.20.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer In directory usw-pr-cvs1:/tmp/cvs-serv19565/Explorer Modified Files: Tag: release22-maint Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py URL_Suite.py Web_Browser_Suite.py __init__.py Log Message: Backport of trunk fix: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. This also picked up a few other changes, but they should be harmless. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Microsoft_Internet_Explorer.py 20 Aug 2000 20:23:57 -0000 1.1 --- Microsoft_Internet_Explorer.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 14,19 **** def GetSource(self, _object=None, _attributes={}, **_arguments): ! """GetSource: Get the html source of a browser window ! Required argument: The index of the window to get the source from. No value means get the source from the frontmost browser window. Keyword argument _attributes: AppleEvent attribute dictionary Returns: undocumented, typecode 'TEXT' --- 14,19 ---- def GetSource(self, _object=None, _attributes={}, **_arguments): ! """GetSource: Get the HTML source of a browser window ! Required argument: Window Identifier of window from which to get the source. No value means get the source from the frontmost window. Keyword argument _attributes: AppleEvent attribute dictionary Returns: undocumented, typecode 'TEXT' *************** *** 28,32 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 41,45 **** """do script: Execute script commands Required argument: JavaScript text to execute ! Keyword argument window: optional ID of window (as specified by the ListWindows event) to execute the script in Keyword argument _attributes: AppleEvent attribute dictionary Returns: Return value --- 41,45 ---- """do script: Execute script commands Required argument: JavaScript text to execute ! Keyword argument window: optional Window Identifier (as supplied by the ListWindows event) specifying context in which to execute the script Keyword argument _attributes: AppleEvent attribute dictionary Returns: Return value *************** *** 54,58 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 54,78 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def PrintBrowserWindow(self, _object=None, _attributes={}, **_arguments): ! """PrintBrowserWindow: Print contents of browser window (HTML) ! Required argument: Window Identifier of the window to print. No value means print the frontmost browser window. ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'pWND' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Netscape_Suite.py 20 Aug 2000 20:23:57 -0000 1.1 --- Netscape_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 1,6 **** ! """Suite Netscape Suite: Events defined by Netscape. Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 1,6 ---- ! """Suite Netscape Suite: Events defined by Netscape Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 14,18 **** def Open_bookmark(self, _object=None, _attributes={}, **_arguments): ! """Open bookmark: Reads in a bookmark file Required argument: If not available, reloads the current bookmark file Keyword argument _attributes: AppleEvent attribute dictionary --- 14,18 ---- def Open_bookmark(self, _object=None, _attributes={}, **_arguments): ! """Open bookmark: Opens a bookmark file Required argument: If not available, reloads the current bookmark file Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 27,31 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Required_Suite.py 20 Aug 2000 20:23:57 -0000 1.1 --- Required_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 27,31 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 47,51 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 47,51 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 67,71 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 67,71 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 86,90 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 86,90 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** URL_Suite.py 20 Aug 2000 20:23:58 -0000 1.1 --- URL_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 19,24 **** def GetURL(self, _object, _attributes={}, **_arguments): """GetURL: Open the URL (and optionally save it to disk) ! Required argument: The URL ! Keyword argument to: Save the resolved URL contents to this file. Keyword argument _attributes: AppleEvent attribute dictionary """ --- 19,24 ---- def GetURL(self, _object, _attributes={}, **_arguments): """GetURL: Open the URL (and optionally save it to disk) ! Required argument: URL to open ! Keyword argument to: File into which to save resource located at URL. Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 32,36 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 32,36 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Web_Browser_Suite.py 20 Aug 2000 20:23:58 -0000 1.1 --- Web_Browser_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 1,6 **** ! """Suite Web Browser Suite: Class of events which are sent to Web Browser applications Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 1,6 ---- ! """Suite Web Browser Suite: Class of events supported by Web Browser applications Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 18,38 **** 'Flags' : 'FLGS', 'FormData' : 'POST', ! 'MIMEType' : 'MIME', ! 'ProgressApp' : 'PROG', ! 'ResultApp' : 'RSLT', } def OpenURL(self, _object, _attributes={}, **_arguments): """OpenURL: Retrieves URL off the Web. ! Required argument: Fully specified URL ! Keyword argument to: File to save downloaded data into. ! Keyword argument toWindow: Window to open this URL into. (Use -1 for top window, 0 for new window) Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. ! Keyword argument FormData: Posting of forms of a given MIMEType. ! Keyword argument MIMEType: MIME type for the FormData. ! Keyword argument ProgressApp: If specified, ProgressApp can be named to handle the user interface for process messages. ! Keyword argument ResultApp: When the requested URL has been accessed and all associated documents loaded, the Web browser will issue an OpenURLResult to the ResultApp. Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TransactionID """ _code = 'WWW!' --- 18,33 ---- 'Flags' : 'FLGS', 'FormData' : 'POST', ! 'MIME_Type' : 'MIME', } def OpenURL(self, _object, _attributes={}, **_arguments): """OpenURL: Retrieves URL off the Web. ! Required argument: Fully-qualified URL ! Keyword argument to: Target file for saving downloaded data ! Keyword argument toWindow: Target window for resource at URL (-1 for top window, 0 for new window) Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. ! Keyword argument FormData: data to post ! Keyword argument MIME_Type: MIME type of data being posted Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' *************** *** 45,49 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 40,44 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 52,70 **** _argmap_ShowFile = { ! 'MIME_type' : 'MIME', ! 'Window_ID' : 'WIND', 'URL' : 'URL ', - 'ResultApp' : 'RSLT', } def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: Passes FileSpec containing data of a given MIME type to be rendered in a given WindowID. ! Required argument: The file to show. ! Keyword argument MIME_type: MIME type ! Keyword argument Window_ID: ID of the window to open the file into. (Can use -1 for top window) ! Keyword argument URL: A URL which allows this document to be reloaded if necessary. ! Keyword argument ResultApp: When the requested URL has been accessed and all associated documents loaded, the Web browser will issue a ShowFileResult to the ResultApp. Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TransactionID """ _code = 'WWW!' --- 47,62 ---- _argmap_ShowFile = { ! 'MIME_Type' : 'MIME', ! 'Window_Identifier' : 'WIND', 'URL' : 'URL ', } def ShowFile(self, _object, _attributes={}, **_arguments): ! """ShowFile: FileSpec containing data of specified MIME type to be rendered in window specified by Window Identifier. ! Required argument: The file ! Keyword argument MIME_Type: MIME type ! Keyword argument Window_Identifier: Identifier of the target window for the URL. (Can use -1 for top window) ! Keyword argument URL: URL that allows this document to be reloaded. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' *************** *** 77,128 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def CancelTransaction(self, _object, _attributes={}, **_arguments): ! """CancelTransaction: Tells the Web browser to cancel a TransactionID is progress which the application has initiated via an OpenURL or ShowFile command. ! Required argument: TransactionID ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'CANT' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_QueryVersion = { ! 'Major_Version' : 'MAJV', ! 'Minor_Version' : 'MINV', ! } ! ! def QueryVersion(self, _no_object=None, _attributes={}, **_arguments): ! """QueryVersion: Tells the Web browser that an application which wishes to communicate with it supports a specific version (major.minor) of this SDI specification ! Keyword argument Major_Version: Major version of the SDI specification the sending application supports. ! Keyword argument Minor_Version: Minor version of the SDI specification the sending application supports. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: ! """ ! _code = 'WWW!' ! _subcode = 'QVER' ! ! aetools.keysubst(_arguments, self._argmap_QueryVersion) ! if _no_object != None: raise TypeError, 'No direct arg expected' ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 69,73 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 131,135 **** def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): ! """CloseAllWindows: Tells the Web browser to close all windows Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success --- 76,80 ---- def CloseAllWindows(self, _no_object=None, _attributes={}, **_arguments): ! """CloseAllWindows: Closes all windows Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success *************** *** 144,148 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 89,93 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 156,162 **** def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): ! """CloseWindow: Tells the Web browser to close the window specified either by Window ID or Title. If no parameters are specified, the top window will be closed. Keyword argument ID: ID of the window to close. (Can use -1 for top window) ! Keyword argument Title: Title of the window to close. Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success --- 101,107 ---- def CloseWindow(self, _no_object=None, _attributes={}, **_arguments): ! """CloseWindow: Close the window specified by either Window Identifier or Title. If no parameter is specified, close the top window. Keyword argument ID: ID of the window to close. (Can use -1 for top window) ! Keyword argument Title: Title of the window to close Keyword argument _attributes: AppleEvent attribute dictionary Returns: Success *************** *** 171,175 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 116,120 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 177,195 **** return _arguments['----'] - _argmap_Activate = { - 'Flags' : 'FLGS', - } - def Activate(self, _object=None, _attributes={}, **_arguments): ! """Activate: Tells the Web browser to bring itself to the front and show WindowID. (Can use -1 for top window) ! Required argument: WindowID ! Keyword argument Flags: Reserved for future use Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: WindowID of the front window """ _code = 'WWW!' _subcode = 'ACTV' ! aetools.keysubst(_arguments, self._argmap_Activate) _arguments['----'] = _object --- 122,135 ---- return _arguments['----'] def Activate(self, _object=None, _attributes={}, **_arguments): ! """Activate: Activate Internet Explorer and optionally select window designated by Window Identifier. ! Required argument: Window Identifier Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Window Identifier of window to activate """ _code = 'WWW!' _subcode = 'ACTV' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object *************** *** 197,201 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 137,141 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 204,208 **** def ListWindows(self, _no_object=None, _attributes={}, **_arguments): ! """ListWindows: Return a list of WindowIDs representing each windows currently being used by the Web browser. Keyword argument _attributes: AppleEvent attribute dictionary Returns: undocumented, typecode 'list' --- 144,148 ---- def ListWindows(self, _no_object=None, _attributes={}, **_arguments): ! """ListWindows: Returns list of Window Identifiers for all open windows. Keyword argument _attributes: AppleEvent attribute dictionary Returns: undocumented, typecode 'list' *************** *** 217,221 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 157,161 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 224,229 **** def GetWindowInfo(self, _object, _attributes={}, **_arguments): ! """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. ! Required argument: WindowID of the window to get info about Keyword argument _attributes: AppleEvent attribute dictionary Returns: --- 164,169 ---- def GetWindowInfo(self, _object, _attributes={}, **_arguments): ! """GetWindowInfo: Returns a window info record (URL/Title) for the specified window. ! Required argument: Window Identifier of the window Keyword argument _attributes: AppleEvent attribute dictionary Returns: *************** *** 238,242 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 178,182 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 249,257 **** def ParseAnchor(self, _object, _attributes={}, **_arguments): ! """ParseAnchor: Combine a base URL and a relative URL to produce a fully-specified URL ! Required argument: MainURL.The base URL. ! Keyword argument withURL: RelativeURL, which, when combined with the MainURL (in the direct object), is used to produce a fully-specified URL. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: The Fully specified URL """ _code = 'WWW!' --- 189,197 ---- def ParseAnchor(self, _object, _attributes={}, **_arguments): ! """ParseAnchor: Combines a base URL and a relative URL to produce a fully-qualified URL ! Required argument: Base URL ! Keyword argument withURL: Relative URL that is combined with the Base URL (in the direct object) to produce a fully-qualified URL. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Fully-qualified URL """ _code = 'WWW!' *************** *** 264,614 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_BeginProgress = { ! 'with_Message' : 'PMSG', ! } ! ! def BeginProgress(self, _object, _attributes={}, **_arguments): ! """BeginProgress: Initialize a progress indicator. ! Required argument: TransactionID ! Keyword argument with_Message: Message to display with the progress indicator. ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'PRBG' ! ! aetools.keysubst(_arguments, self._argmap_BeginProgress) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_SetProgressRange = { ! 'Max' : 'MAXV', ! } ! ! def SetProgressRange(self, _object, _attributes={}, **_arguments): ! """SetProgressRange: Sets a max value for the progress indicator associated with TransactionID ! Required argument: TransactionID ! Keyword argument Max: Max value for this progress indicator ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'PRSR' ! ! aetools.keysubst(_arguments, self._argmap_SetProgressRange) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_MakingProgress = { ! 'with_message' : 'PMSG', ! 'current_setting' : 'CURR', ! } ! ! def MakingProgress(self, _object, _attributes={}, **_arguments): ! """MakingProgress: Updates the progress indicator associated with TransactionID ! Required argument: TransactionID ! Keyword argument with_message: Message to display in the progress indicator ! Keyword argument current_setting: Current value of the progress indicator ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Cancel ! """ ! _code = 'WWW!' ! _subcode = 'PRMK' ! ! aetools.keysubst(_arguments, self._argmap_MakingProgress) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def EndProgress(self, _object, _attributes={}, **_arguments): ! """EndProgress: Nortifies the application that the progress indicator associated with TransactionID is no longer needed. ! Required argument: TransactionID ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'PREN' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterDone(self, _object, _attributes={}, **_arguments): ! """RegisterDone: Signals that all processing initiated by the RegisteNow event associated by TransactionID has finished. ! Required argument: TransactionID ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: 0 = failure; 1 = success; 2 = sending application needs more time to complete operation. ! """ ! _code = 'WWW!' ! _subcode = 'RGDN' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_RegisterProtocol = { ! '_for' : 'PROT', ! } ! ! def RegisterProtocol(self, _object, _attributes={}, **_arguments): ! """RegisterProtocol: Notifies that the sending application is able to handle all URLs for the specified protocol. ! Required argument: application ! Keyword argument _for: Protocol, such as NEWS, MAILTO, etc... ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'RGPR' ! ! aetools.keysubst(_arguments, self._argmap_RegisterProtocol) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_UnRegisterProtocol = { ! '_for' : 'PROT', ! } ! ! def UnRegisterProtocol(self, _object, _attributes={}, **_arguments): ! """UnRegisterProtocol: Notifies that the sending application is no longer wishes to handle URLs for the specified protocol. ! Required argument: application ! Keyword argument _for: Protocol, such as NEWS, MAILTO, etc... ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRP' ! ! aetools.keysubst(_arguments, self._argmap_UnRegisterProtocol) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_RegisterViewer = { ! '_for' : 'MIME', ! 'as' : 'FTYP', ! 'Flags' : 'MTHD', ! } ! ! def RegisterViewer(self, _object, _attributes={}, **_arguments): ! """RegisterViewer: Notifies that the sending application is able to handle all documents for the specified MIMEType. ! Required argument: application ! Keyword argument _for: MIMEType ! Keyword argument as: File type for saved documents ! Keyword argument Flags: undocumented, typecode 'shor' ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGVW' ! ! aetools.keysubst(_arguments, self._argmap_RegisterViewer) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_UnRegisterViewer = { ! '_for' : 'MIME', ! } ! ! def UnRegisterViewer(self, _object, _attributes={}, **_arguments): ! """UnRegisterViewer: Notifies that the sending application is no longer wishes to handle documents of the specified MIMEType. ! Required argument: application ! Keyword argument _for: MIMEType ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNVW' ! ! aetools.keysubst(_arguments, self._argmap_UnRegisterViewer) ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterURLEcho(self, _object, _attributes={}, **_arguments): ! """RegisterURLEcho: Notifies that the sending application would like to receive EchoURL events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Success ! """ ! _code = 'WWW!' ! _subcode = 'RGUE' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def UnRegisterURLEcho(self, _object, _attributes={}, **_arguments): ! """UnRegisterURLEcho: Notifies that the sending application would no longer like to receive EchoURL events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRU' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterWindowClose(self, _object, _attributes={}, **_arguments): ! """RegisterWindowClose: Notifies that the sending application would like to receive WindowClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGWC' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def UnRegisterWindowClose(self, _object, _attributes={}, **_arguments): ! """UnRegisterWindowClose: Notifies that the sending application would no longer like to receive WindowClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRC' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def RegisterAppClose(self, _object, _attributes={}, **_arguments): ! """RegisterAppClose: Notifies that the sending application would like to receive AppClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'RGAC' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! def UnRegisterAppClose(self, _object, _attributes={}, **_arguments): ! """UnRegisterAppClose: Notifies that the sending application would no longer like to receive AppClose events. ! Required argument: application ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'WWW!' ! _subcode = 'UNRA' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 204,208 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** __init__.py 20 Aug 2000 20:23:58 -0000 1.1 --- __init__.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 1,20 **** """ ! Package generated from Macintosh HD:Internet:Internet-programma's:Internet Explorer 4.5-map:Internet Explorer 4.5 Resource aete resid 0 """ import aetools import Web_Browser_Suite import URL_Suite import Microsoft_Internet_Explorer import Netscape_Suite - import Required_Suite _code_to_module = { 'WWW!' : Web_Browser_Suite, 'GURL' : URL_Suite, 'MSIE' : Microsoft_Internet_Explorer, 'MOSS' : Netscape_Suite, - 'reqd' : Required_Suite, } --- 1,23 ---- """ ! Package generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer Resource aete resid 0 """ import aetools + Error = aetools.Error + import Required_Suite + import Standard_Suite import Web_Browser_Suite import URL_Suite import Microsoft_Internet_Explorer import Netscape_Suite _code_to_module = { + 'reqd' : Required_Suite, + '****' : Standard_Suite, 'WWW!' : Web_Browser_Suite, 'GURL' : URL_Suite, 'MSIE' : Microsoft_Internet_Explorer, 'MOSS' : Netscape_Suite, } *************** *** 22,44 **** _code_to_fullname = { 'WWW!' : ('Explorer.Web_Browser_Suite', 'Web_Browser_Suite'), 'GURL' : ('Explorer.URL_Suite', 'URL_Suite'), 'MSIE' : ('Explorer.Microsoft_Internet_Explorer', 'Microsoft_Internet_Explorer'), 'MOSS' : ('Explorer.Netscape_Suite', 'Netscape_Suite'), - 'reqd' : ('Explorer.Required_Suite', 'Required_Suite'), } from Web_Browser_Suite import * from URL_Suite import * from Microsoft_Internet_Explorer import * from Netscape_Suite import * - from Required_Suite import * ! class Explorer(Web_Browser_Suite_Events, URL_Suite_Events, Microsoft_Internet_Explorer_Events, Netscape_Suite_Events, - Required_Suite_Events, aetools.TalkTo): _signature = 'MSIE' --- 25,50 ---- _code_to_fullname = { + 'reqd' : ('Explorer.Required_Suite', 'Required_Suite'), + '****' : ('Explorer.Standard_Suite', 'Standard_Suite'), 'WWW!' : ('Explorer.Web_Browser_Suite', 'Web_Browser_Suite'), 'GURL' : ('Explorer.URL_Suite', 'URL_Suite'), 'MSIE' : ('Explorer.Microsoft_Internet_Explorer', 'Microsoft_Internet_Explorer'), 'MOSS' : ('Explorer.Netscape_Suite', 'Netscape_Suite'), } + from Required_Suite import * + from Standard_Suite import * from Web_Browser_Suite import * from URL_Suite import * from Microsoft_Internet_Explorer import * from Netscape_Suite import * ! class Explorer(Required_Suite_Events, ! Standard_Suite_Events, ! Web_Browser_Suite_Events, URL_Suite_Events, Microsoft_Internet_Explorer_Events, Netscape_Suite_Events, aetools.TalkTo): _signature = 'MSIE' From jackjansen@sourceforge.net Wed Apr 24 10:21:50 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:21:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Containers_and_folders.py,1.3,1.3.20.1 Earlier_terms.py,1.3,1.3.20.1 Enumerations.py,1.2,1.2.20.1 Files_and_suitcases.py,1.3,1.3.20.1 Finder_Basics.py,1.2,1.2.20.1 Finder_items.py,1.2,1.2.20.1 Obsolete_terms.py,1.3,1.3.20.1 Process_classes.py,1.2,1.2.20.1 Standard_Suite.py,1.2,1.2.20.1 Type_Definitions.py,1.3,1.3.20.1 Window_classes.py,1.3,1.3.20.1 __init__.py,1.2,1.2.20.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv19565/Finder Modified Files: Tag: release22-maint Containers_and_folders.py Earlier_terms.py Enumerations.py Files_and_suitcases.py Finder_Basics.py Finder_items.py Obsolete_terms.py Process_classes.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Log Message: Backport of trunk fix: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. This also picked up a few other changes, but they should be harmless. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Containers_and_folders.py 17 May 2001 12:40:38 -0000 1.3 --- Containers_and_folders.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 47,50 **** --- 47,54 ---- which = 'lvis' want = 'long' + class view_options_window(aetools.NProperty): + """view options window - the view options window for the container (can only be opened when the container window is open) """ + which = 'vwnd' + want = 'vwnd' # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] *************** *** 277,280 **** --- 281,285 ---- 'icon_size' : icon_size, 'icon_size' : icon_size, + 'view_options_window' : view_options_window, } container._elemdict = { *************** *** 438,479 **** # _classdeclarations = { 'priv' : sharing_privileges, - 'cfol' : folder, 'cdis' : disk, ! 'sctr' : sharable_container, 'ctnr' : container, - 'cdsk' : desktop_2d_object, - 'ctrs' : trash_2d_object, } _propdeclarations = { ! 'ownr' : owner_privileges, ! 'spro' : protected, 'frsp' : free_space, - 'sgrp' : group, - 'pexc' : completely_expanded, - 'sele' : selection, - 'smou' : mounted, 'pexa' : expandable, ! 'istd' : startup, ! 'sdsk' : startup_disk, ! 'gppr' : group_privileges, ! 'shar' : shared, ! 'capa' : capacity, ! 'isej' : ejectable, ! 'gstp' : guest_privileges, 'warn' : warns_before_emptying, 'sown' : owner, ! 'c@#^' : _3c_Inheritance_3e_, 'sexp' : exported, ! 'isrv' : local_volume, ! 'iprv' : privileges_inherited, ! 'lvis' : icon_size, 'trsh' : trash, 'prvs' : see_folders, ! 'prvr' : see_files, ! 'prvw' : make_changes, ! 'pexp' : expanded, ! 'ects' : entire_contents, } --- 443,485 ---- # _classdeclarations = { + 'ctrs' : trash_2d_object, + 'cdsk' : desktop_2d_object, + 'sctr' : sharable_container, 'priv' : sharing_privileges, 'cdis' : disk, ! 'cfol' : folder, 'ctnr' : container, } _propdeclarations = { ! 'pexp' : expanded, ! 'gppr' : group_privileges, ! 'prvr' : see_files, ! 'ects' : entire_contents, ! 'lvis' : icon_size, ! 'iprv' : privileges_inherited, ! 'isrv' : local_volume, 'frsp' : free_space, 'pexa' : expandable, ! 'pexc' : completely_expanded, ! 'vwnd' : view_options_window, 'warn' : warns_before_emptying, 'sown' : owner, ! 'prvw' : make_changes, ! 'isej' : ejectable, ! 'capa' : capacity, ! 'shar' : shared, 'sexp' : exported, ! 'sdsk' : startup_disk, ! 'istd' : startup, ! 'gstp' : guest_privileges, 'trsh' : trash, + 'smou' : mounted, + 'sele' : selection, 'prvs' : see_folders, ! 'sgrp' : group, ! 'c@#^' : _3c_Inheritance_3e_, ! 'spro' : protected, ! 'ownr' : owner_privileges, } Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Earlier_terms.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Earlier_terms.py 17 May 2001 12:40:33 -0000 1.3 --- Earlier_terms.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 402,407 **** which = 'pmod' want = 'bool' ! ! resizable = titled class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ --- 402,409 ---- which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 616,723 **** # _classdeclarations = { 'iwnd' : information_window, - 'cwnd' : container_window, - 'inlf' : internet_location, - 'appf' : application_file, 'prcs' : process, 'cobj' : item, - 'cwin' : window, - 'pcda' : accessory_process, - 'ctrs' : trash_2d_object, - 'capp' : application, - 'cprf' : preferences, - 'sctr' : sharable_container, - 'dsut' : accessory_suitcase, } _propdeclarations = { 'pidx' : index, ! 'scda' : show_creation_date, ! 'qpro' : properties, ! 'fshr' : file_sharing, ! 'pvew' : view, ! 'pusd' : partition_space_used, ! 'aslk' : locked, ! 'sdat' : show_modification_date, ! 'issl' : selected, ! 'pvis' : visible, ! 'slbl' : show_label, ! 'wshd' : collapsed, ! 'cdis' : disk, ! 'usme' : use_simple_menus, 'sord' : sort_direction, ! 'sexp' : exported, ! 'comt' : comment, ! 'dscr' : description, ! 'svew' : previous_list_view, ! 'svrs' : show_version, ! 'sknd' : show_kind, ! 'phys' : physical_size, ! 'iarr' : spatial_view_arrangement, ! 'smou' : mounted, ! 'posn' : position, ! 'cobj' : item, 'revt' : remote_events, ! 'asmo' : modification_date, ! 'ssiz' : show_size, ! 'pnam' : name, ! 'mprt' : minimum_partition_size, ! 'cwin' : window, ! 'pcli' : clipboard, ! 'spro' : protected, ! 'sprt' : suggested_partition_size, ! 'pisf' : frontmost, ! 'sele' : selection, ! 'pmod' : modal, ! 'fcrt' : creator_type, ! 'shar' : shared, ! 'dwnd' : content_space, 'zumf' : zoomed_full_size, - 'sfsz' : calculate_folder_sizes, - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'pspd' : stationery, 'iprv' : inherited_privileges, - 'pfrp' : Finder_preferences, - 'barr' : button_view_arrangement, - 'ownr' : owner_privileges, - 'drwr' : popup, - 'sgrp' : group, - 'ptsz' : size, - 'kind' : kind, - 'pull' : pulled_open, - 'abbx' : about_this_computer, - 'ctnr' : container, - 'ascd' : creation_date, - 'desk' : desktop, - 'warn' : warn_before_emptying, - 'iszm' : zoomable, - 'isab' : scriptable, - 'gstp' : guest_privileges, 'vers' : version, ! 'dela' : delay_before_springing, ! 'ptit' : titled, ! 'uswg' : use_wide_grid, ! 'cuss' : has_custom_view_settings, ! 'labi' : label_index, ! 'iwnd' : information_window, 'file' : file, ! 'asty' : file_type, ! 'appt' : partition_size, ! 'scom' : show_comments, ! 'pins' : insertion_location, ! 'pbnd' : bounds, ! 'urdt' : use_relative_dates, ! 'fsup' : sharing_starting_up, ! 'sown' : owner, ! 'isfl' : floating, ! 'hclb' : closeable, ! 'iimg' : icon, ! 'gppr' : group_privileges, ! 'asdr' : folder, 'sprg' : spring_open_folders, ! 'pzum' : zoomed, ! 'ver2' : product_version, ! 'mfre' : largest_free_block, } --- 618,726 ---- # _classdeclarations = { + 'dsut' : accessory_suitcase, + 'cprf' : preferences, + 'sctr' : sharable_container, + 'capp' : application, + 'ctrs' : trash_2d_object, + 'pcda' : accessory_process, + 'cwin' : window, 'iwnd' : information_window, 'prcs' : process, + 'appf' : application_file, + 'inlf' : internet_location, + 'cwnd' : container_window, 'cobj' : item, } _propdeclarations = { + 'ver2' : product_version, + 'pbnd' : bounds, + 'asdr' : folder, + 'gppr' : group_privileges, 'pidx' : index, ! 'isfl' : floating, ! 'sown' : owner, ! 'fsup' : sharing_starting_up, ! 'urdt' : use_relative_dates, ! 'scom' : show_comments, ! 'appt' : partition_size, ! 'iimg' : icon, ! 'asty' : file_type, ! 'uswg' : use_wide_grid, ! 'ptit' : titled, ! 'dela' : delay_before_springing, ! 'cuss' : has_custom_view_settings, ! 'gstp' : guest_privileges, ! 'isab' : scriptable, ! 'iszm' : zoomable, 'sord' : sort_direction, ! 'pins' : insertion_location, ! 'pspd' : stationery, ! 'desk' : desktop, ! 'ascd' : creation_date, ! 'ctnr' : container, ! 'abbx' : about_this_computer, ! 'pull' : pulled_open, ! 'kind' : kind, ! 'ptsz' : size, ! 'hclb' : closeable, ! 'sgrp' : group, ! 'mfre' : largest_free_block, 'revt' : remote_events, ! 'drwr' : popup, ! 'iwnd' : information_window, ! 'ownr' : owner_privileges, ! 'pzum' : zoomed, ! 'prsz' : resizable, ! 'barr' : button_view_arrangement, ! 'pfrp' : Finder_preferences, 'zumf' : zoomed_full_size, 'iprv' : inherited_privileges, 'vers' : version, ! 'c@#^' : _3c_Inheritance_3e_, ! 'ID ' : id, ! 'sfsz' : calculate_folder_sizes, 'file' : file, ! 'dwnd' : content_space, ! 'shar' : shared, ! 'pmod' : modal, ! 'sele' : selection, ! 'pisf' : frontmost, ! 'sprt' : suggested_partition_size, ! 'spro' : protected, ! 'pcli' : clipboard, ! 'cwin' : window, ! 'mprt' : minimum_partition_size, 'sprg' : spring_open_folders, ! 'ssiz' : show_size, ! 'asmo' : modification_date, ! 'svrs' : show_version, ! 'cobj' : item, ! 'posn' : position, ! 'iarr' : spatial_view_arrangement, ! 'phys' : physical_size, ! 'sknd' : show_kind, ! 'labi' : label_index, ! 'svew' : previous_list_view, ! 'dscr' : description, ! 'comt' : comment, ! 'sexp' : exported, ! 'usme' : use_simple_menus, ! 'cdis' : disk, ! 'wshd' : collapsed, ! 'slbl' : show_label, ! 'warn' : warn_before_emptying, ! 'scda' : show_creation_date, ! 'pvis' : visible, ! 'issl' : selected, ! 'smou' : mounted, ! 'sdat' : show_modification_date, ! 'fcrt' : creator_type, ! 'pusd' : partition_space_used, ! 'pvew' : view, ! 'fshr' : file_sharing, ! 'qpro' : properties, ! 'aslk' : locked, ! 'pnam' : name, } Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Enumerations.py 22 Aug 2000 20:35:16 -0000 1.2 --- Enumerations.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 17,44 **** _Enum_ipnl = { ! 'General Information panel' : 'gpnl', # ! 'Sharing panel' : 'spnl', # ! 'Memory panel' : 'mpnl', # ! 'Status and Configuration panel' : 'scnl', # ! 'Fonts panel' : 'fpnl', # } _Enum_pple = { ! 'General Preferences panel' : 'pgnp', # ! 'Label Preferences panel' : 'plbp', # ! 'Icon View Preferences panel' : 'pivp', # ! 'Button View Preferences panel' : 'pbvp', # ! 'List View Preferences panel' : 'plvp', # } _Enum_earr = { ! 'not arranged' : 'narr', # ! 'snap to grid' : 'grda', # ! 'arranged by name' : 'nama', # ! 'arranged by modification date' : 'mdta', # ! 'arranged by creation date' : 'cdta', # ! 'arranged by size' : 'siza', # ! 'arranged by kind' : 'kina', # ! 'arranged by label' : 'laba', # } --- 17,44 ---- _Enum_ipnl = { ! 'General_Information_panel' : 'gpnl', # ! 'Sharing_panel' : 'spnl', # ! 'Memory_panel' : 'mpnl', # ! 'Status_and_Configuration_panel' : 'scnl', # ! 'Fonts_panel' : 'fpnl', # } _Enum_pple = { ! 'General_Preferences_panel' : 'pgnp', # ! 'Label_Preferences_panel' : 'plbp', # ! 'Icon_View_Preferences_panel' : 'pivp', # ! 'Button_View_Preferences_panel' : 'pbvp', # ! 'List_View_Preferences_panel' : 'plvp', # } _Enum_earr = { ! 'not_arranged' : 'narr', # ! 'snap_to_grid' : 'grda', # ! 'arranged_by_name' : 'nama', # ! 'arranged_by_modification_date' : 'mdta', # ! 'arranged_by_creation_date' : 'cdta', # ! 'arranged_by_size' : 'siza', # ! 'arranged_by_kind' : 'kina', # ! 'arranged_by_label' : 'laba', # } *************** *** 56,64 **** _Enum_vwby = { 'conflicts' : 'cflc', # ! 'existing items' : 'exsi', # ! 'small icon' : 'smic', # 'icon' : 'iimg', # 'name' : 'pnam', # ! 'modification date' : 'asmo', # 'size' : 'ptsz', # 'kind' : 'kind', # --- 56,64 ---- _Enum_vwby = { 'conflicts' : 'cflc', # ! 'existing_items' : 'exsi', # ! 'small_icon' : 'smic', # 'icon' : 'iimg', # 'name' : 'pnam', # ! 'modification_date' : 'asmo', # 'size' : 'ptsz', # 'kind' : 'kind', # *************** *** 66,72 **** 'label' : 'labi', # 'version' : 'vers', # ! 'creation date' : 'ascd', # ! 'small button' : 'smbu', # ! 'large button' : 'lgbu', # 'grid' : 'grid', # 'all' : 'kyal', # --- 66,72 ---- 'label' : 'labi', # 'version' : 'vers', # ! 'creation_date' : 'ascd', # ! 'small_button' : 'smbu', # ! 'large_button' : 'lgbu', # 'grid' : 'grid', # 'all' : 'kyal', # *************** *** 78,85 **** 'MMU' : 'mmu ', # 'hardware' : 'hdwr', # ! 'operating system' : 'os ', # ! 'sound system' : 'snd ', # ! 'memory available' : 'lram', # ! 'memory installed' : 'ram ', # } --- 78,94 ---- 'MMU' : 'mmu ', # 'hardware' : 'hdwr', # ! 'operating_system' : 'os ', # ! 'sound_system' : 'snd ', # ! 'memory_available' : 'lram', # ! 'memory_installed' : 'ram ', # ! } ! ! _Enum_ese0 = { ! 'starting_up' : 'ese2', # ! 'running' : 'ese3', # ! 'rebuilding_desktop' : 'ese5', # ! 'copying' : 'ese4', # ! 'restarting' : 'ese6', # ! 'quitting' : 'ese7', # } *************** *** 98,107 **** _enumdeclarations = { 'gsen' : _Enum_gsen, - 'earr' : _Enum_earr, 'isiz' : _Enum_isiz, ! 'vwby' : _Enum_vwby, 'pple' : _Enum_pple, - 'ipnl' : _Enum_ipnl, - 'sodr' : _Enum_sodr, } --- 107,117 ---- _enumdeclarations = { + 'sodr' : _Enum_sodr, + 'ipnl' : _Enum_ipnl, + 'ese0' : _Enum_ese0, + 'vwby' : _Enum_vwby, 'gsen' : _Enum_gsen, 'isiz' : _Enum_isiz, ! 'earr' : _Enum_earr, 'pple' : _Enum_pple, } Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Files_and_suitcases.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Files_and_suitcases.py 17 May 2001 12:40:28 -0000 1.3 --- Files_and_suitcases.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 244,278 **** # _classdeclarations = { 'clpf' : clipping, - 'docf' : document_file, - 'stcs' : suitcase, - 'appf' : application_file, - 'file' : file, - 'fsut' : font_suitcase, - 'pack' : package, - 'dafi' : desk_accessory_file, 'alia' : alias_file, 'dsut' : desk_accessory_suitcase, ! 'inlf' : internet_location_file, ! 'fntf' : font_file, ! 'sndf' : sound_file, } _propdeclarations = { ! 'orig' : original_item, ! 'pspd' : stationery, ! 'aslk' : locked, ! 'iloc' : location, ! 'mprt' : minimum_size, ! 'fcrt' : creator_type, ! 'c@#^' : _3c_Inheritance_3e_, ! 'asty' : file_type, ! 'hscr' : has_scripting_terminology, ! 'sprt' : suggested_size, 'appt' : preferred_size, 'isab' : accepts_high_level_events, ! 'snd ' : sound, ! 'ver2' : product_version, ! 'vers' : version, } --- 244,278 ---- # _classdeclarations = { + 'sndf' : sound_file, + 'fntf' : font_file, + 'inlf' : internet_location_file, 'clpf' : clipping, 'alia' : alias_file, + 'dafi' : desk_accessory_file, 'dsut' : desk_accessory_suitcase, ! 'fsut' : font_suitcase, ! 'file' : file, ! 'appf' : application_file, ! 'stcs' : suitcase, ! 'docf' : document_file, ! 'pack' : package, } _propdeclarations = { ! 'vers' : version, ! 'ver2' : product_version, ! 'snd ' : sound, 'appt' : preferred_size, + 'sprt' : suggested_size, 'isab' : accepts_high_level_events, ! 'hscr' : has_scripting_terminology, ! 'asty' : file_type, ! 'c@#^' : _3c_Inheritance_3e_, ! 'fcrt' : creator_type, ! 'mprt' : minimum_size, ! 'pspd' : stationery, ! 'iloc' : location, ! 'aslk' : locked, ! 'orig' : original_item, } Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Finder_Basics.py 17 May 2001 12:40:24 -0000 1.2 --- Finder_Basics.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 33,37 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 33,37 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 52,56 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 52,56 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 71,75 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 71,75 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 90,94 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 90,94 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 109,113 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 109,113 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 135,139 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 135,139 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 197,200 **** --- 197,204 ---- which = 'desk' want = 'cdsk' + class execution_state(aetools.NProperty): + """execution state - the current execution state of the Finder """ + which = 'exec' + want = 'ese0' class Finder_preferences(aetools.NProperty): """Finder preferences - Various preferences that apply to the Finder as a whole """ *************** *** 225,228 **** --- 229,233 ---- # element 'cwnd' as ['indx', 'name'] # element 'iwnd' as ['indx', 'name'] + # element 'vwnd' as ['indx', 'name'] # element 'lwnd' as ['indx', 'name'] # element 'dwnd' as ['indx', 'name'] *************** *** 286,289 **** --- 291,295 ---- 'about_this_computer' : about_this_computer, 'desktop' : desktop, + 'execution_state' : execution_state, 'Finder_preferences' : Finder_preferences, } *************** *** 313,316 **** --- 319,323 ---- 'container_window' : Earlier_terms.container_window, 'information_window' : Earlier_terms.information_window, + 'view_options_window' : Window_classes.view_options_window, 'clipping_window' : Window_classes.clipping_window, 'content_space' : Window_classes.content_space, *************** *** 334,365 **** # _classdeclarations = { - 'spfl' : special_folders, 'capp' : application, } _propdeclarations = { ! 'amnu' : apple_menu_items_folder, ! 'extn' : extensions_folder, ! 'pnam' : name, ! 'fshr' : file_sharing, ! 'pcli' : clipboard, ! 'strt' : startup_items_folder, ! 'pref' : preferences_folder, ! 'pisf' : frontmost, ! 'pins' : insertion_location, ! 'pvis' : visible, ! 'abbx' : about_this_computer, ! 'temp' : temporary_items_folder, ! 'font' : fonts_folder, 'pfrp' : Finder_preferences, ! 'desk' : desktop, ! 'fsup' : sharing_starting_up, 'mfre' : largest_free_block, 'ctrl' : control_panels_folder, - 'sele' : selection, - 'shdf' : shutdown_items_folder, 'macs' : system_folder, ! 'ver2' : product_version, ! 'vers' : version, } --- 341,373 ---- # _classdeclarations = { 'capp' : application, + 'spfl' : special_folders, } _propdeclarations = { ! 'vers' : version, ! 'ver2' : product_version, 'pfrp' : Finder_preferences, ! 'exec' : execution_state, ! 'pins' : insertion_location, 'mfre' : largest_free_block, + 'fsup' : sharing_starting_up, + 'desk' : desktop, 'ctrl' : control_panels_folder, 'macs' : system_folder, ! 'font' : fonts_folder, ! 'abbx' : about_this_computer, ! 'shdf' : shutdown_items_folder, ! 'temp' : temporary_items_folder, ! 'pvis' : visible, ! 'sele' : selection, ! 'pisf' : frontmost, ! 'pref' : preferences_folder, ! 'strt' : startup_items_folder, ! 'pcli' : clipboard, ! 'fshr' : file_sharing, ! 'pnam' : name, ! 'extn' : extensions_folder, ! 'amnu' : apple_menu_items_folder, } Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Finder_items.py 17 May 2001 12:39:53 -0000 1.2 --- Finder_items.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 27,31 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 52,56 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 52,56 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 72,76 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 72,76 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 92,96 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 92,96 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 112,116 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 112,116 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 118,124 **** --- 118,129 ---- return _arguments['----'] + _argmap_put_away = { + 'asking' : 'fask', + } + def put_away(self, _object, _attributes={}, **_arguments): """put away: Put away the specified object(s) Required argument: the items to put away + Keyword argument asking: Specifies whether or not to present a dialog to confirm putting this item away. Keyword argument _attributes: AppleEvent attribute dictionary Returns: the object put away in its put-away location *************** *** 127,137 **** _subcode = 'ptwy' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 132,143 ---- _subcode = 'ptwy' ! aetools.keysubst(_arguments, self._argmap_put_away) _arguments['----'] = _object + aetools.enumsubst(_arguments, 'fask', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 153,157 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 159,163 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 173,177 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 179,183 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 294,297 **** --- 300,304 ---- item._elemdict = { } + _Enum_bool = None # XXXX enum bool not found!! # *************** *** 303,327 **** _propdeclarations = { ! 'iwnd' : information_window, ! 'cdis' : disk, ! 'asmo' : modification_date, ! 'ascd' : creation_date, ! 'pnam' : name, 'labi' : label_index, ! 'ID ' : id, ! 'iimg' : icon, 'pidx' : index, ! 'dwnd' : content_space, 'cwin' : window, ! 'comt' : comment, ! 'dscr' : description, 'asdr' : folder, ! 'issl' : selected, ! 'pbnd' : bounds, ! 'ctnr' : container, ! 'phys' : physical_size, ! 'ptsz' : size, ! 'kind' : kind, ! 'posn' : position, } --- 310,334 ---- _propdeclarations = { ! 'posn' : position, ! 'kind' : kind, ! 'ptsz' : size, ! 'phys' : physical_size, ! 'dwnd' : content_space, ! 'pbnd' : bounds, ! 'issl' : selected, 'labi' : label_index, ! 'dscr' : description, ! 'comt' : comment, ! 'ctnr' : container, 'pidx' : index, ! 'iimg' : icon, ! 'ID ' : id, 'cwin' : window, ! 'pnam' : name, ! 'ascd' : creation_date, ! 'cdis' : disk, ! 'asmo' : modification_date, 'asdr' : folder, ! 'iwnd' : information_window, } Index: Obsolete_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Obsolete_terms.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Obsolete_terms.py 17 May 2001 12:39:48 -0000 1.3 --- Obsolete_terms.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 176,204 **** # _classdeclarations = { ! 'ccdv' : control_panel, ! 'iwnd' : information_window, ! 'ctnr' : container, 'capp' : application, ! 'sctr' : sharable_container, ! 'cwnd' : container_window, 'prcs' : process, - 'file' : file, 'cobj' : item, ! 'qwnd' : status_window, ! 'swnd' : sharing_window, } _propdeclarations = { ! 'crtd' : creation_date_obsolete, ! 'cfol' : folder_obsolete, ! 'ctnr' : container, ! 'cwnd' : container_window, ! 'pvwp' : view_preferences, 'swnd' : sharing_window, 'sctr' : sharable_container, 'cobj' : item, - 'modd' : modification_date_obsolete, - 'islk' : locked_obsolete, - 'fitp' : file_type_obsolete, } --- 176,204 ---- # _classdeclarations = { ! 'qwnd' : status_window, 'capp' : application, ! 'swnd' : sharing_window, ! 'ccdv' : control_panel, 'prcs' : process, 'cobj' : item, ! 'file' : file, ! 'sctr' : sharable_container, ! 'cwnd' : container_window, ! 'ctnr' : container, ! 'iwnd' : information_window, } _propdeclarations = { ! 'fitp' : file_type_obsolete, 'swnd' : sharing_window, + 'cfol' : folder_obsolete, + 'crtd' : creation_date_obsolete, + 'islk' : locked_obsolete, + 'modd' : modification_date_obsolete, 'sctr' : sharable_container, + 'pvwp' : view_preferences, + 'cwnd' : container_window, + 'ctnr' : container, 'cobj' : item, } Index: Process_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Process_classes.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Process_classes.py 22 Aug 2000 20:35:17 -0000 1.2 --- Process_classes.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 121,144 **** # _classdeclarations = { 'pcda' : desk_accessory_process, 'pcap' : application_process, - 'prcs' : process, } _propdeclarations = { - 'revt' : accepts_remote_events, - 'appf' : application_file, - 'pnam' : name, - 'file' : file, - 'pusd' : partition_space_used, - 'fcrt' : creator_type, - 'c@#^' : _3c_Inheritance_3e_, - 'asty' : file_type, - 'hscr' : has_scripting_terminology, - 'dafi' : desk_accessory_file, - 'isab' : accepts_high_level_events, - 'appt' : total_partition_size, - 'pisf' : frontmost, 'pvis' : visible, } --- 121,144 ---- # _classdeclarations = { + 'prcs' : process, 'pcda' : desk_accessory_process, 'pcap' : application_process, } _propdeclarations = { 'pvis' : visible, + 'pisf' : frontmost, + 'appt' : total_partition_size, + 'isab' : accepts_high_level_events, + 'dafi' : desk_accessory_file, + 'hscr' : has_scripting_terminology, + 'asty' : file_type, + 'c@#^' : _3c_Inheritance_3e_, + 'fcrt' : creator_type, + 'pusd' : partition_space_used, + 'file' : file, + 'pnam' : name, + 'appf' : application_file, + 'revt' : accepts_remote_events, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Standard_Suite.py 22 Aug 2000 20:35:17 -0000 1.2 --- Standard_Suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 11,15 **** _code = 'CoRe' ! class Standard_Suite_Events: _argmap_open = { --- 11,16 ---- _code = 'CoRe' ! from StdSuites.Standard_Suite import * ! class Standard_Suite_Events(Standard_Suite_Events): _argmap_open = { *************** *** 34,38 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 35,39 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 59,63 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 60,64 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 78,82 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 79,83 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 98,102 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 99,103 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 124,128 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 125,129 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 150,154 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 151,155 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 171,175 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 172,176 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 203,207 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 204,208 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 224,228 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 225,229 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 255,259 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 256,260 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 290,294 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 291,295 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 310,314 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 311,315 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 316,319 **** --- 317,322 ---- return _arguments['----'] + import AppleScript_Suite + import AppleScript_Suite _Enum_list = None # XXXX enum list not found!! _Enum_bool = None # XXXX enum bool not found!! Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Type_Definitions.py 17 May 2001 12:39:44 -0000 1.3 --- Type_Definitions.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 222,265 **** # _classdeclarations = { - 'clbl' : label, - 'ifam' : icon_family, - 'alst' : alias_list, 'cprf' : preferences, } _propdeclarations = { 'ics#' : small_monochrome_icon_and_mask, ! 'scda' : shows_creation_date, ! 'uswg' : uses_wide_grid, 'sprg' : spring_open_folders, ! 'is32' : small_32_bit_icon, ! 'ICN#' : large_monochrome_icon_and_mask, ! 'cwin' : window, ! 'sdat' : shows_modification_date, ! 'iisz' : spatial_view_icon_size, ! 'barr' : button_view_arrangement, ! 'il32' : large_32_bit_icon, 'l8mk' : large_8_bit_mask, - 'scom' : shows_comments, - 'bisz' : button_view_icon_size, - 'lisz' : list_view_icon_size, - 'slbl' : shows_label, - 'icl4' : large_4_bit_icon, - 'usme' : uses_simple_menus, - 'urdt' : uses_relative_dates, 'vfnt' : view_font, ! 'sfsz' : calculates_folder_sizes, 'pidx' : index, ! 'icl8' : large_8_bit_icon, ! 'ssiz' : shows_size, ! 'ics8' : small_8_bit_mask, ! 'colr' : color, ! 'svrs' : shows_version, 'pnam' : name, ! 'sknd' : shows_kind, ! 'vfsz' : view_font_size, ! 'iarr' : spatial_view_arrangement, ! 'ics4' : small_4_bit_icon, ! 'dela' : delay_before_springing, } --- 222,265 ---- # _classdeclarations = { 'cprf' : preferences, + 'alst' : alias_list, + 'ifam' : icon_family, + 'clbl' : label, } _propdeclarations = { + 'dela' : delay_before_springing, + 'ics4' : small_4_bit_icon, + 'iarr' : spatial_view_arrangement, + 'barr' : button_view_arrangement, 'ics#' : small_monochrome_icon_and_mask, ! 'sknd' : shows_kind, ! 'svrs' : shows_version, ! 'colr' : color, ! 'ics8' : small_8_bit_mask, ! 'icl8' : large_8_bit_icon, 'sprg' : spring_open_folders, ! 'vfsz' : view_font_size, ! 'sfsz' : calculates_folder_sizes, 'l8mk' : large_8_bit_mask, 'vfnt' : view_font, ! 'urdt' : uses_relative_dates, ! 'usme' : uses_simple_menus, ! 'icl4' : large_4_bit_icon, ! 'slbl' : shows_label, ! 'lisz' : list_view_icon_size, ! 'scda' : shows_creation_date, ! 'bisz' : button_view_icon_size, 'pidx' : index, ! 'scom' : shows_comments, ! 'iisz' : spatial_view_icon_size, ! 'sdat' : shows_modification_date, ! 'cwin' : window, ! 'ICN#' : large_monochrome_icon_and_mask, ! 'is32' : small_32_bit_icon, 'pnam' : name, ! 'il32' : large_32_bit_icon, ! 'uswg' : uses_wide_grid, ! 'ssiz' : shows_size, } Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -C2 -d -r1.3 -r1.3.20.1 *** Window_classes.py 17 May 2001 12:39:36 -0000 1.3 --- Window_classes.py 24 Apr 2002 09:21:47 -0000 1.3.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 51,56 **** which = 'pmod' want = 'bool' ! ! resizable = titled class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ --- 51,58 ---- which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 228,231 **** --- 230,239 ---- information_windows = information_window + class view_options_window(aetools.ComponentItem): + """view options window - A View Options window """ + want = 'vwnd' + + view_options_windows = view_options_window + class preferences_window(aetools.ComponentItem): """preferences window - The Finder Preferences window """ *************** *** 306,309 **** --- 314,323 ---- information_window._elemdict = { } + view_options_window._propdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + 'item' : item, + } + view_options_window._elemdict = { + } preferences_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, *************** *** 326,386 **** # _classdeclarations = { 'dwnd' : content_space, 'iwnd' : information_window, 'lwnd' : clipping_window, - 'cwnd' : container_window, - 'cwin' : window, - 'pwnd' : preferences_window, } _propdeclarations = { ! 'pidx' : index, ! 'scda' : shows_creation_date, ! 'vers' : version, ! 'aslk' : locked, ! 'pvew' : view, ! 'sdat' : shows_modification_date, ! 'drwr' : popup, ! 'sprt' : suggested_size, ! 'pvis' : visible, ! 'ptsz' : size, ! 'pull' : pulled_open, ! 'slbl' : shows_label, ! 'wshd' : collapsed, ! 'ctnr' : container, ! 'ascd' : creation_date, ! 'warn' : warns_before_emptying, ! 'sord' : sort_direction, ! 'iszm' : zoomable, ! 'comt' : comment, ! 'svew' : previous_list_view, ! 'svrs' : shows_version, ! 'sknd' : shows_kind, ! 'phys' : physical_size, 'iarr' : spatial_view_arrangement, ! 'posn' : position, ! 'ptit' : titled, ! 'cobj' : item, ! 'asmo' : modification_date, ! 'ssiz' : shows_size, ! 'pnam' : name, 'pbnd' : bounds, - 'mprt' : minimum_size, 'iimg' : icon, 'cuss' : has_custom_view_settings, ! 'appt' : preferred_size, ! 'scom' : shows_comments, ! 'pmod' : modal, ! 'panl' : current_panel, ! 'urdt' : uses_relative_dates, ! 'zumf' : zoomed_full_size, ! 'sfsz' : calculates_folder_sizes, ! 'c@#^' : _3c_Inheritance_3e_, 'isfl' : floating, ! 'hclb' : closeable, ! 'pspd' : stationery, ! 'pzum' : zoomed, ! 'barr' : button_view_arrangement, ! 'ver2' : product_version, } --- 340,402 ---- # _classdeclarations = { + 'pwnd' : preferences_window, + 'vwnd' : view_options_window, + 'cwin' : window, + 'cwnd' : container_window, 'dwnd' : content_space, 'iwnd' : information_window, 'lwnd' : clipping_window, } _propdeclarations = { ! 'prsz' : resizable, ! 'barr' : button_view_arrangement, ! 'pzum' : zoomed, 'iarr' : spatial_view_arrangement, ! 'hclb' : closeable, ! 'c@#^' : _3c_Inheritance_3e_, ! 'ver2' : product_version, ! 'sfsz' : calculates_folder_sizes, ! 'sprt' : suggested_size, ! 'zumf' : zoomed_full_size, ! 'urdt' : uses_relative_dates, ! 'panl' : current_panel, ! 'pmod' : modal, ! 'pspd' : stationery, ! 'scom' : shows_comments, ! 'appt' : preferred_size, ! 'aslk' : locked, 'pbnd' : bounds, 'iimg' : icon, + 'mprt' : minimum_size, + 'pnam' : name, + 'ssiz' : shows_size, + 'asmo' : modification_date, + 'cobj' : item, + 'ptit' : titled, + 'posn' : position, 'cuss' : has_custom_view_settings, ! 'phys' : physical_size, ! 'sknd' : shows_kind, ! 'svrs' : shows_version, ! 'svew' : previous_list_view, ! 'comt' : comment, ! 'iszm' : zoomable, ! 'sord' : sort_direction, ! 'ascd' : creation_date, ! 'ctnr' : container, ! 'wshd' : collapsed, ! 'slbl' : shows_label, ! 'pull' : pulled_open, ! 'ptsz' : size, ! 'pvis' : visible, ! 'pidx' : index, 'isfl' : floating, ! 'warn' : warns_before_emptying, ! 'drwr' : popup, ! 'sdat' : shows_modification_date, ! 'pvew' : view, ! 'scda' : shows_creation_date, ! 'vers' : version, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** __init__.py 22 Aug 2000 20:35:17 -0000 1.2 --- __init__.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 1,4 **** """ ! Package generated from Macintosh HD:Systeemmap:Finder Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from Moes:Systeemmap:Finder Resource aete resid 0 """ From jackjansen@sourceforge.net Wed Apr 24 10:21:50 2002 From: jackjansen@sourceforge.net (jackjansen@sourceforge.net) Date: Wed, 24 Apr 2002 02:21:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.2,1.2.20.1 Macintosh_Connectivity_Clas.py,1.1,1.1.20.1 QuickDraw_Graphics_Suite.py,1.1,1.1.20.1 QuickDraw_Graphics_Suppleme.py,1.1,1.1.20.1 Required_Suite.py,1.1,1.1.20.1 Standard_Suite.py,1.2,1.2.20.1 Table_Suite.py,1.2,1.2.20.1 Text_Suite.py,1.2,1.2.20.1 Type_Names_Suite.py,1.1,1.1.20.1 __init__.py,1.2,1.2.20.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv19565/StdSuites Modified Files: Tag: release22-maint AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Required_Suite.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Backport of trunk fix: Second part of fix for #493826: regenerated suite modules so errn exists but == 0 doesn't signal an error. This also picked up a few other changes, but they should be harmless. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** AppleScript_Suite.py 17 May 2001 12:38:44 -0000 1.2 --- AppleScript_Suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 26,30 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 26,30 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 46,50 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 46,50 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 65,69 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 65,69 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 84,88 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 84,88 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 104,108 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 104,108 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 123,127 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 123,127 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 142,146 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 142,146 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 161,165 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 161,165 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 192,196 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 192,196 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 272,276 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 272,276 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 293,297 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 293,297 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 306,310 **** """ _code = 'ascr' ! _subcode = '\255 ' if _arguments: raise TypeError, 'No optional args expected' --- 306,310 ---- """ _code = 'ascr' ! _subcode = '\xad ' if _arguments: raise TypeError, 'No optional args expected' *************** *** 314,318 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 314,318 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 335,339 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 335,339 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 356,360 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 356,360 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 377,381 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 377,381 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 398,402 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 398,402 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 419,423 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 419,423 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 440,444 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 440,444 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 461,465 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 461,465 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 482,486 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 482,486 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 503,507 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 503,507 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 524,528 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 524,528 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 545,549 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 545,549 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 566,570 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 566,570 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 587,591 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 587,591 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 608,612 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 608,612 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 629,633 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 629,633 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 650,654 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 650,654 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 671,675 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 671,675 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 692,696 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 692,696 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 713,717 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 713,717 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 734,738 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 734,738 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 786,790 **** """linked list - An ordered collection of items """ want = 'llst' - # repeated property length the length of a list linked_lists = linked_list --- 786,789 ---- *************** *** 793,797 **** """vector - An ordered collection of items """ want = 'vect' - # repeated property length the length of a list vectors = vector --- 792,795 ---- *************** *** 1883,1917 **** _Enum_ekst = { ! 'escape_key' : 'ks5\000', # ! 'delete_key' : 'ks3\000', # ! 'tab_key' : 'ks0\000', # ! 'return_key' : 'ks$\000', # ! 'clear_key' : 'ksG\000', # ! 'enter_key' : 'ksL\000', # ! 'up_arrow_key' : 'ks~\000', # ! 'down_arrow_key' : 'ks}\000', # ! 'left_arrow_key' : 'ks{\000', # ! 'right_arrow_key' : 'ks|\000', # ! 'help_key' : 'ksr\000', # ! 'home_key' : 'kss\000', # ! 'page_up_key' : 'kst\000', # ! 'page_down_key' : 'ksy\000', # ! 'forward_del_key' : 'ksu\000', # ! 'end_key' : 'ksw\000', # ! 'F1_key' : 'ksz\000', # ! 'F2_key' : 'ksx\000', # ! 'F3_key' : 'ksc\000', # ! 'F4_key' : 'ksv\000', # ! 'F5_key' : 'ks`\000', # ! 'F6_key' : 'ksa\000', # ! 'F7_key' : 'ksb\000', # ! 'F8_key' : 'ksd\000', # ! 'F9_key' : 'kse\000', # ! 'F10_key' : 'ksm\000', # ! 'F11_key' : 'ksg\000', # ! 'F12_key' : 'kso\000', # ! 'F13_key' : 'ksi\000', # ! 'F14_key' : 'ksk\000', # ! 'F15_key' : 'ksq\000', # } --- 1881,1915 ---- _Enum_ekst = { ! 'escape_key' : 'ks5\x00', # ! 'delete_key' : 'ks3\x00', # ! 'tab_key' : 'ks0\x00', # ! 'return_key' : 'ks$\x00', # ! 'clear_key' : 'ksG\x00', # ! 'enter_key' : 'ksL\x00', # ! 'up_arrow_key' : 'ks~\x00', # ! 'down_arrow_key' : 'ks}\x00', # ! 'left_arrow_key' : 'ks{\x00', # ! 'right_arrow_key' : 'ks|\x00', # ! 'help_key' : 'ksr\x00', # ! 'home_key' : 'kss\x00', # ! 'page_up_key' : 'kst\x00', # ! 'page_down_key' : 'ksy\x00', # ! 'forward_del_key' : 'ksu\x00', # ! 'end_key' : 'ksw\x00', # ! 'F1_key' : 'ksz\x00', # ! 'F2_key' : 'ksx\x00', # ! 'F3_key' : 'ksc\x00', # ! 'F4_key' : 'ksv\x00', # ! 'F5_key' : 'ks`\x00', # ! 'F6_key' : 'ksa\x00', # ! 'F7_key' : 'ksb\x00', # ! 'F8_key' : 'ksd\x00', # ! 'F9_key' : 'kse\x00', # ! 'F10_key' : 'ksm\x00', # ! 'F11_key' : 'ksg\x00', # ! 'F12_key' : 'kso\x00', # ! 'F13_key' : 'ksi\x00', # ! 'F14_key' : 'ksk\x00', # ! 'F15_key' : 'ksq\x00', # } *************** *** 1921,2064 **** # _classdeclarations = { 'nmbr' : number, ! 'ctxt' : text, ! 'fss ' : file_specification, ! 'sat ' : Saturday, ! 'ccmt' : cubic_centimetres, ! 'cfet' : cubic_feet, ! 'lbs ' : pounds, ! 'yard' : yards, ! 'sqyd' : square_yards, ! 'mach' : machine, ! 'utxt' : Unicode_text, ! 'cstr' : C_string, ! 'rdat' : data, ! 'doub' : real, ! 'hand' : handler, ! 'sutx' : styled_Unicode_text, ! 'sqmi' : square_miles, ! 'undf' : _empty_ae_name, ! 'reco' : record, ! 'cha ' : character, ! 'cobj' : item, ! 'kfrm' : reference_form, ! 'enum' : constant, ! 'inch' : inches, ! 'sqrm' : square_metres, ! 'bool' : boolean, ! 'prop' : property, ! '****' : anything, ! 'scpt' : script, ! 'kgrm' : kilograms, ! 'sep ' : September, ! 'snd ' : sound, ! 'mon ' : Monday, ! 'capp' : app, ! 'lr ' : list_or_record, ! 'fri ' : Friday, ! 'cuin' : cubic_inches, ! 'mar ' : March, ! 'galn' : gallons, ! 'encs' : encoded_string, 'litr' : litres, ! 'case' : upper_case, ! 'styl' : styled_Clipboard_text, ! 'llst' : linked_list, ! 'pcls' : _class, ! 'jun ' : June, ! 'ns ' : number_or_string, ! 'ozs ' : ounces, ! 'mnth' : month, ! 'metr' : metres, ! 'jan ' : January, 'pstr' : Pascal_string, ! 'alis' : alias, ! 'gram' : grams, ! 'msng' : missing_value, ! 'qrts' : quarts, ! 'nov ' : November, ! 'list' : list, ! 'sqft' : square_feet, ! 'kmtr' : kilometres, 'cRGB' : RGB_color, 'itxt' : international_text, 'scnd' : seconds, ! 'apr ' : April, ! 'nd ' : number_or_date, ! 'wkdy' : weekday, ! 'vect' : vector, ! 'obj ' : reference, ! 'sqkm' : square_kilometres, ! 'dec ' : December, ! 'wed ' : Wednesday, ! 'cyrd' : cubic_yards, ! 'vers' : version, ! 'tue ' : Tuesday, ! 'prep' : preposition, ! 'type' : type_class, ! 'citm' : text_item, ! 'citl' : writing_code_info, ! 'sf ' : alias_or_string, 'degc' : degrees_Celsius, ! 'long' : integer, ! 'ls ' : list_or_string, ! 'PICT' : picture, ! 'zone' : zone, ! 'psct' : writing_code, ! 'lrs ' : list_2c__record_or_text, ! 'cmtr' : centimetres, ! 'evnt' : event, ! 'oct ' : October, 'degk' : degrees_Kelvin, ! 'ldt ' : date, 'thu ' : Thursday, ! 'degf' : degrees_Fahrenheit, ! 'kprs' : keystroke, ! 'mile' : miles, ! 'feb ' : February, ! 'feet' : feet, ! 'nds ' : number_2c__date_or_text, ! 'STXT' : styled_text, ! 'cmet' : cubic_metres, ! 'sun ' : Sunday, ! 'aug ' : August, ! 'may ' : May, ! 'jul ' : July, ! 'TEXT' : string, } _propdeclarations = { ! 'pscd' : script_code, ! 'rslt' : result, ! 'pnam' : name, ! 'time' : time, ! 'txdl' : text_item_delimiters, ! 'prln' : print_length, ! 'prdp' : print_depth, 'kMod' : modifiers, ! 'days' : days, ! 'spac' : space, ! 'kMsg' : key, ! 'plcd' : language_code, ! 'ret ' : _return, ! 'tstr' : time_string, 'hour' : hours, ! 'tab ' : tab, ! 'rvse' : reverse, 'wkdy' : weekday, - 'day ' : day, - 'ID ' : id, - 'c@#^' : _3c_Inheritance_3e_, - 'kknd' : key_kind, - 'ascr' : AppleScript, - 'rest' : rest, 'dstr' : date_string, ! 'min ' : minutes, ! 'pi ' : pi, ! 'leng' : length, 'year' : year, ! 'pare' : parent, ! 'mnth' : month, ! 'week' : weeks, } --- 1919,2062 ---- # _classdeclarations = { + 'jul ' : July, + 'may ' : May, + 'TEXT' : string, + 'cmet' : cubic_metres, + 'STXT' : styled_text, + 'nds ' : number_2c__date_or_text, + 'feet' : feet, + 'feb ' : February, 'nmbr' : number, ! 'mile' : miles, ! 'kprs' : keystroke, ! 'psct' : writing_code, ! 'degf' : degrees_Fahrenheit, ! 'lrs ' : list_2c__record_or_text, ! 'ldt ' : date, 'litr' : litres, ! 'nd ' : number_or_date, ! 'cmtr' : centimetres, ! 'evnt' : event, 'pstr' : Pascal_string, ! 'zone' : zone, ! 'PICT' : picture, ! 'ls ' : list_or_string, ! 'long' : integer, ! 'sf ' : alias_or_string, ! 'citl' : writing_code_info, ! 'citm' : text_item, ! 'mach' : machine, ! 'type' : type_class, ! 'prep' : preposition, ! 'tue ' : Tuesday, ! 'case' : upper_case, ! 'vers' : version, ! 'wed ' : Wednesday, ! 'dec ' : December, ! 'sqkm' : square_kilometres, ! 'obj ' : reference, ! 'vect' : vector, ! 'wkdy' : weekday, 'cRGB' : RGB_color, + 'sun ' : Sunday, 'itxt' : international_text, 'scnd' : seconds, ! 'mar ' : March, ! 'kmtr' : kilometres, ! 'sqft' : square_feet, ! 'list' : list, ! 'doub' : real, ! 'nov ' : November, ! 'qrts' : quarts, 'degc' : degrees_Celsius, ! 'msng' : missing_value, ! 'alis' : alias, ! 'jan ' : January, ! 'metr' : metres, ! 'mnth' : month, ! 'ns ' : number_or_string, ! 'jun ' : June, ! 'aug ' : August, ! 'llst' : linked_list, ! 'styl' : styled_Clipboard_text, ! 'encs' : encoded_string, ! 'galn' : gallons, ! 'cuin' : cubic_inches, ! 'fri ' : Friday, ! 'sutx' : styled_Unicode_text, ! 'lr ' : list_or_record, 'degk' : degrees_Kelvin, ! 'mon ' : Monday, ! 'snd ' : sound, ! 'pcls' : _class, ! 'kgrm' : kilograms, ! 'scpt' : script, ! '****' : anything, ! 'prop' : property, ! 'reco' : record, ! 'bool' : boolean, ! 'oct ' : October, ! 'sqrm' : square_metres, ! 'inch' : inches, ! 'kfrm' : reference_form, ! 'cobj' : item, ! 'gram' : grams, ! 'cha ' : character, ! 'apr ' : April, ! 'undf' : _empty_ae_name, ! 'capp' : app, ! 'enum' : constant, ! 'hand' : handler, ! 'sqmi' : square_miles, ! 'rdat' : data, ! 'cstr' : C_string, ! 'utxt' : Unicode_text, 'thu ' : Thursday, ! 'sqyd' : square_yards, ! 'yard' : yards, ! 'cyrd' : cubic_yards, ! 'ozs ' : ounces, ! 'lbs ' : pounds, ! 'cfet' : cubic_feet, ! 'ccmt' : cubic_centimetres, ! 'sat ' : Saturday, ! 'sep ' : September, ! 'fss ' : file_specification, ! 'ctxt' : text, } _propdeclarations = { ! 'week' : weeks, 'kMod' : modifiers, ! 'pare' : parent, ! 'leng' : length, 'hour' : hours, ! 'mnth' : month, ! 'min ' : minutes, 'wkdy' : weekday, 'dstr' : date_string, ! 'rest' : rest, ! 'ascr' : AppleScript, ! 'kknd' : key_kind, ! 'c@#^' : _3c_Inheritance_3e_, ! 'ID ' : id, 'year' : year, ! 'rvse' : reverse, ! 'tab ' : tab, ! 'tstr' : time_string, ! 'pi ' : pi, ! 'ret ' : _return, ! 'plcd' : language_code, ! 'kMsg' : key, ! 'spac' : space, ! 'days' : days, ! 'txdl' : text_item_delimiters, ! 'prdp' : print_depth, ! 'prln' : print_length, ! 'pscd' : script_code, ! 'time' : time, ! 'pnam' : name, ! 'rslt' : result, ! 'day ' : day, } *************** *** 2067,2074 **** _enumdeclarations = { - 'boov' : _Enum_boov, - 'ekst' : _Enum_ekst, - 'misc' : _Enum_misc, - 'cons' : _Enum_cons, 'eMds' : _Enum_eMds, } --- 2065,2072 ---- _enumdeclarations = { 'eMds' : _Enum_eMds, + 'cons' : _Enum_cons, + 'misc' : _Enum_misc, + 'ekst' : _Enum_ekst, + 'boov' : _Enum_boov, } Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Macintosh_Connectivity_Clas.py 17 Aug 2000 22:14:56 -0000 1.1 --- Macintosh_Connectivity_Clas.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 37,41 **** """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' - # repeated property properties property that allows getting and setting of multiple properties class conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ --- 37,40 ---- *************** *** 66,70 **** """AppleTalk address - Addresses a device or service connected via the AppleTalk protocol """ want = 'cat ' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class class AppleTalk_machine(aetools.NProperty): """AppleTalk machine - the machine name part of the address """ --- 65,68 ---- *************** *** 85,90 **** """bus slot - Addresses a PC, PCI, or NuBus card """ want = 'cbus' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class - # repeated property ID the slot number bus_slots = bus_slot --- 83,86 ---- *************** *** 93,98 **** """Ethernet address - Addresses a device by its Ethernet address """ want = 'cen ' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class - # repeated property ID the Ethernet address Ethernet_addresses = Ethernet_address --- 89,92 ---- *************** *** 101,106 **** """FireWire address - Addresses a device on the FireWire bus """ want = 'cfw ' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class - # repeated property ID the FireWire device ID FireWire_addresses = FireWire_address --- 95,98 ---- *************** *** 109,114 **** """IP address - Addresses a device or service via the Internet Protocol (IP) """ want = 'cip ' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class - # repeated property ID the address in the form "127.201.0.1" class DNS_form(aetools.NProperty): """DNS form - the address in the form "apple.com" """ --- 101,104 ---- *************** *** 125,129 **** """LocalTalk address - Addresses a device by its LocalTalk address """ want = 'clt ' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class class network(aetools.NProperty): """network - the LocalTalk network number """ --- 115,118 ---- *************** *** 144,153 **** """SCSI address - Addresses a SCSI device """ want = 'cscs' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class class SCSI_bus(aetools.NProperty): """SCSI bus - the SCSI bus number """ which = 'pscb' want = 'shor' - # repeated property ID the SCSI ID class LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ --- 133,140 ---- *************** *** 160,165 **** """Token Ring address - Addresses a device or service via the Token Ring protocol """ want = 'ctok' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class - # repeated property ID the Token Ring ID Token_Ring_addresses = Token_Ring_address --- 147,150 ---- *************** *** 168,172 **** """USB address - Addresses a device on the Universal Serial Bus """ want = 'cusb' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class class name(aetools.NProperty): """name - the USB device name """ --- 153,156 ---- *************** *** 333,369 **** # _classdeclarations = { ! 'cen ' : Ethernet_address, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cusb' : USB_address, ! 'cadb' : ADB_address, ! 'cscs' : SCSI_address, ! 'cbus' : bus_slot, ! 'cdev' : device_specification, 'ctok' : Token_Ring_address, 'cfw ' : FireWire_address, ! 'cadr' : address_specification, ! 'cat ' : AppleTalk_address, } _propdeclarations = { ! 'pnod' : node, ! 'pslu' : LUN, ! 'patm' : AppleTalk_machine, ! 'pdva' : device_address, ! 'pscb' : SCSI_bus, 'ppor' : port, ! 'pALL' : properties, ! 'ID ' : ID, ! 'c@#^' : _3c_inheritance_3e_, ! 'pdvt' : device_type, ! 'pnet' : network, 'patz' : AppleTalk_zone, 'pnam' : name, ! 'pcon' : conduit, ! 'pprt' : protocol, ! 'patt' : AppleTalk_type, 'psoc' : socket, ! 'pdns' : DNS_form, } --- 317,353 ---- # _classdeclarations = { ! 'cat ' : AppleTalk_address, ! 'cadr' : address_specification, 'ctok' : Token_Ring_address, 'cfw ' : FireWire_address, ! 'cbus' : bus_slot, ! 'cscs' : SCSI_address, ! 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cen ' : Ethernet_address, } _propdeclarations = { ! 'pdns' : DNS_form, 'ppor' : port, ! 'patt' : AppleTalk_type, ! 'pprt' : protocol, ! 'pcon' : conduit, 'patz' : AppleTalk_zone, + 'pnet' : network, + 'pdvt' : device_type, 'pnam' : name, ! 'c@#^' : _3c_inheritance_3e_, ! 'ID ' : ID, ! 'pALL' : properties, ! 'pscb' : SCSI_bus, ! 'pdva' : device_address, ! 'patm' : AppleTalk_machine, 'psoc' : socket, ! 'pslu' : LUN, ! 'pnod' : node, } *************** *** 373,377 **** _enumdeclarations = { 'econ' : _Enum_econ, - 'epro' : _Enum_epro, 'edvt' : _Enum_edvt, } --- 357,361 ---- _enumdeclarations = { 'econ' : _Enum_econ, 'edvt' : _Enum_edvt, + 'epro' : _Enum_epro, } Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** QuickDraw_Graphics_Suite.py 17 Aug 2000 22:14:56 -0000 1.1 --- QuickDraw_Graphics_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 189,193 **** """pixel - A pixel """ want = 'cpxl' - # repeated property color the color pixels = pixel --- 189,192 ---- *************** *** 345,398 **** # _classdeclarations = { ! 'crec' : rectangle, ! 'cpix' : pixel_map, ! 'carc' : arc, 'cgsh' : graphic_shape, 'cpxl' : pixel, 'crrc' : rounded_rectangle, ! 'cpgn' : polygon, ! 'cdrw' : drawing_area, ! 'cgob' : graphic_object, ! 'glin' : graphic_line, ! 'cgtx' : graphic_text, ! 'covl' : oval, ! 'cpic' : graphic_group, } _propdeclarations = { 'pend' : end_point, - 'pupd' : update_on_change, 'pstp' : start_point, ! 'pdrt' : definition_rect, ! 'pnam' : name, ! 'pbcl' : background_color, 'pptm' : transfer_mode, ! 'pnel' : default_location, ! 'pdpt' : pixel_depth, ! 'gobs' : ordering, ! 'ustl' : uniform_styles, ! 'ptlt' : point_list, ! 'pdst' : dash_style, ! 'psct' : writing_code, ! 'txst' : style, ! 'font' : font, ! 'pchd' : corner_curve_height, ! 'arro' : arrow_style, ! 'ppwd' : pen_width, ! 'ptps' : default_size, ! 'ppcl' : pen_color, 'ptxf' : default_font, 'pcwd' : corner_curve_width, ! 'ptxc' : text_color, ! 'cltb' : color_table, ! 'pppa' : pen_pattern, ! 'pang' : start_angle, ! 'flpt' : fill_pattern, ! 'colr' : color, ! 'pbnd' : bounds, 'ptsz' : size, ! 'parc' : arc_angle, ! 'flcl' : fill_color, ! 'pbpt' : background_pattern, } --- 344,397 ---- # _classdeclarations = { ! 'cpic' : graphic_group, ! 'covl' : oval, ! 'cgtx' : graphic_text, 'cgsh' : graphic_shape, + 'glin' : graphic_line, + 'cgob' : graphic_object, + 'cdrw' : drawing_area, + 'cpgn' : polygon, 'cpxl' : pixel, 'crrc' : rounded_rectangle, ! 'carc' : arc, ! 'cpix' : pixel_map, ! 'crec' : rectangle, } _propdeclarations = { + 'pbpt' : background_pattern, + 'flcl' : fill_color, + 'parc' : arc_angle, + 'pbnd' : bounds, + 'colr' : color, + 'flpt' : fill_pattern, + 'ustl' : uniform_styles, + 'font' : font, 'pend' : end_point, 'pstp' : start_point, ! 'pang' : start_angle, 'pptm' : transfer_mode, ! 'cltb' : color_table, ! 'ptxc' : text_color, 'ptxf' : default_font, + 'ppcl' : pen_color, + 'ptps' : default_size, + 'ppwd' : pen_width, + 'arro' : arrow_style, 'pcwd' : corner_curve_width, ! 'txst' : style, ! 'psct' : writing_code, ! 'pdst' : dash_style, ! 'ptlt' : point_list, ! 'gobs' : ordering, ! 'pdpt' : pixel_depth, ! 'pnel' : default_location, ! 'pchd' : corner_curve_height, ! 'pbcl' : background_color, ! 'pnam' : name, ! 'pdrt' : definition_rect, 'ptsz' : size, ! 'pupd' : update_on_change, ! 'pppa' : pen_pattern, } *************** *** 401,405 **** _enumdeclarations = { - 'tran' : _Enum_tran, 'arro' : _Enum_arro, } --- 400,404 ---- _enumdeclarations = { 'arro' : _Enum_arro, + 'tran' : _Enum_tran, } Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** QuickDraw_Graphics_Suppleme.py 17 Aug 2000 22:14:56 -0000 1.1 --- QuickDraw_Graphics_Suppleme.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 61,66 **** _propdeclarations = { 'prot' : rotation, - 'pscl' : scale, 'ptrs' : translation, } --- 61,66 ---- _propdeclarations = { 'prot' : rotation, 'ptrs' : translation, + 'pscl' : scale, } Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Required_Suite.py 17 Aug 2000 22:14:57 -0000 1.1 --- Required_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 11,15 **** _code = 'reqd' ! class Required_Suite_Events: pass --- 11,16 ---- _code = 'reqd' ! from _builtinSuites.builtin_Suite import * ! class Required_Suite_Events(builtin_Suite_Events): pass Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Standard_Suite.py 17 May 2001 12:38:36 -0000 1.2 --- Standard_Suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 11,15 **** _code = 'core' ! class Standard_Suite_Events: def open(self, _object, _attributes={}, **_arguments): --- 11,16 ---- _code = 'core' ! from _builtinSuites.builtin_Suite import * ! class Standard_Suite_Events(builtin_Suite_Events): def open(self, _object, _attributes={}, **_arguments): *************** *** 27,31 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 28,32 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 46,50 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 47,51 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 65,69 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 66,70 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 85,89 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 86,90 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 110,114 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 111,115 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 138,142 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 139,143 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 164,168 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 165,169 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 184,188 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 185,189 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 212,216 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 213,217 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 233,237 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 234,238 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 264,268 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 265,269 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 290,294 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 291,295 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 317,321 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 318,322 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 337,341 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 338,342 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 363,367 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 364,368 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 389,393 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 390,394 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 415,419 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 416,420 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 441,445 **** _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result --- 442,446 ---- _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) ! if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result *************** *** 656,703 **** # _classdeclarations = { - 'docu' : document, - 'cins' : insertion_point, - 'capp' : application, - 'alis' : alias, - 'csel' : selection_2d_object, - 'file' : file, 'cwin' : window, } _propdeclarations = { ! 'ptit' : titled, 'pidx' : index, - 'pnam' : name, - 'pzum' : zoomed, - 'pcnt' : contents, - 'pcli' : clipboard, - 'hclb' : closeable, - 'iszm' : zoomable, - 'isfl' : floating, - 'pspd' : stationery, - 'pisf' : frontmost, - 'sele' : selection, - 'pbnd' : bounds, - 'imod' : modified, 'pvis' : visible, 'pmod' : modal, ! 'vers' : version, ! 'prsz' : resizable, } _compdeclarations = { ! '> ' : _3e_, ! 'bgwt' : starts_with, '>= ' : _b3_, - '= ' : _3d_, - '<= ' : _b2_, 'cont' : contains, ! 'ends' : ends_with, ! '< ' : _3c_, } _enumdeclarations = { - 'styl' : _Enum_styl, 'savo' : _Enum_savo, 'kfrm' : _Enum_kfrm, } --- 657,704 ---- # _classdeclarations = { 'cwin' : window, + 'file' : file, + 'csel' : selection_2d_object, + 'alis' : alias, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, } _propdeclarations = { ! 'prsz' : resizable, ! 'vers' : version, 'pidx' : index, 'pvis' : visible, + 'imod' : modified, + 'pbnd' : bounds, + 'sele' : selection, + 'pisf' : frontmost, + 'pspd' : stationery, + 'isfl' : floating, + 'iszm' : zoomable, + 'hclb' : closeable, + 'pcli' : clipboard, 'pmod' : modal, ! 'pcnt' : contents, ! 'pnam' : name, ! 'pzum' : zoomed, ! 'ptit' : titled, } _compdeclarations = { ! '< ' : _3c_, ! 'ends' : ends_with, '>= ' : _b3_, 'cont' : contains, ! '<= ' : _b2_, ! '= ' : _3d_, ! 'bgwt' : starts_with, ! '> ' : _3e_, } _enumdeclarations = { 'savo' : _Enum_savo, + 'styl' : _Enum_styl, 'kfrm' : _Enum_kfrm, } Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Table_Suite.py 17 May 2001 12:38:31 -0000 1.2 --- Table_Suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 82,94 **** _classdeclarations = { 'ccel' : cell, - 'ctbl' : table, 'ccol' : column, 'crow' : row, } _propdeclarations = { - 'ppro' : protection, - 'pfor' : formula, 'pnam' : name, } --- 82,94 ---- _classdeclarations = { 'ccel' : cell, 'ccol' : column, + 'ctbl' : table, 'crow' : row, } _propdeclarations = { 'pnam' : name, + 'pfor' : formula, + 'ppro' : protection, } Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** Text_Suite.py 17 May 2001 12:38:26 -0000 1.2 --- Text_Suite.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 27,31 **** """line - A line of text """ want = 'clin' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class class justification(aetools.NProperty): """justification - the justification of the text """ --- 27,30 ---- *************** *** 38,42 **** """paragraph - A paragraph """ want = 'cpar' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class paragraphs = paragraph --- 37,40 ---- *************** *** 78,82 **** """text flow - A contiguous block of text. Page layout applications call this a •story.Õ """ want = 'cflo' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class class name(aetools.NProperty): """name - the name """ --- 76,79 ---- *************** *** 103,107 **** """word - A word """ want = 'cwor' - # repeated property _3c_inheritance_3e_ inherits some of its properties from this class words = word --- 100,103 ---- *************** *** 184,208 **** # _classdeclarations = { - 'clin' : line, - 'ctxt' : text, - 'cwor' : word, - 'cflo' : text_flow, 'cpar' : paragraph, - 'tsty' : text_style_info, 'cha ' : character, } _propdeclarations = { ! 'psct' : writing_code, ! 'txst' : style, 'colr' : color, ! 'font' : font, ! 'pnam' : name, 'ustl' : uniform_styles, - 'pjst' : justification, - 'ofst' : off_styles, - 'onst' : on_styles, - 'ptsz' : size, 'c@#^' : _3c_inheritance_3e_, } --- 180,204 ---- # _classdeclarations = { 'cpar' : paragraph, 'cha ' : character, + 'cflo' : text_flow, + 'tsty' : text_style_info, + 'clin' : line, + 'cwor' : word, + 'ctxt' : text, } _propdeclarations = { ! 'ptsz' : size, ! 'ofst' : off_styles, ! 'pjst' : justification, 'colr' : color, ! 'txst' : style, ! 'psct' : writing_code, 'ustl' : uniform_styles, 'c@#^' : _3c_inheritance_3e_, + 'pnam' : name, + 'font' : font, + 'onst' : on_styles, } Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.1 retrieving revision 1.1.20.1 diff -C2 -d -r1.1 -r1.1.20.1 *** Type_Names_Suite.py 17 Aug 2000 22:14:57 -0000 1.1 --- Type_Names_Suite.py 24 Apr 2002 09:21:47 -0000 1.1.20.1 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 348,391 **** # _classdeclarations = { ! 'targ' : target_id, ! 'null' : null, ! 'lfxd' : long_fixed, ! 'TIFF' : TIFF_picture, 'vers' : version, 'magn' : unsigned_integer, - 'exte' : extended_real, - 'qdrt' : bounding_rectangle, - 'lrct' : long_rectangle, - 'lfpt' : long_fixed_point, - 'pmin' : type_parameter_info, - 'pinf' : type_property_info, - 'tdas' : dash_style, - 'tr96' : RGB96_color, 'cmnu' : menu, - 'gcli' : type_class_info, - 'lpnt' : long_point, - 'suin' : type_suite_info, - 'trot' : rotation, - 'fixd' : fixed, - 'lfrc' : long_fixed_rectangle, 'frct' : fixed_rectangle, 'evin' : type_event_info, 'sing' : small_real, ! 'aete' : application_dictionary, ! 'tpmm' : pixel_map_record, ! 'cmen' : menu_item, ! 'QDpt' : point, ! 'EPS ' : PostScript_picture, ! 'mLoc' : machine_location, ! 'insl' : location_reference, ! 'elin' : type_element_info, ! 'comp' : double_integer, ! 'fpnt' : fixed_point, ! 'clrt' : color_table, 'styl' : scrap_styles, ! 'aeut' : system_dictionary, ! 'tr16' : RGB16_color, ! 'shor' : small_integer, ! 'TEXT' : plain_text, } --- 348,391 ---- # _classdeclarations = { ! 'shor' : small_integer, ! 'tr16' : RGB16_color, 'vers' : version, + 'aeut' : system_dictionary, + 'clrt' : color_table, + 'fpnt' : fixed_point, + 'TEXT' : plain_text, + 'elin' : type_element_info, + 'insl' : location_reference, + 'mLoc' : machine_location, + 'EPS ' : PostScript_picture, + 'QDpt' : point, + 'cmen' : menu_item, + 'tpmm' : pixel_map_record, + 'aete' : application_dictionary, 'magn' : unsigned_integer, 'cmnu' : menu, 'frct' : fixed_rectangle, + 'lfrc' : long_fixed_rectangle, 'evin' : type_event_info, 'sing' : small_real, ! 'suin' : type_suite_info, ! 'trot' : rotation, ! 'pmin' : type_parameter_info, ! 'fixd' : fixed, 'styl' : scrap_styles, ! 'lpnt' : long_point, ! 'gcli' : type_class_info, ! 'TIFF' : TIFF_picture, ! 'tr96' : RGB96_color, ! 'tdas' : dash_style, ! 'exte' : extended_real, ! 'pinf' : type_property_info, ! 'lfpt' : long_fixed_point, ! 'lrct' : long_rectangle, ! 'qdrt' : bounding_rectangle, ! 'comp' : double_integer, ! 'lfxd' : long_fixed, ! 'null' : null, ! 'targ' : target_id, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** __init__.py 20 Aug 2000 19:28:27 -0000 1.2 --- __init__.py 24 Apr 2002 09:21:47 -0000 1.2.20.1 *************** *** 1,7 **** """ ! Package generated from Macintosh HD:Systeemmap:Extensies:AppleScript Resource aeut resid 0 Standard Event Suites for English """ import aetools import AppleScript_Suite import Required_Suite --- 1,8 ---- """ ! Package generated from Moes:Systeemmap:Extensies:AppleScript Resource aeut resid 0 Standard Event Suites for English """ import aetools + Error = aetools.Error import AppleScript_Suite import Required_Suite From bwarsaw@sourceforge.net Thu Apr 25 16:44:19 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Thu, 25 Apr 2002 08:44:19 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.13,4.14 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8439 Modified Files: python-mode.el Log Message: (py-shell-hook): A new hook variable, run at the end of py-shell. Allows for some customization of the underlying comint buffer. (py-shell): Call the new hook. (info-lookup-maybe-add-help): A new call suggested by Milan Zamazal to make lookups in the Info documentation easier. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.13 retrieving revision 4.14 diff -C2 -d -r4.13 -r4.14 *** python-mode.el 22 Apr 2002 22:05:49 -0000 4.13 --- python-mode.el 25 Apr 2002 15:44:17 -0000 4.14 *************** *** 470,473 **** --- 470,476 ---- "*Hook called by `python-mode'.") + (defvar py-shell-hook nil + "*Hook called by `py-shell'.") + ;; In previous version of python-mode.el, the hook was incorrectly ;; called py-mode-hook, and was not defvar'd. Deprecate its use. *************** *** 1337,1340 **** --- 1340,1344 ---- (set-syntax-table py-mode-syntax-table) (use-local-map py-shell-map) + (run-hooks 'py-shell-hook) )) *************** *** 2996,2999 **** --- 3000,3013 ---- to newline-and-indent in the global keymap, and shadows them with local bindings to py-newline-and-indent.")) + + (require 'info-look) + (info-lookup-maybe-add-help + :mode 'python-mode + :regexp "[a-zA-Z0-9_]+" + :doc-spec '(("(python-lib)Module Index") + ("(python-lib)Class-Exception-Object Index") + ("(python-lib)Function-Method-Variable Index") + ("(python-lib)Miscellaneous Index"))) + From bwarsaw@sourceforge.net Thu Apr 25 17:26:40 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Thu, 25 Apr 2002 09:26:40 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.14,4.15 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25251 Modified Files: python-mode.el Log Message: (py-comint-output-filter-function): Add a pop-to-buffer call so you always get to see the result of e.g. a py-execute-region. Funny, this bugged both me /and/ Guido! Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.14 retrieving revision 4.15 diff -C2 -d -r4.14 -r4.15 *** python-mode.el 25 Apr 2002 15:44:17 -0000 4.14 --- python-mode.el 25 Apr 2002 16:26:38 -0000 4.15 *************** *** 1124,1127 **** --- 1124,1128 ---- This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string + (pop-to-buffer (current-buffer)) (when (and (or (string-equal string ">>> ") (and (>= (length string) 5) From theller@sourceforge.net Thu Apr 25 18:03:33 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Thu, 25 Apr 2002 10:03:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils ccompiler.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv5902 Modified Files: ccompiler.py Log Message: Fix trivial typo. Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ccompiler.py 31 Jan 2002 18:55:31 -0000 1.42 --- ccompiler.py 25 Apr 2002 17:03:30 -0000 1.43 *************** *** 320,324 **** ! # -- Priviate utility methods -------------------------------------- # (here for the convenience of subclasses) --- 320,324 ---- ! # -- Private utility methods -------------------------------------- # (here for the convenience of subclasses) From theller@sourceforge.net Thu Apr 25 18:26:45 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Thu, 25 Apr 2002 10:26:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_ext.py,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv14688 Modified Files: build_ext.py Log Message: Append the PC specific include 'PC' and library 'PCBuild' directories under NT - this allows distutils to work with the CVS version or the source distribution. Wrap a long line. Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** build_ext.py 31 Jan 2002 18:56:00 -0000 1.79 --- build_ext.py 25 Apr 2002 17:26:37 -0000 1.80 *************** *** 168,171 **** --- 168,176 ---- self.build_temp = os.path.join(self.build_temp, "Release") + # Append the source distribution include and library directories, + # this allows distutils on windows to work in the source tree + self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) + self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) + # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory *************** *** 178,182 **** if string.find(sys.executable, sys.exec_prefix) != -1: # building third party extensions ! self.library_dirs.append(os.path.join(sys.prefix, "lib", "python" + sys.version[:3], "config")) else: # building python standard extensions --- 183,189 ---- if string.find(sys.executable, sys.exec_prefix) != -1: # building third party extensions ! self.library_dirs.append(os.path.join(sys.prefix, "lib", ! "python" + sys.version[:3], ! "config")) else: # building python standard extensions From theller@sourceforge.net Thu Apr 25 18:29:48 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Thu, 25 Apr 2002 10:29:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils msvccompiler.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv15839 Modified Files: msvccompiler.py Log Message: Pass the full pathname to MSVC when compiling a debug version. This allows the debugger to find the source without asking the user to browse for it. Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** msvccompiler.py 8 Feb 2002 14:41:31 -0000 1.45 --- msvccompiler.py 25 Apr 2002 17:29:45 -0000 1.46 *************** *** 310,313 **** --- 310,319 ---- self.mkpath (os.path.dirname (obj)) + if debug: + # pass the full pathname to MSVC in debug mode, + # this allows the debugger to find the source file + # without asking the user to browse for it + src = os.path.abspath(src) + if ext in self._c_extensions: input_opt = "/Tc" + src From bwarsaw@sourceforge.net Thu Apr 25 20:17:44 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Thu, 25 Apr 2002 12:17:44 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.15,4.16 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29578 Modified Files: python-mode.el Log Message: (py-execute-region): Alexander Schmolck points out that leading whitespace can hose the needs-if test. So just skip all blank lines at the start of the region right off the bat. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.15 retrieving revision 4.16 diff -C2 -d -r4.15 -r4.16 *** python-mode.el 25 Apr 2002 16:26:38 -0000 4.15 --- python-mode.el 25 Apr 2002 19:17:42 -0000 4.16 *************** *** 1379,1382 **** --- 1379,1389 ---- is inserted at the end. See also the command `py-clear-queue'." (interactive "r\nP") + ;; Skip ahead to the first non-blank line + (goto-char start) + (beginning-of-line) + (while (and (looking-at "\\s *$") + (< (point) end)) + (forward-line 1)) + (setq start (point)) (or (< start end) (error "Region is empty")) From gvanrossum@sourceforge.net Thu Apr 25 21:01:13 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Thu, 25 Apr 2002 13:01:13 -0700 Subject: [Python-checkins] python/dist/src/Objects boolobject.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17330 Modified Files: boolobject.c Log Message: Clean up the layout of the bool_as_number struct initializer. Index: boolobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/boolobject.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** boolobject.c 4 Apr 2002 01:00:42 -0000 1.2 --- boolobject.c 25 Apr 2002 20:01:10 -0000 1.3 *************** *** 104,145 **** static PyNumberMethods bool_as_number = { ! 0, /*nb_add*/ ! 0, /*nb_subtract*/ ! 0, /*nb_multiply*/ ! 0, /*nb_divide*/ ! 0, /*nb_remainder*/ ! 0, /*nb_divmod*/ ! 0, /*nb_power*/ ! 0, /*nb_negative*/ ! 0, /*nb_positive*/ ! 0, /*nb_absolute*/ ! 0, /*nb_nonzero*/ ! 0, /*nb_invert*/ ! 0, /*nb_lshift*/ ! 0, /*nb_rshift*/ ! (binaryfunc)bool_and, /*nb_and*/ ! (binaryfunc)bool_xor, /*nb_xor*/ ! (binaryfunc)bool_or, /*nb_or*/ ! 0, /*nb_coerce*/ ! 0, /*nb_int*/ ! 0, /*nb_long*/ ! 0, /*nb_float*/ ! 0, /*nb_oct*/ ! 0, /*nb_hex*/ ! 0, /*nb_inplace_add*/ ! 0, /*nb_inplace_subtract*/ ! 0, /*nb_inplace_multiply*/ ! 0, /*nb_inplace_divide*/ ! 0, /*nb_inplace_remainder*/ ! 0, /*nb_inplace_power*/ ! 0, /*nb_inplace_lshift*/ ! 0, /*nb_inplace_rshift*/ ! 0, /*nb_inplace_and*/ ! 0, /*nb_inplace_xor*/ ! 0, /*nb_inplace_or*/ ! 0, /* nb_floor_divide */ ! 0, /* nb_true_divide */ ! 0, /* nb_inplace_floor_divide */ ! 0, /* nb_inplace_true_divide */ }; --- 104,145 ---- static PyNumberMethods bool_as_number = { ! 0, /* nb_add */ ! 0, /* nb_subtract */ ! 0, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! 0, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! 0, /* nb_nonzero */ ! 0, /* nb_invert */ ! 0, /* nb_lshift */ ! 0, /* nb_rshift */ ! (binaryfunc)bool_and, /* nb_and */ ! (binaryfunc)bool_xor, /* nb_xor */ ! (binaryfunc)bool_or, /* nb_or */ ! 0, /* nb_coerce */ ! 0, /* nb_int */ ! 0, /* nb_long */ ! 0, /* nb_float */ ! 0, /* nb_oct */ ! 0, /* nb_hex */ ! 0, /* nb_inplace_add */ ! 0, /* nb_inplace_subtract */ ! 0, /* nb_inplace_multiply */ ! 0, /* nb_inplace_divide */ ! 0, /* nb_inplace_remainder */ ! 0, /* nb_inplace_power */ ! 0, /* nb_inplace_lshift */ ! 0, /* nb_inplace_rshift */ ! 0, /* nb_inplace_and */ ! 0, /* nb_inplace_xor */ ! 0, /* nb_inplace_or */ ! 0, /* nb_floor_divide */ ! 0, /* nb_true_divide */ ! 0, /* nb_inplace_floor_divide */ ! 0, /* nb_inplace_true_divide */ }; From bwarsaw@sourceforge.net Thu Apr 25 22:31:50 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Thu, 25 Apr 2002 14:31:50 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.16,4.17 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23285 Modified Files: python-mode.el Log Message: SF patch #510288 by Kevin J. Butler, mod'd by Barry. This provides better auto-recognition of a Jython file vs. a CPython (or agnostic) file by looking at the #! line more closely, and inspecting the import statements in the first 20000 bytes (configurable). Specifically, (py-import-check-point-max): New variable, controlling how far into the buffer it will search for import statements. (py-jpython-packages): List of package names that are Jython-ish. (py-shell-alist): List of #! line programs and the modes associated with them. (jpython-mode-hook): Extra hook that runs when entering jpython-mode (what about Jython mode? <20k wink>). (py-choose-shell-by-shebang, py-choose-shell-by-import, py-choose-shell): New functions. (python-mode): Use py-choose-shell. (jpython-mode): New command. (py-execute-region): Don't use my previous hacky attempt at doing this, use the new py-choose-shell function. One other thing this file now does: it attempts to add the proper hooks to interpreter-mode-alist and auto-mode-alist if they aren't already there. Might help with Emacs users since that editor doesn't come with python-mode by default. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.16 retrieving revision 4.17 diff -C2 -d -r4.16 -r4.17 *** python-mode.el 25 Apr 2002 19:17:42 -0000 4.16 --- python-mode.el 25 Apr 2002 21:31:47 -0000 4.17 *************** *** 271,274 **** --- 271,291 ---- :group 'python) + (defcustom py-import-check-point-max + 20000 + "Maximum number of characters to search for a Java-ish import statement. + When `python-mode' tries to calculate the shell to use (either a + CPython or a JPython shell), it looks at the so-called `shebang' line + -- i.e. #! line. If that's not available, it looks at some of the + file heading imports to see if they look Java-like." + :type 'integer + :group 'python + ) + + (defcustom py-jpython-packages + '("java" "javax" "org" "com") + "Imported packages that imply `jpython-mode'." + :type '(repeat string) + :group 'python) + ;; Not customizable (defvar py-master-file nil *************** *** 299,302 **** --- 316,325 ---- :tag "Pychecker Command Args") + (defvar py-shell-alist + '(("jpython" . 'jpython) + ("jython" . 'jpython) + ("python" . 'cpython)) + "*Alist of interpreters and python shells. Used by `py-choose-shell' + to select the appropriate python interpreter mode for a file.") *************** *** 470,473 **** --- 493,500 ---- "*Hook called by `python-mode'.") + (defvar jpython-mode-hook nil + "*Hook called by `jpython-mode'. `jpython-mode' also calls + `python-mode-hook'.") + (defvar py-shell-hook nil "*Hook called by `py-shell'.") *************** *** 949,952 **** --- 976,1037 ---- (nreverse index-alist))) + + + (defun py-choose-shell-by-shebang () + "Choose CPython or JPython mode by looking at #! on the first line. + Returns the appropriate mode function. + Used by `py-choose-shell', and similar to but distinct from + `set-auto-mode', though it uses `auto-mode-interpreter-regexp' (if available)." + ;; look for an interpreter specified in the first line + ;; similar to set-auto-mode (files.el) + (let* ((re (if (boundp 'auto-mode-interpreter-regexp) + auto-mode-interpreter-regexp + ;; stolen from Emacs 21.2 + "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")) + (interpreter (save-excursion + (goto-char (point-min)) + (if (looking-at re) + (match-string 2) + ""))) + elt) + ;; Map interpreter name to a mode. + (setq elt (assoc (file-name-nondirectory interpreter) + py-shell-alist)) + (and elt (caddr elt)))) + + + + (defun py-choose-shell-by-import () + "Choose CPython or JPython mode based imports. + If a file imports any packages in `py-jpython-packages', within + `py-import-check-point-max' characters from the start of the file, + return `jpython', otherwise return nil." + (let (mode) + (save-excursion + (goto-char (point-min)) + (while (and (not mode) + (search-forward-regexp + "^\\(\\(from\\)\\|\\(import\\)\\) \\([^ \t\n.]+\\)" + py-import-check-point-max t)) + (setq mode (and (member (match-string 4) py-jpython-packages) + 'jpython + )))) + mode)) + + + (defun py-choose-shell () + "Choose CPython or JPython mode. Returns the appropriate mode function. + This does the following: + - look for an interpreter with `py-choose-shell-by-shebang' + - examine imports using `py-choose-shell-by-import' + - default to the variable `py-default-interpreter'" + (interactive) + (or (py-choose-shell-by-shebang) + (py-choose-shell-by-import) + py-default-interpreter + ; 'cpython ;; don't use to py-default-interpreter, because default + ; ;; is only way to choose CPython + )) + ;;;###autoload *************** *** 1039,1044 **** ;; Set the default shell if not already set (when (null py-which-shell) ! (py-toggle-shells py-default-interpreter)) ! ) --- 1124,1160 ---- ;; Set the default shell if not already set (when (null py-which-shell) ! (py-toggle-shells (py-choose-shell)))) ! ! ! (defun jpython-mode () ! "Major mode for editing JPython/Jython files. ! This is a simple wrapper around `python-mode'. ! It runs `jpython-mode-hook' then calls `python-mode.' ! It is added to `interpreter-mode-alist' and `py-choose-shell'. ! " ! (interactive) ! (python-mode) ! (py-toggle-shells 'jpython) ! (when jpython-mode-hook ! (run-hooks 'jpython-mode-hook))) ! ! ! ;; It's handy to add recognition of Python files to the ! ;; interpreter-mode-alist and to auto-mode-alist. With the former, we ! ;; can specify different `derived-modes' based on the #! line, but ! ;; with the latter, we can't. So we just won't add them if they're ! ;; already added. ! (let ((modes '(("jpython" . jpython-mode) ! ("jython" . jpython-mode) ! ("python" . python-mode)))) ! (while modes ! (when (not (assoc (car modes) interpreter-mode-alist)) ! (push modes interpreter-mode-alist)) ! (setq modes (cdr modes)))) ! ! (when (not (or (rassq 'python-mode auto-mode-alist) ! (rassq 'jpython-mode auto-mode-alist))) ! (push '("\\.py$" . python-mode) auto-mode-alist)) ! *************** *** 1413,1421 **** ;; Set the shell either to the #! line command, or to the ;; py-which-shell buffer local variable. ! (goto-char (point-min)) ! (if (looking-at "^#!\\s *\\(.*\\)$") ! (setq shell (match-string 1)) ! ;; No useable #! line ! (setq shell py-which-shell)))) (cond ;; always run the code in its own asynchronous subprocess --- 1529,1535 ---- ;; Set the shell either to the #! line command, or to the ;; py-which-shell buffer local variable. ! (setq shell (or (py-choose-shell-by-shebang) ! (py-choose-shell-by-import) ! py-which-shell)))) (cond ;; always run the code in its own asynchronous subprocess From bwarsaw@sourceforge.net Thu Apr 25 22:46:35 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Thu, 25 Apr 2002 14:46:35 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.17,4.18 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29605 Modified Files: python-mode.el Log Message: Fix typo in the setup of interpreter-mode-alist. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.17 retrieving revision 4.18 diff -C2 -d -r4.17 -r4.18 *** python-mode.el 25 Apr 2002 21:31:47 -0000 4.17 --- python-mode.el 25 Apr 2002 21:46:33 -0000 4.18 *************** *** 1150,1154 **** (while modes (when (not (assoc (car modes) interpreter-mode-alist)) ! (push modes interpreter-mode-alist)) (setq modes (cdr modes)))) --- 1150,1154 ---- (while modes (when (not (assoc (car modes) interpreter-mode-alist)) ! (push (car modes) interpreter-mode-alist)) (setq modes (cdr modes)))) From gvanrossum@sourceforge.net Fri Apr 26 01:53:36 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Thu, 25 Apr 2002 17:53:36 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4281 Modified Files: intobject.c Log Message: Make sure that tp_free frees the int the same way as tp_dealloc would. This fixes the problem that Barry reported on python-dev: >>> 23000 .__class__ = bool crashes in the deallocator. This was because int inherited tp_free from object, which uses the default allocator. 2.2. Bugfix candidate. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -d -r2.81 -r2.82 *** intobject.c 3 Apr 2002 22:41:51 -0000 2.81 --- intobject.c 26 Apr 2002 00:53:34 -0000 2.82 *************** *** 131,134 **** --- 131,141 ---- } + static void + int_free(PyIntObject *v) + { + v->ob_type = (struct _typeobject *)free_list; + free_list = v; + } + long PyInt_AsLong(register PyObject *op) *************** *** 906,909 **** --- 913,917 ---- 0, /* tp_alloc */ int_new, /* tp_new */ + (freefunc)int_free, /* tp_free */ }; From nascheme@sourceforge.net Fri Apr 26 02:57:21 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 25 Apr 2002 18:57:21 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.241,2.242 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24670/Python Modified Files: compile.c Log Message: If Py_OptimizeFlag is false then always evaluate assert conditions, don't test __debug__ at runtime. Closes SF patch #548833. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.241 retrieving revision 2.242 diff -C2 -d -r2.241 -r2.242 *** compile.c 22 Apr 2002 02:33:27 -0000 2.241 --- compile.c 26 Apr 2002 01:57:19 -0000 2.242 *************** *** 2665,2689 **** com_assert_stmt(struct compiling *c, node *n) { ! int a = 0, b = 0; int i; REQ(n, assert_stmt); /* 'assert' test [',' test] */ ! /* Generate code like for ! if __debug__: ! if not : raise AssertionError [, ] where is the second test, if present. */ - - if (Py_OptimizeFlag) - return; - com_addop_name(c, LOAD_GLOBAL, "__debug__"); - com_push(c, 1); - com_addfwref(c, JUMP_IF_FALSE, &a); - com_addbyte(c, POP_TOP); - com_pop(c, 1); com_node(c, CHILD(n, 1)); ! com_addfwref(c, JUMP_IF_TRUE, &b); com_addbyte(c, POP_TOP); com_pop(c, 1); --- 2665,2682 ---- com_assert_stmt(struct compiling *c, node *n) { ! int a = 0; int i; REQ(n, assert_stmt); /* 'assert' test [',' test] */ ! if (Py_OptimizeFlag) ! return; ! /* Generate code like ! if not : raise AssertionError [, ] where is the second test, if present. */ com_node(c, CHILD(n, 1)); ! com_addfwref(c, JUMP_IF_TRUE, &a); com_addbyte(c, POP_TOP); com_pop(c, 1); *************** *** 2697,2703 **** com_pop(c, i); /* The interpreter does not fall through */ ! /* All jumps converge here */ com_backpatch(c, a); - com_backpatch(c, b); com_addbyte(c, POP_TOP); } --- 2690,2695 ---- com_pop(c, i); /* The interpreter does not fall through */ ! /* Jump ends up here */ com_backpatch(c, a); com_addbyte(c, POP_TOP); } From nascheme@sourceforge.net Fri Apr 26 02:58:55 2002 From: nascheme@sourceforge.net (nascheme@sourceforge.net) Date: Thu, 25 Apr 2002 18:58:55 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.393,1.394 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25040/Misc Modified Files: NEWS Log Message: If Py_OptimizeFlag is false then always evaluate assert conditions, don't test __debug__ at runtime. Closes SF patch #548833. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.393 retrieving revision 1.394 diff -C2 -d -r1.393 -r1.394 *** NEWS 23 Apr 2002 13:29:43 -0000 1.393 --- NEWS 26 Apr 2002 01:58:53 -0000 1.394 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - The assert statement no longer tests __debug__ at runtime. This means + that assert statements cannot be disabled by assigning a false value + to __debug__. + - A method zfill() was added to str and unicode, that fills a numeric string to the left with zeros. For example, From fdrake@sourceforge.net Fri Apr 26 03:29:57 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Thu, 25 Apr 2002 19:29:57 -0700 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.40,1.41 Cookie.py,1.11,1.12 inspect.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv381/Lib Modified Files: ConfigParser.py Cookie.py inspect.py Log Message: Clean up uses of some deprecated features. Reported by Neal Norwitz on python-dev. Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ConfigParser.py 4 Apr 2002 22:55:58 -0000 1.40 --- ConfigParser.py 26 Apr 2002 02:29:55 -0000 1.41 *************** *** 302,309 **** def getint(self, section, option): ! return self.__get(section, string.atoi, option) def getfloat(self, section, option): ! return self.__get(section, string.atof, option) def getboolean(self, section, option): --- 302,309 ---- def getint(self, section, option): ! return self.__get(section, int, option) def getfloat(self, section, option): ! return self.__get(section, float, option) def getboolean(self, section, option): Index: Cookie.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Cookie.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Cookie.py 2 Aug 2001 07:15:29 -0000 1.11 --- Cookie.py 26 Apr 2002 02:29:55 -0000 1.12 *************** *** 232,235 **** --- 232,238 ---- "SmartCookie","Cookie"] + _nulljoin = ''.join + _spacejoin = ' '.join + # # Define an exception visible to External modules *************** *** 312,316 **** def _quote(str, LegalChars=_LegalChars, ! join=string.join, idmap=string._idmap, translate=string.translate): # # If the string does not need to be double-quoted, --- 315,319 ---- def _quote(str, LegalChars=_LegalChars, ! idmap=string._idmap, translate=string.translate): # # If the string does not need to be double-quoted, *************** *** 322,326 **** return str else: ! return '"' + join( map(_Translator.get, str, str), "" ) + '"' # end _quote --- 325,329 ---- return str else: ! return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"' # end _quote *************** *** 329,333 **** _QuotePatt = re.compile(r"[\\].") ! def _unquote(str, join=string.join, atoi=string.atoi): # If there aren't any doublequotes, # then there can't be any special characters. See RFC 2109. --- 332,336 ---- _QuotePatt = re.compile(r"[\\].") ! def _unquote(str): # If there aren't any doublequotes, # then there can't be any special characters. See RFC 2109. *************** *** 366,372 **** else: # OctalPatt matched res.append(str[i:j]) ! res.append( chr( atoi(str[j+1:j+4], 8) ) ) i = j+4 ! return join(res, "") # end _unquote --- 369,375 ---- else: # OctalPatt matched res.append(str[i:j]) ! res.append( chr( int(str[j+1:j+4], 8) ) ) i = j+4 ! return _nulljoin(res) # end _unquote *************** *** 436,440 **** def __setitem__(self, K, V): ! K = string.lower(K) if not K in self._reserved_keys: raise CookieError("Invalid Attribute %s" % K) --- 439,443 ---- def __setitem__(self, K, V): ! K = K.lower() if not K in self._reserved_keys: raise CookieError("Invalid Attribute %s" % K) *************** *** 443,447 **** def isReservedKey(self, K): ! return string.lower(K) in self._reserved_keys # end isReservedKey --- 446,450 ---- def isReservedKey(self, K): ! return K.lower() in self._reserved_keys # end isReservedKey *************** *** 451,455 **** # First we verify that the key isn't a reserved word # Second we make sure it only contains legal characters ! if string.lower(key) in self._reserved_keys: raise CookieError("Attempt to set a reserved key: %s" % key) if "" != translate(key, idmap, LegalChars): --- 454,458 ---- # First we verify that the key isn't a reserved word # Second we make sure it only contains legal characters ! if key.lower() in self._reserved_keys: raise CookieError("Attempt to set a reserved key: %s" % key) if "" != translate(key, idmap, LegalChars): *************** *** 509,513 **** # Return the result ! return string.join(result, " ") # end OutputString # end Morsel class --- 512,516 ---- # Return the result ! return _spacejoin(result) # end OutputString # end Morsel class *************** *** 593,597 **** for K,V in items: result.append( V.output(attrs, header) ) ! return string.join(result, sep) # end output --- 596,600 ---- for K,V in items: result.append( V.output(attrs, header) ) ! return sep.join(result) # end output *************** *** 604,608 **** for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) ! return '<%s: %s>' % (self.__class__.__name__, string.join(L)) def js_output(self, attrs=None): --- 607,611 ---- for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) ! return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) def js_output(self, attrs=None): *************** *** 613,617 **** for K,V in items: result.append( V.js_output(attrs) ) ! return string.join(result, "") # end js_output --- 616,620 ---- for K,V in items: result.append( V.js_output(attrs) ) ! return _nulljoin(result) # end js_output *************** *** 649,653 **** if M: M[ K[1:] ] = V ! elif string.lower(K) in Morsel._reserved_keys: if M: M[ K ] = _unquote(V) --- 652,656 ---- if M: M[ K[1:] ] = V ! elif K.lower() in Morsel._reserved_keys: if M: M[ K ] = _unquote(V) Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** inspect.py 28 Mar 2002 23:01:56 -0000 1.31 --- inspect.py 26 Apr 2002 02:29:55 -0000 1.32 *************** *** 770,774 **** 1/0 except ZeroDivisionError: ! return sys.exc_traceback.tb_frame.f_back if hasattr(sys, '_getframe'): currentframe = sys._getframe --- 770,774 ---- 1/0 except ZeroDivisionError: ! return sys.exc_info()[2].tb_frame.f_back if hasattr(sys, '_getframe'): currentframe = sys._getframe *************** *** 780,782 **** def trace(context=1): """Return a list of records for the stack below the current exception.""" ! return getinnerframes(sys.exc_traceback, context) --- 780,782 ---- def trace(context=1): """Return a list of records for the stack below the current exception.""" ! return getinnerframes(sys.exc_info()[2], context) From gvanrossum@sourceforge.net Fri Apr 26 03:46:03 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Thu, 25 Apr 2002 19:46:03 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.172,2.173 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4739 Modified Files: object.c Log Message: PyNumber_CoerceEx: this took a shortcut (not doing anything) when the left and right type were of the same type and not classic instances. This shortcut is dangerous for proxy types, because it means that coerce(Proxy(1), Proxy(2.1)) leaves Proxy(1) unchanged rather than turning it into Proxy(1.0). In an ever-so-slight change of semantics, I now only take the shortcut when the left and right types are of the same type and don't have the CHECKTYPES feature. It so happens that classic instances have this flag, so the shortcut is still skipped in this case (i.e. nothing changes for classic instances). Proxies also have this flag set (otherwise implementing numeric operations on proxies would become nightmarish) and this means that the shortcut is also skipped there, as desired. It so happens that int, long and float also have this flag set; that means that e.g. coerce(1, 1) will now invoke int_coerce(). This is fine: int_coerce() can deal with this, and I'm not worried about the performance; int_coerce() is only invoked when the user explicitly calls coerce(), which should be rarer than rare. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.172 retrieving revision 2.173 diff -C2 -d -r2.172 -r2.173 *** object.c 12 Apr 2002 07:22:56 -0000 2.172 --- object.c 26 Apr 2002 02:46:00 -0000 2.173 *************** *** 1428,1432 **** int res; ! if (v->ob_type == w->ob_type && !PyInstance_Check(v)) { Py_INCREF(v); Py_INCREF(w); --- 1428,1435 ---- int res; ! /* Shortcut only for old-style types */ ! if (v->ob_type == w->ob_type && ! !PyType_HasFeature(v->ob_type, Py_TPFLAGS_CHECKTYPES)) ! { Py_INCREF(v); Py_INCREF(w); From gvanrossum@sourceforge.net Fri Apr 26 03:49:17 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Thu, 25 Apr 2002 19:49:17 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.394,1.395 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5603 Modified Files: NEWS Log Message: PyNumber_CoerceEx: this took a shortcut (not doing anything) when the left and right type were of the same type and not classic instances. This shortcut is dangerous for proxy types, because it means that coerce(Proxy(1), Proxy(2.1)) leaves Proxy(1) unchanged rather than turning it into Proxy(1.0). In an ever-so-slight change of semantics, I now only take the shortcut when the left and right types are of the same type and don't have the CHECKTYPES feature. It so happens that classic instances have this flag, so the shortcut is still skipped in this case (i.e. nothing changes for classic instances). Proxies also have this flag set (otherwise implementing numeric operations on proxies would become nightmarish) and this means that the shortcut is also skipped there, as desired. It so happens that int, long and float also have this flag set; that means that e.g. coerce(1, 1) will now invoke int_coerce(). This is fine: int_coerce() can deal with this, and I'm not worried about the performance; int_coerce() is only invoked when the user explicitly calls coerce(), which should be rarer than rare. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.394 retrieving revision 1.395 diff -C2 -d -r1.394 -r1.395 *** NEWS 26 Apr 2002 01:58:53 -0000 1.394 --- NEWS 26 Apr 2002 02:49:14 -0000 1.395 *************** *** 164,167 **** --- 164,171 ---- C API + - PyNumber_Coerce() and PyNumber_CoerceEx() now also invoke the type's + coercion if both arguments have the same type but this type has the + CHECKTYPES flag set. This is to better support proxies. + - The type of tp_free has been changed from "void (*)(PyObject *)" to "void (*)(void *)". From anthonybaxter@sourceforge.net Fri Apr 26 07:31:24 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Thu, 25 Apr 2002 23:31:24 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.79.6.1,2.79.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16181/Objects Modified Files: Tag: release22-maint intobject.c Log Message: backport gvanrossum's patch: Make sure that tp_free frees the int the same way as tp_dealloc would. This fixes the problem that Barry reported on python-dev: >>> 23000 .__class__ = bool crashes in the deallocator. This was because int inherited tp_free from object, which uses the default allocator. 2.2. Bugfix candidate. (trivial change in backport: "freefunc" -> "destructor") Original patch(es): python/dist/src/Objects/intobject.c:2.82 Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.79.6.1 retrieving revision 2.79.6.2 diff -C2 -d -r2.79.6.1 -r2.79.6.2 *** intobject.c 19 Feb 2002 14:17:02 -0000 2.79.6.1 --- intobject.c 26 Apr 2002 06:31:22 -0000 2.79.6.2 *************** *** 143,146 **** --- 143,153 ---- } + static void + int_free(PyIntObject *v) + { + v->ob_type = (struct _typeobject *)free_list; + free_list = v; + } + long PyInt_AsLong(register PyObject *op) *************** *** 918,921 **** --- 925,929 ---- 0, /* tp_alloc */ int_new, /* tp_new */ + (destructor)int_free, /* tp_free */ }; From bwarsaw@sourceforge.net Fri Apr 26 16:49:54 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Fri, 26 Apr 2002 08:49:54 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.18,4.19 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28450 Modified Files: python-mode.el Log Message: (py-comint-output-filter-function): Put the pop-to-buffer call inside the `when' condition so other non-Python shell comint changes won't cause random buffers to pop. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.18 retrieving revision 4.19 diff -C2 -d -r4.18 -r4.19 *** python-mode.el 25 Apr 2002 21:46:33 -0000 4.18 --- python-mode.el 26 Apr 2002 15:49:52 -0000 4.19 *************** *** 1240,1248 **** This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string - (pop-to-buffer (current-buffer)) (when (and (or (string-equal string ">>> ") (and (>= (length string) 5) (string-equal (substring string -5) "\n>>> "))) py-file-queue) (py-safe (delete-file (car py-file-queue))) (setq py-file-queue (cdr py-file-queue)) --- 1240,1248 ---- This function is appropriate for `comint-output-filter-functions'." ;; TBD: this should probably use split-string (when (and (or (string-equal string ">>> ") (and (>= (length string) 5) (string-equal (substring string -5) "\n>>> "))) py-file-queue) + (pop-to-buffer (current-buffer)) (py-safe (delete-file (car py-file-queue))) (setq py-file-queue (cdr py-file-queue)) From fdrake@sourceforge.net Fri Apr 26 21:29:46 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:29:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.104,1.105 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6261/lib Modified Files: libfuncs.tex Log Message: Documentation for the enumerate() function/type. This closes SF patch #547162. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** libfuncs.tex 17 Apr 2002 12:54:04 -0000 1.104 --- libfuncs.tex 26 Apr 2002 20:29:44 -0000 1.105 *************** *** 262,265 **** --- 262,277 ---- \end{funcdesc} + \begin{funcdesc}{enumerate}{iterable} + Return an enumerate object. \var{iterable} must be a sequence, an + iterator, or some other object which supports iteration. The + \method{next()} method of the iterator returned by + \function{enumerate()} returns a tuple containing a count (from + zero) and the corresponding value obtained from iterating over + \var{iterable}. \function{enumerate} is useful for obtaining an + indexed series: \code{(0, seq[0])}, \code{(1, seq[1])}, \code{(2, + seq[2])}, \ldots. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{eval}{expression\optional{, globals\optional{, locals}}} The arguments are a string and two optional dictionaries. The From fdrake@sourceforge.net Fri Apr 26 21:29:46 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:29:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv6261/tut Modified Files: tut.tex Log Message: Documentation for the enumerate() function/type. This closes SF patch #547162. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** tut.tex 8 Mar 2002 00:54:43 -0000 1.159 --- tut.tex 26 Apr 2002 20:29:44 -0000 1.160 *************** *** 2015,2018 **** --- 2015,2061 ---- \end{verbatim} + + \section{Looping Techniques \label{loopidioms}} + + When looping through dictionaries, the key and corresponding value can + be retrieved at the same time using the \method{items()} method. + + \begin{verbatim} + >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} + >>> for k, v in knights.items(): + ... print k, v + ... + gallahad the pure + robin the brave + \end{verbatim} + + When looping through a sequence, the position index and corresponding + value can be retrieved at the same time using the + \function{enumerate()} function. + + \begin{verbatim} + >>> for i, v in enumerate(['tic', 'tac', 'toe']): + ... print i, v + ... + 0 tic + 1 tac + 2 toe + \end{verbatim} + + To loop over two or more sequences at the same time, the entries + can be paired with the \function{zip()} function. + + \begin{verbatim} + >>> questions = ['name', 'quest', 'favorite color'] + >>> answers = ['lancelot', 'the holy grail', 'blue'] + >>> for q, a in zip(questions, answers): + ... print 'What is your %s? It is %s.' % (q, a) + ... + What is your name ? It is lancelot . + What is your quest ? It is the holy grail . + What is your favorite color ? It is blue . + \end{verbatim} + + \section{More on Conditions \label{conditions}} From gvanrossum@sourceforge.net Fri Apr 26 20:41:00 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 12:41:00 -0700 Subject: [Python-checkins] python/dist/src/Include enumobject.h,NONE,2.1 Python.h,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23330/Include Modified Files: Python.h Added Files: enumobject.h Log Message: - New builtin function enumerate(x), from PEP 279. Example: enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object. --- NEW FILE: enumobject.h --- #ifndef Py_ENUMOBJECT_H #define Py_ENUMOBJECT_H /* Enumerate Object */ #ifdef __cplusplus extern "C" { #endif extern DL_IMPORT(PyTypeObject) PyEnum_Type; #ifdef __cplusplus } #endif #endif /* !Py_ENUMOBJECT_H */ Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** Python.h 3 Apr 2002 22:41:50 -0000 2.45 --- Python.h 26 Apr 2002 19:40:56 -0000 2.46 *************** *** 92,95 **** --- 92,96 ---- #include "listobject.h" #include "dictobject.h" + #include "enumobject.h" #include "methodobject.h" #include "moduleobject.h" From gvanrossum@sourceforge.net Fri Apr 26 20:41:00 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 12:41:00 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.251,2.252 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv23330/Python Modified Files: bltinmodule.c Log Message: - New builtin function enumerate(x), from PEP 279. Example: enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.251 retrieving revision 2.252 diff -C2 -d -r2.251 -r2.252 *** bltinmodule.c 14 Apr 2002 20:12:41 -0000 2.251 --- bltinmodule.c 26 Apr 2002 19:40:55 -0000 2.252 *************** *** 1865,1868 **** --- 1865,1869 ---- #endif SETBUILTIN("dict", &PyDict_Type); + SETBUILTIN("enumerate", &PyEnum_Type); SETBUILTIN("float", &PyFloat_Type); SETBUILTIN("property", &PyProperty_Type); From gvanrossum@sourceforge.net Fri Apr 26 20:41:26 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 12:41:26 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.395,1.396 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23330/Misc Modified Files: NEWS Log Message: - New builtin function enumerate(x), from PEP 279. Example: enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.395 retrieving revision 1.396 diff -C2 -d -r1.395 -r1.396 *** NEWS 26 Apr 2002 02:49:14 -0000 1.395 --- NEWS 26 Apr 2002 19:40:49 -0000 1.396 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - New builtin function enumerate(x), from PEP 279. Example: + enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). + The argument can be an arbitrary iterable object. + - The assert statement no longer tests __debug__ at runtime. This means that assert statements cannot be disabled by assigning a false value From gvanrossum@sourceforge.net Fri Apr 26 20:41:26 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 12:41:26 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv23330 Modified Files: Makefile.pre.in Log Message: - New builtin function enumerate(x), from PEP 279. Example: enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** Makefile.pre.in 22 Apr 2002 03:05:25 -0000 1.81 --- Makefile.pre.in 26 Apr 2002 19:40:53 -0000 1.82 *************** *** 258,261 **** --- 258,262 ---- Objects/complexobject.o \ Objects/descrobject.o \ + Objects/enumobject.o \ Objects/fileobject.o \ Objects/floatobject.o \ *************** *** 444,447 **** --- 445,449 ---- Include/descrobject.h \ Include/dictobject.h \ + Include/enumobject.h \ Include/fileobject.h \ Include/floatobject.h \ From gvanrossum@sourceforge.net Fri Apr 26 21:11:33 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 13:11:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.396,1.397 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv657 Modified Files: NEWS Log Message: Clarify that the strip changes also apply to Unicode. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.396 retrieving revision 1.397 diff -C2 -d -r1.396 -r1.397 *** NEWS 26 Apr 2002 19:40:49 -0000 1.396 --- NEWS 26 Apr 2002 20:11:29 -0000 1.397 *************** *** 23,29 **** deprecated now. ! - String methods lstrip(), rstrip() and strip() now take an optional ! argument that specifies the characters to strip. For example, ! "Foo!!!?!?!?".rstrip("?!") -> "Foo". - Added a new dict method pop(key). This removes and returns the --- 23,29 ---- deprecated now. ! - String and unicode methods lstrip(), rstrip() and strip() now take ! an optional argument that specifies the characters to strip. For ! example, "Foo!!!?!?!?".rstrip("?!") -> "Foo". - Added a new dict method pop(key). This removes and returns the From gvanrossum@sourceforge.net Fri Apr 26 20:40:57 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 12:40:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_enumerate.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23330/Lib/test Added Files: test_enumerate.py Log Message: - New builtin function enumerate(x), from PEP 279. Example: enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object. --- NEW FILE: test_enumerate.py --- from __future__ import generators import unittest import test_support seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] class G: 'Sequence using __getitem__' def __init__(self, seqn): self.seqn = seqn def __getitem__(self, i): return self.seqn[i] class I: 'Sequence using iterator protocol' def __init__(self, seqn): self.seqn = seqn self.i = 0 def __iter__(self): return self def next(self): if self.i >= len(self.seqn): raise StopIteration v = self.seqn[self.i] self.i += 1 return v class Ig: 'Sequence using iterator protocol defined with a generator' def __init__(self, seqn): self.seqn = seqn self.i = 0 def __iter__(self): for val in self.seqn: yield val class X: 'Missing __getitem__ and __iter__' def __init__(self, seqn): self.seqn = seqn self.i = 0 def next(self): if self.i >= len(self.seqn): raise StopIteration v = self.seqn[self.i] self.i += 1 return v class E: 'Test propagation of exceptions' def __init__(self, seqn): self.seqn = seqn self.i = 0 def __iter__(self): return self def next(self): 3/0 class N: 'Iterator missing next()' def __init__(self, seqn): self.seqn = seqn self.i = 0 def __iter__(self): return self class EnumerateTestCase(unittest.TestCase): enum = enumerate def test_basicfunction(self): self.assertEqual(type(self.enum(seq)), self.enum) e = self.enum(seq) self.assertEqual(iter(e), e) self.assertEqual(list(self.enum(seq)), res) self.enum.__doc__ def test_getitemseqn(self): self.assertEqual(list(self.enum(G(seq))), res) e = self.enum(G('')) self.assertRaises(StopIteration, e.next) def test_iteratorseqn(self): self.assertEqual(list(self.enum(I(seq))), res) e = self.enum(I('')) self.assertRaises(StopIteration, e.next) def test_iteratorgenerator(self): self.assertEqual(list(self.enum(Ig(seq))), res) e = self.enum(Ig('')) self.assertRaises(StopIteration, e.next) def test_noniterable(self): self.assertRaises(TypeError, self.enum, X(seq)) def test_illformediterable(self): self.assertRaises(TypeError, list, self.enum(N(seq))) def test_exception_propagation(self): self.assertRaises(ZeroDivisionError, list, self.enum(E(seq))) class MyEnum(enumerate): pass class SubclassTestCase(EnumerateTestCase): enum = MyEnum def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(EnumerateTestCase)) suite.addTest(unittest.makeSuite(SubclassTestCase)) return suite def test_main(): test_support.run_suite(suite()) if __name__ == "__main__": test_main() From gvanrossum@sourceforge.net Fri Apr 26 20:40:56 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Fri, 26 Apr 2002 12:40:56 -0700 Subject: [Python-checkins] python/dist/src/Objects enumobject.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23330/Objects Added Files: enumobject.c Log Message: - New builtin function enumerate(x), from PEP 279. Example: enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c"). The argument can be an arbitrary iterable object. --- NEW FILE: enumobject.c --- /* enumerate object */ #include "Python.h" typedef struct { PyObject_HEAD long en_index; /* current index of enumeration */ PyObject* en_sit; /* secondary iterator of enumeration */ } enumobject; PyTypeObject PyEnum_Type; static PyObject * enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { enumobject *en; PyObject *seq = NULL; static char *kwlist[] = {"sequence", 0}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:enumerate", kwlist, &seq)) return NULL; en = (enumobject *)type->tp_alloc(type, 0); if (en == NULL) return NULL; en->en_index = 0; en->en_sit = PyObject_GetIter(seq); if (en->en_sit == NULL) { Py_DECREF(en); return NULL; } return (PyObject *)en; } static void enum_dealloc(enumobject *en) { PyObject_GC_UnTrack(en); Py_XDECREF(en->en_sit); en->ob_type->tp_free(en); } static int enum_traverse(enumobject *en, visitproc visit, void *arg) { if (en->en_sit) return visit(en->en_sit, arg); return 0; } static PyObject * enum_next(enumobject *en) { PyObject *result; PyObject *next_index; PyObject *next_item = PyIter_Next(en->en_sit); if (next_item == NULL) return NULL; result = PyTuple_New(2); if (result == NULL) { Py_DECREF(next_item); return NULL; } next_index = PyInt_FromLong(en->en_index++); if (next_index == NULL) { Py_DECREF(next_item); Py_DECREF(result); return NULL; } PyTuple_SET_ITEM(result, 0, next_index); PyTuple_SET_ITEM(result, 1, next_item); return result; } static PyObject * enum_getiter(PyObject *en) { Py_INCREF(en); return en; } static PyMethodDef enum_methods[] = { {"next", (PyCFunction)enum_next, METH_NOARGS, "return the next (index, value) pair, or raise StopIteration"}, {NULL, NULL} /* sentinel */ }; static char enum_doc[] = "enumerate(iterable) -> create an enumerating-iterator"; PyTypeObject PyEnum_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "enumerate", /* tp_name */ sizeof(enumobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)enum_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, /* tp_flags */ enum_doc, /* tp_doc */ (traverseproc)enum_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)enum_getiter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ enum_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ enum_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ }; From fdrake@sourceforge.net Fri Apr 26 21:44:01 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:44:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.35,1.35.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10684/lib Modified Files: Tag: release22-maint libcgi.tex Log Message: Be more consistent, both internally and with recommended practice. This closes SF bug #547953. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.35 retrieving revision 1.35.4.1 diff -C2 -d -r1.35 -r1.35.4.1 *** libcgi.tex 20 Dec 2001 17:13:09 -0000 1.35 --- libcgi.tex 26 Apr 2002 20:43:59 -0000 1.35.4.1 *************** *** 136,140 **** If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{type()} built-in function to determine whether you have a single instance or a list of instances. For example, this code concatenates any number of username fields, separated by --- 136,140 ---- If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{isinstance()} built-in function to determine whether you have a single instance or a list of instances. For example, this code concatenates any number of username fields, separated by *************** *** 142,149 **** \begin{verbatim} - from types import ListType - value = form.getvalue("username", "") ! if isinstance(value, ListType): # Multiple username fields specified usernames = ",".join(value) --- 142,147 ---- \begin{verbatim} value = form.getvalue("username", "") ! if isinstance(value, list): # Multiple username fields specified usernames = ",".join(value) From fdrake@sourceforge.net Fri Apr 26 21:44:16 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:44:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10747/lib Modified Files: libcgi.tex Log Message: Be more consistent, both internally and with recommended practice. This closes SF bug #547953. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** libcgi.tex 20 Dec 2001 17:13:09 -0000 1.35 --- libcgi.tex 26 Apr 2002 20:44:14 -0000 1.36 *************** *** 136,140 **** If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{type()} built-in function to determine whether you have a single instance or a list of instances. For example, this code concatenates any number of username fields, separated by --- 136,140 ---- If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{isinstance()} built-in function to determine whether you have a single instance or a list of instances. For example, this code concatenates any number of username fields, separated by *************** *** 142,149 **** \begin{verbatim} - from types import ListType - value = form.getvalue("username", "") ! if isinstance(value, ListType): # Multiple username fields specified usernames = ",".join(value) --- 142,147 ---- \begin{verbatim} value = form.getvalue("username", "") ! if isinstance(value, list): # Multiple username fields specified usernames = ",".join(value) From fdrake@sourceforge.net Fri Apr 26 21:45:40 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:45:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.28.6.1,1.28.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11080/lib Modified Files: Tag: release21-maint libcgi.tex Log Message: Be more consistent, both internally and with recommended practice (within the limits of Python 2.1). This closes SF bug #547953. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.28.6.1 retrieving revision 1.28.6.2 diff -C2 -d -r1.28.6.1 -r1.28.6.2 *** libcgi.tex 29 Jun 2001 15:00:34 -0000 1.28.6.1 --- libcgi.tex 26 Apr 2002 20:45:38 -0000 1.28.6.2 *************** *** 112,125 **** instance but a list of such instances. Similarly, in this situation, \samp{form.getvalue(\var{key})} would return a list of strings. ! If you expect this possibility ! (i.e., when your HTML form contains multiple fields with the same ! name), use the \function{type()} function to determine whether you ! have a single instance or a list of instances. For example, here's ! code that concatenates any number of username fields, separated by ! commas: \begin{verbatim} value = form.getvalue("username", "") ! if type(value) is type([]): # Multiple username fields specified usernames = ",".join(value) --- 112,126 ---- instance but a list of such instances. Similarly, in this situation, \samp{form.getvalue(\var{key})} would return a list of strings. ! If you expect this possibility (i.e., when your HTML form contains ! multiple fields with the same name), use the \function{isinstance()} ! built-in function to determine whether you have a single instance or a ! list of instances. For example, here's code that concatenates any ! number of username fields, separated by commas: \begin{verbatim} + from types import ListType + value = form.getvalue("username", "") ! if isinstance(value, ListType): # Multiple username fields specified usernames = ",".join(value) From fdrake@sourceforge.net Fri Apr 26 21:59:42 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:59:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14866/lib Modified Files: libos.tex Log Message: Slightly expand and clarify the differences between getegid(), getgid(), getpgrp(), and setpgid(). This closes SF bug #547939. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** libos.tex 23 Apr 2002 15:58:02 -0000 1.82 --- libos.tex 26 Apr 2002 20:59:40 -0000 1.83 *************** *** 115,119 **** \begin{funcdesc}{getegid}{} ! Return the current process' effective group id. Availability: \UNIX. \end{funcdesc} --- 115,121 ---- \begin{funcdesc}{getegid}{} ! Return the effective group id of the current process. This ! corresponds to the `set id' bit on the file being executed in the ! current process. Availability: \UNIX. \end{funcdesc} *************** *** 127,131 **** \begin{funcdesc}{getgid}{} \index{process!group} ! Return the current process' group id. Availability: \UNIX. \end{funcdesc} --- 129,133 ---- \begin{funcdesc}{getgid}{} \index{process!group} ! Return the real group id of the current process. Availability: \UNIX. \end{funcdesc} *************** *** 145,149 **** \begin{funcdesc}{getpgrp}{} \index{process!group} ! Return the current process group id. Availability: \UNIX. \end{funcdesc} --- 147,151 ---- \begin{funcdesc}{getpgrp}{} \index{process!group} ! Return the id of the current process group. Availability: \UNIX. \end{funcdesc} *************** *** 220,226 **** \end{funcdesc} ! \begin{funcdesc}{setpgid}{pid, pgrp} ! Calls the system call \cfunction{setpgid()}. See the \UNIX{} manual ! for the semantics. Availability: \UNIX. \end{funcdesc} --- 222,229 ---- \end{funcdesc} ! \begin{funcdesc}{setpgid}{pid, pgrp} Calls the system call ! \cfunction{setpgid()} to set the process group id of the process with ! id \var{pid} to the process group with id \var{pgrp}. See the \UNIX{} ! manual for the semantics. Availability: \UNIX. \end{funcdesc} From fdrake@sourceforge.net Fri Apr 26 21:59:57 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Fri, 26 Apr 2002 13:59:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.74.2.1.2.1,1.74.2.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14914/lib Modified Files: Tag: release22-maint libos.tex Log Message: Slightly expand and clarify the differences between getegid(), getgid(), getpgrp(), and setpgid(). This closes SF bug #547939. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.1 retrieving revision 1.74.2.1.2.2 diff -C2 -d -r1.74.2.1.2.1 -r1.74.2.1.2.2 *** libos.tex 1 Apr 2002 23:29:02 -0000 1.74.2.1.2.1 --- libos.tex 26 Apr 2002 20:59:55 -0000 1.74.2.1.2.2 *************** *** 114,118 **** \begin{funcdesc}{getegid}{} ! Return the current process' effective group id. Availability: \UNIX. \end{funcdesc} --- 114,120 ---- \begin{funcdesc}{getegid}{} ! Return the effective group id of the current process. This ! corresponds to the `set id' bit on the file being executed in the ! current process. Availability: \UNIX. \end{funcdesc} *************** *** 126,130 **** \begin{funcdesc}{getgid}{} \index{process!group} ! Return the current process' group id. Availability: \UNIX. \end{funcdesc} --- 128,132 ---- \begin{funcdesc}{getgid}{} \index{process!group} ! Return the real group id of the current process. Availability: \UNIX. \end{funcdesc} *************** *** 144,148 **** \begin{funcdesc}{getpgrp}{} \index{process!group} ! Return the current process group id. Availability: \UNIX. \end{funcdesc} --- 146,150 ---- \begin{funcdesc}{getpgrp}{} \index{process!group} ! Return the id of the current process group. Availability: \UNIX. \end{funcdesc} *************** *** 219,225 **** \end{funcdesc} ! \begin{funcdesc}{setpgid}{pid, pgrp} ! Calls the system call \cfunction{setpgid()}. See the \UNIX{} manual ! for the semantics. Availability: \UNIX. \end{funcdesc} --- 221,228 ---- \end{funcdesc} ! \begin{funcdesc}{setpgid}{pid, pgrp} Calls the system call ! \cfunction{setpgid()} to set the process group id of the process with ! id \var{pid} to the process group with id \var{pgrp}. See the \UNIX{} ! manual for the semantics. Availability: \UNIX. \end{funcdesc} From tim_one@sourceforge.net Fri Apr 26 22:20:04 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Fri, 26 Apr 2002 14:20:04 -0700 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv20840/python/PCbuild Modified Files: pythoncore.dsp Log Message: Teach the Windows build about the new enumobject.c file. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** pythoncore.dsp 4 Apr 2002 00:02:02 -0000 1.33 --- pythoncore.dsp 26 Apr 2002 21:20:02 -0000 1.34 *************** *** 586,589 **** --- 586,604 ---- # Begin Source File + SOURCE=..\Objects\enumobject.c + + !IF "$(CFG)" == "pythoncore - Win32 Release" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Modules\errnomodule.c From tim_one@sourceforge.net Sat Apr 27 19:03:29 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 11:03:29 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.145,2.146 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30259 Modified Files: unicodeobject.c Log Message: SF patch 549375: Compromise PyUnicode_EncodeUTF8 This implements ideas from Marc-Andre, Martin, Guido and me on Python-Dev. "Short" Unicode strings are encoded into a "big enough" stack buffer, then exactly as much string space as they turn out to need is allocated at the end. This should have speed benefits akin to Martin's "measure once, allocate once" strategy, but without needing a distinct measuring pass. "Long" Unicode strings allocate as much heap space as they could possibly need (4 x # Unicode chars), and do a realloc at the end to return the untouched excess. Since the overallocation is likely to be substantial, this shouldn't burden the platform realloc with unusably small excess blocks. Also simplified uses of the PyString_xyz functions. Also added a release- build check that 4*size doesn't overflow a C int. Sooner or later, that's going to happen. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.145 retrieving revision 2.146 diff -C2 -d -r2.145 -r2.146 *** unicodeobject.c 22 Apr 2002 19:00:10 -0000 2.145 --- unicodeobject.c 27 Apr 2002 18:03:26 -0000 2.146 *************** *** 1139,1182 **** } ! /* Not used anymore, now that the encoder supports UTF-16 ! surrogates. */ ! #if 0 ! static ! int utf8_encoding_error(const Py_UNICODE **source, ! char **dest, ! const char *errors, ! const char *details) ! { ! if ((errors == NULL) || ! (strcmp(errors,"strict") == 0)) { ! PyErr_Format(PyExc_UnicodeError, ! "UTF-8 encoding error: %.400s", ! details); ! return -1; ! } ! else if (strcmp(errors,"ignore") == 0) { ! return 0; ! } ! else if (strcmp(errors,"replace") == 0) { ! **dest = '?'; ! (*dest)++; ! return 0; ! } ! else { ! PyErr_Format(PyExc_ValueError, ! "UTF-8 encoding error; " ! "unknown error handling code: %.400s", ! errors); ! return -1; ! } ! } ! #endif ! ! /* Allocation strategy: we default to Latin-1, then do one resize ! whenever we hit an order boundary. The assumption is that ! characters from higher orders usually occur often enough to warrant ! this. */ - PyObject * PyUnicode_EncodeUTF8(const Py_UNICODE *s, --- 1139,1147 ---- } ! /* Allocation strategy: if the string is short, convert into a stack buffer ! and allocate exactly as much space needed at the end. Else allocate the ! maximum possible needed (4 result bytes per Unicode character), and return ! the excess memory at the end. */ PyObject * PyUnicode_EncodeUTF8(const Py_UNICODE *s, *************** *** 1184,1278 **** const char *errors) { ! PyObject *v; ! char *p; ! int len; ! int i = 0; ! long overalloc = 2; ! int nallocated; /* overalloc * size; PyString_ adds one more for \0 */ ! /* Short-cut for empty strings */ ! if (size == 0) ! return PyString_FromStringAndSize(NULL, 0); ! nallocated = Py_SAFE_DOWNCAST(overalloc * size, long, int); ! v = PyString_FromStringAndSize(NULL, nallocated); ! if (v == NULL) ! return NULL; ! p = PyString_AS_STRING(v); ! while (i < size) { Py_UCS4 ch = s[i++]; if (ch < 0x80) ! /* Encode ASCII */ *p++ = (char) ch; else if (ch < 0x0800) { ! /* Encode Latin-1 */ *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); } - else { ! /* Encode UCS2 Unicode ordinals */ ! if (ch < 0x10000) { ! ! /* Special case: check for high surrogate */ ! if (0xD800 <= ch && ch <= 0xDBFF && i != size) { ! Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate and combine the two to ! form a UCS4 value */ ! if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; ! i++; ! goto encodeUCS4; } ! /* Fall through: handles isolated high surrogates */ } - - if (overalloc < 3) { - len = Py_SAFE_DOWNCAST(p-PyString_AS_STRING(v), long, int); - assert(len <= nallocated); - overalloc = 3; - nallocated = Py_SAFE_DOWNCAST(overalloc * size, long, int); - if (_PyString_Resize(&v, nallocated)) - goto onError; - p = PyString_AS_STRING(v) + len; - } *p++ = (char)(0xe0 | (ch >> 12)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! continue; ! } ! ! /* Encode UCS4 Unicode ordinals */ ! encodeUCS4: ! if (overalloc < 4) { ! len = Py_SAFE_DOWNCAST(p - PyString_AS_STRING(v), long, int); ! assert(len <= nallocated); ! overalloc = 4; ! nallocated = Py_SAFE_DOWNCAST(overalloc * size, long, int); ! if (_PyString_Resize(&v, nallocated)) ! goto onError; ! p = PyString_AS_STRING(v) + len; ! } ! *p++ = (char)(0xf0 | (ch >> 18)); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! } } ! *p = '\0'; ! len = Py_SAFE_DOWNCAST(p - PyString_AS_STRING(v), long, int); ! assert(len <= nallocated); ! if (_PyString_Resize(&v, len)) ! goto onError; return v; ! onError: ! Py_DECREF(v); ! return NULL; } --- 1149,1240 ---- const char *errors) { ! #define MAX_SHORT_UNICHARS 300 /* largest size we'll do on the stack */ ! int i; /* index into s of next input byte */ ! PyObject *v; /* result string object */ ! char *p; /* next free byte in output buffer */ ! int nallocated; /* number of result bytes allocated */ ! int nneeded; /* number of result bytes needed */ ! char stackbuf[MAX_SHORT_UNICHARS * 4]; ! assert(s != NULL); ! assert(size >= 0); ! if (size <= MAX_SHORT_UNICHARS) { ! /* Write into the stack buffer; nallocated can't overflow. ! * At the end, we'll allocate exactly as much heap space as it ! * turns out we need. ! */ ! nallocated = Py_SAFE_DOWNCAST(sizeof(stackbuf), size_t, int); ! v = NULL; /* will allocate after we're done */ ! p = stackbuf; ! } ! else { ! /* Overallocate on the heap, and give the excess back at the end. */ ! nallocated = size * 4; ! if (nallocated / 4 != size) /* overflow! */ ! return PyErr_NoMemory(); ! v = PyString_FromStringAndSize(NULL, nallocated); ! if (v == NULL) ! return NULL; ! p = PyString_AS_STRING(v); ! } ! for (i = 0; i < size;) { Py_UCS4 ch = s[i++]; if (ch < 0x80) ! /* Encode ASCII */ *p++ = (char) ch; else if (ch < 0x0800) { ! /* Encode Latin-1 */ *p++ = (char)(0xc0 | (ch >> 6)); *p++ = (char)(0x80 | (ch & 0x3f)); } else { ! /* Encode UCS2 Unicode ordinals */ ! if (ch < 0x10000) { ! /* Special case: check for high surrogate */ ! if (0xD800 <= ch && ch <= 0xDBFF && i != size) { ! Py_UCS4 ch2 = s[i]; ! /* Check for low surrogate and combine the two to ! form a UCS4 value */ ! if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; ! i++; ! goto encodeUCS4; } ! /* Fall through: handles isolated high surrogates */ } *p++ = (char)(0xe0 | (ch >> 12)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! continue; ! } ! encodeUCS4: ! /* Encode UCS4 Unicode ordinals */ ! *p++ = (char)(0xf0 | (ch >> 18)); ! *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); ! *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); ! *p++ = (char)(0x80 | (ch & 0x3f)); ! } } ! if (v == NULL) { ! /* This was stack allocated. */ ! nneeded = Py_SAFE_DOWNCAST(p - stackbuf, long, int); ! assert(nneeded <= nallocated); ! v = PyString_FromStringAndSize(stackbuf, nneeded); ! } ! else { ! /* Cut back to size actually needed. */ ! nneeded = Py_SAFE_DOWNCAST(p - PyString_AS_STRING(v), long, int); ! assert(nneeded <= nallocated); ! _PyString_Resize(&v, nneeded); ! } return v; ! #undef MAX_SHORT_UNICHARS } From tim_one@sourceforge.net Sat Apr 27 19:45:02 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 11:45:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv7685/python/Doc/api Modified Files: concrete.tex Log Message: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** concrete.tex 12 Apr 2002 19:32:07 -0000 1.12 --- concrete.tex 27 Apr 2002 18:44:29 -0000 1.13 *************** *** 587,591 **** A way to resize a string object even though it is ``immutable''. Only use this to build up a brand new string object; don't use this ! if the string may already be known in other parts of the code. \end{cfuncdesc} --- 587,600 ---- A way to resize a string object even though it is ``immutable''. Only use this to build up a brand new string object; don't use this ! if the string may already be known in other parts of the code. It ! is an error to call this function if the refcount on the input string ! object is not one. ! Pass the address of an existing string object as an lvalue (it may ! be written into), and the new size desired. On success, \var{*string} ! holds the resized string object and 0 is returned; the address in ! \var{*string} may differ from its input value. If the ! reallocation fails, the original string object at \var{*string} is ! deallocated, \var{*string} is set to \NULL{}, a memory exception is set, ! and -1 is returned. \end{cfuncdesc} From tim_one@sourceforge.net Sun Apr 28 05:11:49 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 21:11:49 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.51,2.52 pymem.h,2.14,2.15 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv23019/python/Include Modified Files: objimpl.h pymem.h Log Message: Moving pymalloc along. As threatened, PyMem_{Free, FREE} also invoke the object deallocator now when pymalloc is enabled (well, it does when pymalloc isn't enabled too, but in that case "the object deallocator" is plain free()). This is maximally backward-compatible, but it leaves a bitter aftertaste. Also massive reworking of comments. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** objimpl.h 13 Apr 2002 08:29:14 -0000 2.51 --- objimpl.h 28 Apr 2002 04:11:46 -0000 2.52 *************** *** 1,2 **** --- 1,5 ---- + /* The PyObject_ memory family: high-level object memory interfaces. + See pymem.h for the low-level PyMem_ family. + */ #ifndef Py_OBJIMPL_H *************** *** 9,59 **** #endif /* Functions and macros for modules that implement new object types. - You must first include "object.h". ! - PyObject_New(type, typeobj) allocates memory for a new object of ! the given type; here 'type' must be the C structure type used to ! represent the object and 'typeobj' the address of the corresponding ! type object. Reference count and type pointer are filled in; the ! rest of the bytes of the object are *undefined*! The resulting ! expression type is 'type *'. The size of the object is determined ! by the tp_basicsize field of the type object. ! - PyObject_NewVar(type, typeobj, n) is similar but allocates a ! variable-size object with n extra items. The size is computed as ! tp_basicsize plus n * tp_itemsize. This fills in the ob_size field ! as well. ! - PyObject_Del(op) releases the memory allocated for an object. It ! does not run a destructor -- it only frees the memory. PyObject_Free ! is identical. ! - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) are ! similar to PyObject_{New, NewVar} except that they don't allocate ! the memory needed for an object. Instead of the 'type' parameter, ! they accept the pointer of a new object (allocated by an arbitrary ! allocator) and initialize its object header fields. ! Note that objects created with PyObject_{New, NewVar} are allocated ! using the specialized Python allocator (implemented in obmalloc.c), if ! WITH_PYMALLOC is enabled. In addition, a special debugging allocator ! is used if PYMALLOC_DEBUG is also #defined. ! In case a specific form of memory management is needed, implying that ! the objects would not reside in the Python heap (for example standard ! malloc heap(s) are mandatory, use of shared memory, C++ local storage ! or operator new), you must first allocate the object with your custom ! allocator, then pass its pointer to PyObject_{Init, InitVar} for ! filling in its Python-specific fields: reference count, type pointer, ! possibly others. You should be aware that Python has very limited ! control over these objects because they don't cooperate with the ! Python memory manager. Such objects may not be eligible for automatic ! garbage collection and you have to make sure that they are released ! accordingly whenever their destructor gets called (cf. the specific form of memory management you're using). ! Unless you have specific memory management requirements, it is ! recommended to use PyObject_{New, NewVar, Del}. */ /* --- 12,69 ---- #endif + /* BEWARE: + + Each interface exports both functions and macros. Extension modules should + use the functions, to ensure binary compatibility across Python versions. + Because the Python implementation is free to change internal details, and + the macros may (or may not) expose details for speed, if you do use the + macros you must recompile your extensions with each Python release. + + Never mix calls to PyObject_ memory functions with calls to the platform + malloc/realloc/ calloc/free, or with calls to PyMem_. + */ + /* Functions and macros for modules that implement new object types. ! - PyObject_New(type, typeobj) allocates memory for a new object of the given ! type, and initializes part of it. 'type' must be the C structure type used ! to represent the object, and 'typeobj' the address of the corresponding ! type object. Reference count and type pointer are filled in; the rest of ! the bytes of the object are *undefined*! The resulting expression type is ! 'type *'. The size of the object is determined by the tp_basicsize field ! of the type object. ! - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size ! object with room for n items. In addition to the refcount and type pointer ! fields, this also fills in the ob_size field. ! - PyObject_Del(op) releases the memory allocated for an object. It does not ! run a destructor -- it only frees the memory. PyObject_Free is identical. ! - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't ! allocate memory. Instead of a 'type' parameter, they take a pointer to a ! new object (allocated by an arbitrary allocator), and initialize its object ! header fields. ! Note that objects created with PyObject_{New, NewVar} are allocated using the ! specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is ! enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG ! is also #defined. ! In case a specific form of memory management is needed (for example, if you ! must use the platform malloc heap(s), or shared memory, or C++ local storage or ! operator new), you must first allocate the object with your custom allocator, ! then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- ! specific fields: reference count, type pointer, possibly others. You should ! be aware that Python no control over these objects because they don't ! cooperate with the Python memory manager. Such objects may not be eligible ! for automatic garbage collection and you have to make sure that they are ! released accordingly whenever their destructor gets called (cf. the specific form of memory management you're using). ! Unless you have specific memory management requirements, use ! PyObject_{New, NewVar, Del}. ! */ /* *************** *** 62,88 **** */ - /* The use of this API should be avoided, unless a builtin object - constructor inlines PyObject_{New, NewVar}, either because the - latter functions cannot allocate the exact amount of needed memory, - either for speed. This situation is exceptional, but occurs for - some object constructors (PyBuffer_New, PyList_New...). Inlining - PyObject_{New, NewVar} for objects that are supposed to belong to - the Python heap is discouraged. If you really have to, make sure - the object is initialized with PyObject_{Init, InitVar}. Do *not* - inline PyObject_{Init, InitVar} for user-extension types or you - might seriously interfere with Python's memory management. */ - - /* Functions */ - /* Functions to call the same malloc/realloc/free as used by Python's object allocator. If WITH_PYMALLOC is enabled, these may differ from the platform malloc/realloc/free. The Python object allocator is designed for fast, cache-conscious allocation of many "small" objects, ! with low hidden memory overhead. PyObject_Malloc(0) returns a unique ! non-NULL pointer if possible. PyObject_Realloc(NULL, n) acts like ! PyObject_Malloc(n). PyObject_Realloc(p != NULL, 0) does not return ! NULL or free the memory at p. Returned pointers must be checked for ! NULL explicitly; no action is performed on failure other than to return ! NULL. */ extern DL_IMPORT(void *) PyObject_Malloc(size_t); extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t); --- 72,98 ---- */ /* Functions to call the same malloc/realloc/free as used by Python's object allocator. If WITH_PYMALLOC is enabled, these may differ from the platform malloc/realloc/free. The Python object allocator is designed for fast, cache-conscious allocation of many "small" objects, ! and with low hidden memory overhead. ! ! PyObject_Malloc(0) returns a unique non-NULL pointer if possible. ! ! PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). ! PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory ! at p. ! ! Returned pointers must be checked for NULL explicitly; no action is ! performed on failure other than to return NULL (no warning it printed, no ! exception is set, etc). ! ! For allocating objects, use PyObject_{New, NewVar} instead whenever ! possible. The PyObject_{Malloc, Realloc, Free} family is exposed ! so that you can exploit Python's small-block allocator for non-object ! uses. If you must use these routines to allocate object memory, make sure ! the object gets initialized via PyObject_{Init, InitVar} after obtaining ! the raw memory. ! */ extern DL_IMPORT(void *) PyObject_Malloc(size_t); extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t); *************** *** 115,126 **** #define PyObject_MALLOC PyMem_MALLOC #define PyObject_REALLOC PyMem_REALLOC ! #define PyObject_FREE PyMem_FREE #endif /* WITH_PYMALLOC */ ! #define PyObject_Del PyObject_Free ! #define PyObject_DEL PyObject_FREE /* for source compatibility with 2.2 */ ! #define _PyObject_Del PyObject_Free /* --- 125,141 ---- #define PyObject_MALLOC PyMem_MALLOC #define PyObject_REALLOC PyMem_REALLOC ! /* This is an odd one! For backward compatability with old extensions, the ! PyMem "release memory" functions have to invoke the object allocator's ! free() function. When pymalloc isn't enabled, that leaves us using ! the platform free(). */ ! #define PyObject_FREE free ! #endif /* WITH_PYMALLOC */ ! #define PyObject_Del PyObject_Free ! #define PyObject_DEL PyObject_FREE /* for source compatibility with 2.2 */ ! #define _PyObject_Del PyObject_Free /* *************** *** 197,203 **** return PyErr_NoMemory(); ! op = PyObject_Init(op, &YourTypeStruct); ! if (op == NULL) ! return NULL; op->ob_field = value; --- 212,216 ---- return PyErr_NoMemory(); ! PyObject_Init(op, &YourTypeStruct); op->ob_field = value; *************** *** 208,212 **** Note that in C++, the use of the new operator usually implies that the 1st step is performed automatically for you, so in a C++ class ! constructor you would start directly with PyObject_Init/InitVar. */ /* --- 221,226 ---- Note that in C++, the use of the new operator usually implies that the 1st step is performed automatically for you, so in a C++ class ! constructor you would start directly with PyObject_Init/InitVar ! */ /* *************** *** 235,239 **** #ifdef WITH_CYCLE_GC ! /* GC information is stored BEFORE the object structure */ typedef union _gc_head { struct { --- 249,253 ---- #ifdef WITH_CYCLE_GC ! /* GC information is stored BEFORE the object structure. */ typedef union _gc_head { struct { *************** *** 284,291 **** #else /* !WITH_CYCLE_GC */ ! #define _PyObject_GC_Malloc PyObject_Malloc ! #define PyObject_GC_New PyObject_New ! #define PyObject_GC_NewVar PyObject_NewVar ! #define PyObject_GC_Del PyObject_Del #define _PyObject_GC_TRACK(op) #define _PyObject_GC_UNTRACK(op) --- 298,305 ---- #else /* !WITH_CYCLE_GC */ ! #define _PyObject_GC_Malloc PyObject_Malloc ! #define PyObject_GC_New PyObject_New ! #define PyObject_GC_NewVar PyObject_NewVar ! #define PyObject_GC_Del PyObject_Del #define _PyObject_GC_TRACK(op) #define _PyObject_GC_UNTRACK(op) Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** pymem.h 22 Apr 2002 02:33:27 -0000 2.14 --- pymem.h 28 Apr 2002 04:11:46 -0000 2.15 *************** *** 1,4 **** ! ! /* Lowest-level memory allocation interface */ #ifndef Py_PYMEM_H --- 1,5 ---- ! /* The PyMem_ family: low-level memory allocation interfaces. ! See objimpl.h for the PyObject_ memory family. ! */ #ifndef Py_PYMEM_H *************** *** 13,29 **** /* BEWARE: ! Each interface exports both functions and macros. Extension modules ! should normally use the functions for ensuring binary compatibility ! of the user's code across Python versions. Subsequently, if the ! Python runtime switches to its own malloc (different from standard ! malloc), no recompilation is required for the extensions. ! ! The macro versions are free to trade compatibility for speed, although ! there's no guarantee they're ever faster. Extensions shouldn't use the ! macro versions, as they don't gurantee binary compatibility across ! releases. ! Do not mix calls to PyMem_xyz with calls to platform ! malloc/realloc/calloc/free. */ /* --- 14,35 ---- /* BEWARE: ! Each interface exports both functions and macros. Extension modules should ! use the functions, to ensure binary compatibility across Python versions. ! Because the Python implementation is free to change internal details, and ! the macros may (or may not) expose details for speed, if you do use the ! macros you must recompile your extensions with each Python release. ! Never mix calls to PyMem_ with calls to the platform malloc/realloc/ ! calloc/free. For example, on Windows different DLLs may end up using ! different heaps, and if you use PyMem_Malloc you'll get the memory from the ! heap used by the Python DLL; it could be a disaster if you free()'ed that ! directly in your own extension. Using PyMem_Free instead ensures Python ! can return the memory to the proper heap. As another example, in ! PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_ ! memory functions in special debugging wrappers that add additional ! debugging info to dynamic memory blocks. The system routines have no idea ! what to do with that stuff, and the Python wrappers have no idea what to do ! with raw blocks obtained directly by the system routines then. ! */ /* *************** *** 32,47 **** */ ! /* Functions */ ! /* Functions supplying platform-independent semantics for malloc/realloc/ ! free; useful if you need to be sure you're using the same memory ! allocator as Python (this can be especially important on Windows, if ! you need to make sure you're using the same MS malloc/free, and out of ! the same heap, as the main Python DLL uses). ! These functions make sure that allocating 0 bytes returns a distinct non-NULL pointer (whenever possible -- if we're flat out of memory, NULL may be returned), even if the platform malloc and realloc don't. Returned pointers must be checked for NULL explicitly. No action is ! performed on failure (no exception is set, no warning is printed, etc).` */ extern DL_IMPORT(void *) PyMem_Malloc(size_t); --- 38,50 ---- */ ! /* Functions ! Functions supplying platform-independent semantics for malloc/realloc/ ! free. These functions make sure that allocating 0 bytes returns a distinct non-NULL pointer (whenever possible -- if we're flat out of memory, NULL may be returned), even if the platform malloc and realloc don't. Returned pointers must be checked for NULL explicitly. No action is ! performed on failure (no exception is set, no warning is printed, etc). ! */ extern DL_IMPORT(void *) PyMem_Malloc(size_t); *************** *** 57,61 **** #define PyMem_MALLOC PyObject_MALLOC #define PyMem_REALLOC PyObject_REALLOC - #define PyMem_FREE PyObject_FREE #else /* ! PYMALLOC_DEBUG */ --- 60,63 ---- *************** *** 66,69 **** --- 68,72 ---- #define PyMem_MALLOC malloc #endif + /* Caution: whether MALLOC_ZERO_RETURNS_NULL is #defined has nothing to do with whether platform realloc(non-NULL, 0) normally frees the memory *************** *** 72,78 **** #define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1) - #define PyMem_FREE free #endif /* PYMALLOC_DEBUG */ /* * Type-oriented memory interface --- 75,85 ---- #define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1) #endif /* PYMALLOC_DEBUG */ + /* In order to avoid breaking old code mixing PyObject_{New, NEW} with + PyMem_{Del, DEL} and PyMem_{Free, FREE}, the PyMem "release memory" + functions have to be redirected to the object deallocator. */ + #define PyMem_FREE PyObject_FREE + /* * Type-oriented memory interface *************** *** 80,104 **** * * These are carried along for historical reasons. There's rarely a good ! * reason to use them anymore. */ - /* Functions */ #define PyMem_New(type, n) \ ( (type *) PyMem_Malloc((n) * sizeof(type)) ) - #define PyMem_Resize(p, type, n) \ - ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) - - /* In order to avoid breaking old code mixing PyObject_{New, NEW} with - PyMem_{Del, DEL} (there was no choice about this in 1.5.2), the latter - have to be redirected to the object allocator. */ - #define PyMem_Del PyObject_Free - - /* Macros */ #define PyMem_NEW(type, n) \ ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) #define PyMem_RESIZE(p, type, n) \ ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) ! #define PyMem_DEL PyObject_FREE #ifdef __cplusplus --- 87,109 ---- * * These are carried along for historical reasons. There's rarely a good ! * reason to use them anymore (you can just as easily do the multiply and ! * cast yourself). */ #define PyMem_New(type, n) \ ( (type *) PyMem_Malloc((n) * sizeof(type)) ) #define PyMem_NEW(type, n) \ ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) + + #define PyMem_Resize(p, type, n) \ + ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) #define PyMem_RESIZE(p, type, n) \ ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) ! /* In order to avoid breaking old code mixing PyObject_{New, NEW} with ! PyMem_{Del, DEL} and PyMem_{Free, FREE}, the PyMem "release memory" ! functions have to be redirected to the object deallocator. */ ! #define PyMem_Del PyObject_Free ! #define PyMem_DEL PyObject_FREE #ifdef __cplusplus From tim_one@sourceforge.net Sun Apr 28 17:57:37 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 28 Apr 2002 09:57:37 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.82,2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7261/python/Objects Modified Files: intobject.c Log Message: Just added comments, and cleared some XXX questions, related to int memory management. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.82 retrieving revision 2.83 diff -C2 -d -r2.82 -r2.83 *** intobject.c 26 Apr 2002 00:53:34 -0000 2.82 --- intobject.c 28 Apr 2002 16:57:34 -0000 2.83 *************** *** 27,35 **** (Using odd pointers to represent integers would save much space but require extra checks for this special case throughout the code.) ! Since, a typical Python program spends much of its time allocating and deallocating integers, these operations should be very fast. Therefore we use a dedicated allocation scheme with a much lower overhead (in space and time) than straight malloc(): a simple dedicated free list, filled when necessary with memory from malloc(). */ --- 27,42 ---- (Using odd pointers to represent integers would save much space but require extra checks for this special case throughout the code.) ! Since a typical Python program spends much of its time allocating and deallocating integers, these operations should be very fast. Therefore we use a dedicated allocation scheme with a much lower overhead (in space and time) than straight malloc(): a simple dedicated free list, filled when necessary with memory from malloc(). + + block_list is a singly-linked list of all PyIntBlocks ever allocated, + linked via their next members. PyIntBlocks are never returned to the + system before shutdown (PyInt_Fini). + + free_list is a singly-linked list of available PyIntObjects, linked + via abuse of their ob_type members. */ *************** *** 52,56 **** { PyIntObject *p, *q; ! /* XXX Int blocks escape the object heap. Use PyObject_MALLOC ??? */ p = (PyIntObject *) PyMem_MALLOC(sizeof(PyIntBlock)); if (p == NULL) --- 59,63 ---- { PyIntObject *p, *q; ! /* Python's object allocator isn't appropriate for large blocks. */ p = (PyIntObject *) PyMem_MALLOC(sizeof(PyIntBlock)); if (p == NULL) *************** *** 58,61 **** --- 65,70 ---- ((PyIntBlock *)p)->next = block_list; block_list = (PyIntBlock *)p; + /* Link the int objects together, from rear to front, then return + the address of the last int object in the block. */ p = &((PyIntBlock *)p)->objects[0]; q = p + N_INTOBJECTS; *************** *** 976,980 **** } else { ! PyMem_FREE(list); /* XXX PyObject_FREE ??? */ bf++; } --- 985,989 ---- } else { ! PyMem_FREE(list); bf++; } From tim_one@sourceforge.net Sun Apr 28 07:14:48 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 23:14:48 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.43,2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22851/python/Objects Modified Files: obmalloc.c Log Message: _PyObject_DebugCheckAddress(): If the leading pad bytes are corrupt, display a msg warning that the count of bytes requested may be bogus, and that a segfault may happen next. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** obmalloc.c 18 Apr 2002 22:25:03 -0000 2.43 --- obmalloc.c 28 Apr 2002 06:14:45 -0000 2.44 *************** *** 1071,1074 **** --- 1071,1076 ---- const uchar *q = (const uchar *)p; char *msg; + ulong nbytes; + const uchar *tail; int i; *************** *** 1078,1081 **** --- 1080,1087 ---- } + /* Check the stuff at the start of p first: if there's underwrite + * corruption, the number-of-bytes field may be nuts, and checking + * the tail could lead to a segfault then. + */ for (i = 4; i >= 1; --i) { if (*(q-i) != FORBIDDENBYTE) { *************** *** 1085,1096 **** } ! { ! const ulong nbytes = read4(q-8); ! const uchar *tail = q + nbytes; ! for (i = 0; i < 4; ++i) { ! if (tail[i] != FORBIDDENBYTE) { ! msg = "bad trailing pad byte"; ! goto error; ! } } } --- 1091,1100 ---- } ! nbytes = read4(q-8); ! tail = q + nbytes; ! for (i = 0; i < 4; ++i) { ! if (tail[i] != FORBIDDENBYTE) { ! msg = "bad trailing pad byte"; ! goto error; } } *************** *** 1119,1131 **** fprintf(stderr, " %lu bytes originally requested\n", nbytes); ! /* In case this is nuts, check the pad bytes before trying to read up ! the serial number (the address deref could blow up). */ ! ! fputs(" the 4 pad bytes at p-4 are ", stderr); if (*(q-4) == FORBIDDENBYTE && *(q-3) == FORBIDDENBYTE && *(q-2) == FORBIDDENBYTE && *(q-1) == FORBIDDENBYTE) { ! fputs("FORBIDDENBYTE, as expected\n", stderr); } else { --- 1123,1133 ---- fprintf(stderr, " %lu bytes originally requested\n", nbytes); ! /* In case this is nuts, check the leading pad bytes first. */ ! fputs(" The 4 pad bytes at p-4 are ", stderr); if (*(q-4) == FORBIDDENBYTE && *(q-3) == FORBIDDENBYTE && *(q-2) == FORBIDDENBYTE && *(q-1) == FORBIDDENBYTE) { ! fputs("FORBIDDENBYTE, as expected.\n", stderr); } else { *************** *** 1139,1151 **** fputc('\n', stderr); } } tail = q + nbytes; ! fprintf(stderr, " the 4 pad bytes at tail=%p are ", tail); if (tail[0] == FORBIDDENBYTE && tail[1] == FORBIDDENBYTE && tail[2] == FORBIDDENBYTE && tail[3] == FORBIDDENBYTE) { ! fputs("FORBIDDENBYTE, as expected\n", stderr); } else { --- 1141,1158 ---- fputc('\n', stderr); } + + fputs(" Because memory is corrupted at the start, the " + "count of bytes requested\n" + " may be bogus, and checking the trailing pad " + "bytes may segfault.\n", stderr); } tail = q + nbytes; ! fprintf(stderr, " The 4 pad bytes at tail=%p are ", tail); if (tail[0] == FORBIDDENBYTE && tail[1] == FORBIDDENBYTE && tail[2] == FORBIDDENBYTE && tail[3] == FORBIDDENBYTE) { ! fputs("FORBIDDENBYTE, as expected.\n", stderr); } else { *************** *** 1163,1172 **** serial = read4(tail+4); ! fprintf(stderr, " the block was made by call #%lu to " ! "debug malloc/realloc\n", serial); if (nbytes > 0) { int i = 0; ! fputs(" data at p:", stderr); /* print up to 8 bytes at the start */ while (q < tail && i < 8) { --- 1170,1179 ---- serial = read4(tail+4); ! fprintf(stderr, " The block was made by call #%lu to " ! "debug malloc/realloc.\n", serial); if (nbytes > 0) { int i = 0; ! fputs(" Data at p:", stderr); /* print up to 8 bytes at the start */ while (q < tail && i < 8) { From tim_one@sourceforge.net Sun Apr 28 02:57:28 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 18:57:28 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv979 Modified Files: gcmodule.c Log Message: _PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument. _PyObject_GC_NewVar: Could call PyObject_INIT_VAR likewise. Bugfix candidate. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** gcmodule.c 12 Apr 2002 02:41:03 -0000 2.39 --- gcmodule.c 28 Apr 2002 01:57:25 -0000 2.40 *************** *** 879,883 **** { PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp)); ! return PyObject_INIT(op, tp); } --- 879,885 ---- { PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp)); ! if (op != NULL) ! op = PyObject_INIT(op, tp); ! return op; } *************** *** 887,891 **** const size_t size = _PyObject_VAR_SIZE(tp, nitems); PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(size); ! return PyObject_INIT_VAR(op, tp, nitems); } --- 889,895 ---- const size_t size = _PyObject_VAR_SIZE(tp, nitems); PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(size); ! if (op != NULL) ! op = PyObject_INIT_VAR(op, tp, nitems); ! return op; } From tim_one@sourceforge.net Sat Apr 27 19:44:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 11:44:34 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.160,2.161 stringobject.c,2.160,2.161 unicodeobject.c,2.146,2.147 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7685/python/Objects Modified Files: fileobject.c stringobject.c unicodeobject.c Log Message: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.160 retrieving revision 2.161 diff -C2 -d -r2.160 -r2.161 *** fileobject.c 21 Apr 2002 18:15:20 -0000 2.160 --- fileobject.c 27 Apr 2002 18:44:32 -0000 2.161 *************** *** 1318,1324 **** } cleanup: ! if (big_buffer) { ! Py_DECREF(big_buffer); ! } return list; } --- 1318,1322 ---- } cleanup: ! Py_XDECREF(big_buffer); return list; } Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.160 retrieving revision 2.161 diff -C2 -d -r2.160 -r2.161 *** stringobject.c 22 Apr 2002 17:42:37 -0000 2.160 --- stringobject.c 27 Apr 2002 18:44:32 -0000 2.161 *************** *** 1870,1875 **** } /* Fix the size of the resulting string */ ! if (inlen > 0 &&_PyString_Resize(&result, output-output_start)) ! return NULL; return result; } --- 1870,1875 ---- } /* Fix the size of the resulting string */ ! if (inlen > 0) ! _PyString_Resize(&result, output - output_start); return result; } *************** *** 2928,2932 **** as creating a new string object and destroying the old one, only more efficiently. In any case, don't use this if the string may ! already be known to some other part of the code... */ int --- 2928,2939 ---- as creating a new string object and destroying the old one, only more efficiently. In any case, don't use this if the string may ! already be known to some other part of the code... ! Note that if there's not enough memory to resize the string, the original ! string object at *pv is deallocated, *pv is set to NULL, an "out of ! memory" exception is set, and -1 is returned. Else (on success) 0 is ! returned, and the value in *pv may or may not be the same as on input. ! As always, an extra byte is allocated for a trailing \0 byte (newsize ! does *not* include that), and a trailing \0 byte is stored. ! */ int Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.146 retrieving revision 2.147 diff -C2 -d -r2.146 -r2.147 *** unicodeobject.c 27 Apr 2002 18:03:26 -0000 2.146 --- unicodeobject.c 27 Apr 2002 18:44:32 -0000 2.147 *************** *** 928,935 **** } ! if (_PyString_Resize(&v, out - start)) { ! Py_DECREF(v); ! return NULL; ! } return v; } --- 928,932 ---- } ! _PyString_Resize(&v, out - start); return v; } *************** *** 1765,1769 **** if (offset + 12 > PyString_GET_SIZE(repr)) { if (_PyString_Resize(&repr, PyString_GET_SIZE(repr) + 100)) ! goto onError; p = PyString_AS_STRING(repr) + offset; } --- 1762,1766 ---- if (offset + 12 > PyString_GET_SIZE(repr)) { if (_PyString_Resize(&repr, PyString_GET_SIZE(repr) + 100)) ! return NULL; p = PyString_AS_STRING(repr) + offset; } *************** *** 1848,1859 **** *p = '\0'; ! if (_PyString_Resize(&repr, p - PyString_AS_STRING(repr))) ! goto onError; ! return repr; - - onError: - Py_DECREF(repr); - return NULL; } --- 1845,1850 ---- *p = '\0'; ! _PyString_Resize(&repr, p - PyString_AS_STRING(repr)); return repr; } *************** *** 1986,1997 **** } *p = '\0'; ! if (_PyString_Resize(&repr, p - q)) ! goto onError; ! return repr; - - onError: - Py_DECREF(repr); - return NULL; } --- 1977,1982 ---- } *p = '\0'; ! _PyString_Resize(&repr, p - q); return repr; } *************** *** 2093,2098 **** /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! if (_PyString_Resize(&repr, s - start)) ! goto onError; return repr; --- 2078,2082 ---- /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! _PyString_Resize(&repr, s - start); return repr; *************** *** 2241,2246 **** /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! if (_PyString_Resize(&repr, s - start)) ! goto onError; return repr; --- 2225,2229 ---- /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! _PyString_Resize(&repr, s - start); return repr; *************** *** 2589,2598 **** } if (s - PyString_AS_STRING(v) < PyString_GET_SIZE(v)) ! if (_PyString_Resize(&v, (int)(s - PyString_AS_STRING(v)))) ! goto onError; return v; onError: ! Py_DECREF(v); return NULL; } --- 2572,2580 ---- } if (s - PyString_AS_STRING(v) < PyString_GET_SIZE(v)) ! _PyString_Resize(&v, (int)(s - PyString_AS_STRING(v))); return v; onError: ! Py_XDECREF(v); return NULL; } From tim_one@sourceforge.net Sat Apr 27 19:44:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 11:44:34 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.252,2.253 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7685/python/Python Modified Files: bltinmodule.c Log Message: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.252 retrieving revision 2.253 diff -C2 -d -r2.252 -r2.253 *** bltinmodule.c 26 Apr 2002 19:40:55 -0000 2.252 --- bltinmodule.c 27 Apr 2002 18:44:32 -0000 2.253 *************** *** 1994,1999 **** } ! if (j < len && _PyString_Resize(&result, j) < 0) ! return NULL; return result; --- 1994,1999 ---- } ! if (j < len) ! _PyString_Resize(&result, j); return result; From tim_one@sourceforge.net Sat Apr 27 19:44:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sat, 27 Apr 2002 11:44:34 -0700 Subject: [Python-checkins] python/dist/src/Modules _ssl.c,1.2,1.3 cPickle.c,2.82,2.83 cdmodule.c,1.27,1.28 clmodule.c,2.28,2.29 linuxaudiodev.c,2.17,2.18 regexmodule.c,1.47,1.48 socketmodule.c,1.215,1.216 stropmodule.c,2.87,2.88 zlibmodule.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7685/python/Modules Modified Files: _ssl.c cPickle.c cdmodule.c clmodule.c linuxaudiodev.c regexmodule.c socketmodule.c stropmodule.c zlibmodule.c Log Message: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _ssl.c 20 Apr 2002 07:47:40 -0000 1.2 --- _ssl.c 27 Apr 2002 18:44:29 -0000 1.3 *************** *** 332,337 **** return PySSL_SetError(self, count); } ! if (count != len && _PyString_Resize(&buf, count) < 0) ! return NULL; return buf; } --- 332,337 ---- return PySSL_SetError(self, count); } ! if (count != len) ! _PyString_Resize(&buf, count); return buf; } Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.82 retrieving revision 2.83 diff -C2 -d -r2.82 -r2.83 *** cPickle.c 21 Apr 2002 23:44:34 -0000 2.82 --- cPickle.c 27 Apr 2002 18:44:29 -0000 2.83 *************** *** 1253,1264 **** } *p = '\0'; ! if (_PyString_Resize(&repr, p - q)) ! goto onError; ! return repr; - - onError: - Py_DECREF(repr); - return NULL; } --- 1253,1258 ---- } *p = '\0'; ! _PyString_Resize(&repr, p - q); return repr; } Index: cdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cdmodule.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** cdmodule.c 17 Jan 2002 23:15:58 -0000 1.27 --- cdmodule.c 27 Apr 2002 18:44:31 -0000 1.28 *************** *** 252,257 **** } if (n < numframes) ! if (_PyString_Resize(&result, n * sizeof(CDFRAME))) ! return NULL; return result; --- 252,256 ---- } if (n < numframes) ! _PyString_Resize(&result, n * sizeof(CDFRAME)); return result; Index: clmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/clmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** clmodule.c 2 Apr 2002 18:26:33 -0000 2.28 --- clmodule.c 27 Apr 2002 18:44:31 -0000 2.29 *************** *** 136,141 **** if (compressedBufferSize < frameBufferSize) ! if (_PyString_Resize(&compressedBuffer, compressedBufferSize)) ! return NULL; return compressedBuffer; --- 136,140 ---- if (compressedBufferSize < frameBufferSize) ! _PyString_Resize(&compressedBuffer, compressedBufferSize); return compressedBuffer; Index: linuxaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/linuxaudiodev.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** linuxaudiodev.c 12 Jan 2002 11:05:06 -0000 2.17 --- linuxaudiodev.c 27 Apr 2002 18:44:31 -0000 2.18 *************** *** 159,164 **** } self->x_icount += count; ! if (_PyString_Resize(&rv, count) == -1) ! return NULL; return rv; } --- 159,163 ---- } self->x_icount += count; ! _PyString_Resize(&rv, count); return rv; } Index: regexmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/regexmodule.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** regexmodule.c 31 Mar 2002 15:27:00 -0000 1.47 --- regexmodule.c 27 Apr 2002 18:44:31 -0000 1.48 *************** *** 517,525 **** } /* _PyString_Resize() decrements npattern on failure */ ! if (_PyString_Resize(&npattern, n - v) == 0) ! return npattern; ! else { ! return NULL; ! } } --- 517,522 ---- } /* _PyString_Resize() decrements npattern on failure */ ! _PyString_Resize(&npattern, n - v); ! return npattern; } Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** socketmodule.c 12 Apr 2002 02:41:24 -0000 1.215 --- socketmodule.c 27 Apr 2002 18:44:31 -0000 1.216 *************** *** 1403,1408 **** return s->errorhandler(); } ! if (n != len && _PyString_Resize(&buf, n) < 0) ! return NULL; return buf; } --- 1403,1408 ---- return s->errorhandler(); } ! if (n != len) ! _PyString_Resize(&buf, n); return buf; } Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -d -r2.87 -r2.88 *** stropmodule.c 2 Apr 2002 18:17:57 -0000 2.87 --- stropmodule.c 27 Apr 2002 18:44:31 -0000 2.88 *************** *** 216,223 **** slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz * 2)) { ! Py_DECREF(res); return NULL; - } sz *= 2; p = PyString_AsString(res) + reslen; --- 216,221 ---- slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz * 2) < 0) return NULL; sz *= 2; p = PyString_AsString(res) + reslen; *************** *** 232,239 **** reslen += slen; } ! if (_PyString_Resize(&res, reslen)) { ! Py_DECREF(res); ! res = NULL; ! } return res; } --- 230,234 ---- reslen += slen; } ! _PyString_Resize(&res, reslen); return res; } *************** *** 258,263 **** slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz * 2)) { ! Py_DECREF(res); Py_DECREF(item); return NULL; --- 253,257 ---- slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { ! if (_PyString_Resize(&res, sz * 2) < 0) { Py_DECREF(item); return NULL; *************** *** 276,283 **** Py_DECREF(item); } ! if (_PyString_Resize(&res, reslen)) { ! Py_DECREF(res); ! res = NULL; ! } return res; } --- 270,274 ---- Py_DECREF(item); } ! _PyString_Resize(&res, reslen); return res; } *************** *** 990,995 **** } /* Fix the size of the resulting string */ ! if (inlen > 0 &&_PyString_Resize(&result, output-output_start)) ! return NULL; return result; } --- 981,986 ---- } /* Fix the size of the resulting string */ ! if (inlen > 0) ! _PyString_Resize(&result, output - output_start); return result; } Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** zlibmodule.c 19 Apr 2002 14:37:07 -0000 2.60 --- zlibmodule.c 27 Apr 2002 18:44:31 -0000 2.61 *************** *** 256,262 **** case(Z_OK): /* need more memory */ ! if (_PyString_Resize(&result_str, r_strlen << 1) == -1) { inflateEnd(&zst); - result_str = NULL; goto error; } --- 256,261 ---- case(Z_OK): /* need more memory */ ! if (_PyString_Resize(&result_str, r_strlen << 1) < 0) { inflateEnd(&zst); goto error; } *************** *** 415,422 **** so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { ! if (_PyString_Resize(&RetVal, length << 1) == -1) { ! RetVal = NULL; goto error; - } self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; --- 414,419 ---- so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { ! if (_PyString_Resize(&RetVal, length << 1) < 0) goto error; self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; *************** *** 439,445 **** goto error; } ! if (_PyString_Resize(&RetVal, ! self->zst.total_out - start_total_out) < 0) ! RetVal = NULL; error: --- 436,440 ---- goto error; } ! _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: *************** *** 511,518 **** length = max_length; ! if (_PyString_Resize(&RetVal, length) == -1) { ! RetVal = NULL; goto error; - } self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + old_length; --- 506,511 ---- length = max_length; ! if (_PyString_Resize(&RetVal, length) < 0) goto error; self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + old_length; *************** *** 562,567 **** } ! if (_PyString_Resize(&RetVal, self->zst.total_out - start_total_out) < 0) ! RetVal = NULL; error: --- 555,559 ---- } ! _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: *************** *** 613,620 **** so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { ! if (_PyString_Resize(&RetVal, length << 1) == -1) { ! RetVal = NULL; goto error; - } self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; --- 605,610 ---- so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { ! if (_PyString_Resize(&RetVal, length << 1) < 0) goto error; self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; *************** *** 652,657 **** } ! if (_PyString_Resize(&RetVal, self->zst.total_out - start_total_out) < 0) ! RetVal = NULL; error: --- 642,646 ---- } ! _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: From tim_one@sourceforge.net Mon Apr 29 02:37:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 28 Apr 2002 18:37:34 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.397,1.398 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv32409/python/Misc Modified Files: NEWS Log Message: Mostly in SequenceMatcher.{__chain_b, find_longest_match}: This now does a dynamic analysis of which elements are so frequently repeated as to constitute noise. The primary benefit is an enormous speedup in find_longest_match, as the innermost loop can have factors of 100s less potential matches to worry about, in cases where the sequences have many duplicate elements. In effect, this zooms in on sequences of non-ubiquitous elements now. While I like what I've seen of the effects so far, I still consider this experimental. Please give it a try! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.397 retrieving revision 1.398 diff -C2 -d -r1.397 -r1.398 *** NEWS 26 Apr 2002 20:11:29 -0000 1.397 --- NEWS 29 Apr 2002 01:37:32 -0000 1.398 *************** *** 73,79 **** Extension modules ! - The bsddb.*open functions can now take 'None' as a filename. This will create a temporary in-memory bsddb that won't be ! written to disk. - posix.mknod was added. --- 73,79 ---- Extension modules ! - The bsddb.*open functions can now take 'None' as a filename. This will create a temporary in-memory bsddb that won't be ! written to disk. - posix.mknod was added. *************** *** 99,102 **** --- 99,111 ---- Library + + - difflib's SequenceMatcher class now does a dynamic analysis of + which elements are so frequent as to constitute noise. For + comparing files as sequences of lines, this generally works better + than the IS_LINE_JUNK function, and function ndiff's linejunk + argument defaults to None now as a result. A happy benefit is + that SequenceMatcher may run much faster now when applied + to large files with many duplicate lines (for example, C program + text with lots of repeated "}" and "return NULL;" lines). - New Text.dump() method in Tkinter module. From tim_one@sourceforge.net Mon Apr 29 02:37:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 28 Apr 2002 18:37:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdifflib.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32409/python/Doc/lib Modified Files: libdifflib.tex Log Message: Mostly in SequenceMatcher.{__chain_b, find_longest_match}: This now does a dynamic analysis of which elements are so frequently repeated as to constitute noise. The primary benefit is an enormous speedup in find_longest_match, as the innermost loop can have factors of 100s less potential matches to worry about, in cases where the sequences have many duplicate elements. In effect, this zooms in on sequences of non-ubiquitous elements now. While I like what I've seen of the effects so far, I still consider this experimental. Please give it a try! Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libdifflib.tex 29 Nov 2001 19:04:50 -0000 1.11 --- libdifflib.tex 29 Apr 2002 01:37:31 -0000 1.12 *************** *** 91,101 **** for filter functions (or \code{None}): ! \var{linejunk}: A function that should accept a single string ! argument, and return true if the string is junk (or false if it is ! not). The default is module-level function \function{IS_LINE_JUNK()}, which filters out lines without visible characters, except for at most one pound character (\character{\#}). ! \var{charjunk}: A function that should accept a string of length 1. The default is module-level function \function{IS_CHARACTER_JUNK()}, which filters out whitespace characters (a blank or tab; note: bad --- 91,107 ---- for filter functions (or \code{None}): ! \var{linejunk}: A function that accepts a single string ! argument, and returns true if the string is junk, or false if not. ! The default is (\code{None}), starting with Python 2.3. Before then, ! the default was the module-level function \function{IS_LINE_JUNK()}, which filters out lines without visible characters, except for at most one pound character (\character{\#}). + As of Python 2.3, the underlying \class{SequenceMatcher} class + does a dynamic analysis of which lines are so frequent as to + constitute noise, and this usually works better than the pre-2.3 + default. ! \var{charjunk}: A function that accepts a character (a string of ! length 1), and returns if the character is junk, or false if not. The default is module-level function \function{IS_CHARACTER_JUNK()}, which filters out whitespace characters (a blank or tab; note: bad *************** *** 151,155 **** if \var{line} is blank or contains a single \character{\#}, otherwise it is not ignorable. Used as a default for parameter ! \var{linejunk} in \function{ndiff()}. \end{funcdesc} --- 157,161 ---- if \var{line} is blank or contains a single \character{\#}, otherwise it is not ignorable. Used as a default for parameter ! \var{linejunk} in \function{ndiff()} before Python 2.3. \end{funcdesc} *************** *** 444,457 **** for filter functions (or \code{None}): ! \var{linejunk}: A function that should accept a single string ! argument, and return true if the string is junk. The default is ! module-level function \function{IS_LINE_JUNK()}, which filters out ! lines without visible characters, except for at most one pound ! character (\character{\#}). ! \var{charjunk}: A function that should accept a string of length 1. ! The default is module-level function \function{IS_CHARACTER_JUNK()}, ! which filters out whitespace characters (a blank or tab; note: bad ! idea to include newline in this!). \end{classdesc} --- 450,461 ---- for filter functions (or \code{None}): ! \var{linejunk}: A function that accepts a single string ! argument, and returns true if the string is junk. The default is ! \code{None}, meaning that no line is considered junk. ! \var{charjunk}: A function that accepts a single character argument ! (a string of length 1), and returns true if the character is junk. ! The default is \code{None}, meaning that no character is ! considered junk. \end{classdesc} From tim_one@sourceforge.net Mon Apr 29 02:37:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Sun, 28 Apr 2002 18:37:34 -0700 Subject: [Python-checkins] python/dist/src/Lib difflib.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32409/python/Lib Modified Files: difflib.py Log Message: Mostly in SequenceMatcher.{__chain_b, find_longest_match}: This now does a dynamic analysis of which elements are so frequently repeated as to constitute noise. The primary benefit is an enormous speedup in find_longest_match, as the innermost loop can have factors of 100s less potential matches to worry about, in cases where the sequences have many duplicate elements. In effect, this zooms in on sequences of non-ubiquitous elements now. While I like what I've seen of the effects so far, I still consider this experimental. Please give it a try! Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** difflib.py 3 Apr 2002 22:41:50 -0000 1.8 --- difflib.py 29 Apr 2002 01:37:32 -0000 1.9 *************** *** 162,167 **** # for x in b, b2j[x] is a list of the indices (into b) # at which x appears; junk elements do not appear - # b2jhas - # b2j.has_key # fullbcount # for x in b, fullbcount[x] == the number of times x --- 162,165 ---- *************** *** 189,192 **** --- 187,194 ---- # it's really the has_key method of a hidden dict. # DOES NOT WORK for x in a! + # isbpopular + # for x in b, isbpopular(x) is true iff b is reasonably long + # (at least 200 elements) and x accounts for more than 1% of + # its elements. DOES NOT WORK for x in a! self.isjunk = isjunk *************** *** 267,270 **** --- 269,278 ---- # from starting any matching block at a junk element ... # also creates the fast isbjunk function ... + # b2j also does not contain entries for "popular" elements, meaning + # elements that account for more than 1% of the total elements, and + # when the sequence is reasonably large (>= 200 elements); this can + # be viewed as an adaptive notion of semi-junk, and yields an enormous + # speedup when, e.g., comparing program files with hundreds of + # instances of "return NULL;" ... # note that this is only called when b changes; so for cross-product # kinds of matches, it's best to call set_seq2 once, then set_seq1 *************** *** 283,305 **** # from the start. b = self.b self.b2j = b2j = {} ! self.b2jhas = b2jhas = b2j.has_key ! for i in xrange(len(b)): ! elt = b[i] ! if b2jhas(elt): ! b2j[elt].append(i) else: b2j[elt] = [i] # Now b2j.keys() contains elements uniquely, and especially when # the sequence is a string, that's usually a good deal smaller # than len(string). The difference is the number of isjunk calls # saved. ! isjunk, junkdict = self.isjunk, {} if isjunk: ! for elt in b2j.keys(): ! if isjunk(elt): ! junkdict[elt] = 1 # value irrelevant; it's a set ! del b2j[elt] # Now for x in b, isjunk(x) == junkdict.has_key(x), but the --- 291,324 ---- # from the start. b = self.b + n = len(b) self.b2j = b2j = {} ! populardict = {} ! for i, elt in enumerate(b): ! if elt in b2j: ! indices = b2j[elt] ! if n >= 200 and len(indices) * 100 > n: ! populardict[elt] = 1 ! del indices[:] ! else: ! indices.append(i) else: b2j[elt] = [i] + # Purge leftover indices for popular elements. + for elt in populardict: + del b2j[elt] + # Now b2j.keys() contains elements uniquely, and especially when # the sequence is a string, that's usually a good deal smaller # than len(string). The difference is the number of isjunk calls # saved. ! isjunk = self.isjunk ! junkdict = {} if isjunk: ! for d in populardict, b2j: ! for elt in d.keys(): ! if isjunk(elt): ! junkdict[elt] = 1 ! del d[elt] # Now for x in b, isjunk(x) == junkdict.has_key(x), but the *************** *** 309,312 **** --- 328,332 ---- # this dict alive is likely trivial compared to the size of b2j. self.isbjunk = junkdict.has_key + self.isbpopular = populardict.has_key def find_longest_match(self, alo, ahi, blo, bhi): *************** *** 389,392 **** --- 409,425 ---- j2len = newj2len + # Extend the best by non-junk elements on each end. In particular, + # "popular" non-junk elements aren't in b2j, which greatly speeds + # the inner loop above, but also means "the best" match so far + # doesn't contain any junk *or* popular non-junk elements. + while besti > alo and bestj > blo and \ + not isbjunk(b[bestj-1]) and \ + a[besti-1] == b[bestj-1]: + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + while besti+bestsize < ahi and bestj+bestsize < bhi and \ + not isbjunk(b[bestj+bestsize]) and \ + a[besti+bestsize] == b[bestj+bestsize]: + bestsize += 1 + # Now that we have a wholly interesting match (albeit possibly # empty!), we may as well suck up the matching junk on each *************** *** 737,746 **** and return true iff the string is junk. The module-level function `IS_LINE_JUNK` may be used to filter out lines without visible ! characters, except for at most one splat ('#'). - `charjunk`: A function that should accept a string of length 1. The module-level function `IS_CHARACTER_JUNK` may be used to filter out whitespace characters (a blank or tab; **note**: bad idea to include ! newline in this!). """ --- 770,783 ---- and return true iff the string is junk. The module-level function `IS_LINE_JUNK` may be used to filter out lines without visible ! characters, except for at most one splat ('#'). It is recommended ! to leave linejunk None; as of Python 2.3, the underlying ! SequenceMatcher class has grown an adaptive notion of "noise" lines ! that's better than any static definition the author has ever been ! able to craft. - `charjunk`: A function that should accept a string of length 1. The module-level function `IS_CHARACTER_JUNK` may be used to filter out whitespace characters (a blank or tab; **note**: bad idea to include ! newline in this!). Use of IS_CHARACTER_JUNK is recommended. """ *************** *** 1006,1010 **** del re ! def ndiff(a, b, linejunk=IS_LINE_JUNK, charjunk=IS_CHARACTER_JUNK): r""" Compare `a` and `b` (lists of strings); return a `Differ`-style delta. --- 1043,1047 ---- del re ! def ndiff(a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK): r""" Compare `a` and `b` (lists of strings); return a `Differ`-style delta. *************** *** 1014,1020 **** - linejunk: A function that should accept a single string argument, and ! return true iff the string is junk. The default is module-level function ! IS_LINE_JUNK, which filters out lines without visible characters, except ! for at most one splat ('#'). - charjunk: A function that should accept a string of length 1. The --- 1051,1057 ---- - linejunk: A function that should accept a single string argument, and ! return true iff the string is junk. The default is None, and is ! recommended; as of Python 2.3, an adaptive notion of "noise" lines is ! used that does a good job on its own. - charjunk: A function that should accept a string of length 1. The From gvanrossum@sourceforge.net Mon Apr 29 14:54:50 2002 From: gvanrossum@sourceforge.net (gvanrossum@sourceforge.net) Date: Mon, 29 Apr 2002 06:54:50 -0700 Subject: [Python-checkins] python/dist/src/Modules cStringIO.c,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv3702 Modified Files: cStringIO.c Log Message: See discussion at SF bug 547537. Unicode objects are currently taken as binary data by the write() method. This is not what Unicode users expect, nor what the StringIO.py code does. Until somebody adds a way to specify binary or text mode for cStringIO objects, change the format string to use "t#" instead of "s#", so that it will request the "text buffer" version. This will try the default encoding for Unicode objects. This is *not* a 2.2 bugfix (since it *is* a semantic change). Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** cStringIO.c 4 Apr 2002 17:52:50 -0000 2.34 --- cStringIO.c 29 Apr 2002 13:54:48 -0000 2.35 *************** *** 377,381 **** int l; ! UNLESS (PyArg_ParseTuple(args, "s#:write", &c, &l)) return NULL; if (O_cwrite((PyObject*)self,c,l) < 0) return NULL; --- 377,381 ---- int l; ! UNLESS (PyArg_ParseTuple(args, "t#:write", &c, &l)) return NULL; if (O_cwrite((PyObject*)self,c,l) < 0) return NULL; From fdrake@sourceforge.net Mon Apr 29 16:17:26 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 29 Apr 2002 08:17:26 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv5311/api Modified Files: concrete.tex Log Message: Small markup adjustments for consistency. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** concrete.tex 27 Apr 2002 18:44:29 -0000 1.13 --- concrete.tex 29 Apr 2002 15:17:16 -0000 1.14 *************** *** 592,600 **** Pass the address of an existing string object as an lvalue (it may be written into), and the new size desired. On success, \var{*string} ! holds the resized string object and 0 is returned; the address in \var{*string} may differ from its input value. If the reallocation fails, the original string object at \var{*string} is deallocated, \var{*string} is set to \NULL{}, a memory exception is set, ! and -1 is returned. \end{cfuncdesc} --- 592,600 ---- Pass the address of an existing string object as an lvalue (it may be written into), and the new size desired. On success, \var{*string} ! holds the resized string object and \code{0} is returned; the address in \var{*string} may differ from its input value. If the reallocation fails, the original string object at \var{*string} is deallocated, \var{*string} is set to \NULL{}, a memory exception is set, ! and \code{-1} is returned. \end{cfuncdesc} From akuchling@sourceforge.net Mon Apr 29 16:42:20 2002 From: akuchling@sourceforge.net (akuchling@sourceforge.net) Date: Mon, 29 Apr 2002 08:42:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv17229 Modified Files: whatsnew23.tex Log Message: Add some items, and remove a note to myself Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** whatsnew23.tex 15 Apr 2002 14:05:59 -0000 1.8 --- whatsnew23.tex 29 Apr 2002 15:42:16 -0000 1.9 *************** *** 217,223 **** - support +=, *= Return enhanced tuples in grpmodule ! posixmodule: killpg, mknod Expat is now included with the Python source --- 217,226 ---- - support +=, *= + distutils: command/bdist_packager, support for Solaris pkgtool + and HP-UX swinstall + Return enhanced tuples in grpmodule ! posixmodule: killpg, mknod, fchdir, Expat is now included with the Python source *************** *** 233,244 **** Add dict method pop(). %====================================================================== \section{Interpreter Changes and Fixes} - XXX bug? Change the version string from "2.2+" to "2.3a0". disutils peels off - the first 3 characters of this string in several places, so for as long - as they remain "2.2" it confuses the heck out of attempts to build 2.3 - stuff using distutils. - file object can now be subtyped (did this not work before?) --- 236,244 ---- Add dict method pop(). + New enumerate() built-in. + %====================================================================== \section{Interpreter Changes and Fixes} file object can now be subtyped (did this not work before?) *************** *** 307,311 **** were not Python-compatible. ! Checked in Sean Reifschneider's RPM spec file and patches. Bugfix candidate. --- 307,311 ---- were not Python-compatible. ! Checked in Sean Reifschneider's RPM spec file and patches. From theller@sourceforge.net Mon Apr 29 18:28:45 2002 From: theller@sourceforge.net (theller@sourceforge.net) Date: Mon, 29 Apr 2002 10:28:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv27105 Modified Files: concrete.tex Log Message: Typo: whcar_t should be wchar_t. Bugfix candidate? Don't know how this is handled in the docs. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** concrete.tex 29 Apr 2002 15:17:16 -0000 1.14 --- concrete.tex 29 Apr 2002 17:28:43 -0000 1.15 *************** *** 885,889 **** \begin{cfuncdesc}{PyObject*}{PyUnicode_FromWideChar}{const wchar_t *w, int size} ! Create a Unicode object from the \ctype{whcar_t} buffer \var{w} of the given size. Returns \NULL{} on failure. \end{cfuncdesc} --- 885,889 ---- \begin{cfuncdesc}{PyObject*}{PyUnicode_FromWideChar}{const wchar_t *w, int size} ! Create a Unicode object from the \ctype{wchar_t} buffer \var{w} of the given size. Returns \NULL{} on failure. \end{cfuncdesc} *************** *** 892,898 **** wchar_t *w, int size} ! Copies the Unicode object contents into the \ctype{whcar_t} buffer ! \var{w}. At most \var{size} \ctype{whcar_t} characters are copied. ! Returns the number of \ctype{whcar_t} characters copied or -1 in case of an error. \end{cfuncdesc} --- 892,898 ---- wchar_t *w, int size} ! Copies the Unicode object contents into the \ctype{wchar_t} buffer ! \var{w}. At most \var{size} \ctype{wchar_t} characters are copied. ! Returns the number of \ctype{wchar_t} characters copied or -1 in case of an error. \end{cfuncdesc} From tim_one@sourceforge.net Mon Apr 29 22:27:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 29 Apr 2002 14:27:34 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.253,2.254 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv17494/python/Python Modified Files: bltinmodule.c Log Message: builtin_zip(): Take a good guess at how big the result list will be, and allocate it in one gulp. This isn't a bugfix, it's just a minor optimization that may or may not pay off. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.253 retrieving revision 2.254 diff -C2 -d -r2.253 -r2.254 *** bltinmodule.c 27 Apr 2002 18:44:32 -0000 2.253 --- bltinmodule.c 29 Apr 2002 21:27:32 -0000 2.254 *************** *** 382,386 **** PyCompilerFlags cf; ! if (!PyArg_ParseTuple(args, "sss|ii:compile", &str, &filename, &startstr, &supplied_flags, &dont_inherit)) return NULL; --- 382,386 ---- PyCompilerFlags cf; ! if (!PyArg_ParseTuple(args, "sss|ii:compile", &str, &filename, &startstr, &supplied_flags, &dont_inherit)) return NULL; *************** *** 1129,1133 **** else if (!PyArg_ParseTuple(args, "O:min/max", &v)) return NULL; ! it = PyObject_GetIter(v); if (it == NULL) --- 1129,1133 ---- else if (!PyArg_ParseTuple(args, "O:min/max", &v)) return NULL; ! it = PyObject_GetIter(v); if (it == NULL) *************** *** 1705,1711 **** { PyObject *ret; ! int itemsize = PySequence_Length(args); int i; PyObject *itlist; /* tuple of iterators */ if (itemsize < 1) { --- 1705,1712 ---- { PyObject *ret; ! const int itemsize = PySequence_Length(args); int i; PyObject *itlist; /* tuple of iterators */ + int len; /* guess at result length */ if (itemsize < 1) { *************** *** 1717,1722 **** assert(PyTuple_Check(args)); /* allocate result list */ ! if ((ret = PyList_New(0)) == NULL) return NULL; --- 1718,1736 ---- assert(PyTuple_Check(args)); + /* Guess at result length: the shortest of the input lengths. */ + len = -1; /* unknown */ + for (i = 0; i < itemsize; ++i) { + PyObject *item = PyTuple_GET_ITEM(args, i); + int thislen = PySequence_Length(item); + if (thislen < 0) + PyErr_Clear(); + else if (len < 0 || thislen < len) + len = thislen; + } + /* allocate result list */ ! if (len < 0) ! len = 10; /* arbitrary */ ! if ((ret = PyList_New(len)) == NULL) return NULL; *************** *** 1739,1750 **** /* build result into ret list */ ! for (;;) { ! int status; PyObject *next = PyTuple_New(itemsize); if (!next) goto Fail_ret_itlist; ! for (i = 0; i < itemsize; i++) { ! PyObject *it = PyTuple_GET_ITEM(itlist, i); PyObject *item = PyIter_Next(it); if (!item) { --- 1753,1764 ---- /* build result into ret list */ ! for (i = 0; ; ++i) { ! int j; PyObject *next = PyTuple_New(itemsize); if (!next) goto Fail_ret_itlist; ! for (j = 0; j < itemsize; j++) { ! PyObject *it = PyTuple_GET_ITEM(itlist, j); PyObject *item = PyIter_Next(it); if (!item) { *************** *** 1755,1768 **** Py_DECREF(next); Py_DECREF(itlist); ! return ret; } ! PyTuple_SET_ITEM(next, i, item); } ! status = PyList_Append(ret, next); ! Py_DECREF(next); ! if (status < 0) ! goto Fail_ret_itlist; } Fail_ret_itlist: --- 1769,1795 ---- Py_DECREF(next); Py_DECREF(itlist); ! goto Done; } ! PyTuple_SET_ITEM(next, j, item); } ! if (i < len) ! PyList_SET_ITEM(ret, i, next); ! else { ! int status = PyList_Append(ret, next); ! Py_DECREF(next); ! ++len; ! if (status < 0) ! goto Fail_ret_itlist; ! } ! } ! ! Done: ! if (ret != NULL && i < len) { ! /* The list is too big. */ ! if (PyList_SetSlice(ret, i, len, NULL) < 0) ! return NULL; } + return ret; Fail_ret_itlist: *************** *** 1865,1869 **** #endif SETBUILTIN("dict", &PyDict_Type); ! SETBUILTIN("enumerate", &PyEnum_Type); SETBUILTIN("float", &PyFloat_Type); SETBUILTIN("property", &PyProperty_Type); --- 1892,1896 ---- #endif SETBUILTIN("dict", &PyDict_Type); ! SETBUILTIN("enumerate", &PyEnum_Type); SETBUILTIN("float", &PyFloat_Type); SETBUILTIN("property", &PyProperty_Type); From tim_one@sourceforge.net Mon Apr 29 22:27:34 2002 From: tim_one@sourceforge.net (tim_one@sourceforge.net) Date: Mon, 29 Apr 2002 14:27:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_iter.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17494/python/Lib/test Modified Files: test_iter.py Log Message: builtin_zip(): Take a good guess at how big the result list will be, and allocate it in one gulp. This isn't a bugfix, it's just a minor optimization that may or may not pay off. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_iter.py 3 Dec 2001 19:33:25 -0000 1.23 --- test_iter.py 29 Apr 2002 21:27:31 -0000 1.24 *************** *** 468,471 **** --- 468,499 ---- pass + self.assertEqual(zip(xrange(5)), [(i,) for i in range(5)]) + + # Classes that lie about their lengths. + class NoGuessLen5: + def __getitem__(self, i): + if i >= 5: + raise IndexError + return i + + class Guess3Len5(NoGuessLen5): + def __len__(self): + return 3 + + class Guess30Len5(NoGuessLen5): + def __len__(self): + return 30 + + self.assertEqual(len(Guess3Len5()), 3) + self.assertEqual(len(Guess30Len5()), 30) + self.assertEqual(zip(NoGuessLen5()), zip(range(5))) + self.assertEqual(zip(Guess3Len5()), zip(range(5))) + self.assertEqual(zip(Guess30Len5()), zip(range(5))) + + expected = [(i, i) for i in range(5)] + for x in NoGuessLen5(), Guess3Len5(), Guess30Len5(): + for y in NoGuessLen5(), Guess3Len5(), Guess30Len5(): + self.assertEqual(zip(x, y), expected) + # Test reduces()'s use of iterators. def test_builtin_reduce(self): From fdrake@sourceforge.net Tue Apr 30 03:18:54 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 29 Apr 2002 19:18:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22170/ref Modified Files: ref5.tex Log Message: Added a missing "|" in the grammar productions used in the reference manual (reported by François Pinard). Added some missing "_" characters in the same cluster of productions. Added missing floor division operator in m_expr production, and mention floor division in the relevant portion of the text. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** ref5.tex 9 Apr 2002 14:39:10 -0000 1.59 --- ref5.tex 30 Apr 2002 02:18:51 -0000 1.60 *************** *** 649,657 **** \production{m_expr} {\token{u_expr} | \token{m_expr} "*" \token{u_expr} | \token{m_expr} "/" \token{u_expr}} \productioncont{| \token{m_expr} "\%" \token{u_expr}} \production{a_expr} ! {\token{m_expr} | \token{aexpr} "+" \token{m_expr} ! \token{aexpr} "-" \token{m_expr}} \end{productionlist} --- 649,658 ---- \production{m_expr} {\token{u_expr} | \token{m_expr} "*" \token{u_expr} + | \token{m_expr} "//" \token{u_expr} | \token{m_expr} "/" \token{u_expr}} \productioncont{| \token{m_expr} "\%" \token{u_expr}} \production{a_expr} ! {\token{m_expr} | \token{a_expr} "+" \token{m_expr} ! | \token{a_expr} "-" \token{m_expr}} \end{productionlist} *************** *** 664,672 **** \index{multiplication} ! The \code{/} (division) operator yields the quotient of its ! arguments. The numeric arguments are first converted to a common ! type. Plain or long integer division yields an integer of the same ! type; the result is that of mathematical division with the `floor' ! function applied to the result. Division by zero raises the \exception{ZeroDivisionError} exception. \exindex{ZeroDivisionError} --- 665,674 ---- \index{multiplication} ! The \code{/} (division) and \code{//} (floor division) operators yield ! the quotient of their arguments. The numeric arguments are first ! converted to a common type. Plain or long integer division yields an ! integer of the same type; the result is that of mathematical division ! with the `floor' function applied to the result. Division by zero ! raises the \exception{ZeroDivisionError} exception. \exindex{ZeroDivisionError} From fdrake@sourceforge.net Tue Apr 30 03:21:35 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Mon, 29 Apr 2002 19:21:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.53.4.4,1.53.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22806/ref Modified Files: Tag: release22-maint ref5.tex Log Message: Added a missing "|" in the grammar productions used in the reference manual (reported by François Pinard). Added some missing "_" characters in the same cluster of productions. Added missing floor division operator in m_expr production, and mention floor division in the relevant portion of the text. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.53.4.4 retrieving revision 1.53.4.5 diff -C2 -d -r1.53.4.4 -r1.53.4.5 *** ref5.tex 9 Apr 2002 14:38:44 -0000 1.53.4.4 --- ref5.tex 30 Apr 2002 02:21:32 -0000 1.53.4.5 *************** *** 665,673 **** \production{m_expr} {\token{u_expr} | \token{m_expr} "*" \token{u_expr} | \token{m_expr} "/" \token{u_expr}} \productioncont{| \token{m_expr} "\%" \token{u_expr}} \production{a_expr} ! {\token{m_expr} | \token{aexpr} "+" \token{m_expr} ! \token{aexpr} "-" \token{m_expr}} \end{productionlist} --- 665,674 ---- \production{m_expr} {\token{u_expr} | \token{m_expr} "*" \token{u_expr} + | \token{m_expr} "//" \token{u_expr} | \token{m_expr} "/" \token{u_expr}} \productioncont{| \token{m_expr} "\%" \token{u_expr}} \production{a_expr} ! {\token{m_expr} | \token{a_expr} "+" \token{m_expr} ! | \token{a_expr} "-" \token{m_expr}} \end{productionlist} *************** *** 680,688 **** \index{multiplication} ! The \code{/} (division) operator yields the quotient of its ! arguments. The numeric arguments are first converted to a common ! type. Plain or long integer division yields an integer of the same ! type; the result is that of mathematical division with the `floor' ! function applied to the result. Division by zero raises the \exception{ZeroDivisionError} exception. \exindex{ZeroDivisionError} --- 681,690 ---- \index{multiplication} ! The \code{/} (division) and \code{//} (floor division) operators yield ! the quotient of their arguments. The numeric arguments are first ! converted to a common type. Plain or long integer division yields an ! integer of the same type; the result is that of mathematical division ! with the `floor' function applied to the result. Division by zero ! raises the \exception{ZeroDivisionError} exception. \exindex{ZeroDivisionError} From anthonybaxter@sourceforge.net Tue Apr 30 04:24:15 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 20:24:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.6.6.2,1.6.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv3514/Doc/api Modified Files: Tag: release22-maint concrete.tex Log Message: backport tim_one's patch: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Original patch(es): python/dist/src/Doc/api/concrete.tex:1.13 Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.6.6.2 retrieving revision 1.6.6.3 diff -C2 -d -r1.6.6.2 -r1.6.6.3 *** concrete.tex 10 Apr 2002 18:00:44 -0000 1.6.6.2 --- concrete.tex 30 Apr 2002 03:24:12 -0000 1.6.6.3 *************** *** 583,587 **** A way to resize a string object even though it is ``immutable''. Only use this to build up a brand new string object; don't use this ! if the string may already be known in other parts of the code. \end{cfuncdesc} --- 583,596 ---- A way to resize a string object even though it is ``immutable''. Only use this to build up a brand new string object; don't use this ! if the string may already be known in other parts of the code. It ! is an error to call this function if the refcount on the input string ! object is not one. ! Pass the address of an existing string object as an lvalue (it may ! be written into), and the new size desired. On success, \var{*string} ! holds the resized string object and 0 is returned; the address in ! \var{*string} may differ from its input value. If the ! reallocation fails, the original string object at \var{*string} is ! deallocated, \var{*string} is set to \NULL{}, a memory exception is set, ! and -1 is returned. \end{cfuncdesc} From anthonybaxter@sourceforge.net Tue Apr 30 04:33:17 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 20:33:17 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.3,2.33.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv4828/Modules Modified Files: Tag: release22-maint gcmodule.c Log Message: backport tim_one's patch: (some tweaking for different _PyObject_GC_Malloc() call in 2.2. checked, still returns the same thing on failure...) _PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument. _PyObject_GC_NewVar: Could call PyObject_INIT_VAR likewise. Bugfix candidate. Original patch(es): python/dist/src/Modules/gcmodule.c:2.40 Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.33.6.3 retrieving revision 2.33.6.4 diff -C2 -d -r2.33.6.3 -r2.33.6.4 *** gcmodule.c 3 Apr 2002 14:07:32 -0000 2.33.6.3 --- gcmodule.c 30 Apr 2002 03:33:15 -0000 2.33.6.4 *************** *** 862,866 **** { PyObject *op = _PyObject_GC_Malloc(tp, 0); ! return PyObject_INIT(op, tp); } --- 862,868 ---- { PyObject *op = _PyObject_GC_Malloc(tp, 0); ! if (op != NULL) ! op = PyObject_INIT(op, tp); ! return op; } *************** *** 869,873 **** { PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(tp, nitems); ! return PyObject_INIT_VAR(op, tp, nitems); } --- 871,877 ---- { PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(tp, nitems); ! if (op != NULL) ! op = PyObject_INIT_VAR(op, tp, nitems); ! return op; } From anthonybaxter@sourceforge.net Tue Apr 30 04:41:56 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 20:41:56 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.141.6.4,2.141.6.5 stringobject.c,2.147.6.3,2.147.6.4 unicodeobject.c,2.124.6.8,2.124.6.9 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6207/Objects Modified Files: Tag: release22-maint fileobject.c stringobject.c unicodeobject.c Log Message: backport tim_one's patch: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Original patch(es): python/dist/src/Objects/fileobject.c:2.161 python/dist/src/Objects/stringobject.c:2.161 python/dist/src/Objects/unicodeobject.c:2.147 Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.141.6.4 retrieving revision 2.141.6.5 diff -C2 -d -r2.141.6.4 -r2.141.6.5 *** fileobject.c 8 Apr 2002 04:19:50 -0000 2.141.6.4 --- fileobject.c 30 Apr 2002 03:41:53 -0000 2.141.6.5 *************** *** 1167,1173 **** } cleanup: ! if (big_buffer) { ! Py_DECREF(big_buffer); ! } return list; } --- 1167,1171 ---- } cleanup: ! Py_XDECREF(big_buffer); return list; } Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.3 retrieving revision 2.147.6.4 diff -C2 -d -r2.147.6.3 -r2.147.6.4 *** stringobject.c 22 Apr 2002 18:42:44 -0000 2.147.6.3 --- stringobject.c 30 Apr 2002 03:41:53 -0000 2.147.6.4 *************** *** 1902,1907 **** } /* Fix the size of the resulting string */ ! if (inlen > 0 &&_PyString_Resize(&result, output-output_start)) ! return NULL; return result; } --- 1902,1907 ---- } /* Fix the size of the resulting string */ ! if (inlen > 0) ! _PyString_Resize(&result, output - output_start); return result; } *************** *** 2964,2968 **** as creating a new string object and destroying the old one, only more efficiently. In any case, don't use this if the string may ! already be known to some other part of the code... */ int --- 2964,2975 ---- as creating a new string object and destroying the old one, only more efficiently. In any case, don't use this if the string may ! already be known to some other part of the code... ! Note that if there's not enough memory to resize the string, the original ! string object at *pv is deallocated, *pv is set to NULL, an "out of ! memory" exception is set, and -1 is returned. Else (on success) 0 is ! returned, and the value in *pv may or may not be the same as on input. ! As always, an extra byte is allocated for a trailing \0 byte (newsize ! does *not* include that), and a trailing \0 byte is stored. ! */ int Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.8 retrieving revision 2.124.6.9 diff -C2 -d -r2.124.6.8 -r2.124.6.9 *** unicodeobject.c 22 Apr 2002 18:42:45 -0000 2.124.6.8 --- unicodeobject.c 30 Apr 2002 03:41:53 -0000 2.124.6.9 *************** *** 928,935 **** } ! if (_PyString_Resize(&v, out - start)) { ! Py_DECREF(v); ! return NULL; ! } return v; } --- 928,932 ---- } ! _PyString_Resize(&v, out - start); return v; } *************** *** 1779,1783 **** if (offset + 12 > PyString_GET_SIZE(repr)) { if (_PyString_Resize(&repr, PyString_GET_SIZE(repr) + 100)) ! goto onError; p = PyString_AS_STRING(repr) + offset; } --- 1776,1780 ---- if (offset + 12 > PyString_GET_SIZE(repr)) { if (_PyString_Resize(&repr, PyString_GET_SIZE(repr) + 100)) ! return NULL; p = PyString_AS_STRING(repr) + offset; } *************** *** 1862,1873 **** *p = '\0'; ! if (_PyString_Resize(&repr, p - PyString_AS_STRING(repr))) ! goto onError; ! return repr; - - onError: - Py_DECREF(repr); - return NULL; } --- 1859,1864 ---- *p = '\0'; ! _PyString_Resize(&repr, p - PyString_AS_STRING(repr)); return repr; } *************** *** 2000,2011 **** } *p = '\0'; ! if (_PyString_Resize(&repr, p - q)) ! goto onError; ! return repr; - - onError: - Py_DECREF(repr); - return NULL; } --- 1991,1996 ---- } *p = '\0'; ! _PyString_Resize(&repr, p - q); return repr; } *************** *** 2107,2112 **** /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! if (_PyString_Resize(&repr, s - start)) ! goto onError; return repr; --- 2092,2096 ---- /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! _PyString_Resize(&repr, s - start); return repr; *************** *** 2255,2260 **** /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! if (_PyString_Resize(&repr, s - start)) ! goto onError; return repr; --- 2239,2243 ---- /* Resize if error handling skipped some characters */ if (s - start < PyString_GET_SIZE(repr)) ! _PyString_Resize(&repr, s - start); return repr; *************** *** 2603,2612 **** } if (s - PyString_AS_STRING(v) < PyString_GET_SIZE(v)) ! if (_PyString_Resize(&v, (int)(s - PyString_AS_STRING(v)))) ! goto onError; return v; onError: ! Py_DECREF(v); return NULL; } --- 2586,2594 ---- } if (s - PyString_AS_STRING(v) < PyString_GET_SIZE(v)) ! _PyString_Resize(&v, (int)(s - PyString_AS_STRING(v))); return v; onError: ! Py_XDECREF(v); return NULL; } From anthonybaxter@sourceforge.net Tue Apr 30 04:58:49 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 20:58:49 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.110.2.1,2.110.2.2 stringobject.c,2.102.2.4,2.102.2.5 unicodeobject.c,2.82.2.1,2.82.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9184/Objects Modified Files: Tag: release21-maint fileobject.c stringobject.c unicodeobject.c Log Message: backport tim_one's patch: [Re-did unicodeobject.c - it's changed a lot since 2.1 :) Pretty confident that it's correct] Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Original patch(es): python/dist/src/Objects/fileobject.c:2.161 python/dist/src/Objects/stringobject.c:2.161 python/dist/src/Objects/unicodeobject.c:2.147 Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.110.2.1 retrieving revision 2.110.2.2 diff -C2 -d -r2.110.2.1 -r2.110.2.2 *** fileobject.c 7 Jan 2002 06:42:37 -0000 2.110.2.1 --- fileobject.c 30 Apr 2002 03:58:47 -0000 2.110.2.2 *************** *** 1105,1111 **** } cleanup: ! if (big_buffer) { ! Py_DECREF(big_buffer); ! } return list; } --- 1105,1109 ---- } cleanup: ! Py_XDECREF(big_buffer); return list; } Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.102.2.4 retrieving revision 2.102.2.5 diff -C2 -d -r2.102.2.4 -r2.102.2.5 *** stringobject.c 23 May 2001 14:38:53 -0000 2.102.2.4 --- stringobject.c 30 Apr 2002 03:58:47 -0000 2.102.2.5 *************** *** 1450,1455 **** } /* Fix the size of the resulting string */ ! if (inlen > 0 &&_PyString_Resize(&result, output-output_start)) ! return NULL; return result; } --- 1450,1455 ---- } /* Fix the size of the resulting string */ ! if (inlen > 0) ! _PyString_Resize(&result, output - output_start); return result; } *************** *** 2426,2430 **** as creating a new string object and destroying the old one, only more efficiently. In any case, don't use this if the string may ! already be known to some other part of the code... */ int --- 2426,2437 ---- as creating a new string object and destroying the old one, only more efficiently. In any case, don't use this if the string may ! already be known to some other part of the code... ! Note that if there's not enough memory to resize the string, the original ! string object at *pv is deallocated, *pv is set to NULL, an "out of ! memory" exception is set, and -1 is returned. Else (on success) 0 is ! returned, and the value in *pv may or may not be the same as on input. ! As always, an extra byte is allocated for a trailing \0 byte (newsize ! does *not* include that), and a trailing \0 byte is stored. ! */ int Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.82.2.1 retrieving revision 2.82.2.2 diff -C2 -d -r2.82.2.1 -r2.82.2.2 *** unicodeobject.c 23 May 2001 12:31:25 -0000 2.82.2.1 --- unicodeobject.c 30 Apr 2002 03:58:47 -0000 2.82.2.2 *************** *** 865,869 **** onError: - Py_DECREF(v); return NULL; } --- 865,868 ---- *************** *** 1366,1370 **** onError: - Py_DECREF(repr); return NULL; } --- 1365,1368 ---- *************** *** 1502,1506 **** onError: - Py_DECREF(repr); return NULL; } --- 1500,1503 ---- *************** *** 1590,1595 **** if (ch >= 256) { if (latin1_encoding_error(&p, &s, errors, ! "ordinal not in range(256)")) goto onError; } else --- 1587,1594 ---- if (ch >= 256) { if (latin1_encoding_error(&p, &s, errors, ! "ordinal not in range(256)")) { ! Py_DECREF(repr); goto onError; + } } else *************** *** 1603,1607 **** onError: - Py_DECREF(repr); return NULL; } --- 1602,1605 ---- *************** *** 1733,1738 **** if (ch >= 128) { if (ascii_encoding_error(&p, &s, errors, ! "ordinal not in range(128)")) goto onError; } else --- 1731,1738 ---- if (ch >= 128) { if (ascii_encoding_error(&p, &s, errors, ! "ordinal not in range(128)")) { ! Py_DECREF(repr); goto onError; + } } else *************** *** 1746,1750 **** onError: - Py_DECREF(repr); return NULL; } --- 1746,1749 ---- *************** *** 2019,2023 **** w = PyInt_FromLong((long)ch); if (w == NULL) ! goto onError; x = PyObject_GetItem(mapping, w); Py_DECREF(w); --- 2018,2022 ---- w = PyInt_FromLong((long)ch); if (w == NULL) ! goto onErrorDecref; x = PyObject_GetItem(mapping, w); Py_DECREF(w); *************** *** 2029,2033 **** Py_INCREF(x); } else ! goto onError; } --- 2028,2032 ---- Py_INCREF(x); } else ! goto onErrorDecref; } *************** *** 2039,2043 **** "character mapping must be in range(256)"); Py_DECREF(x); ! goto onError; } *s++ = (char)value; --- 2038,2042 ---- "character mapping must be in range(256)"); Py_DECREF(x); ! goto onErrorDecref; } *s++ = (char)value; *************** *** 2048,2052 **** "character maps to ")) { Py_DECREF(x); ! goto onError; } } --- 2047,2051 ---- "character maps to ")) { Py_DECREF(x); ! goto onErrorDecref; } } *************** *** 2067,2071 **** extrachars += needed; if (_PyString_Resize(&v, PyString_GET_SIZE(v) + needed)) { ! Py_DECREF(x); goto onError; } --- 2066,2070 ---- extrachars += needed; if (_PyString_Resize(&v, PyString_GET_SIZE(v) + needed)) { ! Py_DECREF(x); goto onError; } *************** *** 2085,2089 **** "character mapping must return integer, None or unicode"); Py_DECREF(x); ! goto onError; } Py_DECREF(x); --- 2084,2088 ---- "character mapping must return integer, None or unicode"); Py_DECREF(x); ! goto onErrorDecref; } Py_DECREF(x); *************** *** 2094,2099 **** return v; ! onError: Py_DECREF(v); return NULL; } --- 2093,2099 ---- return v; ! onErrorDecref: Py_DECREF(v); + onError: return NULL; } From anthonybaxter@sourceforge.net Tue Apr 30 05:01:23 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 21:01:23 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.197.2.2,2.197.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9861/Python Modified Files: Tag: release21-maint bltinmodule.c Log Message: backport tim_one's patch: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Original patch(es): python/dist/src/Python/bltinmodule.c:2.253 Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.197.2.2 retrieving revision 2.197.2.3 diff -C2 -d -r2.197.2.2 -r2.197.2.3 *** bltinmodule.c 20 Apr 2002 18:21:29 -0000 2.197.2.2 --- bltinmodule.c 30 Apr 2002 04:01:21 -0000 2.197.2.3 *************** *** 2326,2331 **** } ! if (j < len && _PyString_Resize(&result, j) < 0) ! return NULL; return result; --- 2326,2331 ---- } ! if (j < len) ! _PyString_Resize(&result, j); return result; From anthonybaxter@sourceforge.net Tue Apr 30 05:05:36 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 21:05:36 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.246.4.3,2.246.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11267/Python Modified Files: Tag: release22-maint bltinmodule.c Log Message: backport tim_one's patch: Repair widespread misuse of _PyString_Resize. Since it's clear people don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate. Original patch(es): python/dist/src/Python/bltinmodule.c:2.253 Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.246.4.3 retrieving revision 2.246.4.4 diff -C2 -d -r2.246.4.3 -r2.246.4.4 *** bltinmodule.c 8 Apr 2002 13:29:00 -0000 2.246.4.3 --- bltinmodule.c 30 Apr 2002 04:05:33 -0000 2.246.4.4 *************** *** 2001,2006 **** } ! if (j < len && _PyString_Resize(&result, j) < 0) ! return NULL; return result; --- 2001,2006 ---- } ! if (j < len) ! _PyString_Resize(&result, j); return result; From anthonybaxter@sourceforge.net Tue Apr 30 05:07:59 2002 From: anthonybaxter@sourceforge.net (anthonybaxter@sourceforge.net) Date: Mon, 29 Apr 2002 21:07:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.6.6.3,1.6.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv12037/Doc/api Modified Files: Tag: release22-maint concrete.tex Log Message: backport theller's patch: Typo: whcar_t should be wchar_t. Bugfix candidate? Don't know how this is handled in the docs. Original patch(es): python/dist/src/Doc/api/concrete.tex:1.15 Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.6.6.3 retrieving revision 1.6.6.4 diff -C2 -d -r1.6.6.3 -r1.6.6.4 *** concrete.tex 30 Apr 2002 03:24:12 -0000 1.6.6.3 --- concrete.tex 30 Apr 2002 04:07:57 -0000 1.6.6.4 *************** *** 881,885 **** \begin{cfuncdesc}{PyObject*}{PyUnicode_FromWideChar}{const wchar_t *w, int size} ! Create a Unicode object from the \ctype{whcar_t} buffer \var{w} of the given size. Returns \NULL{} on failure. \end{cfuncdesc} --- 881,885 ---- \begin{cfuncdesc}{PyObject*}{PyUnicode_FromWideChar}{const wchar_t *w, int size} ! Create a Unicode object from the \ctype{wchar_t} buffer \var{w} of the given size. Returns \NULL{} on failure. \end{cfuncdesc} *************** *** 888,894 **** wchar_t *w, int size} ! Copies the Unicode object contents into the \ctype{whcar_t} buffer ! \var{w}. At most \var{size} \ctype{whcar_t} characters are copied. ! Returns the number of \ctype{whcar_t} characters copied or -1 in case of an error. \end{cfuncdesc} --- 888,894 ---- wchar_t *w, int size} ! Copies the Unicode object contents into the \ctype{wchar_t} buffer ! \var{w}. At most \var{size} \ctype{wchar_t} characters are copied. ! Returns the number of \ctype{wchar_t} characters copied or -1 in case of an error. \end{cfuncdesc} From aimacintyre@sourceforge.net Tue Apr 30 13:06:26 2002 From: aimacintyre@sourceforge.net (aimacintyre@sourceforge.net) Date: Tue, 30 Apr 2002 05:06:26 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx python23.def,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory usw-pr-cvs1:/tmp/cvs-serv27887 Modified Files: python23.def Log Message: add enumobject.c to build machinery Index: python23.def =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/python23.def,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** python23.def 15 Apr 2002 12:09:45 -0000 1.2 --- python23.def 30 Apr 2002 12:06:23 -0000 1.3 *************** *** 258,261 **** --- 258,264 ---- "PyDictIter_Type" + ; From python23_s.lib(enumobject) + "PyEnum_Type" + ; From python23_s.lib(fileobject) "PyFile_AsFile" *************** *** 537,540 **** --- 540,544 ---- "PyUnicodeUCS2_Contains" "PyUnicodeUCS2_Concat" + "_PyUnicode_XStrip" "PyUnicodeUCS2_Replace" "PyUnicodeUCS2_Split" From aimacintyre@sourceforge.net Tue Apr 30 13:11:06 2002 From: aimacintyre@sourceforge.net (aimacintyre@sourceforge.net) Date: Tue, 30 Apr 2002 05:11:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29199 Modified Files: regrtest.py Log Message: Fred's recent changes to support "-u all" resulted in subset resource selections (eg "-u network") being ignored. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** regrtest.py 23 Apr 2002 23:09:02 -0000 1.82 --- regrtest.py 30 Apr 2002 12:11:04 -0000 1.83 *************** *** 134,138 **** usage(1, 'Invalid -u/--use option: ' + a) if r not in use_resources: ! use_resources.extend(r) if generate and verbose: usage(2, "-g and -v don't go together!") --- 134,138 ---- usage(1, 'Invalid -u/--use option: ' + a) if r not in use_resources: ! use_resources.append(r) if generate and verbose: usage(2, "-g and -v don't go together!") From aimacintyre@sourceforge.net Tue Apr 30 14:06:35 2002 From: aimacintyre@sourceforge.net (aimacintyre@sourceforge.net) Date: Tue, 30 Apr 2002 06:06:35 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory usw-pr-cvs1:/tmp/cvs-serv21700 Modified Files: Makefile Log Message: add enumobject.c to build machinery Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 15 Apr 2002 12:09:45 -0000 1.2 --- Makefile 30 Apr 2002 13:06:32 -0000 1.3 *************** *** 1,3 **** ! #####################==================----------------úúúúúúúúúúúúú # # Top-Level Makefile for Building Python 2.3 for OS/2 using GCC/EMX --- 1,3 ---- ! #####################==================----------------············· # # Top-Level Makefile for Building Python 2.3 for OS/2 using GCC/EMX *************** *** 22,26 **** # make test (optional) # ! #####################==================----------------úúúúúúúúúúúúú # === Compilation mode: debug or release === --- 22,26 ---- # make test (optional) # ! #####################==================----------------············· # === Compilation mode: debug or release === *************** *** 309,312 **** --- 309,313 ---- Objects/descrobject.c \ Objects/dictobject.c \ + Objects/enumobject.c \ Objects/fileobject.c \ Objects/floatobject.c \ From fdrake@sourceforge.net Tue Apr 30 15:54:17 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 30 Apr 2002 07:54:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.52.4.3,1.52.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5436/lib Modified Files: Tag: release21-maint libstdtypes.tex Log Message: Add a note about when the "%r" formatting code was added. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.52.4.3 retrieving revision 1.52.4.4 diff -C2 -d -r1.52.4.3 -r1.52.4.4 *** libstdtypes.tex 9 Aug 2001 22:00:32 -0000 1.52.4.3 --- libstdtypes.tex 30 Apr 2002 14:54:15 -0000 1.52.4.4 *************** *** 698,701 **** --- 698,702 ---- % XXX Examples? + (The \code{\%r} conversion was added in Python 2.0.) Since Python strings have an explicit length, \code{\%s} conversions From fdrake@sourceforge.net Tue Apr 30 15:54:33 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 30 Apr 2002 07:54:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.5,1.80.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5562/lib Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Add a note about when the "%r" formatting code was added. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.5 retrieving revision 1.80.6.6 diff -C2 -d -r1.80.6.5 -r1.80.6.6 *** libstdtypes.tex 22 Apr 2002 11:57:04 -0000 1.80.6.5 --- libstdtypes.tex 30 Apr 2002 14:54:31 -0000 1.80.6.6 *************** *** 812,815 **** --- 812,816 ---- % XXX Examples? + (The \code{\%r} conversion was added in Python 2.0.) Since Python strings have an explicit length, \code{\%s} conversions From fdrake@sourceforge.net Tue Apr 30 15:54:50 2002 From: fdrake@sourceforge.net (fdrake@sourceforge.net) Date: Tue, 30 Apr 2002 07:54:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.88,1.89 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5683/lib Modified Files: libstdtypes.tex Log Message: Add a note about when the "%r" formatting code was added. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** libstdtypes.tex 15 Apr 2002 13:36:43 -0000 1.88 --- libstdtypes.tex 30 Apr 2002 14:54:47 -0000 1.89 *************** *** 817,820 **** --- 817,821 ---- % XXX Examples? + (The \code{\%r} conversion was added in Python 2.0.) Since Python strings have an explicit length, \code{\%s} conversions From montanaro@sourceforge.net Tue Apr 30 17:23:44 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Tue, 30 Apr 2002 09:23:44 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts findsyms.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv8785 Removed Files: findsyms.py Log Message: moving into the Doc/tools directory --- findsyms.py DELETED --- From montanaro@sourceforge.net Tue Apr 30 17:25:39 2002 From: montanaro@sourceforge.net (montanaro@sourceforge.net) Date: Tue, 30 Apr 2002 09:25:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools findsyms,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv9185 Added Files: findsyms Log Message: moved from Tools/scripts (was only at rev 1.1 - no changes yet - so I simply removed it from there and added it here) --- NEW FILE: findsyms --- #!/usr/bin/env python # Released to the public domain by Skip Montanaro, 28 March 2002 """ findsyms.py - try to identify undocumented symbols exported by modules Usage: findsyms.py librefdir For each lib*.tex file in the libref manual source directory, identify which module is documented, import the module if possible, then search the LaTeX source for the symbols global to that module. Report any that don't seem to be documented. Certain exceptions are made to the list of undocumented symbols: * don't mention symbols in which all letters are upper case on the assumption they are manifest constants * don't mention symbols that are themselves modules * don't mention symbols that match those exported by os, math, string, types, or __builtin__ modules Finally, if a name is exported by the module but fails a getattr() lookup, that anomaly is reported. """ import __builtin__ import getopt import glob import math import os import re import string import sys import types import warnings def usage(): print >> sys.stderr, """ usage: %s dir where 'dir' is the Library Reference Manual source directory. """ % os.path.basename(sys.argv[0]) def main(): try: opts, args = getopt.getopt(sys.argv[1:], "") except getopt.error: usage() return if not args: usage() return libdir = args[0] warnings.filterwarnings("error") pat = re.compile(r"\\declaremodule\s*{[^}]*}\s*{([^}]*)}") missing = [] filelist = glob.glob(os.path.join(libdir, "lib*.tex")) filelist.sort() for f in filelist: mod = f[3:-4] if not mod: continue data = open(f).read() mods = re.findall(pat, data) if not mods: print "No module declarations found in", f continue for modname in mods: # skip special modules if modname.startswith("__"): continue try: mod = __import__(modname) except ImportError: missing.append(modname) continue except DeprecationWarning: print "Deprecated module:", modname continue if hasattr(mod, "__all__"): all = mod.__all__ else: all = [k for k in dir(mod) if k[0] != "_"] mentioned = 0 all.sort() for name in all: if data.find(name) == -1: # certain names are predominantly used for testing if name in ("main","test","_test"): continue # is it some sort of manifest constant? if name.upper() == name: continue try: item = getattr(mod, name) except AttributeError: print " ", name, "exposed, but not an attribute" continue # don't care about modules that might be exposed if type(item) == types.ModuleType: continue # check a few modules which tend to be import *'d isglobal = 0 for m in (os, math, string, __builtin__, types): if hasattr(m, name) and item == getattr(m, name): isglobal = 1 break if isglobal: continue if not mentioned: print "Not mentioned in", modname, "docs:" mentioned = 1 print " ", name if missing: missing.sort() print "Could not import:" print " ", ", ".join(missing) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass From bwarsaw@sourceforge.net Tue Apr 30 19:58:54 2002 From: bwarsaw@sourceforge.net (bwarsaw@sourceforge.net) Date: Tue, 30 Apr 2002 11:58:54 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.19,4.20 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23567 Modified Files: python-mode.el Log Message: Watch out for older XEmacsen for which requiring info-look doesn't define info-lookup-maybe-add-help. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.19 retrieving revision 4.20 diff -C2 -d -r4.19 -r4.20 *** python-mode.el 26 Apr 2002 15:49:52 -0000 4.19 --- python-mode.el 30 Apr 2002 18:58:52 -0000 4.20 *************** *** 3124,3135 **** (require 'info-look) ! (info-lookup-maybe-add-help ! :mode 'python-mode ! :regexp "[a-zA-Z0-9_]+" ! :doc-spec '(("(python-lib)Module Index") ! ("(python-lib)Class-Exception-Object Index") ! ("(python-lib)Function-Method-Variable Index") ! ("(python-lib)Miscellaneous Index"))) ! --- 3124,3138 ---- (require 'info-look) ! ;; The info-look package does not always provide this function (it ! ;; appears this is the case with XEmacs 21.1) ! (when (fboundp 'info-lookup-maybe-add-help) ! (info-lookup-maybe-add-help ! :mode 'python-mode ! :regexp "[a-zA-Z0-9_]+" ! :doc-spec '(("(python-lib)Module Index") ! ("(python-lib)Class-Exception-Object Index") ! ("(python-lib)Function-Method-Variable Index") ! ("(python-lib)Miscellaneous Index"))) ! )