From rhettinger@users.sourceforge.net Sat Mar 1 01:44:34 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 28 Feb 2003 17:44:34 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.118,2.119 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv32068 Modified Files: abstract.c Log Message: Removed duplicate test from inner loop. The PyIter_Check is already performed by PyObject_GetIter. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.118 retrieving revision 2.119 diff -C2 -d -r2.118 -r2.119 *** abstract.c 18 Feb 2003 16:33:49 -0000 2.118 --- abstract.c 1 Mar 2003 01:44:32 -0000 2.119 *************** *** 2183,2192 **** { PyObject *result; ! if (!PyIter_Check(iter)) { ! PyErr_Format(PyExc_TypeError, ! "'%.100s' object is not an iterator", ! iter->ob_type->tp_name); ! return NULL; ! } result = (*iter->ob_type->tp_iternext)(iter); if (result == NULL && --- 2183,2187 ---- { PyObject *result; ! assert(PyIter_Check(iter)); result = (*iter->ob_type->tp_iternext)(iter); if (result == NULL && From rhettinger@users.sourceforge.net Sat Mar 1 01:48:26 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 28 Feb 2003 17:48:26 -0800 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv883 Modified Files: itertoolsmodule.c Log Message: Several of the tools can make direct calls the inner iterators. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** itertoolsmodule.c 23 Feb 2003 04:40:07 -0000 1.6 --- itertoolsmodule.c 1 Mar 2003 01:48:24 -0000 1.7 *************** *** 236,243 **** { PyObject *item, *good; long ok; for (;;) { ! item = PyIter_Next(lz->it); if (item == NULL) return NULL; --- 236,245 ---- { PyObject *item, *good; + PyObject *it = lz->it; long ok; for (;;) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 390,393 **** --- 392,396 ---- { PyObject *item, *good; + PyObject *it = lz->it; long ok; *************** *** 395,399 **** return NULL; ! item = PyIter_Next(lz->it); if (item == NULL) return NULL; --- 398,403 ---- return NULL; ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 561,568 **** { PyObject *item; long oldnext; while (lz->cnt < lz->next) { ! item = PyIter_Next(lz->it); if (item == NULL) return NULL; --- 565,574 ---- { PyObject *item; + PyObject *it = lz->it; long oldnext; while (lz->cnt < lz->next) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 572,576 **** if (lz->cnt >= lz->stop) return NULL; ! item = PyIter_Next(lz->it); if (item == NULL) return NULL; --- 578,583 ---- if (lz->cnt >= lz->stop) return NULL; ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 716,721 **** PyObject *args; PyObject *result; ! args = PyIter_Next(lz->it); if (args == NULL) return NULL; --- 723,730 ---- PyObject *args; PyObject *result; + PyObject *it = lz->it; ! assert(PyIter_Check(it)); ! args = (*it->ob_type->tp_iternext)(it); if (args == NULL) return NULL; *************** *** 1195,1202 **** { PyObject *item; long ok; for (;;) { ! item = PyIter_Next(lz->it); if (item == NULL) return NULL; --- 1204,1213 ---- { PyObject *item; + PyObject *it = lz->it; long ok; for (;;) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 1349,1356 **** { PyObject *item; long ok; for (;;) { ! item = PyIter_Next(lz->it); if (item == NULL) return NULL; --- 1360,1369 ---- { PyObject *item; + PyObject *it = lz->it; long ok; for (;;) { ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 1627,1631 **** for (i=0 ; i < tuplesize ; i++) { it = PyTuple_GET_ITEM(lz->ittuple, i); ! item = PyIter_Next(it); if (item == NULL) return NULL; --- 1640,1645 ---- for (i=0 ; i < tuplesize ; i++) { it = PyTuple_GET_ITEM(lz->ittuple, i); ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) return NULL; *************** *** 1640,1644 **** for (i=0 ; i < tuplesize ; i++) { it = PyTuple_GET_ITEM(lz->ittuple, i); ! item = PyIter_Next(it); if (item == NULL) { Py_DECREF(result); --- 1654,1659 ---- for (i=0 ; i < tuplesize ; i++) { it = PyTuple_GET_ITEM(lz->ittuple, i); ! assert(PyIter_Check(it)); ! item = (*it->ob_type->tp_iternext)(it); if (item == NULL) { Py_DECREF(result); From gvanrossum@users.sourceforge.net Sat Mar 1 02:14:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 18:14:54 -0800 Subject: [Python-checkins] python/dist/src/Lib cmd.py,1.26.16.3,1.26.16.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9709/Lib Modified Files: Tag: release22-maint cmd.py Log Message: - Backported SF patch #676342: after using pdb, the readline command completion was botched. Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cmd.py,v retrieving revision 1.26.16.3 retrieving revision 1.26.16.4 diff -C2 -d -r1.26.16.3 -r1.26.16.4 *** cmd.py 13 Jan 2003 21:21:00 -0000 1.26.16.3 --- cmd.py 1 Mar 2003 02:14:52 -0000 1.26.16.4 *************** *** 87,97 **** """ self.cmdqueue = [] ! if completekey: ! try: ! import readline ! readline.set_completer(self.complete) ! readline.parse_and_bind(completekey+": complete") ! except ImportError: ! pass def cmdloop(self, intro=None): --- 87,91 ---- """ self.cmdqueue = [] ! self.completekey = completekey def cmdloop(self, intro=None): *************** *** 144,148 **** def preloop(self): """Hook method executed once when the cmdloop() method is called.""" ! pass def postloop(self): --- 138,149 ---- def preloop(self): """Hook method executed once when the cmdloop() method is called.""" ! if self.completekey: ! try: ! import readline ! self.old_completer = readline.get_completer() ! readline.set_completer(self.complete) ! readline.parse_and_bind(self.completekey+": complete") ! except ImportError: ! pass def postloop(self): *************** *** 151,155 **** """ ! pass def parseline(self, line): --- 152,161 ---- """ ! if self.completekey: ! try: ! import readline ! readline.set_completer(self.old_completer) ! except ImportError: ! pass def parseline(self, line): From gvanrossum@users.sourceforge.net Sat Mar 1 02:14:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 18:14:55 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.63,1.337.2.4.2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9709/Misc Modified Files: Tag: release22-maint NEWS Log Message: - Backported SF patch #676342: after using pdb, the readline command completion was botched. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.63 retrieving revision 1.337.2.4.2.64 diff -C2 -d -r1.337.2.4.2.63 -r1.337.2.4.2.64 *** NEWS 23 Feb 2003 23:45:16 -0000 1.337.2.4.2.63 --- NEWS 1 Mar 2003 02:14:52 -0000 1.337.2.4.2.64 *************** *** 3,6 **** --- 3,9 ---- ============================ + - Backported SF patch #676342: after using pdb, the readline command + completion was botched. + - Fix problem building on OSF1 because the compiler only accepted preprocessor directives that start in column 1. (SF bug #691793.) From gvanrossum@users.sourceforge.net Sat Mar 1 02:14:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 18:14:55 -0800 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.41.6.4,2.41.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9709/Modules Modified Files: Tag: release22-maint readline.c Log Message: - Backported SF patch #676342: after using pdb, the readline command completion was botched. Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.41.6.4 retrieving revision 2.41.6.5 diff -C2 -d -r2.41.6.4 -r2.41.6.5 *** readline.c 7 Jan 2003 20:37:58 -0000 2.41.6.4 --- readline.c 1 Mar 2003 02:14:53 -0000 2.41.6.5 *************** *** 333,336 **** --- 333,353 ---- "; + static PyObject * + get_completer(PyObject *self, PyObject *args) + { + if (completer == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + Py_INCREF(completer); + return completer; + } + + static char doc_get_completer[] = "\ + get_completer() -> function\n\ + \n\ + Returns current completer function.\ + "; + /* Exported function to read the current line buffer */ *************** *** 386,389 **** --- 403,407 ---- METH_VARARGS, get_history_length_doc}, {"set_completer", set_completer, METH_VARARGS, doc_set_completer}, + {"get_completer", get_completer, METH_VARARGS, doc_get_completer}, {"get_begidx", get_begidx, METH_OLDARGS, doc_get_begidx}, {"get_endidx", get_endidx, METH_OLDARGS, doc_get_endidx}, From gvanrossum@users.sourceforge.net Sat Mar 1 03:20:42 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:20:42 -0800 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.176,1.177 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv29053/Doc/tut Modified Files: tut.tex Log Message: - New function sys.exc_clear() clears the current exception. This is rarely needed, but can sometimes be useful to release objects referenced by the traceback held in sys.exc_info()[2]. (SF patch #693195.) Thanks to Kevin Jacobs! Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.176 retrieving revision 1.177 diff -C2 -d -r1.176 -r1.177 *** tut.tex 28 Oct 2002 19:28:22 -0000 1.176 --- tut.tex 1 Mar 2003 03:20:39 -0000 1.177 *************** *** 2452,2463 **** >>> dir(sys) ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', ! '__stdin__', '__stdout__', '_getframe', 'argv', 'builtin_module_names', ! 'byteorder', 'copyright', 'displayhook', 'exc_info', 'exc_type', ! 'excepthook', 'exec_prefix', 'executable', 'exit', 'getdefaultencoding', ! 'getdlopenflags', 'getrecursionlimit', 'getrefcount', 'hexversion', ! 'maxint', 'maxunicode', 'modules', 'path', 'platform', 'prefix', 'ps1', ! 'ps2', 'setcheckinterval', 'setdlopenflags', 'setprofile', ! 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'version', ! 'version_info', 'warnoptions'] \end{verbatim} --- 2452,2464 ---- >>> dir(sys) ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', ! '__stdin__', '__stdout__', '_getframe', 'api_version', 'argv', ! 'builtin_module_names', 'byteorder', 'callstats', 'copyright', ! 'displayhook', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', ! 'exec_prefix', 'executable', 'exit', 'getdefaultencoding', 'getdlopenflags', ! 'getrecursionlimit', 'getrefcount', 'hexversion', 'maxint', 'maxunicode', ! 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', ! 'platform', 'prefix', 'ps1', 'ps2', 'setcheckinterval', 'setdlopenflags', ! 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', ! 'version', 'version_info', 'warnoptions'] \end{verbatim} From gvanrossum@users.sourceforge.net Sat Mar 1 03:20:43 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:20:43 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sys.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv29053/Lib/test Modified Files: test_sys.py Log Message: - New function sys.exc_clear() clears the current exception. This is rarely needed, but can sometimes be useful to release objects referenced by the traceback held in sys.exc_info()[2]. (SF patch #693195.) Thanks to Kevin Jacobs! Index: test_sys.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sys.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_sys.py 19 Feb 2003 02:35:06 -0000 1.4 --- test_sys.py 1 Mar 2003 03:20:40 -0000 1.5 *************** *** 64,67 **** --- 64,111 ---- # Python/pythonrun.c::PyErr_PrintEx() is tricky. + def test_exc_clear(self): + self.assertRaises(TypeError, sys.exc_clear, 42) + + # Verify that exc_info is present and matches exc, then clear it, and + # check that it worked. + def clear_check(exc): + typ, value, traceback = sys.exc_info() + self.assert_(typ is not None) + self.assert_(value is exc) + self.assert_(traceback is not None) + + sys.exc_clear() + + typ, value, traceback = sys.exc_info() + self.assert_(typ is None) + self.assert_(value is None) + self.assert_(traceback is None) + + def clear(): + try: + raise ValueError, 42 + except ValueError, exc: + clear_check(exc) + + # Raise an exception and check that it can be cleared + clear() + + # Verify that a frame currently handling an exception is + # unaffected by calling exc_clear in a nested frame. + try: + raise ValueError, 13 + except ValueError, exc: + typ1, value1, traceback1 = sys.exc_info() + clear() + typ2, value2, traceback2 = sys.exc_info() + + self.assert_(typ1 is typ2) + self.assert_(value1 is exc) + self.assert_(value1 is value2) + self.assert_(traceback1 is traceback2) + + # Check that an exception can be cleared outside of an except block + clear_check(exc) + def test_exit(self): self.assertRaises(TypeError, sys.exit, 42, 42) From gvanrossum@users.sourceforge.net Sat Mar 1 03:20:43 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:20:43 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.683,1.684 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29053/Misc Modified Files: NEWS Log Message: - New function sys.exc_clear() clears the current exception. This is rarely needed, but can sometimes be useful to release objects referenced by the traceback held in sys.exc_info()[2]. (SF patch #693195.) Thanks to Kevin Jacobs! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.683 retrieving revision 1.684 diff -C2 -d -r1.683 -r1.684 *** NEWS 28 Feb 2003 22:09:33 -0000 1.683 --- NEWS 1 Mar 2003 03:20:40 -0000 1.684 *************** *** 13,16 **** --- 13,22 ---- ----------------- + + - New function sys.exc_clear() clears the current exception. This is + rarely needed, but can sometimes be useful to release objects + referenced by the traceback held in sys.exc_info()[2]. (SF patch + #693195.) + - On 64-bit systems, a dictionary could contain duplicate long/int keys if the key value was larger than 2**32. See SF bug #689659. From gvanrossum@users.sourceforge.net Sat Mar 1 03:20:44 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:20:44 -0800 Subject: [Python-checkins] python/dist/src/Python sysmodule.c,2.114,2.115 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv29053/Python Modified Files: sysmodule.c Log Message: - New function sys.exc_clear() clears the current exception. This is rarely needed, but can sometimes be useful to release objects referenced by the traceback held in sys.exc_info()[2]. (SF patch #693195.) Thanks to Kevin Jacobs! Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.114 retrieving revision 2.115 diff -C2 -d -r2.114 -r2.115 *** sysmodule.c 19 Feb 2003 15:24:39 -0000 2.114 --- sysmodule.c 1 Mar 2003 03:20:41 -0000 2.115 *************** *** 133,137 **** static PyObject * ! sys_exc_info(PyObject *self) { PyThreadState *tstate; --- 133,137 ---- static PyObject * ! sys_exc_info(PyObject *self, PyObject *noargs) { PyThreadState *tstate; *************** *** 148,153 **** "exc_info() -> (type, value, traceback)\n\ \n\ ! Return information about the exception that is currently being handled.\n\ ! This should be called from inside an except clause only." ); --- 148,184 ---- "exc_info() -> (type, value, traceback)\n\ \n\ ! Return information about the most recent exception caught by an except\n\ ! clause in the current stack frame or in an older stack frame." ! ); ! ! static PyObject * ! sys_exc_clear(PyObject *self, PyObject *noargs) ! { ! PyThreadState *tstate = PyThreadState_Get(); ! PyObject *tmp_type, *tmp_value, *tmp_tb; ! tmp_type = tstate->exc_type; ! tmp_value = tstate->exc_value; ! tmp_tb = tstate->exc_traceback; ! tstate->exc_type = NULL; ! tstate->exc_value = NULL; ! tstate->exc_traceback = NULL; ! Py_XDECREF(tmp_type); ! Py_XDECREF(tmp_value); ! Py_XDECREF(tmp_tb); ! /* For b/w compatibility */ ! PySys_SetObject("exc_type", Py_None); ! PySys_SetObject("exc_value", Py_None); ! PySys_SetObject("exc_traceback", Py_None); ! Py_INCREF(Py_None); ! return Py_None; ! } ! ! PyDoc_STRVAR(exc_clear_doc, ! "exc_clear() -> None\n\ ! \n\ ! Clear global information on the current exception. Subsequent calls to\n\ ! exc_info() will return (None,None,None) until another exception is raised\n\ ! in the current thread or the execution stack returns to a frame where\n\ ! another exception is being handled." ); *************** *** 601,605 **** callstats_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc}, ! {"exc_info", (PyCFunction)sys_exc_info, METH_NOARGS, exc_info_doc}, {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, {"exit", sys_exit, METH_VARARGS, exit_doc}, --- 632,637 ---- callstats_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc}, ! {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, ! {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, {"exit", sys_exit, METH_VARARGS, exit_doc}, *************** *** 787,790 **** --- 819,823 ---- excepthook() -- print an exception and its traceback to sys.stderr\n\ exc_info() -- return thread-safe information about the current exception\n\ + exc_clear() -- clear the exception state for the current thread\n\ exit() -- exit the interpreter by raising SystemExit\n\ getdlopenflags() -- returns flags to be used for dlopen() calls\n\ From gvanrossum@users.sourceforge.net Sat Mar 1 03:21:11 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:21:11 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29053/Doc/lib Modified Files: libsys.tex Log Message: - New function sys.exc_clear() clears the current exception. This is rarely needed, but can sometimes be useful to release objects referenced by the traceback held in sys.exc_info()[2]. (SF patch #693195.) Thanks to Kevin Jacobs! Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** libsys.tex 8 Oct 2002 02:44:29 -0000 1.61 --- libsys.tex 1 Mar 2003 03:20:38 -0000 1.62 *************** *** 100,103 **** --- 100,108 ---- originally occurred. \obindex{traceback} + If \function{exc_clear()} is called, this function will return three + \code{None} values until either another exception is raised in the + current thread or the execution stack returns to a frame where + another exception is being handled. + \warning{Assigning the \var{traceback} return value to a local variable in a function that is handling an exception will *************** *** 114,117 **** --- 119,137 ---- collection is enabled and they become unreachable, but it remains more efficient to avoid creating cycles.} + \end{funcdesc} + + \begin{funcdesc}{exc_clear}{} + This function clears all information relating to the current or last + exception that occured in the current thread. After calling this + function, \function{exc_info()} will return three \code{None} values until + another exception is raised in the current thread or the execution stack + returns to a frame where another exception is being handled. + + This function is only needed in only a few obscure situations. These + include logging and error handling systems that report information on the + last or current exception. This function can also be used to try to free + resources and trigger object finalization, though no guarantee is made as + to what objects will be freed, if any. + \versionadded{2.3} \end{funcdesc} From gvanrossum@users.sourceforge.net Sat Mar 1 03:25:44 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:25:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sys.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30550 Modified Files: test_sys.py Log Message: Reindent the new code properly. Index: test_sys.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sys.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_sys.py 1 Mar 2003 03:20:40 -0000 1.5 --- test_sys.py 1 Mar 2003 03:25:41 -0000 1.6 *************** *** 70,90 **** # check that it worked. def clear_check(exc): ! typ, value, traceback = sys.exc_info() ! self.assert_(typ is not None) ! self.assert_(value is exc) ! self.assert_(traceback is not None) ! sys.exc_clear() ! typ, value, traceback = sys.exc_info() ! self.assert_(typ is None) ! self.assert_(value is None) ! self.assert_(traceback is None) def clear(): ! try: ! raise ValueError, 42 ! except ValueError, exc: ! clear_check(exc) # Raise an exception and check that it can be cleared --- 70,90 ---- # check that it worked. def clear_check(exc): ! typ, value, traceback = sys.exc_info() ! self.assert_(typ is not None) ! self.assert_(value is exc) ! self.assert_(traceback is not None) ! sys.exc_clear() ! typ, value, traceback = sys.exc_info() ! self.assert_(typ is None) ! self.assert_(value is None) ! self.assert_(traceback is None) def clear(): ! try: ! raise ValueError, 42 ! except ValueError, exc: ! clear_check(exc) # Raise an exception and check that it can be cleared *************** *** 94,107 **** # unaffected by calling exc_clear in a nested frame. try: ! raise ValueError, 13 except ValueError, exc: ! typ1, value1, traceback1 = sys.exc_info() ! clear() ! typ2, value2, traceback2 = sys.exc_info() ! self.assert_(typ1 is typ2) ! self.assert_(value1 is exc) ! self.assert_(value1 is value2) ! self.assert_(traceback1 is traceback2) # Check that an exception can be cleared outside of an except block --- 94,107 ---- # unaffected by calling exc_clear in a nested frame. try: ! raise ValueError, 13 except ValueError, exc: ! typ1, value1, traceback1 = sys.exc_info() ! clear() ! typ2, value2, traceback2 = sys.exc_info() ! self.assert_(typ1 is typ2) ! self.assert_(value1 is exc) ! self.assert_(value1 is value2) ! self.assert_(traceback1 is traceback2) # Check that an exception can be cleared outside of an except block From gvanrossum@users.sourceforge.net Sat Mar 1 03:36:35 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 28 Feb 2003 19:36:35 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.352,2.353 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv607 Modified Files: ceval.c Log Message: Added implementation notes for [re]set_exc_info(). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.352 retrieving revision 2.353 diff -C2 -d -r2.352 -r2.353 *** ceval.c 27 Feb 2003 14:50:34 -0000 2.352 --- ceval.c 1 Mar 2003 03:36:33 -0000 2.353 *************** *** 2617,2620 **** --- 2617,2681 ---- + /* Implementation notes for set_exc_info() and reset_exc_info(): + + - Below, 'exc_ZZZ' stands for 'exc_type', 'exc_value' and + 'exc_traceback'. These always travel together. + + - tstate->curexc_ZZZ is the "hot" exception that is set by + PyErr_SetString(), cleared by PyErr_Clear(), and so on. + + - Once an exception is caught by an except clause, it is transferred + from tstate->curexc_ZZZ to tstate->exc_ZZZ, from which sys.exc_info() + can pick it up. This is the primary task of set_exc_info(). + + - Now let me explain the complicated dance with frame->f_exc_ZZZ. + + Long ago, when none of this existed, there were just a few globals: + one set corresponding to the "hot" exception, and one set + corresponding to sys.exc_ZZZ. (Actually, the latter weren't C + globals; they were simply stored as sys.exc_ZZZ. For backwards + compatibility, they still are!) The problem was that in code like + this: + + try: + "something that may fail" + except "some exception": + "do something else first" + "print the exception from sys.exc_ZZZ." + + if "do something else first" invoked something that raised and caught + an exception, sys.exc_ZZZ were overwritten. That was a frequent + cause of subtle bugs. I fixed this by changing the semantics as + follows: + + - Within one frame, sys.exc_ZZZ will hold the last exception caught + *in that frame*. + + - But initially, and as long as no exception is caught in a given + frame, sys.exc_ZZZ will hold the last exception caught in the + previous frame (or the frame before that, etc.). + + The first bullet fixed the bug in the above example. The second + bullet was for backwards compatibility: it was (and is) common to + have a function that is called when an exception is caught, and to + have that function access the caught exception via sys.exc_ZZZ. + (Example: traceback.print_exc()). + + At the same time I fixed the problem that sys.exc_ZZZ weren't + thread-safe, by introducing sys.exc_info() which gets it from tstate; + but that's really a separate improvement. + + The reset_exc_info() function in ceval.c restores the tstate->exc_ZZZ + variables to what they were before the current frame was called. The + set_exc_info() function saves them on the frame so that + reset_exc_info() can restore them. The invariant is that + frame->f_exc_ZZZ is NULL iff the current frame never caught an + exception (where "catching" an exception applies only to successful + except clauses); and if the current frame ever caught an exception, + frame->f_exc_ZZZ is the exception that was stored in tstate->exc_ZZZ + at the start of the current frame. + + */ + static void set_exc_info(PyThreadState *tstate, From nnorwitz@users.sourceforge.net Sat Mar 1 15:19:44 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 01 Mar 2003 07:19:44 -0800 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29285/Modules Modified Files: readline.c Log Message: get_completer() takes no args Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** readline.c 21 Feb 2003 00:30:18 -0000 2.61 --- readline.c 1 Mar 2003 15:19:41 -0000 2.62 *************** *** 350,354 **** static PyObject * ! get_completer(PyObject *self, PyObject *args) { if (completer == NULL) { --- 350,354 ---- static PyObject * ! get_completer(PyObject *self, PyObject *noargs) { if (completer == NULL) { From nnorwitz@users.sourceforge.net Sat Mar 1 15:19:51 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 01 Mar 2003 07:19:51 -0800 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.41.6.5,2.41.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29375/Modules Modified Files: Tag: release22-maint readline.c Log Message: get_completer() takes no args Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.41.6.5 retrieving revision 2.41.6.6 diff -C2 -d -r2.41.6.5 -r2.41.6.6 *** readline.c 1 Mar 2003 02:14:53 -0000 2.41.6.5 --- readline.c 1 Mar 2003 15:19:49 -0000 2.41.6.6 *************** *** 334,338 **** static PyObject * ! get_completer(PyObject *self, PyObject *args) { if (completer == NULL) { --- 334,338 ---- static PyObject * ! get_completer(PyObject *self, PyObject *noargs) { if (completer == NULL) { *************** *** 403,407 **** METH_VARARGS, get_history_length_doc}, {"set_completer", set_completer, METH_VARARGS, doc_set_completer}, ! {"get_completer", get_completer, METH_VARARGS, doc_get_completer}, {"get_begidx", get_begidx, METH_OLDARGS, doc_get_begidx}, {"get_endidx", get_endidx, METH_OLDARGS, doc_get_endidx}, --- 403,407 ---- METH_VARARGS, get_history_length_doc}, {"set_completer", set_completer, METH_VARARGS, doc_set_completer}, ! {"get_completer", get_completer, METH_NOARGS, doc_get_completer}, {"get_begidx", get_begidx, METH_OLDARGS, doc_get_begidx}, {"get_endidx", get_endidx, METH_OLDARGS, doc_get_endidx}, From nnorwitz@users.sourceforge.net Sat Mar 1 15:22:44 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 01 Mar 2003 07:22:44 -0800 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31219/Lib Modified Files: pydoc.py Log Message: Fix SF patch #695581, "returnself" -> "return self" Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** pydoc.py 27 Feb 2003 20:14:39 -0000 1.78 --- pydoc.py 1 Mar 2003 15:22:41 -0000 1.79 *************** *** 269,273 **** if inspect.ismodule(object): return self.docmodule(*args) if inspect.isclass(object): return self.docclass(*args) ! if inspect.isroutine(object): returnself.docroutine(*args) return self.docother(*args) --- 269,273 ---- if inspect.ismodule(object): return self.docmodule(*args) if inspect.isclass(object): return self.docclass(*args) ! if inspect.isroutine(object): return self.docroutine(*args) return self.docother(*args) From nnorwitz@users.sourceforge.net Sat Mar 1 22:58:02 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 01 Mar 2003 14:58:02 -0800 Subject: [Python-checkins] python/dist/src/Lib dumbdbm.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31916/Lib Modified Files: dumbdbm.py Log Message: Fix comment, mode really is used Index: dumbdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** dumbdbm.py 1 Jun 2002 14:25:41 -0000 1.19 --- dumbdbm.py 1 Mar 2003 22:58:00 -0000 1.20 *************** *** 167,170 **** """ ! # flag, mode arguments are currently ignored return _Database(file, mode) --- 167,170 ---- """ ! # flag argument is currently ignored return _Database(file, mode) From tim_one@users.sourceforge.net Sat Mar 1 23:33:36 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 15:33:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11029/Lib/test Modified Files: test_sets.py Log Message: The doctest was printing Sets, but that's unreliable because set elements get displayed in undefined dict order. Use a Set subclass instead (which arranges to sort the elements for display). Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_sets.py 15 Jan 2003 16:15:38 -0000 1.19 --- test_sets.py 1 Mar 2003 23:33:34 -0000 1.20 *************** *** 642,646 **** Example from the Library Reference: Doc/lib/libsets.tex ! >>> from sets import Set >>> engineers = Set(['John', 'Jane', 'Jack', 'Janice']) >>> programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) --- 642,649 ---- Example from the Library Reference: Doc/lib/libsets.tex ! >>> from sets import Set as Base # override _repr to get sorted output ! >>> class Set(Base): ! ... def _repr(self): ! ... return Base._repr(self, sorted=True) >>> engineers = Set(['John', 'Jane', 'Jack', 'Janice']) >>> programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) *************** *** 651,655 **** >>> engineers.add('Marvin') >>> print engineers ! Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) >>> employees.issuperset(engineers) # superset test False --- 654,658 ---- >>> engineers.add('Marvin') >>> print engineers ! Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin']) >>> employees.issuperset(engineers) # superset test False *************** *** 661,668 **** ... print group ... ! Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) ! Set(['Janice', 'Jack', 'Sam']) ! Set(['Jane', 'Zack', 'Jack']) ! Set(['Zack', 'Sam', 'Marvin', 'Jack', 'Jane', 'Janice', 'John']) """ --- 664,671 ---- ... print group ... ! Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin']) ! Set(['Jack', 'Janice', 'Sam']) ! Set(['Jack', 'Jane', 'Zack']) ! Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin', 'Sam', 'Zack']) """ From tim_one@users.sourceforge.net Sun Mar 2 00:19:51 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 16:19:51 -0800 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24329/Lib Modified Files: sets.py Log Message: SF bug 693121: Set == non-Set is a TypeError. Allow mixed-type __eq__ and __ne__ for Set objects. This is messier than I'd like because Set *also* implements __cmp__. I know of one glitch now: cmp(s, t) returns 0 now when s and t are both Sets and s == t, despite that Set.__cmp__ unconditionally raises TypeError (and by intent). The rub is that __eq__ gets tried first, and the x.__eq__(y) True result convinces Python that cmp(x, y) is 0 without even calling Set.__cmp__. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** sets.py 14 Feb 2003 03:42:11 -0000 1.42 --- sets.py 2 Mar 2003 00:19:49 -0000 1.43 *************** *** 103,120 **** return self._data.iterkeys() ! # Three-way comparison is not supported def __cmp__(self, other): raise TypeError, "can't compare sets using cmp()" ! # Equality comparisons using the underlying dicts def __eq__(self, other): ! self._binary_sanity_check(other) ! return self._data == other._data def __ne__(self, other): ! self._binary_sanity_check(other) ! return self._data != other._data # Copying operations --- 103,140 ---- return self._data.iterkeys() ! # Three-way comparison is not supported. However, because __eq__ is ! # tried before __cmp__, if Set x == Set y, x.__eq__(y) returns True and ! # then cmp(x, y) returns 0 (Python doesn't actually call __cmp__ in this ! # case). def __cmp__(self, other): raise TypeError, "can't compare sets using cmp()" ! # Equality comparisons using the underlying dicts. Mixed-type comparisons ! # are allowed here, where Set == z for non-Set z always returns False, ! # and Set != z always True. This allows expressions like "x in y" to ! # give the expected result when y is a sequence of mixed types, not ! # raising a pointless TypeError just because y contains a Set, or x is ! # a Set and y contain's a non-set ("in" invokes only __eq__). ! # Subtle: it would be nicer if __eq__ and __ne__ could return ! # NotImplemented instead of True or False. Then the other comparand ! # would get a chance to determine the result, and if the other comparand ! # also returned NotImplemented then it would fall back to object address ! # comparison (which would always return False for __eq__ and always ! # True for __ne__). However, that doesn't work, because this type ! # *also* implements __cmp__: if, e.g., __eq__ returns NotImplemented, ! # Python tries __cmp__ next, and the __cmp__ here then raises TypeError. def __eq__(self, other): ! if isinstance(other, BaseSet): ! return self._data == other._data ! else: ! return False def __ne__(self, other): ! if isinstance(other, BaseSet): ! return self._data != other._data ! else: ! return True # Copying operations From tim_one@users.sourceforge.net Sun Mar 2 00:19:51 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 16:19:51 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24329/Lib/test Modified Files: test_sets.py Log Message: SF bug 693121: Set == non-Set is a TypeError. Allow mixed-type __eq__ and __ne__ for Set objects. This is messier than I'd like because Set *also* implements __cmp__. I know of one glitch now: cmp(s, t) returns 0 now when s and t are both Sets and s == t, despite that Set.__cmp__ unconditionally raises TypeError (and by intent). The rub is that __eq__ gets tried first, and the x.__eq__(y) True result convinces Python that cmp(x, y) is 0 without even calling Set.__cmp__. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_sets.py 1 Mar 2003 23:33:34 -0000 1.20 --- test_sets.py 2 Mar 2003 00:19:49 -0000 1.21 *************** *** 233,237 **** def test_cmp(self): a, b = Set('a'), Set('b') ! self.assertRaises(TypeError, cmp, (a,b)) #============================================================================== --- 233,246 ---- def test_cmp(self): a, b = Set('a'), Set('b') ! self.assertRaises(TypeError, cmp, a, b) ! ! # You can view this as a buglet: cmp(a, a) does not raise TypeError, ! # because __eq__ is tried before __cmp__, and a.__eq__(a) returns, ! # which Python thinks is good enough to synthesize a cmp() result ! # without calling __cmp__. ! self.assertEqual(cmp(a, a), 0) ! ! self.assertRaises(TypeError, cmp, a, 12) ! self.assertRaises(TypeError, cmp, "abc", a) #============================================================================== *************** *** 477,491 **** class TestOnlySetsInBinaryOps(unittest.TestCase): ! def test_cmp(self): ! try: ! self.other == self.set ! self.fail("expected TypeError") ! except TypeError: ! pass ! try: ! self.set != self.other ! self.fail("expected TypeError") ! except TypeError: ! pass def test_union_update(self): --- 486,502 ---- class TestOnlySetsInBinaryOps(unittest.TestCase): ! def test_eq_ne(self): ! # Unlike the others, this is testing that == and != *are* allowed. ! self.assertEqual(self.other == self.set, False) ! self.assertEqual(self.set == self.other, False) ! self.assertEqual(self.other != self.set, True) ! self.assertEqual(self.set != self.other, True) ! ! def test_ge_gt_lt_le(self): ! # Unlike the others, this is testing that == and != *are* allowed. ! self.assertRaises(TypeError, lambda: self.set < self.other) ! self.assertRaises(TypeError, lambda: self.set <= self.other) ! self.assertRaises(TypeError, lambda: self.set > self.other) ! self.assertRaises(TypeError, lambda: self.set >= self.other) def test_union_update(self): From tim_one@users.sourceforge.net Sun Mar 2 00:19:52 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 16:19:52 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.684,1.685 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv24329/Misc Modified Files: NEWS Log Message: SF bug 693121: Set == non-Set is a TypeError. Allow mixed-type __eq__ and __ne__ for Set objects. This is messier than I'd like because Set *also* implements __cmp__. I know of one glitch now: cmp(s, t) returns 0 now when s and t are both Sets and s == t, despite that Set.__cmp__ unconditionally raises TypeError (and by intent). The rub is that __eq__ gets tried first, and the x.__eq__(y) True result convinces Python that cmp(x, y) is 0 without even calling Set.__cmp__. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.684 retrieving revision 1.685 diff -C2 -d -r1.684 -r1.685 *** NEWS 1 Mar 2003 03:20:40 -0000 1.684 --- NEWS 2 Mar 2003 00:19:49 -0000 1.685 *************** *** 32,35 **** --- 32,42 ---- ------- + - sets.Set objects now support mixed-type __eq__ and __ne__, instead + of raising TypeError. If x is a Set object and y is a non-Set object, + x == y is False, and x != y is True. This is akin to the change made + for mixed-type comparisons of datetime objects in 2.3a2; more info + about the rationale is in the NEWS entry for that. See also SF bug + report . + - os.listdir() now returns Unicode strings on platforms that set Py_FileSystemDefaultEncoding, for file names that are not representable *************** *** 84,88 **** - A new method MacOS.WMAvailable() returns true if it is safe to access the window manager, false otherwise. ! - EasyDialogs dialogs are now movable-modal. --- 91,95 ---- - A new method MacOS.WMAvailable() returns true if it is safe to access the window manager, false otherwise. ! - EasyDialogs dialogs are now movable-modal. *************** *** 344,349 **** pathsep, curdir, pardir and defpath are now defined in the platform dependent path modules (e.g. ntpath.py) rather than os.py, so these ! variables are now available via os.path. They continue to be ! available from the os module. (see ). --- 351,356 ---- pathsep, curdir, pardir and defpath are now defined in the platform dependent path modules (e.g. ntpath.py) rather than os.py, so these ! variables are now available via os.path. They continue to be ! available from the os module. (see ). *************** *** 500,509 **** - Type Carbon.File.FSCatalogInfo and supporting methods have been implemented. This also makes macfs.FSSpec.SetDates() work again. ! - There is a new module pimp, the package install manager for Python, and accompanying applet PackageManager. These allow you to easily download and install pretested extension packages either in source or binary form. Only in MacPython-OSX. ! - Applets are now built with bundlebuilder in MacPython-OSX, which should make them more robust and also provides a path towards BuildApplication. The --- 507,516 ---- - Type Carbon.File.FSCatalogInfo and supporting methods have been implemented. This also makes macfs.FSSpec.SetDates() work again. ! - There is a new module pimp, the package install manager for Python, and accompanying applet PackageManager. These allow you to easily download and install pretested extension packages either in source or binary form. Only in MacPython-OSX. ! - Applets are now built with bundlebuilder in MacPython-OSX, which should make them more robust and also provides a path towards BuildApplication. The From tim_one@users.sourceforge.net Sun Mar 2 00:31:26 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 16:31:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28203/Lib/test Modified Files: test_sets.py Log Message: Typo repairs in new code. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_sets.py 2 Mar 2003 00:19:49 -0000 1.21 --- test_sets.py 2 Mar 2003 00:31:23 -0000 1.22 *************** *** 236,240 **** # You can view this as a buglet: cmp(a, a) does not raise TypeError, ! # because __eq__ is tried before __cmp__, and a.__eq__(a) returns, # which Python thinks is good enough to synthesize a cmp() result # without calling __cmp__. --- 236,240 ---- # You can view this as a buglet: cmp(a, a) does not raise TypeError, ! # because __eq__ is tried before __cmp__, and a.__eq__(a) returns True, # which Python thinks is good enough to synthesize a cmp() result # without calling __cmp__. *************** *** 493,502 **** self.assertEqual(self.set != self.other, True) ! def test_ge_gt_lt_le(self): ! # Unlike the others, this is testing that == and != *are* allowed. self.assertRaises(TypeError, lambda: self.set < self.other) self.assertRaises(TypeError, lambda: self.set <= self.other) self.assertRaises(TypeError, lambda: self.set > self.other) self.assertRaises(TypeError, lambda: self.set >= self.other) def test_union_update(self): --- 493,506 ---- self.assertEqual(self.set != self.other, True) ! def test_ge_gt_le_lt(self): self.assertRaises(TypeError, lambda: self.set < self.other) self.assertRaises(TypeError, lambda: self.set <= self.other) self.assertRaises(TypeError, lambda: self.set > self.other) self.assertRaises(TypeError, lambda: self.set >= self.other) + + self.assertRaises(TypeError, lambda: self.other < self.set) + self.assertRaises(TypeError, lambda: self.other <= self.set) + self.assertRaises(TypeError, lambda: self.other > self.set) + self.assertRaises(TypeError, lambda: self.other >= self.set) def test_union_update(self): From tim_one@users.sourceforge.net Sun Mar 2 00:36:12 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 16:36:12 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv29004/Lib/test Modified Files: test_sets.py Log Message: TestOnlySetsInBinaryOps: Simplified the non-inplace tests by using assertRaises. Fixed a repeated subtle bug in the inplace tests by removing the possibilty that a self.fail() call could raise a TypeError that the test catches by mistake. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_sets.py 2 Mar 2003 00:31:23 -0000 1.22 --- test_sets.py 2 Mar 2003 00:36:10 -0000 1.23 *************** *** 507,582 **** try: self.set |= self.other - self.fail("expected TypeError") except TypeError: pass def test_union(self): ! try: ! self.other | self.set ! self.fail("expected TypeError") ! except TypeError: ! pass ! try: ! self.set | self.other ! self.fail("expected TypeError") ! except TypeError: ! pass def test_intersection_update(self): try: self.set &= self.other - self.fail("expected TypeError") except TypeError: pass def test_intersection(self): ! try: ! self.other & self.set ! self.fail("expected TypeError") ! except TypeError: ! pass ! try: ! self.set & self.other ! self.fail("expected TypeError") ! except TypeError: ! pass def test_sym_difference_update(self): try: self.set ^= self.other - self.fail("expected TypeError") except TypeError: pass def test_sym_difference(self): ! try: ! self.other ^ self.set ! self.fail("expected TypeError") ! except TypeError: ! pass ! try: ! self.set ^ self.other ! self.fail("expected TypeError") ! except TypeError: ! pass def test_difference_update(self): try: self.set -= self.other - self.fail("expected TypeError") except TypeError: pass def test_difference(self): ! try: ! self.other - self.set ! self.fail("expected TypeError") ! except TypeError: ! pass ! try: ! self.set - self.other ! self.fail("expected TypeError") ! except TypeError: ! pass #------------------------------------------------------------------------------ --- 507,554 ---- try: self.set |= self.other except TypeError: pass + else: + self.fail("expected TypeError") def test_union(self): ! self.assertRaises(TypeError, lambda: self.set | self.other) ! self.assertRaises(TypeError, lambda: self.other | self.set) def test_intersection_update(self): try: self.set &= self.other except TypeError: pass + else: + self.fail("expected TypeError") def test_intersection(self): ! self.assertRaises(TypeError, lambda: self.set & self.other) ! self.assertRaises(TypeError, lambda: self.other & self.set) def test_sym_difference_update(self): try: self.set ^= self.other except TypeError: pass + else: + self.fail("expected TypeError") def test_sym_difference(self): ! self.assertRaises(TypeError, lambda: self.set ^ self.other) ! self.assertRaises(TypeError, lambda: self.other ^ self.set) def test_difference_update(self): try: self.set -= self.other except TypeError: pass + else: + self.fail("expected TypeError") def test_difference(self): ! self.assertRaises(TypeError, lambda: self.set - self.other) ! self.assertRaises(TypeError, lambda: self.other - self.set) #------------------------------------------------------------------------------ From akuchling@users.sourceforge.net Sun Mar 2 02:13:55 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 01 Mar 2003 18:13:55 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv23268 Modified Files: whatsnew23.tex Log Message: Expand itertools paragraph Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** whatsnew23.tex 26 Feb 2003 19:00:52 -0000 1.125 --- whatsnew23.tex 2 Mar 2003 02:13:52 -0000 1.126 *************** *** 1355,1361 **** (Contributed by Piers Lauder and Tino Lange.) ! \item The \ulink{\module{itertools}}{../lib/module-itertools.html} ! module provides several functions to support efficient looping using ! iterators. \item Two new functions in the \module{math} module, --- 1355,1367 ---- (Contributed by Piers Lauder and Tino Lange.) ! \item The \module{itertools} contains a number of useful functions for ! use with iterators, inspired by various functions provided by the ML ! and Haskell languages. For example, ! \code{itertools.ifilter(predicate, iterator)} returns all elements in ! the iterator for which the function \function{predicate()} returns ! \constant{True}, and \code{itertools.times(\var{N}, obj)} returns ! \code{obj} \var{N} times. There are a number of other functions in ! the module; see the \ulink{package's reference ! documentation}{../lib/module-itertools.html} for details. \item Two new functions in the \module{math} module, From akuchling@users.sourceforge.net Sun Mar 2 02:32:01 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 01 Mar 2003 18:32:01 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.126,1.127 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv27509 Modified Files: whatsnew23.tex Log Message: Add updates for alpha2 Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** whatsnew23.tex 2 Mar 2003 02:13:52 -0000 1.126 --- whatsnew23.tex 2 Mar 2003 02:31:58 -0000 1.127 *************** *** 330,333 **** --- 330,335 ---- checking \member{os.path.supports_unicode_filenames}, a Boolean value. + Under MacOS, \function{os.listdir()} may now return Unicode filenames. + \begin{seealso} *************** *** 1360,1364 **** \code{itertools.ifilter(predicate, iterator)} returns all elements in the iterator for which the function \function{predicate()} returns ! \constant{True}, and \code{itertools.times(\var{N}, obj)} returns \code{obj} \var{N} times. There are a number of other functions in the module; see the \ulink{package's reference --- 1362,1366 ---- \code{itertools.ifilter(predicate, iterator)} returns all elements in the iterator for which the function \function{predicate()} returns ! \constant{True}, and \code{itertools.repeat(obj, \var{N})} returns \code{obj} \var{N} times. There are a number of other functions in the module; see the \ulink{package's reference *************** *** 1496,1501 **** Sockets Layer (SSL) support. ! \item The value of the C \constant{PYTHON_API_VERSION} macro is now exposed ! at the Python level as \code{sys.api_version}. \item The new \module{tarfile} module --- 1498,1505 ---- Sockets Layer (SSL) support. ! \item The value of the C \constant{PYTHON_API_VERSION} macro is now ! exposed at the Python level as \code{sys.api_version}. The current ! exception can be cleared by calling the new \function{sys.exc_clear()} ! function. \item The new \module{tarfile} module From bwarsaw@users.sourceforge.net Sun Mar 2 03:35:35 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 01 Mar 2003 19:35:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.29,1.29.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv9256 Modified Files: Tag: folding-reimpl-branch test_email.py Log Message: A bunch of new tests, mostly from Tokio Kikuchi's SF patch 687338. Working on the new ASCII wrapping code and Tokio's improvements. Committing on a branch until the tests all pass. :/ Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.29 retrieving revision 1.29.4.1 diff -C2 -d -r1.29 -r1.29.4.1 *** test_email.py 2 Jan 2003 22:48:36 -0000 1.29 --- test_email.py 2 Mar 2003 03:35:33 -0000 1.29.4.1 *************** *** 567,571 **** cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") ! h = Header(g_head, g) h.append(cz_head, cz) h.append(utf8_head, utf8) --- 567,571 ---- cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") ! h = Header(g_head, g, header_name='Subject') h.append(cz_head, cz) h.append(utf8_head, utf8) *************** *** 575,612 **** g = Generator(sfp) g.flatten(msg) ! eq(sfp.getvalue(), '''\ ! Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?= ! =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutil?= ! =?iso-8859-2?q?y_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv?= ! =?utf-8?b?44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?= ! =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?= ! =?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?= ! =?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?= ! =?utf-8?q?s_Nunstuck_git_und?= ! =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?= ! =?utf-8?q?r_die_Flipperwaldt?= ! =?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?= ! ''') ! eq(h.encode(), '''\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?= ! =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutil?= ! =?iso-8859-2?q?y_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv?= ! =?utf-8?b?44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?= ! =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?= ! =?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?= ! =?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?= ! =?utf-8?q?s_Nunstuck_git_und?= ! =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?= ! =?utf-8?q?r_die_Flipperwaldt?= ! =?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=''') def test_long_header_encode(self): --- 575,604 ---- g = Generator(sfp) g.flatten(msg) ! eq(sfp.getvalue(), """\ ! Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCnd?= ! =?iso-8859-1?q?ischen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kli?= ! =?iso-8859-1?q?ngen_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropol?= ! =?iso-8859-2?q?e_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb?= ! =?utf-8?b?44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go?= ! =?utf-8?b?44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBp?= ! =?utf-8?q?st_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder?= ! =?utf-8?b?IGRpZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYQ=?= ! =?utf-8?b?44G+44GZ44CC?= ! """) ! eq(h.encode(), """\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCnd?= ! =?iso-8859-1?q?ischen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kli?= ! =?iso-8859-1?q?ngen_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropol?= ! =?iso-8859-2?q?e_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb?= ! =?utf-8?b?44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go?= ! =?utf-8?b?44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBp?= ! =?utf-8?q?st_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder?= ! =?utf-8?b?IGRpZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYQ=?= ! =?utf-8?b?44G+44GZ44CC?=""") def test_long_header_encode(self): *************** *** 713,722 **** eq = self.ndiffAssertEqual msg = Message() ! h = Header('Britische Regierung gibt', 'iso-8859-1') h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte') msg['Subject'] = h eq(msg.as_string(), """\ ! Subject: =?iso-8859-1?q?Britische_Regierung_gibt?= ! =?iso-8859-1?q?gr=FCnes_Licht_f=FCr_Offshore-Windkraftprojekte?= """) --- 705,715 ---- eq = self.ndiffAssertEqual msg = Message() ! h = Header('Britische Regierung gibt', 'iso-8859-1', ! header_name='Subject') h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte') msg['Subject'] = h eq(msg.as_string(), """\ ! Subject: =?iso-8859-1?q?Britische_Regierung_gibt?= =?iso-8859-1?q?gr=FCnes?= ! =?iso-8859-1?q?_Licht_f=FCr_Offshore-Windkraftprojekte?= """) *************** *** 731,734 **** --- 724,769 ---- """) + def test_long_to_header(self): + eq = self.ndiffAssertEqual + to = '"Someone Test #A" ,,"Someone Test #B" , "Someone Test #C" , "Someone Test #D" ' + msg = Message() + msg['To'] = to + eq(msg.as_string(0), '''\ + To: "Someone Test #A" , , + \t"Someone Test #B" , + \t"Someone Test #C" , + \t"Someone Test #D" + + ''') + + def test_long_line_after_append(self): + eq = self.ndiffAssertEqual + s = 'This is an example of string which has almost the limit of header length.' + h = Header(s) + h.append('Add another line.') + eq(h.encode(), """\ + This is an example of string which has almost the limit of header length. + Add another line.""") + + def test_shorter_line_with_append(self): + eq = self.ndiffAssertEqual + s = 'This is a shorter line.' + h = Header(s) + h.append('Add another sentence. (Surprise?)') + eq(h.encode(), + 'This is a shorter line. Add another sentence. (Surprise?)') + + def test_long_field_name(self): + eq = self.ndiffAssertEqual + fn = 'X-Very-Very-Very-Long-Header-Name' + gs = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " + h = Header(gs, 'iso-8859-1', header_name=fn) + # BAW: this seems broken because the first line is too long + eq(h.encode(), """\ + X-Very-Very-Very-Long-Header-Name: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= + =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= + =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= + =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") + *************** *** 2182,2186 **** eq(h.encode(), 'Hello World!') h.append(' Goodbye World!') ! eq(h.encode(), 'Hello World! Goodbye World!') def test_simple_surprise(self): --- 2217,2221 ---- eq(h.encode(), 'Hello World!') h.append(' Goodbye World!') ! eq(h.encode(), 'Hello World! Goodbye World!') def test_simple_surprise(self): *************** *** 2189,2193 **** eq(h.encode(), 'Hello World!') h.append('Goodbye World!') ! eq(h.encode(), 'Hello World!Goodbye World!') def test_header_needs_no_decoding(self): --- 2224,2228 ---- eq(h.encode(), 'Hello World!') h.append('Goodbye World!') ! eq(h.encode(), 'Hello World! Goodbye World!') def test_header_needs_no_decoding(self): *************** *** 2198,2202 **** h = Header("I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.", maxlinelen=76) ! for l in h.encode().split('\n '): self.failUnless(len(l) <= 76) --- 2233,2237 ---- h = Header("I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.", maxlinelen=76) ! for l in h.encode(splitchars=' ').split('\n '): self.failUnless(len(l) <= 76) *************** *** 2213,2231 **** h.append(utf8_head, utf8) enc = h.encode() ! eq(enc, """=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?= ! =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutil?= ! =?iso-8859-2?q?y_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv?= ! =?utf-8?b?44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?= ! =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?= ! =?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?= ! =?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?= ! =?utf-8?q?s_Nunstuck_git_und?= ! =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?= ! =?utf-8?q?r_die_Flipperwaldt?= ! =?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=""") eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), --- 2248,2263 ---- h.append(utf8_head, utf8) enc = h.encode() ! eq(enc, """\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_ko?= ! =?iso-8859-1?q?mfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wa?= ! =?iso-8859-1?q?ndgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef?= ! =?iso-8859-1?q?=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hro?= ! =?iso-8859-2?q?utily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j?= ! =?utf-8?b?56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT?= ! =?utf-8?b?44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv?= ! =?utf-8?b?44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3Qg?= ! =?utf-8?q?das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder_di?= ! =?utf-8?b?ZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYTjgb4=?= ! =?utf-8?b?44GZ44CC?=""") eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), *************** *** 2318,2321 **** --- 2350,2363 ---- h.append(x, errors='replace') eq(str(h), x) + + def test_encoded_adjacent_nonencoded(self): + eq = self.assertEqual + h = Header() + h.append('hello', 'iso-8859-1') + h.append('world') + s = h.encode() + eq(s, '=?iso-8859-1?q?hello?= world') + h = make_header(decode_header(s)) + eq(h.encode(), s) From bwarsaw@users.sourceforge.net Sun Mar 2 03:35:55 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 01 Mar 2003 19:35:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email_codecs.py,1.3,1.3.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv9296 Modified Files: Tag: folding-reimpl-branch test_email_codecs.py Log Message: A bunch of new tests, mostly from Tokio Kikuchi's SF patch 687338. Working on the new ASCII wrapping code and Tokio's improvements. Committing on a branch until the tests all pass. :/ Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_codecs.py,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -C2 -d -r1.3 -r1.3.8.1 *** test_email_codecs.py 23 Jul 2002 19:03:42 -0000 1.3 --- test_email_codecs.py 2 Mar 2003 03:35:53 -0000 1.3.8.1 *************** *** 36,56 **** # test a very long header enc = h.encode() ! # BAW: The following used to pass. Sadly, the test afterwards is what ! # happens now. I've no idea which is right. Please, any Japanese and ! # RFC 2047 experts, please verify! ! ## eq(enc, '''\ ! ##=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYRsoQg==?= ! ## =?iso-2022-jp?b?GyRCITwlayRPO0oycTxUJE4+NRsoQg==?= ! ## =?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?=''') ! eq(enc, """\ ! =?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYRsoQg==?= ! =?iso-2022-jp?b?GyRCITwlayRPO0oycTxUJE4+NUcnJHJCVCRDJEYkJCReJDkbKEI=?=""") ! # BAW: same deal here. :( ! ## self.assertEqual( ! ## decode_header(enc), ! ## [("test-ja \x1b$B$XEj9F$5$l$?%a\x1b(B\x1b$B!<%k$O;J2q5\x1b(B\x1b$BG'$rBT$C$F$$$^$9\x1b(B", 'iso-2022-jp')]) ! self.assertEqual( ! decode_header(enc), ! [("test-ja \x1b$B$XEj9F$5$l$?%a\x1b(B\x1b$B!<%k$O;J2q5G'$rBT$C$F$$$^$9\x1b(B", 'iso-2022-jp')]) --- 36,45 ---- # test a very long header enc = h.encode() ! # TK: splitting point may differ by codec design and/or Header encoding ! eq(enc , """\ ! =?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKGyhC?= ! =?iso-2022-jp?b?GyRCMnE8VCROPjVHJyRyQlQkQyRGJCQkXiQ5GyhC?=""") ! # TK: full decode comparison ! eq(h.__unicode__().encode('euc-jp'), long) From bwarsaw@users.sourceforge.net Sun Mar 2 03:37:21 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 01 Mar 2003 19:37:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.17,1.17.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv9598 Modified Files: Tag: folding-reimpl-branch Header.py Log Message: Re-implemented ASCII split algorithm. Committing on a branch until the tests all pass. :/ Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -C2 -d -r1.17 -r1.17.6.1 *** Header.py 30 Dec 2002 19:13:00 -0000 1.17 --- Header.py 2 Mar 2003 03:37:19 -0000 1.17.6.1 *************** *** 26,29 **** --- 26,30 ---- CRLF = '\r\n' NL = '\n' + SPACE = ' ' SPACE8 = ' ' * 8 EMPTYSTRING = '' *************** *** 48,51 **** --- 49,59 ---- ''', re.VERBOSE | re.IGNORECASE) + pcre = re.compile('([,;])') + + # Field name regexp, including trailing colon, but not separating whitespace, + # according to RFC 2822. Character range is from tilde to exclamation mark. + # For use with .match() + fcre = re.compile(r'[\041-\176]+:$') + *************** *** 127,131 **** class Header: ! def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' ', errors='strict'): """Create a MIME-compliant header that can contain many character sets. --- 135,140 ---- class Header: ! def __init__(self, s=None, charset=None, ! maxlinelen=None, header_name=None, continuation_ws=' ', errors='strict'): """Create a MIME-compliant header that can contain many character sets. *************** *** 254,258 **** self._chunks.append((s, charset)) ! def _split(self, s, charset, firstline=False): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) --- 263,267 ---- self._chunks.append((s, charset)) ! def _split(self, s, charset, firstline, splitchars): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) *************** *** 281,287 **** # although it's possible that other charsets may also benefit from the # higher-level syntactic breaks. - # elif charset == 'us-ascii': ! return self._ascii_split(s, charset, firstline) # BAW: should we use encoded? elif elen == len(s): --- 290,295 ---- # although it's possible that other charsets may also benefit from the # higher-level syntactic breaks. elif charset == 'us-ascii': ! return self._split_ascii(s, charset, firstline, splitchars) # BAW: should we use encoded? elif elen == len(s): *************** *** 297,377 **** last = charset.from_splittable(splittable[halfway:], False) # Do the split ! return self._split(first, charset, firstline) + \ ! self._split(last, charset) ! def _ascii_split(self, s, charset, firstline): ! # Attempt to split the line at the highest-level syntactic break ! # possible. Note that we don't have a lot of smarts about field ! # syntax; we just try to break on semi-colons, then whitespace. ! rtn = [] ! lines = s.splitlines() ! while lines: ! line = lines.pop(0) ! if firstline: ! maxlinelen = self._firstlinelen ! firstline = False ! else: ! #line = line.lstrip() ! maxlinelen = self._maxlinelen ! # Short lines can remain unchanged ! if len(line.replace('\t', SPACE8)) <= maxlinelen: ! rtn.append(line) ! else: ! oldlen = len(line) ! # Try to break the line on semicolons, but if that doesn't ! # work, try to split on folding whitespace. ! while len(line) > maxlinelen: ! i = line.rfind(';', 0, maxlinelen) ! if i < 0: ! break ! rtn.append(line[:i] + ';') ! line = line[i+1:] ! # Is the remaining stuff still longer than maxlinelen? ! if len(line) <= maxlinelen: ! # Splitting on semis worked ! rtn.append(line) ! continue ! # Splitting on semis didn't finish the job. If it did any ! # work at all, stick the remaining junk on the front of the ! # `lines' sequence and let the next pass do its thing. ! if len(line) <> oldlen: ! lines.insert(0, line) ! continue ! # Otherwise, splitting on semis didn't help at all. ! parts = re.split(r'(\s+)', line) ! if len(parts) == 1 or (len(parts) == 3 and ! parts[0].endswith(':')): ! # This line can't be split on whitespace. There's now ! # little we can do to get this into maxlinelen. BAW: ! # We're still potentially breaking the RFC by possibly ! # allowing lines longer than the absolute maximum of 998 ! # characters. For now, let it slide. ! # ! # len(parts) will be 1 if this line has no `Field: ' ! # prefix, otherwise it will be len(3). ! rtn.append(line) ! continue ! # There is whitespace we can split on. ! first = parts.pop(0) ! sublines = [first] ! acc = len(first) ! while parts: ! len0 = len(parts[0]) ! len1 = len(parts[1]) ! if acc + len0 + len1 <= maxlinelen: ! sublines.append(parts.pop(0)) ! sublines.append(parts.pop(0)) ! acc += len0 + len1 ! else: ! # Split it here, but don't forget to ignore the ! # next whitespace-only part ! if first <> '': ! rtn.append(EMPTYSTRING.join(sublines)) ! del parts[0] ! first = parts.pop(0) ! sublines = [first] ! acc = len(first) ! rtn.append(EMPTYSTRING.join(sublines)) ! return [(chunk, charset) for chunk in rtn] def _encode_chunks(self, newchunks): --- 305,321 ---- last = charset.from_splittable(splittable[halfway:], False) # Do the split ! return self._split(first, charset, firstline, splitchars) + \ ! self._split(last, charset, False, splitchars) ! def _split_ascii(self, s, charset, firstline, splitchars): ! if firstline: ! firstlen = self._firstlinelen ! restlen = self._maxlinelen ! else: ! firstlen = restlen = self._maxlinelen ! line = _split_ascii(s, firstlen, restlen, ! self._continuation_ws, splitchars) ! lines = line.splitlines() ! return zip(lines, [charset]*len(lines)) def _encode_chunks(self, newchunks): *************** *** 397,409 **** for header, charset in newchunks: if charset is None or charset.header_encoding is None: ! # There's no encoding for this chunk's charsets ! _max_append(chunks, header, self._maxlinelen) else: ! _max_append(chunks, charset.header_encode(header), ! self._maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) ! def encode(self): """Encode a message header into an RFC-compliant format. --- 341,352 ---- for header, charset in newchunks: if charset is None or charset.header_encoding is None: ! s = header else: ! s = charset.header_encode(header) ! _max_append(chunks, s, self._maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) ! def encode(self, splitchars=';, '): """Encode a message header into an RFC-compliant format. *************** *** 422,428 **** If the given charset is not known or an error occurs during conversion, this function will return the header untouched. """ newchunks = [] for s, charset in self._chunks: ! newchunks += self._split(s, charset, True) return self._encode_chunks(newchunks) --- 365,434 ---- If the given charset is not known or an error occurs during conversion, this function will return the header untouched. + + Optional splitchars is a string containing characters to split long + ASCII lines on, in rough support of RFC 2822's `highest level + syntactic breaks'. This doesn't affect RFC 2047 encoded lines. """ newchunks = [] for s, charset in self._chunks: ! newchunks += self._split(s, charset, True, splitchars) return self._encode_chunks(newchunks) + + + + def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): + lines = [] + maxlen = firstlen + for line in s.splitlines(): + if len(line) < maxlen: + lines.append(line) + maxlen = restlen + continue + # Attempt to split the line at the highest-level syntactic break + # possible. Note that we don't have a lot of smarts about field + # syntax; we just try to break on semi-colons, then commas, then + # whitespace. + for ch in splitchars: + if line.find(ch) >= 0: + break + else: + # There's nothing useful to split the line on, not even spaces, so + # just append this line unchanged + lines.append(line) + maxlen = restlen + continue + # Now split the line on the character plus trailing whitespace + cre = re.compile(r'%s\s*' % ch) + if ch in ';,': + eol = ch + else: + eol = '' + joiner = eol + ' ' + joinlen = len(joiner) + wslen = len(continuation_ws.replace('\t', SPACE8)) + this = [] + linelen = 0 + for part in cre.split(line): + curlen = linelen + max(0, len(this)-1) * joinlen + partlen = len(part) + onfirstline = not lines + # We don't want to split after the field name, if we're on the + # first line and the field name is present in the header string. + if ch == ' ' and onfirstline and \ + len(this) == 1 and fcre.match(this[0]): + this.append(part) + linelen += partlen + elif curlen + partlen > maxlen: + if this: + lines.append(joiner.join(this) + eol) + this = [part] + linelen = wslen + partlen + maxlen = restlen + else: + this.append(part) + linelen += partlen + # Put any left over parts on a line by themselves + if this: + lines.append(joiner.join(this)) + linejoiner = '\n' + continuation_ws + return linejoiner.join(lines) From tim_one@users.sourceforge.net Sun Mar 2 04:54:26 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 01 Mar 2003 20:54:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25054/Lib/test Modified Files: pickletester.py Log Message: test_load_from_canned_string(): Created a DATA2 string to test a canned proto 2 pickle too. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** pickletester.py 18 Feb 2003 22:41:24 -0000 1.53 --- pickletester.py 2 Mar 2003 04:54:24 -0000 1.54 *************** *** 89,93 **** # DATA0 .. DATA2 are the pickles we expect under the various protocols, for # the object returned by create_data(). - # XXX DATA2 doesn't exist yet, as it's not fully implemented in cPickle. # break into multiple strings to avoid confusing font-lock-mode --- 89,92 ---- *************** *** 277,280 **** --- 276,344 ---- """ + DATA2 = ('\x80\x02]q\x01(K\x00\x8a\x01\x01G@\x00\x00\x00\x00\x00\x00\x00' + 'c__builtin__\ncomplex\nq\x02G@\x08\x00\x00\x00\x00\x00\x00G\x00' + '\x00\x00\x00\x00\x00\x00\x00\x86Rq\x03K\x01J\xff\xff\xff\xffK' + '\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xff' + 'J\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00\x00\x80J\x00\x00\x00' + '\x80(U\x03abcq\x04h\x04(c__main__\nC\nq\x05oq\x06}q\x07(U\x03foo' + 'q\x08K\x01U\x03barq\tK\x02ubh\x06tq\nh\nK\x05e.') + + # Disassembly of DATA2. + DATA2_DIS = """\ + 0: \x80 PROTO 2 + 2: ] EMPTY_LIST + 3: q BINPUT 1 + 5: ( MARK + 6: K BININT1 0 + 8: \x8a LONG1 1L + 11: G BINFLOAT 2.0 + 20: c GLOBAL '__builtin__ complex' + 41: q BINPUT 2 + 43: G BINFLOAT 3.0 + 52: G BINFLOAT 0.0 + 61: \x86 TUPLE2 + 62: R REDUCE + 63: q BINPUT 3 + 65: K BININT1 1 + 67: J BININT -1 + 72: K BININT1 255 + 74: J BININT -255 + 79: J BININT -256 + 84: M BININT2 65535 + 87: J BININT -65535 + 92: J BININT -65536 + 97: J BININT 2147483647 + 102: J BININT -2147483647 + 107: J BININT -2147483648 + 112: ( MARK + 113: U SHORT_BINSTRING 'abc' + 118: q BINPUT 4 + 120: h BINGET 4 + 122: ( MARK + 123: c GLOBAL '__main__ C' + 135: q BINPUT 5 + 137: o OBJ (MARK at 122) + 138: q BINPUT 6 + 140: } EMPTY_DICT + 141: q BINPUT 7 + 143: ( MARK + 144: U SHORT_BINSTRING 'foo' + 149: q BINPUT 8 + 151: K BININT1 1 + 153: U SHORT_BINSTRING 'bar' + 158: q BINPUT 9 + 160: K BININT1 2 + 162: u SETITEMS (MARK at 143) + 163: b BUILD + 164: h BINGET 6 + 166: t TUPLE (MARK at 112) + 167: q BINPUT 10 + 169: h BINGET 10 + 171: K BININT1 5 + 173: e APPENDS (MARK at 5) + 174: . STOP + highest protocol among opcodes = 2 + """ + def create_data(): c = C() *************** *** 334,338 **** def test_load_from_canned_string(self): expected = self._testdata ! for canned in DATA0, DATA1: got = self.loads(canned) self.assertEqual(expected, got) --- 398,402 ---- def test_load_from_canned_string(self): expected = self._testdata ! for canned in DATA0, DATA1, DATA2: got = self.loads(canned) self.assertEqual(expected, got) From bwarsaw@users.sourceforge.net Sun Mar 2 05:32:41 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 01 Mar 2003 21:32:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.17.6.1,1.17.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1551 Modified Files: Tag: folding-reimpl-branch Header.py Log Message: Experimental binary search for a better split point. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.17.6.1 retrieving revision 1.17.6.2 diff -C2 -d -r1.17.6.1 -r1.17.6.2 *** Header.py 2 Mar 2003 03:37:19 -0000 1.17.6.1 --- Header.py 2 Mar 2003 05:32:38 -0000 1.17.6.2 *************** *** 266,273 **** # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) ! encoded = charset.from_splittable(splittable) elen = charset.encoded_header_len(encoded) ! ! if elen <= self._maxlinelen: return [(encoded, charset)] # If we have undetermined raw 8bit characters sitting in a byte --- 266,279 ---- # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) ! encoded = charset.from_splittable(splittable, True) elen = charset.encoded_header_len(encoded) ! # The maxlinelen depends on whether we're on the first line or not, to ! # take account of any header field name. ! if firstline: ! maxlinelen = self._firstlinelen ! else: ! maxlinelen = self._maxlinelen ! # If the line's encoded length first, just return it ! if elen <= maxlinelen: return [(encoded, charset)] # If we have undetermined raw 8bit characters sitting in a byte *************** *** 277,281 **** # be to not split the header at all, but that means they could go out # longer than maxlinelen. ! elif charset == '8bit': return [(s, charset)] # BAW: I'm not sure what the right test here is. What we're trying to --- 283,287 ---- # be to not split the header at all, but that means they could go out # longer than maxlinelen. ! if charset == '8bit': return [(s, charset)] # BAW: I'm not sure what the right test here is. What we're trying to *************** *** 296,307 **** # We can split on _maxlinelen boundaries because we know that the # encoding won't change the size of the string ! splitpnt = self._maxlinelen first = charset.from_splittable(splittable[:splitpnt], False) last = charset.from_splittable(splittable[splitpnt:], False) else: # Divide and conquer. ! halfway = _floordiv(len(splittable), 2) ! first = charset.from_splittable(splittable[:halfway], False) ! last = charset.from_splittable(splittable[halfway:], False) # Do the split return self._split(first, charset, firstline, splitchars) + \ --- 302,315 ---- # We can split on _maxlinelen boundaries because we know that the # encoding won't change the size of the string ! splitpnt = maxlinelen first = charset.from_splittable(splittable[:splitpnt], False) last = charset.from_splittable(splittable[splitpnt:], False) else: + # Binary search for split point + first, last = _binsplit(splittable, charset, maxlinelen) # Divide and conquer. ! ## halfway = _floordiv(len(splittable), 2) ! ## first = charset.from_splittable(splittable[:halfway], False) ! ## last = charset.from_splittable(splittable[halfway:], False) # Do the split return self._split(first, charset, firstline, splitchars) + \ *************** *** 433,434 **** --- 441,464 ---- linejoiner = '\n' + continuation_ws return linejoiner.join(lines) + + + + def _binsplit(splittable, charset, maxlinelen): + i = lastm = 0 + j = len(splittable) - 1 + while True: + if j < i: + break + m = (i + j) / 2 + chunk = charset.from_splittable(splittable[:m], True) + chunklen = charset.encoded_header_len(chunk) + if chunklen < maxlinelen: + lastm = m + i = m + 1 + elif chunklen > maxlinelen: + j = m - 1 + else: + break + first = charset.from_splittable(splittable[:lastm], False) + last = charset.from_splittable(splittable[lastm:], False) + return first, last From gvanrossum@users.sourceforge.net Sun Mar 2 13:17:22 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 02 Mar 2003 05:17:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv11849 Modified Files: init.tex Log Message: Commit MvL's doc patch for SF bug #221327. This adds an example of calling into Python from a C thread. Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** init.tex 10 Feb 2003 19:12:42 -0000 1.6 --- init.tex 2 Mar 2003 13:17:20 -0000 1.7 *************** *** 467,470 **** --- 467,492 ---- thread after Python is initialized). + Assuming you have access to an interpreter object, the typical idiom + for calling into Python from a C thread is + + \begin{verbatim} + PyThreadState *tstate; + PyObject *result; + + /* interp is your reference to an interpreter object. */ + tstate = PyThreadState_New(interp); + PyEval_AcquireThread(tstate); + + /* Perform Python actions here. */ + result = CallSomeFunction(); + /* evaluate result */ + + /* Release the thread. No Python API allowed beyond this point. */ + PyEval_ReleaseThread(tstate); + + /* You can either delete the thread state, or save it + until you need it the next time. */ + PyThreadState_Delete(tstate); + \end{verbatim} \begin{ctypedesc}{PyInterpreterState} From gvanrossum@users.sourceforge.net Sun Mar 2 13:51:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 02 Mar 2003 05:51:49 -0800 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.65,2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv21390 Modified Files: complexobject.c Log Message: Fix from Greg Chapman from SF bug #695651: a complex subclass constructor, when passed a single complex argument, returns the argument unchanged. This should be done only for the complex base class; a complex subclass should of course cast the value to the subclass in this case. The fix also revealed a segfault in complex_getnewargs(): the argument for the Py_BuildValue() format code "D" is the *address* of a Py_complex struct, not the value. (This corroborated by the API documentation.) I expect this needs to be backported to 2.2.3. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** complexobject.c 29 Jan 2003 17:58:44 -0000 2.65 --- complexobject.c 2 Mar 2003 13:51:47 -0000 2.66 *************** *** 643,647 **** complex_getnewargs(PyComplexObject *v) { ! return Py_BuildValue("(D)", v->cval); } --- 643,647 ---- complex_getnewargs(PyComplexObject *v) { ! return Py_BuildValue("(D)", &v->cval); } *************** *** 833,837 **** /* Special-case for single argumet that is already complex */ ! if (PyComplex_CheckExact(r) && i == NULL) { /* Note that we can't know whether it's safe to return a complex *subclass* instance as-is, hence the restriction --- 833,838 ---- /* Special-case for single argumet that is already complex */ ! if (PyComplex_CheckExact(r) && i == NULL && ! type == &PyComplex_Type) { /* Note that we can't know whether it's safe to return a complex *subclass* instance as-is, hence the restriction From gvanrossum@users.sourceforge.net Sun Mar 2 13:53:20 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 02 Mar 2003 05:53:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21813a Modified Files: pickletester.py Log Message: MyComplex now works. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** pickletester.py 2 Mar 2003 04:54:24 -0000 1.54 --- pickletester.py 2 Mar 2003 13:53:18 -0000 1.55 *************** *** 885,889 **** myclasses = [MyInt, MyLong, MyFloat, ! # MyComplex, # XXX complex somehow doesn't work here :-( MyStr, MyUnicode, MyTuple, MyList, MyDict] --- 885,889 ---- myclasses = [MyInt, MyLong, MyFloat, ! MyComplex, MyStr, MyUnicode, MyTuple, MyList, MyDict] From guido@python.org Sun Mar 2 14:11:50 2003 From: guido@python.org (Guido van Rossum) Date: Sun, 02 Mar 2003 09:11:50 -0500 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.65,2.66 In-Reply-To: "Your message of Sun, 02 Mar 2003 05:51:49 PST." References: Message-ID: <200303021411.h22EBoA18584@pcp02138704pcs.reston01.va.comcast.net> > I expect this needs to be backported to 2.2.3. I take that back. The 2.2 complex_new() looks vey different, and __getnewargs__ didn't exist then. --Guido van Rossum (home page: http://www.python.org/~guido/) From tim.one@comcast.net Sun Mar 2 19:00:58 2003 From: tim.one@comcast.net (Tim Peters) Date: Sun, 02 Mar 2003 14:00:58 -0500 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.17.6.1,1.17.6.2 In-Reply-To: Message-ID: > Modified Files: > Tag: folding-reimpl-branch > Header.py > Log Message: > Experimental binary search for a better split point. ... > + def _binsplit(splittable, charset, maxlinelen): > + i = lastm = 0 > + j = len(splittable) - 1 > + while True: > + if j < i: > + break > + m = (i + j) / 2 > + chunk = charset.from_splittable(splittable[:m], True) > + chunklen = charset.encoded_header_len(chunk) > + if chunklen < maxlinelen: > + lastm = m > + i = m + 1 > + elif chunklen > maxlinelen: > + j = m - 1 > + else: > + break > + first = charset.from_splittable(splittable[:lastm], False) > + last = charset.from_splittable(splittable[lastm:], False) > + return first, last I'm not entirely sure what this is doing, but if I grok it I trust this version more : def _binsplit(splittable, charset, maxlinelen): i, j = 0, len(splittable) while i < j: # Invariants: # 1. splittable[:k] fits for all k <= i (note that we *assume*, # at the start, that splittable[:0] fits). # 2. splittable[:k] does not fit for any k > j (at the start, # this means we shouldn't look at any k > len(splittable)). # 3. We don't know about splittable[:k] for k in i+1..j. # 4. We want to set i to the largest k that fits, with i <= k <= j. m = (i+j+1) >> 1 # ceiling((i+j)/2); i < m <= j chunk = charset.from_splittable(splittable[:m], True) chunklen = charset.encoded_header_len(chunk) if chunklen <= maxlinelen: # m is acceptable, so is a new lower bound. i = m else: # m is not acceptable, so final i must be < j. j = m-1 # i == j. Invariant #1 implies that splittable[:i] fits, and # invariant #2 implies that splittable[:i+1] does not fit, so i # is what we're looking for. first = charset.from_splittable(splittable[:i], False) last = charset.from_splittable(splittable[i:], False) return first, last You could break out early when chunklen == maxlinelen, but it's not necessary and *usually* slows binary searches. From gvanrossum@users.sourceforge.net Sun Mar 2 20:47:35 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 02 Mar 2003 12:47:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,1.7,1.8 config.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1:/tmp/cvs-serv15153 Modified Files: __init__.py config.py Log Message: Undo the apply() removals; this code needs to run under Python 1.5.2. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 27 Feb 2003 20:14:47 -0000 1.7 --- __init__.py 2 Mar 2003 20:47:28 -0000 1.8 *************** *** 875,879 **** return if DEBUG >= self.getEffectiveLevel(): ! self._log(DEBUG, msg, args, **kwargs) def info(self, msg, *args, **kwargs): --- 875,879 ---- return if DEBUG >= self.getEffectiveLevel(): ! apply(self._log, (DEBUG, msg, args), kwargs) def info(self, msg, *args, **kwargs): *************** *** 889,893 **** return if INFO >= self.getEffectiveLevel(): ! self._log(INFO, msg, args, **kwargs) def warning(self, msg, *args, **kwargs): --- 889,893 ---- return if INFO >= self.getEffectiveLevel(): ! apply(self._log, (INFO, msg, args), kwargs) def warning(self, msg, *args, **kwargs): *************** *** 903,907 **** return if self.isEnabledFor(WARNING): ! self._log(WARNING, msg, args, **kwargs) warn = warning --- 903,907 ---- return if self.isEnabledFor(WARNING): ! apply(self._log, (WARNING, msg, args), kwargs) warn = warning *************** *** 919,923 **** return if self.isEnabledFor(ERROR): ! self._log(ERROR, msg, args, **kwargs) def exception(self, msg, *args): --- 919,923 ---- return if self.isEnabledFor(ERROR): ! apply(self._log, (ERROR, msg, args), kwargs) def exception(self, msg, *args): *************** *** 925,929 **** Convenience method for logging an ERROR with exception information. """ ! self.error(msg, exc_info=1, *args) def critical(self, msg, *args, **kwargs): --- 925,929 ---- Convenience method for logging an ERROR with exception information. """ ! apply(self.error, (msg,) + args, {'exc_info': 1}) def critical(self, msg, *args, **kwargs): *************** *** 939,943 **** return if CRITICAL >= self.getEffectiveLevel(): ! self._log(CRITICAL, msg, args, **kwargs) fatal = critical --- 939,943 ---- return if CRITICAL >= self.getEffectiveLevel(): ! apply(self._log, (CRITICAL, msg, args), kwargs) fatal = critical *************** *** 955,959 **** return if self.isEnabledFor(level): ! self._log(level, msg, args, **kwargs) def findCaller(self): --- 955,959 ---- return if self.isEnabledFor(level): ! apply(self._log, (level, msg, args), kwargs) def findCaller(self): *************** *** 1132,1136 **** if len(root.handlers) == 0: basicConfig() ! root.critical(msg, *args, **kwargs) fatal = critical --- 1132,1136 ---- if len(root.handlers) == 0: basicConfig() ! apply(root.critical, (msg,)+args, kwargs) fatal = critical *************** *** 1142,1146 **** if len(root.handlers) == 0: basicConfig() ! root.error(msg, *args, **kwargs) def exception(msg, *args): --- 1142,1146 ---- if len(root.handlers) == 0: basicConfig() ! apply(root.error, (msg,)+args, kwargs) def exception(msg, *args): *************** *** 1149,1153 **** with exception information. """ ! error(msg, exc_info=1, *args) def warning(msg, *args, **kwargs): --- 1149,1153 ---- with exception information. """ ! apply(error, (msg,)+args, {'exc_info': 1}) def warning(msg, *args, **kwargs): *************** *** 1157,1161 **** if len(root.handlers) == 0: basicConfig() ! root.warning(msg, *args, **kwargs) warn = warning --- 1157,1161 ---- if len(root.handlers) == 0: basicConfig() ! apply(root.warning, (msg,)+args, kwargs) warn = warning *************** *** 1167,1171 **** if len(root.handlers) == 0: basicConfig() ! root.info(msg, *args, **kwargs) def debug(msg, *args, **kwargs): --- 1167,1171 ---- if len(root.handlers) == 0: basicConfig() ! apply(root.info, (msg,)+args, kwargs) def debug(msg, *args, **kwargs): *************** *** 1175,1179 **** if len(root.handlers) == 0: basicConfig() ! root.debug(msg, *args, **kwargs) def disable(level): --- 1175,1179 ---- if len(root.handlers) == 0: basicConfig() ! apply(root.debug, (msg,)+args, kwargs) def disable(level): Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/config.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** config.py 27 Feb 2003 20:14:48 -0000 1.6 --- config.py 2 Mar 2003 20:47:29 -0000 1.7 *************** *** 103,107 **** args = cp.get(sectname, "args") args = eval(args, vars(logging)) ! h = klass(*args) if "level" in opts: level = cp.get(sectname, "level") --- 103,107 ---- args = cp.get(sectname, "args") args = eval(args, vars(logging)) ! h = apply(klass, args) if "level" in opts: level = cp.get(sectname, "level") From jackjansen@users.sourceforge.net Sun Mar 2 21:31:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 02 Mar 2003 13:31:55 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.153,1.154 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv31568 Modified Files: setup.py Log Message: _CG module only needs the ApplicationServices framework, not Carbon. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** setup.py 28 Feb 2003 17:39:42 -0000 1.153 --- setup.py 2 Mar 2003 21:31:51 -0000 1.154 *************** *** 777,782 **** extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_CG', ['cg/_CGmodule.c'], ! extra_link_args=['-framework', 'ApplicationServices', ! '-framework', 'Carbon']) ) exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) --- 777,781 ---- extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_CG', ['cg/_CGmodule.c'], ! extra_link_args=['-framework', 'ApplicationServices']) ) exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From jackjansen@users.sourceforge.net Sun Mar 2 23:16:52 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 02 Mar 2003 15:16:52 -0800 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv6543 Modified Files: mactoolboxglue.c Log Message: Use Carbon.File for FSSpec and FSRef conversion, not macfs. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mactoolboxglue.c 17 Jan 2003 23:11:17 -0000 1.16 --- mactoolboxglue.c 2 Mar 2003 23:16:50 -0000 1.17 *************** *** 529,536 **** } ! GLUE_NEW(FSSpec *, PyMac_BuildFSSpec, "macfs") ! GLUE_CONVERT(FSSpec, PyMac_GetFSSpec, "macfs") ! GLUE_NEW(FSRef *, PyMac_BuildFSRef, "macfs") ! GLUE_CONVERT(FSRef, PyMac_GetFSRef, "macfs") GLUE_NEW(AppleEvent *, AEDesc_New, "Carbon.AE") /* XXXX Why by address? */ --- 529,536 ---- } ! GLUE_NEW(FSSpec *, PyMac_BuildFSSpec, "Carbon.File") ! GLUE_CONVERT(FSSpec, PyMac_GetFSSpec, "Carbon.File") ! GLUE_NEW(FSRef *, PyMac_BuildFSRef, "Carbon.File") ! GLUE_CONVERT(FSRef, PyMac_GetFSRef, "Carbon.File") GLUE_NEW(AppleEvent *, AEDesc_New, "Carbon.AE") /* XXXX Why by address? */ From klm@users.sourceforge.net Mon Mar 3 00:35:35 2003 From: klm@users.sourceforge.net (klm@users.sourceforge.net) Date: Sun, 02 Mar 2003 16:35:35 -0800 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.29,4.30 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv650 Modified Files: python-mode.el Log Message: Enhanced pdbtrack to provide for source code that's not findable by the reported path. (Eg, precompiled scripts with a file path suitable for a different host, scripts actually running on a remote system or with no valid path, like Zope through-the-web python scripts.) On failing to find the code on the reported path, pdbtrack takes the function name and looks through the buffers, from most to least recent, seeking the first python-mode buffer that either is named for the function or has a definition (def or class) for that function. So to get source tracking for code that's not located where the path indicates, you put a copy of the script in a buffer, and pdbtrack will find it. Also, fixed a small bug so pdbtrack now properly presents the overlay arrow when you run the pdb 'w'here command. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.29 retrieving revision 4.30 diff -C2 -d -r4.29 -r4.30 *** python-mode.el 31 Dec 2002 16:56:20 -0000 4.29 --- python-mode.el 3 Mar 2003 00:35:32 -0000 4.30 *************** *** 473,477 **** ;; pdbtrack contants (defconst py-pdbtrack-stack-entry-regexp ! "> \\([^(]+\\)(\\([0-9]+\\))[?a-zA-Z0-9_]+()" "Regular expression pdbtrack uses to find a stack trace entry.") --- 473,478 ---- ;; pdbtrack contants (defconst py-pdbtrack-stack-entry-regexp ! ; "^> \\([^(]+\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_]+\\)()" ! "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_]+\\)()" "Regular expression pdbtrack uses to find a stack trace entry.") *************** *** 1277,1281 **** We depend on the pdb input prompt matching `py-pdbtrack-input-prompt' ! at the beginning of the line." ;; Instead of trying to piece things together from partial text ;; (which can be almost useless depending on Emacs version), we --- 1278,1289 ---- We depend on the pdb input prompt matching `py-pdbtrack-input-prompt' ! at the beginning of the line. ! ! If the traceback target file path is invalid, we look for the most ! recently visited python-mode buffer which either has the name of the ! current function \(or class) or which defines the function \(or ! class). This is to provide for remote scripts, eg, Zope's 'Script ! (Python)' - put a _copy_ of the script in a python-mode buffer named ! for the script and pdbtrack will find it.)" ;; Instead of trying to piece things together from partial text ;; (which can be almost useless depending on Emacs version), we *************** *** 1283,1323 **** ;; check all text from comint-last-input-end to process-mark. ;; ! ;; KLM: It might be nice to provide an optional override, so this ! ;; routine could be fed debugger output strings as the text ! ;; argument, for deliberate application elsewhere. ! ;; ! ;; KLM: We're very conservative about clearing the overlay arrow, to ! ;; minimize residue. This means, for instance, that executing other ! ;; pdb commands wipes out the highlight. (let* ((origbuf (current-buffer)) (currproc (get-buffer-process origbuf))) (if (not (and currproc py-pdbtrack-do-tracking-p)) (py-pdbtrack-overlay-arrow nil) ! (let* (;(origdir default-directory) ! (procmark (process-mark currproc)) (block (buffer-substring (max comint-last-input-end (- procmark py-pdbtrack-track-range)) procmark)) ! fname lineno) (if (not (string-match (concat py-pdbtrack-input-prompt "$") block)) (py-pdbtrack-overlay-arrow nil) ! (if (not (string-match ! (concat ".*" py-pdbtrack-stack-entry-regexp ".*") ! block)) ! (py-pdbtrack-overlay-arrow nil) ! (setq fname (match-string 1 block) ! lineno (match-string 2 block)) ! (if (file-exists-p fname) ! (progn ! (find-file-other-window fname) ! (goto-line (string-to-int lineno)) ! (message "pdbtrack: line %s, file %s" lineno fname) ! (py-pdbtrack-overlay-arrow t) ! (pop-to-buffer origbuf t) ) ! (if (= (elt fname 0) ?\<) ! (message "pdbtrack: (Non-file source: '%s')" fname) ! (message "pdbtrack: File not found: %s" fname)) ! ))))))) (defun py-postprocess-output-buffer (buf) --- 1291,1399 ---- ;; check all text from comint-last-input-end to process-mark. ;; ! ;; Also, we're very conservative about clearing the overlay arrow, ! ;; to minimize residue. This means, for instance, that executing ! ;; other pdb commands wipe out the highlight. You can always do a ! ;; 'where' (aka 'w') command to reveal the overlay arrow. (let* ((origbuf (current-buffer)) (currproc (get-buffer-process origbuf))) + (if (not (and currproc py-pdbtrack-do-tracking-p)) (py-pdbtrack-overlay-arrow nil) ! ! (let* ((procmark (process-mark currproc)) (block (buffer-substring (max comint-last-input-end (- procmark py-pdbtrack-track-range)) procmark)) ! target target_fname target_lineno) ! (if (not (string-match (concat py-pdbtrack-input-prompt "$") block)) (py-pdbtrack-overlay-arrow nil) ! ! (setq target (py-pdbtrack-get-source-buffer block)) ! ! (if (stringp target) ! (message "pdbtrack: %s" target) ! ! (setq target_lineno (car target)) ! (setq target_buffer (cadr target)) ! (setq target_fname (buffer-file-name target_buffer)) ! (switch-to-buffer-other-window target_buffer) ! (goto-line target_lineno) ! (message "pdbtrack: line %s, file %s" target_lineno target_fname) ! (py-pdbtrack-overlay-arrow t) ! (pop-to-buffer origbuf t) ! ! ))))) ! ) ! ! (defun py-pdbtrack-get-source-buffer (block) ! "Return line number and buffer of code indicated by block's traceback text. ! ! We look first to visit the file indicated in the trace. ! ! Failing that, we look for the most recently visited python-mode buffer ! with the same name or having ! having the named function. ! ! If we're unable find the source code we return a string describing the ! problem as best as we can determine." ! ! (if (not (string-match py-pdbtrack-stack-entry-regexp block)) ! ! "Traceback cue not found" ! ! (let* ((filename (match-string 1 block)) ! (lineno (string-to-int (match-string 2 block))) ! (funcname (match-string 3 block)) ! funcbuffer) ! ! (cond ((file-exists-p filename) ! (list lineno (find-file-noselect filename))) ! ! ((setq funcbuffer (py-pdbtrack-grub-for-buffer funcname lineno)) ! (if (string-match "/Script (Python)$" filename) ! ;; Add in number of lines for leading '##' comments: ! (setq lineno ! (+ lineno ! (save-excursion ! (set-buffer funcbuffer) ! (count-lines ! (point-min) ! (string-match "^\\([^#]\\|#[^#]\\|#$\\)" ! (buffer-substring (point-min) ! (point-max) ! funcbuffer))))))) ! (list lineno funcbuffer)) ! ! ((= (elt filename 0) ?\<) ! (format "(Non-file source: '%s')" filename)) ! ! (t (format "Function/file not found: %s(), %s" funcname filename))) ! ) ! ) ! ) ! ! (defun py-pdbtrack-grub-for-buffer (funcname lineno) ! "Find most recent buffer itself named or having function funcname. ! ! Must have a least int(lineno) lines in it." ! (let ((buffers (buffer-list)) ! ;(buffers (list (get-buffer "workflow_do_action.py"))) ! curbuf ! got) ! (while (and buffers (not got)) ! (setq buf (car buffers) ! buffers (cdr buffers)) ! (if (or (save-excursion (set-buffer buf) ! (string= major-mode "python-mode")) ! (and (string-match funcname (buffer-name buf)) ! (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" ! funcname "\\s-*(") ! (buffer-substring (point-min buf) ! (point-max buf) ! buf)))) ! (setq got buf))) ! got)) (defun py-postprocess-output-buffer (buf) From klm@users.sourceforge.net Mon Mar 3 04:05:09 2003 From: klm@users.sourceforge.net (klm@users.sourceforge.net) Date: Sun, 02 Mar 2003 20:05:09 -0800 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.30,4.31 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26759 Modified Files: python-mode.el Log Message: Guard advancing past leading meta-comments. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.30 retrieving revision 4.31 diff -C2 -d -r4.30 -r4.31 *** python-mode.el 3 Mar 2003 00:35:32 -0000 4.30 --- python-mode.el 3 Mar 2003 04:05:03 -0000 4.31 *************** *** 1361,1368 **** (count-lines (point-min) ! (string-match "^\\([^#]\\|#[^#]\\|#$\\)" ! (buffer-substring (point-min) ! (point-max) ! funcbuffer))))))) (list lineno funcbuffer)) --- 1361,1370 ---- (count-lines (point-min) ! (max (point-min) ! (string-match "^\\([^#]\\|#[^#]\\|#$\\)" ! (buffer-substring (point-min) ! (point-max) ! funcbuffer)) ! )))))) (list lineno funcbuffer)) From bwarsaw@users.sourceforge.net Mon Mar 3 06:41:58 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 02 Mar 2003 22:41:58 -0800 Subject: [Python-checkins] python/dist/src/Lib/email base64MIME.py,1.5,1.5.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv2091 Modified Files: Tag: folding-reimpl-branch base64MIME.py Log Message: Remove an outdated comment. Index: base64MIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/base64MIME.py,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** base64MIME.py 28 Sep 2002 20:59:12 -0000 1.5 --- base64MIME.py 3 Mar 2003 06:41:55 -0000 1.5.8.1 *************** *** 103,109 **** max_unencoded = _floordiv(max_encoded * 3, 4) - # BAW: Ben's original code used a step of max_unencoded, but I think it - # ought to be max_encoded. Otherwise, where's max_encoded used? I'm - # still not sure what the for i in range(0, len(header), max_unencoded): base64ed.append(b2a_base64(header[i:i+max_unencoded])) --- 103,106 ---- From bwarsaw@users.sourceforge.net Mon Mar 3 06:51:29 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 02 Mar 2003 22:51:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/email quopriMIME.py,1.4,1.4.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv4379 Modified Files: Tag: folding-reimpl-branch quopriMIME.py Log Message: _max_append(): Comparison should allow for concatenation if the resulting length is equal to the max length. header_encode(): Allow for maxlinelen=None to mean no splitting of long lines. Higher level functions such as Header.encode() know what the chunk lengths should be so they don't want header_encode() second guessing them (there isn't a convenient way to thread the maxlinelen and continuation_ws all the way through). Index: quopriMIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v retrieving revision 1.4 retrieving revision 1.4.8.1 diff -C2 -d -r1.4 -r1.4.8.1 *** quopriMIME.py 28 Sep 2002 21:02:51 -0000 1.4 --- quopriMIME.py 3 Mar 2003 06:51:27 -0000 1.4.8.1 *************** *** 83,87 **** if not L: L.append(s.lstrip()) ! elif len(L[-1]) + len(s) < maxlen: L[-1] += extra + s else: --- 83,87 ---- if not L: L.append(s.lstrip()) ! elif len(L[-1]) + len(s) <= maxlen: L[-1] += extra + s else: *************** *** 117,121 **** with each line wrapped safely at, at most, maxlinelen characters (defaults ! to 76 characters). End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted --- 117,122 ---- with each line wrapped safely at, at most, maxlinelen characters (defaults ! to 76 characters). If maxlinelen is None, the entire string is encoded in ! one chunk with no splitting. End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted *************** *** 135,141 **** # Quopri encode each line, in encoded chunks no greater than maxlinelen in ! # lenght, after the RFC chrome is added in. quoted = [] ! max_encoded = maxlinelen - len(charset) - MISC_LEN for c in header: --- 136,146 ---- # Quopri encode each line, in encoded chunks no greater than maxlinelen in ! # length, after the RFC chrome is added in. quoted = [] ! if maxlinelen is None: ! # An obnoxiously large number that's good enough ! max_encoded = 100000 ! else: ! max_encoded = maxlinelen - len(charset) - MISC_LEN - 1 for c in header: From bwarsaw@users.sourceforge.net Mon Mar 3 06:55:36 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 02 Mar 2003 22:55:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Charset.py,1.12,1.12.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv5405 Modified Files: Tag: folding-reimpl-branch Charset.py Log Message: __repr__: Added header_encode(): When calling quopriMIME.header_encode(), pass in maxlinelen=None since we've already split the line into properly sized chunks. Index: Charset.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v retrieving revision 1.12 retrieving revision 1.12.4.1 diff -C2 -d -r1.12 -r1.12.4.1 *** Charset.py 7 Jan 2003 00:29:07 -0000 1.12 --- Charset.py 3 Mar 2003 06:55:34 -0000 1.12.4.1 *************** *** 235,238 **** --- 235,240 ---- return self.input_charset.lower() + __repr__ = __str__ + def __eq__(self, other): return str(self) == str(other).lower() *************** *** 359,363 **** return email.base64MIME.header_encode(s, cset) elif self.header_encoding == QP: ! return email.quopriMIME.header_encode(s, cset) elif self.header_encoding == SHORTEST: lenb64 = email.base64MIME.base64_len(s) --- 361,365 ---- return email.base64MIME.header_encode(s, cset) elif self.header_encoding == QP: ! return email.quopriMIME.header_encode(s, cset, maxlinelen=None) elif self.header_encoding == SHORTEST: lenb64 = email.base64MIME.base64_len(s) *************** *** 366,370 **** return email.base64MIME.header_encode(s, cset) else: ! return email.quopriMIME.header_encode(s, cset) else: return s --- 368,372 ---- return email.base64MIME.header_encode(s, cset) else: ! return email.quopriMIME.header_encode(s, cset, maxlinelen=None) else: return s From bwarsaw@users.sourceforge.net Mon Mar 3 06:59:16 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 02 Mar 2003 22:59:16 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.17.6.2,1.17.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv6405 Modified Files: Tag: folding-reimpl-branch Header.py Log Message: Internal changes to improve the packing of encoded headers. This makes sure that different charsets can appear on the same line. Uncle Timmie gives us a better binary split implementation. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.17.6.2 retrieving revision 1.17.6.3 diff -C2 -d -r1.17.6.2 -r1.17.6.3 *** Header.py 2 Mar 2003 05:32:38 -0000 1.17.6.2 --- Header.py 3 Mar 2003 06:59:14 -0000 1.17.6.3 *************** *** 263,277 **** self._chunks.append((s, charset)) ! def _split(self, s, charset, firstline, splitchars): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) encoded = charset.from_splittable(splittable, True) elen = charset.encoded_header_len(encoded) - # The maxlinelen depends on whether we're on the first line or not, to - # take account of any header field name. - if firstline: - maxlinelen = self._firstlinelen - else: - maxlinelen = self._maxlinelen # If the line's encoded length first, just return it if elen <= maxlinelen: --- 263,271 ---- self._chunks.append((s, charset)) ! def _split(self, s, charset, maxlinelen, splitchars): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) encoded = charset.from_splittable(splittable, True) elen = charset.encoded_header_len(encoded) # If the line's encoded length first, just return it if elen <= maxlinelen: *************** *** 297,301 **** # higher-level syntactic breaks. elif charset == 'us-ascii': ! return self._split_ascii(s, charset, firstline, splitchars) # BAW: should we use encoded? elif elen == len(s): --- 291,295 ---- # higher-level syntactic breaks. elif charset == 'us-ascii': ! return self._split_ascii(s, charset, maxlinelen, splitchars) # BAW: should we use encoded? elif elen == len(s): *************** *** 308,326 **** # Binary search for split point first, last = _binsplit(splittable, charset, maxlinelen) - # Divide and conquer. - ## halfway = _floordiv(len(splittable), 2) - ## first = charset.from_splittable(splittable[:halfway], False) - ## last = charset.from_splittable(splittable[halfway:], False) # Do the split ! return self._split(first, charset, firstline, splitchars) + \ ! self._split(last, charset, False, splitchars) ! def _split_ascii(self, s, charset, firstline, splitchars): ! if firstline: ! firstlen = self._firstlinelen ! restlen = self._maxlinelen ! else: ! firstlen = restlen = self._maxlinelen ! line = _split_ascii(s, firstlen, restlen, self._continuation_ws, splitchars) lines = line.splitlines() --- 302,311 ---- # Binary search for split point first, last = _binsplit(splittable, charset, maxlinelen) # Do the split ! return self._split(first, charset, maxlinelen, splitchars) + \ ! self._split(last, charset, self._maxlinelen, splitchars) ! def _split_ascii(self, s, charset, firstlen, splitchars): ! line = _split_ascii(s, firstlen, self._maxlinelen, self._continuation_ws, splitchars) lines = line.splitlines() *************** *** 379,384 **** """ newchunks = [] for s, charset in self._chunks: ! newchunks += self._split(s, charset, True, splitchars) return self._encode_chunks(newchunks) --- 364,380 ---- """ newchunks = [] + maxlinelen = self._firstlinelen + lastlen = 0 for s, charset in self._chunks: ! # The first bit of the next chunk should be just long enough to ! # fill the next line. Don't forget the space separating the ! # encoded words. ! targetlen = maxlinelen - lastlen - 1 ! if targetlen < charset.encoded_header_len(''): ! # Stick it on the next line ! targetlen = maxlinelen ! newchunks += self._split(s, charset, targetlen, splitchars) ! lastchunk, lastcharset = newchunks[-1] ! lastlen = lastcharset.encoded_header_len(lastchunk) return self._encode_chunks(newchunks) *************** *** 445,464 **** def _binsplit(splittable, charset, maxlinelen): ! i = lastm = 0 ! j = len(splittable) - 1 ! while True: ! if j < i: ! break ! m = (i + j) / 2 chunk = charset.from_splittable(splittable[:m], True) chunklen = charset.encoded_header_len(chunk) ! if chunklen < maxlinelen: ! lastm = m ! i = m + 1 ! elif chunklen > maxlinelen: ! j = m - 1 else: ! break ! first = charset.from_splittable(splittable[:lastm], False) ! last = charset.from_splittable(splittable[lastm:], False) return first, last --- 441,468 ---- def _binsplit(splittable, charset, maxlinelen): ! i = 0 ! j = len(splittable) ! while i < j: ! # Invariants: ! # 1. splittable[:k] fits for all k <= i (note that we *assume*, ! # at the start, that splittable[:0] fits). ! # 2. splittable[:k] does not fit for any k > j (at the start, ! # this means we shouldn't look at any k > len(splittable)). ! # 3. We don't know about splittable[:k] for k in i+1..j. ! # 4. We want to set i to the largest k that fits, with i <= k <= j. ! # ! m = (i+j+1) >> 1 # ceiling((i+j)/2); i < m <= j chunk = charset.from_splittable(splittable[:m], True) chunklen = charset.encoded_header_len(chunk) ! if chunklen <= maxlinelen: ! # m is acceptable, so is a new lower bound. ! i = m else: ! # m is not acceptable, so final i must be < j. ! j = m - 1 ! # i == j. Invariant #1 implies that splittable[:i] fits, and ! # invariant #2 implies that splittable[:i+1] does not fit, so i ! # is what we're looking for. ! first = charset.from_splittable(splittable[:i], False) ! last = charset.from_splittable(splittable[i:], False) return first, last From bwarsaw@users.sourceforge.net Mon Mar 3 07:00:04 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 02 Mar 2003 23:00:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.29.4.1,1.29.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv6548 Modified Files: Tag: folding-reimpl-branch test_email.py Log Message: Update some of the more complicated encoded header tests. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.29.4.1 retrieving revision 1.29.4.2 diff -C2 -d -r1.29.4.1 -r1.29.4.2 *** test_email.py 2 Mar 2003 03:35:33 -0000 1.29.4.1 --- test_email.py 3 Mar 2003 07:00:01 -0000 1.29.4.2 *************** *** 577,604 **** eq(sfp.getvalue(), """\ Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCnd?= ! =?iso-8859-1?q?ischen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kli?= ! =?iso-8859-1?q?ngen_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropol?= ! =?iso-8859-2?q?e_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb?= ! =?utf-8?b?44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go?= ! =?utf-8?b?44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBp?= ! =?utf-8?q?st_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder?= ! =?utf-8?b?IGRpZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYQ=?= ! =?utf-8?b?44G+44GZ44CC?= """) eq(h.encode(), """\ =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCnd?= ! =?iso-8859-1?q?ischen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kli?= ! =?iso-8859-1?q?ngen_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropol?= ! =?iso-8859-2?q?e_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb?= ! =?utf-8?b?44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go?= ! =?utf-8?b?44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBp?= ! =?utf-8?q?st_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder?= ! =?utf-8?b?IGRpZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYQ=?= ! =?utf-8?b?44G+44GZ44CC?=""") def test_long_header_encode(self): --- 577,604 ---- eq(sfp.getvalue(), """\ Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= ! =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= ! =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= ! =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= ! =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= ! =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= ! =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= ! =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= ! =?utf-8?b?44Gm44GE44G+44GZ44CC?= """) eq(h.encode(), """\ =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= ! =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= ! =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= ! =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= ! =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= ! =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= ! =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= ! =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= ! =?utf-8?b?44Gm44GE44G+44GZ44CC?=""") def test_long_header_encode(self): *************** *** 761,768 **** # BAW: this seems broken because the first line is too long eq(h.encode(), """\ ! X-Very-Very-Very-Long-Header-Name: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") --- 761,768 ---- # BAW: this seems broken because the first line is too long eq(h.encode(), """\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_?= ! =?iso-8859-1?q?ein_werden_mit_einem_Foerderband_komfortabel_den_Korridor_?= ! =?iso-8859-1?q?entlang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei=2C_g?= ! =?iso-8859-1?q?egen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") *************** *** 2250,2263 **** eq(enc, """\ =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_ko?= ! =?iso-8859-1?q?mfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wa?= ! =?iso-8859-1?q?ndgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef?= ! =?iso-8859-1?q?=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hro?= ! =?iso-8859-2?q?utily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j?= ! =?utf-8?b?56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT?= ! =?utf-8?b?44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv?= ! =?utf-8?b?44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3Qg?= ! =?utf-8?q?das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder_di?= ! =?utf-8?b?ZSBGbGlwcGVyd2FsZHQgZ2Vyc3B1dC7jgI3jgajoqIDjgaPjgabjgYTjgb4=?= ! =?utf-8?b?44GZ44CC?=""") eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), --- 2250,2263 ---- eq(enc, """\ =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_ko?= ! =?iso-8859-1?q?mfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wan?= ! =?iso-8859-1?q?dgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef=F6?= ! =?iso-8859-1?q?rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutily?= ! =?iso-8859-2?q?_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j56K6?= ! =?utf-8?b?44Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT44CC?= ! =?utf-8?b?5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv44Gn?= ! =?utf-8?b?44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGFz?= ! =?utf-8?q?_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder_die_Fl?= ! =?utf-8?b?aXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBo+OBpuOBhOOBvuOBmQ==?= ! =?utf-8?b?44CC?=""") eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), From bwarsaw@users.sourceforge.net Mon Mar 3 07:02:04 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 02 Mar 2003 23:02:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email_codecs.py,1.3.8.1,1.3.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv7092 Modified Files: Tag: folding-reimpl-branch test_email_codecs.py Log Message: Update a test but see the BAW comment. Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_codecs.py,v retrieving revision 1.3.8.1 retrieving revision 1.3.8.2 diff -C2 -d -r1.3.8.1 -r1.3.8.2 *** test_email_codecs.py 2 Mar 2003 03:35:53 -0000 1.3.8.1 --- test_email_codecs.py 3 Mar 2003 07:02:02 -0000 1.3.8.2 *************** *** 27,31 **** h.append(jhello, j) h.append(ghello, g) ! eq(h.encode(), 'Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?=\n =?iso-8859-1?q?Gr=FC=DF_Gott!?=') eq(decode_header(h.encode()), [('Hello World!', None), --- 27,38 ---- h.append(jhello, j) h.append(ghello, g) ! # BAW: This used to -- and maybe should -- fold the two iso-8859-1 ! # chunks into a single encoded word. However it doesn't violate the ! # standard to have them as two encoded chunks and maybe it's ! # reasonable for each .append() call to result in a separate ! # encoded word. ! eq(h.encode(), """\ ! Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?= ! =?iso-8859-1?q?Gr=FC=DF?= =?iso-8859-1?q?_Gott!?=""") eq(decode_header(h.encode()), [('Hello World!', None), From loewis@users.sourceforge.net Mon Mar 3 09:34:05 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 03 Mar 2003 01:34:05 -0800 Subject: [Python-checkins] python/dist/src/Lib site.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23190 Modified Files: site.py Log Message: Patch #671666: Alias ANSI code page to "mbcs". Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** site.py 30 Dec 2002 22:08:02 -0000 1.47 --- site.py 3 Mar 2003 09:34:01 -0000 1.48 *************** *** 283,286 **** --- 283,302 ---- + # On Windows, some default encodings are not provided + # by Python (e.g. "cp932" in Japanese locale), while they + # are always available as "mbcs" in each locale. + # Make them usable by aliasing to "mbcs" in such a case. + + if sys.platform == 'win32': + import locale, codecs + enc = locale.getdefaultlocale()[1] + if enc.startswith('cp'): # "cp***" ? + try: + codecs.lookup(enc) + except LookupError: + import encodings + encodings._cache[enc] = encodings._unknown + encodings.aliases.aliases[enc] = 'mbcs' + # Set the string encoding used by the Unicode implementation. The # default is 'ascii', but if you're willing to experiment, you can From loewis@users.sourceforge.net Mon Mar 3 10:40:16 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 03 Mar 2003 02:40:16 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.149,1.150 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv19890 Modified Files: _tkinter.c Log Message: Don't crash on _tkinter.createfilehandler in non-threaded Tcl; disable this function in threaded Tcl. Likewise for creaetetimerhandler. Fixes #692416. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** _tkinter.c 11 Feb 2003 23:05:40 -0000 1.149 --- _tkinter.c 3 Mar 2003 10:40:01 -0000 1.150 *************** *** 2203,2207 **** &file, &mask, &func)) return NULL; ! CHECK_TCL_APPARTMENT; tfile = PyObject_AsFileDescriptor(file); if (tfile < 0) --- 2203,2219 ---- &file, &mask, &func)) return NULL; ! ! if (!self && !tcl_lock) { ! /* We don't have the Tcl lock since Tcl is threaded. */ ! PyErr_SetString(PyExc_RuntimeError, ! "_tkinter.createfilehandler not supported " ! "for threaded Tcl"); ! return NULL; ! } ! ! if (self) { ! CHECK_TCL_APPARTMENT; ! } ! tfile = PyObject_AsFileDescriptor(file); if (tfile < 0) *************** *** 2397,2400 **** --- 2409,2425 ---- return NULL; } + + if (!self && !tcl_lock) { + /* We don't have the Tcl lock since Tcl is threaded. */ + PyErr_SetString(PyExc_RuntimeError, + "_tkinter.createtimerhandler not supported " + "for threaded Tcl"); + return NULL; + } + + if (self) { + CHECK_TCL_APPARTMENT; + } + v = Tktt_New(func); v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler, From jackjansen@users.sourceforge.net Mon Mar 3 12:25:05 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 03 Mar 2003 04:25:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv29414 Modified Files: EasyDialogs.py Log Message: Call AEInteractWithUser() before bringing up any of the dialogs (with the exception of the ProgressBar, which I think is okay to show in the background). This is a prerequisitite for the fix of #684975. Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/EasyDialogs.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EasyDialogs.py 21 Feb 2003 23:18:48 -0000 1.9 --- EasyDialogs.py 3 Mar 2003 12:25:02 -0000 1.10 *************** *** 28,31 **** --- 28,32 ---- from Carbon import Controls from Carbon import Menu + from Carbon import AE import Nav import MacOS *************** *** 47,51 **** if _initialized: return macresource.need("DLOG", 260, "dialogs.rsrc", __name__) ! def cr2lf(text): --- 48,55 ---- if _initialized: return macresource.need("DLOG", 260, "dialogs.rsrc", __name__) ! ! def _interact(): ! """Make sure the application is in the foreground""" ! AE.AEInteractWithUser(50000000) def cr2lf(text): *************** *** 69,72 **** --- 73,77 ---- """ _initialize() + _interact() d = GetNewDialog(id, -1) if not d: *************** *** 101,104 **** --- 106,110 ---- _initialize() + _interact() d = GetNewDialog(id, -1) if not d: *************** *** 142,145 **** --- 148,152 ---- """ _initialize() + _interact() d = GetNewDialog(id, -1) if not d: *************** *** 185,188 **** --- 192,196 ---- _initialize() + _interact() d = GetNewDialog(id, -1) if not d: *************** *** 417,420 **** --- 425,429 ---- def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): _initialize() + _interact() d = GetNewDialog(id, -1) if not d: *************** *** 637,640 **** --- 646,650 ---- popupExtension=popupExtension,eventProc=eventProc,previewProc=previewProc, filterProc=filterProc,typeList=typeList,wanted=wanted,multiple=multiple) + _interact() try: rr = Nav.NavChooseFile(args) *************** *** 689,692 **** --- 699,703 ---- popupExtension=popupExtension,eventProc=eventProc,fileType=fileType, fileCreator=fileCreator,wanted=wanted,multiple=multiple) + _interact() try: rr = Nav.NavPutFile(args) *************** *** 748,751 **** --- 759,763 ---- popupExtension=popupExtension,eventProc=eventProc,filterProc=filterProc, wanted=wanted,multiple=multiple) + _interact() try: rr = Nav.NavChooseFolder(args) From jackjansen@users.sourceforge.net Mon Mar 3 12:28:07 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 03 Mar 2003 04:28:07 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv32050 Modified Files: PythonIDEMain.py Log Message: Don't call AEInteractWithUser unconditionally on a quit appleevent. The EasyDIalogs methods will call it if needed. Fixes #684975. Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** PythonIDEMain.py 28 Feb 2003 15:18:59 -0000 1.30 --- PythonIDEMain.py 3 Mar 2003 12:28:04 -0000 1.31 *************** *** 157,162 **** def quitevent(self, theAppleEvent, theReply): - from Carbon import AE - AE.AEInteractWithUser(50000000) self._quit() --- 157,160 ---- From mwh@users.sourceforge.net Mon Mar 3 12:29:44 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 03 Mar 2003 04:29:44 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.685,1.686 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv423/Misc Modified Files: NEWS Log Message: Fix bug [ 555817 ] Flawed fcntl.ioctl implementation. with my patch that allows for an array to be mutated when passed as the buffer argument to ioctl() (details complicated by backwards compatibility considerations -- read the docs!). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.685 retrieving revision 1.686 diff -C2 -d -r1.685 -r1.686 *** NEWS 2 Mar 2003 00:19:49 -0000 1.685 --- NEWS 3 Mar 2003 12:29:41 -0000 1.686 *************** *** 25,28 **** --- 25,31 ---- ----------------- + - Modified the fcntl.ioctl() function to allow modification of a passed + mutable buffer (for details see the reference documentation). + - Made user requested changes to the itertools module. Subsumed the times() function into repeat(). From mwh@users.sourceforge.net Mon Mar 3 12:29:44 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 03 Mar 2003 04:29:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_ioctl.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv423/Lib/test Added Files: test_ioctl.py Log Message: Fix bug [ 555817 ] Flawed fcntl.ioctl implementation. with my patch that allows for an array to be mutated when passed as the buffer argument to ioctl() (details complicated by backwards compatibility considerations -- read the docs!). --- NEW FILE: test_ioctl.py --- import unittest from test_support import TestSkipped, run_unittest import os, struct try: import fcntl, termios except ImportError: raise TestSkipped("No fcntl or termios module") if not hasattr(termios,'TIOCGPGRP'): raise TestSkipped("termios module doesn't have TIOCGPGRP") class IoctlTests(unittest.TestCase): def test_ioctl(self): pgrp = os.getpgrp() tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") self.assertEquals(pgrp, struct.unpack("i", r)[0]) def test_ioctl_mutate(self): import array buf = array.array('i', [0]) pgrp = os.getpgrp() tty = open("/dev/tty", "r") r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1) self.assertEquals(r, 0) self.assertEquals(pgrp, buf[0]) def test_main(): run_unittest(IoctlTests) if __name__ == "__main__": test_main() From mwh@users.sourceforge.net Mon Mar 3 12:29:44 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 03 Mar 2003 04:29:44 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libfcntl.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv423/Doc/lib Modified Files: libfcntl.tex Log Message: Fix bug [ 555817 ] Flawed fcntl.ioctl implementation. with my patch that allows for an array to be mutated when passed as the buffer argument to ioctl() (details complicated by backwards compatibility considerations -- read the docs!). Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** libfcntl.tex 15 Jan 2003 21:08:19 -0000 1.30 --- libfcntl.tex 3 Mar 2003 12:29:42 -0000 1.31 *************** *** 48,55 **** \end{funcdesc} ! \begin{funcdesc}{ioctl}{fd, op, arg} ! This function is identical to the \function{fcntl()} function, except ! that the operations are typically defined in the library module ! \refmodule{termios}. \end{funcdesc} --- 48,102 ---- \end{funcdesc} ! \begin{funcdesc}{ioctl}{fd, op\optional{, arg\optional{, mutate_flag}}} ! This function is identical to the \function{fcntl()} function, ! except that the operations are typically defined in the library ! module \refmodule{termios} and the argument handling is even more ! complicated. ! ! The parameter \var{arg} can be one of an integer, absent (treated ! identically to the integer \code{0}), an object supporting the ! read-only buffer interface (most likely a plain Python string) or an ! object supporting the read-write buffer interface. ! ! In all but the last case, behaviour is as for the \function{fcntl()} ! function. ! ! If a mutable buffer is passed, then the behaviour is determined by ! the value of the \var{mutate_flag} parameter. ! ! If it is false, the buffer's mutability is ignored and behaviour is ! as for a read-only buffer, except that the 1024 byte limit mentioned ! above is avoided -- so long as the buffer you pass is longer than ! what the operating system wants to put there, things should work. ! ! If \var{mutate_flag} is true, then the buffer is (in effect) passed ! to the underlying \function{ioctl()} system call, the latter's ! return code is passed back to the calling Python, and the buffer's ! new contents reflect the action of the \function{ioctl}. This is a ! slight simplification, because if the supplied buffer is less than ! 1024 bytes long it is first copied into a static buffer 1024 bytes ! long which is then passed to \function{ioctl} and copied back into ! the supplied buffer. ! ! If \var{mutate_flag} is not supplied, then in 2.3 it defaults to ! false. This is planned to change over the next few Python versions: ! in 2.4 failing to supply \var{mutate_flag} will get a warning but ! the same behavior and in versions later than 2.5 it will default to ! true. ! ! An example: ! ! \begin{verbatim} ! >>> import array, fnctl, struct, termios, os ! >>> os.getpgrp() ! 13341 ! >>> struct.unpack('h', fcntl.ioctl(0, termios.TIOCGPGRP, " "))[0] ! 13341 ! >>> buf = array.array('h', [0]) ! >>> fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1) ! 0 ! >>> buf ! array('h', [13341]) ! \end{verbatim} \end{funcdesc} *************** *** 123,128 **** \seemodule{os}{The \function{os.open} function supports locking flags and is available on a wider variety of platforms than ! the \function{fcntl.lockf} and \function{fcntl.flock} ! functions, providing a more platform-independent file ! locking facility.} \end{seealso} --- 170,175 ---- \seemodule{os}{The \function{os.open} function supports locking flags and is available on a wider variety of platforms than ! the \function{fcntl.lockf} and \function{fcntl.flock} ! functions, providing a more platform-independent file ! locking facility.} \end{seealso} From mwh@users.sourceforge.net Mon Mar 3 12:29:45 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 03 Mar 2003 04:29:45 -0800 Subject: [Python-checkins] python/dist/src/Modules fcntlmodule.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv423/Modules Modified Files: fcntlmodule.c Log Message: Fix bug [ 555817 ] Flawed fcntl.ioctl implementation. with my patch that allows for an array to be mutated when passed as the buffer argument to ioctl() (details complicated by backwards compatibility considerations -- read the docs!). Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** fcntlmodule.c 1 Jan 2003 09:51:12 -0000 2.37 --- fcntlmodule.c 3 Mar 2003 12:29:42 -0000 2.38 *************** *** 100,105 **** --- 100,159 ---- char *str; int len; + int mutate_arg = 0; char buf[1024]; + if (PyArg_ParseTuple(args, "O&iw#|i:ioctl", + conv_descriptor, &fd, &code, + &str, &len, &mutate_arg)) { + char *arg; + + if (PyTuple_Size(args) == 3) { + /* warning goes here in 2.4 */ + mutate_arg = 0; + } + if (mutate_arg) { + if (len <= sizeof buf) { + memcpy(buf, str, len); + arg = buf; + } + else { + arg = str; + } + } + else { + if (len > sizeof buf) { + PyErr_SetString(PyExc_ValueError, + "ioctl string arg too long"); + return NULL; + } + else { + memcpy(buf, str, len); + arg = buf; + } + } + if (buf == arg) { + Py_BEGIN_ALLOW_THREADS /* think array.resize() */ + ret = ioctl(fd, code, arg); + Py_END_ALLOW_THREADS + } + else { + ret = ioctl(fd, code, arg); + } + if (mutate_arg && (len < sizeof buf)) { + memcpy(str, buf, len); + } + if (ret < 0) { + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + if (mutate_arg) { + return PyInt_FromLong(ret); + } + else { + return PyString_FromStringAndSize(buf, len); + } + } + + PyErr_Clear(); if (PyArg_ParseTuple(args, "O&is#:ioctl", conv_descriptor, &fd, &code, &str, &len)) { *************** *** 124,128 **** if (!PyArg_ParseTuple(args, "O&i|i;ioctl requires a file or file descriptor," ! " an integer and optionally a third integer or a string", conv_descriptor, &fd, &code, &arg)) { return NULL; --- 178,182 ---- if (!PyArg_ParseTuple(args, "O&i|i;ioctl requires a file or file descriptor," ! " an integer and optionally a integer or buffer argument", conv_descriptor, &fd, &code, &arg)) { return NULL; *************** *** 139,153 **** PyDoc_STRVAR(ioctl_doc, ! "ioctl(fd, opt, [arg])\n\ \n\ ! Perform the requested operation on file descriptor fd. The operation\n\ ! is defined by op and is operating system dependent. Typically these\n\ ! codes can be retrieved from the library module IOCTL. The argument arg\n\ ! is optional, and defaults to 0; it may be an int or a string. If arg is\n\ ! given as a string, the return value of ioctl is a string of that length,\n\ ! containing the resulting value put in the arg buffer by the operating system.\n\ ! The length of the arg string is not allowed to exceed 1024 bytes. If the arg\n\ ! given is an integer or if none is specified, the result value is an integer\n\ ! corresponding to the return value of the ioctl call in the C code."); --- 193,225 ---- PyDoc_STRVAR(ioctl_doc, ! "ioctl(fd, opt[, arg[, mutate_flag]])\n\ \n\ ! Perform the requested operation on file descriptor fd. The operation is\n\ ! defined by op and is operating system dependent. Typically these codes are\n\ ! retrieved from the fcntl or termios library modules.\n\ ! \n\ ! The argument arg is optional, and defaults to 0; it may be an int or a\n\ ! buffer containing character data (most likely a string or an array). \n\ ! \n\ ! If the argument is a mutable buffer (such as an array) and if the\n\ ! mutate_flag argument (which is only allowed in this case) is true then the\n\ ! buffer is (in effect) passed to the operating system and changes made by\n\ ! the OS will be reflected in the contents of the buffer after the call has\n\ ! returned. The return value is the integer returned by the ioctl system\n\ ! call.\n\ ! \n\ ! If the argument is a mutable buffer and the mutable_flag argument is not\n\ ! passed or is false, the behavior is as if a string had been passed. This\n\ ! behavior will change in future releases of Python.\n\ ! \n\ ! If the argument is an immutable buffer (most likely a string) then a copy\n\ ! of the buffer is passed to the operating system and the return value is a\n\ ! string of the same length containing whatever the operating system put in\n\ ! the buffer. The length of the arg buffer in this case is not allowed to\n\ ! exceed 1024 bytes.\n\ ! \n\ ! If the arg given is an integer or if none is specified, the result value is\n\ ! an integer corresponding to the return value of the ioctl call in the C\n\ ! code."); From jackjansen@users.sourceforge.net Mon Mar 3 13:13:01 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 03 Mar 2003 05:13:01 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.19,1.20 cfsupport.py,1.19,1.20 pycfbridge.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory sc8-pr-cvs1:/tmp/cvs-serv17271 Modified Files: _CFmodule.c cfsupport.py pycfbridge.c Log Message: Accept only the system default encoding when converting Python strings to CF strings. Fixes 682215. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _CFmodule.c 23 Dec 2002 22:35:38 -0000 1.19 --- _CFmodule.c 3 Mar 2003 13:12:58 -0000 1.20 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 1459,1463 **** if (PyString_Check(v)) { char *cStr = PyString_AsString(v); ! *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, 0); return 1; } --- 1459,1463 ---- if (PyString_Check(v)) { char *cStr = PyString_AsString(v); ! *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; } Index: cfsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cfsupport.py 23 Dec 2002 22:35:38 -0000 1.19 --- cfsupport.py 3 Mar 2003 13:12:59 -0000 1.20 *************** *** 360,365 **** if (v == Py_None) { *p_itself = NULL; return 1; } if (PyString_Check(v)) { ! char *cStr = PyString_AsString(v); ! *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, 0); return 1; } --- 360,367 ---- if (v == Py_None) { *p_itself = NULL; return 1; } if (PyString_Check(v)) { ! char *cStr; ! if (!PyArg_Parse(v, "et", "ascii", &cStr)) ! return NULL; ! *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; } Index: pycfbridge.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/pycfbridge.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pycfbridge.c 13 May 2002 21:23:10 -0000 1.5 --- pycfbridge.c 3 Mar 2003 13:12:59 -0000 1.6 *************** *** 293,298 **** if (PyString_Check(src)) { ! if ((chars = PyString_AsString(src)) == NULL ) goto err; ! *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, 0); return 1; } --- 293,299 ---- if (PyString_Check(src)) { ! if (!PyArg_Parse(src, "es", NULL, &chars)) ! return NULL; /* This error is more descriptive than the general one below */ ! *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); return 1; } From jackjansen@users.sourceforge.net Mon Mar 3 13:19:46 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 03 Mar 2003 05:19:46 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf cfsupport.py,1.20,1.21 pycfbridge.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory sc8-pr-cvs1:/tmp/cvs-serv19892 Modified Files: cfsupport.py pycfbridge.c Log Message: Mod to previous checkin: we must require ascii, not system defautl encoding, because we have no easy way to convert the python encoding string to a CF encoding parameter. Index: cfsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** cfsupport.py 3 Mar 2003 13:12:59 -0000 1.20 --- cfsupport.py 3 Mar 2003 13:19:43 -0000 1.21 *************** *** 361,365 **** if (PyString_Check(v)) { char *cStr; ! if (!PyArg_Parse(v, "et", "ascii", &cStr)) return NULL; *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); --- 361,365 ---- if (PyString_Check(v)) { char *cStr; ! if (!PyArg_Parse(v, "es", "ascii", &cStr)) return NULL; *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); Index: pycfbridge.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/pycfbridge.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pycfbridge.c 3 Mar 2003 13:12:59 -0000 1.6 --- pycfbridge.c 3 Mar 2003 13:19:44 -0000 1.7 *************** *** 293,297 **** if (PyString_Check(src)) { ! if (!PyArg_Parse(src, "es", NULL, &chars)) return NULL; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); --- 293,297 ---- if (PyString_Check(src)) { ! if (!PyArg_Parse(src, "es", "ascii", &chars)) return NULL; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); From jackjansen@users.sourceforge.net Mon Mar 3 14:57:02 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 03 Mar 2003 06:57:02 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyDebugger.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv28847 Modified Files: PyDebugger.py Log Message: Gave the text fields a little more space, so they don't get cut off. Index: PyDebugger.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDebugger.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyDebugger.py 13 Dec 2002 23:31:55 -0000 1.12 --- PyDebugger.py 3 Mar 2003 14:56:59 -0000 1.13 *************** *** 154,158 **** w.panes.bottom = bottom = W.Group(None) ! bottom.src = src = W.Group((0, 52, 0, 0)) source = SourceViewer((1, 1, -15, -15), readonly = 1, debugger = self) src.optionsmenu = W.PopupMenu((-16, 0, 16, 16), []) --- 154,158 ---- w.panes.bottom = bottom = W.Group(None) ! bottom.src = src = W.Group((0, 64, 0, 0)) source = SourceViewer((1, 1, -15, -15), readonly = 1, debugger = self) src.optionsmenu = W.PopupMenu((-16, 0, 16, 16), []) *************** *** 165,172 **** bottom.tracingmonitor = TracingMonitor((0, 23, 6, 6)) ! bottom.state = W.TextBox((12, 20, 0, 16), self.reason) ! bottom.srctitle = W.TextBox((12, 36, 0, 14)) ! bottom.buttons = buttons = W.Group((12, 0, 0, 16)) buttons.runbutton = W.Button((0, 0, 50, 16), "Run", self.do_run) --- 165,172 ---- bottom.tracingmonitor = TracingMonitor((0, 23, 6, 6)) ! bottom.state = W.TextBox((12, 24, 0, 16), self.reason) ! bottom.srctitle = W.TextBox((12, 44, 0, 16)) ! bottom.buttons = buttons = W.Group((12, 0, 0, 20)) buttons.runbutton = W.Button((0, 0, 50, 16), "Run", self.do_run) From bwarsaw@users.sourceforge.net Mon Mar 3 15:40:33 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 03 Mar 2003 07:40:33 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.29.4.2,1.29.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv22260 Modified Files: Tag: folding-reimpl-branch test_email.py Log Message: test_whitespace_eater(): Test for complaint in SF patch #585600. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.29.4.2 retrieving revision 1.29.4.3 diff -C2 -d -r1.29.4.2 -r1.29.4.3 *** test_email.py 3 Mar 2003 07:00:01 -0000 1.29.4.2 --- test_email.py 3 Mar 2003 15:40:28 -0000 1.29.4.3 *************** *** 2361,2364 **** --- 2361,2373 ---- eq(h.encode(), s) + def test_whitespace_eater(self): + eq = self.assertEqual + s = 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztk=?= =?koi8-r?q?=CA?= zz.' + parts = decode_header(s) + eq(parts, [('Subject:', None), ('\xf0\xd2\xcf\xd7\xc5\xd2\xcb\xc1 \xce\xc1 \xc6\xc9\xce\xc1\xcc\xd8\xce\xd9\xca', 'koi8-r'), ('zz.', None)]) + hdr = make_header(parts) + eq(hdr.encode(), + 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztnK?= zz.') + From bwarsaw@users.sourceforge.net Mon Mar 3 15:48:15 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 03 Mar 2003 07:48:15 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.17,1.17.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv26220 Modified Files: Tag: folding-reimpl-branch Generator.py Log Message: _make_boundary(): Some locales don't use periods as th decimal point character. SF patch #652497 by Dmitry Azhichakov (slightly modified by Barry). Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -C2 -d -r1.17 -r1.17.6.1 *** Generator.py 14 Oct 2002 15:09:30 -0000 1.17 --- Generator.py 3 Mar 2003 15:48:08 -0000 1.17.6.1 *************** *** 5,10 **** """ - import time import re import random --- 5,11 ---- """ import re + import time + import locale import random *************** *** 365,369 **** # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! boundary = ('=' * 15) + repr(random.random()).split('.')[1] + '==' if text is None: return boundary --- 366,371 ---- # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! dp = locale.localeconv().get('decimal_point', '.') ! boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '==' if text is None: return boundary From bwarsaw@users.sourceforge.net Mon Mar 3 15:57:20 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 03 Mar 2003 07:57:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.17.6.3,1.17.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv30969 Modified Files: Tag: folding-reimpl-branch Header.py Log Message: _split(): `first' is now guaranteed to be of the correct length so we don't need to recursively split it. We just wrap it in the appropriate chrome, then add it to the recursively split remainder. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.17.6.3 retrieving revision 1.17.6.4 diff -C2 -d -r1.17.6.3 -r1.17.6.4 *** Header.py 3 Mar 2003 06:59:14 -0000 1.17.6.3 --- Header.py 3 Mar 2003 15:57:17 -0000 1.17.6.4 *************** *** 302,308 **** # Binary search for split point first, last = _binsplit(splittable, charset, maxlinelen) ! # Do the split ! return self._split(first, charset, maxlinelen, splitchars) + \ ! self._split(last, charset, self._maxlinelen, splitchars) def _split_ascii(self, s, charset, firstlen, splitchars): --- 302,311 ---- # Binary search for split point first, last = _binsplit(splittable, charset, maxlinelen) ! # first is of the proper length so just wrap it in the appropriate ! # chrome. last must be recursively split. ! fsplittable = charset.to_splittable(first) ! fencoded = charset.from_splittable(fsplittable, True) ! chunk = [(fencoded, charset)] ! return chunk + self._split(last, charset, self._maxlinelen, splitchars) def _split_ascii(self, s, charset, firstlen, splitchars): From bwarsaw@users.sourceforge.net Mon Mar 3 16:33:44 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 03 Mar 2003 08:33:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.29.4.3,1.29.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv16057 Modified Files: Tag: folding-reimpl-branch test_email.py Log Message: test_no_nl_preamble(): New test for preamble not being line terminated. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.29.4.3 retrieving revision 1.29.4.4 diff -C2 -d -r1.29.4.3 -r1.29.4.4 *** test_email.py 3 Mar 2003 15:40:28 -0000 1.29.4.3 --- test_email.py 3 Mar 2003 16:33:35 -0000 1.29.4.4 *************** *** 1345,1348 **** --- 1345,1385 ---- self.assertEqual(sfp.getvalue(), text) + def test_no_nl_preamble(self): + eq = self.ndiffAssertEqual + msg = Message() + msg['From'] = 'aperson@dom.ain' + msg['To'] = 'bperson@dom.ain' + msg['Subject'] = 'Test' + msg.preamble = 'MIME message' + msg.epilogue = '' + msg1 = MIMEText('One') + msg2 = MIMEText('Two') + msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') + msg.attach(msg1) + msg.attach(msg2) + eq(msg.as_string(), """\ + From: aperson@dom.ain + To: bperson@dom.ain + Subject: Test + Content-Type: multipart/mixed; boundary="BOUNDARY" + + MIME message + --BOUNDARY + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + One + + --BOUNDARY + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + Two + + --BOUNDARY-- + """) + def test_default_type(self): eq = self.assertEqual From bwarsaw@users.sourceforge.net Mon Mar 3 16:36:28 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 03 Mar 2003 08:36:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.17.6.1,1.17.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv17277 Modified Files: Tag: folding-reimpl-branch Generator.py Log Message: _handle_multipart(): If the preamble doesn't end in a line break, we must add one otherwise the following boundary separator will be broken. Closes SF bug #682504. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.17.6.1 retrieving revision 1.17.6.2 diff -C2 -d -r1.17.6.1 -r1.17.6.2 *** Generator.py 3 Mar 2003 15:48:08 -0000 1.17.6.1 --- Generator.py 3 Mar 2003 16:36:23 -0000 1.17.6.2 *************** *** 14,17 **** --- 14,18 ---- from email.Header import Header + from email.Parser import NLCRE try: *************** *** 260,263 **** --- 261,272 ---- if msg.preamble is not None: self._fp.write(msg.preamble) + # If preamble is the empty string, the length of the split will be + # 1, but the last element will be the empty string. If it's + # anything else but does not end in a line separator, the length + # will be > 1 and not end in an empty string. We need to + # guarantee a newline after the preamble, but don't add too many. + plines = NLCRE.split(msg.preamble) + if plines <> [''] and plines[-1] <> '': + self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. From bwarsaw@users.sourceforge.net Mon Mar 3 16:37:19 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 03 Mar 2003 08:37:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.19,1.19.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv17645 Modified Files: Tag: folding-reimpl-branch Parser.py Log Message: Cosmetic Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.19 retrieving revision 1.19.6.1 diff -C2 -d -r1.19 -r1.19.6.1 *** Parser.py 5 Nov 2002 21:44:06 -0000 1.19 --- Parser.py 3 Mar 2003 16:37:12 -0000 1.19.6.1 *************** *** 21,25 **** False = 0 ! nlcre = re.compile('\r\n|\r|\n') --- 21,25 ---- False = 0 ! NLCRE = re.compile('\r\n|\r|\n') *************** *** 177,181 **** # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = nlcre.search(payload, start) if mo: start += len(mo.group(0)) --- 177,181 ---- # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = NLCRE.search(payload, start) if mo: start += len(mo.group(0)) From klm@users.sourceforge.net Mon Mar 3 17:09:47 2003 From: klm@users.sourceforge.net (klm@users.sourceforge.net) Date: Mon, 03 Mar 2003 09:09:47 -0800 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.31,4.32 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv728 Modified Files: python-mode.el Log Message: py-pdbtrack-grub-for-buffer(): Rectified some logic errors i introduced when shifting around some code, and added some redundancy to reduce chances of hitting the wrong source code. (This is experimental - it will improve the accuracy, but will reduce the ability of the user to deliberately select the buffer they want the buffer grubbing stuff to find. I think the accuracy improvement will be worth it, but am not sure, so may remove this.) Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.31 retrieving revision 4.32 diff -C2 -d -r4.31 -r4.32 *** python-mode.el 3 Mar 2003 04:05:03 -0000 4.31 --- python-mode.el 3 Mar 2003 17:09:44 -0000 4.32 *************** *** 387,390 **** --- 387,397 ---- (defvar py-pdbtrack-is-tracking-p nil) + (defvar py-pdbtrack-last-grubbed-buffer nil + "Record of the last buffer used when the source path was invalid. + + This buffer is consulted before the buffer-list history for satisfying + `py-pdbtrack-grub-for-buffer', since it's the most often the likely + prospect as debugging continues.") + (make-variable-buffer-local 'py-pdbtrack-last-grubbed-buffer) (defvar py-pychecker-history nil) *************** *** 1380,1394 **** "Find most recent buffer itself named or having function funcname. ! Must have a least int(lineno) lines in it." (let ((buffers (buffer-list)) - ;(buffers (list (get-buffer "workflow_do_action.py"))) curbuf got) (while (and buffers (not got)) (setq buf (car buffers) buffers (cdr buffers)) ! (if (or (save-excursion (set-buffer buf) ! (string= major-mode "python-mode")) ! (and (string-match funcname (buffer-name buf)) (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" funcname "\\s-*(") --- 1387,1406 ---- "Find most recent buffer itself named or having function funcname. ! We first check the last buffer this function found, if any, then walk ! throught the buffer-list history for python-mode buffers that are ! named for funcname or define a function funcname." (let ((buffers (buffer-list)) curbuf got) + (if (and py-pdbtrack-last-grubbed-buffer + (member py-pdbtrack-last-grubbed-buffer buffers)) + ; Prefer last grubbed buffer by putting it at the front of the list: + (setq buffers (cons py-pdbtrack-last-grubbed-buffer buffers))) (while (and buffers (not got)) (setq buf (car buffers) buffers (cdr buffers)) ! (if (and (save-excursion (set-buffer buf) ! (string= major-mode "python-mode")) ! (or (string-match funcname (buffer-name buf)) (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" funcname "\\s-*(") *************** *** 1397,1401 **** buf)))) (setq got buf))) ! got)) (defun py-postprocess-output-buffer (buf) --- 1409,1413 ---- buf)))) (setq got buf))) ! (setq py-pdbtrack-last-grubbed-buffer got))) (defun py-postprocess-output-buffer (buf) From jvr@users.sourceforge.net Mon Mar 3 17:32:22 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 03 Mar 2003 09:32:22 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.686,1.687 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13097/Misc Modified Files: NEWS Log Message: Patch #683592 revisited, after discussions with MvL: - Implement the behavior as specified in PEP 277, meaning os.listdir() will only return unicode strings if it is _called_ with a unicode argument. - And then return only unicode, don't attempt to convert to ASCII. - Don't switch on Py_FileSystemDefaultEncoding, but simply use the default encoding if Py_FileSystemDefaultEncoding is NULL. This means os.listdir() can now raise UnicodeDecodeError if the default encoding can't represent the directory entry. (This seems better than silcencing the error and fall back to a byte string.) - Attempted to decribe the above in Doc/lib/libos.tex. - Reworded the Misc/NEWS items to reflect the current situation. This checkin also fixes bug #696261, which was due to os.listdir() not using Py_FileSystemDefaultEncoding, like all file system calls are supposed to. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.686 retrieving revision 1.687 diff -C2 -d -r1.686 -r1.687 *** NEWS 3 Mar 2003 12:29:41 -0000 1.686 --- NEWS 3 Mar 2003 17:32:15 -0000 1.687 *************** *** 42,50 **** report . ! - os.listdir() now returns Unicode strings on platforms that set ! Py_FileSystemDefaultEncoding, for file names that are not representable ! in ASCII. (This currently only affects MacOS X; on Windows versions ! with wide file name support os.listdir() already returned Unicode ! strings.) - Distutils: both 'py_modules' and 'packages' keywords can now be specified --- 42,48 ---- report . ! - On Unix platforms, if os.listdir() is called with a Unicode argument, ! it now returns Unicode strings. (This behavior was added earlier ! to the Windows NT/2k/XP version of os.listdir().) - Distutils: both 'py_modules' and 'packages' keywords can now be specified *************** *** 89,94 **** --- ! - os.listdir() now may return Unicode strings on MacOS X. See the general ! news item under "Library". - A new method MacOS.WMAvailable() returns true if it is safe to access --- 87,92 ---- --- ! - os.listdir() now returns Unicode strings on MacOS X when called with ! a Unicode argument. See the general news item under "Library". - A new method MacOS.WMAvailable() returns true if it is safe to access From jvr@users.sourceforge.net Mon Mar 3 17:32:45 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 03 Mar 2003 09:32:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.114,1.115 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13097/Doc/lib Modified Files: libos.tex Log Message: Patch #683592 revisited, after discussions with MvL: - Implement the behavior as specified in PEP 277, meaning os.listdir() will only return unicode strings if it is _called_ with a unicode argument. - And then return only unicode, don't attempt to convert to ASCII. - Don't switch on Py_FileSystemDefaultEncoding, but simply use the default encoding if Py_FileSystemDefaultEncoding is NULL. This means os.listdir() can now raise UnicodeDecodeError if the default encoding can't represent the directory entry. (This seems better than silcencing the error and fall back to a byte string.) - Attempted to decribe the above in Doc/lib/libos.tex. - Reworded the Misc/NEWS items to reflect the current situation. This checkin also fixes bug #696261, which was due to os.listdir() not using Py_FileSystemDefaultEncoding, like all file system calls are supposed to. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** libos.tex 14 Feb 2003 19:35:31 -0000 1.114 --- libos.tex 3 Mar 2003 17:32:12 -0000 1.115 *************** *** 712,717 **** Availability: Macintosh, \UNIX, Windows. ! \versionadded[On Windows NT/2k/XP, if \var{path} is a Unicode object, ! the result will be a list of Unicode objects.]{2.3} \end{funcdesc} --- 712,717 ---- Availability: Macintosh, \UNIX, Windows. ! \versionadded[On Windows NT/2k/XP and Unix, if \var{path} is a Unicode ! object, the result will be a list of Unicode objects.]{2.3} \end{funcdesc} From jvr@users.sourceforge.net Mon Mar 3 17:32:47 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 03 Mar 2003 09:32:47 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.287,2.288 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13097/Modules Modified Files: posixmodule.c Log Message: Patch #683592 revisited, after discussions with MvL: - Implement the behavior as specified in PEP 277, meaning os.listdir() will only return unicode strings if it is _called_ with a unicode argument. - And then return only unicode, don't attempt to convert to ASCII. - Don't switch on Py_FileSystemDefaultEncoding, but simply use the default encoding if Py_FileSystemDefaultEncoding is NULL. This means os.listdir() can now raise UnicodeDecodeError if the default encoding can't represent the directory entry. (This seems better than silcencing the error and fall back to a byte string.) - Attempted to decribe the above in Doc/lib/libos.tex. - Reworded the Misc/NEWS items to reflect the current situation. This checkin also fixes bug #696261, which was due to os.listdir() not using Py_FileSystemDefaultEncoding, like all file system calls are supposed to. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.287 retrieving revision 2.288 diff -C2 -d -r2.287 -r2.288 *** posixmodule.c 25 Feb 2003 21:42:15 -0000 2.287 --- posixmodule.c 3 Mar 2003 17:32:13 -0000 2.288 *************** *** 1776,1780 **** DIR *dirp; struct dirent *ep; ! if (!PyArg_ParseTuple(args, "s:listdir", &name)) return NULL; if ((dirp = opendir(name)) == NULL) { --- 1776,1786 ---- DIR *dirp; struct dirent *ep; ! int arg_is_unicode = 1; ! ! if (!PyArg_ParseTuple(args, "U:listdir", &v)) { ! arg_is_unicode = 0; ! PyErr_Clear(); ! } ! if (!PyArg_ParseTuple(args, "et:listdir", Py_FileSystemDefaultEncoding, &name)) return NULL; if ((dirp = opendir(name)) == NULL) { *************** *** 1797,1801 **** } #ifdef Py_USING_UNICODE ! if (Py_FileSystemDefaultEncoding != NULL) { PyObject *w; --- 1803,1807 ---- } #ifdef Py_USING_UNICODE ! if (arg_is_unicode) { PyObject *w; *************** *** 1810,1821 **** break; } - /* attempt to convert to ASCII */ - w = PyUnicode_AsASCIIString(v); - if (w != NULL) { - Py_DECREF(v); - v = w; - } - else - PyErr_Clear(); } #endif --- 1816,1819 ---- From akuchling@users.sourceforge.net Mon Mar 3 18:26:04 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 03 Mar 2003 10:26:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command register.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv13971 Modified Files: register.py Log Message: Improve description Index: register.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/register.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** register.py 19 Feb 2003 14:27:21 -0000 1.4 --- register.py 3 Mar 2003 18:26:01 -0000 1.5 *************** *** 16,20 **** class register(Command): ! description = "register the distribution with the repository" DEFAULT_REPOSITORY = 'http://www.python.org/pypi' --- 16,20 ---- class register(Command): ! description = ("register the distribution with the Python package index") DEFAULT_REPOSITORY = 'http://www.python.org/pypi' From akuchling@users.sourceforge.net Mon Mar 3 18:37:19 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 03 Mar 2003 10:37:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command __init__.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv17894 Modified Files: __init__.py Log Message: [Bug #69389] List register command in __all__, so setup.py --help-commands will now list it Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/__init__.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** __init__.py 19 Nov 2002 13:12:27 -0000 1.17 --- __init__.py 3 Mar 2003 18:37:16 -0000 1.18 *************** *** 20,23 **** --- 20,24 ---- 'install_data', 'sdist', + 'register', 'bdist', 'bdist_dumb', From jvr@users.sourceforge.net Mon Mar 3 19:07:16 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 03 Mar 2003 11:07:16 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.288,2.289 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv32165/Modules Modified Files: posixmodule.c Log Message: plugged leak noted by nnorwitz: the 'et' format returns allocated memory Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.288 retrieving revision 2.289 diff -C2 -d -r2.288 -r2.289 *** posixmodule.c 3 Mar 2003 17:32:13 -0000 2.288 --- posixmodule.c 3 Mar 2003 19:07:13 -0000 2.289 *************** *** 1772,1776 **** #else ! char *name; PyObject *d, *v; DIR *dirp; --- 1772,1776 ---- #else ! char *name = NULL; PyObject *d, *v; DIR *dirp; *************** *** 1785,1792 **** return NULL; if ((dirp = opendir(name)) == NULL) { ! return posix_error_with_filename(name); } if ((d = PyList_New(0)) == NULL) { closedir(dirp); return NULL; } --- 1785,1793 ---- return NULL; if ((dirp = opendir(name)) == NULL) { ! return posix_error_with_allocated_filename(name); } if ((d = PyList_New(0)) == NULL) { closedir(dirp); + PyMem_Free(name); return NULL; } *************** *** 1827,1830 **** --- 1828,1832 ---- } closedir(dirp); + PyMem_Free(name); return d; From akuchling@users.sourceforge.net Mon Mar 3 20:07:32 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 03 Mar 2003 12:07:32 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils dist.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv25442 Modified Files: dist.py Log Message: [Bug #693470] 'licence' as an alias for 'license' doesn't work. This patch makes it work again. Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** dist.py 19 Feb 2003 14:16:01 -0000 1.62 --- dist.py 3 Mar 2003 20:07:27 -0000 1.63 *************** *** 206,209 **** --- 206,218 ---- opt_dict[opt] = ("setup script", val) + if attrs.has_key('licence'): + attrs['license'] = attrs['licence'] + del attrs['licence'] + msg = "'licence' distribution option is deprecated; use 'license'" + if warnings is not None: + warnings.warn(msg) + else: + sys.stderr.write(msg + "\n") + # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! *************** *** 967,971 **** "license", "description", "long_description", "keywords", "platforms", "fullname", "contact", ! "contact_email", "licence", "classifiers", "download_url") --- 976,980 ---- "license", "description", "long_description", "keywords", "platforms", "fullname", "contact", ! "contact_email", "license", "classifiers", "download_url") From nnorwitz@users.sourceforge.net Mon Mar 3 21:16:41 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 03 Mar 2003 13:16:41 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.687,1.688 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30451/Misc Modified Files: NEWS Log Message: Fix SF #692416, don't crash interpreter for _tkinter.deletefilehandler in addition to createfilehandler and creaetetimerhandler. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.687 retrieving revision 1.688 diff -C2 -d -r1.687 -r1.688 *** NEWS 3 Mar 2003 17:32:15 -0000 1.687 --- NEWS 3 Mar 2003 21:16:38 -0000 1.688 *************** *** 25,28 **** --- 25,32 ---- ----------------- + - Using createfilehandler, deletefilehandler, createtimerhandler functions + on Tkinter.tkinter (_tkinter module) no longer crashes the interpreter. + See SF bug #692416. + - Modified the fcntl.ioctl() function to allow modification of a passed mutable buffer (for details see the reference documentation). From nnorwitz@users.sourceforge.net Mon Mar 3 21:16:42 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 03 Mar 2003 13:16:42 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.150,1.151 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30451/Modules Modified Files: _tkinter.c Log Message: Fix SF #692416, don't crash interpreter for _tkinter.deletefilehandler in addition to createfilehandler and creaetetimerhandler. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** _tkinter.c 3 Mar 2003 10:40:01 -0000 1.150 --- _tkinter.c 3 Mar 2003 21:16:39 -0000 1.151 *************** *** 2244,2248 **** if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file)) return NULL; ! CHECK_TCL_APPARTMENT; tfile = PyObject_AsFileDescriptor(file); if (tfile < 0) --- 2244,2260 ---- if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file)) return NULL; ! ! if (!self && !tcl_lock) { ! /* We don't have the Tcl lock since Tcl is threaded. */ ! PyErr_SetString(PyExc_RuntimeError, ! "_tkinter.deletefilehandler not supported " ! "for threaded Tcl"); ! return NULL; ! } ! ! if (self) { ! CHECK_TCL_APPARTMENT; ! } ! tfile = PyObject_AsFileDescriptor(file); if (tfile < 0) From tim_one@users.sourceforge.net Tue Mar 4 00:26:43 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 03 Mar 2003 16:26:43 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17965/Lib/test Modified Files: regrtest.py Log Message: test_ioctl is an expected skip on Windows. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** regrtest.py 28 Feb 2003 19:53:32 -0000 1.132 --- regrtest.py 4 Mar 2003 00:26:38 -0000 1.133 *************** *** 568,571 **** --- 568,572 ---- test_iconv_codecs test_imgfile + test_ioctl test_largefile test_linuxaudiodev From niemeyer@users.sourceforge.net Tue Mar 4 00:50:26 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 03 Mar 2003 16:50:26 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.64,1.337.2.4.2.65 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25505/Misc Modified Files: Tag: release22-maint NEWS Log Message: Backported fix to [521782] unreliable file.read() error handling. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.64 retrieving revision 1.337.2.4.2.65 diff -C2 -d -r1.337.2.4.2.64 -r1.337.2.4.2.65 *** NEWS 1 Mar 2003 02:14:52 -0000 1.337.2.4.2.64 --- NEWS 4 Mar 2003 00:50:23 -0000 1.337.2.4.2.65 *************** *** 296,299 **** --- 296,302 ---- class than for instances of that class. + - Fixed bug #521782: when a file was in non-blocking mode, file.read() + could silently lose data or wrongly throw an unknown error. + Extension modules From niemeyer@users.sourceforge.net Tue Mar 4 00:50:27 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 03 Mar 2003 16:50:27 -0800 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.141.6.6,2.141.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25505/Objects Modified Files: Tag: release22-maint fileobject.c Log Message: Backported fix to [521782] unreliable file.read() error handling. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.141.6.6 retrieving revision 2.141.6.7 diff -C2 -d -r2.141.6.6 -r2.141.6.7 *** fileobject.c 25 Sep 2002 18:06:48 -0000 2.141.6.6 --- fileobject.c 4 Mar 2003 00:50:24 -0000 2.141.6.7 *************** *** 569,572 **** --- 569,586 ---- } + #if defined(EWOULDBLOCK) && defined(EAGAIN) && EWOULDBLOCK != EAGAIN + #define BLOCKED_ERRNO(x) ((x) == EWOULDBLOCK || (x) == EAGAIN) + #else + #ifdef EWOULDBLOCK + #define BLOCKED_ERRNO(x) ((x) == EWOULDBLOCK) + #else + #ifdef EAGAIN + #define BLOCKED_ERRNO(x) ((x) == EAGAIN) + #else + #define BLOCKED_ERRNO(x) 0 + #endif + #endif + #endif + static PyObject * file_read(PyFileObject *f, PyObject *args) *************** *** 602,617 **** if (!ferror(f->f_fp)) break; - PyErr_SetFromErrno(PyExc_IOError); clearerr(f->f_fp); Py_DECREF(v); return NULL; } bytesread += chunksize; ! if (bytesread < buffersize) break; if (bytesrequested < 0) { buffersize = new_buffersize(f, buffersize); if (_PyString_Resize(&v, buffersize) < 0) return NULL; } } --- 616,642 ---- if (!ferror(f->f_fp)) break; clearerr(f->f_fp); + /* When in non-blocking mode, data shouldn't + * be discarded if a blocking signal was + * received. That will also happen if + * chunksize != 0, but bytesread < buffersize. */ + if (bytesread > 0 && BLOCKED_ERRNO(errno)) + break; + PyErr_SetFromErrno(PyExc_IOError); Py_DECREF(v); return NULL; } bytesread += chunksize; ! if (bytesread < buffersize) { ! clearerr(f->f_fp); break; + } if (bytesrequested < 0) { buffersize = new_buffersize(f, buffersize); if (_PyString_Resize(&v, buffersize) < 0) return NULL; + } else { + /* Got what was requested. */ + break; } } *************** *** 1322,1326 **** "read([size]) -> read at most size bytes, returned as a string.\n" "\n" ! "If the size argument is negative or omitted, read until EOF is reached."; static char write_doc[] = --- 1347,1353 ---- "read([size]) -> read at most size bytes, returned as a string.\n" "\n" ! "If the size argument is negative or omitted, read until EOF is reached.\n" ! "Notice that when in non-blocking mode, less data than what was requested\n" ! "may be returned, even if no size parameter was given."; static char write_doc[] = From niemeyer@users.sourceforge.net Tue Mar 4 00:50:55 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 03 Mar 2003 16:50:55 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.19,1.80.6.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25505/Doc/lib Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Backported fix to [521782] unreliable file.read() error handling. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.19 retrieving revision 1.80.6.20 diff -C2 -d -r1.80.6.19 -r1.80.6.20 *** libstdtypes.tex 17 Feb 2003 18:59:54 -0000 1.80.6.19 --- libstdtypes.tex 4 Mar 2003 00:50:20 -0000 1.80.6.20 *************** *** 1164,1168 **** an \EOF{} is hit.) Note that this method may call the underlying C function \cfunction{fread()} more than once in an effort to ! acquire as close to \var{size} bytes as possible. \end{methoddesc} --- 1164,1170 ---- an \EOF{} is hit.) Note that this method may call the underlying C function \cfunction{fread()} more than once in an effort to ! acquire as close to \var{size} bytes as possible. Also note that ! when in non-blocking mode, less data than what was requested may ! be returned, even if no \var{size} parameter was given. \end{methoddesc} From jackjansen@users.sourceforge.net Tue Mar 4 10:52:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 04 Mar 2003 02:52:41 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv2738 Modified Files: Makefile.pre.in Log Message: Patch #696613 by Ben Laurie: use "test -L" to test for symlinks in stead of the older (and, according to some manpages, deprecated) "test -h". Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** Makefile.pre.in 27 Feb 2003 23:19:46 -0000 1.115 --- Makefile.pre.in 4 Mar 2003 10:52:39 -0000 1.116 *************** *** 564,568 **** # Install the interpreter (by creating a hard link to python$(VERSION)) bininstall: altbininstall ! -if test -f $(BINDIR)/$(PYTHON) -o -L $(BINDIR)/$(PYTHON); \ then rm -f $(BINDIR)/$(PYTHON); \ else true; \ --- 564,568 ---- # Install the interpreter (by creating a hard link to python$(VERSION)) bininstall: altbininstall ! -if test -f $(BINDIR)/$(PYTHON) -o -h $(BINDIR)/$(PYTHON); \ then rm -f $(BINDIR)/$(PYTHON); \ else true; \ From akuchling@users.sourceforge.net Tue Mar 4 14:07:55 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 04 Mar 2003 06:07:55 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16125 Modified Files: libre.tex Log Message: [bug #696771] Remove misleading parenthetical aside Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** libre.tex 3 Dec 2002 18:49:17 -0000 1.93 --- libre.tex 4 Mar 2003 14:07:51 -0000 1.94 *************** *** 314,319 **** is 0, or \var{number} is 3 octal digits long, it will not be interpreted as a group match, but as the character with octal value \var{number}. - (There is a group 0, which is the entire matched pattern, but it can't - be referenced with \regexp{\e 0}; instead, use \regexp{\e g<0>}.) Inside the \character{[} and \character{]} of a character class, all numeric escapes are treated as characters. --- 314,317 ---- From akuchling@users.sourceforge.net Tue Mar 4 14:12:28 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 04 Mar 2003 06:12:28 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17967 Modified Files: libre.tex Log Message: [bug #692016] update description of {m,n} modifier; you can omit the lower bound Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** libre.tex 4 Mar 2003 14:07:51 -0000 1.94 --- libre.tex 4 Mar 2003 14:12:24 -0000 1.95 *************** *** 130,136 **** \var{m} to \var{n} repetitions of the preceding RE, attempting to match as many repetitions as possible. For example, \regexp{a\{3,5\}} ! will match from 3 to 5 \character{a} characters. Omitting \var{n} ! specifies an infinite upper bound; you can't omit \var{m}. As an ! example, \regexp{a\{4,\}b} will match \code{aaaab}, a thousand \character{a} characters followed by a \code{b}, but not \code{aaab}. The comma may not be omitted or the modifier would be confused with --- 130,137 ---- \var{m} to \var{n} repetitions of the preceding RE, attempting to match as many repetitions as possible. For example, \regexp{a\{3,5\}} ! will match from 3 to 5 \character{a} characters. Omitting \var{m} ! specifies a lower bound of zero, ! and omitting \var{n} specifies an infinite upper bound. As an ! example, \regexp{a\{4,\}b} will match \code{aaaab} or a thousand \character{a} characters followed by a \code{b}, but not \code{aaab}. The comma may not be omitted or the modifier would be confused with From akuchling@users.sourceforge.net Tue Mar 4 14:17:09 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 04 Mar 2003 06:17:09 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19475 Modified Files: libre.tex Log Message: Weaken recommendation of Friedl book; fix reference Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** libre.tex 4 Mar 2003 14:12:24 -0000 1.95 --- libre.tex 4 Mar 2003 14:17:05 -0000 1.96 *************** *** 36,42 **** \begin{seealso} \seetitle{Mastering Regular Expressions}{Book on regular expressions ! by Jeffrey Friedl, published by O'Reilly. The Python ! material in this book dates from before the \refmodule{re} ! module, but it covers writing good regular expression patterns in great detail.} \end{seealso} --- 36,42 ---- \begin{seealso} \seetitle{Mastering Regular Expressions}{Book on regular expressions ! by Jeffrey Friedl, published by O'Reilly. The second ! edition of the book no longer covers Python at all, ! but the first edition covered writing good regular expression patterns in great detail.} \end{seealso} *************** *** 59,63 **** expressions like the ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book ! referenced below, or almost any textbook about compiler construction. A brief explanation of the format of regular expressions follows. For --- 59,63 ---- expressions like the ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book ! referenced above, or almost any textbook about compiler construction. A brief explanation of the format of regular expressions follows. For From nnorwitz@users.sourceforge.net Tue Mar 4 17:44:38 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 04 Mar 2003 09:44:38 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.45.8.3,1.45.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17613 Modified Files: Tag: release22-maint libstring.tex Log Message: SF bug #697220, string.strip implementation/doc mismatch Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.45.8.3 retrieving revision 1.45.8.4 diff -C2 -d -r1.45.8.3 -r1.45.8.4 *** libstring.tex 12 Sep 2002 14:16:31 -0000 1.45.8.3 --- libstring.tex 4 Mar 2003 17:44:34 -0000 1.45.8.4 *************** *** 260,263 **** --- 260,265 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[The \var{chars} parameter was added. The \var{chars} + parameter cannot be passed in 2.2 or 2.2.1]{2.2.2} \end{funcdesc} From jvr@users.sourceforge.net Tue Mar 4 19:30:49 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 04 Mar 2003 11:30:49 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.289,2.290 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv977/Modules Modified Files: posixmodule.c Log Message: os.listdir(): Fall back to the original byte string if conversion to unicode fails, as discussed in patch #683592. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.289 retrieving revision 2.290 diff -C2 -d -r2.289 -r2.290 *** posixmodule.c 3 Mar 2003 19:07:13 -0000 2.289 --- posixmodule.c 4 Mar 2003 19:30:44 -0000 2.290 *************** *** 1810,1819 **** Py_FileSystemDefaultEncoding, "strict"); ! Py_DECREF(v); ! v = w; ! if (v == NULL) { ! Py_DECREF(d); ! d = NULL; ! break; } } --- 1810,1821 ---- Py_FileSystemDefaultEncoding, "strict"); ! if (w != NULL) { ! Py_DECREF(v); ! v = w; ! } ! else { ! /* fall back to the original byte string, as ! discussed in patch #683592 */ ! PyErr_Clear(); } } From akuchling@users.sourceforge.net Tue Mar 4 19:35:45 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 04 Mar 2003 11:35:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1:/tmp/cvs-serv4014 Modified Files: dist.tex Log Message: Point e-mail address at the SIG Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** dist.tex 26 Feb 2003 18:58:46 -0000 1.50 --- dist.tex 4 Mar 2003 19:35:40 -0000 1.51 *************** *** 12,16 **** \author{Greg Ward} ! \authoraddress{Email: \email{gward@python.net}} \makeindex --- 12,16 ---- \author{Greg Ward} ! \authoraddress{Email: \email{distutils-sig@python.org}} \makeindex From akuchling@users.sourceforge.net Tue Mar 4 19:36:16 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 04 Mar 2003 11:36:16 -0800 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory sc8-pr-cvs1:/tmp/cvs-serv4217 Modified Files: inst.tex Log Message: Point e-mail address at the SIG Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** inst.tex 27 Nov 2002 13:34:20 -0000 1.46 --- inst.tex 4 Mar 2003 19:36:11 -0000 1.47 *************** *** 18,22 **** \author{Greg Ward} ! \authoraddress{Email: \email{gward@python.net}} \makeindex --- 18,22 ---- \author{Greg Ward} ! \authoraddress{Email: \email{distutils-sig@python.org}} \makeindex From jackjansen@users.sourceforge.net Wed Mar 5 09:37:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 05 Mar 2003 01:37:23 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources Applet-Info.plist,1.2,NONE Applet-InfoPlist.strings,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources In directory sc8-pr-cvs1:/tmp/cvs-serv3466 Removed Files: Applet-Info.plist Applet-InfoPlist.strings Log Message: These are no longer used. --- Applet-Info.plist DELETED --- --- Applet-InfoPlist.strings DELETED --- From loewis@users.sourceforge.net Wed Mar 5 14:15:30 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 05 Mar 2003 06:15:30 -0800 Subject: [Python-checkins] python/dist/src/Modules getbuildinfo.c,2.9,2.10 main.c,1.72,1.73 posixmodule.c,2.290,2.291 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26905 Modified Files: getbuildinfo.c main.c posixmodule.c Log Message: Patch #696645: Remove VMS code with uncertain authorship. Index: getbuildinfo.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getbuildinfo.c,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** getbuildinfo.c 6 Dec 2002 12:48:49 -0000 2.9 --- getbuildinfo.c 5 Mar 2003 14:15:18 -0000 2.10 *************** *** 29,97 **** #endif - #ifdef __VMS - # ifdef __DECC - # pragma extern_model save - # pragma extern_model strict_refdef - extern long ctl$gl_imghdrbf; - # pragma extern_model restore - # endif - - # ifdef __ALPHA - # define EIHD$L_IMGIDOFF 24 - # define EIHI$Q_LINKTIME 8 - # define _IMGIDOFF EIHD$L_IMGIDOFF - # define _LINKTIME EIHI$Q_LINKTIME - # else - # define IHD$W_IMGIDOFF 6 - # define IHI$Q_LINKTIME 56 - # define _IMGIDOFF IHD$W_IMGIDOFF - # define _LINKTIME IHI$Q_LINKTIME - # endif /* __VMS */ - - long* - vms__get_linktime (void) - { - long* al_imghdrbf; - unsigned short* aw_imgidoff; - unsigned short w_imgidoff; - long* aq_linktime; - unsigned char* ab_ihi; - - al_imghdrbf = &ctl$gl_imghdrbf; - - al_imghdrbf = (long *)*al_imghdrbf; - al_imghdrbf = (long *)*al_imghdrbf; - - aw_imgidoff = (unsigned short *) - ((unsigned char *)al_imghdrbf + _IMGIDOFF); - - w_imgidoff = *aw_imgidoff; - - ab_ihi = (unsigned char *)al_imghdrbf + w_imgidoff; - - aq_linktime = (long *) (ab_ihi + _LINKTIME); - - return aq_linktime; - } /* vms__get_linktime (void) */ - extern void vms__cvt_v2u_time (long * aq_vmstime, time_t * al_unixtime); - /* input , output */ - #endif /* __VMS */ - - const char * Py_GetBuildInfo(void) { static char buildinfo[50]; - #ifdef __VMS - time_t l_unixtime; - - vms__cvt_v2u_time(vms__get_linktime (), &l_unixtime ); - - memset(buildinfo, 0, 40); - sprintf(buildinfo, "#%d, %.24s", BUILD, ctime (&l_unixtime)); - #else PyOS_snprintf(buildinfo, sizeof(buildinfo), "#%d, %.20s, %.9s", BUILD, DATE, TIME); - #endif return buildinfo; } --- 29,38 ---- Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** main.c 23 Dec 2002 21:03:36 -0000 1.72 --- main.c 5 Mar 2003 14:15:19 -0000 1.73 *************** *** 6,11 **** #ifdef __VMS ! extern int PyVMS_init(int* pvi_argc, char*** pvi_argv); ! extern PyObject* pyvms_gr_empty_string; #endif --- 6,10 ---- #ifdef __VMS ! #include #endif *************** *** 306,310 **** --- 305,316 ---- strcmp(argv[_PyOS_optind], "-") != 0) { + #ifdef __VMS + filename = decc$translate_vms(argv[_PyOS_optind]); + if (filename == (char *)0 || filename == (char *)-1) + filename = argv[_PyOS_optind]; + + #else filename = argv[_PyOS_optind]; + #endif if (filename != NULL) { if ((fp = fopen(filename, "r")) == NULL) { *************** *** 371,411 **** Py_SetProgramName(argv[0]); - #ifdef __VMS - PyVMS_init(&argc, &argv); - #endif Py_Initialize(); - #ifdef __VMS - /* create an empty string object */ - pyvms_gr_empty_string = Py_BuildValue("s#", Py_None, (unsigned int)0); - #endif - if (Py_VerboseFlag || (command == NULL && filename == NULL && stdin_is_interactive)) - #ifndef __VMS fprintf(stderr, "Python %s on %s\n%s\n", Py_GetVersion(), Py_GetPlatform(), COPYRIGHT); - #else - fprintf(stderr, "Python %s on %s %s (%s_float)\n%s\n", - Py_GetVersion(), Py_GetPlatform(), - # ifdef __ALPHA - "Alpha", - # else - "VAX", - # endif - # if __IEEE_FLOAT - "T", - # else - # if __D_FLOAT - "D", - # else - # if __G_FLOAT - "G", - # endif /* __G_FLOAT */ - # endif /* __D_FLOAT */ - # endif /* __IEEE_FLOAT */ - COPYRIGHT); /* << @@ defined above in this file */ - /* Py_GetCopyright()); */ - #endif /* __VMS */ if (command != NULL) { --- 377,386 ---- Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.290 retrieving revision 2.291 diff -C2 -d -r2.290 -r2.291 *** posixmodule.c 4 Mar 2003 19:30:44 -0000 2.290 --- posixmodule.c 5 Mar 2003 14:15:21 -0000 2.291 *************** *** 29,44 **** # include # include - /* ----- */ - /* DECC on Alpha does redefine these already */ - # ifndef shell$from_vms - # define shell$from_vms(_p1_,_p2_,_p3_) decc$from_vms(_p1_,_p2_,_p3_) - # endif - # ifndef shell$translate_vms - # define shell$translate_vms(_p1_) decc$translate_vms(_p1_) - # endif - # ifndef shell$to_vms - # define shell$to_vms(_p1_,_p2_,_p3_,_p4_,_p5_) \ - decc$to_vms(_p1_,_p2_,_p3_,_p4_,_p5_) - # endif # include /* define wait() */ #endif /* defined(__VMS) */ --- 29,32 ---- *************** *** 148,152 **** #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 ! #endif /* PYOS_OS2 && PYCC_GCC */ #endif /* _MSC_VER */ #endif /* __BORLANDC__ */ --- 136,140 ---- #define HAVE_WAIT 1 #define HAVE_TTYNAME 1 ! #endif /* PYOS_OS2 && PYCC_GCC && __VMS */ #endif /* _MSC_VER */ #endif /* __BORLANDC__ */ *************** *** 337,488 **** #if defined(__VMS) - static char psxmod_gt_psxpath[1026]; - - static int - psxmod_from_vms_action (char *spec) - { - (void)strcpy(psxmod_gt_psxpath, spec); - return 1; - } - - /* Return a dictionary corresponding to the VMS 'environment table' */ - static char* at_home = "HOME"; - static char* at_path = "PATH"; - - static char psxmod_t_command [] = "SYS$COMMAND"; /* add some values to provide a similar environment like POSIX */ void ! psmmod_add_posix_env(PyObject *d) { - /* -------------------- */ - struct dsc$descriptor_s r_device_name; - long l_devbufsiz; - long l_tt_page; - long l_item_code; - long l_status; PyObject *o; ! struct dsc$descriptor_s r_resultant_string; ! char t_resultant_string[13]; /* enough space for username (12)+ '\0' */ ! char *at_resultant_string; ! short int w_resultant_length; ! ! /* set up string descriptor */ ! r_device_name.dsc$w_length = strlen(psxmod_t_command); ! r_device_name.dsc$b_dtype = DSC$K_DTYPE_T; ! r_device_name.dsc$b_class = DSC$K_CLASS_S; ! r_device_name.dsc$a_pointer = &psxmod_t_command[0]; ! ! /* -------------------- */ ! /* COLUMNS = $getdvi("SYS$COMMAND","DEVBUFSIZ") */ ! l_item_code = DVI$_DEVBUFSIZ; ! l_status = lib$getdvi(&l_item_code, ! 0, /* [channel] */ ! &r_device_name, ! &l_devbufsiz, /* integer-value */ ! 0, /* resultant_string */ ! 0); /* resultant_length */ ! if (l_status == SS$_NORMAL) { ! /* create a string object here to comply with POSIX */ ! ! /* set up string descriptor */ ! r_resultant_string.dsc$w_length = ! (sizeof(t_resultant_string) - 1); /* ommit '\0' at end */ ! r_resultant_string.dsc$b_dtype = DSC$K_DTYPE_T; ! r_resultant_string.dsc$b_class = DSC$K_CLASS_S; ! r_resultant_string.dsc$a_pointer = &t_resultant_string[0]; ! ! /* Convert Signed Integer to Decimal Text */ ! l_status = ots$cvt_l_ti(&l_devbufsiz, &r_resultant_string, 1, ! 4, 0); ! if (l_status == SS$_NORMAL) { ! /* terminate string for 'C'-style */ ! t_resultant_string[sizeof(t_resultant_string)-1] = '\0'; ! /* string appears as: ' value' -- skip ' ' */ ! at_resultant_string = &t_resultant_string[0]; ! while ((*at_resultant_string == ' ' ) && ! (*at_resultant_string != '\0')) { ! at_resultant_string++; /* skip prefix spaces */ ! } ! ! o = Py_BuildValue("s", at_resultant_string); ! if (o != NULL) { ! (void) PyDict_SetItemString(d, "COLUMNS", o); ! Py_DECREF(o); ! } ! } /* (l_status = ots$cvt_l_ti() == SS$_NORMAL) */ ! } /* (l_status = lib$getdvi(DVI$_DEVBUFSIZ) == SS$_NORMAL) */ ! /* LINES = $getdvi("SYS$COMMAND","TT_PAGE") */ ! l_item_code = DVI$_TT_PAGE; ! l_status = lib$getdvi(&l_item_code, ! 0, /* [channel] */ ! &r_device_name, ! &l_tt_page, /* integer-value */ ! 0, /* resultant_string */ ! 0); /* resultant_length */ ! if (l_status == SS$_NORMAL) { ! /* create a string object here to comply with POSIX */ ! ! /* set up string descriptor */ ! r_resultant_string.dsc$w_length = ! (sizeof(t_resultant_string) - 1); /* ommit '\0' at end */ ! r_resultant_string.dsc$b_dtype = DSC$K_DTYPE_T; ! r_resultant_string.dsc$b_class = DSC$K_CLASS_S; ! r_resultant_string.dsc$a_pointer = &t_resultant_string[0]; ! ! /* Convert Signed Integer to Decimal Text */ ! l_status = ots$cvt_l_ti(&l_tt_page, &r_resultant_string, ! 1, 4, 0); ! if (l_status == SS$_NORMAL) { ! /* terminate string for 'C'-style */ ! t_resultant_string[sizeof(t_resultant_string)-1] = '\0'; ! /* string appears as: ' value' -- skip ' ' */ ! at_resultant_string = &t_resultant_string[0]; ! while ((*at_resultant_string == ' ' ) && ! (*at_resultant_string != '\0')) { ! at_resultant_string++; /* skip prefix spaces */ ! } ! ! o = Py_BuildValue("s", at_resultant_string); ! if (o != NULL) { ! (void)PyDict_SetItemString(d, "LINES", o); ! Py_DECREF(o); ! } ! } /* (l_status = ots$cvt_l_ti() == SS$_NORMAL) */ ! } /* (l_status = lib$getdvi(DVI$_TT_PAGE) == SS$_NORMAL) */ ! /* else -- ignore error */ ! ! /* LOGNAME = $getjpi(0,"USERNAME") */ ! l_item_code = JPI$_USERNAME; ! /* set up string descriptor */ ! r_resultant_string.dsc$w_length = ! (sizeof(t_resultant_string) - 1); /* ommit '\0' at end */ ! r_resultant_string.dsc$b_dtype = DSC$K_DTYPE_T; ! r_resultant_string.dsc$b_class = DSC$K_CLASS_S; ! r_resultant_string.dsc$a_pointer = &t_resultant_string[0]; ! l_status = lib$getjpi(&l_item_code, 0, 0, 0, ! &r_resultant_string, &w_resultant_length); ! if (l_status == SS$_NORMAL){ ! t_resultant_string[w_resultant_length] = '\0'; ! /* remove any trailing spaces by replacing 1st one with '\0' */ ! at_resultant_string = &t_resultant_string[0]; ! while ((*at_resultant_string != ' ' ) && ! (*at_resultant_string != '\0')) { ! /* lowercase for compatibility with POSIX */ ! *at_resultant_string = tolower(*at_resultant_string); ! at_resultant_string++; /* skip non-blank */ ! } ! *at_resultant_string = '\0'; /* terminate */ ! o = Py_BuildValue("s", &t_resultant_string[0]); ! if (o != NULL) { ! (void) PyDict_SetItemString(d, "LOGNAME", o); ! (void) PyDict_SetItemString(d, "USERNAME", o); ! Py_DECREF(o); ! } ! } /* (l_status == SS$_NORMAL) */ /* OS = "OpenVMS" */ o = PyString_FromString ("OpenVMS"); --- 325,375 ---- #if defined(__VMS) /* add some values to provide a similar environment like POSIX */ + static void ! vms_add_posix_env(PyObject *d) { PyObject *o; ! char* str; ! str = getenv("LINES"); ! o = Py_BuildValue("s", str); ! if (o != NULL) { ! (void)PyDict_SetItemString(d, "LINES", o); ! Py_DECREF(o); ! } ! str = getenv("COLUMNS"); ! o = Py_BuildValue("s", str); ! if (o != NULL) { ! (void)PyDict_SetItemString(d, "COLUMNS", o); ! Py_DECREF(o); ! } ! str = getenv("USER"); ! o = Py_BuildValue("s", str); ! if (o != NULL) { ! (void)PyDict_SetItemString(d, "USERNAME", o); ! Py_DECREF(o); ! } ! o = Py_BuildValue("s", str); ! if (o != NULL) { ! (void)PyDict_SetItemString(d, "LOGNAME", o); ! Py_DECREF(o); ! } ! str = getenv("HOME"); ! o = Py_BuildValue("s", str); ! if (o != NULL) { ! (void)PyDict_SetItemString(d, "HOME", o); ! Py_DECREF(o); ! } + str = getenv("PATH"); + o = Py_BuildValue("s", str); + if (o != NULL) { + (void)PyDict_SetItemString(d, "PATH", o); + Py_DECREF(o); + } /* OS = "OpenVMS" */ o = PyString_FromString ("OpenVMS"); *************** *** 492,529 **** } } - - /* @@ posix env: - COLUMNS=80 $ write sys$output f$getdvi("SYS$COMMAND","DEVBUFSIZ") - LINES=47 $ write sys$output f$getdvi("SYS$COMMAND","TT_PAGE") - LOGNAME=zessin $ write sys$output f$edit(f$getjpi(0,"username"), - - "collapse,lowercase") - OS=OpenVMS - PS1=HERE $ - - TZ=CET-1:00CET DST,M3.5.0/2:00,M10.5.0/3:00 - $ write sys$output f$trnlnm("POSIX$DEFAULT_TZ") - "CET-1:00CET DST-2:00,M3.5.0/2:00,M10.5.0/3:00" - $ write sys$output f$trnlnm("UCX$TZ") - "MET-1MET_DST-2,M3.5.0/2,M10.5.0/3" - PAGER=more - TERM=vt300_series - SHELL=/bin/sh - HOME=/dka100/user/zessin - _=/bin/env - - >>> for v in os.environ.items(): - ... print v - ... - ('HOME', '/user_here/zessin') - ('COLUMNS', '80') - ('LINES', '24') - ('PATH', '/python_disk/python/python-1_5_2/vms') - ('OS', 'OpenVMS') - ('USER', 'ZESSIN') - ('LOGNAME', 'zessin') - ('TERM', 'vt300-80') - ('USERNAME', 'zessin') - >>> - */ #endif /* __VMS */ --- 379,382 ---- *************** *** 554,570 **** continue; } - #if defined(__VMS) - if ((strncmp(at_home, *e, sizeof(at_home)) == 0) || - (strncmp(at_path, *e, sizeof(at_path)) == 0)) { - (void)shell$from_vms(p+1, psxmod_from_vms_action, 0); - /* 0 = no wildcard expansion */ - v = PyString_FromString(psxmod_gt_psxpath); - } - else { - v = PyString_FromString(p+1); - } - #else v = PyString_FromString(p+1); - #endif if (v == NULL) { PyErr_Clear(); --- 407,411 ---- *************** *** 580,586 **** } #if defined(__VMS) ! psmmod_add_posix_env(d); ! #endif /* defined(__VMS) */ ! #if defined(PYOS_OS2) { APIRET rc; --- 421,426 ---- } #if defined(__VMS) ! vms_add_posix_env(d); ! #elif defined(PYOS_OS2) { APIRET rc; *************** *** 1341,1346 **** #elif defined(PYOS_OS2) && defined(PYCC_GCC) return posix_1str(args, "et:chdir", _chdir2, NULL, NULL); ! #else ! #ifdef __VMS return posix_1str(args, "et:chdir", (int (*)(const char *))chdir, NULL, NULL); --- 1181,1185 ---- #elif defined(PYOS_OS2) && defined(PYCC_GCC) return posix_1str(args, "et:chdir", _chdir2, NULL, NULL); ! #elif defined(__VMS) return posix_1str(args, "et:chdir", (int (*)(const char *))chdir, NULL, NULL); *************** *** 1348,1352 **** return posix_1str(args, "et:chdir", chdir, NULL, NULL); #endif - #endif } --- 1187,1190 ---- *************** *** 1500,1505 **** #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(buf, sizeof buf); ! #else ! #if defined(__VMS) /* 0 = force Unix-style path if in the VMS DCL environment! */ res = getcwd(buf, sizeof buf, 0); --- 1338,1342 ---- #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(buf, sizeof buf); ! #elif defined(__VMS) /* 0 = force Unix-style path if in the VMS DCL environment! */ res = getcwd(buf, sizeof buf, 0); *************** *** 1507,1511 **** res = getcwd(buf, sizeof buf); #endif - #endif Py_END_ALLOW_THREADS if (res == NULL) --- 1344,1347 ---- *************** *** 1541,1544 **** --- 1377,1383 ---- #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(buf, sizeof buf); + #elif defined(__VMS) + /* 0 = force Unix-style path if in the VMS DCL environment! */ + res = getcwd(buf, sizeof buf, 0); #else res = getcwd(buf, sizeof buf); *************** *** 5339,5342 **** --- 5178,5185 ---- if (!PyArg_ParseTuple(args, "i:fstat", &fd)) return NULL; + #ifdef __VMS + /* on OpenVMS we must ensure that all bytes are written to the file */ + fsync(fd); + #endif Py_BEGIN_ALLOW_THREADS res = FSTAT(fd, &st); From mwh@users.sourceforge.net Wed Mar 5 14:21:03 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 05 Mar 2003 06:21:03 -0800 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv28992 Modified Files: ref3.tex Log Message: I thought it was common practice to check things compiled before checking them in? Oh well, this fixes various obvious mistakes and changes a subsubsubsection (which doesn't exist) into a subsubsection (which does). I'm not sure this matches the intent, but it seems to read OK on a quick skim. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** ref3.tex 28 Feb 2003 14:11:45 -0000 1.100 --- ref3.tex 5 Mar 2003 14:20:58 -0000 1.101 *************** *** 1200,1204 **** \end{methoddesc} ! \subsubsection{More attribute access for new-style classes \lable{new-style-attribute-access}} The following methods only apply to new-style classes. --- 1200,1204 ---- \end{methoddesc} ! \subsubsection{More attribute access for new-style classes \label{new-style-attribute-access}} The following methods only apply to new-style classes. *************** *** 1216,1220 **** \end{methoddesc} ! \subsubsubsection{Implementing Descriptors \label{descriptors}} The following methods only apply when an instance of the class --- 1216,1220 ---- \end{methoddesc} ! \subsubsection{Implementing Descriptors \label{descriptors}} The following methods only apply when an instance of the class *************** *** 1236,1246 **** \begin{methoddesc}[object]{__set__}{self, instance, value} ! Called to set the attribute on an instance \{instance} of the owner class to a new value, \var{value}. \end{methoddesc} \begin{methoddesc}[object]{__delete__}{self, instance} ! Called to delete the attribute on an instance \{instance} of the owner ! class. \end{methoddesc} --- 1236,1246 ---- \begin{methoddesc}[object]{__set__}{self, instance, value} ! Called to set the attribute on an instance \var{instance} of the owner class to a new value, \var{value}. \end{methoddesc} \begin{methoddesc}[object]{__delete__}{self, instance} ! Called to delete the attribute on an instance \var{instance} of the ! owner class. \end{methoddesc} From mwh@users.sourceforge.net Wed Mar 5 14:42:15 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 05 Mar 2003 06:42:15 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5741 Modified Files: libstdtypes.tex Log Message: Back in June in revision 1.98 Steve (accidentally, presumably) wiped out a month's worth of checkins to libstdtypes.tex (including my extended slice docs). I think this checkin merges them all back in, but if you make one of these checkins: revision 1.97 date: 2002/06/14 00:27:13; author: nnorwitz Use \code{True} (or False) instead of true/false. Not sure if code is correct, but that is what's in this file. I've seen \constant{True} in other places. ---------------------------- revision 1.95 date: 2002/05/22 20:39:43; author: bwarsaw Jack's documentation for the U mode character on the file() constructor, vetted by Barry. ---------------------------- revision 1.94 date: 2002/05/21 18:19:15; author: rhettinger Patch 543387. Document deprecation of complex %, //,and divmod(). ---------------------------- revision 1.93 date: 2002/05/15 15:45:25; author: rhettinger Added missing index entries for mapping methods. Closes patch #548693. some checking may be in order. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** libstdtypes.tex 17 Feb 2003 18:57:06 -0000 1.118 --- libstdtypes.tex 5 Mar 2003 14:42:09 -0000 1.119 *************** *** 229,234 **** \bifuncindex{complex} ! All numeric types support the following operations, sorted by ! ascending priority (operations in the same box have the same priority; all numeric operations have a higher priority than comparison operations): --- 229,234 ---- \bifuncindex{complex} ! All numeric types (except complex) support the following operations, ! sorted by ascending priority (operations in the same box have the same priority; all numeric operations have a higher priority than comparison operations): *************** *** 240,244 **** \lineiii{\var{x} * \var{y}}{product of \var{x} and \var{y}}{} \lineiii{\var{x} / \var{y}}{quotient of \var{x} and \var{y}}{(1)} ! \lineiii{\var{x} \%{} \var{y}}{remainder of \code{\var{x} / \var{y}}}{} \hline \lineiii{-\var{x}}{\var{x} negated}{} --- 240,244 ---- \lineiii{\var{x} * \var{y}}{product of \var{x} and \var{y}}{} \lineiii{\var{x} / \var{y}}{quotient of \var{x} and \var{y}}{(1)} ! \lineiii{\var{x} \%{} \var{y}}{remainder of \code{\var{x} / \var{y}}}{(4)} \hline \lineiii{-\var{x}}{\var{x} negated}{} *************** *** 251,255 **** \lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{} \lineiii{\var{c}.conjugate()}{conjugate of the complex number \var{c}}{} ! \lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)} \lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{} \lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{} --- 251,255 ---- \lineiii{complex(\var{re},\var{im})}{a complex number with real part \var{re}, imaginary part \var{im}. \var{im} defaults to zero.}{} \lineiii{\var{c}.conjugate()}{conjugate of the complex number \var{c}}{} ! \lineiii{divmod(\var{x}, \var{y})}{the pair \code{(\var{x} / \var{y}, \var{x} \%{} \var{y})}}{(3)(4)} \lineiii{pow(\var{x}, \var{y})}{\var{x} to the power \var{y}}{} \lineiii{\var{x} ** \var{y}}{\var{x} to the power \var{y}}{} *************** *** 284,287 **** --- 284,293 ---- description. + \item[(4)] + Complex floor division operator, modulo operator, and \function{divmod()}. + + \deprecated{2.3}{Instead convert to float using \function{abs()} + if appropriate.} + \end{description} % XXXJH exceptions: overflow (when? what operations?) zerodivision *************** *** 443,446 **** --- 449,453 ---- \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(3)} \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(3), (4)} + \lineiii{\var{s}[\var{i}:\var{j}:\var{k}]}{slice of \var{s} from \var{i} to \var{j} with step \var{k}}{(3), (5)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} *************** *** 456,459 **** --- 463,467 ---- \indexii{subscript}{operation} \indexii{slice}{operation} + \indexii{extended slice}{operation} \opindex{in} \opindex{not in} *************** *** 507,510 **** --- 515,527 ---- use \code{0}. If \var{j} is omitted, use \code{len(\var{s})}. If \var{i} is greater than or equal to \var{j}, the slice is empty. + + \item[(5)] The slice of \var{s} from \var{i} to \var{j} with step + \var{k} is defined as the sequence of items with index + \code{\var{x} = \var{i} + \var{n}*\var{k}} such that \code{0} + \code{<=} \var{n} \code{<} \code{abs(i-j)}. If \var{i} or \var{j} + is greater than \code{len(\var{s})}, use \code{len(\var{s})}. If + \var{i} or \var{j} are ommitted then they become ``end'' values + (which end depends on the sign of \var{k}). + \end{description} *************** *** 551,556 **** \begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} ! Return true if the string ends with the specified \var{suffix}, ! otherwise return false. With optional \var{start}, test beginning at that position. With optional \var{end}, stop comparing at that position. \end{methoddesc} --- 568,573 ---- \begin{methoddesc}[string]{endswith}{suffix\optional{, start\optional{, end}}} ! Return \code{True} if the string ends with the specified \var{suffix}, ! otherwise return \code{False}. With optional \var{start}, test beginning at that position. With optional \var{end}, stop comparing at that position. \end{methoddesc} *************** *** 684,689 **** \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 that position. With optional \var{end}, stop comparing string at that position. --- 701,706 ---- \begin{methoddesc}[string]{startswith}{prefix\optional{, start\optional{, end}}} ! Return \code{True} if string starts with the \var{prefix}, otherwise ! return \code{False}. With optional \var{start}, test string beginning at that position. With optional \var{end}, stop comparing string at that position. *************** *** 912,934 **** \lineiii{del \var{s}[\var{i}:\var{j}]} {same as \code{\var{s}[\var{i}:\var{j}] = []}}{} \lineiii{\var{s}.append(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{(1)} \lineiii{\var{s}.extend(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = \var{x}}}{(2)} \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(3)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} ! if \code{\var{i} >= 0}}{(4)} \lineiii{\var{s}.pop(\optional{\var{i}})} ! {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(5)} \lineiii{\var{s}.remove(\var{x})} ! {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(3)} \lineiii{\var{s}.reverse()} ! {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc=None}})} ! {sort the items of \var{s} in place}{(6), (7), (8), (9)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 929,955 ---- \lineiii{del \var{s}[\var{i}:\var{j}]} {same as \code{\var{s}[\var{i}:\var{j}] = []}}{} + \lineiii{\var{s}[\var{i}:\var{j}:\var{k}] = \var{t}} + {the elements of \code{\var{s}[\var{i}:\var{j}:\var{k}]} are replaced by those of \var{t}}{(1)} + \lineiii{del \var{s}[\var{i}:\var{j}:\var{k}]} + {removes the elements of \code{\var{s}[\var{i}:\var{j}:\var{k}]} from the list}{} \lineiii{\var{s}.append(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{(2)} \lineiii{\var{s}.extend(\var{x})} ! {same as \code{\var{s}[len(\var{s}):len(\var{s})] = \var{x}}}{(3)} \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} ! if \code{\var{i} >= 0}}{(5)} \lineiii{\var{s}.pop(\optional{\var{i}})} ! {same as \code{\var{x} = \var{s}[\var{i}]; del \var{s}[\var{i}]; return \var{x}}}{(6)} \lineiii{\var{s}.remove(\var{x})} ! {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(4)} \lineiii{\var{s}.reverse()} ! {reverses the items of \var{s} in place}{(7)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc=None}})} ! {sort the items of \var{s} in place}{(7), (8), (9), (10)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} *************** *** 937,940 **** --- 958,962 ---- \indexii{subscript}{assignment} \indexii{slice}{assignment} + \indexii{extended slice}{assignment} \stindex{del} \withsubitem{(list method)}{ *************** *** 945,972 **** Notes: \begin{description} ! \item[(1)] The C implementation of Python historically accepted ! multiple parameters and implicitly joined them into a tuple; ! Use of this misfeature has been deprecated since Python 1.4, ! and became an error with the introduction of Python 2.0. ! \item[(2)] Raises an exception when \var{x} is not an iterable object. ! \item[(3)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. ! \item[(4)] When a negative index is passed as the first parameter to the \method{insert()} method, the new element is prepended to the sequence. ! \item[(5)] The \method{pop()} method is only supported by the list and array types. The optional argument \var{i} defaults to \code{-1}, so that by default the last item is removed and returned. ! \item[(6)] The \method{sort()} and \method{reverse()} methods modify the list in place for economy of space when sorting or reversing a large list. To remind you that they operate by side effect, they don't return the sorted or reversed list. ! \item[(7)] The \method{sort()} method takes an optional argument specifying a comparison function of two arguments (list items) which should return a negative, zero or positive number depending on whether --- 967,999 ---- Notes: \begin{description} ! \item[(1)] \var{t} must have the same length as the slice it is ! replacing. ! \item[(2)] The C implementation of Python has historically accepted ! multiple parameters and implicitly joined them into a tuple; this ! no longer works in Python 2.0. Use of this misfeature has been ! deprecated since Python 1.4. ! \item[(3)] Raises an exception when \var{x} is not a list object. The ! \method{extend()} method is experimental and not supported by ! mutable sequence types other than lists. ! ! \item[(4)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. ! \item[(5)] When a negative index is passed as the first parameter to the \method{insert()} method, the new element is prepended to the sequence. ! \item[(6)] The \method{pop()} method is only supported by the list and array types. The optional argument \var{i} defaults to \code{-1}, so that by default the last item is removed and returned. ! \item[(7)] The \method{sort()} and \method{reverse()} methods modify the list in place for economy of space when sorting or reversing a large list. To remind you that they operate by side effect, they don't return the sorted or reversed list. ! \item[(8)] The \method{sort()} method takes an optional argument specifying a comparison function of two arguments (list items) which should return a negative, zero or positive number depending on whether *************** *** 980,984 **** \method{sort()} with no comparison function. ! \item[(8)] Whether the \method{sort()} method is stable is not defined by the language (a sort is stable if it guarantees not to change the relative order of elements that compare equal). In the C --- 1007,1011 ---- \method{sort()} with no comparison function. ! \item[(9)] Whether the \method{sort()} method is stable is not defined by the language (a sort is stable if it guarantees not to change the relative order of elements that compare equal). In the C *************** *** 988,992 **** implementations and versions must not rely on stability. ! \item[(9)] While a list is being sorted, the effect of attempting to mutate, or even inspect, the list is undefined. The C implementation of Python 2.3 makes the list appear empty for the duration, and raises --- 1015,1019 ---- implementations and versions must not rely on stability. ! \item[(10)] While a list is being sorted, the effect of attempting to mutate, or even inspect, the list is undefined. The C implementation of Python 2.3 makes the list appear empty for the duration, and raises *************** *** 1031,1035 **** \ttindex{update()} \ttindex{values()} ! \ttindex{get()}} \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} --- 1058,1068 ---- \ttindex{update()} \ttindex{values()} ! \ttindex{get()} ! \ttindex{setdefault()} ! \ttindex{pop()} ! \ttindex{popitem()} ! \ttindex{iteritems()} ! \ttindex{iterkeys)} ! \ttindex{itervalues()}} \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} *************** *** 1321,1324 **** --- 1354,1369 ---- file object, of the form \samp{<\mbox{\ldots}>}. This is a read-only attribute and may not be present on all file-like objects. + \end{memberdesc} + + \begin{memberdesc}[file]{newlines} + If Python was built with the \code{--with-universal-newlines} option + (the default) this read-only attribute exists, and for files opened in + universal newline read mode it keeps track of the types of newlines + encountered while reading the file. The values it can take are + \code{'\e r'}, \code{'\e n'}, \code{'\e r\e n'}, \code{None} (unknown, + no newlines read yet) or a tuple containing all the newline + types seen, to indicate that multiple + newline conventions were encountered. For files not opened in universal + newline read mode the value of this attribute will be \code{None}. \end{memberdesc} From jackjansen@users.sourceforge.net Wed Mar 5 14:42:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 05 Mar 2003 06:42:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv4960 Modified Files: bundlebuilder.py Log Message: Moved some application-bundle specific code from the BundleBuilder class to AppBuilder, and set the default type to BNDL (overridden in AppBuilder). This surfaced when trying to build help bundles. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** bundlebuilder.py 26 Feb 2003 11:27:56 -0000 1.18 --- bundlebuilder.py 5 Mar 2003 14:42:18 -0000 1.19 *************** *** 84,88 **** # The type of the bundle. ! type = "APPL" # The creator code of the bundle. creator = None --- 84,88 ---- # The type of the bundle. ! type = "BNDL" # The creator code of the bundle. creator = None *************** *** 98,104 **** builddir = "build" - # platform, name of the subfolder of Contents that contains the executable. - platform = "MacOS" - # Make symlinks instead copying files. This is handy during debugging, but # makes the bundle non-distributable. --- 98,101 ---- *************** *** 116,120 **** # misc (derived) attributes self.bundlepath = pathjoin(self.builddir, self.name + bundleextension) - self.execdir = pathjoin("Contents", self.platform) plist = self.plist --- 113,116 ---- *************** *** 295,298 **** --- 291,300 ---- class AppBuilder(BundleBuilder): + # Override type of the bundle. + type = "BNDL" + + # platform, name of the subfolder of Contents that contains the executable. + platform = "MacOS" + # A Python main program. If this argument is given, the main # executable in the bundle will be a small wrapper that invokes *************** *** 355,358 **** --- 357,362 ---- raise BundleBuilderError, ("must specify either or both of " "'executable' and 'mainprogram'") + + self.execdir = pathjoin("Contents", self.platform) if self.name is not None: From jackjansen@users.sourceforge.net Wed Mar 5 14:44:57 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 05 Mar 2003 06:44:57 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv6590 Modified Files: bundlebuilder.py Log Message: Actually *do* override the type in AppBuilder. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** bundlebuilder.py 5 Mar 2003 14:42:18 -0000 1.19 --- bundlebuilder.py 5 Mar 2003 14:44:54 -0000 1.20 *************** *** 292,296 **** # Override type of the bundle. ! type = "BNDL" # platform, name of the subfolder of Contents that contains the executable. --- 292,296 ---- # Override type of the bundle. ! type = "APPL" # platform, name of the subfolder of Contents that contains the executable. From loewis@users.sourceforge.net Wed Mar 5 15:14:14 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 05 Mar 2003 07:14:14 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18533/Lib/test Modified Files: test_support.py Log Message: Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize, and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_support.py 3 Feb 2003 15:19:30 -0000 1.48 --- test_support.py 5 Mar 2003 15:13:40 -0000 1.49 *************** *** 110,115 **** else: TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. ! if os.name=="nt": ! TESTFN_ENCODING="mbcs" else: TESTFN = 'test' --- 110,114 ---- else: TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. ! TESTFN_ENCODING=sys.getfilesystemencoding() else: TESTFN = 'test' From loewis@users.sourceforge.net Wed Mar 5 15:14:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 05 Mar 2003 07:14:13 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18533/Doc/lib Modified Files: libsys.tex Log Message: Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize, and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** libsys.tex 1 Mar 2003 03:20:38 -0000 1.62 --- libsys.tex 5 Mar 2003 15:13:38 -0000 1.63 *************** *** 212,215 **** --- 212,231 ---- \end{funcdesc} + \begin{funcdesc}{getfilesystemencoding}{} + Return the name of the encoding used to convert Unicode filenames + into system file names, or \code{None} if the system default encoding + is used. The result value depends on the operating system: + \begin{itemize} + \item On Windows 9x, the encoding is ``mbcs''. + \item On Mac OS X, the encoding is ``utf-8''. + \item On Unix, the encoding is the user's preference + according to the result of nl_langinfo(CODESET), or None if + the nl_langinfo(CODESET) failed. + \item On Windows NT+, file names are Unicode natively, so no conversion + is performed. + \end{itemize} + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{getrefcount}{object} Return the reference count of the \var{object}. The count returned From loewis@users.sourceforge.net Wed Mar 5 15:14:16 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 05 Mar 2003 07:14:16 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.688,1.689 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18533/Misc Modified Files: NEWS Log Message: Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize, and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.688 retrieving revision 1.689 diff -C2 -d -r1.688 -r1.689 *** NEWS 3 Mar 2003 21:16:38 -0000 1.688 --- NEWS 5 Mar 2003 15:13:42 -0000 1.689 *************** *** 13,16 **** --- 13,18 ---- ----------------- + - sys.getfilesystemencoding() was added to expose + Py_FileSystemDefaultEncoding. - New function sys.exc_clear() clears the current exception. This is From loewis@users.sourceforge.net Wed Mar 5 15:14:18 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 05 Mar 2003 07:14:18 -0800 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18533/Modules Modified Files: _localemodule.c Log Message: Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize, and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** _localemodule.c 21 Dec 2002 18:34:06 -0000 2.38 --- _localemodule.c 5 Mar 2003 15:13:45 -0000 2.39 *************** *** 162,169 **** } - #if defined(HAVE_LANGINFO_H) && defined(CODESET) - static int fileencoding_uses_locale = 0; - #endif - static PyObject* PyLocale_setlocale(PyObject* self, PyObject* args) --- 162,165 ---- *************** *** 214,233 **** /* things that got wrong up to here are ignored */ PyErr_Clear(); - #if defined(HAVE_LANGINFO_H) && defined(CODESET) - if (Py_FileSystemDefaultEncoding == NULL) - fileencoding_uses_locale = 1; - if (fileencoding_uses_locale) { - char *codeset = nl_langinfo(CODESET); - PyObject *enc = NULL; - if (*codeset && (enc = PyCodec_Encoder(codeset))) { - /* Release previous file encoding */ - if (Py_FileSystemDefaultEncoding) - free((char *)Py_FileSystemDefaultEncoding); - Py_FileSystemDefaultEncoding = strdup(codeset); - Py_DECREF(enc); - } else - PyErr_Clear(); - } - #endif } else { /* get locale */ --- 210,213 ---- From loewis@users.sourceforge.net Wed Mar 5 15:14:21 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 05 Mar 2003 07:14:21 -0800 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.179,2.180 sysmodule.c,2.115,2.116 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv18533/Python Modified Files: pythonrun.c sysmodule.c Log Message: Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize, and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding. Adjust test case. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.179 retrieving revision 2.180 diff -C2 -d -r2.179 -r2.180 *** pythonrun.c 25 Feb 2003 20:25:12 -0000 2.179 --- pythonrun.c 5 Mar 2003 15:13:46 -0000 2.180 *************** *** 18,21 **** --- 18,26 ---- #endif + #ifdef HAVE_LANGINFO_H + #include + #include + #endif + #ifdef MS_WINDOWS #undef BYTE *************** *** 182,185 **** --- 187,213 ---- PyModule_WarningsModule = PyImport_ImportModule("warnings"); + + #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) + /* On Unix, set the file system encoding according to the + user's preference, if the CODESET names a well-known + Python codec, and Py_FileSystemDefaultEncoding isn't + initialized by other means. */ + if (!Py_FileSystemDefaultEncoding) { + char *saved_locale = setlocale(LC_CTYPE, NULL); + char *codeset; + setlocale(LC_CTYPE, ""); + codeset = nl_langinfo(CODESET); + PyObject *enc = NULL; + if (*codeset) { + enc = PyCodec_Encoder(codeset); + if (enc) { + Py_FileSystemDefaultEncoding = strdup(codeset); + Py_DECREF(enc); + } else + PyErr_Clear(); + } + setlocale(LC_CTYPE, saved_locale); + } + #endif } Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.115 retrieving revision 2.116 diff -C2 -d -r2.115 -r2.116 *** sysmodule.c 1 Mar 2003 03:20:41 -0000 2.115 --- sysmodule.c 5 Mar 2003 15:13:47 -0000 2.116 *************** *** 237,240 **** --- 237,256 ---- ); + static PyObject * + sys_getfilesystemencoding(PyObject *self) + { + if (Py_FileSystemDefaultEncoding) + return PyString_FromString(Py_FileSystemDefaultEncoding); + Py_INCREF(Py_None); + return Py_None; + } + + PyDoc_STRVAR(getfilesystemencoding_doc, + "getfilesystemencoding() -> string\n\ + \n\ + Return the encoding used to convert Unicode filenames in\n\ + operating system filenames." + ); + #endif *************** *** 649,652 **** --- 665,672 ---- #ifdef DYNAMIC_EXECUTION_PROFILE {"getdxp", _Py_GetDXProfile, METH_VARARGS}, + #endif + #ifdef Py_USING_UNICODE + {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, + METH_NOARGS, getfilesystemencoding_doc}, #endif #ifdef Py_TRACE_REFS From jvr@users.sourceforge.net Wed Mar 5 15:46:59 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Wed, 05 Mar 2003 07:46:59 -0800 Subject: [Python-checkins] python/dist/src/Modules main.c,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv685/Modules Modified Files: main.c Log Message: removing one Mac hack and add another: - The applet logic has been replaced to bundlebuilder's bootstrap script - Due to Apple being extremely string about argv[0], we need a way to specify the actual executable name for use with sys.executable. See the comment embedded in the code. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** main.c 5 Mar 2003 14:15:19 -0000 1.73 --- main.c 5 Mar 2003 15:46:54 -0000 1.74 *************** *** 13,20 **** #endif - #if defined(WITH_NEXT_FRAMEWORK) - #include "pymactoolbox.h" - #endif - #if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS) #define PYTHONHOMEHELP "\\lib" --- 13,16 ---- *************** *** 155,179 **** PySys_ResetWarnOptions(); - #if defined(WITH_NEXT_FRAMEWORK) - /* If we are running from a framework it could be that we are actually - ** the main program for an applet. If so, the next call will return the - ** filename that we are supposed to run. - */ - filename = PyMac_GetAppletScriptFile(); - if (filename != NULL) { - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "%s: can't open file '%s'\n", - argv[0], filename); - #if defined(__VMS) - /* STS$M_INHIB_MSG + SS$_ABORT */ - exit(0x1000002c); - #else - exit(2); - #endif - } - } - /* Skip option-processing if we are an applet */ - if (filename == NULL) - #endif while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { if (c == 'c') { --- 151,154 ---- *************** *** 302,306 **** unbuffered = 1; ! if (command == NULL && filename == NULL && _PyOS_optind < argc && strcmp(argv[_PyOS_optind], "-") != 0) { --- 277,281 ---- unbuffered = 1; ! if (command == NULL && _PyOS_optind < argc && strcmp(argv[_PyOS_optind], "-") != 0) { *************** *** 376,379 **** --- 351,369 ---- #endif /* __VMS */ + #ifdef __APPLE__ + /* On MacOS X, when the Python interpreter is embedded in an + application bundle, it gets executed by a bootstrapping script + that does os.execve() with an argv[0] that's different from the + actual Python executable. This is needed to keep the Finder happy, + or rather, to work around Apple's overly strict requirements of + the process name. However, we still need a usable sys.executable, + so the actual executable path is passed in an environment variable. + See Lib/plat-mac/bundlebuiler.py for details about the bootstrap + script. */ + if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') + Py_SetProgramName(p); + else + Py_SetProgramName(argv[0]); + #else Py_SetProgramName(argv[0]); Py_Initialize(); From jackjansen@users.sourceforge.net Wed Mar 5 16:00:20 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 05 Mar 2003 08:00:20 -0800 Subject: [Python-checkins] python/dist/src/Modules main.c,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7785/Modules Modified Files: main.c Log Message: An #endif was missing in Just's patch. Added. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** main.c 5 Mar 2003 15:46:54 -0000 1.74 --- main.c 5 Mar 2003 16:00:15 -0000 1.75 *************** *** 367,370 **** --- 367,371 ---- #else Py_SetProgramName(argv[0]); + #endif Py_Initialize(); From jackjansen@users.sourceforge.net Wed Mar 5 16:13:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 05 Mar 2003 08:13:23 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app Info.plist,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app In directory sc8-pr-cvs1:/tmp/cvs-serv12325 Modified Files: Info.plist Log Message: Fix for bug #697546: don't auto-register the Python documentation by putting the help book in an array. Somehow the fact that Python.app (and, hence, pythonw) got an automatic help menu messed up Tkinter's handling of the help menu. Index: Info.plist =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Info.plist,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Info.plist 28 Aug 2002 21:27:02 -0000 1.8 --- Info.plist 5 Mar 2003 16:13:19 -0000 1.9 *************** *** 31,35 **** CFBundleHelpBookFolder ! Documentation CFBundleHelpBookName Python Help --- 31,37 ---- CFBundleHelpBookFolder ! ! Documentation ! CFBundleHelpBookName Python Help From jvr@users.sourceforge.net Wed Mar 5 17:23:52 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Wed, 05 Mar 2003 09:23:52 -0800 Subject: [Python-checkins] python/dist/src/Lib modulefinder.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19025/Lib Modified Files: modulefinder.py Log Message: Patch #698082 from Thomas Heller: Modulefinder didn't exclude modules in packages correctly. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/modulefinder.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** modulefinder.py 27 Feb 2003 20:14:35 -0000 1.5 --- modulefinder.py 5 Mar 2003 17:23:48 -0000 1.6 *************** *** 243,247 **** try: fp, pathname, stuff = self.find_module(partname, ! parent and parent.__path__) except ImportError: self.msgout(3, "import_module ->", None) --- 243,247 ---- try: fp, pathname, stuff = self.find_module(partname, ! parent and parent.__path__, parent) except ImportError: self.msgout(3, "import_module ->", None) *************** *** 386,392 **** return m ! def find_module(self, name, path): ! if path: ! fullname = '.'.join(path)+'.'+name else: fullname = name --- 386,392 ---- return m ! def find_module(self, name, path, parent=None): ! if parent is not None: ! fullname = parent.__name__+'.'+name else: fullname = name From fdrake@users.sourceforge.net Wed Mar 5 17:31:26 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 05 Mar 2003 09:31:26 -0800 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.180,2.181 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22516/Python Modified Files: pythonrun.c Log Message: Declare all variables at the start of their scope. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.180 retrieving revision 2.181 diff -C2 -d -r2.180 -r2.181 *** pythonrun.c 5 Mar 2003 15:13:46 -0000 2.180 --- pythonrun.c 5 Mar 2003 17:31:21 -0000 2.181 *************** *** 196,202 **** char *saved_locale = setlocale(LC_CTYPE, NULL); char *codeset; setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); - PyObject *enc = NULL; if (*codeset) { enc = PyCodec_Encoder(codeset); --- 196,202 ---- char *saved_locale = setlocale(LC_CTYPE, NULL); char *codeset; + PyObject *enc = NULL; setlocale(LC_CTYPE, ""); codeset = nl_langinfo(CODESET); if (*codeset) { enc = PyCodec_Encoder(codeset); From jackjansen@users.sourceforge.net Wed Mar 5 21:16:13 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 05 Mar 2003 13:16:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv22404 Modified Files: aetools.py Log Message: Two ancient and obscure bugs found and fixed by Donovan Preston (these could be responsible for various unexplained problems with Python/OSA interaction over the years): - Enum values were passed as their string counterparts. Most applications don't seem to mind this, but some do (InDesign). - Attributes have never worked (!), as they were incorrectly passed as parameters. Apparently nobody uses them much:-) Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** aetools.py 26 Feb 2003 15:28:17 -0000 1.2 --- aetools.py 5 Mar 2003 21:16:06 -0000 1.3 *************** *** 93,97 **** packkey(ae, key, value) for key, value in attributes.items(): ! packkey(ae, key, value) # --- 93,97 ---- packkey(ae, key, value) for key, value in attributes.items(): ! ae.AEPutAttributeDesc(key, pack(value)) # *************** *** 117,121 **** ok = edict.values() if edict.has_key(v): ! arguments[key] = edict[v] elif not v in ok: raise TypeError, 'Unknown enumerator: %s'%v --- 117,121 ---- ok = edict.values() if edict.has_key(v): ! arguments[key] = Enum(edict[v]) elif not v in ok: raise TypeError, 'Unknown enumerator: %s'%v From gvanrossum@users.sourceforge.net Wed Mar 5 23:32:02 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 05 Mar 2003 15:32:02 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18995 Added Files: timeit.py Log Message: A flexible utility to time the execution speed of a code snippet. Usable from the command line or from a program. --- NEW FILE: timeit.py --- """Framework for timing execution speed of small code snippets. This avoids a number of common traps for timing frameworks (see also Tim Peters' introduction to the timing chapter in the Python Cookbook). (To use this with older versions of Python, the dependency on the itertools module is easily removed; instead of itertools.repeat(None, count) you can use [None]*count; this is barely slower.) Command line usage: python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [statement] Options: -n/--number N: how many times to execute 'statement' (default varies) -r/--repeat N: how many times to repeat the timer (default 1) -s/--setup S: statements executed once before 'statement' (default 'pass') -t/--time: use time.time() (default on Unix) -c/--clock: use time.clock() (default on Windows) statement: statement to be timed (default 'pass') """ import sys import math import time import itertools __all__ = ["Timer"] default_number = 1000000 default_repeat = 10 if sys.platform == "win32": # On Windows, the best timer is time.clock() default_timer = time.clock else: # On most other platforms the best timer is time.time() default_timer = time.time template = """ def inner(number, timer): %(setup)s seq = itertools.repeat(None, number) t0 = timer() for i in seq: %(stmt)s t1 = timer() return t1-t0 """ def reindent(src, indent): return ("\n" + " "*indent).join(src.split("\n")) class Timer: def __init__(self, stmt="pass", setup="pass", timer=default_timer): self.timer = timer stmt = reindent(stmt, 8) setup = reindent(setup, 4) src = template % {'stmt': stmt, 'setup': setup} code = compile(src, "", "exec") ns = {} exec code in globals(), ns self.inner = ns["inner"] def timeit(self, number=default_number): return self.inner(number, self.timer) def repeat(self, repeat=default_repeat, number=default_number): r = [] for i in range(repeat): t = self.timeit(number) r.append(t) return r def main(args=None): if args is None: args = sys.argv[1:] import getopt try: opts, args = getopt.getopt(args, "n:s:r:tc", ["number=", "setup=", "repeat=", "time", "clock"]) except getopt.error, err: print err return 2 timer = default_timer stmt = "\n".join(args) or "pass" number = 0 # auto-determine setup = "pass" repeat = 1 for o, a in opts: if o in ("-n", "--number"): number = int(a) if o in ("-s", "--setup"): setup = a if o in ("-r", "--repeat"): repeat = int(a) if repeat <= 0: repeat = 1 if o in ("-t", "time"): timer = time.time if o in ("-c", "clock"): timer = time.clock t = Timer(stmt, setup, timer) if number == 0: # determine number so that 0.2 <= total time < 2.0 for i in range(1, 10): number = 10**i x = t.timeit(number) if x >= 0.2: break r = t.repeat(repeat, number) best = min(r) print "%d loops," % number, usec = best * 1e6 / number if repeat > 1: print "best of %d: %.3f usec" % (repeat, usec) else: print "time: %.3f usec" % usec if __name__ == "__main__": sys.exit(main()) From gvanrossum@users.sourceforge.net Thu Mar 6 01:56:16 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 05 Mar 2003 17:56:16 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.689,1.690 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1532 Modified Files: NEWS Log Message: Mention timeit.py. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.689 retrieving revision 1.690 diff -C2 -d -r1.689 -r1.690 *** NEWS 5 Mar 2003 15:13:42 -0000 1.689 --- NEWS 6 Mar 2003 01:56:12 -0000 1.690 *************** *** 41,44 **** --- 41,47 ---- ------- + - New module timeit provides a simple framework for timing the + execution speed of expressions and statements. + - sets.Set objects now support mixed-type __eq__ and __ne__, instead of raising TypeError. If x is a Set object and y is a non-Set object, From gvanrossum@users.sourceforge.net Thu Mar 6 02:32:21 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 05 Mar 2003 18:32:21 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12260 Modified Files: timeit.py Log Message: Added more documentation. Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timeit.py 5 Mar 2003 23:31:58 -0000 1.1 --- timeit.py 6 Mar 2003 02:32:19 -0000 1.2 *************** *** 1,17 **** ! """Framework for timing execution speed of small code snippets. ! This avoids a number of common traps for timing frameworks (see also ! Tim Peters' introduction to the timing chapter in the Python ! Cookbook). ! (To use this with older versions of Python, the dependency on the ! itertools module is easily removed; instead of itertools.repeat(None, ! count) you can use [None]*count; this is barely slower.) Command line usage: ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [statement] Options: ! -n/--number N: how many times to execute 'statement' (default varies) -r/--repeat N: how many times to repeat the timer (default 1) -s/--setup S: statements executed once before 'statement' (default 'pass') --- 1,15 ---- ! """Framework for measuring execution time for small code snippets. ! This module avoids a number of common traps for measuring execution ! times. See also Tim Peters' introduction to the Algorithms chapter in ! the Python Cookbook, published by O'Reilly. ! Library usage: see the Timer class. Command line usage: ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [statement] Options: ! -n/--number N: how many times to execute 'statement' (default: see below) -r/--repeat N: how many times to repeat the timer (default 1) -s/--setup S: statements executed once before 'statement' (default 'pass') *************** *** 19,24 **** --- 17,43 ---- -c/--clock: use time.clock() (default on Windows) statement: statement to be timed (default 'pass') + + A multi-line statement may be given by specifying each line as a + separate argument; indented lines are possible by enclosing an + argument in quotes and using leading spaces. + + If -n is not given, a suitable number of loops is calculated by trying + successive powers of 10 until the total time is at least 0.2 seconds. + + The difference in default timer function is because on Windows, + clock() has microsecond granularity but time()'s granularity is 1/60th + of a second; on Unix, clock() has 1/100th of a second granularity and + time() is much more precise. On either platform, the default timer + functions measures wall clock time, not the CPU time. This means that + other processes running on the same computer may interfere with the + timing. The best thing to do when accurate timing is necessary is to + repeat the timing a few times and use the best time; the -r option is + good for this. On Unix, you can use clock() to measure CPU time. """ + # To use this module with older versions of Python, the dependency on + # the itertools module is easily removed; in the template, instead of + # itertools.repeat(None, count), use [None]*count. It's barely slower. + import sys import math *************** *** 38,41 **** --- 57,63 ---- default_timer = time.time + # Don't change the indentation of the template; the reindent() calls + # in Timer.__init__() depend on setup being indented 4 spaces and stmt + # being indented 8 spaces. template = """ def inner(number, timer): *************** *** 50,58 **** --- 72,96 ---- def reindent(src, indent): + """Helper to reindent a multi-line statement.""" return ("\n" + " "*indent).join(src.split("\n")) class Timer: + """Class for timing execution speed of small code snippets. + + The constructor takes a statement to be timed, an additional + statement used for setup, and a timer function. Both statements + default to 'pass'; the timer function is platform-dependent (see + module doc string). + + To measure the execution time of the first statement, use the + timeit() method. The repeat() method is a convenience to call + timeit() multiple times and return a list of results. + + The statements may contain newlines, as long as they don't contain + multi-line string literals. + """ def __init__(self, stmt="pass", setup="pass", timer=default_timer): + """Constructor. See class doc string.""" self.timer = timer stmt = reindent(stmt, 8) *************** *** 65,71 **** --- 103,126 ---- def timeit(self, number=default_number): + """Time 'number' executions of the main statement. + + To be precise, this executes the setup statement once, and + then returns the time it takes to execute the main statement + a number of times, as a float measured in seconds. The + argument is the number of times through the loop, defaulting + to one million. The main statement, the setup statement and + the timer function to be used are passed to the constructor. + """ return self.inner(number, self.timer) def repeat(self, repeat=default_repeat, number=default_number): + """Call timer() a few times. + + This is a convenience function that calls the timer() + repeatedly, returning a list of results. The first argument + specifies how many times to call timer(), defaulting to 10; + the second argument specifies the timer argument, defaulting + to one million. + """ r = [] for i in range(repeat): *************** *** 75,78 **** --- 130,141 ---- def main(args=None): + """Main program, used when run as a script. + + The optional argument specifies the command line to be parsed, + defaulting to sys.argv[1:]. + + The return value is an exit code to be passed to sys.exit(); it + may be None to indicate success. + """ if args is None: args = sys.argv[1:] *************** *** 119,122 **** --- 182,186 ---- else: print "time: %.3f usec" % usec + return None if __name__ == "__main__": From gvanrossum@users.sourceforge.net Thu Mar 6 03:02:14 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 05 Mar 2003 19:02:14 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20902 Modified Files: timeit.py Log Message: Add notes about baseline overhead, and about different Python versions. Add -h/--help option to print doc string. Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timeit.py 6 Mar 2003 02:32:19 -0000 1.2 --- timeit.py 6 Mar 2003 03:02:10 -0000 1.3 *************** *** 8,12 **** Command line usage: ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [statement] Options: --- 8,12 ---- Command line usage: ! python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement] Options: *************** *** 16,19 **** --- 16,20 ---- -t/--time: use time.time() (default on Unix) -c/--clock: use time.clock() (default on Windows) + -h/--help: print this usage message and exit statement: statement to be timed (default 'pass') *************** *** 34,42 **** repeat the timing a few times and use the best time; the -r option is good for this. On Unix, you can use clock() to measure CPU time. """ # To use this module with older versions of Python, the dependency on # the itertools module is easily removed; in the template, instead of ! # itertools.repeat(None, count), use [None]*count. It's barely slower. import sys --- 35,54 ---- repeat the timing a few times and use the best time; the -r option is good for this. On Unix, you can use clock() to measure CPU time. + + Note: there is a certain baseline overhead associated with executing a + pass statement. The code here doesn't try to hide it, but you should + be aware of it (especially when comparing different versions of + Python). The baseline overhead is measured by invoking the program + without arguments. """ # To use this module with older versions of Python, the dependency on # the itertools module is easily removed; in the template, instead of ! # itertools.repeat(None, number), use [None]*number. It's barely ! # slower. Note: the baseline overhead, measured by the default ! # invocation, differs for older Python versions! Also, to fairly ! # compare older Python versions to Python 2.3, you may want to use ! # python -O for the older versions to avoid timing SET_LINENO ! # instructions. import sys *************** *** 142,150 **** import getopt try: ! opts, args = getopt.getopt(args, "n:s:r:tc", ["number=", "setup=", "repeat=", ! "time", "clock"]) except getopt.error, err: print err return 2 timer = default_timer --- 154,163 ---- import getopt try: ! opts, args = getopt.getopt(args, "n:s:r:tch", ["number=", "setup=", "repeat=", ! "time", "clock", "help"]) except getopt.error, err: print err + print "use -h/--help for command line help" return 2 timer = default_timer *************** *** 162,169 **** if repeat <= 0: repeat = 1 ! if o in ("-t", "time"): timer = time.time ! if o in ("-c", "clock"): timer = time.clock t = Timer(stmt, setup, timer) if number == 0: --- 175,185 ---- if repeat <= 0: repeat = 1 ! if o in ("-t", "--time"): timer = time.time ! if o in ("-c", "--clock"): timer = time.clock + if o in ("-h", "--help"): + print __doc__, + return 0 t = Timer(stmt, setup, timer) if number == 0: From bwarsaw@users.sourceforge.net Thu Mar 6 05:14:22 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:14:22 -0800 Subject: [Python-checkins] python/dist/src/Lib/email quopriMIME.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv31474 Modified Files: quopriMIME.py Log Message: Merge of the folding-reimpl-branch. Specific changes, _max_append(): Change the comparison so that the new string is concatenated if it's less than or equal to the max length. header_encode(): Allow for maxlinelen == None to mean, don't do any line splitting. This is because this module is mostly used by higher level abstractions (Header.py) which already ensures line lengths. We do this in a cheapo way by setting the max_encoding to some insanely <100k wink> large number. Index: quopriMIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** quopriMIME.py 28 Sep 2002 21:02:51 -0000 1.4 --- quopriMIME.py 6 Mar 2003 05:14:20 -0000 1.5 *************** *** 83,87 **** if not L: L.append(s.lstrip()) ! elif len(L[-1]) + len(s) < maxlen: L[-1] += extra + s else: --- 83,87 ---- if not L: L.append(s.lstrip()) ! elif len(L[-1]) + len(s) <= maxlen: L[-1] += extra + s else: *************** *** 117,121 **** with each line wrapped safely at, at most, maxlinelen characters (defaults ! to 76 characters). End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted --- 117,122 ---- with each line wrapped safely at, at most, maxlinelen characters (defaults ! to 76 characters). If maxlinelen is None, the entire string is encoded in ! one chunk with no splitting. End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted *************** *** 135,141 **** # Quopri encode each line, in encoded chunks no greater than maxlinelen in ! # lenght, after the RFC chrome is added in. quoted = [] ! max_encoded = maxlinelen - len(charset) - MISC_LEN for c in header: --- 136,146 ---- # Quopri encode each line, in encoded chunks no greater than maxlinelen in ! # length, after the RFC chrome is added in. quoted = [] ! if maxlinelen is None: ! # An obnoxiously large number that's good enough ! max_encoded = 100000 ! else: ! max_encoded = maxlinelen - len(charset) - MISC_LEN - 1 for c in header: From bwarsaw@users.sourceforge.net Thu Mar 6 05:16:31 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:16:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Charset.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv31943 Modified Files: Charset.py Log Message: Merge of the folding-reimpl-branch. Specific changes, Charset: Alias __repr__ to __str__ for debugging. header_encode(): When calling quopriMIME.header_encode(), set maxlinelen=None so that the lower level function doesn't (also) try to wrap/fold the line. Index: Charset.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Charset.py 7 Jan 2003 00:29:07 -0000 1.12 --- Charset.py 6 Mar 2003 05:16:29 -0000 1.13 *************** *** 235,238 **** --- 235,240 ---- return self.input_charset.lower() + __repr__ = __str__ + def __eq__(self, other): return str(self) == str(other).lower() *************** *** 359,363 **** return email.base64MIME.header_encode(s, cset) elif self.header_encoding == QP: ! return email.quopriMIME.header_encode(s, cset) elif self.header_encoding == SHORTEST: lenb64 = email.base64MIME.base64_len(s) --- 361,365 ---- return email.base64MIME.header_encode(s, cset) elif self.header_encoding == QP: ! return email.quopriMIME.header_encode(s, cset, maxlinelen=None) elif self.header_encoding == SHORTEST: lenb64 = email.base64MIME.base64_len(s) *************** *** 366,370 **** return email.base64MIME.header_encode(s, cset) else: ! return email.quopriMIME.header_encode(s, cset) else: return s --- 368,372 ---- return email.base64MIME.header_encode(s, cset) else: ! return email.quopriMIME.header_encode(s, cset, maxlinelen=None) else: return s From bwarsaw@users.sourceforge.net Thu Mar 6 05:22:05 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:22:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv933 Modified Files: Generator.py Log Message: Merge of the folding-reimpl-branch. Specific changes, _handle_multipart(): Ensure that if the preamble exists but does not end in a newline, a newline is still added. Without this, the boundary separator will end up on the preamble line, breaking the MIME structure. _make_boundary(): Handle differences in the decimal point character based on the locale. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Generator.py 14 Oct 2002 15:09:30 -0000 1.17 --- Generator.py 6 Mar 2003 05:22:02 -0000 1.18 *************** *** 5,10 **** """ - import time import re import random --- 5,11 ---- """ import re + import time + import locale import random *************** *** 13,16 **** --- 14,18 ---- from email.Header import Header + from email.Parser import NLCRE try: *************** *** 259,262 **** --- 261,272 ---- if msg.preamble is not None: self._fp.write(msg.preamble) + # If preamble is the empty string, the length of the split will be + # 1, but the last element will be the empty string. If it's + # anything else but does not end in a line separator, the length + # will be > 1 and not end in an empty string. We need to + # guarantee a newline after the preamble, but don't add too many. + plines = NLCRE.split(msg.preamble) + if plines <> [''] and plines[-1] <> '': + self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. *************** *** 365,369 **** # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! boundary = ('=' * 15) + repr(random.random()).split('.')[1] + '==' if text is None: return boundary --- 375,380 ---- # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! dp = locale.localeconv().get('decimal_point', '.') ! boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '==' if text is None: return boundary From bwarsaw@users.sourceforge.net Thu Mar 6 05:25:04 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:25:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/email base64MIME.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1659 Modified Files: base64MIME.py Log Message: Merge of the folding-reimpl-branch. Specific changes, Remove a senseless comment. Index: base64MIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/base64MIME.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** base64MIME.py 28 Sep 2002 20:59:12 -0000 1.5 --- base64MIME.py 6 Mar 2003 05:25:00 -0000 1.6 *************** *** 103,109 **** max_unencoded = _floordiv(max_encoded * 3, 4) - # BAW: Ben's original code used a step of max_unencoded, but I think it - # ought to be max_encoded. Otherwise, where's max_encoded used? I'm - # still not sure what the for i in range(0, len(header), max_unencoded): base64ed.append(b2a_base64(header[i:i+max_unencoded])) --- 103,106 ---- From bwarsaw@users.sourceforge.net Thu Mar 6 05:25:37 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:25:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1848 Modified Files: Parser.py Log Message: Merge of the folding-reimpl-branch. Specific changes, Rename a constant. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Parser.py 5 Nov 2002 21:44:06 -0000 1.19 --- Parser.py 6 Mar 2003 05:25:35 -0000 1.20 *************** *** 21,25 **** False = 0 ! nlcre = re.compile('\r\n|\r|\n') --- 21,25 ---- False = 0 ! NLCRE = re.compile('\r\n|\r|\n') *************** *** 177,181 **** # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = nlcre.search(payload, start) if mo: start += len(mo.group(0)) --- 177,181 ---- # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = NLCRE.search(payload, start) if mo: start += len(mo.group(0)) From bwarsaw@users.sourceforge.net Thu Mar 6 05:39:48 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:39:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv5699 Modified Files: Header.py Log Message: Merge of the folding-reimpl-branch. Specific changes, _split(): New implementation of ASCII line splitting which should do a better job and not be subject to the various weird artifacts (bugs) reported. This should also do a better job of higher-level syntactic splits by trying first to split on semis, then commas, then whitespace. Use a Timbot-ly binary search for optimal non-ASCII split points for better packing of header lines. This also lets us remove one recursion call. Don't pass in firstline, but instead pass in the actual line length we're shooting for. Also pass in the list of split characters. encode(): Pass in the list of split characters so applications can have some control over what "higher level syntactic breaks" are. Also, decode_header(): Transform binascii.Errors which can occur when decoding a base64 RFC 2047 header with bogus data, into an email.Errors.HeaderParseError. Closes SF bug #696712. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Header.py 30 Dec 2002 19:13:00 -0000 1.17 --- Header.py 6 Mar 2003 05:39:46 -0000 1.18 *************** *** 5,12 **** --- 5,14 ---- import re + import binascii from types import StringType, UnicodeType import email.quopriMIME import email.base64MIME + from email.Errors import HeaderParseError from email.Charset import Charset *************** *** 26,29 **** --- 28,32 ---- CRLF = '\r\n' NL = '\n' + SPACE = ' ' SPACE8 = ' ' * 8 EMPTYSTRING = '' *************** *** 48,51 **** --- 51,61 ---- ''', re.VERBOSE | re.IGNORECASE) + pcre = re.compile('([,;])') + + # Field name regexp, including trailing colon, but not separating whitespace, + # according to RFC 2822. Character range is from tilde to exclamation mark. + # For use with .match() + fcre = re.compile(r'[\041-\176]+:$') + *************** *** 62,65 **** --- 72,78 ---- header, otherwise a lower-case string containing the name of the character set specified in the encoded string. + + An email.Errors.HeaderParseError may be raised when certain decoding error + occurs (e.g. a base64 decoding exception). """ # If no encoding, just return the header *************** *** 86,95 **** charset, encoding = [s.lower() for s in parts[0:2]] encoded = parts[2] ! dec = '' if encoding == 'q': dec = email.quopriMIME.header_decode(encoded) elif encoding == 'b': ! dec = email.base64MIME.decode(encoded) ! else: dec = encoded --- 99,114 ---- charset, encoding = [s.lower() for s in parts[0:2]] encoded = parts[2] ! dec = None if encoding == 'q': dec = email.quopriMIME.header_decode(encoded) elif encoding == 'b': ! try: ! dec = email.base64MIME.decode(encoded) ! except binascii.Error: ! # Turn this into a higher level exception. BAW: Right ! # now we throw the lower level exception away but ! # when/if we get exception chaining, we'll preserve it. ! raise HeaderParseError ! if dec is None: dec = encoded *************** *** 127,131 **** class Header: ! def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' ', errors='strict'): """Create a MIME-compliant header that can contain many character sets. --- 146,151 ---- class Header: ! def __init__(self, s=None, charset=None, ! maxlinelen=None, header_name=None, continuation_ws=' ', errors='strict'): """Create a MIME-compliant header that can contain many character sets. *************** *** 254,264 **** self._chunks.append((s, charset)) ! def _split(self, s, charset, firstline=False): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) ! encoded = charset.from_splittable(splittable) elen = charset.encoded_header_len(encoded) ! ! if elen <= self._maxlinelen: return [(encoded, charset)] # If we have undetermined raw 8bit characters sitting in a byte --- 274,284 ---- self._chunks.append((s, charset)) ! def _split(self, s, charset, maxlinelen, splitchars): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) ! encoded = charset.from_splittable(splittable, True) elen = charset.encoded_header_len(encoded) ! # If the line's encoded length first, just return it ! if elen <= maxlinelen: return [(encoded, charset)] # If we have undetermined raw 8bit characters sitting in a byte *************** *** 268,272 **** # be to not split the header at all, but that means they could go out # longer than maxlinelen. ! elif charset == '8bit': return [(s, charset)] # BAW: I'm not sure what the right test here is. What we're trying to --- 288,292 ---- # be to not split the header at all, but that means they could go out # longer than maxlinelen. ! if charset == '8bit': return [(s, charset)] # BAW: I'm not sure what the right test here is. What we're trying to *************** *** 281,377 **** # although it's possible that other charsets may also benefit from the # higher-level syntactic breaks. - # elif charset == 'us-ascii': ! return self._ascii_split(s, charset, firstline) # BAW: should we use encoded? elif elen == len(s): # We can split on _maxlinelen boundaries because we know that the # encoding won't change the size of the string ! splitpnt = self._maxlinelen first = charset.from_splittable(splittable[:splitpnt], False) last = charset.from_splittable(splittable[splitpnt:], False) else: ! # Divide and conquer. ! halfway = _floordiv(len(splittable), 2) ! first = charset.from_splittable(splittable[:halfway], False) ! last = charset.from_splittable(splittable[halfway:], False) ! # Do the split ! return self._split(first, charset, firstline) + \ ! self._split(last, charset) ! def _ascii_split(self, s, charset, firstline): ! # Attempt to split the line at the highest-level syntactic break ! # possible. Note that we don't have a lot of smarts about field ! # syntax; we just try to break on semi-colons, then whitespace. ! rtn = [] ! lines = s.splitlines() ! while lines: ! line = lines.pop(0) ! if firstline: ! maxlinelen = self._firstlinelen ! firstline = False ! else: ! #line = line.lstrip() ! maxlinelen = self._maxlinelen ! # Short lines can remain unchanged ! if len(line.replace('\t', SPACE8)) <= maxlinelen: ! rtn.append(line) ! else: ! oldlen = len(line) ! # Try to break the line on semicolons, but if that doesn't ! # work, try to split on folding whitespace. ! while len(line) > maxlinelen: ! i = line.rfind(';', 0, maxlinelen) ! if i < 0: ! break ! rtn.append(line[:i] + ';') ! line = line[i+1:] ! # Is the remaining stuff still longer than maxlinelen? ! if len(line) <= maxlinelen: ! # Splitting on semis worked ! rtn.append(line) ! continue ! # Splitting on semis didn't finish the job. If it did any ! # work at all, stick the remaining junk on the front of the ! # `lines' sequence and let the next pass do its thing. ! if len(line) <> oldlen: ! lines.insert(0, line) ! continue ! # Otherwise, splitting on semis didn't help at all. ! parts = re.split(r'(\s+)', line) ! if len(parts) == 1 or (len(parts) == 3 and ! parts[0].endswith(':')): ! # This line can't be split on whitespace. There's now ! # little we can do to get this into maxlinelen. BAW: ! # We're still potentially breaking the RFC by possibly ! # allowing lines longer than the absolute maximum of 998 ! # characters. For now, let it slide. ! # ! # len(parts) will be 1 if this line has no `Field: ' ! # prefix, otherwise it will be len(3). ! rtn.append(line) ! continue ! # There is whitespace we can split on. ! first = parts.pop(0) ! sublines = [first] ! acc = len(first) ! while parts: ! len0 = len(parts[0]) ! len1 = len(parts[1]) ! if acc + len0 + len1 <= maxlinelen: ! sublines.append(parts.pop(0)) ! sublines.append(parts.pop(0)) ! acc += len0 + len1 ! else: ! # Split it here, but don't forget to ignore the ! # next whitespace-only part ! if first <> '': ! rtn.append(EMPTYSTRING.join(sublines)) ! del parts[0] ! first = parts.pop(0) ! sublines = [first] ! acc = len(first) ! rtn.append(EMPTYSTRING.join(sublines)) ! return [(chunk, charset) for chunk in rtn] def _encode_chunks(self, newchunks): --- 301,328 ---- # although it's possible that other charsets may also benefit from the # higher-level syntactic breaks. elif charset == 'us-ascii': ! return self._split_ascii(s, charset, maxlinelen, splitchars) # BAW: should we use encoded? elif elen == len(s): # We can split on _maxlinelen boundaries because we know that the # encoding won't change the size of the string ! splitpnt = maxlinelen first = charset.from_splittable(splittable[:splitpnt], False) last = charset.from_splittable(splittable[splitpnt:], False) else: ! # Binary search for split point ! first, last = _binsplit(splittable, charset, maxlinelen) ! # first is of the proper length so just wrap it in the appropriate ! # chrome. last must be recursively split. ! fsplittable = charset.to_splittable(first) ! fencoded = charset.from_splittable(fsplittable, True) ! chunk = [(fencoded, charset)] ! return chunk + self._split(last, charset, self._maxlinelen, splitchars) ! def _split_ascii(self, s, charset, firstlen, splitchars): ! line = _split_ascii(s, firstlen, self._maxlinelen, ! self._continuation_ws, splitchars) ! lines = line.splitlines() ! return zip(lines, [charset]*len(lines)) def _encode_chunks(self, newchunks): *************** *** 397,409 **** for header, charset in newchunks: if charset is None or charset.header_encoding is None: ! # There's no encoding for this chunk's charsets ! _max_append(chunks, header, self._maxlinelen) else: ! _max_append(chunks, charset.header_encode(header), ! self._maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) ! def encode(self): """Encode a message header into an RFC-compliant format. --- 348,359 ---- for header, charset in newchunks: if charset is None or charset.header_encoding is None: ! s = header else: ! s = charset.header_encode(header) ! _max_append(chunks, s, self._maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) ! def encode(self, splitchars=';, '): """Encode a message header into an RFC-compliant format. *************** *** 422,428 **** If the given charset is not known or an error occurs during conversion, this function will return the header untouched. """ newchunks = [] for s, charset in self._chunks: ! newchunks += self._split(s, charset, True) return self._encode_chunks(newchunks) --- 372,482 ---- If the given charset is not known or an error occurs during conversion, this function will return the header untouched. + + Optional splitchars is a string containing characters to split long + ASCII lines on, in rough support of RFC 2822's `highest level + syntactic breaks'. This doesn't affect RFC 2047 encoded lines. """ newchunks = [] + maxlinelen = self._firstlinelen + lastlen = 0 for s, charset in self._chunks: ! # The first bit of the next chunk should be just long enough to ! # fill the next line. Don't forget the space separating the ! # encoded words. ! targetlen = maxlinelen - lastlen - 1 ! if targetlen < charset.encoded_header_len(''): ! # Stick it on the next line ! targetlen = maxlinelen ! newchunks += self._split(s, charset, targetlen, splitchars) ! lastchunk, lastcharset = newchunks[-1] ! lastlen = lastcharset.encoded_header_len(lastchunk) return self._encode_chunks(newchunks) + + + + def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): + lines = [] + maxlen = firstlen + for line in s.splitlines(): + if len(line) < maxlen: + lines.append(line) + maxlen = restlen + continue + # Attempt to split the line at the highest-level syntactic break + # possible. Note that we don't have a lot of smarts about field + # syntax; we just try to break on semi-colons, then commas, then + # whitespace. + for ch in splitchars: + if line.find(ch) >= 0: + break + else: + # There's nothing useful to split the line on, not even spaces, so + # just append this line unchanged + lines.append(line) + maxlen = restlen + continue + # Now split the line on the character plus trailing whitespace + cre = re.compile(r'%s\s*' % ch) + if ch in ';,': + eol = ch + else: + eol = '' + joiner = eol + ' ' + joinlen = len(joiner) + wslen = len(continuation_ws.replace('\t', SPACE8)) + this = [] + linelen = 0 + for part in cre.split(line): + curlen = linelen + max(0, len(this)-1) * joinlen + partlen = len(part) + onfirstline = not lines + # We don't want to split after the field name, if we're on the + # first line and the field name is present in the header string. + if ch == ' ' and onfirstline and \ + len(this) == 1 and fcre.match(this[0]): + this.append(part) + linelen += partlen + elif curlen + partlen > maxlen: + if this: + lines.append(joiner.join(this) + eol) + this = [part] + linelen = wslen + partlen + maxlen = restlen + else: + this.append(part) + linelen += partlen + # Put any left over parts on a line by themselves + if this: + lines.append(joiner.join(this)) + linejoiner = '\n' + continuation_ws + return linejoiner.join(lines) + + + + def _binsplit(splittable, charset, maxlinelen): + i = 0 + j = len(splittable) + while i < j: + # Invariants: + # 1. splittable[:k] fits for all k <= i (note that we *assume*, + # at the start, that splittable[:0] fits). + # 2. splittable[:k] does not fit for any k > j (at the start, + # this means we shouldn't look at any k > len(splittable)). + # 3. We don't know about splittable[:k] for k in i+1..j. + # 4. We want to set i to the largest k that fits, with i <= k <= j. + # + m = (i+j+1) >> 1 # ceiling((i+j)/2); i < m <= j + chunk = charset.from_splittable(splittable[:m], True) + chunklen = charset.encoded_header_len(chunk) + if chunklen <= maxlinelen: + # m is acceptable, so is a new lower bound. + i = m + else: + # m is not acceptable, so final i must be < j. + j = m - 1 + # i == j. Invariant #1 implies that splittable[:i] fits, and + # invariant #2 implies that splittable[:i+1] does not fit, so i + # is what we're looking for. + first = charset.from_splittable(splittable[:i], False) + last = charset.from_splittable(splittable[i:], False) + return first, last From bwarsaw@users.sourceforge.net Thu Mar 6 05:40:48 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:40:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv5915 Modified Files: test_email.py Log Message: Merge of the folding-reimpl-branch. Specific changes, Update tests for email 2.5. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** test_email.py 2 Jan 2003 22:48:36 -0000 1.29 --- test_email.py 6 Mar 2003 05:40:45 -0000 1.30 *************** *** 2,14 **** # email package unit tests - import sys import os import time - import unittest import base64 import difflib from cStringIO import StringIO from types import StringType, ListType - import warnings import email --- 2,14 ---- # email package unit tests import os + import sys import time import base64 import difflib + import unittest + import warnings from cStringIO import StringIO from types import StringType, ListType import email *************** *** 567,571 **** cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") ! h = Header(g_head, g) h.append(cz_head, cz) h.append(utf8_head, utf8) --- 567,571 ---- cz_head = "Finan\xe8ni metropole se hroutily pod tlakem jejich d\xf9vtipu.. " utf8_head = u"\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das Nunstuck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput.\u300d\u3068\u8a00\u3063\u3066\u3044\u307e\u3059\u3002".encode("utf-8") ! h = Header(g_head, g, header_name='Subject') h.append(cz_head, cz) h.append(utf8_head, utf8) *************** *** 575,612 **** g = Generator(sfp) g.flatten(msg) ! eq(sfp.getvalue(), '''\ ! Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?= ! =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutil?= ! =?iso-8859-2?q?y_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv?= ! =?utf-8?b?44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?= ! =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?= ! =?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?= ! =?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?= ! =?utf-8?q?s_Nunstuck_git_und?= ! =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?= ! =?utf-8?q?r_die_Flipperwaldt?= ! =?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?= ! ''') ! eq(h.encode(), '''\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?= ! =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutil?= ! =?iso-8859-2?q?y_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv?= ! =?utf-8?b?44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?= ! =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?= ! =?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?= ! =?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?= ! =?utf-8?q?s_Nunstuck_git_und?= ! =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?= ! =?utf-8?q?r_die_Flipperwaldt?= ! =?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=''') def test_long_header_encode(self): --- 575,604 ---- g = Generator(sfp) g.flatten(msg) ! eq(sfp.getvalue(), """\ ! Subject: =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= ! =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= ! =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= ! =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= ! =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= ! =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= ! =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= ! =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= ! =?utf-8?b?44Gm44GE44G+44GZ44CC?= ! """) ! eq(h.encode(), """\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerd?= ! =?iso-8859-1?q?erband_komfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndi?= ! =?iso-8859-1?q?schen_Wandgem=E4lden_vorbei=2C_gegen_die_rotierenden_Kling?= ! =?iso-8859-1?q?en_bef=F6rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_met?= ! =?iso-8859-2?q?ropole_se_hroutily_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE?= ! =?utf-8?b?44G+44Gb44KT44CC5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB?= ! =?utf-8?b?44GC44Go44Gv44Gn44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CM?= ! =?utf-8?q?Wenn_ist_das_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das?= ! =?utf-8?b?IE9kZXIgZGllIEZsaXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBow==?= ! =?utf-8?b?44Gm44GE44G+44GZ44CC?=""") def test_long_header_encode(self): *************** *** 713,722 **** eq = self.ndiffAssertEqual msg = Message() ! h = Header('Britische Regierung gibt', 'iso-8859-1') h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte') msg['Subject'] = h eq(msg.as_string(), """\ ! Subject: =?iso-8859-1?q?Britische_Regierung_gibt?= ! =?iso-8859-1?q?gr=FCnes_Licht_f=FCr_Offshore-Windkraftprojekte?= """) --- 705,715 ---- eq = self.ndiffAssertEqual msg = Message() ! h = Header('Britische Regierung gibt', 'iso-8859-1', ! header_name='Subject') h.append('gr\xfcnes Licht f\xfcr Offshore-Windkraftprojekte') msg['Subject'] = h eq(msg.as_string(), """\ ! Subject: =?iso-8859-1?q?Britische_Regierung_gibt?= =?iso-8859-1?q?gr=FCnes?= ! =?iso-8859-1?q?_Licht_f=FCr_Offshore-Windkraftprojekte?= """) *************** *** 731,734 **** --- 724,769 ---- """) + def test_long_to_header(self): + eq = self.ndiffAssertEqual + to = '"Someone Test #A" ,,"Someone Test #B" , "Someone Test #C" , "Someone Test #D" ' + msg = Message() + msg['To'] = to + eq(msg.as_string(0), '''\ + To: "Someone Test #A" , , + \t"Someone Test #B" , + \t"Someone Test #C" , + \t"Someone Test #D" + + ''') + + def test_long_line_after_append(self): + eq = self.ndiffAssertEqual + s = 'This is an example of string which has almost the limit of header length.' + h = Header(s) + h.append('Add another line.') + eq(h.encode(), """\ + This is an example of string which has almost the limit of header length. + Add another line.""") + + def test_shorter_line_with_append(self): + eq = self.ndiffAssertEqual + s = 'This is a shorter line.' + h = Header(s) + h.append('Add another sentence. (Surprise?)') + eq(h.encode(), + 'This is a shorter line. Add another sentence. (Surprise?)') + + def test_long_field_name(self): + eq = self.ndiffAssertEqual + fn = 'X-Very-Very-Very-Long-Header-Name' + gs = "Die Mieter treten hier ein werden mit einem Foerderband komfortabel den Korridor entlang, an s\xfcdl\xfcndischen Wandgem\xe4lden vorbei, gegen die rotierenden Klingen bef\xf6rdert. " + h = Header(gs, 'iso-8859-1', header_name=fn) + # BAW: this seems broken because the first line is too long + eq(h.encode(), """\ + =?iso-8859-1?q?Die_Mieter_treten_hier_?= + =?iso-8859-1?q?ein_werden_mit_einem_Foerderband_komfortabel_den_Korridor_?= + =?iso-8859-1?q?entlang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei=2C_g?= + =?iso-8859-1?q?egen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") + *************** *** 1310,1313 **** --- 1345,1385 ---- self.assertEqual(sfp.getvalue(), text) + def test_no_nl_preamble(self): + eq = self.ndiffAssertEqual + msg = Message() + msg['From'] = 'aperson@dom.ain' + msg['To'] = 'bperson@dom.ain' + msg['Subject'] = 'Test' + msg.preamble = 'MIME message' + msg.epilogue = '' + msg1 = MIMEText('One') + msg2 = MIMEText('Two') + msg.add_header('Content-Type', 'multipart/mixed', boundary='BOUNDARY') + msg.attach(msg1) + msg.attach(msg2) + eq(msg.as_string(), """\ + From: aperson@dom.ain + To: bperson@dom.ain + Subject: Test + Content-Type: multipart/mixed; boundary="BOUNDARY" + + MIME message + --BOUNDARY + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + One + + --BOUNDARY + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + Two + + --BOUNDARY-- + """) + def test_default_type(self): eq = self.assertEqual *************** *** 2182,2186 **** eq(h.encode(), 'Hello World!') h.append(' Goodbye World!') ! eq(h.encode(), 'Hello World! Goodbye World!') def test_simple_surprise(self): --- 2254,2258 ---- eq(h.encode(), 'Hello World!') h.append(' Goodbye World!') ! eq(h.encode(), 'Hello World! Goodbye World!') def test_simple_surprise(self): *************** *** 2189,2193 **** eq(h.encode(), 'Hello World!') h.append('Goodbye World!') ! eq(h.encode(), 'Hello World!Goodbye World!') def test_header_needs_no_decoding(self): --- 2261,2265 ---- eq(h.encode(), 'Hello World!') h.append('Goodbye World!') ! eq(h.encode(), 'Hello World! Goodbye World!') def test_header_needs_no_decoding(self): *************** *** 2198,2202 **** h = Header("I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.", maxlinelen=76) ! for l in h.encode().split('\n '): self.failUnless(len(l) <= 76) --- 2270,2274 ---- h = Header("I am the very model of a modern Major-General; I've information vegetable, animal, and mineral; I know the kings of England, and I quote the fights historical from Marathon to Waterloo, in order categorical; I'm very well acquainted, too, with matters mathematical; I understand equations, both the simple and quadratical; about binomial theorem I'm teeming with a lot o' news, with many cheerful facts about the square of the hypotenuse.", maxlinelen=76) ! for l in h.encode(splitchars=' ').split('\n '): self.failUnless(len(l) <= 76) *************** *** 2213,2231 **** h.append(utf8_head, utf8) enc = h.encode() ! eq(enc, """=?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_eine?= ! =?iso-8859-1?q?m_Foerderband_komfortabel_den_Korridor_ent?= ! =?iso-8859-1?q?lang=2C_an_s=FCdl=FCndischen_Wandgem=E4lden_vorbei?= ! =?iso-8859-1?q?=2C_gegen_die_rotierenden_Klingen_bef=F6rdert=2E_?= ! =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutil?= ! =?iso-8859-2?q?y_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= ! =?utf-8?b?5q2j56K644Gr6KiA44GG44Go57+76Kiz44Gv?= ! =?utf-8?b?44GV44KM44Gm44GE44G+44Gb44KT44CC5LiA?= ! =?utf-8?b?6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM?= ! =?utf-8?b?44CB44GC44Go44Gv44Gn44Gf44KJ44KB44Gn?= ! =?utf-8?b?44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGE=?= ! =?utf-8?q?s_Nunstuck_git_und?= ! =?utf-8?q?_Slotermeyer=3F_Ja!_Beiherhund_das_Ode?= ! =?utf-8?q?r_die_Flipperwaldt?= ! =?utf-8?b?IGdlcnNwdXQu44CN44Go6KiA44Gj44Gm44GE44G+44GZ44CC?=""") eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), --- 2285,2300 ---- h.append(utf8_head, utf8) enc = h.encode() ! eq(enc, """\ ! =?iso-8859-1?q?Die_Mieter_treten_hier_ein_werden_mit_einem_Foerderband_ko?= ! =?iso-8859-1?q?mfortabel_den_Korridor_entlang=2C_an_s=FCdl=FCndischen_Wan?= ! =?iso-8859-1?q?dgem=E4lden_vorbei=2C_gegen_die_rotierenden_Klingen_bef=F6?= ! =?iso-8859-1?q?rdert=2E_?= =?iso-8859-2?q?Finan=E8ni_metropole_se_hroutily?= ! =?iso-8859-2?q?_pod_tlakem_jejich_d=F9vtipu=2E=2E_?= =?utf-8?b?5q2j56K6?= ! =?utf-8?b?44Gr6KiA44GG44Go57+76Kiz44Gv44GV44KM44Gm44GE44G+44Gb44KT44CC?= ! =?utf-8?b?5LiA6YOo44Gv44OJ44Kk44OE6Kqe44Gn44GZ44GM44CB44GC44Go44Gv44Gn?= ! =?utf-8?b?44Gf44KJ44KB44Gn44GZ44CC5a6f6Zqb44Gr44Gv44CMV2VubiBpc3QgZGFz?= ! =?utf-8?q?_Nunstuck_git_und_Slotermeyer=3F_Ja!_Beiherhund_das_Oder_die_Fl?= ! =?utf-8?b?aXBwZXJ3YWxkdCBnZXJzcHV0LuOAjeOBqOiogOOBo+OBpuOBhOOBvuOBmQ==?= ! =?utf-8?b?44CC?=""") eq(decode_header(enc), [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"), *************** *** 2318,2321 **** --- 2387,2414 ---- h.append(x, errors='replace') eq(str(h), x) + + def test_encoded_adjacent_nonencoded(self): + eq = self.assertEqual + h = Header() + h.append('hello', 'iso-8859-1') + h.append('world') + s = h.encode() + eq(s, '=?iso-8859-1?q?hello?= world') + h = make_header(decode_header(s)) + eq(h.encode(), s) + + def test_whitespace_eater(self): + eq = self.assertEqual + s = 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztk=?= =?koi8-r?q?=CA?= zz.' + parts = decode_header(s) + eq(parts, [('Subject:', None), ('\xf0\xd2\xcf\xd7\xc5\xd2\xcb\xc1 \xce\xc1 \xc6\xc9\xce\xc1\xcc\xd8\xce\xd9\xca', 'koi8-r'), ('zz.', None)]) + hdr = make_header(parts) + eq(hdr.encode(), + 'Subject: =?koi8-r?b?8NLP18XSy8EgzsEgxsnOwczYztnK?= zz.') + + def test_broken_base64_header(self): + raises = self.assertRaises + s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ?=' + raises(Errors.HeaderParseError, decode_header, s) From bwarsaw@users.sourceforge.net Thu Mar 6 05:41:09 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 21:41:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email_codecs.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv6041 Modified Files: test_email_codecs.py Log Message: Merge of the folding-reimpl-branch. Specific changes, Update tests for email 2.5. Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_codecs.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_email_codecs.py 23 Jul 2002 19:03:42 -0000 1.3 --- test_email_codecs.py 6 Mar 2003 05:41:07 -0000 1.4 *************** *** 27,31 **** h.append(jhello, j) h.append(ghello, g) ! eq(h.encode(), 'Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?=\n =?iso-8859-1?q?Gr=FC=DF_Gott!?=') eq(decode_header(h.encode()), [('Hello World!', None), --- 27,38 ---- h.append(jhello, j) h.append(ghello, g) ! # BAW: This used to -- and maybe should -- fold the two iso-8859-1 ! # chunks into a single encoded word. However it doesn't violate the ! # standard to have them as two encoded chunks and maybe it's ! # reasonable for each .append() call to result in a separate ! # encoded word. ! eq(h.encode(), """\ ! Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?= ! =?iso-8859-1?q?Gr=FC=DF?= =?iso-8859-1?q?_Gott!?=""") eq(decode_header(h.encode()), [('Hello World!', None), *************** *** 36,56 **** # test a very long header enc = h.encode() ! # BAW: The following used to pass. Sadly, the test afterwards is what ! # happens now. I've no idea which is right. Please, any Japanese and ! # RFC 2047 experts, please verify! ! ## eq(enc, '''\ ! ##=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYRsoQg==?= ! ## =?iso-2022-jp?b?GyRCITwlayRPO0oycTxUJE4+NRsoQg==?= ! ## =?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?=''') ! eq(enc, """\ ! =?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYRsoQg==?= ! =?iso-2022-jp?b?GyRCITwlayRPO0oycTxUJE4+NUcnJHJCVCRDJEYkJCReJDkbKEI=?=""") ! # BAW: same deal here. :( ! ## self.assertEqual( ! ## decode_header(enc), ! ## [("test-ja \x1b$B$XEj9F$5$l$?%a\x1b(B\x1b$B!<%k$O;J2q5\x1b(B\x1b$BG'$rBT$C$F$$$^$9\x1b(B", 'iso-2022-jp')]) ! self.assertEqual( ! decode_header(enc), ! [("test-ja \x1b$B$XEj9F$5$l$?%a\x1b(B\x1b$B!<%k$O;J2q5G'$rBT$C$F$$$^$9\x1b(B", 'iso-2022-jp')]) --- 43,52 ---- # test a very long header enc = h.encode() ! # TK: splitting point may differ by codec design and/or Header encoding ! eq(enc , """\ ! =?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKGyhC?= ! =?iso-2022-jp?b?GyRCMnE8VCROPjVHJyRyQlQkQyRGJCQkXiQ5GyhC?=""") ! # TK: full decode comparison ! eq(h.__unicode__().encode('euc-jp'), long) From bwarsaw@users.sourceforge.net Thu Mar 6 06:06:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 22:06:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib emailheaders.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12065 Modified Files: emailheaders.tex Log Message: Describe the new Header.encode() argument "splitchars". Index: emailheaders.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailheaders.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** emailheaders.tex 30 Dec 2002 19:17:37 -0000 1.3 --- emailheaders.tex 6 Mar 2003 06:06:54 -0000 1.4 *************** *** 110,117 **** \end{methoddesc} ! \begin{methoddesc}[Header]{encode}{} Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-\ASCII{} parts in base64 or ! quoted-printable encodings. \end{methoddesc} --- 110,120 ---- \end{methoddesc} ! \begin{methoddesc}[Header]{encode}{\optional{splitchars}} Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-\ASCII{} parts in base64 or ! quoted-printable encodings. Optional \var{splitchars} is a string ! containing characters to split long ASCII lines on, in rough support ! of \rfc{2822}'s \emph{highest level syntactic breaks}. This doesn't ! affect \rfc{2047} encoded lines. \end{methoddesc} From bwarsaw@users.sourceforge.net Thu Mar 6 06:07:37 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 22:07:37 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib emailcharsets.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12253 Modified Files: emailcharsets.tex Log Message: Describe Charset.__repr__(). Index: emailcharsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailcharsets.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** emailcharsets.tex 10 Oct 2002 15:23:38 -0000 1.2 --- emailcharsets.tex 6 Mar 2003 06:07:34 -0000 1.3 *************** *** 178,181 **** --- 178,182 ---- \begin{methoddesc}[Charset]{__str__}{} Returns \var{input_charset} as a string coerced to lower case. + \method{__repr__()} is an alias for \method{__str__()}. \end{methoddesc} From bwarsaw@users.sourceforge.net Thu Mar 6 06:37:44 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 22:37:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv20207 Modified Files: Header.py Log Message: decode_header(): Typo when appending an unencoded chunk to the previous unencoded chunk (e.g. when they appear on separate lines). Closes the 2nd bug in SF #640110 (the first one's already been fixed). Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Header.py 6 Mar 2003 05:39:46 -0000 1.18 --- Header.py 6 Mar 2003 06:37:42 -0000 1.19 *************** *** 93,97 **** # Should we continue a long line? if decoded and decoded[-1][1] is None: ! decoded[-1] = (decoded[-1][0] + dec, None) else: decoded.append((unenc, None)) --- 93,97 ---- # Should we continue a long line? if decoded and decoded[-1][1] is None: ! decoded[-1] = (decoded[-1][0] + SPACE + unenc, None) else: decoded.append((unenc, None)) From bwarsaw@users.sourceforge.net Thu Mar 6 06:38:31 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 05 Mar 2003 22:38:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv20434 Modified Files: test_email.py Log Message: test_rfc2047_multiline(): Test case for SF bug #640110. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** test_email.py 6 Mar 2003 05:40:45 -0000 1.30 --- test_email.py 6 Mar 2003 06:38:29 -0000 1.31 *************** *** 1194,1197 **** --- 1194,1211 ---- '=?iso-8859-2?b?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=') + def test_rfc2047_multiline(self): + eq = self.assertEqual + s = """Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz + foo bar =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""" + dh = decode_header(s) + eq(dh, [ + ('Re:', None), + ('r\x8aksm\x9arg\x8cs', 'mac-iceland'), + ('baz foo bar', None), + ('r\x8aksm\x9arg\x8cs', 'mac-iceland')]) + eq(str(make_header(dh)), + """Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar + =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""") + From python@rcn.com Thu Mar 6 10:05:01 2003 From: python@rcn.com (Raymond Hettinger) Date: Thu, 6 Mar 2003 05:05:01 -0500 Subject: [Python-checkins] python/dist/src/Lib timeit.py,NONE,1.1 References: Message-ID: <000b01c2e3c7$da614500$125ffea9@oemcomputer> > def reindent(src, indent): > return ("\n" + " "*indent).join(src.split("\n")) Can this be simplified to: return src.replace("\n", "\n" + " "*indent) Raymond Hettinger From sjoerd@users.sourceforge.net Thu Mar 6 12:53:09 2003 From: sjoerd@users.sourceforge.net (sjoerd@users.sourceforge.net) Date: Thu, 06 Mar 2003 04:53:09 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.182,2.183 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31032 Modified Files: unicodeobject.c Log Message: Removed superfluous \r. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.182 retrieving revision 2.183 diff -C2 -d -r2.182 -r2.183 *** unicodeobject.c 11 Feb 2003 23:05:37 -0000 2.182 --- unicodeobject.c 6 Mar 2003 12:53:07 -0000 2.183 *************** *** 3257,3261 **** goto onError; } ! Py_XDECREF(x); if (x!=Py_None) /* it worked => adjust input pointer */ ++p; --- 3257,3261 ---- goto onError; } ! Py_XDECREF(x); if (x!=Py_None) /* it worked => adjust input pointer */ ++p; From gvanrossum@users.sourceforge.net Thu Mar 6 13:09:13 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 06 Mar 2003 05:09:13 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4502 Modified Files: timeit.py Log Message: Simpler way to write reindent(), suggested by Raymond H. Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** timeit.py 6 Mar 2003 03:02:10 -0000 1.3 --- timeit.py 6 Mar 2003 13:09:09 -0000 1.4 *************** *** 85,89 **** def reindent(src, indent): """Helper to reindent a multi-line statement.""" ! return ("\n" + " "*indent).join(src.split("\n")) class Timer: --- 85,89 ---- def reindent(src, indent): """Helper to reindent a multi-line statement.""" ! return src.replace("\n", "\n" + " "*indent) class Timer: From webmaster@pferdemarkt.ws Thu Mar 6 14:13:06 2003 From: webmaster@pferdemarkt.ws (webmaster@pferdemarkt.ws) Date: Thu, 6 Mar 2003 06:13:06 -0800 Subject: [Python-checkins] Pferdemarkt.ws informiert! Newsletter 03/2003 http://www.pferdemarkt.ws Message-ID: <200303061413.GAA26288@eagle.he.net> http://www.pferdemarkt.ws Wir sind in 2003 erfolgreich in des neue \"Pferdejahr 2003 gestartet. Für den schnellen Erfolg unseres Marktes möchten wir uns bei Ihnen bedanken. Heute am 06.03.2003 sind wir gut 2 Monate Online! Täglich wächst unsere Datenbank um 30 Neue Angebote. Stellen auch Sie als Privatperson Ihre zu verkaufenden Pferde direkt und vollkommen kostenlos ins Internet. Zur besseren Sichtbarmachung Ihrer Angebote können Sie bis zu ein Bild zu Ihrer Pferdeanzeige kostenlos einstellen! Wollen Sie direkt auf die erste Seite, dann können wir Ihnen unser Bonussystem empfehlen. klicken Sie hier: http://www.pferdemarkt.ws/bestellung.html Ihr http://Pferdemarkt.ws Team Klicken Sie hier um sich direkt einzuloggen http://www.Pferdemarkt.ws Kostenlos Anbieten, Kostenlos Suchen! Direkt von Privat zu Privat! Haben Sie noch Fragen mailto: webmaster@pferdemarkt.ws From bwarsaw@users.sourceforge.net Thu Mar 6 16:10:34 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 06 Mar 2003 08:10:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv22423 Modified Files: Header.py Log Message: __unicode__(): When converting to a unicode string, we need to preserve spaces in the encoded/unencoded word boundaries. RFC 2047 is ambiguous here, but most people expect the space to be preserved. Really closes SF bug # 640110. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Header.py 6 Mar 2003 06:37:42 -0000 1.19 --- Header.py 6 Mar 2003 16:10:30 -0000 1.20 *************** *** 29,34 **** --- 29,36 ---- NL = '\n' SPACE = ' ' + USPACE = u' ' SPACE8 = ' ' * 8 EMPTYSTRING = '' + UEMPTYSTRING = u'' MAXLINELEN = 76 *************** *** 205,211 **** def __unicode__(self): """Helper for the built-in unicode function.""" ! # charset item is a Charset instance so we need to stringify it. ! uchunks = [unicode(s, str(charset)) for s, charset in self._chunks] ! return u''.join(uchunks) # Rich comparison operators for equality only. BAW: does it make sense to --- 207,228 ---- def __unicode__(self): """Helper for the built-in unicode function.""" ! uchunks = [] ! lastcs = None ! for s, charset in self._chunks: ! # We must preserve spaces between encoded and non-encoded word ! # boundaries, which means for us we need to add a space when we go ! # from a charset to None/us-ascii, or from None/us-ascii to a ! # charset. Only do this for the second and subsequent chunks. ! nextcs = charset ! if uchunks: ! if lastcs is not None: ! if nextcs is None or nextcs == 'us-ascii': ! uchunks.append(USPACE) ! nextcs = None ! elif nextcs is not None and nextcs <> 'us-ascii': ! uchunks.append(USPACE) ! lastcs = nextcs ! uchunks.append(unicode(s, str(charset))) ! return UEMPTYSTRING.join(uchunks) # Rich comparison operators for equality only. BAW: does it make sense to From bwarsaw@users.sourceforge.net Thu Mar 6 16:11:18 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 06 Mar 2003 08:11:18 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv22851 Modified Files: test_email.py Log Message: test_whitespace_eater_unicode(): Test of the last outstanding bug in SF # 640110. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** test_email.py 6 Mar 2003 06:38:29 -0000 1.31 --- test_email.py 6 Mar 2003 16:11:14 -0000 1.32 *************** *** 1208,1211 **** --- 1208,1219 ---- =?mac-iceland?q?r=8Aksm=9Arg=8Cs?=""") + def test_whitespace_eater_unicode(self): + eq = self.assertEqual + s = '=?ISO-8859-1?Q?Andr=E9?= Pirard ' + dh = decode_header(s) + eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard ', None)]) + hu = unicode(make_header(dh)).encode('latin-1') + eq(hu, 'Andr\xe9 Pirard ') + From gvanrossum@users.sourceforge.net Thu Mar 6 16:11:19 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 06 Mar 2003 08:11:19 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv22880 Modified Files: timeit.py Log Message: Add a note explaining why you shouldn't try to compute mean and standard deviation. Also add an XXX comment wondering if we should refrain from using itertools.repeat(). Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** timeit.py 6 Mar 2003 13:09:09 -0000 1.4 --- timeit.py 6 Mar 2003 16:11:17 -0000 1.5 *************** *** 52,55 **** --- 52,58 ---- # instructions. + # XXX Maybe for convenience of comparing with previous Python versions, + # itertools.repeat() should not be used at all? + import sys import math *************** *** 134,137 **** --- 137,151 ---- the second argument specifies the timer argument, defaulting to one million. + + Note: it's tempting to calculate mean and standard deviation + from the result vector and report these. However, this is not + very useful. In a typical case, the lowest value gives a + lower bound for how fast your machine can run the given code + snippet; higher values in the result vector are typically not + caused by variability in Python's speed, but by other + processes interfering with your timing accuracy. So the min() + of the result is probably the only number you should be + interested in. After that, you should look at the entire + vector and apply common sense rather than statistics. """ r = [] From fdrake@users.sourceforge.net Thu Mar 6 16:28:04 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 06 Mar 2003 08:28:04 -0800 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.57.6.5,2.57.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv1335 Modified Files: Tag: release22-maint pyexpat.c Log Message: Backport patch from revision 2.90: Fix memory leak: free memory storing the content model passed to the ElementDeclHandler by Expat. Fixes SF bug #676990. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.57.6.5 retrieving revision 2.57.6.6 diff -C2 -d -r2.57.6.5 -r2.57.6.6 *** pyexpat.c 19 Jan 2003 15:48:38 -0000 2.57.6.5 --- pyexpat.c 6 Mar 2003 16:27:58 -0000 2.57.6.6 *************** *** 648,680 **** } ! static PyObject * ! conv_content_model_utf8(XML_Content * const model) { ! return conv_content_model(model, conv_string_to_utf8); ! } ! #ifdef Py_USING_UNICODE ! static PyObject * ! conv_content_model_unicode(XML_Content * const model) ! { ! return conv_content_model(model, conv_string_to_unicode); ! } ! VOID_HANDLER(ElementDecl, ! (void *userData, ! const XML_Char *name, ! XML_Content *model), ! ("O&O&", ! STRING_CONV_FUNC,name, ! (self->returns_unicode ? conv_content_model_unicode ! : conv_content_model_utf8),model)) #else ! VOID_HANDLER(ElementDecl, ! (void *userData, ! const XML_Char *name, ! XML_Content *model), ! ("O&O&", ! STRING_CONV_FUNC,name, conv_content_model_utf8,model)) #endif VOID_HANDLER(AttlistDecl, --- 648,708 ---- } ! static void ! my_ElementDeclHandler(void *userData, ! const XML_Char *name, ! XML_Content *model) { ! xmlparseobject *self = (xmlparseobject *)userData; ! PyObject *args = NULL; ! if (self->handlers[ElementDecl] != NULL ! && self->handlers[ElementDecl] != Py_None) { ! PyObject *rv = NULL; ! PyObject *modelobj, *nameobj; ! #ifdef Py_USING_UNICODE ! modelobj = conv_content_model(model, ! (self->returns_unicode ! ? conv_string_to_unicode ! : conv_string_to_utf8)); #else ! modelobj = conv_content_model(model, conv_string_to_utf8); ! #endif ! if (modelobj == NULL) { ! flag_error(self); ! goto finally; ! } ! nameobj = PyString_FromString(name); ! if (nameobj == NULL) { ! Py_DECREF(modelobj); ! flag_error(self); ! goto finally; ! } ! args = Py_BuildValue("NN", nameobj, modelobj); ! if (args == NULL) { ! Py_DECREF(modelobj); ! flag_error(self); ! goto finally; ! } ! self->in_callback = 1; ! rv = call_with_frame(getcode(ElementDecl, "ElementDecl", __LINE__), ! self->handlers[ElementDecl], args); ! self->in_callback = 0; ! if (rv == NULL) { ! flag_error(self); ! goto finally; ! } ! Py_DECREF(rv); ! } ! finally: ! Py_XDECREF(args); ! /* XML_FreeContentModel() was introduced in Expat 1.95.6. */ ! #if EXPAT_VERSION >= 0x015f06 ! XML_FreeContentModel(self->itself, model); ! #else ! free(model); #endif + return; + } VOID_HANDLER(AttlistDecl, From rhettinger@users.sourceforge.net Thu Mar 6 16:31:51 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 08:31:51 -0800 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2202 Modified Files: httplib.py Log Message: Reverted the previous change to read() and readline(). Kevin Jacobs found that the code simplification did not exactly match the semantics of the original. Regression test cases were requested. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** httplib.py 26 Feb 2003 22:45:18 -0000 1.72 --- httplib.py 6 Mar 2003 16:31:48 -0000 1.73 *************** *** 865,894 **** def read(self, size=None): L = [self._buf] if size is None: self._buf = '' ! for s in iter(self._read, ""): ! L.append(s) ! return "".join(L) else: ! avail = len(self._buf) ! for s in iter(self._read, ""): ! L.append(s) ! avail += len(s) ! if avail >= size: ! all = "".join(L) ! self._buf = all[size:] ! return all[:size] def readline(self): L = [self._buf] self._buf = '' ! for s in iter(self._read, ""): ! L.append(s) ! if "\n" in s: ! i = s.find("\n") + 1 ! self._buf = s[i:] ! L[-1] = s[:i] break ! return "".join(L) class FakeSocket(SharedSocketClient): --- 865,904 ---- def read(self, size=None): L = [self._buf] + avail = len(self._buf) + while size is None or avail < size: + s = self._read() + if s == '': + break + L.append(s) + avail += len(s) + all = "".join(L) if size is None: self._buf = '' ! return all else: ! self._buf = all[size:] ! return all[:size] def readline(self): L = [self._buf] self._buf = '' ! while 1: ! i = L[-1].find("\n") ! if i >= 0: break ! s = self._read() ! if s == '': ! break ! L.append(s) ! if i == -1: ! # loop exited because there is no more data ! return "".join(L) ! else: ! all = "".join(L) ! # XXX could do enough bookkeeping not to do a 2nd search ! i = all.find("\n") + 1 ! line = all[:i] ! self._buf = all[i:] ! return line class FakeSocket(SharedSocketClient): From bwarsaw@users.sourceforge.net Thu Mar 6 20:31:07 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 06 Mar 2003 12:31:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv21234 Modified Files: test_email.py Log Message: test_long_received_header(): Another test case for folding long Received headers (first on semis then on whitespace), given by Jason Mastaler. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** test_email.py 6 Mar 2003 16:11:14 -0000 1.32 --- test_email.py 6 Mar 2003 20:31:02 -0000 1.33 *************** *** 766,769 **** --- 766,784 ---- =?iso-8859-1?q?egen_die_rotierenden_Klingen_bef=F6rdert=2E_?=""") + def test_long_received_header(self): + h = 'from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; Wed, 05 Mar 2003 18:10:18 -0700' + msg = Message() + msg['Received-1'] = Header(h, continuation_ws='\t') + msg['Received-2'] = h + self.assertEqual(msg.as_string(), """\ + Received-1: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by + hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; + Wed, 05 Mar 2003 18:10:18 -0700 + Received-2: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by + hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; + Wed, 05 Mar 2003 18:10:18 -0700 + + """) + From bwarsaw@users.sourceforge.net Thu Mar 6 20:33:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 06 Mar 2003 12:33:08 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv22444 Modified Files: Header.py Log Message: _split_ascii(): In the clause where curlen + partlen > maxlen, if the part itself is longer than maxlen, and we aren't already splitting on whitespace, then we recursively split the part on whitespace and append that to the this list. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Header.py 6 Mar 2003 16:10:30 -0000 1.20 --- Header.py 6 Mar 2003 20:33:04 -0000 1.21 *************** *** 457,461 **** if this: lines.append(joiner.join(this) + eol) ! this = [part] linelen = wslen + partlen maxlen = restlen --- 457,468 ---- if this: lines.append(joiner.join(this) + eol) ! # If this part is longer than maxlen and we aren't already ! # splitting on whitespace, try to recursively split this line ! # on whitespace. ! if partlen > maxlen and ch <> ' ': ! this = [_split_ascii(part, maxlen, restlen, ! continuation_ws, ' ')] ! else: ! this = [part] linelen = wslen + partlen maxlen = restlen From nnorwitz@users.sourceforge.net Thu Mar 6 22:04:28 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 06 Mar 2003 14:04:28 -0800 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv32541/Doc/api Modified Files: utilities.tex Log Message: Fix SF bug #697256, PyMarshal_WriteShortToFile() documented, but not implemented Remove prototype and doc. Backport candidate. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** utilities.tex 13 Nov 2002 15:13:38 -0000 1.7 --- utilities.tex 6 Mar 2003 22:04:24 -0000 1.8 *************** *** 290,299 **** \end{cfuncdesc} - \begin{cfuncdesc}{void}{PyMarshal_WriteShortToFile}{short value, FILE *file} - Marshal a \ctype{short} integer, \var{value}, to \var{file}. This - will only write the least-significant 16 bits of \var{value}; - regardless of the size of the native \ctype{short} type. - \end{cfuncdesc} - \begin{cfuncdesc}{void}{PyMarshal_WriteObjectToFile}{PyObject *value, FILE *file} --- 290,293 ---- From nnorwitz@users.sourceforge.net Thu Mar 6 22:04:56 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 06 Mar 2003 14:04:56 -0800 Subject: [Python-checkins] python/dist/src/Include marshal.h,2.12,2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv32541/Include Modified Files: marshal.h Log Message: Fix SF bug #697256, PyMarshal_WriteShortToFile() documented, but not implemented Remove prototype and doc. Backport candidate. Index: marshal.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/marshal.h,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -d -r2.12 -r2.13 *** marshal.h 12 Aug 2002 07:21:57 -0000 2.12 --- marshal.h 6 Mar 2003 22:04:22 -0000 2.13 *************** *** 9,13 **** PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *); - PyAPI_FUNC(void) PyMarshal_WriteShortToFile(int, FILE *); PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *); PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *); --- 9,12 ---- From jackjansen@users.sourceforge.net Thu Mar 6 23:02:07 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:02:07 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules OSATerminology.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24186 Added Files: OSATerminology.c Log Message: Module to get OSA terminology description through the "official channels", in stead of manually getting the AETE/AEUT resource. Donated by Donovan Preston. This is his original code (but with the filename changed) checked in for reference only. --- NEW FILE: OSATerminology.c --- #include #include #include PyObject * PyOSA_GetAppTerminology(PyObject* self, PyObject* args) { AEDesc temp; FSSpec tempFSSpec; ComponentInstance defaultComponent; ScriptingComponentSelector theType; SInt16 defaultTerminology; Boolean didLaunch; OSAError err; PyObject * returnVal; if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &tempFSSpec)) return NULL; defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr'); // kOSAGenericScriptingComponentSubtype); err = GetComponentInstanceError (defaultComponent); printf("OpenDefaultComponent: %d\n", err); err = OSAGetCurrentDialect(defaultComponent, &defaultTerminology); printf("getcurrentdialect: %d\n", err); err = OSAGetAppTerminology ( defaultComponent, kOSAModeNull, &tempFSSpec, defaultTerminology, &didLaunch, &temp ); /* err = ASGetAppTerminology ( defaultComponent, &tempFSSpec, defaultTerminology, &didLaunch, &temp );*/ printf("getappterminology: %d\n", err); returnVal = Py_BuildValue("O&i", AEDesc_New, &temp, didLaunch); return returnVal; } /* * List of methods defined in the module */ static struct PyMethodDef PyOSA_methods[] = { {"GetAppTerminology", (PyCFunction) PyOSA_GetAppTerminology, METH_VARARGS, "Get an applications terminology, as an AEDesc object."}, {NULL, (PyCFunction) NULL, 0, NULL} }; void initPyOSA(void) { Py_InitModule("PyOSA", PyOSA_methods); } From jackjansen@users.sourceforge.net Thu Mar 6 23:03:03 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:03:03 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules OSATerminology.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24758 Modified Files: OSATerminology.c Log Message: Various tweaks by Jack because of the different module name, adaptation to the Python style, etc. Index: OSATerminology.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/OSATerminology.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OSATerminology.c 6 Mar 2003 23:02:04 -0000 1.1 --- OSATerminology.c 6 Mar 2003 23:02:59 -0000 1.2 *************** *** 1,51 **** ! #include #include ! #include ! PyObject * PyOSA_GetAppTerminology(PyObject* self, PyObject* args) { ! AEDesc temp; ! FSSpec tempFSSpec; ! ! ComponentInstance defaultComponent; ! ScriptingComponentSelector theType; ! SInt16 defaultTerminology; ! Boolean didLaunch; ! OSAError err; ! PyObject * returnVal; ! ! if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &tempFSSpec)) return NULL; ! defaultComponent = OpenDefaultComponent (kOSAComponentType, ! 'ascr'); ! // kOSAGenericScriptingComponentSubtype); ! ! err = GetComponentInstanceError (defaultComponent); ! printf("OpenDefaultComponent: %d\n", err); err = OSAGetCurrentDialect(defaultComponent, &defaultTerminology); ! printf("getcurrentdialect: %d\n", err); err = OSAGetAppTerminology ( defaultComponent, ! kOSAModeNull, ! &tempFSSpec, defaultTerminology, &didLaunch, ! &temp ); ! /* err = ASGetAppTerminology ( defaultComponent, ! &tempFSSpec, defaultTerminology, &didLaunch, ! &temp ! );*/ ! ! printf("getappterminology: %d\n", err); ! ! returnVal = Py_BuildValue("O&i", ! AEDesc_New, &temp, didLaunch); ! return returnVal; } --- 1,79 ---- ! /* ! ** This module is a one-trick pony: given an FSSpec it gets the aeut ! ** resources. It was written by Donovan Preston and slightly modified ! ** by Jack. ! ** ! ** It should be considered a placeholder, it will probably be replaced ! ** by a full interface to OpenScripting. ! */ ! #include "Python.h" ! #include "macglue.h" ! ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else #include ! #endif ! static PyObject * ! PyOSA_GetAppTerminology(PyObject* self, PyObject* args) ! { ! AEDesc theDesc = {0,0}; ! FSSpec fss; ! ComponentInstance defaultComponent = NULL; ! SInt16 defaultTerminology = 0; ! Boolean didLaunch = 0; OSAError err; + long modeFlags = 0; ! if (!PyArg_ParseTuple(args, "O&|i", PyMac_GetFSSpec, &fss, &modeFlags)) ! return NULL; ! defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr'); ! err = GetComponentInstanceError (defaultComponent); ! if (err) return PyMac_Error(err); err = OSAGetCurrentDialect(defaultComponent, &defaultTerminology); ! if (err) return PyMac_Error(err); err = OSAGetAppTerminology ( defaultComponent, ! modeFlags, ! &fss, defaultTerminology, &didLaunch, ! &theDesc ); + if (err) return PyMac_Error(err); + return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch); + } ! static PyObject * ! PyOSA_GetSysTerminology(PyObject* self, PyObject* args) ! { ! AEDesc theDesc = {0,0}; ! FSSpec fss; ! ComponentInstance defaultComponent = NULL; ! SInt16 defaultTerminology = 0; ! Boolean didLaunch = 0; ! OSAError err; ! long modeFlags = 0; ! ! if (!PyArg_ParseTuple(args, "O&|i", PyMac_GetFSSpec, &fss, &modeFlags)) ! return NULL; ! ! defaultComponent = OpenDefaultComponent (kOSAComponentType, 'ascr'); ! err = GetComponentInstanceError (defaultComponent); ! if (err) return PyMac_Error(err); ! err = OSAGetCurrentDialect(defaultComponent, &defaultTerminology); ! if (err) return PyMac_Error(err); ! err = OSAGetAppTerminology ( defaultComponent, ! modeFlags, ! &fss, defaultTerminology, &didLaunch, ! &theDesc ! ); ! if (err) return PyMac_Error(err); ! return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch); } *************** *** 53,70 **** * List of methods defined in the module */ ! static struct PyMethodDef PyOSA_methods[] = { ! {"GetAppTerminology", ! (PyCFunction) PyOSA_GetAppTerminology, ! METH_VARARGS, ! "Get an applications terminology, as an AEDesc object."}, ! ! {NULL, (PyCFunction) NULL, 0, NULL} }; void ! initPyOSA(void) { ! Py_InitModule("PyOSA", PyOSA_methods); } --- 81,101 ---- * List of methods defined in the module */ ! static struct PyMethodDef OSATerminology_methods[] = { ! {"GetAppTerminology", ! (PyCFunction) PyOSA_GetAppTerminology, ! METH_VARARGS, ! "Get an applications terminology, as an AEDesc object."}, ! {"GetSysTerminology", ! (PyCFunction) PyOSA_GetSysTerminology, ! METH_VARARGS, ! "Get an applications system terminology, as an AEDesc object."}, ! {NULL, (PyCFunction) NULL, 0, NULL} }; void ! initOSATerminology(void) { ! Py_InitModule("OSATerminology", OSATerminology_methods); } From jackjansen@users.sourceforge.net Thu Mar 6 23:03:47 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:03:47 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.154,1.155 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv25227 Modified Files: setup.py Log Message: Build the OSATerminology module on MacOSX. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** setup.py 2 Mar 2003 21:31:51 -0000 1.154 --- setup.py 6 Mar 2003 23:03:43 -0000 1.155 *************** *** 760,763 **** --- 760,765 ---- exts.append( Extension('MacOS', ['macosmodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('OSATerminology', ['OSATerminology.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('icglue', ['icgluemodule.c'], extra_link_args=['-framework', 'Carbon']) ) From jackjansen@users.sourceforge.net Thu Mar 6 23:04:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:04:41 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv25439 Modified Files: gensuitemodule.py Log Message: First try to use the OSATerminology module to get the terminology resources before reverting to manually reading the resources. Unfortunately there is still a bug in here somewhere: it doesn't work for all applications. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** gensuitemodule.py 26 Jan 2003 20:35:47 -0000 1.28 --- gensuitemodule.py 6 Mar 2003 23:04:38 -0000 1.29 *************** *** 16,24 **** import keyword import macresource ! from aetools import unpack ! from Carbon.Res import * ! DEFAULT_PACKAGEFOLDER=os.path.join(sys.prefix, 'Lib', 'plat-mac', 'lib-scriptpackages') def main(): --- 16,28 ---- import keyword import macresource ! import aetools ! import distutils.sysconfig ! import OSATerminology from Carbon.Res import * + import MacOS ! _MAC_LIB_FOLDER=os.path.dirname(aetools.__file__) ! DEFAULT_STANDARD_PACKAGEFOLDER=os.path.join(_MAC_LIB_FOLDER, 'lib-scriptpackages') ! DEFAULT_USER_PACKAGEFOLDER=distutils.sysconfig.get_python_lib() def main(): *************** *** 27,36 **** processfile(filename) else: ! filename = EasyDialogs.AskFileForOpen(message='Select file with aeut/aete resource:') if not filename: sys.exit(0) ! processfile(filename) ! def processfile(fullname): """Process all resources in a single file""" cur = CurResFile() --- 31,48 ---- processfile(filename) else: ! # The dialogOptionFlags below allows selection of .app bundles. ! filename = EasyDialogs.AskFileForOpen( ! message='Select scriptable application', ! dialogOptionFlags=0x1056) if not filename: sys.exit(0) ! try: ! processfile(filename) ! except MacOS.Error, arg: ! print "Error getting terminology:", arg ! print "Retry, manually parsing resources" ! processfile_fromresource(filename) ! def processfile_fromresource(fullname): """Process all resources in a single file""" cur = CurResFile() *************** *** 61,64 **** --- 73,92 ---- compileaetelist(aetelist, fullname) + def processfile(fullname): + """Ask an application for its terminology and process that""" + aedescobj, launched = OSATerminology.GetSysTerminology(fullname) + if launched: + print "Launched", fullname + raw = aetools.unpack(aedescobj) + if not raw: + print 'Unpack returned empty value:', raw + return + if not raw[0].data: + print 'Unpack returned value without data:', raw + return + aedata = raw[0] + aete = decode(aedata.data) + compileaete(aete, None, fullname) + def compileaetelist(aetelist, fullname): for aete, resinfo in aetelist: *************** *** 241,250 **** packagename = packagename[:27] pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename, ! defaultLocation=DEFAULT_PACKAGEFOLDER) if not pathname: return packagename = os.path.split(os.path.normpath(pathname))[1] basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)', ! defaultLocation=DEFAULT_PACKAGEFOLDER) if basepkgname: dirname, basepkgname = os.path.split(os.path.normpath(basepkgname)) --- 269,278 ---- packagename = packagename[:27] pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename, ! defaultLocation=DEFAULT_USER_PACKAGEFOLDER) if not pathname: return packagename = os.path.split(os.path.normpath(pathname))[1] basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)', ! defaultLocation=DEFAULT_STANDARD_PACKAGEFOLDER) if basepkgname: dirname, basepkgname = os.path.split(os.path.normpath(basepkgname)) *************** *** 908,910 **** main() sys.exit(1) - print identify('for') --- 936,937 ---- From tim_one@users.sourceforge.net Thu Mar 6 23:42:00 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:42:00 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv7889/Lib/email Modified Files: Header.py Log Message: Repaired a misleading comment Barry inherited from me. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Header.py 6 Mar 2003 20:33:04 -0000 1.21 --- Header.py 6 Mar 2003 23:41:58 -0000 1.22 *************** *** 497,501 **** i = m else: ! # m is not acceptable, so final i must be < j. j = m - 1 # i == j. Invariant #1 implies that splittable[:i] fits, and --- 497,501 ---- i = m else: ! # m is not acceptable, so final i must be < m. j = m - 1 # i == j. Invariant #1 implies that splittable[:i] fits, and From rhettinger@users.sourceforge.net Thu Mar 6 23:54:29 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:54:29 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11840/Doc/lib Modified Files: libstdtypes.tex Log Message: SF patch #693753: fix for bug 639806: default for dict.pop (contributed by Michael Stone.) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** libstdtypes.tex 5 Mar 2003 14:42:09 -0000 1.119 --- libstdtypes.tex 6 Mar 2003 23:54:27 -0000 1.120 *************** *** 1105,1111 **** 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} --- 1105,1112 ---- else \var{x} (also setting it)} {(5)} ! \lineiii{\var{a}.pop(\var{k}\optional{, \var{x}})} ! {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, ! else \var{x} (and remove k)} ! {(8)} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} *************** *** 1156,1159 **** --- 1157,1163 ---- \item[(7)] \function{fromkeys()} is a class method that returns a new dictionary. \var{value} defaults to \code{None}. \versionadded{2.3} + + \item[(8)] \function{pop()} raises a \exception{KeyError} when no default + value is given and the key is not found. \versionadded{2.3} \end{description} From rhettinger@users.sourceforge.net Thu Mar 6 23:54:29 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:54:29 -0800 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11840/Lib Modified Files: UserDict.py Log Message: SF patch #693753: fix for bug 639806: default for dict.pop (contributed by Michael Stone.) Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** UserDict.py 31 Jan 2003 03:30:09 -0000 1.23 --- UserDict.py 6 Mar 2003 23:54:27 -0000 1.24 *************** *** 56,61 **** self[key] = failobj return self[key] ! def pop(self, key): ! return self.data.pop(key) def popitem(self): return self.data.popitem() --- 56,61 ---- self[key] = failobj return self[key] ! def pop(self, key, *args): ! return self.data.pop(key, *args) def popitem(self): return self.data.popitem() *************** *** 118,123 **** self[key] = default return default ! def pop(self, key): ! value = self[key] del self[key] return value --- 118,131 ---- self[key] = default return default ! def pop(self, key, *args): ! if len(args) > 1: ! raise TypeError, "pop expected at most 2 arguments, got "\ ! + repr(1 + len(args)) ! try: ! value = self[key] ! except KeyError: ! if args: ! return args[0] ! raise del self[key] return value From rhettinger@users.sourceforge.net Thu Mar 6 23:54:30 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:54:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.46,1.47 test_userdict.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11840/Lib/test Modified Files: test_types.py test_userdict.py Log Message: SF patch #693753: fix for bug 639806: default for dict.pop (contributed by Michael Stone.) Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test_types.py 23 Feb 2003 23:11:41 -0000 1.46 --- test_types.py 6 Mar 2003 23:54:27 -0000 1.47 *************** *** 644,650 **** x = 4503599627370496L y = 4503599627370496 ! h = {x: 'anything', y: 'something else'} if h[x] != h[y]: raise TestFailed, "long/int key should match" d[1] = 1 --- 644,654 ---- x = 4503599627370496L y = 4503599627370496 ! h = {x: 'anything', y: 'something else'} if h[x] != h[y]: raise TestFailed, "long/int key should match" + + if d.pop(k, v) != v: raise TestFailed, "{}.pop(k, v) doesn't return default value" + d[k] = v + if d.pop(k, 1) != v: raise TestFailed, "{}.pop(k, v) doesn't find known key/value pair" d[1] = 1 Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_userdict.py 19 Jan 2003 23:26:59 -0000 1.12 --- test_userdict.py 6 Mar 2003 23:54:27 -0000 1.13 *************** *** 140,143 **** --- 140,146 ---- self.assertEqual(t.pop("x"), 42) self.assertRaises(KeyError, t.pop, "x") + self.assertEqual(t.pop("x", 1), 1) + t["x"] = 42 + self.assertEqual(t.pop("x", 1), 42) # Test popitem *************** *** 243,246 **** --- 246,252 ---- self.assert_(10 not in s) s[10] = 'ten' + self.assertEqual(s.pop("x", 1), 1) + s["x"] = 42 + self.assertEqual(s.pop("x", 1), 42) # popitem From rhettinger@users.sourceforge.net Thu Mar 6 23:54:30 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:54:30 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.690,1.691 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv11840/Misc Modified Files: NEWS Log Message: SF patch #693753: fix for bug 639806: default for dict.pop (contributed by Michael Stone.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.690 retrieving revision 1.691 diff -C2 -d -r1.690 -r1.691 *** NEWS 6 Mar 2003 01:56:12 -0000 1.690 --- NEWS 6 Mar 2003 23:54:27 -0000 1.691 *************** *** 13,16 **** --- 13,22 ---- ----------------- + - dict.pop now takes an optional argument specifying a default + value to return if the key is not in the dict. If a default is not + given and the key is not found, a KeyError will still be raised. + Parallel changes were made to UserDict.UserDict and UserDict.DictMixin. + [SF patch #693753] (contributed by Michael Stone.) + - sys.getfilesystemencoding() was added to expose Py_FileSystemDefaultEncoding. From rhettinger@users.sourceforge.net Thu Mar 6 23:54:31 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 15:54:31 -0800 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.140,2.141 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11840/Objects Modified Files: dictobject.c Log Message: SF patch #693753: fix for bug 639806: default for dict.pop (contributed by Michael Stone.) Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.140 retrieving revision 2.141 diff -C2 -d -r2.140 -r2.141 *** dictobject.c 15 Feb 2003 14:45:12 -0000 2.140 --- dictobject.c 6 Mar 2003 23:54:28 -0000 2.141 *************** *** 1545,1555 **** 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"); --- 1545,1562 ---- static PyObject * ! dict_pop(dictobject *mp, PyObject *args) { long hash; dictentry *ep; PyObject *old_value, *old_key; + PyObject *key, *deflt = NULL; + if(!PyArg_UnpackTuple(args, "pop", 1, 2, &key, &deflt)) + return NULL; if (mp->ma_used == 0) { + if (deflt) { + Py_INCREF(deflt); + return deflt; + } PyErr_SetString(PyExc_KeyError, "pop(): dictionary is empty"); *************** *** 1564,1567 **** --- 1571,1578 ---- ep = (mp->ma_lookup)(mp, key, hash); if (ep->me_value == NULL) { + if (deflt) { + Py_INCREF(deflt); + return deflt; + } PyErr_SetObject(PyExc_KeyError, key); return NULL; *************** *** 1720,1724 **** PyDoc_STRVAR(pop__doc__, ! "D.pop(k) -> v, remove specified key and return the corresponding value"); PyDoc_STRVAR(popitem__doc__, --- 1731,1736 ---- PyDoc_STRVAR(pop__doc__, ! "D.pop(k[,d]) -> v, remove specified key and return the corresponding value\n\ ! If key is not found, d is returned if given, otherwise KeyError is raised"); PyDoc_STRVAR(popitem__doc__, *************** *** 1764,1768 **** {"setdefault", (PyCFunction)dict_setdefault, METH_VARARGS, setdefault_doc__}, ! {"pop", (PyCFunction)dict_pop, METH_O, pop__doc__}, {"popitem", (PyCFunction)dict_popitem, METH_NOARGS, --- 1776,1780 ---- {"setdefault", (PyCFunction)dict_setdefault, METH_VARARGS, setdefault_doc__}, ! {"pop", (PyCFunction)dict_pop, METH_VARARGS, pop__doc__}, {"popitem", (PyCFunction)dict_popitem, METH_NOARGS, From rhettinger@users.sourceforge.net Fri Mar 7 00:21:45 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 06 Mar 2003 16:21:45 -0800 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv21419 Modified Files: pep-0290.txt Log Message: Add advisory to replace apply(). Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0290.txt 25 Jan 2003 20:30:02 -0000 1.8 --- pep-0290.txt 7 Mar 2003 00:21:42 -0000 1.9 *************** *** 117,120 **** --- 117,133 ---- string1.find(string2) != -1 --> string2 in string1 + Replace apply() with a Direct Function Call + ''''''''''''''''''''''''''''''''''''''''''' + + In Python 2.3, apply() was marked for Pending Deprecation because it + was made obsolete by the Python 1.6's introduction of * and ** in + function calls. Using a direct function call was always a little + faster than apply() because it saved the lookup for the builtin. + Now, apply() is even slower due to its use of the warnings module. + + Pattern:: + + apply(f,args, kwds) --> f(*args, **kwds) + Python 2.2 or Later From montanaro@users.sourceforge.net Fri Mar 7 00:47:43 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 06 Mar 2003 16:47:43 -0800 Subject: [Python-checkins] python/dist/src/Tools/scripts pickle2db.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv29642 Modified Files: pickle2db.py Log Message: fix name of db2pickle Index: pickle2db.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pickle2db.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pickle2db.py 3 Feb 2003 15:28:23 -0000 1.2 --- pickle2db.py 7 Mar 2003 00:47:40 -0000 1.3 *************** *** 12,16 **** Note that recno databases can only contain numeric keys, so you can't dump a ! hash or btree database using bsddb2pickle.py and reconstitute it to a recno database with %(prog)s. """ --- 12,16 ---- Note that recno databases can only contain numeric keys, so you can't dump a ! hash or btree database using db2pickle.py and reconstitute it to a recno database with %(prog)s. """ From gvanrossum@users.sourceforge.net Fri Mar 7 01:33:20 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 06 Mar 2003 17:33:20 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13342 Modified Files: timeit.py Log Message: Broke down and made it work for Python 2.0 and up. (Older versions would have required refraining from using string methods -- too painful.) Changed the -s option so that multiple -s options are cumulative. Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** timeit.py 6 Mar 2003 16:11:17 -0000 1.5 --- timeit.py 7 Mar 2003 01:33:18 -0000 1.6 *************** *** 1,3 **** ! """Framework for measuring execution time for small code snippets. This module avoids a number of common traps for measuring execution --- 1,3 ---- ! """Tool for measuring execution time of small code snippets. This module avoids a number of common traps for measuring execution *************** *** 13,17 **** -n/--number N: how many times to execute 'statement' (default: see below) -r/--repeat N: how many times to repeat the timer (default 1) ! -s/--setup S: statements executed once before 'statement' (default 'pass') -t/--time: use time.time() (default on Unix) -c/--clock: use time.clock() (default on Windows) --- 13,17 ---- -n/--number N: how many times to execute 'statement' (default: see below) -r/--repeat N: how many times to repeat the timer (default 1) ! -s/--setup S: statement to be executed once initially (default 'pass') -t/--time: use time.time() (default on Unix) -c/--clock: use time.clock() (default on Windows) *************** *** 21,25 **** A multi-line statement may be given by specifying each line as a separate argument; indented lines are possible by enclosing an ! argument in quotes and using leading spaces. If -n is not given, a suitable number of loops is calculated by trying --- 21,26 ---- A multi-line statement may be given by specifying each line as a separate argument; indented lines are possible by enclosing an ! argument in quotes and using leading spaces. Multiple -s options are ! treated similarly. If -n is not given, a suitable number of loops is calculated by trying *************** *** 38,62 **** Note: there is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should ! be aware of it (especially when comparing different versions of ! Python). The baseline overhead is measured by invoking the program ! without arguments. ! """ ! ! # To use this module with older versions of Python, the dependency on ! # the itertools module is easily removed; in the template, instead of ! # itertools.repeat(None, number), use [None]*number. It's barely ! # slower. Note: the baseline overhead, measured by the default ! # invocation, differs for older Python versions! Also, to fairly ! # compare older Python versions to Python 2.3, you may want to use ! # python -O for the older versions to avoid timing SET_LINENO ! # instructions. ! # XXX Maybe for convenience of comparing with previous Python versions, ! # itertools.repeat() should not be used at all? import sys import math import time ! import itertools __all__ = ["Timer"] --- 39,59 ---- Note: there is a certain baseline overhead associated with executing a pass statement. The code here doesn't try to hide it, but you should ! be aware of it. The baseline overhead can be measured by invoking the ! program without arguments. ! The baseline overhead differs between Python versions! Also, to ! fairly compare older Python versions to Python 2.3, you may want to ! use python -O for the older versions to avoid timing SET_LINENO ! instructions. ! """ import sys import math import time ! try: ! import itertools ! except ImportError: ! # Must be an older Python version (see timeit() below) ! itertools = None __all__ = ["Timer"] *************** *** 76,82 **** # being indented 8 spaces. template = """ ! def inner(number, timer): %(setup)s - seq = itertools.repeat(None, number) t0 = timer() for i in seq: --- 73,78 ---- # being indented 8 spaces. template = """ ! def inner(seq, timer): %(setup)s t0 = timer() for i in seq: *************** *** 127,131 **** the timer function to be used are passed to the constructor. """ ! return self.inner(number, self.timer) def repeat(self, repeat=default_repeat, number=default_number): --- 123,131 ---- the timer function to be used are passed to the constructor. """ ! if itertools: ! seq = itertools.repeat(None, number) ! else: ! seq = [None] * number ! return self.inner(seq, self.timer) def repeat(self, repeat=default_repeat, number=default_number): *************** *** 178,182 **** stmt = "\n".join(args) or "pass" number = 0 # auto-determine ! setup = "pass" repeat = 1 for o, a in opts: --- 178,182 ---- stmt = "\n".join(args) or "pass" number = 0 # auto-determine ! setup = [] repeat = 1 for o, a in opts: *************** *** 184,188 **** number = int(a) if o in ("-s", "--setup"): ! setup = a if o in ("-r", "--repeat"): repeat = int(a) --- 184,188 ---- number = int(a) if o in ("-s", "--setup"): ! setup.append(a) if o in ("-r", "--repeat"): repeat = int(a) *************** *** 196,199 **** --- 196,200 ---- print __doc__, return 0 + setup = "\n".join(setup) or "pass" t = Timer(stmt, setup, timer) if number == 0: From jackjansen@users.sourceforge.net Fri Mar 7 12:47:09 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 04:47:09 -0800 Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10715 Modified Files: tarfile.py Log Message: Test that os.utime and os.chmod actually exist before using them. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tarfile.py 19 Feb 2003 12:51:34 -0000 1.3 --- tarfile.py 7 Mar 2003 12:47:06 -0000 1.4 *************** *** 1514,1525 **** """Set file permissions of targetpath according to tarinfo. """ ! try: ! os.chmod(targetpath, tarinfo.mode) ! except EnvironmentError, e: ! raise ExtractError, "could not change mode" def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. """ if sys.platform == "win32" and tarinfo.isdir(): # According to msdn.microsoft.com, it is an error (EACCES) --- 1514,1528 ---- """Set file permissions of targetpath according to tarinfo. """ ! if hasattr(os, 'chmod'): ! try: ! os.chmod(targetpath, tarinfo.mode) ! except EnvironmentError, e: ! raise ExtractError, "could not change mode" def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. """ + if not hasattr(os, 'utime'): + return if sys.platform == "win32" and tarinfo.isdir(): # According to msdn.microsoft.com, it is an error (EACCES) From jackjansen@users.sourceforge.net Fri Mar 7 12:50:48 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 04:50:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_tarfile.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12208 Modified Files: test_tarfile.py Log Message: Two fixes to make this test pass on MacOS9: - the test was sloppy about filenames: "0-REGTYPE-TEXT" was used where the archive held "/0-REGTYPE-TEXT". - tarfile extracts all files in binary mode, but the test expected to be able to read and compare text files in text mode. Use universal text mode. Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_tarfile.py 19 Feb 2003 02:41:43 -0000 1.4 --- test_tarfile.py 7 Mar 2003 12:50:45 -0000 1.5 *************** *** 75,79 **** if self.sep != "|": f1 = self.tar.extractfile("S-SPARSE") ! f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS") self.assert_(f1.read() == f2.read(), "_FileObject failed on sparse file member") --- 75,79 ---- if self.sep != "|": f1 = self.tar.extractfile("S-SPARSE") ! f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS") self.assert_(f1.read() == f2.read(), "_FileObject failed on sparse file member") *************** *** 83,89 **** """ if self.sep != "|": ! filename = "0-REGTYPE-TEXT" self.tar.extract(filename, dirname()) ! lines1 = file(os.path.join(dirname(), filename), "r").readlines() lines2 = self.tar.extractfile(filename).readlines() self.assert_(lines1 == lines2, --- 83,89 ---- """ if self.sep != "|": ! filename = "/0-REGTYPE-TEXT" self.tar.extract(filename, dirname()) ! lines1 = file(os.path.join(dirname(), filename), "rU").readlines() lines2 = self.tar.extractfile(filename).readlines() self.assert_(lines1 == lines2, *************** *** 94,98 **** """ if self.sep != "|": ! filename = "0-REGTYPE" self.tar.extract(filename, dirname()) data = file(os.path.join(dirname(), filename), "rb").read() --- 94,98 ---- """ if self.sep != "|": ! filename = "/0-REGTYPE" self.tar.extract(filename, dirname()) data = file(os.path.join(dirname(), filename), "rb").read() From jackjansen@users.sourceforge.net Fri Mar 7 13:27:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 05:27:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_tarfile.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25149 Modified Files: test_tarfile.py Log Message: The filename fix of the previous checkin was complete bogus, the problem is elsewhere. Retracting. Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_tarfile.py 7 Mar 2003 12:50:45 -0000 1.5 --- test_tarfile.py 7 Mar 2003 13:27:53 -0000 1.6 *************** *** 75,79 **** if self.sep != "|": f1 = self.tar.extractfile("S-SPARSE") ! f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS") self.assert_(f1.read() == f2.read(), "_FileObject failed on sparse file member") --- 75,79 ---- if self.sep != "|": f1 = self.tar.extractfile("S-SPARSE") ! f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS") self.assert_(f1.read() == f2.read(), "_FileObject failed on sparse file member") *************** *** 83,87 **** """ if self.sep != "|": ! filename = "/0-REGTYPE-TEXT" self.tar.extract(filename, dirname()) lines1 = file(os.path.join(dirname(), filename), "rU").readlines() --- 83,87 ---- """ if self.sep != "|": ! filename = "0-REGTYPE-TEXT" self.tar.extract(filename, dirname()) lines1 = file(os.path.join(dirname(), filename), "rU").readlines() *************** *** 94,98 **** """ if self.sep != "|": ! filename = "/0-REGTYPE" self.tar.extract(filename, dirname()) data = file(os.path.join(dirname(), filename), "rb").read() --- 94,98 ---- """ if self.sep != "|": ! filename = "0-REGTYPE" self.tar.extract(filename, dirname()) data = file(os.path.join(dirname(), filename), "rb").read() From jackjansen@users.sourceforge.net Fri Mar 7 13:37:34 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 05:37:34 -0800 Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28936 Modified Files: tarfile.py Log Message: Make tarfile raise ImportError on MacOS9. The pathname handling needs work, and I don't have time to fix it. I'll file a bug report. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tarfile.py 7 Mar 2003 12:47:06 -0000 1.4 --- tarfile.py 7 Mar 2003 13:37:32 -0000 1.5 *************** *** 51,54 **** --- 51,61 ---- import struct + if sys.platform == 'mac': + # This module needs work for MacOS9, especially in the area of pathname + # handling. In many places it is assumed a simple substitution of / by the + # local os.path.sep is good enough to convert pathnames, but this does not + # work with the mac rooted:path:name versus :nonrooted:path:name syntax + raise ImportError, "tarfile does not work for platform==mac" + try: import grp, pwd From fdrake@users.sourceforge.net Fri Mar 7 15:02:09 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:02:09 -0800 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv31561 Modified Files: newtypes.tex Log Message: Minor clarification about the ob_size field. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** newtypes.tex 10 Feb 2003 19:18:21 -0000 1.21 --- newtypes.tex 7 Mar 2003 15:02:03 -0000 1.22 *************** *** 462,468 **** 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 --- 462,468 ---- 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 instance structure is variable-length (for ! example, the structure for 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 From gvanrossum@users.sourceforge.net Fri Mar 7 15:13:49 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:13:49 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.691,1.692 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv3464/Misc Modified Files: NEWS Log Message: - The extended type structure used for heap types (new-style classes defined by Python code using a class statement) is now exported from object.h as PyHeapTypeObject. (SF patch #696193.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.691 retrieving revision 1.692 diff -C2 -d -r1.691 -r1.692 *** NEWS 6 Mar 2003 23:54:27 -0000 1.691 --- NEWS 7 Mar 2003 15:13:06 -0000 1.692 *************** *** 81,85 **** ----- ! TBD New platforms --- 81,87 ---- ----- ! - The extended type structure used for heap types (new-style ! classes defined by Python code using a class statement) is now ! exported from object.h as PyHeapTypeObject. (SF patch #696193.) New platforms From gvanrossum@users.sourceforge.net Fri Mar 7 15:13:50 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:13:50 -0800 Subject: [Python-checkins] python/dist/src/Include object.h,2.112,2.113 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv3464/Include Modified Files: object.h Log Message: - The extended type structure used for heap types (new-style classes defined by Python code using a class statement) is now exported from object.h as PyHeapTypeObject. (SF patch #696193.) Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.112 retrieving revision 2.113 diff -C2 -d -r2.112 -r2.113 *** object.h 17 Nov 2002 17:52:44 -0000 2.112 --- object.h 7 Mar 2003 15:13:16 -0000 2.113 *************** *** 328,331 **** --- 328,353 ---- + /* The *real* layout of a type object when allocated on the heap */ + typedef struct _heaptypeobject { + /* Note: there's a dependency on the order of these members + in slotptr() in typeobject.c . */ + PyTypeObject type; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, + so that the mapping wins when both + the mapping and the sequence define + a given operator (e.g. __getitem__). + see add_operators() in typeobject.c . */ + PyBufferProcs as_buffer; + PyObject *name, *slots; + /* here are optional user slots, followed by the members. */ + } PyHeapTypeObject; + + /* access macro to the members which are floating "behind" the object */ + #define PyHeapType_GET_MEMBERS(etype) \ + ((PyMemberDef *)(((char *)etype) + (etype)->type.ob_type->tp_basicsize)) + + /* Generic type check */ PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); From gvanrossum@users.sourceforge.net Fri Mar 7 15:13:52 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:13:52 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.214,2.215 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv3464/Objects Modified Files: typeobject.c Log Message: - The extended type structure used for heap types (new-style classes defined by Python code using a class statement) is now exported from object.h as PyHeapTypeObject. (SF patch #696193.) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.214 retrieving revision 2.215 diff -C2 -d -r2.214 -r2.215 *** typeobject.c 21 Feb 2003 22:02:54 -0000 2.214 --- typeobject.c 7 Mar 2003 15:13:17 -0000 2.215 *************** *** 6,27 **** #include - /* The *real* layout of a type object when allocated on the heap */ - /* XXX Should we publish this in a header file? */ - typedef struct { - /* Note: there's a dependency on the order of these members - in slotptr() below. */ - PyTypeObject type; - PyNumberMethods as_number; - PyMappingMethods as_mapping; - PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, - so that the mapping wins when both - the mapping and the sequence define - a given operator (e.g. __getitem__). - see add_operators() below. */ - PyBufferProcs as_buffer; - PyObject *name, *slots; - PyMemberDef members[1]; - } etype; - static PyMemberDef type_members[] = { {"__basicsize__", T_INT, offsetof(PyTypeObject,tp_basicsize),READONLY}, --- 6,9 ---- *************** *** 43,47 **** if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! etype* et = (etype*)type; Py_INCREF(et->name); --- 25,29 ---- if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! PyHeapTypeObject* et = (PyHeapTypeObject*)type; Py_INCREF(et->name); *************** *** 61,65 **** type_set_name(PyTypeObject *type, PyObject *value, void *context) { ! etype* et; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { --- 43,47 ---- type_set_name(PyTypeObject *type, PyObject *value, void *context) { ! PyHeapTypeObject* et; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { *************** *** 86,90 **** } ! et = (etype*)type; Py_INCREF(value); --- 68,72 ---- } ! et = (PyHeapTypeObject*)type; Py_INCREF(value); *************** *** 450,454 **** { PyObject *obj; ! const size_t size = _PyObject_VAR_SIZE(type, nitems); if (PyType_IS_GC(type)) --- 432,437 ---- { PyObject *obj; ! const size_t size = _PyObject_VAR_SIZE(type, nitems+1); ! /* note that we need to add one, for the sentinel */ if (PyType_IS_GC(type)) *************** *** 490,494 **** n = type->ob_size; ! mp = ((etype *)type)->members; for (i = 0; i < n; i++, mp++) { if (mp->type == T_OBJECT_EX) { --- 473,477 ---- n = type->ob_size; ! mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type); for (i = 0; i < n; i++, mp++) { if (mp->type == T_OBJECT_EX) { *************** *** 555,559 **** n = type->ob_size; ! mp = ((etype *)type)->members; for (i = 0; i < n; i++, mp++) { if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) { --- 538,542 ---- n = type->ob_size; ! mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type); for (i = 0; i < n; i++, mp++) { if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) { *************** *** 1535,1539 **** PyObject *slots, *tmp, *newslots; PyTypeObject *type, *base, *tmptype, *winner; ! etype *et; PyMemberDef *mp; int i, nbases, nslots, slotoffset, add_dict, add_weak; --- 1518,1522 ---- PyObject *slots, *tmp, *newslots; PyTypeObject *type, *base, *tmptype, *winner; ! PyHeapTypeObject *et; PyMemberDef *mp; int i, nbases, nslots, slotoffset, add_dict, add_weak; *************** *** 1650,1654 **** /* Are slots allowed? */ nslots = PyTuple_GET_SIZE(slots); ! if (nslots > 0 && base->tp_itemsize != 0) { PyErr_Format(PyExc_TypeError, "nonempty __slots__ " --- 1633,1638 ---- /* Are slots allowed? */ nslots = PyTuple_GET_SIZE(slots); ! if (nslots > 0 && base->tp_itemsize != 0 && !PyType_Check(base)) { ! /* for the special case of meta types, allow slots */ PyErr_Format(PyExc_TypeError, "nonempty __slots__ " *************** *** 1771,1775 **** /* Keep name and slots alive in the extended type object */ ! et = (etype *)type; Py_INCREF(name); et->name = name; --- 1755,1759 ---- /* Keep name and slots alive in the extended type object */ ! et = (PyHeapTypeObject *)type; Py_INCREF(name); et->name = name; *************** *** 1851,1855 **** /* Add descriptors for custom slots from __slots__, or for __dict__ */ ! mp = et->members; slotoffset = base->tp_basicsize; if (slots != NULL) { --- 1835,1839 ---- /* Add descriptors for custom slots from __slots__, or for __dict__ */ ! mp = PyHeapType_GET_MEMBERS(et); slotoffset = base->tp_basicsize; if (slots != NULL) { *************** *** 1883,1887 **** type->tp_basicsize = slotoffset; type->tp_itemsize = base->tp_itemsize; ! type->tp_members = et->members; if (type->tp_weaklistoffset && type->tp_dictoffset) --- 1867,1871 ---- type->tp_basicsize = slotoffset; type->tp_itemsize = base->tp_itemsize; ! type->tp_members = PyHeapType_GET_MEMBERS(et); if (type->tp_weaklistoffset && type->tp_dictoffset) *************** *** 2053,2057 **** type_dealloc(PyTypeObject *type) { ! etype *et; /* Assert this is a heap-allocated type object */ --- 2037,2041 ---- type_dealloc(PyTypeObject *type) { ! PyHeapTypeObject *et; /* Assert this is a heap-allocated type object */ *************** *** 2059,2063 **** _PyObject_GC_UNTRACK(type); PyObject_ClearWeakRefs((PyObject *)type); ! et = (etype *)type; Py_XDECREF(type->tp_base); Py_XDECREF(type->tp_dict); --- 2043,2047 ---- _PyObject_GC_UNTRACK(type); PyObject_ClearWeakRefs((PyObject *)type); ! et = (PyHeapTypeObject *)type; Py_XDECREF(type->tp_base); Py_XDECREF(type->tp_dict); *************** *** 2135,2139 **** /* There's no need to visit type->tp_subclasses or ! ((etype *)type)->slots, because they can't be involved in cycles; tp_subclasses is a list of weak references, and slots is a tuple of strings. */ --- 2119,2123 ---- /* There's no need to visit type->tp_subclasses or ! ((PyHeapTypeObject *)type)->slots, because they can't be involved in cycles; tp_subclasses is a list of weak references, and slots is a tuple of strings. */ *************** *** 2181,2185 **** lists have their own tp_clear. ! slots (in etype): A tuple of strings can't be part of a cycle. */ --- 2165,2169 ---- lists have their own tp_clear. ! slots (in PyHeapTypeObject): A tuple of strings can't be part of a cycle. */ *************** *** 2202,2206 **** 0, /* ob_size */ "type", /* tp_name */ ! sizeof(etype), /* tp_basicsize */ sizeof(PyMemberDef), /* tp_itemsize */ (destructor)type_dealloc, /* tp_dealloc */ --- 2186,2190 ---- 0, /* ob_size */ "type", /* tp_name */ ! sizeof(PyHeapTypeObject), /* tp_basicsize */ sizeof(PyMemberDef), /* tp_itemsize */ (destructor)type_dealloc, /* tp_dealloc */ *************** *** 4687,4693 **** /* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper ! functions. The offsets here are relative to the 'etype' structure, which ! incorporates the additional structures used for numbers, sequences and ! 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 --- 4671,4678 ---- /* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper ! functions. The offsets here are relative to the 'PyHeapTypeObject' ! structure, which incorporates the additional structures used for numbers, ! sequences and 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 *************** *** 4715,4719 **** PyDoc_STR(DOC), FLAGS} #define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ! {NAME, offsetof(etype, SLOT), (void *)(FUNCTION), WRAPPER, \ PyDoc_STR(DOC)} #define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ --- 4700,4704 ---- PyDoc_STR(DOC), FLAGS} #define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ! {NAME, offsetof(PyHeapTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ PyDoc_STR(DOC)} #define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ *************** *** 4929,4946 **** char *ptr; ! /* Note: this depends on the order of the members of etype! */ assert(offset >= 0); ! assert(offset < offsetof(etype, as_buffer)); ! if (offset >= offsetof(etype, as_sequence)) { ptr = (void *)type->tp_as_sequence; ! offset -= offsetof(etype, as_sequence); } ! else if (offset >= offsetof(etype, as_mapping)) { ptr = (void *)type->tp_as_mapping; ! offset -= offsetof(etype, as_mapping); } ! else if (offset >= offsetof(etype, as_number)) { ptr = (void *)type->tp_as_number; ! offset -= offsetof(etype, as_number); } else { --- 4914,4931 ---- char *ptr; ! /* Note: this depends on the order of the members of PyHeapTypeObject! */ assert(offset >= 0); ! assert(offset < offsetof(PyHeapTypeObject, as_buffer)); ! if (offset >= offsetof(PyHeapTypeObject, as_sequence)) { ptr = (void *)type->tp_as_sequence; ! offset -= offsetof(PyHeapTypeObject, as_sequence); } ! else if (offset >= offsetof(PyHeapTypeObject, as_mapping)) { ptr = (void *)type->tp_as_mapping; ! offset -= offsetof(PyHeapTypeObject, as_mapping); } ! else if (offset >= offsetof(PyHeapTypeObject, as_number)) { ptr = (void *)type->tp_as_number; ! offset -= offsetof(PyHeapTypeObject, as_number); } else { *************** *** 5217,5223 **** In the latter case, the first slotdef entry encoutered wins. Since ! slotdef entries are sorted by the offset of the slot in the etype ! struct, this gives us some control over disambiguating between ! competing slots: the members of struct etype are listed from most general to least general, so the most general slot is preferred. In particular, because as_mapping comes before as_sequence, for a type --- 5202,5208 ---- In the latter case, the first slotdef entry encoutered wins. Since ! slotdef entries are sorted by the offset of the slot in the ! PyHeapTypeObject, this gives us some control over disambiguating ! between competing slots: the members of PyHeapTypeObject are listed from most general to least general, so the most general slot is preferred. In particular, because as_mapping comes before as_sequence, for a type From bwarsaw@users.sourceforge.net Fri Mar 7 15:35:51 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:35:51 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv13009 Modified Files: test_email.py Log Message: test_string_headerinst_eq(): Another Jason test :) Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** test_email.py 6 Mar 2003 20:31:02 -0000 1.33 --- test_email.py 7 Mar 2003 15:35:47 -0000 1.34 *************** *** 781,784 **** --- 781,798 ---- """) + def test_string_headerinst_eq(self): + h = '<15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> (David Bremner\'s message of "Thu, 6 Mar 2003 13:58:21 +0100")' + msg = Message() + msg['Received-1'] = Header(h, header_name='Received-1', + continuation_ws='\t') + msg['Received-2'] = h + self.assertEqual(msg.as_string(), """\ + Received-1: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> + (David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") + Received-2: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> + (David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") + + """) + From jackjansen@users.sourceforge.net Fri Mar 7 15:35:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:35:55 -0800 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandalone.mcp,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory sc8-pr-cvs1:/tmp/cvs-serv13004 Modified Files: PythonStandalone.mcp Log Message: Got PythonStandalone to work again, mainly for debugging purposes (it's much easier to debug GUSI errors in a static build). Index: PythonStandalone.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandalone.mcp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 Binary files /tmp/cvscDx7iL and /tmp/cvsQhFyAn differ From jackjansen@users.sourceforge.net Fri Mar 7 15:36:16 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:36:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_nscarbon_config.h,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory sc8-pr-cvs1:/tmp/cvs-serv13278 Modified Files: mwerks_nscarbon_config.h Log Message: Got PythonStandalone to work again, mainly for debugging purposes (it's much easier to debug GUSI errors in a static build). Index: mwerks_nscarbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_nscarbon_config.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mwerks_nscarbon_config.h 23 Jun 2002 22:09:45 -0000 1.9 --- mwerks_nscarbon_config.h 7 Mar 2003 15:36:13 -0000 1.10 *************** *** 11,24 **** #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ #define USE_GUSI ! /* #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 */ #define USE_QT /* Include quicktime modules in core Python */ #define USE_WASTE /* Include waste module in core Python */ ! /* #define USE_MACSPEECH /* Include macspeech module in core Python */ ! #define USE_IMG /* Include img modules in core Python */ ! /* #define USE_MACCTB /* Include ctb module in core Python */ ! /* #define USE_TK /* Include _tkinter module in core Python */ ! /* #define MAC_TCL /* This *must* be on if USE_TK is on */ /* #define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ /* #define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ --- 11,20 ---- #define USE_GUSI2 /* Stdio implemented with GUSI 2 */ #define USE_GUSI ! #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 */ #define USE_QT /* Include quicktime modules in core Python */ #define USE_WASTE /* Include waste module in core Python */ ! /* #define USE_IMG /* Include img modules in core Python */ /* #define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ /* #define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ *************** *** 28,31 **** --- 24,31 ---- #define USE_IC /* Include Internet Config module */ #define USE_PYEXPAT /* Include Pyexpat module */ + #define XML_NS 1 + #define XML_DTD 1 + #define BYTEORDER 4321 + #define XML_CONTEXT_BYTES 1024 #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ #ifndef USE_MSL_MALLOC From tim_one@users.sourceforge.net Fri Mar 7 15:36:47 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:36:47 -0800 Subject: [Python-checkins] python/dist/src/Lib tarfile.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13161/python/Lib Modified Files: tarfile.py Log Message: Somebody must not have run the test before checking this in -- it had a fatal tab/space inconsistency under -tt. Index: tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tarfile.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tarfile.py 7 Mar 2003 13:37:32 -0000 1.5 --- tarfile.py 7 Mar 2003 15:36:41 -0000 1.6 *************** *** 1531,1535 **** """ if not hasattr(os, 'utime'): ! return if sys.platform == "win32" and tarinfo.isdir(): # According to msdn.microsoft.com, it is an error (EACCES) --- 1531,1535 ---- """ if not hasattr(os, 'utime'): ! return if sys.platform == "win32" and tarinfo.isdir(): # According to msdn.microsoft.com, it is an error (EACCES) From jackjansen@users.sourceforge.net Fri Mar 7 15:36:56 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:36:56 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac macostools.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv13521 Modified Files: macostools.py Log Message: Filter out macfs warning. Index: macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/macostools.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** macostools.py 28 Jan 2003 23:53:40 -0000 1.2 --- macostools.py 7 Mar 2003 15:36:49 -0000 1.3 *************** *** 67,70 **** --- 67,72 ---- """Tell the finder a file has changed. No-op on MacOSX.""" if sys.platform != 'mac': return + import warnings + warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) import macfs file_fss = macfs.FSSpec(dst) From jackjansen@users.sourceforge.net Fri Mar 7 15:37:34 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:37:34 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules Nav.c,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13860 Modified Files: Nav.c Log Message: Removed unused variable Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Nav.c 17 Jan 2003 23:13:03 -0000 1.23 --- Nav.c 7 Mar 2003 15:37:31 -0000 1.24 *************** *** 114,118 **** PyObject *rv; Boolean c_rv = false; - PyObject theItemCopy; if (!dict) return false; --- 114,117 ---- From jackjansen@users.sourceforge.net Fri Mar 7 15:38:18 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:38:18 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14219 Modified Files: regrtest.py Log Message: Test_ioctl and test_tarfile are skipped on MacOS9. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** regrtest.py 4 Mar 2003 00:26:38 -0000 1.133 --- regrtest.py 7 Mar 2003 15:38:11 -0000 1.134 *************** *** 631,634 **** --- 631,635 ---- test_grp test_iconv_codecs + test_ioctl test_imgfile test_largefile *************** *** 652,655 **** --- 653,657 ---- test_sunaudiodev test_sundry + test_tarfile test_timing test_unicode_file From bwarsaw@users.sourceforge.net Fri Mar 7 15:39:43 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:39:43 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv15067 Modified Files: Header.py Log Message: More internal refinements of the ascii splitting algorithm. _encode_chunks(): Pass maxlinelen in instead of always using self._maxlinelen, so we can adjust for shorter initial lines. Pass this value through to _max_append(). encode(): Weave maxlinelen through to the _encode_chunks() call. _split_ascii(): When recursively splitting a line on spaces (i.e. lower level syntactic split), don't append the whole returned string. Instead, split it on linejoiners and extend the lines up to the last line (for proper packing). Calculate the linelen based on the last element in the this list. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Header.py 6 Mar 2003 23:41:58 -0000 1.22 --- Header.py 7 Mar 2003 15:39:37 -0000 1.23 *************** *** 343,347 **** return zip(lines, [charset]*len(lines)) ! def _encode_chunks(self, newchunks): # MIME-encode a header with many different charsets and/or encodings. # --- 343,347 ---- return zip(lines, [charset]*len(lines)) ! def _encode_chunks(self, newchunks, maxlinelen): # MIME-encode a header with many different charsets and/or encodings. # *************** *** 368,372 **** else: s = charset.header_encode(header) ! _max_append(chunks, s, self._maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) --- 368,372 ---- else: s = charset.header_encode(header) ! _max_append(chunks, s, maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) *************** *** 408,416 **** lastchunk, lastcharset = newchunks[-1] lastlen = lastcharset.encoded_header_len(lastchunk) ! return self._encode_chunks(newchunks) def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): lines = [] maxlen = firstlen --- 408,417 ---- lastchunk, lastcharset = newchunks[-1] lastlen = lastcharset.encoded_header_len(lastchunk) ! return self._encode_chunks(newchunks, maxlinelen) def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): + linejoiner = '\n' + continuation_ws lines = [] maxlen = firstlen *************** *** 461,469 **** # on whitespace. if partlen > maxlen and ch <> ' ': ! this = [_split_ascii(part, maxlen, restlen, ! continuation_ws, ' ')] else: this = [part] ! linelen = wslen + partlen maxlen = restlen else: --- 462,473 ---- # on whitespace. if partlen > maxlen and ch <> ' ': ! subs = _split_ascii(part, maxlen, restlen, ! continuation_ws, ' ') ! subl = re.split(linejoiner, subs) ! lines.extend(subl[:-1]) ! this = [subl[-1]] else: this = [part] ! linelen = wslen + len(this[-1]) maxlen = restlen else: *************** *** 473,477 **** if this: lines.append(joiner.join(this)) - linejoiner = '\n' + continuation_ws return linejoiner.join(lines) --- 477,480 ---- From bwarsaw@users.sourceforge.net Fri Mar 7 15:43:23 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:43:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv17098 Modified Files: Generator.py Log Message: _write_headers(), _split_header(): All of the smarts for splitting long header lines is now (properly) in the Header class. So we no longer need _split_header() and we'll just defer to Header.encode() when we have a plain string. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Generator.py 6 Mar 2003 05:22:02 -0000 1.18 --- Generator.py 7 Mar 2003 15:43:17 -0000 1.19 *************** *** 162,202 **** def _write_headers(self, msg): for h, v in msg.items(): ! # RFC 2822 says that lines SHOULD be no more than maxheaderlen ! # characters wide, so we're well within our rights to split long ! # headers. ! text = '%s: %s' % (h, v) ! if self.__maxheaderlen > 0 and len(text) > self.__maxheaderlen: ! text = self._split_header(text) ! print >> self._fp, text # A blank line always separates headers from body print >> self._fp - - def _split_header(self, text): - maxheaderlen = self.__maxheaderlen - # Find out whether any lines in the header are really longer than - # maxheaderlen characters wide. There could be continuation lines - # that actually shorten it. Also, replace hard tabs with 8 spaces. - lines = [s.replace('\t', SPACE8) for s in text.splitlines()] - for line in lines: - if len(line) > maxheaderlen: - break - else: - # No line was actually longer than maxheaderlen characters, so - # just return the original unchanged. - return text - # If we have raw 8bit data in a byte string, we have no idea what the - # encoding is. I think there is no safe way to split this string. If - # it's ascii-subset, then we could do a normal ascii split, but if - # it's multibyte then we could break the string. There's no way to - # know so the least harm seems to be to not split the string and risk - # it being too long. - if _is8bitstring(text): - return text - # The `text' argument already has the field name prepended, so don't - # provide it here or the first line will get folded too short. - h = Header(text, maxlinelen=maxheaderlen, - # For backwards compatibility, we use a hard tab here - continuation_ws='\t') - return h.encode() # --- 162,187 ---- def _write_headers(self, msg): for h, v in msg.items(): ! print >> self._fp, '%s:' % h, ! if self.__maxheaderlen == 0: ! # Explicit no-wrapping ! print >> self._fp, v ! elif isinstance(v, Header): ! # Header instances know what to do ! print >> self._fp, v.encode() ! elif _is8bitstring(v): ! # If we have raw 8bit data in a byte string, we have no idea ! # what the encoding is. There is no safe way to split this ! # string. If it's ascii-subset, then we could do a normal ! # ascii split, but if it's multibyte then we could break the ! # string. There's no way to know so the least harm seems to ! # be to not split the string and risk it being too long. ! print >> self._fp, v ! else: ! # Header's got lots of smarts, so use it. ! print >> self._fp, Header( ! v, maxlinelen=self.__maxheaderlen, ! header_name=h, continuation_ws='\t').encode() # A blank line always separates headers from body print >> self._fp # From montanaro@users.sourceforge.net Fri Mar 7 15:45:19 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:45:19 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.127,1.128 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv18019 Modified Files: whatsnew23.tex Log Message: Add a little more verbiage about the bsddb module/package change. It's clear from recent discussions on c.l.py that people are a bit confused about the differences between the old bsddb, the new bssdb, the bsddb3/PyBSDDB package and changes to file formats. Tried to clarify the issues. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** whatsnew23.tex 2 Mar 2003 02:31:58 -0000 1.127 --- whatsnew23.tex 7 Mar 2003 15:45:15 -0000 1.128 *************** *** 1267,1271 **** \module{bsddb} package is intended to be compatible with the old module, so be sure to file bugs if you discover any ! incompatibilities. \item The Distutils \class{Extension} class now supports --- 1267,1278 ---- \module{bsddb} package is intended to be compatible with the old module, so be sure to file bugs if you discover any ! incompatibilities. When upgrading to Python 2.3, if you also change ! the underlying BerkeleyDB library, you will almost certainly have to ! convert your database files to the new version. You can do this ! fairly easily with the new scripts \file{db2pickle.py} and ! \file{pickle2db.py} which you will find in the distribution's ! Tools/scripts directory. If you've already been using the PyBSDDB ! package, importing it as \module{bsddb3}, you will have to change your ! \code{import} statements. \item The Distutils \class{Extension} class now supports From theller@python.net Fri Mar 7 15:50:59 2003 From: theller@python.net (Thomas Heller) Date: 07 Mar 2003 16:50:59 +0100 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.691,1.692 In-Reply-To: References: Message-ID: gvanrossum@users.sourceforge.net writes: > Update of /cvsroot/python/python/dist/src/Misc > In directory sc8-pr-cvs1:/tmp/cvs-serv3464/Misc > > Modified Files: > NEWS > Log Message: > - The extended type structure used for heap types (new-style > classes defined by Python code using a class statement) is now > exported from object.h as PyHeapTypeObject. (SF patch #696193.) If I understand correctly, this adds no new behaviour but new possibilities for extension programmers. True? If so, it would really be nice if it would be backported to 2.2.x. Thomas From tim_one@users.sourceforge.net Fri Mar 7 15:55:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:55:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_dis.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22717 Modified Files: test_dis.py Log Message: This test relied on significant trailing whitespace in a string literal. Evil. Index: test_dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dis.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_dis.py 27 Feb 2003 21:27:07 -0000 1.1 --- test_dis.py 7 Mar 2003 15:55:36 -0000 1.2 *************** *** 11,26 **** # line numbers in dis_f def _f(a): ! print a ! return 1 dis_f = """\ 13 0 LOAD_FAST 0 (a) ! 3 PRINT_ITEM ! 4 PRINT_NEWLINE 14 5 LOAD_CONST 1 (1) ! 8 RETURN_VALUE 9 LOAD_CONST 0 (None) ! 12 RETURN_VALUE """ --- 11,26 ---- # line numbers in dis_f def _f(a): ! print a ! return 1 dis_f = """\ 13 0 LOAD_FAST 0 (a) ! 3 PRINT_ITEM ! 4 PRINT_NEWLINE 14 5 LOAD_CONST 1 (1) ! 8 RETURN_VALUE 9 LOAD_CONST 0 (None) ! 12 RETURN_VALUE """ *************** *** 44,48 **** dis.dis(_f) sys.stdout = save_stdout ! self.assertEqual(dis_f, s.getvalue()) def test_main(): --- 44,53 ---- dis.dis(_f) sys.stdout = save_stdout ! got = s.getvalue() ! # Trim trailing blanks (if any). ! lines = got.split('\n') ! lines = [line.rstrip() for line in lines] ! got = '\n'.join(lines) ! self.assertEqual(dis_f, got) def test_main(): From bwarsaw@users.sourceforge.net Fri Mar 7 15:58:53 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 07:58:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv25158 Modified Files: test_email.py Log Message: whitespace normalization Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** test_email.py 7 Mar 2003 15:35:47 -0000 1.34 --- test_email.py 7 Mar 2003 15:58:51 -0000 1.35 *************** *** 773,781 **** self.assertEqual(msg.as_string(), """\ Received-1: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by ! hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; ! Wed, 05 Mar 2003 18:10:18 -0700 Received-2: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by ! hrothgar.la.mastaler.com (tmda-ofmipd) with ESMTP; ! Wed, 05 Mar 2003 18:10:18 -0700 """) --- 773,781 ---- self.assertEqual(msg.as_string(), """\ Received-1: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by ! \throthgar.la.mastaler.com (tmda-ofmipd) with ESMTP; ! \tWed, 05 Mar 2003 18:10:18 -0700 Received-2: from FOO.TLD (vizworld.acl.foo.tld [123.452.678.9]) by ! \throthgar.la.mastaler.com (tmda-ofmipd) with ESMTP; ! \tWed, 05 Mar 2003 18:10:18 -0700 """) *************** *** 789,795 **** self.assertEqual(msg.as_string(), """\ Received-1: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> ! (David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") Received-2: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> ! (David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") """) --- 789,795 ---- self.assertEqual(msg.as_string(), """\ Received-1: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> ! \t(David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") Received-2: <15975.17901.207240.414604@sgigritzmann1.mathematik.tu-muenchen.de> ! \t(David Bremner's message of "Thu, 6 Mar 2003 13:58:21 +0100") """) From tim_one@users.sourceforge.net Fri Mar 7 17:30:53 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 07 Mar 2003 09:30:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_plistlib.py,1.1,1.2 test_ucn.py,1.12,1.13 test_unicodedata.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv6619/python/Lib/test Modified Files: test_plistlib.py test_ucn.py test_unicodedata.py Log Message: Whitespace normalization. Index: test_plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_plistlib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_plistlib.py 25 Feb 2003 12:58:58 -0000 1.1 --- test_plistlib.py 7 Mar 2003 17:30:47 -0000 1.2 *************** *** 38,42 **** pl['aDate'] = plistlib.Date(time.mktime(time.gmtime())) return pl ! def test_create(self): pl = self._create() --- 38,42 ---- pl['aDate'] = plistlib.Date(time.mktime(time.gmtime())) return pl ! def test_create(self): pl = self._create() *************** *** 48,52 **** pl.write(test_support.TESTFN) pl2 = plistlib.Plist.fromFile(test_support.TESTFN) ! self.assertEqual(dict(pl), dict(pl2)) --- 48,52 ---- pl.write(test_support.TESTFN) pl2 = plistlib.Plist.fromFile(test_support.TESTFN) ! self.assertEqual(dict(pl), dict(pl2)) Index: test_ucn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_ucn.py 26 Feb 2003 14:49:38 -0000 1.12 --- test_ucn.py 7 Mar 2003 17:30:48 -0000 1.13 *************** *** 16,20 **** def checkletter(self, name, code): # Helper that put all \N escapes inside eval'd raw strings, ! # to make sure this script runs even if the compiler # chokes on \N escapes res = eval(ur'u"\N{%s}"' % name) --- 16,20 ---- def checkletter(self, name, code): # Helper that put all \N escapes inside eval'd raw strings, ! # to make sure this script runs even if the compiler # chokes on \N escapes res = eval(ur'u"\N{%s}"' % name) Index: test_unicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicodedata.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_unicodedata.py 26 Feb 2003 14:49:39 -0000 1.7 --- test_unicodedata.py 7 Mar 2003 17:30:48 -0000 1.8 *************** *** 192,196 **** def test_digit_numeric_consistent(self): # Test that digit and numeric are consistent, ! # i.e. if a character has a digit value, # it's numeric value should be the same. count = 0 --- 192,196 ---- def test_digit_numeric_consistent(self): # Test that digit and numeric are consistent, ! # i.e. if a character has a digit value, # it's numeric value should be the same. count = 0 From tim_one@users.sourceforge.net Fri Mar 7 17:31:20 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 07 Mar 2003 09:31:20 -0800 Subject: [Python-checkins] python/dist/src/Lib dis.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6619/python/Lib Modified Files: dis.py Log Message: Whitespace normalization. Index: dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** dis.py 27 Feb 2003 21:29:27 -0000 1.45 --- dis.py 7 Mar 2003 17:30:45 -0000 1.46 *************** *** 132,174 **** def disassemble_string(code, lasti=-1, varnames=None, names=None, constants=None): ! labels = findlabels(code) ! n = len(code) ! i = 0 ! while i < n: ! c = code[i] ! op = ord(c) ! if op == opmap['SET_LINENO'] and i > 0: ! print # Extra blank line ! if i == lasti: print '-->', ! else: print ' ', ! if i in labels: print '>>', ! else: print ' ', ! print `i`.rjust(4), ! print opname[op].ljust(15), ! i = i+1 ! if op >= HAVE_ARGUMENT: ! oparg = ord(code[i]) + ord(code[i+1])*256 ! i = i+2 ! print `oparg`.rjust(5), ! if op in hasconst: ! if constants: ! print '(' + `constants[oparg]` + ')', ! else: ! print '(%d)'%oparg, ! elif op in hasname: ! if names is not None: ! print '(' + names[oparg] + ')', ! else: ! print '(%d)'%oparg, ! elif op in hasjrel: ! print '(to ' + `i + oparg` + ')', ! elif op in haslocal: ! if varnames: ! print '(' + varnames[oparg] + ')', ! else: ! print '(%d)' % oparg, ! elif op in hascompare: ! print '(' + cmp_op[oparg] + ')', ! print disco = disassemble # XXX For backwards compatibility --- 132,174 ---- def disassemble_string(code, lasti=-1, varnames=None, names=None, constants=None): ! labels = findlabels(code) ! n = len(code) ! i = 0 ! while i < n: ! c = code[i] ! op = ord(c) ! if op == opmap['SET_LINENO'] and i > 0: ! print # Extra blank line ! if i == lasti: print '-->', ! else: print ' ', ! if i in labels: print '>>', ! else: print ' ', ! print `i`.rjust(4), ! print opname[op].ljust(15), ! i = i+1 ! if op >= HAVE_ARGUMENT: ! oparg = ord(code[i]) + ord(code[i+1])*256 ! i = i+2 ! print `oparg`.rjust(5), ! if op in hasconst: ! if constants: ! print '(' + `constants[oparg]` + ')', ! else: ! print '(%d)'%oparg, ! elif op in hasname: ! if names is not None: ! print '(' + names[oparg] + ')', ! else: ! print '(%d)'%oparg, ! elif op in hasjrel: ! print '(to ' + `i + oparg` + ')', ! elif op in haslocal: ! if varnames: ! print '(' + varnames[oparg] + ')', ! else: ! print '(%d)' % oparg, ! elif op in hascompare: ! print '(' + cmp_op[oparg] + ')', ! print disco = disassemble # XXX For backwards compatibility From tim_one@users.sourceforge.net Fri Mar 7 17:31:21 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 07 Mar 2003 09:31:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/compiler transformer.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv6619/python/Lib/compiler Modified Files: transformer.py Log Message: Whitespace normalization. Index: transformer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** transformer.py 3 Jan 2003 10:25:20 -0000 1.36 --- transformer.py 7 Mar 2003 17:30:47 -0000 1.37 *************** *** 143,147 **** node = node[1] n = node[0] ! if n == symbol.single_input: return self.single_input(node[1:]) --- 143,147 ---- node = node[1] n = node[0] ! if n == symbol.single_input: return self.single_input(node[1:]) From guido@python.org Fri Mar 7 17:44:56 2003 From: guido@python.org (Guido van Rossum) Date: Fri, 07 Mar 2003 12:44:56 -0500 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.691,1.692 In-Reply-To: "Your message of 07 Mar 2003 16:50:59 +0100." References: Message-ID: <200303071744.h27HiuD23061@pcp02138704pcs.reston01.va.comcast.net> > > Modified Files: > > NEWS > > Log Message: > > - The extended type structure used for heap types (new-style > > classes defined by Python code using a class statement) is now > > exported from object.h as PyHeapTypeObject. (SF patch #696193.) > > If I understand correctly, this adds no new behaviour but new > possibilities for extension programmers. True? > If so, it would really be nice if it would be backported to 2.2.x. If you would do the honors, that's fine with me. --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@users.sourceforge.net Fri Mar 7 21:10:25 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 07 Mar 2003 13:10:25 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_popen.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17046/Lib/test Modified Files: test_popen.py Log Message: Don't quote the path to Python unless the path contains an embedded space. Quoting the path doesn't work on Win2K (cmd.exe) regardless, this is just a hack to let the test pass again on Win2K (so long as Python isn't installed in a path that does contain an embedded space). On Win2K it looks like we'd also have to add a second pair of double quotes, around the entire command line. Index: test_popen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_popen.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_popen.py 24 Feb 2003 15:26:39 -0000 1.4 --- test_popen.py 7 Mar 2003 21:10:21 -0000 1.5 *************** *** 15,20 **** # 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 = '"%s" -c "import sys;print sys.argv" %s' % (sys.executable, cmdline) data = popen(cmd).read() got = eval(data)[1:] # strip off argv[0] --- 15,23 ---- # 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. + python = sys.executable + if ' ' in python: + python = '"' + python + '"' # quote embedded space for cmdline def _do_test_commandline(cmdline, expected): ! cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline) data = popen(cmd).read() got = eval(data)[1:] # strip off argv[0] From theller@python.net Fri Mar 7 21:43:21 2003 From: theller@python.net (Thomas Heller) Date: 07 Mar 2003 22:43:21 +0100 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.691,1.692 In-Reply-To: <200303071744.h27HiuD23061@pcp02138704pcs.reston01.va.comcast.net> References: <200303071744.h27HiuD23061@pcp02138704pcs.reston01.va.comcast.net> Message-ID: Guido van Rossum writes: > > > Modified Files: > > > NEWS > > > Log Message: > > > - The extended type structure used for heap types (new-style > > > classes defined by Python code using a class statement) is now > > > exported from object.h as PyHeapTypeObject. (SF patch #696193.) > > [me] > > If I understand correctly, this adds no new behaviour but new > > possibilities for extension programmers. True? > > If so, it would really be nice if it would be backported to 2.2.x. > > If you would do the honors, that's fine with me. > I'm afraid I don't have time for it. Christian, do you have a patch ready for the 2.2 branch? Thomas From bwarsaw@users.sourceforge.net Fri Mar 7 22:45:58 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 14:45:58 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv27382 Modified Files: test_email.py Log Message: test_rfc2231_no_language_or_charset(): RFC 2231 allows leaving out both the charset and language without including any single quotes. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_email.py 7 Mar 2003 15:58:51 -0000 1.35 --- test_email.py 7 Mar 2003 22:45:55 -0000 1.36 *************** *** 2547,2550 **** --- 2547,2561 ---- eq(msg.get_content_charset(), 'us-ascii') + def test_rfc2231_no_language_or_charset(self): + m = '''\ + Content-Transfer-Encoding: 8bit + Content-Disposition: inline; filename="file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm" + Content-Type: text/html; NAME*0=file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEM; NAME*1=P_nsmail.htm + + ''' + msg = email.message_from_string(m) + self.assertEqual(msg.get_param('NAME'), + (None, None, 'file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm')) + From bwarsaw@users.sourceforge.net Fri Mar 7 22:46:44 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 14:46:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv27678 Modified Files: Utils.py Log Message: decode_rfc2231(): RFC 2231 allows leaving out both the charset and language without including any single quotes. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Utils.py 5 Nov 2002 19:54:21 -0000 1.21 --- Utils.py 7 Mar 2003 22:46:41 -0000 1.22 *************** *** 281,287 **** """Decode string according to RFC 2231""" import urllib ! charset, language, s = s.split("'", 2) ! s = urllib.unquote(s) ! return charset, language, s --- 281,289 ---- """Decode string according to RFC 2231""" import urllib ! parts = s.split("'", 2) ! if len(parts) == 1: ! return None, None, s ! charset, language, s = parts ! return charset, language, urllib.unquote(s) *************** *** 336,340 **** value.append(continuation) charset, language, value = decode_rfc2231(EMPTYSTRING.join(value)) ! new_params.append((name, ! (charset, language, '"%s"' % quote(value)))) return new_params --- 338,342 ---- value.append(continuation) charset, language, value = decode_rfc2231(EMPTYSTRING.join(value)) ! new_params.append( ! (name, (charset, language, '"%s"' % quote(value)))) return new_params From bwarsaw@users.sourceforge.net Fri Mar 7 23:23:07 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 15:23:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv11458 Modified Files: test_email.py Log Message: test_long_unbreakable_lines_with_continuation(): Another funky example from Jason Mastaler :) Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_email.py 7 Mar 2003 22:45:55 -0000 1.36 --- test_email.py 7 Mar 2003 23:23:04 -0000 1.37 *************** *** 795,798 **** --- 795,814 ---- """) + def test_long_unbreakable_lines_with_continuation(self): + eq = self.ndiffAssertEqual + msg = Message() + t = """\ + iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 + locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp""" + msg['Face-1'] = t + msg['Face-2'] = Header(t, header_name='Face-2') + eq(msg.as_string(), """\ + Face-1: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 + \tlocQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp + Face-2: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUAAAAkHiJeRUIcGBi9 + locQDQ4zJykFBAXJfWDjAAACYUlEQVR4nF2TQY/jIAyFc6lydlG5x8Nyp1Y69wj1PN2I5gzp + + """) + From bwarsaw@users.sourceforge.net Fri Mar 7 23:24:37 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 07 Mar 2003 15:24:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv12181 Modified Files: Header.py Log Message: _split_ascii(): lstrip the individual lines in the ascii split lines, since we'll be adding our own continuation whitespace later. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Header.py 7 Mar 2003 15:39:37 -0000 1.23 --- Header.py 7 Mar 2003 23:24:34 -0000 1.24 *************** *** 417,420 **** --- 417,423 ---- maxlen = firstlen for line in s.splitlines(): + # Ignore any leading whitespace (i.e. continuation whitespace) already + # on the line, since we'll be adding our own. + line = line.lstrip() if len(line) < maxlen: lines.append(line) From loewis@users.sourceforge.net Sat Mar 8 10:25:34 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 08 Mar 2003 02:25:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode_file.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25398 Modified Files: test_unicode_file.py Log Message: Skip the test if TESTFN_ENCODING is None. Fixes #699386. Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_unicode_file.py 3 Oct 2002 05:10:38 -0000 1.6 --- test_unicode_file.py 8 Mar 2003 10:25:31 -0000 1.7 *************** *** 5,26 **** from test.test_support import verify, TestSkipped, TESTFN_UNICODE try: ! from test.test_support import TESTFN_ENCODING ! oldlocale = None ! except ImportError: ! import locale ! # try to run the test in an UTF-8 locale. If this locale is not ! # available, avoid running the test since the locale's encoding ! # might not support TESTFN_UNICODE. Likewise, if the system does ! # not support locale.CODESET, Unicode file semantics is not ! # available, either. ! oldlocale = locale.setlocale(locale.LC_CTYPE) ! try: ! locale.setlocale(locale.LC_CTYPE,"en_US.UTF-8") ! TESTFN_ENCODING = locale.nl_langinfo(locale.CODESET) ! except (locale.Error, AttributeError): ! raise TestSkipped("No Unicode filesystem semantics on this platform.") ! ! TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) # Check with creation as Unicode string. --- 5,15 ---- from test.test_support import verify, TestSkipped, TESTFN_UNICODE + from test.test_support import TESTFN_ENCODING try: ! TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) ! except (ImportError, TypeError): ! # Either the file system encoding is None, or the file name ! # cannot be encoded in the file system encoding. ! raise TestSkipped("No Unicode filesystem semantics on this platform.") # Check with creation as Unicode string. *************** *** 105,108 **** os.rmdir(abs_encoded) print "All the Unicode tests appeared to work" - if oldlocale: - locale.setlocale(locale.LC_CTYPE, oldlocale) --- 94,95 ---- From jvr@users.sourceforge.net Sat Mar 8 19:50:40 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 08 Mar 2003 11:50:40 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze freeze.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv26611 Modified Files: freeze.py Log Message: [ 684677 ] Allow freeze to exclude implicits Index: freeze.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** freeze.py 11 Sep 2002 20:36:00 -0000 1.42 --- freeze.py 8 Mar 2003 19:50:38 -0000 1.43 *************** *** 131,137 **** fail_import = exclude[:] - # modules that are imported by the Python runtime - implicits = ["site", "exceptions"] - # output files frozen_c = 'frozen.c' --- 131,134 ---- *************** *** 202,205 **** --- 199,208 ---- f,r = a.split("=", 2) replace_paths.append( (f,r) ) + + # modules that are imported by the Python runtime + implicits = [] + for module in ('site', 'exceptions',): + if module not in exclude: + implicits.append(module) # default prefix and exec_prefix From theller@python.net Sat Mar 8 21:13:09 2003 From: theller@python.net (Thomas Heller) Date: 08 Mar 2003 22:13:09 +0100 Subject: [Python-checkins] python/dist/src/Tools/freeze freeze.py,1.42,1.43 In-Reply-To: References: Message-ID: jvr@users.sourceforge.net writes: > Update of /cvsroot/python/python/dist/src/Tools/freeze > In directory sc8-pr-cvs1:/tmp/cvs-serv26611 > > Modified Files: > freeze.py > Log Message: > [ 684677 ] Allow freeze to exclude implicits > > Index: freeze.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v > + # modules that are imported by the Python runtime > + implicits = [] > + for module in ('site', 'exceptions',): ^^^^^^^^^^^ Isn't this a relict from the times when exceptions was *not* a builtin module (1.5, iirc)? > + if module not in exclude: > + implicits.append(module) > > # default prefix and exec_prefix > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins From just@letterror.com Sat Mar 8 21:21:40 2003 From: just@letterror.com (Just van Rossum) Date: Sat, 8 Mar 2003 22:21:40 +0100 Subject: [Python-checkins] python/dist/src/Tools/freeze freeze.py,1.42,1.43 In-Reply-To: Message-ID: Thomas Heller wrote: > > + # modules that are imported by the Python runtime > > + implicits = [] > > + for module in ('site', 'exceptions',): > ^^^^^^^^^^^ > > Isn't this a relict from the times when exceptions was *not* > a builtin module (1.5, iirc)? Good point, I think 'exceptions' should be replaced with 'warnings'... Just From rhettinger@users.sourceforge.net Sun Mar 9 05:33:34 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 21:33:34 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.692,1.693 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26947/Misc Modified Files: NEWS Log Message: SF 698520: Iterator for urllib.URLOpener Contributed by Brett Cannon. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.692 retrieving revision 1.693 diff -C2 -d -r1.692 -r1.693 *** NEWS 7 Mar 2003 15:13:06 -0000 1.692 --- NEWS 9 Mar 2003 05:33:32 -0000 1.693 *************** *** 47,50 **** --- 47,53 ---- ------- + - The urllib module now offers support for the iterator protocol. + SF patch 698520 contributed by Brett Cannon. + - New module timeit provides a simple framework for timing the execution speed of expressions and statements. From rhettinger@users.sourceforge.net Sun Mar 9 05:33:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 21:33:35 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26947/Doc/lib Modified Files: liburllib.tex Log Message: SF 698520: Iterator for urllib.URLOpener Contributed by Brett Cannon. Index: liburllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** liburllib.tex 22 Oct 2002 21:58:06 -0000 1.44 --- liburllib.tex 9 Mar 2003 05:33:32 -0000 1.45 *************** *** 28,32 **** supports the following methods: \method{read()}, \method{readline()}, \method{readlines()}, \method{fileno()}, \method{close()}, ! \method{info()} and \method{geturl()}. Except for the \method{info()} and \method{geturl()} methods, --- 28,33 ---- supports the following methods: \method{read()}, \method{readline()}, \method{readlines()}, \method{fileno()}, \method{close()}, ! \method{info()} and \method{geturl()}. It also has proper support for ! the iterator protocol. Except for the \method{info()} and \method{geturl()} methods, From rhettinger@users.sourceforge.net Sun Mar 9 05:33:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 21:33:35 -0800 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.154,1.155 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv26947/Lib Modified Files: urllib.py Log Message: SF 698520: Iterator for urllib.URLOpener Contributed by Brett Cannon. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** urllib.py 27 Feb 2003 20:14:43 -0000 1.154 --- urllib.py 9 Mar 2003 05:33:33 -0000 1.155 *************** *** 781,784 **** --- 781,788 ---- if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno + if hasattr(self.fp, "__iter__"): + self.__iter__ = self.fp.__iter__ + if hasattr(self.fp, "next"): + self.next = self.fp.next def __repr__(self): From rhettinger@users.sourceforge.net Sun Mar 9 07:05:17 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:05:17 -0800 Subject: [Python-checkins] python/dist/src/Lib weakref.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14516/Lib Modified Files: weakref.py Log Message: SF patch #667730: More DictMixin * Adds missing pop() methods to weakref.py * Expands test suite to broaden coverage of objects with a mapping interface. Contributed by Sebastien Keim. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** weakref.py 16 Jul 2002 21:35:23 -0000 1.18 --- weakref.py 9 Mar 2003 07:05:13 -0000 1.19 *************** *** 102,105 **** --- 102,117 ---- return key, o + def pop(self, key, *args): + try: + o = self.data.pop(key)() + except KeyError: + if args: + return args[0] + raise + if o is None: + raise KeyError, key + else: + return o + def setdefault(self, key, default): try: *************** *** 225,228 **** --- 237,243 ---- if o is not None: return o, value + + def pop(self, key, *args): + return self.data.pop(ref(key), *args) def setdefault(self, key, default): From rhettinger@users.sourceforge.net Sun Mar 9 07:05:17 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:05:17 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.13,1.14 test_shelve.py,1.2,1.3 test_userdict.py,1.13,1.14 test_weakref.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14516/Lib/test Modified Files: test_os.py test_shelve.py test_userdict.py test_weakref.py Log Message: SF patch #667730: More DictMixin * Adds missing pop() methods to weakref.py * Expands test suite to broaden coverage of objects with a mapping interface. Contributed by Sebastien Keim. Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_os.py 22 Aug 2002 19:40:33 -0000 1.13 --- test_os.py 9 Mar 2003 07:05:13 -0000 1.14 *************** *** 186,193 **** --- 186,211 ---- pass + from test_userdict import TestMappingProtocol + + class EnvironTests(TestMappingProtocol): + """check that os.environ object conform to mapping protocol""" + _tested_class = None + def _reference(self): + return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"} + def _empty_mapping(self): + os.environ.clear() + return os.environ + def setUp(self): + self.__save = dict(os.environ) + os.environ.clear() + def tearDown(self): + os.environ.clear() + os.environ.update(self.__save) + def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TemporaryFileTests)) suite.addTest(unittest.makeSuite(StatAttributeTests)) + suite.addTest(unittest.makeSuite(EnvironTests)) run_suite(suite) Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_shelve.py 24 Dec 2002 18:31:27 -0000 1.2 --- test_shelve.py 9 Mar 2003 07:05:14 -0000 1.3 *************** *** 44,50 **** self.assertNotEqual(d1, d2) ! def test_main(): ! test_support.run_unittest(TestCase) if __name__ == "__main__": --- 44,95 ---- self.assertNotEqual(d1, d2) ! from test_userdict import TestMappingProtocol + class TestShelveBase(TestMappingProtocol): + fn = "shelftemp.db" + counter = 0 + def __init__(self, *args, **kw): + self._db = [] + TestMappingProtocol.__init__(self, *args, **kw) + _tested_class = shelve.Shelf + def _reference(self): + return {"key1":"value1", "key2":2, "key3":(1,2,3)} + def _empty_mapping(self): + if self._in_mem: + x= shelve.Shelf({}, binary = self._binary) + else: + self.counter+=1 + x= shelve.open(self.fn+str(self.counter), binary=self._binary) + self._db.append(x) + return x + def tearDown(self): + for db in self._db: + db.close() + self._db = [] + if not self._in_mem: + for f in glob.glob(self.fn+"*"): + os.unlink(f) + + class TestAsciiFileShelve(TestShelveBase): + _binary = False + _in_mem = False + class TestBinaryFileShelve(TestShelveBase): + _binary = True + _in_mem = False + class TestAsciiMemShelve(TestShelveBase): + _binary = False + _in_mem = True + class TestBinaryMemShelve(TestShelveBase): + _binary = True + _in_mem = True + + def test_main(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestAsciiFileShelve)) + suite.addTest(unittest.makeSuite(TestBinaryFileShelve)) + suite.addTest(unittest.makeSuite(TestAsciiMemShelve)) + suite.addTest(unittest.makeSuite(TestBinaryMemShelve)) + suite.addTest(unittest.makeSuite(TestCase)) + test_support.run_suite(suite) if __name__ == "__main__": Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_userdict.py 6 Mar 2003 23:54:27 -0000 1.13 --- test_userdict.py 9 Mar 2003 07:05:14 -0000 1.14 *************** *** 5,8 **** --- 5,125 ---- import UserDict + class TestMappingProtocol(unittest.TestCase): + # This base class can be used to check that an object conforms to the + # mapping protocol + + # Functions that can be useful to override to adapt to dictionary + # semantics + _tested_class = dict # which class is being tested + + def _reference(self): + """Return a dictionary of values which are invariant by storage + in the object under test.""" + return {1:2, "key1":"value1", "key2":(1,2,3)} + def _empty_mapping(self): + """Return an empty mapping object""" + return self._tested_class() + def _full_mapping(self, data): + """Return a mapping object with the value contained in data + dictionary""" + x = self._empty_mapping() + for key, value in data.items(): + x[key] = value + return x + + def __init__(self, *args, **kw): + unittest.TestCase.__init__(self, *args, **kw) + self.reference = self._reference().copy() + key, value = self.reference.popitem() + self.other = {key:value} + + def test_read(self): + # Test for read only operations on mapping + p = self._empty_mapping() + p1 = dict(p) #workaround for singleton objects + d = self._full_mapping(self.reference) + if d is p: + p = p1 + #Indexing + for key, value in self.reference.items(): + self.assertEqual(d[key], value) + knownkey = self.other.keys()[0] + self.failUnlessRaises(KeyError, lambda:d[knownkey]) + #len + self.assertEqual(len(p), 0) + self.assertEqual(len(d), len(self.reference)) + #has_key + for k in self.reference: + self.assert_(d.has_key(k)) + self.assert_(k in d) + for k in self.other: + self.failIf(d.has_key(k)) + self.failIf(k in d) + #cmp + self.assertEqual(cmp(p,p), 0) + self.assertEqual(cmp(d,d), 0) + self.assertEqual(cmp(p,d), -1) + self.assertEqual(cmp(d,p), 1) + #__non__zero__ + if p: self.fail("Empty mapping must compare to False") + if not d: self.fail("Full mapping must compare to True") + # keys(), items(), iterkeys() ... + def check_iterandlist(iter, lst, ref): + self.assert_(hasattr(iter, 'next')) + self.assert_(hasattr(iter, '__iter__')) + x = list(iter) + x.sort() + lst.sort() + ref.sort() + self.assert_(x==lst==ref) + check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys()) + check_iterandlist(iter(d), d.keys(), self.reference.keys()) + check_iterandlist(d.itervalues(), d.values(), self.reference.values()) + check_iterandlist(d.iteritems(), d.items(), self.reference.items()) + #get + key, value = d.iteritems().next() + knownkey, knownvalue = self.other.iteritems().next() + self.assertEqual(d.get(key, knownvalue), value) + self.assertEqual(d.get(knownkey, knownvalue), knownvalue) + self.failIf(knownkey in d) + + def test_write(self): + # Test for write operations on mapping + p = self._empty_mapping() + #Indexing + for key, value in self.reference.items(): + p[key] = value + self.assertEqual(p[key], value) + for key in self.reference.keys(): + del p[key] + self.failUnlessRaises(KeyError, lambda:p[key]) + p = self._empty_mapping() + #update + p.update(self.reference) + self.assertEqual(dict(p), self.reference) + d = self._full_mapping(self.reference) + #setdefaullt + key, value = d.iteritems().next() + knownkey, knownvalue = self.other.iteritems().next() + self.assertEqual(d.setdefault(key, knownvalue), value) + self.assertEqual(d[key], value) + self.assertEqual(d.setdefault(knownkey, knownvalue), knownvalue) + self.assertEqual(d[knownkey], knownvalue) + #pop + self.assertEqual(d.pop(knownkey), knownvalue) + self.failIf(knownkey in d) + self.assertRaises(KeyError, d.pop, knownkey) + default = 909 + d[knownkey] = knownvalue + self.assertEqual(d.pop(knownkey, default), knownvalue) + self.failIf(knownkey in d) + self.assertEqual(d.pop(knownkey, default), default) + #popitem + key, value = d.popitem() + self.failIf(key in d) + self.assertEqual(value, self.reference[key]) + p=self._empty_mapping() + self.assertRaises(KeyError, p.popitem) + d0 = {} d1 = {"one": 1} *************** *** 12,16 **** d5 = {"one": 1, "two": 1} ! class UserDictTest(unittest.TestCase): def test_all(self): # Test constructors --- 129,135 ---- d5 = {"one": 1, "two": 1} ! class UserDictTest(TestMappingProtocol): ! _tested_class = UserDict.IterableUserDict ! def test_all(self): # Test constructors *************** *** 183,187 **** return list(self.keylist) ! class UserDictMixinTest(unittest.TestCase): def test_all(self): ## Setup test and verify working of the test class --- 302,308 ---- return list(self.keylist) ! class UserDictMixinTest(TestMappingProtocol): ! _tested_class = SeqDict ! def test_all(self): ## Setup test and verify working of the test class *************** *** 276,279 **** --- 397,401 ---- def test_main(): suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestMappingProtocol)) suite.addTest(unittest.makeSuite(UserDictTest)) suite.addTest(unittest.makeSuite(UserDictMixinTest)) Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_weakref.py 22 Aug 2002 20:21:30 -0000 1.21 --- test_weakref.py 9 Mar 2003 07:05:14 -0000 1.22 *************** *** 518,521 **** --- 518,536 ---- self.assert_(d.items() == [('something else', o2)]) + from test_userdict import TestMappingProtocol + + class WeakValueDictionaryTestCase(TestMappingProtocol): + """Check that WeakValueDictionary class conforms to the mapping protocol""" + __ref = {"key1":Object(1), "key2":Object(2), "key3":Object(3)} + _tested_class = weakref.WeakValueDictionary + def _reference(self): + return self.__ref.copy() + + class WeakKeyDictionaryTestCase(TestMappingProtocol): + """Check that WeakKeyDictionary class conforms to the mapping protocol""" + __ref = {Object("key1"):1, Object("key2"):2, Object("key3"):3} + _tested_class = weakref.WeakKeyDictionary + def _reference(self): + return self.__ref.copy() def test_main(): *************** *** 523,526 **** --- 538,543 ---- suite.addTest(unittest.makeSuite(ReferencesTestCase)) suite.addTest(unittest.makeSuite(MappingTestCase)) + suite.addTest(unittest.makeSuite(WeakValueDictionaryTestCase)) + suite.addTest(unittest.makeSuite(WeakKeyDictionaryTestCase)) test_support.run_suite(suite) From rhettinger@users.sourceforge.net Sun Mar 9 07:05:46 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:05:46 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.227,1.228 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv15204 Modified Files: ACKS Log Message: SF patch #667730: More DictMixin * Adds missing pop() methods to weakref.py * Expands test suite to broaden coverage of objects with a mapping interface. Contributed by Sebastien Keim. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.227 retrieving revision 1.228 diff -C2 -d -r1.227 -r1.228 *** ACKS 10 Feb 2003 01:09:49 -0000 1.227 --- ACKS 9 Mar 2003 07:05:43 -0000 1.228 *************** *** 282,285 **** --- 282,286 ---- Jacob Kaplan-Moss Lou Kates + Sebastien Keim Randall Kern Robert Kern From rhettinger@users.sourceforge.net Sun Mar 9 07:19:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:19:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.128,1.129 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv18590 Modified Files: whatsnew23.tex Log Message: Add contributor name. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** whatsnew23.tex 7 Mar 2003 15:45:15 -0000 1.128 --- whatsnew23.tex 9 Mar 2003 07:19:38 -0000 1.129 *************** *** 1373,1376 **** --- 1373,1377 ---- the module; see the \ulink{package's reference documentation}{../lib/module-itertools.html} for details. + (Contributed by Raymond Hettinger.) \item Two new functions in the \module{math} module, From rhettinger@users.sourceforge.net Sun Mar 9 07:30:45 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:30:45 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.183,2.184 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv20399 Modified Files: unicodeobject.c Log Message: Sf patch #700047: unicode object leaks refcount on resizing Contributed by Hye-Shik Chang. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.183 retrieving revision 2.184 diff -C2 -d -r2.183 -r2.184 *** unicodeobject.c 6 Mar 2003 12:53:07 -0000 2.183 --- unicodeobject.c 9 Mar 2003 07:30:43 -0000 2.184 *************** *** 277,280 **** --- 277,281 ---- Py_UNICODE_COPY(w->str, v->str, length < v->length ? length : v->length); + Py_DECREF(*unicode); *unicode = (PyObject *)w; return 0; From rhettinger@users.sourceforge.net Sun Mar 9 07:44:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:44:44 -0800 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv22888 Modified Files: _strptime.py Log Message: SF patch #691928: Use datetime in _strptime Contributed by Brett Cannon. To prevent code duplication, I patched _strptime to use datetime's date object to do Julian day, Gregorian, and day of the week calculations. Patch also includes new regression tests to test results and the calculation gets triggered. Very minor comment changes and the contact email are also changed. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _strptime.py 29 Jan 2003 03:49:43 -0000 1.12 --- _strptime.py 9 Mar 2003 07:44:41 -0000 1.13 *************** *** 7,22 **** FUNCTIONS: ! firstjulian -- Calculates the Julian date up to the first of the specified ! year ! gregorian -- Calculates the Gregorian date based on the Julian day and ! year ! julianday -- Calculates the Julian day since the first of the year based ! on the Gregorian date ! dayofweek -- Calculates the day of the week from the Gregorian date. strptime -- Calculates the time struct represented by the passed-in string ! Requires Python 2.2.1 or higher. Can be used in Python 2.2 if the following line is added: ! >>> True = 1; False = 0 """ import time --- 7,16 ---- FUNCTIONS: ! _getlang -- Figure out what language is being used for the locale strptime -- Calculates the time struct represented by the passed-in string ! Requires Python 2.2.1 or higher (mainly because of the use of property()). Can be used in Python 2.2 if the following line is added: ! True = 1; False = 0 """ import time *************** *** 25,36 **** from re import compile as re_compile from re import IGNORECASE __author__ = "Brett Cannon" ! __email__ = "drifty@bigfoot.com" __all__ = ['strptime'] - RegexpType = type(re_compile('')) - def _getlang(): # Figure out what the current language is set to. --- 19,29 ---- from re import compile as re_compile from re import IGNORECASE + from datetime import date as datetime_date __author__ = "Brett Cannon" ! __email__ = "brett@python.org" __all__ = ['strptime'] def _getlang(): # Figure out what the current language is set to. *************** *** 426,430 **** hour = minute = second = 0 tz = -1 ! # Defaulted to -1 so as to signal using functions to calc values weekday = julian = -1 found_dict = found.groupdict() --- 419,423 ---- hour = minute = second = 0 tz = -1 ! # weekday and julian defaulted to -1 so as to signal need to calculate values weekday = julian = -1 found_dict = found.groupdict() *************** *** 496,509 **** elif locale_time.timezone[2].lower() == found_zone: tz = -1 ! #XXX : If calculating fxns are never exposed to the general ! #populous then just inline calculations. Also might be able to use ! #``datetime`` and the methods it provides. if julian == -1: ! julian = julianday(year, month, day) ! else: # Assuming that if they bothered to include Julian day it will #be accurate ! year, month, day = gregorian(julian, year) if weekday == -1: ! weekday = dayofweek(year, month, day) return time.struct_time((year, month, day, hour, minute, second, --- 489,507 ---- elif locale_time.timezone[2].lower() == found_zone: tz = -1 ! # Cannot pre-calculate datetime_date() since can change in Julian ! #calculation and thus could have different value for the day of the week ! #calculation if julian == -1: ! # Need to add 1 to result since first day of the year is 1, not 0. ! julian = datetime_date(year, month, day).toordinal() - \ ! datetime_date(year, 1, 1).toordinal() + 1 ! else: # Assume that if they bothered to include Julian day it will #be accurate ! datetime_result = datetime_date.fromordinal((julian - 1) + datetime_date(year, 1, 1).toordinal()) ! year = datetime_result.year ! month = datetime_result.month ! day = datetime_result.day if weekday == -1: ! weekday = datetime_date(year, month, day).weekday() return time.struct_time((year, month, day, hour, minute, second, *************** *** 523,560 **** raise ValueError("value not in list") - def firstjulian(year): - """Calculate the Julian date up until the first of the year.""" - return ((146097 * (year + 4799)) // 400) - 31738 - - def julianday(year, month, day): - """Calculate the Julian day since the beginning of the year. - Calculated from the Gregorian date. - """ - a = (14 - month) // 12 - return (day - 32045 - + (((153 * (month + (12 * a) - 3)) + 2) // 5) - + ((146097 * (year + 4800 - a)) // 400)) - firstjulian(year) + 1 - - def gregorian(julian, year): - """Return 3-item list containing Gregorian date based on the Julian day.""" - a = 32043 + julian + firstjulian(year) - b = ((4 * a) + 3) // 146097 - c = a - ((146097 * b) // 4) - d = ((4 * c) + 3) // 1461 - e = c - ((1461 * d) // 4) - m = ((5 * e) + 2) // 153 - day = 1 + e - (((153 * m) + 2) // 5) - month = m + 3 - (12 * (m // 10)) - year = (100 * b) + d - 4800 + (m // 10) - return [year, month, day] - - def dayofweek(year, month, day): - """Calculate the day of the week (Monday is 0).""" - a = (14 - month) // 12 - y = year - a - weekday = (day + y + ((97 * y) // 400) - + ((31 * (month + (12 * a) -2 )) // 12)) % 7 - if weekday == 0: - return 6 - else: - return weekday-1 --- 521,522 ---- From rhettinger@users.sourceforge.net Sun Mar 9 07:44:45 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 08 Mar 2003 23:44:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22888/test Modified Files: test_strptime.py Log Message: SF patch #691928: Use datetime in _strptime Contributed by Brett Cannon. To prevent code duplication, I patched _strptime to use datetime's date object to do Julian day, Gregorian, and day of the week calculations. Patch also includes new regression tests to test results and the calculation gets triggered. Very minor comment changes and the contact email are also changed. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_strptime.py 18 Jan 2003 03:53:49 -0000 1.9 --- test_strptime.py 9 Mar 2003 07:44:42 -0000 1.10 *************** *** 330,364 **** " %s != %s" % (strp_output, defaults)) - class FxnTests(unittest.TestCase): - """Test functions that fill in info by validating result and are triggered - properly.""" - - def setUp(self): - """Create an initial time tuple.""" - self.time_tuple = time.gmtime() - - def test_julianday_result(self): - # Test julianday - result = _strptime.julianday(self.time_tuple[0], self.time_tuple[1], - self.time_tuple[2]) - self.failUnless(result == self.time_tuple[7], - "julianday failed; %s != %s" % - (result, self.time_tuple[7])) - - def test_gregorian_result(self): - # Test gregorian - result = _strptime.gregorian(self.time_tuple[7], self.time_tuple[0]) - comparison = [self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]] - self.failUnless(result == comparison, - "gregorian() failed; %s != %s" % (result, comparison)) - - def test_dayofweek_result(self): - # Test dayofweek - result = _strptime.dayofweek(self.time_tuple[0], self.time_tuple[1], - self.time_tuple[2]) - comparison = self.time_tuple[6] - self.failUnless(result == comparison, - "dayofweek() failed; %s != %s" % (result, comparison)) - class Strptime12AMPMTests(unittest.TestCase): """Test a _strptime regression in '%I %p' at 12 noon (12 PM)""" --- 330,333 ---- *************** *** 381,384 **** --- 350,390 ---- eq(_strptime.strptime('%d 2004' % i, '%j %Y')[7], i) + class CalculationTests(unittest.TestCase): + """Test that strptime() fills in missing info correctly""" + + def setUp(self): + self.time_tuple = time.gmtime() + + def test_julian_calculation(self): + # Make sure that when Julian is missing that it is calculated + format_string = "%Y %m %d %H %M %S %w %Z" + result = _strptime.strptime(time.strftime(format_string, self.time_tuple), + format_string) + self.failUnless(result.tm_yday == self.time_tuple.tm_yday, + "Calculation of tm_yday failed; %s != %s" % + (result.tm_yday, self.time_tuple.tm_yday)) + + def test_gregorian_calculation(self): + # Test that Gregorian date can be calculated from Julian day + format_string = "%Y %H %M %S %w %j %Z" + result = _strptime.strptime(time.strftime(format_string, self.time_tuple), + format_string) + self.failUnless(result.tm_year == self.time_tuple.tm_year and + result.tm_mon == self.time_tuple.tm_mon and + result.tm_mday == self.time_tuple.tm_mday, + "Calculation of Gregorian date failed;" + "%s-%s-%s != %s-%s-%s" % + (result.tm_year, result.tm_mon, result.tm_mday, + self.time_tuple.tm_year, self.time_tuple.tm_mon, + self.time_tuple.tm_mday)) + + def test_day_of_week_calculation(self): + # Test that the day of the week is calculated as needed + format_string = "%Y %m %d %H %S %j %Z" + result = _strptime.strptime(time.strftime(format_string, self.time_tuple), + format_string) + self.failUnless(result.tm_wday == self.time_tuple.tm_wday, + "Calculation of day of the week failed;" + "%s != %s" % (result.tm_wday, self.time_tuple.tm_wday)) def test_main(): *************** *** 387,393 **** suite.addTest(unittest.makeSuite(TimeRETests)) suite.addTest(unittest.makeSuite(StrptimeTests)) - suite.addTest(unittest.makeSuite(FxnTests)) suite.addTest(unittest.makeSuite(Strptime12AMPMTests)) suite.addTest(unittest.makeSuite(JulianTests)) test_support.run_suite(suite) --- 393,399 ---- suite.addTest(unittest.makeSuite(TimeRETests)) suite.addTest(unittest.makeSuite(StrptimeTests)) suite.addTest(unittest.makeSuite(Strptime12AMPMTests)) suite.addTest(unittest.makeSuite(JulianTests)) + suite.addTest(unittest.makeSuite(CalculationTests)) test_support.run_suite(suite) From gward@users.sourceforge.net Sun Mar 9 23:34:54 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 15:34:54 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12154 Added Files: libossaudiodev.tex Log Message: Documentation for the ossaudiodev module. Initial revision supplied by Nicholas FitzRoy-Dale (emailed to me [gward@python.net] 2003-03-08 23:37 +1100). --- NEW FILE: libossaudiodev.tex --- \section{\module{ossaudiodev} --- Access to Open Sound System-compatible audio hardware} \declaremodule{builtin}{ossaudiodev} \platform{OSS} \modulesynopsis{Access to OSS-compatible audio hardware.} % I know FreeBSD uses OSS - what about Net- and Open-? This module allows you to access the Open Sound System audio interface. The Open Sound System interface is present on Linux and FreeBSD. This module provides a very "bare bones" wrapper over the IOCTLs used to access the audio hardware. The best - albeit rather daunting - way to get a feel for the interface is from the Open Sound System official documentation: \url{http://www.opensound.com/pguide/oss.pdf} The module defines a number of constants which may be used to program the device. These constants are the same as those defined in the C include file \code{}. \code{ossaudiodev} defines the following variables and functions: \begin{excdesc}{error} This exception is raised on errors. The argument is a string describing what went wrong. \end{excdesc} \begin{funcdesc}{open}{\optional{device, }mode} This function opens the audio device and returns an OSS audio device object. This object can then be used to do I/O on. The \var{device} parameter is the audio device filename to use. If it is not specified, this module first looks in the environment variable \code{AUDIODEV} for a device to use. If not found, it falls back to \file{/dev/dsp}. The \var{mode} parameter is one of \code{'r'} for record-only access, \code{'w'} for play-only access and \code{'rw'} for both. Since many soundcards only allow one process to have the recorder or player open at a time it is a good idea to open the device only for the activity needed. Further, some soundcards are half-duplex: they can be opened for reading or writing, but not both at once. \end{funcdesc} \begin{funcdesc}{openmixer}{\optional{device\optional{, mode}}} This function opens the mixer device and returns an OSS mixer device object. The \var{device} parameter is the mixer device filename to use. If it is not specified, this module first looks in the environment variable \code{MIXERDEV} for a device to use. If not found, it falls back to \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or \code{'w'} for \var{mode}; the default is \code{'r'}. \end{funcdesc} \subsection{Audio Device Objects \label{ossaudio-device-objects}} Setting up the device To set up the device, three functions must be called in the correct sequence: \code{setfmt} to set the output format, \code{channels} to set the number of channels, and \code{speed} to set the sample rate. The audio device objects are returned by \function{open()} define the following methods: \begin{methoddesc}[audio device]{close}{} This method explicitly closes the device. It is useful in situations where deleting the object does not immediately close it since there are other references to it. A closed device should not be used again. \end{methoddesc} \begin{methoddesc}[audio device]{fileno}{} Returns the file descriptor associated with the device. \end{methoddesc} \begin{methoddesc}[audio device]{read}{size} Reads \var{size} samples from the audio input and returns them as a Python string. The function blocks until enough data is available. \end{methoddesc} \begin{methoddesc}[audio device]{write}{data} Writes Python string \var{data} to the audio device and returns the number of bytes written. If the audio device is opened in blocking mode, the entire string is always written. If the device is opened in nonblocking mode, some data may not be written - see \code{writeall}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} Writes the entire Python string \var{data} to the audio device. If the device is opened in blocking mode, behaves identially to \code{write}; in nonblocking mode, waits until the device becomes available before feeding it more data. Returns None, since the amount of data written is always equal to the amount of data supplied. \end{methoddesc} Simple IOCTLs: \begin{methoddesc}[audio device]{nonblock}{} Attempts to put the device into nonblocking mode. Once in nonblocking mode there is no way to return to blocking mode. Raises \exception{IOError} if the IOCTL failed. \end{methoddesc} \begin{methoddesc}[audio device]{getfmts}{} Returns a bitmask of the audio output formats supported by the soundcard. On a typical Linux system, these formats are: AFMT_MU_LAW - a logarithmic encoding. This is the default format on /dev/audio and is the format used by Sun .au files. AFMT_A_LAW - a logarithmic encoding AFMT_IMA_ADPCM - a 4:1 compressed format defined by the Interactive Multimedia Association. AFMT_U8 - Unsigned, 8-bit audio. AFMT_S16_LE - Unsigned, 16-bit audio, little-endian byte order (as used by Intel processors) AFMT_S16_BE - Unsigned, 16-bit audio, big-endian byte order (as used by 68k, PowerPC, Sparc) AFMT_S8 - Signed, 8 bit audio. AFMT_U16_LE - Signed, 16-bit little-endian audio AFMT_U16_BE - Signed, 16-bit big-endian audio Most systems support only a subset of these formats. Many devices only support AFTM_U8; the most common format used today is AFMT_S16_LE. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} Used to set the current audio format to \var{format} - see \code{getfmts} for a list. May also be used to return the current audio format - do this by passing an ``audio format'' of \code{AFMT_QUERY}. Returns the audio format that the device was set to, which may not be the requested format. \end{methoddesc} \begin{methoddesc}[audio device]{channels}{num_channels} Sets the number of output channels to \var{num_channels}. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. Returns the number of channels the device was set to. \end{methoddesc} \begin{methoddesc}[audio device]{speed}{samplerate} Sets the samplerate to \var{samplerate} samples per second and returns the rate actually set. Most sound devices don't support arbitrary sample rates. Common rates are: 8000 - default rate 11025 - speech recording 22050 44100 - Audio CD-quality (at 16 bits/sample and 2 channels) 96000 - DVD-quality \end{methoddesc} \begin{methoddesc}[audio device]{sync} Waits until the sound device has played every byte in its buffer and returns. This also occurs when the sound device is closed. The OSS documentation recommends simply closing and re-opening the device rather than using \code{sync}. \end{methoddesc} \begin{methoddesc}[audio device]{reset} Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends closing and re-opening the device after calling \code{reset}. \end{methoddesc} \begin{methoddesc}[audio device]{post} To be used like a lightweight \code{sync}, the \code{post} IOCTL informs the audio device that there is a likely to be a pause in the audio output - ie, after playing a spot sound effect, before waiting for user input, or before doing disk IO. \end{methoddesc} Convenience methods \begin{methoddesc}[audio device]{setparameters}{samplerate,num_channels,format,emulate} Initialise the sound device in one method. \var{samplerate}, \var{channels} and \var{format} should be as specified in the \code{speed}, \code{channels} and \code{setfmt} methods. If \var{emulate} is true, attempt to find the closest matching format instead, otherwise raise ValueError if the device does not support the format. The default is to raise ValueError on unsupported formats. \end{methoddesc} \begin{methoddesc}[audio device]{bufsize}{} Returns the size of the hardware buffer, in samples. \end{methoddesc} \begin{methoddesc}[audio device]{obufcount}{} Returns the number of samples that are in the hardware buffer yet to be played. \end{methoddesc} \begin{methoddesc}[audio device]{obuffree}{} Returns the number of samples that could be queued into the hardware buffer to be played without blocking. \end{methoddesc} \subsection{Mixer Device Objects \label{mixer-device-objects}} File-like interface \begin{methoddesc}[mixer device]{close}{} This method closes the open mixer device file. Any further attempts to use the mixer after this file is closed will raise an IOError. \end{methoddesc} \begin{methoddesc}[mixer device]{fileno}{} Returns the file handle number of the open mixer device file. \end{methoddesc} Mixer interface \begin{methoddesc}[mixer device]{controls}{} This method returns a bitmask specifying the available mixer controls (``Control'' being a specific mixable ``channel'', such as \code{SOUND_MIXER_PCM} or \code{SOUND_MIXER_SYNTH}). This bitmask indicates a subset of all available mixer channels - the \code{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the following Python code: \begin{verbatim} mixer=ossaudiodev.openmixer() if mixer.channels() & (1 << ossaudiodev.SOUND_MIXER_PCM): # PCM is supported \end{verbatim} For most purposes, the \code{SOUND_MIXER_VOLUME} (Master volume) and \code{SOUND_MIXER_PCM} channels should suffice - but code that uses the mixer should be flexible when it comes to choosing sound channels. On the Gravis Ultrasound, for example, \code{SOUND_MIXER_VOLUME} does not exist. \end{methoddesc} \begin{methoddesc}[mixer device]{stereocontrols}{} Returns a bitmask indicating stereo mixer channels. If a bit is set, the corresponding channel is stereo; if it is unset, the channel is either monophonic or not supported by the mixer (use in combination with \function{channels} to determine which). See the code example for the \function{channels} function for an example of getting data from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{reccontrols}{} Returns a bitmask specifying the mixer controls that may be used to record. See the code example for \function{controls} for an example of reading from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{get}{channel} Returns the volume of a given mixer channel. The returned volume is a 2-tuple of \code{left volume, right volume}. Volumes are specified as numbers from 0 (silent) to 100 (full volume). If the channel is monophonic, a 2-tuple is still returned, but both channel volumes are the same. If an unknown channel is specified, \exception{error} is raised. \end{methoddesc} \begin{methoddesc}[mixer device]{set}{channel, (left, right)} Sets the volume for a given mixer channel to \code{(left, right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. Note that this may not be exactly the same as the volume specified, because of the limited resolution of some soundcard's mixers. Raises \exception{IOError} if an invalid mixer channel was specified; \exception{TypeError} if the argument format was incorrect, and \exception{error} if the specified volumes were out-of-range. \end{methoddesc} \begin{methoddesc}[mixer device]{get_recsrc}{} This method returns a bitmask indicating which channel or channels are currently being used as a recording source. \end{methoddesc} \begin{methoddesc}[mixer device]{set_recsrc}{bitmask} Call this function to specify a recording source. Returns a bitmask indicating the new recording source (or sources) if successful; raises \exception{IOError} if an invalid source was specified. To set the current recording source to the microphone input: \begin{verbatim} mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC) \end{verbatim} \end{methoddesc} From gward@users.sourceforge.net Sun Mar 9 23:57:36 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 15:57:36 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20251 Modified Files: libossaudiodev.tex Log Message: Wrap all paragraphs to 72 columns. Two spaces between sentences. Fix em-dashes -- should be "---" not " - ". Spelling fix. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libossaudiodev.tex 9 Mar 2003 23:34:52 -0000 1.1 --- libossaudiodev.tex 9 Mar 2003 23:57:34 -0000 1.2 *************** *** 6,15 **** \modulesynopsis{Access to OSS-compatible audio hardware.} ! % I know FreeBSD uses OSS - what about Net- and Open-? This module allows you to access the Open Sound System audio interface. The Open Sound System interface is present on Linux and FreeBSD. This module provides a very "bare bones" wrapper over the IOCTLs used to ! access the audio hardware. The best - albeit rather daunting - way to get a feel for the interface is from the Open Sound System official documentation: --- 6,15 ---- \modulesynopsis{Access to OSS-compatible audio hardware.} ! % I know FreeBSD uses OSS -- what about Net- and Open-? This module allows you to access the Open Sound System audio interface. The Open Sound System interface is present on Linux and FreeBSD. This module provides a very "bare bones" wrapper over the IOCTLs used to ! access the audio hardware. The best---albeit rather daunting---way to get a feel for the interface is from the Open Sound System official documentation: *************** *** 17,52 **** \url{http://www.opensound.com/pguide/oss.pdf} ! The module defines a number of constants which may be used to program the ! device. These constants are the same as those defined in the C include file ! \code{}. \code{ossaudiodev} defines the following variables and functions: \begin{excdesc}{error} ! This exception is raised on errors. The argument is a string ! describing what went wrong. \end{excdesc} \begin{funcdesc}{open}{\optional{device, }mode} This function opens the audio device and returns an OSS audio device ! object. This object can then be used to do I/O on. The \var{device} ! parameter is the audio device filename to use. If it is not specified, this ! module first looks in the environment variable \code{AUDIODEV} for a device ! to use. If not found, it falls back to \file{/dev/dsp}. The \var{mode} parameter is one of \code{'r'} for record-only access, ! \code{'w'} for play-only access and \code{'rw'} for both. Since many soundcards only allow one process to have the recorder or player open at a time it is a good idea to open the device only for the activity ! needed. Further, some soundcards are half-duplex: they can be opened for reading ! or writing, but not both at once. \end{funcdesc} \begin{funcdesc}{openmixer}{\optional{device\optional{, mode}}} This function ! opens the mixer device and returns an OSS mixer device object. The \var{device} ! parameter is the mixer device filename to use. If it is not specified, this ! module first looks in the environment variable \code{MIXERDEV} for a device to ! use. If not found, it falls back to \file{/dev/mixer}. You may specify ! \code{'r'}, \code{'rw'} or \code{'w'} for \var{mode}; the default is \code{'r'}. \end{funcdesc} --- 17,53 ---- \url{http://www.opensound.com/pguide/oss.pdf} ! The module defines a number of constants which may be used to program ! the device. These constants are the same as those defined in the C ! include file \code{}. \code{ossaudiodev} defines the following variables and functions: \begin{excdesc}{error} ! This exception is raised on errors. The argument is a string describing ! what went wrong. \end{excdesc} \begin{funcdesc}{open}{\optional{device, }mode} This function opens the audio device and returns an OSS audio device ! object. This object can then be used to do I/O on. The \var{device} ! parameter is the audio device filename to use. If it is not specified, ! this module first looks in the environment variable \code{AUDIODEV} for ! a device to use. If not found, it falls back to \file{/dev/dsp}. The \var{mode} parameter is one of \code{'r'} for record-only access, ! \code{'w'} for play-only access and \code{'rw'} for both. Since many soundcards only allow one process to have the recorder or player open at a time it is a good idea to open the device only for the activity ! needed. Further, some soundcards are half-duplex: they can be opened ! for reading or writing, but not both at once. \end{funcdesc} \begin{funcdesc}{openmixer}{\optional{device\optional{, mode}}} This function ! opens the mixer device and returns an OSS mixer device object. The ! \var{device} parameter is the mixer device filename to use. If it is ! not specified, this module first looks in the environment variable ! \code{MIXERDEV} for a device to use. If not found, it falls back to ! \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or ! \code{'w'} for \var{mode}; the default is \code{'r'}. \end{funcdesc} *************** *** 56,60 **** Setting up the device ! To set up the device, three functions must be called in the correct sequence: \code{setfmt} to set the output format, --- 57,62 ---- Setting up the device ! To set up the device, three functions must be called in the correct ! sequence: \code{setfmt} to set the output format, *************** *** 66,96 **** \begin{methoddesc}[audio device]{close}{} ! This method explicitly closes the device. It is useful in situations ! where deleting the object does not immediately close it since there ! are other references to it. A closed device should not be used again. \end{methoddesc} \begin{methoddesc}[audio device]{fileno}{} ! Returns the file descriptor associated with the device. \end{methoddesc} \begin{methoddesc}[audio device]{read}{size} ! Reads \var{size} samples from the audio input and returns ! them as a Python string. The function blocks until enough data is available. \end{methoddesc} \begin{methoddesc}[audio device]{write}{data} ! Writes Python string \var{data} to the audio device and returns the number of ! bytes written. If the audio device is opened in blocking mode, the entire ! string is always written. If the device is opened in nonblocking mode, some data ! may not be written - see \code{writeall}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} ! Writes the entire Python string \var{data} to the audio device. If the device ! is opened in blocking mode, behaves identially to \code{write}; in nonblocking ! mode, waits until the device becomes available before feeding it more data. ! Returns None, since the amount of data written is always equal to the amount ! of data supplied. \end{methoddesc} --- 68,98 ---- \begin{methoddesc}[audio device]{close}{} ! This method explicitly closes the device. It is useful in situations ! where deleting the object does not immediately close it since there are ! other references to it. A closed device should not be used again. \end{methoddesc} \begin{methoddesc}[audio device]{fileno}{} ! Returns the file descriptor associated with the device. \end{methoddesc} \begin{methoddesc}[audio device]{read}{size} ! Reads \var{size} samples from the audio input and returns them as a ! Python string. The function blocks until enough data is available. \end{methoddesc} \begin{methoddesc}[audio device]{write}{data} ! Writes Python string \var{data} to the audio device and returns the ! number of bytes written. If the audio device is opened in blocking ! mode, the entire string is always written. If the device is opened in ! nonblocking mode, some data may not be written---see \code{writeall}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} ! Writes the entire Python string \var{data} to the audio device. If the ! device is opened in blocking mode, behaves identially to \code{write}; ! in nonblocking mode, waits until the device becomes available before ! feeding it more data. Returns None, since the amount of data written is ! always equal to the amount of data supplied. \end{methoddesc} *************** *** 98,103 **** \begin{methoddesc}[audio device]{nonblock}{} ! Attempts to put the device into nonblocking mode. Once in nonblocking mode there ! is no way to return to blocking mode. Raises \exception{IOError} if the IOCTL failed. --- 100,105 ---- \begin{methoddesc}[audio device]{nonblock}{} ! Attempts to put the device into nonblocking mode. Once in nonblocking ! mode there is no way to return to blocking mode. Raises \exception{IOError} if the IOCTL failed. *************** *** 105,173 **** \begin{methoddesc}[audio device]{getfmts}{} ! Returns a bitmask of the audio output formats supported by the soundcard. ! On a typical Linux system, these formats are: ! AFMT_MU_LAW - a logarithmic encoding. This is the default format on /dev/audio ! and is the format used by Sun .au files. ! AFMT_A_LAW - a logarithmic encoding ! AFMT_IMA_ADPCM - a 4:1 compressed format defined by the Interactive Multimedia ! Association. ! AFMT_U8 - Unsigned, 8-bit audio. ! AFMT_S16_LE - Unsigned, 16-bit audio, little-endian byte order (as used by Intel ! processors) ! AFMT_S16_BE - Unsigned, 16-bit audio, big-endian byte order (as used by 68k, ! PowerPC, Sparc) ! AFMT_S8 - Signed, 8 bit audio. ! AFMT_U16_LE - Signed, 16-bit little-endian audio ! AFMT_U16_BE - Signed, 16-bit big-endian audio ! Most systems support only a subset of these formats. Many devices only support ! AFTM_U8; the most common format used today is AFMT_S16_LE. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} ! Used to set the current audio format to \var{format} - see \code{getfmts} for a ! list. May also be used to return the current audio format - do this by passing ! an ``audio format'' of \code{AFMT_QUERY}. Returns the audio format that the ! device was set to, which may not be the requested format. \end{methoddesc} \begin{methoddesc}[audio device]{channels}{num_channels} ! Sets the number of output channels to \var{num_channels}. A value of 1 indicates ! monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, ! and some high-end devices may not support mono. Returns the number of channels ! the device was set to. \end{methoddesc} \begin{methoddesc}[audio device]{speed}{samplerate} ! Sets the samplerate to \var{samplerate} samples per second and returns the rate ! actually set. Most sound devices don't support arbitrary sample rates. Common ! rates are: ! 8000 - default rate ! 11025 - speech recording 22050 ! 44100 - Audio CD-quality (at 16 bits/sample and 2 channels) ! 96000 - DVD-quality \end{methoddesc} \begin{methoddesc}[audio device]{sync} ! Waits until the sound device has played every byte in its buffer and returns. ! This also occurs when the sound device is closed. The OSS documentation ! recommends simply closing and re-opening the device rather than using ! \code{sync}. \end{methoddesc} \begin{methoddesc}[audio device]{reset} ! Immediately stops and playing or recording and returns the device to a state ! where it can accept commands. The OSS documentation recommends closing and ! re-opening the device after calling \code{reset}. \end{methoddesc} \begin{methoddesc}[audio device]{post} ! To be used like a lightweight \code{sync}, the \code{post} IOCTL informs the ! audio device that there is a likely to be a pause in the audio output - ie, ! after playing a spot sound effect, before waiting for user input, or before ! doing disk IO. \end{methoddesc} --- 107,176 ---- \begin{methoddesc}[audio device]{getfmts}{} ! Returns a bitmask of the audio output formats supported by the ! soundcard. On a typical Linux system, these formats are: ! AFMT_MU_LAW---a logarithmic encoding. This is the default format on ! /dev/audio and is the format used by Sun .au files. ! AFMT_A_LAW---a logarithmic encoding ! AFMT_IMA_ADPCM---a 4:1 compressed format defined by the Interactive ! Multimedia Association. ! AFMT_U8---Unsigned, 8-bit audio. ! AFMT_S16_LE---Unsigned, 16-bit audio, little-endian byte order (as used ! by Intel processors) ! AFMT_S16_BE---Unsigned, 16-bit audio, big-endian byte order (as used by ! 68k, PowerPC, Sparc) ! AFMT_S8---Signed, 8 bit audio. ! AFMT_U16_LE---Signed, 16-bit little-endian audio ! AFMT_U16_BE---Signed, 16-bit big-endian audio ! Most systems support only a subset of these formats. Many devices only ! support AFTM_U8; the most common format used today is AFMT_S16_LE. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} ! Used to set the current audio format to \var{format}---see ! \code{getfmts} for a list. May also be used to return the current audio ! format---do this by passing an ``audio format'' of \code{AFMT_QUERY}. ! Returns the audio format that the device was set to, which may not be ! the requested format. \end{methoddesc} \begin{methoddesc}[audio device]{channels}{num_channels} ! Sets the number of output channels to \var{num_channels}. A value of 1 ! indicates monophonic sound, 2 stereophonic. Some devices may have more ! than 2 channels, and some high-end devices may not support mono. ! Returns the number of channels the device was set to. \end{methoddesc} \begin{methoddesc}[audio device]{speed}{samplerate} ! Sets the samplerate to \var{samplerate} samples per second and returns ! the rate actually set. Most sound devices don't support arbitrary ! sample rates. Common rates are: ! 8000---default rate ! 11025---speech recording 22050 ! 44100---Audio CD-quality (at 16 bits/sample and 2 channels) ! 96000---DVD-quality \end{methoddesc} \begin{methoddesc}[audio device]{sync} ! Waits until the sound device has played every byte in its buffer and ! returns. This also occurs when the sound device is closed. The OSS ! documentation recommends simply closing and re-opening the device rather ! than using \code{sync}. \end{methoddesc} \begin{methoddesc}[audio device]{reset} ! Immediately stops and playing or recording and returns the device to a ! state where it can accept commands. The OSS documentation recommends ! closing and re-opening the device after calling \code{reset}. \end{methoddesc} \begin{methoddesc}[audio device]{post} ! To be used like a lightweight \code{sync}, the \code{post} IOCTL informs ! the audio device that there is a likely to be a pause in the audio ! output---i.e., after playing a spot sound effect, before waiting for ! user input, or before doing disk IO. \end{methoddesc} *************** *** 175,184 **** \begin{methoddesc}[audio device]{setparameters}{samplerate,num_channels,format,emulate} ! Initialise the sound device in one method. \var{samplerate}, \var{channels} and ! \var{format} should be as specified in the \code{speed}, \code{channels} and ! \code{setfmt} methods. If \var{emulate} is true, attempt to find the closest ! matching format instead, otherwise raise ValueError if the ! device does not support the format. The default is to raise ValueError on ! unsupported formats. \end{methoddesc} --- 178,187 ---- \begin{methoddesc}[audio device]{setparameters}{samplerate,num_channels,format,emulate} ! Initialise the sound device in one method. \var{samplerate}, ! \var{channels} and \var{format} should be as specified in the ! \code{speed}, \code{channels} and \code{setfmt} methods. If ! \var{emulate} is true, attempt to find the closest matching format ! instead, otherwise raise ValueError if the device does not support the ! format. The default is to raise ValueError on unsupported formats. \end{methoddesc} *************** *** 188,197 **** \begin{methoddesc}[audio device]{obufcount}{} ! Returns the number of samples that are in the hardware buffer yet to be played. \end{methoddesc} \begin{methoddesc}[audio device]{obuffree}{} ! Returns the number of samples that could be queued into the hardware buffer to ! be played without blocking. \end{methoddesc} --- 191,201 ---- \begin{methoddesc}[audio device]{obufcount}{} ! Returns the number of samples that are in the hardware buffer yet to be ! played. \end{methoddesc} \begin{methoddesc}[audio device]{obuffree}{} ! Returns the number of samples that could be queued into the hardware ! buffer to be played without blocking. \end{methoddesc} *************** *** 201,206 **** \begin{methoddesc}[mixer device]{close}{} ! This method closes the open mixer device file. Any further attempts to use the ! mixer after this file is closed will raise an IOError. \end{methoddesc} --- 205,210 ---- \begin{methoddesc}[mixer device]{close}{} ! This method closes the open mixer device file. Any further attempts to ! use the mixer after this file is closed will raise an IOError. \end{methoddesc} *************** *** 214,220 **** This method returns a bitmask specifying the available mixer controls (``Control'' being a specific mixable ``channel'', such as ! \code{SOUND_MIXER_PCM} or \code{SOUND_MIXER_SYNTH}). This ! bitmask indicates a subset of all available mixer channels - the ! \code{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the following Python code: --- 218,224 ---- This method returns a bitmask specifying the available mixer controls (``Control'' being a specific mixable ``channel'', such as ! \code{SOUND_MIXER_PCM} or \code{SOUND_MIXER_SYNTH}). This ! bitmask indicates a subset of all available mixer channels---the ! \code{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the following Python code: *************** *** 228,257 **** For most purposes, the \code{SOUND_MIXER_VOLUME} (Master volume) and ! \code{SOUND_MIXER_PCM} channels should suffice - but code that uses the mixer ! should be flexible when it comes to choosing sound channels. On the Gravis ! Ultrasound, for example, \code{SOUND_MIXER_VOLUME} does not exist. \end{methoddesc} \begin{methoddesc}[mixer device]{stereocontrols}{} ! Returns a bitmask indicating stereo mixer channels. If a bit is set, the ! corresponding channel is stereo; if it is unset, the channel is either ! monophonic or not supported by the mixer (use in combination with \function{channels} to determine which). ! See the code example for the \function{channels} function for an example of ! getting data from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{reccontrols}{} ! Returns a bitmask specifying the mixer controls that may be used to record. ! See the code example for \function{controls} for an example of reading from ! a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{get}{channel} ! Returns the volume of a given mixer channel. The returned volume is a ! 2-tuple of \code{left volume, right volume}. Volumes are specified as ! numbers from 0 (silent) to 100 (full volume). If the channel is monophonic, ! a 2-tuple is still returned, but both channel volumes are the same. If an unknown channel is specified, \exception{error} is raised. --- 232,263 ---- For most purposes, the \code{SOUND_MIXER_VOLUME} (Master volume) and ! \code{SOUND_MIXER_PCM} channels should suffice---but code that uses the ! mixer should be flexible when it comes to choosing sound channels. On ! the Gravis Ultrasound, for example, \code{SOUND_MIXER_VOLUME} does not ! exist. \end{methoddesc} \begin{methoddesc}[mixer device]{stereocontrols}{} ! Returns a bitmask indicating stereo mixer channels. If a bit is set, ! the corresponding channel is stereo; if it is unset, the channel is ! either monophonic or not supported by the mixer (use in combination with \function{channels} to determine which). ! See the code example for the \function{channels} function for an example ! of getting data from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{reccontrols}{} ! Returns a bitmask specifying the mixer controls that may be used to ! record. See the code example for \function{controls} for an example of ! reading from a bitmask. \end{methoddesc} \begin{methoddesc}[mixer device]{get}{channel} ! Returns the volume of a given mixer channel. The returned volume is a ! 2-tuple of \code{left volume, right volume}. Volumes are specified as ! numbers from 0 (silent) to 100 (full volume). If the channel is ! monophonic, a 2-tuple is still returned, but both channel volumes are ! the same. If an unknown channel is specified, \exception{error} is raised. *************** *** 261,270 **** Sets the volume for a given mixer channel to \code{(left, right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 ! (full volume). On success, the new volume is returned as a 2-tuple. Note ! that this may not be exactly the same as the volume specified, because of ! the limited resolution of some soundcard's mixers. Raises \exception{IOError} if an invalid mixer channel was specified; ! \exception{TypeError} if the argument format was incorrect, and \exception{error} if the specified volumes were out-of-range. \end{methoddesc} --- 267,276 ---- Sets the volume for a given mixer channel to \code{(left, right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 ! (full volume). On success, the new volume is returned as a 2-tuple. ! Note that this may not be exactly the same as the volume specified, ! because of the limited resolution of some soundcard's mixers. Raises \exception{IOError} if an invalid mixer channel was specified; ! \exception{TypeError} if the argument format was incorrect, and \exception{error} if the specified volumes were out-of-range. \end{methoddesc} *************** *** 276,282 **** \begin{methoddesc}[mixer device]{set_recsrc}{bitmask} ! Call this function to specify a recording source. Returns a bitmask indicating the new recording source (or sources) if successful; raises ! \exception{IOError} if an invalid source was specified. To set the current recording source to the microphone input: --- 282,288 ---- \begin{methoddesc}[mixer device]{set_recsrc}{bitmask} ! Call this function to specify a recording source. Returns a bitmask indicating the new recording source (or sources) if successful; raises ! \exception{IOError} if an invalid source was specified. To set the current recording source to the microphone input: From gward@users.sourceforge.net Mon Mar 10 00:07:19 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 16:07:19 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex,1.214,1.215 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23678/lib Modified Files: lib.tex Log Message: Add libossaudiodev.tex. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -d -r1.214 -r1.215 *** lib.tex 1 Feb 2003 00:10:09 -0000 1.214 --- lib.tex 10 Mar 2003 00:07:14 -0000 1.215 *************** *** 284,287 **** --- 284,288 ---- \input{libimghdr} \input{libsndhdr} + \input{libossaudiodev} \input{libcrypto} % Cryptographic Services From gward@users.sourceforge.net Mon Mar 10 00:07:22 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 16:07:22 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.98,1.99 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv23678 Modified Files: Makefile.deps Log Message: Add libossaudiodev.tex. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** Makefile.deps 14 Feb 2003 01:45:53 -0000 1.98 --- Makefile.deps 10 Mar 2003 00:07:13 -0000 1.99 *************** *** 192,195 **** --- 192,196 ---- lib/libjpeg.tex \ lib/librgbimg.tex \ + lib/libossaudiodev.tex \ lib/libcrypto.tex \ lib/libmd5.tex \ From gward@users.sourceforge.net Mon Mar 10 00:24:45 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 16:24:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29776 Modified Files: libossaudiodev.tex Log Message: Fix two unformatted lists: one is now an 'enumerate' environment, the other a 'tableii'. Formatting/typo fix. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libossaudiodev.tex 9 Mar 2003 23:57:34 -0000 1.2 --- libossaudiodev.tex 10 Mar 2003 00:24:42 -0000 1.3 *************** *** 59,66 **** To set up the device, three functions must be called in the correct sequence: ! ! \code{setfmt} to set the output format, ! \code{channels} to set the number of channels, and ! \code{speed} to set the sample rate. The audio device objects are returned by \function{open()} define the --- 59,67 ---- To set up the device, three functions must be called in the correct sequence: ! \begin{enumerate} ! \item \code{setfmt()} to set the output format, ! \item \code{channels()} to set the number of channels, and ! \item \code{speed()} to set the sample rate. ! \end{enumerate} The audio device objects are returned by \function{open()} define the *************** *** 110,129 **** soundcard. On a typical Linux system, these formats are: ! AFMT_MU_LAW---a logarithmic encoding. This is the default format on ! /dev/audio and is the format used by Sun .au files. ! AFMT_A_LAW---a logarithmic encoding ! AFMT_IMA_ADPCM---a 4:1 compressed format defined by the Interactive ! Multimedia Association. ! AFMT_U8---Unsigned, 8-bit audio. ! AFMT_S16_LE---Unsigned, 16-bit audio, little-endian byte order (as used ! by Intel processors) ! AFMT_S16_BE---Unsigned, 16-bit audio, big-endian byte order (as used by ! 68k, PowerPC, Sparc) ! AFMT_S8---Signed, 8 bit audio. ! AFMT_U16_LE---Signed, 16-bit little-endian audio ! AFMT_U16_BE---Signed, 16-bit big-endian audio ! Most systems support only a subset of these formats. Many devices only ! support AFTM_U8; the most common format used today is AFMT_S16_LE. \end{methoddesc} --- 111,141 ---- soundcard. On a typical Linux system, these formats are: ! \begin{tableii}{l|l}{constant}{Format}{Description} ! \lineii{AFMT_MU_LAW} ! {a logarithmic encoding. This is the default format on ! /dev/audio and is the format used by Sun .au files.} ! \lineii{AFMT_A_LAW} ! {a logarithmic encoding} ! \lineii{AFMT_IMA_ADPCM} ! {a 4:1 compressed format defined by the Interactive Multimedia ! Association.} ! \lineii{AFMT_U8} ! {Unsigned, 8-bit audio.} ! \lineii{AFMT_S16_LE} ! {Unsigned, 16-bit audio, little-endian byte order (as used by ! Intel processors)} ! \lineii{AFMT_S16_BE} ! {Unsigned, 16-bit audio, big-endian byte order (as used by 68k, ! PowerPC, Sparc)} ! \lineii{AFMT_S8} ! {Signed, 8 bit audio.} ! \lineii{AFMT_U16_LE} ! {Signed, 16-bit little-endian audio} ! \lineii{AFMT_U16_BE} ! {Signed, 16-bit big-endian audio} ! \end{tableii} Most systems support only a subset of these formats. Many devices only ! support \code{AFMT_U8}; the most common format used today is ! \code{AFMT_S16_LE}. \end{methoddesc} From gward@users.sourceforge.net Mon Mar 10 02:09:53 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 18:09:53 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16191 Modified Files: libossaudiodev.tex Log Message: Rewrite intro paragraphs and add a "See also" box for the link to the official OSS docs. Markup fixes: change \code{} variously to \function{}, \method{}, or \constant{} as appropriate. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libossaudiodev.tex 10 Mar 2003 00:24:42 -0000 1.3 --- libossaudiodev.tex 10 Mar 2003 02:09:51 -0000 1.4 *************** *** 1,25 **** \section{\module{ossaudiodev} --- ! Access to Open Sound System-compatible audio hardware} \declaremodule{builtin}{ossaudiodev} ! \platform{OSS} ! \modulesynopsis{Access to OSS-compatible audio hardware.} ! ! % I know FreeBSD uses OSS -- what about Net- and Open-? ! This module allows you to access the Open Sound System audio interface. ! The Open Sound System interface is present on Linux and FreeBSD. ! ! This module provides a very "bare bones" wrapper over the IOCTLs used to ! access the audio hardware. The best---albeit rather daunting---way to ! get a feel for the interface is from the Open Sound System official ! documentation: ! \url{http://www.opensound.com/pguide/oss.pdf} ! The module defines a number of constants which may be used to program ! the device. These constants are the same as those defined in the C ! include file \code{}. ! \code{ossaudiodev} defines the following variables and functions: \begin{excdesc}{error} --- 1,26 ---- \section{\module{ossaudiodev} --- ! Access to OSS-compatible audio devices} \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD} ! \modulesynopsis{Access to OSS-compatible audio devices.} ! % XXX OSS is standard for Linux and FreeBSD -- what about NetBSD? ! % OpenBSD? others? ! This module allows you to access the OSS (Open Sound System) audio ! interface. OSS is available for a wide range of open-source and ! commercial Unices, and is the standard audio interface for Linux (up to ! kernel 2.4) and FreeBSD. ! \begin{seealso} ! \seetitle[http://www.opensound.com/pguide/oss.pdf] ! {Open Sound System Programmer's Guide} ! {the official documentation for the OSS C API} ! \seetext{The module defines a large number of constants supplied by ! the OSS device driver; see \file{} on either ! Linux or FreeBSD for a listing .} ! \end{seealso} ! \module{ossaudiodev} defines the following variables and functions: \begin{excdesc}{error} *************** *** 32,36 **** object. This object can then be used to do I/O on. The \var{device} parameter is the audio device filename to use. If it is not specified, ! this module first looks in the environment variable \code{AUDIODEV} for a device to use. If not found, it falls back to \file{/dev/dsp}. --- 33,37 ---- object. This object can then be used to do I/O on. The \var{device} parameter is the audio device filename to use. If it is not specified, ! this module first looks in the environment variable \envvar{AUDIODEV} for a device to use. If not found, it falls back to \file{/dev/dsp}. *************** *** 47,51 **** \var{device} parameter is the mixer device filename to use. If it is not specified, this module first looks in the environment variable ! \code{MIXERDEV} for a device to use. If not found, it falls back to \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or \code{'w'} for \var{mode}; the default is \code{'r'}. --- 48,52 ---- \var{device} parameter is the mixer device filename to use. If it is not specified, this module first looks in the environment variable ! \envvar{MIXERDEV} for a device to use. If not found, it falls back to \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or \code{'w'} for \var{mode}; the default is \code{'r'}. *************** *** 60,66 **** sequence: \begin{enumerate} ! \item \code{setfmt()} to set the output format, ! \item \code{channels()} to set the number of channels, and ! \item \code{speed()} to set the sample rate. \end{enumerate} --- 61,67 ---- sequence: \begin{enumerate} ! \item \method{setfmt()} to set the output format, ! \item \method{channels()} to set the number of channels, and ! \item \method{speed()} to set the sample rate. \end{enumerate} *************** *** 87,99 **** number of bytes written. If the audio device is opened in blocking mode, the entire string is always written. If the device is opened in ! nonblocking mode, some data may not be written---see \code{writeall}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} Writes the entire Python string \var{data} to the audio device. If the ! device is opened in blocking mode, behaves identially to \code{write}; ! in nonblocking mode, waits until the device becomes available before ! feeding it more data. Returns None, since the amount of data written is ! always equal to the amount of data supplied. \end{methoddesc} --- 88,101 ---- number of bytes written. If the audio device is opened in blocking mode, the entire string is always written. If the device is opened in ! nonblocking mode, some data may not be written---see ! \method{writeall()}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} Writes the entire Python string \var{data} to the audio device. If the ! device is opened in blocking mode, behaves identially to ! \method{write()}; in nonblocking mode, waits until the device becomes ! available before feeding it more data. Returns \code{None}, since the ! amount of data written is always equal to the amount of data supplied. \end{methoddesc} *************** *** 114,118 **** \lineii{AFMT_MU_LAW} {a logarithmic encoding. This is the default format on ! /dev/audio and is the format used by Sun .au files.} \lineii{AFMT_A_LAW} {a logarithmic encoding} --- 116,120 ---- \lineii{AFMT_MU_LAW} {a logarithmic encoding. This is the default format on ! \file{/dev/audio} and is the format used by Sun .au files.} \lineii{AFMT_A_LAW} {a logarithmic encoding} *************** *** 136,149 **** \end{tableii} Most systems support only a subset of these formats. Many devices only ! support \code{AFMT_U8}; the most common format used today is ! \code{AFMT_S16_LE}. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} Used to set the current audio format to \var{format}---see ! \code{getfmts} for a list. May also be used to return the current audio ! format---do this by passing an ``audio format'' of \code{AFMT_QUERY}. ! Returns the audio format that the device was set to, which may not be ! the requested format. \end{methoddesc} --- 138,151 ---- \end{tableii} Most systems support only a subset of these formats. Many devices only ! support \constant{AFMT_U8}; the most common format used today is ! \constant{AFMT_S16_LE}. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} Used to set the current audio format to \var{format}---see ! \method{getfmts()} for a list. May also be used to return the current ! audio format---do this by passing an ``audio format'' of ! \constant{AFMT_QUERY}. Returns the audio format that the device was set ! to, which may not be the requested format. \end{methoddesc} *************** *** 171,175 **** returns. This also occurs when the sound device is closed. The OSS documentation recommends simply closing and re-opening the device rather ! than using \code{sync}. \end{methoddesc} --- 173,177 ---- returns. This also occurs when the sound device is closed. The OSS documentation recommends simply closing and re-opening the device rather ! than using \method{sync()}. \end{methoddesc} *************** *** 177,188 **** Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends ! closing and re-opening the device after calling \code{reset}. \end{methoddesc} \begin{methoddesc}[audio device]{post} ! To be used like a lightweight \code{sync}, the \code{post} IOCTL informs ! the audio device that there is a likely to be a pause in the audio ! output---i.e., after playing a spot sound effect, before waiting for ! user input, or before doing disk IO. \end{methoddesc} --- 179,190 ---- Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends ! closing and re-opening the device after calling \method{reset()}. \end{methoddesc} \begin{methoddesc}[audio device]{post} ! To be used like a lightweight \method{sync()}, the \method{post()} ! IOCTL informs the audio device that there is a likely to be a pause in ! the audio output---i.e., after playing a spot sound effect, before ! waiting for user input, or before doing disk I/O. \end{methoddesc} *************** *** 192,199 **** Initialise the sound device in one method. \var{samplerate}, \var{channels} and \var{format} should be as specified in the ! \code{speed}, \code{channels} and \code{setfmt} methods. If ! \var{emulate} is true, attempt to find the closest matching format ! instead, otherwise raise ValueError if the device does not support the ! format. The default is to raise ValueError on unsupported formats. \end{methoddesc} --- 194,202 ---- Initialise the sound device in one method. \var{samplerate}, \var{channels} and \var{format} should be as specified in the ! \method{speed()}, \method{channels()} and \method{setfmt()} ! methods. If \var{emulate} is true, attempt to find the closest matching ! format instead, otherwise raise ValueError if the device does not ! support the format. The default is to raise ValueError on unsupported ! formats. \end{methoddesc} *************** *** 230,236 **** This method returns a bitmask specifying the available mixer controls (``Control'' being a specific mixable ``channel'', such as ! \code{SOUND_MIXER_PCM} or \code{SOUND_MIXER_SYNTH}). This bitmask indicates a subset of all available mixer channels---the ! \code{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the following Python code: --- 233,239 ---- This method returns a bitmask specifying the available mixer controls (``Control'' being a specific mixable ``channel'', such as ! \constant{SOUND_MIXER_PCM} or \constant{SOUND_MIXER_SYNTH}). This bitmask indicates a subset of all available mixer channels---the ! \constant{SOUND_MIXER_*} constants defined at module level. To determine if, for example, the current mixer object supports a PCM mixer, use the following Python code: *************** *** 243,250 **** \end{verbatim} ! For most purposes, the \code{SOUND_MIXER_VOLUME} (Master volume) and ! \code{SOUND_MIXER_PCM} channels should suffice---but code that uses the mixer should be flexible when it comes to choosing sound channels. On ! the Gravis Ultrasound, for example, \code{SOUND_MIXER_VOLUME} does not exist. \end{methoddesc} --- 246,253 ---- \end{verbatim} ! For most purposes, the \constant{SOUND_MIXER_VOLUME} (Master volume) and ! \constant{SOUND_MIXER_PCM} channels should suffice---but code that uses the mixer should be flexible when it comes to choosing sound channels. On ! the Gravis Ultrasound, for example, \constant{SOUND_MIXER_VOLUME} does not exist. \end{methoddesc} *************** *** 254,260 **** the corresponding channel is stereo; if it is unset, the channel is either monophonic or not supported by the mixer (use in combination with ! \function{channels} to determine which). ! See the code example for the \function{channels} function for an example of getting data from a bitmask. \end{methoddesc} --- 257,263 ---- the corresponding channel is stereo; if it is unset, the channel is either monophonic or not supported by the mixer (use in combination with ! \method{channels()} to determine which). ! See the code example for the \method{channels()} function for an example of getting data from a bitmask. \end{methoddesc} *************** *** 262,266 **** \begin{methoddesc}[mixer device]{reccontrols}{} Returns a bitmask specifying the mixer controls that may be used to ! record. See the code example for \function{controls} for an example of reading from a bitmask. \end{methoddesc} --- 265,269 ---- \begin{methoddesc}[mixer device]{reccontrols}{} Returns a bitmask specifying the mixer controls that may be used to ! record. See the code example for \method{controls()} for an example of reading from a bitmask. \end{methoddesc} *************** *** 268,272 **** \begin{methoddesc}[mixer device]{get}{channel} Returns the volume of a given mixer channel. The returned volume is a ! 2-tuple of \code{left volume, right volume}. Volumes are specified as numbers from 0 (silent) to 100 (full volume). If the channel is monophonic, a 2-tuple is still returned, but both channel volumes are --- 271,275 ---- \begin{methoddesc}[mixer device]{get}{channel} Returns the volume of a given mixer channel. The returned volume is a ! 2-tuple \code{(left_volume,right_volume)}. Volumes are specified as numbers from 0 (silent) to 100 (full volume). If the channel is monophonic, a 2-tuple is still returned, but both channel volumes are *************** *** 277,281 **** \begin{methoddesc}[mixer device]{set}{channel, (left, right)} ! Sets the volume for a given mixer channel to \code{(left, right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. --- 280,284 ---- \begin{methoddesc}[mixer device]{set}{channel, (left, right)} ! Sets the volume for a given mixer channel to \code{(left,right)}. \code{left} and \code{right} must be ints and between 0 (silent) and 100 (full volume). On success, the new volume is returned as a 2-tuple. From gward@users.sourceforge.net Mon Mar 10 03:05:25 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 19:05:25 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1089/lib Modified Files: libossaudiodev.tex Log Message: Expand description of ossaudiodev.error exception. Improve descriptions of open(), openmixer(). Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libossaudiodev.tex 10 Mar 2003 02:09:51 -0000 1.4 --- libossaudiodev.tex 10 Mar 2003 03:05:21 -0000 1.5 *************** *** 25,54 **** \begin{excdesc}{error} ! This exception is raised on errors. The argument is a string describing ! what went wrong. \end{excdesc} \begin{funcdesc}{open}{\optional{device, }mode} ! This function opens the audio device and returns an OSS audio device ! object. This object can then be used to do I/O on. The \var{device} ! parameter is the audio device filename to use. If it is not specified, ! this module first looks in the environment variable \envvar{AUDIODEV} for ! a device to use. If not found, it falls back to \file{/dev/dsp}. ! The \var{mode} parameter is one of \code{'r'} for record-only access, ! \code{'w'} for play-only access and \code{'rw'} for both. Since many ! soundcards only allow one process to have the recorder or player open at ! a time it is a good idea to open the device only for the activity ! needed. Further, some soundcards are half-duplex: they can be opened ! for reading or writing, but not both at once. \end{funcdesc} ! \begin{funcdesc}{openmixer}{\optional{device\optional{, mode}}} This function ! opens the mixer device and returns an OSS mixer device object. The ! \var{device} parameter is the mixer device filename to use. If it is not specified, this module first looks in the environment variable \envvar{MIXERDEV} for a device to use. If not found, it falls back to \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or \code{'w'} for \var{mode}; the default is \code{'r'}. \end{funcdesc} --- 25,75 ---- \begin{excdesc}{error} ! This exception is raised on certain errors. The argument is a string ! describing what went wrong. ! ! (If \module{ossaudiodev} receives an error from a system call such as ! \cfunction{open()}, \cfunction{write()}, or \cfunction{ioctl()}, it ! raises \exception{IOError}. Errors detected directly by ! \module{ossaudiodev} result in \exception{ossaudiodev.error}.) \end{excdesc} \begin{funcdesc}{open}{\optional{device, }mode} ! Open an audio device and return an OSS audio device object. This ! object supports many file-like methods, such as \method{read()}, ! \method{write()}, and \method{fileno()} (although there are subtle ! differences between conventional Unix read/write semantics and those of ! OSS audio devices). It also supports a number of audio-specific ! methods; see below for the complete list of methods. ! Note the unusual calling syntax: the \emph{first} argument is optional, ! and the second is required. This is a historical artifact for ! compatibility with the older \module{linuxaudiodev} module which ! \module{ossaudiodev} supersedes. % XXX it might also be motivated ! % by my unfounded-but-still-possibly-true belief that the default ! % audio device varies unpredictably across operating systems. -GW ! ! \var{device} is the audio device filename to use. If it is not ! specified, this module first looks in the environment variable ! \envvar{AUDIODEV} for a device to use. If not found, it falls back to ! \file{/dev/dsp}. ! ! \var{mode} is one of \code{'r'} for read-only (record) access, ! \code{'w'} for write-only (playback) access and \code{'rw'} for both. ! Since many soundcards only allow one process to have the recorder or ! player open at a time it is a good idea to open the device only for the ! activity needed. Further, some soundcards are half-duplex: they can be ! opened for reading or writing, but not both at once. \end{funcdesc} ! \begin{funcdesc}{openmixer}{\optional{device\optional{, mode}}} ! Open a mixer device and return an OSS mixer device object. ! \var{device} is the mixer device filename to use. If it is not specified, this module first looks in the environment variable \envvar{MIXERDEV} for a device to use. If not found, it falls back to \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or \code{'w'} for \var{mode}; the default is \code{'r'}. + + % XXX I suspect 'mode' is irrelevant, ie. that OSS doesn't care. + % If so this argument and the code that handles it should be ripped out. \end{funcdesc} From gward@users.sourceforge.net Mon Mar 10 03:17:13 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 19:17:13 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv4076/Modules Modified Files: ossaudiodev.c Log Message: seems to exist on both Linux and FreeBSD, so include it instead of the OS-specific or . Mixers devices have an ioctl-only interface, no read/write -- so the flags passed to open() don't really matter. Thus, drop the 'mode' parameter to openmixer() (ie. second arg to newossmixerobject()) and always open mixers with O_RDWR. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ossaudiodev.c 13 Feb 2003 13:27:07 -0000 1.23 --- ossaudiodev.c 10 Mar 2003 03:17:06 -0000 1.24 *************** *** 30,46 **** #endif - #include #if defined(linux) - #include typedef unsigned long uint32_t; #elif defined(__FreeBSD__) - #include ! #ifndef SNDCTL_DSP_CHANNELS ! #define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS ! #endif #endif --- 30,45 ---- #endif #include + #include + #if defined(linux) typedef unsigned long uint32_t; #elif defined(__FreeBSD__) ! # ifndef SNDCTL_DSP_CHANNELS ! # define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS ! # endif #endif *************** *** 170,178 **** newossmixerobject(PyObject *arg) { ! char *basedev = NULL, *mode = NULL; ! int fd, imode; oss_mixer_t *self; ! if (!PyArg_ParseTuple(arg, "|ss", &basedev, &mode)) { return NULL; } --- 169,177 ---- newossmixerobject(PyObject *arg) { ! char *basedev = NULL; ! int fd; oss_mixer_t *self; ! if (!PyArg_ParseTuple(arg, "|s", &basedev)) { return NULL; } *************** *** 184,203 **** } ! if (mode == NULL || strcmp(mode, "r") == 0) ! imode = O_RDONLY; ! else if (strcmp(mode, "w") == 0) ! imode = O_WRONLY; ! else if (strcmp(mode, "rw") == 0) ! imode = O_RDWR; ! else { ! PyErr_SetString(OSSAudioError, "mode must be 'r', 'w', or 'rw'"); ! return NULL; ! } ! ! if ((fd = open(basedev, imode)) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } ! if ((self = PyObject_New(oss_mixer_t, &OSSMixerType)) == NULL) { close(fd); --- 183,191 ---- } ! if ((fd = open(basedev, O_RDWR)) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } ! if ((self = PyObject_New(oss_mixer_t, &OSSMixerType)) == NULL) { close(fd); From gward@users.sourceforge.net Mon Mar 10 03:18:22 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 09 Mar 2003 19:18:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4966 Modified Files: libossaudiodev.tex Log Message: openmixer()'s 'mode' parameter has been removed. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libossaudiodev.tex 10 Mar 2003 03:05:21 -0000 1.5 --- libossaudiodev.tex 10 Mar 2003 03:18:19 -0000 1.6 *************** *** 62,75 **** \end{funcdesc} ! \begin{funcdesc}{openmixer}{\optional{device\optional{, mode}}} Open a mixer device and return an OSS mixer device object. \var{device} is the mixer device filename to use. If it is not specified, this module first looks in the environment variable \envvar{MIXERDEV} for a device to use. If not found, it falls back to ! \file{/dev/mixer}. You may specify \code{'r'}, \code{'rw'} or ! \code{'w'} for \var{mode}; the default is \code{'r'}. ! ! % XXX I suspect 'mode' is irrelevant, ie. that OSS doesn't care. ! % If so this argument and the code that handles it should be ripped out. \end{funcdesc} --- 62,71 ---- \end{funcdesc} ! \begin{funcdesc}{openmixer}{\optional{device}} Open a mixer device and return an OSS mixer device object. \var{device} is the mixer device filename to use. If it is not specified, this module first looks in the environment variable \envvar{MIXERDEV} for a device to use. If not found, it falls back to ! \file{/dev/mixer}. \end{funcdesc} From bwarsaw@users.sourceforge.net Mon Mar 10 15:11:36 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 07:11:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv13169 Modified Files: test_email.py Log Message: test_another_long_multiline_header(): Yet another formatting test. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test_email.py 7 Mar 2003 23:23:04 -0000 1.37 --- test_email.py 10 Mar 2003 15:11:29 -0000 1.38 *************** *** 811,814 **** --- 811,826 ---- """) + def test_another_long_multiline_header(self): + eq = self.ndiffAssertEqual + m = '''\ + Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); + Wed, 16 Oct 2002 07:41:11 -0700''' + msg = email.message_from_string(m) + eq(msg.as_string(), '''\ + Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with + Microsoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 + + ''') + From akuchling@users.sourceforge.net Mon Mar 10 15:12:08 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 10 Mar 2003 07:12:08 -0800 Subject: [Python-checkins] python/dist/src/Lib asynchat.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13379 Modified Files: asynchat.py Log Message: Use isinstance() instead of type comparison Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** asynchat.py 30 Jun 2002 03:39:14 -0000 1.19 --- asynchat.py 10 Mar 2003 15:12:00 -0000 1.20 *************** *** 105,109 **** self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' ! elif type(terminator) == type(0): # numeric terminator n = terminator --- 105,109 ---- self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' ! elif isinstance(terminator, int): # numeric terminator n = terminator *************** *** 184,188 **** # of the first producer in the queue def refill_buffer (self): - _string_type = type('') while 1: if len(self.producer_fifo): --- 184,187 ---- *************** *** 195,199 **** self.close() return ! elif type(p) is _string_type: self.producer_fifo.pop() self.ac_out_buffer = self.ac_out_buffer + p --- 194,198 ---- self.close() return ! elif isinstance(p, str): self.producer_fifo.pop() self.ac_out_buffer = self.ac_out_buffer + p From bwarsaw@users.sourceforge.net Mon Mar 10 15:14:12 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 07:14:12 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv14235 Modified Files: Header.py Log Message: _split_ascii() [method and function]: Don't join the lines just to split them again. Simply return them as chunk lists. _encode_chunks(): Don't add more folding whitespace than necessary. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Header.py 7 Mar 2003 23:24:34 -0000 1.24 --- Header.py 10 Mar 2003 15:14:08 -0000 1.25 *************** *** 338,345 **** def _split_ascii(self, s, charset, firstlen, splitchars): ! line = _split_ascii(s, firstlen, self._maxlinelen, ! self._continuation_ws, splitchars) ! lines = line.splitlines() ! return zip(lines, [charset]*len(lines)) def _encode_chunks(self, newchunks, maxlinelen): --- 338,344 ---- def _split_ascii(self, s, charset, firstlen, splitchars): ! chunks = _split_ascii(s, firstlen, self._maxlinelen, ! self._continuation_ws, splitchars) ! return zip(chunks, [charset]*len(chunks)) def _encode_chunks(self, newchunks, maxlinelen): *************** *** 361,365 **** # =?charset1?q?Mar=EDa_Gonz=E1lez_Alonso?=\n # =?charset2?b?SvxyZ2VuIEL2aW5n?=" - # chunks = [] for header, charset in newchunks: --- 360,363 ---- *************** *** 368,372 **** else: s = charset.header_encode(header) ! _max_append(chunks, s, maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) --- 366,375 ---- else: s = charset.header_encode(header) ! # Don't add more folding whitespace than necessary ! if chunks and chunks[-1].endswith(' '): ! extra = '' ! else: ! extra = ' ' ! _max_append(chunks, s, maxlinelen, extra) joiner = NL + self._continuation_ws return joiner.join(chunks) *************** *** 413,417 **** def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): - linejoiner = '\n' + continuation_ws lines = [] maxlen = firstlen --- 416,419 ---- *************** *** 465,471 **** # on whitespace. if partlen > maxlen and ch <> ' ': ! subs = _split_ascii(part, maxlen, restlen, continuation_ws, ' ') - subl = re.split(linejoiner, subs) lines.extend(subl[:-1]) this = [subl[-1]] --- 467,472 ---- # on whitespace. if partlen > maxlen and ch <> ' ': ! subl = _split_ascii(part, maxlen, restlen, continuation_ws, ' ') lines.extend(subl[:-1]) this = [subl[-1]] *************** *** 480,484 **** if this: lines.append(joiner.join(this)) ! return linejoiner.join(lines) --- 481,485 ---- if this: lines.append(joiner.join(this)) ! return lines From akuchling@users.sourceforge.net Mon Mar 10 15:16:57 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 10 Mar 2003 07:16:57 -0800 Subject: [Python-checkins] python/dist/src/Lib asynchat.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14644 Modified Files: asynchat.py Log Message: [Patch #649762] Fix for asynchat endless loop When the null string is used as the terminator, it used to be the same as None, meaning "collect all the data". In the current code, however, it falls into an endless loop; this change reverts to the old behavior. Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** asynchat.py 10 Mar 2003 15:12:00 -0000 1.20 --- asynchat.py 10 Mar 2003 15:16:54 -0000 1.21 *************** *** 101,105 **** lb = len(self.ac_in_buffer) terminator = self.get_terminator() ! if terminator is None: # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) --- 101,105 ---- lb = len(self.ac_in_buffer) terminator = self.get_terminator() ! if terminator is None or terminator == '': # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) From loewis@users.sourceforge.net Mon Mar 10 16:01:46 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 10 Mar 2003 08:01:46 -0800 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10742 Modified Files: gettext.py Log Message: Patch #700839: Fix bugs in the plural handling. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** gettext.py 21 Nov 2002 21:45:32 -0000 1.16 --- gettext.py 10 Mar 2003 16:01:43 -0000 1.17 *************** *** 33,37 **** # module. # ! # J. David Ibanez implemented plural forms. # # TODO: --- 33,37 ---- # module. # ! # J. David Ibanez implemented plural forms. Bruno Haible fixed some bugs. # # TODO: *************** *** 81,87 **** import token, tokenize tokens = tokenize.generate_tokens(StringIO(plural).readline) ! danger = [ x for x in tokens if x[0] == token.NAME and x[1] != 'n' ] ! if danger: ! raise ValueError, 'dangerous expression' # Replace some C operators by their Python equivalents --- 81,92 ---- import token, tokenize tokens = tokenize.generate_tokens(StringIO(plural).readline) ! try: ! danger = [ x for x in tokens if x[0] == token.NAME and x[1] != 'n' ] ! except tokenize.TokenError: ! raise ValueError, \ ! 'plural forms expression error, maybe unbalanced parenthesis' ! else: ! if danger: ! raise ValueError, 'plural forms expression could be dangerous' # Replace some C operators by their Python equivalents *************** *** 89,94 **** plural = plural.replace('||', ' or ') ! expr = re.compile(r'\![^=]') ! plural = expr.sub(' not ', plural) # Regular expression and replacement function used to transform --- 94,99 ---- plural = plural.replace('||', ' or ') ! expr = re.compile(r'\!([^=])') ! plural = expr.sub(' not \\1', plural) # Regular expression and replacement function used to transform *************** *** 105,109 **** stack.append('') elif c == ')': ! if len(stack) == 0: raise ValueError, 'unbalanced parenthesis in plural form' s = expr.sub(repl, stack.pop()) --- 110,117 ---- stack.append('') elif c == ')': ! if len(stack) == 1: ! # Actually, we never reach this code, because unbalanced ! # parentheses get caught in the security check at the ! # beginning. raise ValueError, 'unbalanced parenthesis in plural form' s = expr.sub(repl, stack.pop()) *************** *** 226,229 **** --- 234,238 ---- # bit words. self._catalog = catalog = {} + self.plural = lambda n: int(n != 1) # germanic plural by default buf = fp.read() buflen = len(buf) *************** *** 259,263 **** raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata ! if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.split('\n'): --- 268,272 ---- raise IOError(0, 'File is corrupt', filename) # See if we're looking at GNU .mo conventions for metadata ! if mlen == 0: # Catalog description for item in tmsg.split('\n'): From bwarsaw@users.sourceforge.net Mon Mar 10 16:09:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 08:09:56 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv16003 Modified Files: test_email.py Log Message: test_broken_base64_payload(): Test for crash in low-level binascii module when decoding a message with broken base64. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** test_email.py 10 Mar 2003 15:11:29 -0000 1.38 --- test_email.py 10 Mar 2003 16:09:51 -0000 1.39 *************** *** 459,462 **** --- 459,470 ---- self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing') + def test_broken_base64_payload(self): + x = 'AwDp0P7//y6LwKEAcPa/6Q=9' + msg = Message() + msg['content-type'] = 'audio/x-midi' + msg['content-transfer-encoding'] = 'base64' + msg.set_payload(x) + self.assertEqual(msg.get_payload(decode=True), x) + From bwarsaw@users.sourceforge.net Mon Mar 10 16:13:23 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 08:13:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv17913 Modified Files: Message.py Log Message: get_payload(): If we get a low-level binascii.Error when base64 decoding the payload, just return it as-is. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Message.py 10 Oct 2002 15:13:26 -0000 1.28 --- Message.py 10 Mar 2003 16:13:14 -0000 1.29 *************** *** 6,9 **** --- 6,10 ---- import re + import binascii import warnings from cStringIO import StringIO *************** *** 11,16 **** # Intrapackage imports - from email import Errors from email import Utils from email import Charset --- 12,17 ---- # Intrapackage imports from email import Utils + from email import Errors from email import Charset *************** *** 170,176 **** multipart, the payload will be decoded if this header's value is `quoted-printable' or `base64'. If some other encoding is used, or ! the header is missing, the payload is returned as-is (undecoded). If ! the message is a multipart and the decode flag is True, then None is ! returned. """ if i is None: --- 171,179 ---- multipart, the payload will be decoded if this header's value is `quoted-printable' or `base64'. If some other encoding is used, or ! the header is missing, or if the payload has bogus base64 data, the ! payload is returned as-is (undecoded). ! ! If the message is a multipart and the decode flag is True, then None ! is returned. """ if i is None: *************** *** 187,191 **** return Utils._qdecode(payload) elif cte.lower() == 'base64': ! return Utils._bdecode(payload) # Everything else, including encodings with 8bit or 7bit are returned # unchanged. --- 190,198 ---- return Utils._qdecode(payload) elif cte.lower() == 'base64': ! try: ! return Utils._bdecode(payload) ! except binascii.Error: ! # Incorrect padding ! return payload # Everything else, including encodings with 8bit or 7bit are returned # unchanged. From bwarsaw@users.sourceforge.net Mon Mar 10 16:13:55 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 08:13:55 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib emailmessage.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18208 Modified Files: emailmessage.tex Log Message: Describe what happens when decode=True and the payload has bogus base64 data. Index: emailmessage.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmessage.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** emailmessage.tex 10 Oct 2002 15:22:16 -0000 1.9 --- emailmessage.tex 10 Mar 2003 16:13:50 -0000 1.10 *************** *** 88,94 **** \samp{base64}. If some other encoding is used, or \mailheader{Content-Transfer-Encoding} header is ! missing, the payload is returned as-is (undecoded). If the message is ! a multipart and the \var{decode} flag is \code{True}, then \code{None} is ! returned. The default for \var{decode} is \code{False}. \end{methoddesc} --- 88,95 ---- \samp{base64}. If some other encoding is used, or \mailheader{Content-Transfer-Encoding} header is ! missing, or if the payload has bogus base64 data, the payload is ! returned as-is (undecoded). If the message is a multipart and the ! \var{decode} flag is \code{True}, then \code{None} is returned. The ! default for \var{decode} is \code{False}. \end{methoddesc} From bwarsaw@users.sourceforge.net Mon Mar 10 16:59:37 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 08:59:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv11022 Modified Files: test_email.py Log Message: Use ndiffAssertEqual in a couple of places for better error reporting. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_email.py 10 Mar 2003 16:09:51 -0000 1.39 --- test_email.py 10 Mar 2003 16:59:34 -0000 1.40 *************** *** 1090,1093 **** --- 1090,1094 ---- def test_one_part_in_a_multipart(self): + eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' *************** *** 1099,1103 **** msg = MIMEText('hello world') outer.attach(msg) ! self.assertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 --- 1100,1104 ---- msg = MIMEText('hello world') outer.attach(msg) ! eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 *************** *** 1117,1120 **** --- 1118,1122 ---- def test_seq_parts_in_a_multipart(self): + eq = self.ndiffAssertEqual outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' *************** *** 1126,1130 **** outer.attach(msg) outer.set_boundary('BOUNDARY') ! self.assertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 --- 1128,1132 ---- outer.attach(msg) outer.set_boundary('BOUNDARY') ! eq(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 *************** *** 1411,1414 **** --- 1413,1417 ---- def test_epilogue(self): + eq = self.ndiffAssertEqual fp = openfile('msg_21.txt') try: *************** *** 1430,1434 **** g = Generator(sfp) g.flatten(msg) ! self.assertEqual(sfp.getvalue(), text) def test_no_nl_preamble(self): --- 1433,1437 ---- g = Generator(sfp) g.flatten(msg) ! eq(sfp.getvalue(), text) def test_no_nl_preamble(self): From bwarsaw@users.sourceforge.net Mon Mar 10 17:00:51 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 09:00:51 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv11609 Modified Files: test_email.py Log Message: Fix base class Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_email.py 10 Mar 2003 16:59:34 -0000 1.40 --- test_email.py 10 Mar 2003 17:00:43 -0000 1.41 *************** *** 1007,1011 **** # Test a more complicated multipart/mixed type message ! class TestMultipartMixed(unittest.TestCase): def setUp(self): fp = openfile('PyBanner048.gif') --- 1007,1011 ---- # Test a more complicated multipart/mixed type message ! class TestMultipartMixed(TestEmailBase): def setUp(self): fp = openfile('PyBanner048.gif') From bwarsaw@users.sourceforge.net Mon Mar 10 17:36:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 09:36:08 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv30210 Modified Files: Utils.py Log Message: _bdecode(): Remove redundant check. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Utils.py 7 Mar 2003 22:46:41 -0000 1.22 --- Utils.py 10 Mar 2003 17:36:04 -0000 1.23 *************** *** 67,72 **** def _bdecode(s): - if not s: - return s # We can't quite use base64.encodestring() since it tacks on a "courtesy # newline". Blech! --- 67,70 ---- From bwarsaw@users.sourceforge.net Mon Mar 10 19:18:48 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 11:18:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv23679 Modified Files: test_email.py Log Message: test_escape_backslashes(): A test for SF bug #663369 by Matthew Woodcraft. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_email.py 10 Mar 2003 17:00:43 -0000 1.41 --- test_email.py 10 Mar 2003 19:18:34 -0000 1.42 *************** *** 1860,1863 **** --- 1860,1871 ---- self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b)) + def test_escape_backslashes(self): + self.assertEqual( + Utils.formataddr(('Arthur \Backslash\ Foobar', 'person@dom.ain')), + r'"Arthur \\Backslash\\ Foobar" ') + a = r'Arthur \Backslash\ Foobar' + b = 'person@dom.ain' + self.assertEqual(Utils.parseaddr(Utils.formataddr((a, b))), (a, b)) + def test_name_with_dot(self): x = 'John X. Doe ' From bwarsaw@users.sourceforge.net Mon Mar 10 19:20:21 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 11:20:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv24677 Modified Files: Utils.py Log Message: specialsre, escapesre: In SF bug #663369, Matthew Woodcraft points out that backslashes must be escaped in character sets. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Utils.py 10 Mar 2003 17:36:04 -0000 1.23 --- Utils.py 10 Mar 2003 19:20:18 -0000 1.24 *************** *** 55,60 **** CRLF = '\r\n' ! specialsre = re.compile(r'[][\()<>@,:;".]') ! escapesre = re.compile(r'[][\()"]') --- 55,60 ---- CRLF = '\r\n' ! specialsre = re.compile(r'[][\\()<>@,:;".]') ! escapesre = re.compile(r'[][\\()"]') From bwarsaw@users.sourceforge.net Tue Mar 11 04:31:39 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 20:31:39 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv27845 Modified Files: test_email.py Log Message: test_get_decoded_uu_payload(): A new test for Content-Transfer-Encoding: x-uuencode Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_email.py 10 Mar 2003 19:18:34 -0000 1.42 --- test_email.py 11 Mar 2003 04:31:37 -0000 1.43 *************** *** 205,208 **** --- 205,219 ---- 'This has no Content-Transfer-Encoding: header.\n') + def test_get_decoded_uu_payload(self): + eq = self.assertEqual + msg = Message() + msg.set_payload('begin 666 -\n+:&5L;&\\@=V]R;&0 \n \nend\n') + for cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): + msg['content-transfer-encoding'] = cte + eq(msg.get_payload(decode=True), 'hello world') + # Now try some bogus data + msg.set_payload('foo') + eq(msg.get_payload(decode=True), 'foo') + def test_decoded_generator(self): eq = self.assertEqual From bwarsaw@users.sourceforge.net Tue Mar 11 04:33:33 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 20:33:33 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv28372 Modified Files: Message.py Log Message: get_payload(): Teach this about various uunencoded Content-Transfer-Encodings Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Message.py 10 Mar 2003 16:13:14 -0000 1.29 --- Message.py 11 Mar 2003 04:33:30 -0000 1.30 *************** *** 6,9 **** --- 6,10 ---- import re + import uu import binascii import warnings *************** *** 166,176 **** i returns that index into the payload. ! Optional decode is a flag (defaulting to False) indicating whether the ! payload should be decoded or not, according to the ! Content-Transfer-Encoding header. When True and the message is not a ! multipart, the payload will be decoded if this header's value is ! `quoted-printable' or `base64'. If some other encoding is used, or ! the header is missing, or if the payload has bogus base64 data, the ! payload is returned as-is (undecoded). If the message is a multipart and the decode flag is True, then None --- 167,179 ---- i returns that index into the payload. ! Optional decode is a flag indicating whether the payload should be ! decoded or not, according to the Content-Transfer-Encoding header ! (default is False). ! ! When True and the message is not a multipart, the payload will be ! decoded if this header's value is `quoted-printable' or `base64'. If ! some other encoding is used, or the header is missing, or if the ! payload has bogus data (i.e. bogus base64 or uuencoded data), the ! payload is returned as-is. If the message is a multipart and the decode flag is True, then None *************** *** 186,197 **** if self.is_multipart(): return None ! cte = self.get('content-transfer-encoding', '') ! if cte.lower() == 'quoted-printable': return Utils._qdecode(payload) ! elif cte.lower() == 'base64': try: return Utils._bdecode(payload) except binascii.Error: # Incorrect padding return payload # Everything else, including encodings with 8bit or 7bit are returned --- 189,208 ---- if self.is_multipart(): return None ! cte = self.get('content-transfer-encoding', '').lower() ! if cte == 'quoted-printable': return Utils._qdecode(payload) ! elif cte == 'base64': try: return Utils._bdecode(payload) except binascii.Error: # Incorrect padding + return payload + elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): + sfp = StringIO() + try: + uu.decode(StringIO(payload+'\n'), sfp) + payload = sfp.getvalue() + except uu.Error: + # Some decoding problem return payload # Everything else, including encodings with 8bit or 7bit are returned From bwarsaw@users.sourceforge.net Tue Mar 11 04:40:16 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 20:40:16 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib emailiter.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30415 Modified Files: emailiter.tex Log Message: body_line_iterator() now takes a decode argument. Index: emailiter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailiter.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** emailiter.tex 1 Oct 2002 01:05:52 -0000 1.3 --- emailiter.tex 11 Mar 2003 04:40:14 -0000 1.4 *************** *** 7,11 **** trees. ! \begin{funcdesc}{body_line_iterator}{msg} This iterates over all the payloads in all the subparts of \var{msg}, returning the string payloads line-by-line. It skips over all the --- 7,11 ---- trees. ! \begin{funcdesc}{body_line_iterator}{msg\optional{, decode}} This iterates over all the payloads in all the subparts of \var{msg}, returning the string payloads line-by-line. It skips over all the *************** *** 14,17 **** --- 14,19 ---- flat text representation of the message from a file using \method{readline()}, skipping over all the intervening headers. + + Optional \var{decode} is passed through to \method{Message.get_payload()}. \end{funcdesc} From bwarsaw@users.sourceforge.net Tue Mar 11 04:41:20 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 20:41:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv30655 Modified Files: _compat21.py Log Message: body_line_iterator(): Accept optional decode argument, pass through to Message.get_payload(). Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _compat21.py 24 Dec 2002 18:31:27 -0000 1.5 --- _compat21.py 11 Mar 2003 04:41:18 -0000 1.6 *************** *** 38,46 **** # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg): ! """Iterate over the parts, returning string payloads line-by-line.""" lines = [] for subpart in msg.walk(): ! payload = subpart.get_payload() if _isstring(payload): for line in StringIO(payload).readlines(): --- 38,49 ---- # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg, decode=False): ! """Iterate over the parts, returning string payloads line-by-line. ! ! Optional decode (default False) is passed through to .get_payload(). ! """ lines = [] for subpart in msg.walk(): ! payload = subpart.get_payload(decode=decode) if _isstring(payload): for line in StringIO(payload).readlines(): From bwarsaw@users.sourceforge.net Tue Mar 11 04:41:37 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 20:41:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv30737 Modified Files: _compat22.py Log Message: body_line_iterator(): Accept optional decode argument, pass through to Message.get_payload(). Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _compat22.py 10 Sep 2002 16:09:06 -0000 1.4 --- _compat22.py 11 Mar 2003 04:41:35 -0000 1.5 *************** *** 39,46 **** # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg): ! """Iterate over the parts, returning string payloads line-by-line.""" for subpart in msg.walk(): ! payload = subpart.get_payload() if _isstring(payload): for line in StringIO(payload): --- 39,49 ---- # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg, decode=False): ! """Iterate over the parts, returning string payloads line-by-line. ! ! Optional decode (default False) is passed through to .get_payload(). ! """ for subpart in msg.walk(): ! payload = subpart.get_payload(decode=decode) if _isstring(payload): for line in StringIO(payload): From goodger@users.sourceforge.net Tue Mar 11 04:49:47 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 10 Mar 2003 20:49:47 -0800 Subject: [Python-checkins] python/nondist/peps pep-0309.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv425 Modified Files: pep-0309.txt Log Message: update from Peter Harris, plus spell-check & edit Index: pep-0309.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0309.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0309.txt 19 Feb 2003 00:46:51 -0000 1.2 --- pep-0309.txt 11 Mar 2003 04:49:44 -0000 1.3 *************** *** 9,31 **** Created: 08-Feb-2003 Python-Version: 2.4 ! Post-History: 10-Feb-2003 Abstract ! ========= ! This proposal is for a built-in closure or curry type for Python that ! allows a new callable to be constructed from another callable and a ! partial argument list (including positional and keyword arguments). A ! concise syntax shorthand for curried functions is suggested ! (tentatively). Note: after feedback on comp.lang.python, I am persuaded that the most ! accurate term for this is a 'curry', so the terminology has been ! amended since the first version of this PEP. Motivation ! =========== Curried functions are useful as functional 'sections' or as convenient --- 9,32 ---- Created: 08-Feb-2003 Python-Version: 2.4 ! Post-History: 10-Feb-2003, 27-Feb-2003 Abstract ! ======== ! This proposal is for a standard curry type for Python that ! allows a new callable to be constructed from a callable and a ! partial argument list (including positional and keyword arguments). Note: after feedback on comp.lang.python, I am persuaded that the most ! accurate term for this is a 'curry' rather than a 'closure', so the ! terminology has been amended since the first version of this PEP. ! ! I propose a standard library module called "functional", to hold useful ! higher-order functions, including the curry() class. Motivation ! ========== Curried functions are useful as functional 'sections' or as convenient *************** *** 50,54 **** Rationale ! ========== Here is one way to do a curry in Python:: --- 51,55 ---- Rationale ! ========= Here is one way to do a curry in Python:: *************** *** 60,65 **** def __call__(self, *args, **kw): ! d = self.kw.copy() ! d.update(kw) return self.fn(*(self.args + args), **d) --- 61,69 ---- def __call__(self, *args, **kw): ! if self.kw: ! d = self.kw.copy() ! d.update(kw) ! else: ! d = kw return self.fn(*(self.args + args), **d) *************** *** 79,93 **** http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549. - Tentative Syntax Proposal - ========================== ! I know syntax proposals have the odds stacked against them, and ! introducing new punctuation characters is frowned upon, but I think ! curries may be a sufficiently powerful abstraction to deserve it. ! I suggest the syntax ``fn@(*args, **kw)``, meaning the same as ! ``curry(fn, *args, **kw)``. I have no idea what havoc this would ! wreak on the parser. At least there are no backwards-compatibility issues because the @ --- 83,96 ---- http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549. + Update: It seems likely that a standard library implementation would + be in Python, and would have to prove its worth there before making + it into the built-ins. ! Abandoned Syntax Proposal ! ========================= ! I originally suggested the syntax ``fn@(*args, **kw)``, meaning the same ! as ``curry(fn, *args, **kw)``. At least there are no backwards-compatibility issues because the @ *************** *** 120,126 **** nextarg = sys.argv.pop@(0) Feedback from comp.lang.python ! =============================== Among the opinions voiced were the following (which I summarise): --- 123,132 ---- nextarg = sys.argv.pop@(0) + It has not been well-received, so I am not pursuing this as a serious + proposal. + Feedback from comp.lang.python ! ============================== Among the opinions voiced were the following (which I summarise): *************** *** 137,141 **** library. ! * It maybe isn't useful enough to be in the builtins. I agree that lambda is usually good enough, just not always. And I --- 143,155 ---- library. ! * It maybe isn't useful enough to be in the built-ins. ! ! * The idea of a module called ``functional`` was well received, and ! there are other things that belong there (for example function ! composition). ! ! * For completeness, another curry class that appends curried arguments ! after those supplied in the function call (maybe called ! ``rightcurry``) has been suggested. I agree that lambda is usually good enough, just not always. And I *************** *** 152,162 **** amended this PEP accordingly. - I think it's best as a builtin type rather than in a separate standard - library module, because it's simple and general enough. It may not be - an idiom that is very common in Python programming at the moment, but - I think that's because you have to code it yourself if you want it. - If added as a built-in feature, we would soon be wondering how we - managed without it. - Carl Banks posted an implementation as a real functional closure:: --- 166,169 ---- *************** *** 177,205 **** cdef class curry: cdef object fn, args, kw def __init__(self, fn, *args, **kw): self.fn=fn ! self.args=args ! self.kw = kw def __call__(self, *args, **kw): ! if self.kw: # from Python Cookbook version ! d = self.kw.copy() d.update(kw) ! else: ! d=kw return self.fn(*(self.args + args), **d) ! but I'm guessing that there would be minimal performance improvement ! since it compiles to a load of Python API calls. Summary ! ======== ! I maintain that curry should be a built-in, with the semantics as ! described, whether as a function or a class. The @ syntax proposal is withdrawn. --- 184,225 ---- cdef class curry: + cdef object fn, args, kw + def __init__(self, fn, *args, **kw): self.fn=fn ! self.args=args ! self.kw = kw def __call__(self, *args, **kw): ! if self.kw: # from Python Cookbook version ! d = self.kw.copy() d.update(kw) ! else: ! d=kw return self.fn(*(self.args + args), **d) ! The performance gain in Pyrex is less than 100% over the nested function ! implementation, since to be fully general it has to operate by Python API ! calls. Any C implementation will be unlikely to be much faster, so the ! case for a builtin coded in C is not very strong. ! Summary ! ======= ! I prefer that curry should be a built-in, with the semantics as ! described, whether as a function or a class. However, it should do its ! apprenticeship in the standard library first. ! ! The standard library module ``functional`` should contain ``curry`` and ! ``rightcurry`` classes, and any other higher-order functions the community ! want. These other functions fall outside this PEP though. The @ syntax proposal is withdrawn. + + Since this proposal is now much less ambitious, I'd like to aim for + inclusion in Python 2.3. From bwarsaw@users.sourceforge.net Tue Mar 11 05:03:27 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 21:03:27 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib emailmimebase.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4137 Modified Files: emailmimebase.tex Log Message: For email 2.5b1, we no longer add a trailing newline to MIMEText.__init__()'s _text argument if it doesn't already end in a newline. This may be controversial. Index: emailmimebase.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmimebase.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** emailmimebase.tex 1 Oct 2002 04:33:16 -0000 1.2 --- emailmimebase.tex 11 Mar 2003 05:03:25 -0000 1.3 *************** *** 152,157 **** character set of the text and is passed as a parameter to the \class{MIMENonMultipart} constructor; it defaults to \code{us-ascii}. No ! guessing or encoding is performed on the text data, but a newline is ! appended to \var{_text} if it doesn't already end with a newline. \deprecated{2.2.2}{The \var{_encoding} argument has been deprecated. --- 152,156 ---- character set of the text and is passed as a parameter to the \class{MIMENonMultipart} constructor; it defaults to \code{us-ascii}. No ! guessing or encoding is performed on the text data. \deprecated{2.2.2}{The \var{_encoding} argument has been deprecated. From bwarsaw@users.sourceforge.net Tue Mar 11 05:04:11 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 21:04:11 -0800 Subject: [Python-checkins] python/dist/src/Lib/email MIMEText.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv4392 Modified Files: MIMEText.py Log Message: __init__(): Don't add a newline to _text if it doesn't already end in one. Possibly controversial. Index: MIMEText.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/MIMEText.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MIMEText.py 1 Oct 2002 00:52:27 -0000 1.7 --- MIMEText.py 11 Mar 2003 05:04:09 -0000 1.8 *************** *** 18,23 **** """Create a text/* type MIME document. ! _text is the string for this message object. If the text does not end ! in a newline, one is added. _subtype is the MIME sub content type, defaulting to "plain". --- 18,22 ---- """Create a text/* type MIME document. ! _text is the string for this message object. _subtype is the MIME sub content type, defaulting to "plain". *************** *** 36,41 **** MIMENonMultipart.__init__(self, 'text', _subtype, **{'charset': _charset}) - if _text and not _text.endswith('\n'): - _text += '\n' self.set_payload(_text, _charset) if _encoder is not None: --- 35,38 ---- From bwarsaw@users.sourceforge.net Tue Mar 11 05:04:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 21:04:56 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv4565 Modified Files: test_email.py Log Message: Adjust tests for no newline appending to MIMEText.__init__()'s _text argument. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** test_email.py 11 Mar 2003 04:31:37 -0000 1.43 --- test_email.py 11 Mar 2003 05:04:54 -0000 1.44 *************** *** 485,497 **** eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_noop) ! eq(msg.get_payload(), 'hello world\n') def test_encode_7bit(self): eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_7or8bit) ! eq(msg.get_payload(), 'hello world\n') eq(msg['content-transfer-encoding'], '7bit') msg = MIMEText('hello \x7f world', _encoder=Encoders.encode_7or8bit) ! eq(msg.get_payload(), 'hello \x7f world\n') eq(msg['content-transfer-encoding'], '7bit') --- 485,497 ---- eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_noop) ! eq(msg.get_payload(), 'hello world') def test_encode_7bit(self): eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_7or8bit) ! eq(msg.get_payload(), 'hello world') eq(msg['content-transfer-encoding'], '7bit') msg = MIMEText('hello \x7f world', _encoder=Encoders.encode_7or8bit) ! eq(msg.get_payload(), 'hello \x7f world') eq(msg['content-transfer-encoding'], '7bit') *************** *** 499,503 **** eq = self.assertEqual msg = MIMEText('hello \x80 world', _encoder=Encoders.encode_7or8bit) ! eq(msg.get_payload(), 'hello \x80 world\n') eq(msg['content-transfer-encoding'], '8bit') --- 499,503 ---- eq = self.assertEqual msg = MIMEText('hello \x80 world', _encoder=Encoders.encode_7or8bit) ! eq(msg.get_payload(), 'hello \x80 world') eq(msg['content-transfer-encoding'], '8bit') *************** *** 511,515 **** eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_base64) ! eq(msg.get_payload(), 'aGVsbG8gd29ybGQK\n') eq(msg['content-transfer-encoding'], 'base64') --- 511,515 ---- eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_base64) ! eq(msg.get_payload(), 'aGVsbG8gd29ybGQ=') eq(msg['content-transfer-encoding'], 'base64') *************** *** 517,521 **** eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_quopri) ! eq(msg.get_payload(), 'hello=20world\n') eq(msg['content-transfer-encoding'], 'quoted-printable') --- 517,521 ---- eq = self.assertEqual msg = MIMEText('hello world', _encoder=Encoders.encode_quopri) ! eq(msg.get_payload(), 'hello=20world') eq(msg['content-transfer-encoding'], 'quoted-printable') *************** *** 1006,1010 **** def test_payload(self): ! self.assertEqual(self._msg.get_payload(), 'hello there\n') self.failUnless(not self._msg.is_multipart()) --- 1006,1010 ---- def test_payload(self): ! self.assertEqual(self._msg.get_payload(), 'hello there') self.failUnless(not self._msg.is_multipart()) *************** *** 1124,1128 **** hello world - --BOUNDARY-- ''') --- 1124,1127 ---- *************** *** 1152,1156 **** hello world - --BOUNDARY-- ''') --- 1151,1154 ---- *************** *** 1472,1476 **** One - --BOUNDARY Content-Type: text/plain; charset="us-ascii" --- 1470,1473 ---- *************** *** 1479,1483 **** Two - --BOUNDARY-- """) --- 1476,1479 ---- From bwarsaw@users.sourceforge.net Tue Mar 11 05:05:23 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 21:05:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv4757 Modified Files: __init__.py Log Message: beta 1 Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** __init__.py 30 Dec 2002 19:08:38 -0000 1.23 --- __init__.py 11 Mar 2003 05:05:21 -0000 1.24 *************** *** 5,9 **** """ ! __version__ = '2.5a1' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5b1' __all__ = [ From bwarsaw@users.sourceforge.net Tue Mar 11 05:10:48 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 10 Mar 2003 21:10:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_21.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1:/tmp/cvs-serv6334 Modified Files: msg_21.txt Log Message: Adjust tests for no newline appending to MIMEText.__init__()'s _text argument. Index: msg_21.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/data/msg_21.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** msg_21.txt 19 Jul 2002 22:29:49 -0000 1.1 --- msg_21.txt 11 Mar 2003 05:10:46 -0000 1.2 *************** *** 11,15 **** One - --BOUNDARY Content-Type: text/plain; charset="us-ascii" --- 11,14 ---- *************** *** 18,22 **** Two - --BOUNDARY-- End of MIME message --- 17,20 ---- From jackjansen@users.sourceforge.net Tue Mar 11 14:37:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 06:37:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv976 Modified Files: pimp.py Log Message: Patch by Andrew Straw: use urllib2 so proxie access works. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pimp.py 17 Feb 2003 12:21:05 -0000 1.12 --- pimp.py 11 Mar 2003 14:37:19 -0000 1.13 *************** *** 16,19 **** --- 16,20 ---- import os import urllib + import urllib2 import urlparse import plistlib *************** *** 50,58 **** ] - class MyURLopener(urllib.FancyURLopener): - """Like FancyURLOpener, but we do want to get errors as exceptions.""" - def http_error_default(self, url, fp, errcode, errmsg, headers): - urllib.URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) - class PimpPreferences: """Container for per-user preferences, such as the database to use --- 51,54 ---- *************** *** 150,154 **** return self._urllist.append(url) ! fp = MyURLopener().open(url).fp dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc --- 146,150 ---- return self._urllist.append(url) ! fp = urllib2.urlopen(url).fp dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc *************** *** 799,801 **** main() ! \ No newline at end of file --- 795,797 ---- main() ! From gvanrossum@users.sourceforge.net Tue Mar 11 14:46:50 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 11 Mar 2003 06:46:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.134,1.135 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv6900 Modified Files: regrtest.py Log Message: Add 'audio' resource. ALERT! A month ago or so I made test_ossaudiodev.py require the 'audio' resource, but I didn't make the necessary changes to regrtest.py. This means that *nobody* has been testing the oss module all that time! Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** regrtest.py 7 Mar 2003 15:38:11 -0000 1.134 --- regrtest.py 11 Mar 2003 14:46:48 -0000 1.135 *************** *** 47,50 **** --- 47,54 ---- all - Enable all special resources. + audio - Tests that use the audio device. (There are known + cases of broken audio drivers that can crash Python or + even the Linux kernel.) + curses - Tests that use curses and will modify the terminal's state and output modes. *************** *** 102,106 **** from test import test_support ! RESOURCE_NAMES = ('curses', 'largefile', 'network', 'bsddb') --- 106,110 ---- from test import test_support ! RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb') From gward@users.sourceforge.net Tue Mar 11 16:53:21 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 11 Mar 2003 08:53:21 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv12830 Modified Files: ossaudiodev.c Log Message: Open with O_NONBLOCK to avoid hanging on open(). Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ossaudiodev.c 10 Mar 2003 03:17:06 -0000 1.24 --- ossaudiodev.c 11 Mar 2003 16:53:13 -0000 1.25 *************** *** 132,136 **** } ! if ((fd = open(basedev, imode)) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; --- 132,140 ---- } ! /* Open with O_NONBLOCK to avoid hanging on devices that only allow ! one open at a time. This does *not* affect later I/O; OSS ! provides a special ioctl() for non-blocking read/write, which is ! exposed via oss_nonblock() below. */ ! if ((fd = open(basedev, imode|O_NONBLOCK)) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; From rhettinger@users.sourceforge.net Tue Mar 11 21:44:00 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 11 Mar 2003 13:44:00 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.693,1.694 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv23388 Modified Files: NEWS Log Message: Fix spelling. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.693 retrieving revision 1.694 diff -C2 -d -r1.693 -r1.694 *** NEWS 9 Mar 2003 05:33:32 -0000 1.693 --- NEWS 11 Mar 2003 21:43:55 -0000 1.694 *************** *** 248,252 **** an mmap'ed file which was already closed. (SF patch #665913) ! - Fixed serveral serious bugs in the zipimport implementation. - datetime changes: --- 248,252 ---- an mmap'ed file which was already closed. (SF patch #665913) ! - Fixed several serious bugs in the zipimport implementation. - datetime changes: *************** *** 622,626 **** Jython 2.1. ! - PEP 302 has been accepted. Although it was inititally developed to support zipimport, it offers a new, general import hook mechanism. Several new variables have been added to the sys module: --- 622,626 ---- Jython 2.1. ! - PEP 302 has been accepted. Although it was initially developed to support zipimport, it offers a new, general import hook mechanism. Several new variables have been added to the sys module: *************** *** 1024,1030 **** - unittest.py now has two additional methods called assertAlmostEqual() ! and failIfAlmostEqual(). They implement an approximate comparision by rounding the difference between the two arguments and comparing ! the result to zero. Approximate comparision is essential for unit tests of floating point results. --- 1024,1030 ---- - unittest.py now has two additional methods called assertAlmostEqual() ! and failIfAlmostEqual(). They implement an approximate comparison by rounding the difference between the two arguments and comparing ! the result to zero. Approximate comparison is essential for unit tests of floating point results. *************** *** 1042,1046 **** test the current module. ! - When cancelling a server that implemented threading with a keyboard interrupt, the server would shut down but not terminate (waiting on client threads). A new member variable, daemon_threads, was added to --- 1042,1046 ---- test the current module. ! - When canceling a server that implemented threading with a keyboard interrupt, the server would shut down but not terminate (waiting on client threads). A new member variable, daemon_threads, was added to *************** *** 1403,1407 **** incremented. The apparently unused feature of "indirect interned strings", supported by the ob_sinterned member, is gone. Interned ! strings are now usually mortal; theres a new API, PyString_InternImmortal() that creates immortal interned strings. (The ob_sstate member can only take three values; however, while --- 1403,1407 ---- incremented. The apparently unused feature of "indirect interned strings", supported by the ob_sinterned member, is gone. Interned ! strings are now usually mortal; there is a new API, PyString_InternImmortal() that creates immortal interned strings. (The ob_sstate member can only take three values; however, while *************** *** 1495,1499 **** bugs. XXX What are the licensing issues here? ! XXX If a user has a database created with a previous verion of XXX Python, what must they do to convert it? XXX I'm still not sure how to link this thing (see PCbuild/readme.txt). --- 1495,1499 ---- bugs. XXX What are the licensing issues here? ! XXX If a user has a database created with a previous version of XXX Python, what must they do to convert it? XXX I'm still not sure how to link this thing (see PCbuild/readme.txt). *************** *** 1508,1512 **** - When Python is built under a Microsoft compiler, sys.version now includes the compiler version number (_MSC_VER). For example, under ! MSVC 6, sys.version constains the substring "MSC v.1200 ". 1200 is the value of _MSC_VER under MSVC 6. --- 1508,1512 ---- - When Python is built under a Microsoft compiler, sys.version now includes the compiler version number (_MSC_VER). For example, under ! MSVC 6, sys.version contains the substring "MSC v.1200 ". 1200 is the value of _MSC_VER under MSVC 6. *************** *** 1613,1617 **** (and Apple's Carbon and Cocoa documentation) through the Help Viewer. See Mac/OSX/README for converting the Python documentation to a ! Help Viewer comaptible form and installing it. - OSA support has been redesigned and the generated Python classes now --- 1613,1617 ---- (and Apple's Carbon and Cocoa documentation) through the Help Viewer. See Mac/OSX/README for converting the Python documentation to a ! Help Viewer compatible form and installing it. - OSA support has been redesigned and the generated Python classes now *************** *** 2176,2180 **** module). ! Note that Profile.calibrate() must be overriden by subclasses. Improving the accuracy required exploiting detailed knowledge of profiler internals; the earlier method abstracted away the details --- 2176,2180 ---- module). ! Note that Profile.calibrate() must be overridden by subclasses. Improving the accuracy required exploiting detailed knowledge of profiler internals; the earlier method abstracted away the details From jackjansen@users.sourceforge.net Tue Mar 11 21:48:58 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 13:48:58 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_macfs.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25603/Lib/test Modified Files: test_macfs.py Log Message: Allow unicode pathnames where FSRefs are expected. Fixes 696253. Index: test_macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macfs.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_macfs.py 19 Feb 2003 02:35:05 -0000 1.3 --- test_macfs.py 11 Mar 2003 21:48:55 -0000 1.4 *************** *** 27,30 **** --- 27,35 ---- fsr = macfs.FSRef(test_support.TESTFN) self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) + + def test_fsref_unicode(self): + testfn_unicode = unicode(test_support.TESTFN) + fsr = macfs.FSRef(testfn_unicode) + self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) def test_coercion(self): From jackjansen@users.sourceforge.net Tue Mar 11 21:49:00 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 13:49:00 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/file _Filemodule.c,1.17,1.18 filesupport.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/file In directory sc8-pr-cvs1:/tmp/cvs-serv25603/Mac/Modules/file Modified Files: _Filemodule.c filesupport.py Log Message: Allow unicode pathnames where FSRefs are expected. Fixes 696253. Index: _Filemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/_Filemodule.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** _Filemodule.c 2 Feb 2003 23:00:19 -0000 1.17 --- _Filemodule.c 11 Mar 2003 21:48:56 -0000 1.18 *************** *** 3223,3228 **** #if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ ! if ( PyString_Check(v) ) { ! if ( (err=FSPathMakeRef(PyString_AsString(v), fsr, NULL)) ) { PyMac_Error(err); return 0; --- 3223,3231 ---- #if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ ! if ( PyString_Check(v) || PyUnicode_Check(v)) { ! char *path = NULL; ! if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) ! return NULL; ! if ( (err=FSPathMakeRef(path, fsr, NULL)) ) { PyMac_Error(err); return 0; Index: filesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filesupport.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** filesupport.py 28 Jan 2003 23:29:46 -0000 1.15 --- filesupport.py 11 Mar 2003 21:48:57 -0000 1.16 *************** *** 281,286 **** #if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ ! if ( PyString_Check(v) ) { ! if ( (err=FSPathMakeRef(PyString_AsString(v), fsr, NULL)) ) { PyMac_Error(err); return 0; --- 281,289 ---- #if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ ! if ( PyString_Check(v) || PyUnicode_Check(v)) { ! char *path = NULL; ! if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) ! return NULL; ! if ( (err=FSPathMakeRef(path, fsr, NULL)) ) { PyMac_Error(err); return 0; From jackjansen@users.sourceforge.net Tue Mar 11 21:50:27 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 13:50:27 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo plugins.html,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo In directory sc8-pr-cvs1:/tmp/cvs-serv26687/Mac/Demo Modified Files: plugins.html Log Message: This file was terribly outdated. The example is still silly (and won't work), but at least the rest of the text is okay now. Index: plugins.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/plugins.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** plugins.html 25 Feb 1998 15:40:24 -0000 1.3 --- plugins.html 11 Mar 2003 21:50:21 -0000 1.4 *************** *** 8,12 **** to interface to the programmers' API of InterSLIP, a package that allows you to use MacTCP (and, hence, all internet services) over a ! modem connection.

Prerequisites

--- 8,14 ---- to interface to the programmers' API of InterSLIP, a package that allows you to use MacTCP (and, hence, all internet services) over a ! modem connection. The actual example does not work anymore, as both ! MacTCP and Interslip died long ago, but the text is still mostly ! correct.

Prerequisites

*************** *** 15,20 **** you need a C development environment. Actually, you need a specific development environment, CodeWarrior by MetroWerks. You will probably ! need the latest version. You may be able to get by with an older version of CodeWarrior or with another development environment (Up to about 1994 python was developed with THINK C, and in the dim past it --- 17,22 ---- you need a C development environment. Actually, you need a specific development environment, CodeWarrior by MetroWerks. You will ! need Version 7 or later. You may be able to get by with an older version of CodeWarrior or with another development environment (Up to about 1994 python was developed with THINK C, and in the dim past it *************** *** 23,33 **** character of this document will be lost.

! Next, you need a python source ! distribution. For PowerPC and cfm68k development you can actually ! get by without a full source distribution, using the Development ! distribution. You'll also need a functional python interpreter, and ! the Modulator program (which lives in Tools:Modulator in ! the standard source distribution). You may also find that Guido's Extending and embedding the Python interpreter is a very handy piece of documentation. I --- 25,30 ---- character of this document will be lost.

! Next, you need to install the Developer option in the MacPython installer. ! You may also find that Guido's Extending and embedding the Python interpreter is a very handy piece of documentation. I *************** *** 156,223 **** way...

-

Adding a module to Classic 68K Python

- - What you do now depends on whether you're developing for PowerPC (or - for CFM68K) or for "traditional" mac. For a traditional 68K Python, - you will have to add your new module to the project file of the Python - interpreter, and you have to edit "config.c" to add the module to the - set of builtin modules. In config.c you will add the module at two - places: near the start of the file there is a list of external - declarations for all init() routines. Add a line of the form -
- 		extern void initinterslip();
- 
- here. Further down the file there is an array that is initialized with - modulename/initfunction pairs. Add a line of the form -
- 		{"interslip",	initinterslip},
- 
- here. You may want to bracket these two lines with -
- 	#ifdef USE_INTERSLIP
- 	#endif
- 
- lines, that way you can easily control whether the module is - incorporated into python at compile time. If you decide to do the - latter edit your config file (you can find the name in the "C/C++ - language" section of the MW preferences dialog, it will probably be - "mwerks_nonshared_config.h") and add a -
- 	#define USE_INTERSLIP
- 
- - Make the new interpreter and check that you can import the module, see - the methods (with "dir(interslip)") and call them.

-

Creating a plugin module

! For PowerPC or cfm68k development you could follow the same path, but it is ! actually a better idea to use a dynamically loadable module. The ! advantage of dynamically loadable modules is that they are not loaded ! until a python program actually uses them (resulting in less memory ! usage by the interpreter) and that development is a lot simpler (since ! your projects will all be smaller). Moreover, you can distribute a ! plugin module by itself without haveing to distribute a complete ! python interpreter.

! Go to the "PlugIns" folder and copy the files xx.prj, ! and xx.prj.exp to interslipmodule.prj and ! interslipmodule.prj.exp, respectively. Edit ! interslipmodule.prj.exp and change the name of the exported routine ! "initxx" to "initinterslip". Open interslipmodule.prj with CodeWarrior, remove the file xxmodule.c and add interslipmodule.c and make a number of adjustments to the preferences:

    !
  • in PPC target, set the output file name to "interslipmodule.pcc.slb", !
  • in cfm68k target set the output file name to "interslipmodule.cfm68k.slb".
  • if you are working without a source distribution (i.e. with a normal binary distribution plus a development distribution) you will not have ! a file PythonCore. The installation process has deposited this file in the System Extensions folder under the name ! PythonCore version. Add that file to the project, replacing ! PythonCore.
! Next, compile and link your module, fire up python and do the same ! tests as for 68K python.

Getting the module to do real work

--- 153,186 ---- way...

Creating a plugin module

! The easiest way to build a plugin module is to use the distutils package, ! this works fine on MacOS with CodeWarrior. See the distutils documentation ! for details. Keep in mind that even though you are on the Mac you specify ! filenames with Unix syntax: they are actually URLs, not filenames. !

! Alternatively you can build the project file by hand. ! Go to the ":Mac:Build" folder and copy the files xx.carbon.mcp, ! and xx.carbon.mcp.exp to interslipmodule.carbon.mcp and ! interslipmodule.carbon.mcp.exp, respectively. Edit ! interslipmodule.carbon.mcp.exp and change the name of the exported routine ! "initxx" to "initinterslip". Open interslipmodule.carbon.mcp with CodeWarrior, remove the file xxmodule.c and add interslipmodule.c and make a number of adjustments to the preferences:

    !
  • in PPC target, set the output file name to "interslipmodule.carbon.slb",
  • if you are working without a source distribution (i.e. with a normal binary distribution plus a development distribution) you will not have ! a file PythonCoreCarbon. The installation process has deposited this file in the System Extensions folder under the name ! PythonCoreCarbon version. Add that file to the project, replacing ! PythonCoreCarbon. !
  • you must either download and build GUSI (if your extension module uses sockets ! or other Unix I/O constructs) or remove GUSI references from the Access Paths ! settings. See the Building document for where to get GUSI ! and how to build it.
! Next, compile and link your module, fire up python and test it.

Getting the module to do real work

From jackjansen@users.sourceforge.net Tue Mar 11 22:48:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 14:48:39 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv20021/Documentation Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation added to the repository From jackjansen@users.sourceforge.net Tue Mar 11 22:56:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 14:56:43 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv22882/macpython_ide_tutorial Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial added to the repository From jackjansen@users.sourceforge.net Tue Mar 11 22:56:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 14:56:43 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc In directory sc8-pr-cvs1:/tmp/cvs-serv22882/doc Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc added to the repository From jackjansen@users.sourceforge.net Tue Mar 11 22:59:19 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 14:59:19 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc index.html,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc In directory sc8-pr-cvs1:/tmp/cvs-serv23138/doc Added Files: index.html Log Message: Adding MacPython online help. Only the basics are installed, with a placeholder for the full documentation (pointing to the online docs and explaining you can also install them locally to make them searchable, etc). --- NEW FILE: index.html --- Python Language Documentation

Python Language and runtime documentation

This volume of documentation is rather big (17 Megabytes) and contains a tutorial, full description of the Python library (all the modules and packages included), formal description of the language and more.

You can view it online, where you can also download PDFs for printing, or you can download and install it through the Package Manager for viewing and searching via Apple Help Viewer.

From jackjansen@users.sourceforge.net Tue Mar 11 22:59:19 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 14:59:19 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation PackageManager.gif,NONE,1.1 finder.html,NONE,1.1 index.html,NONE,1.1 intro.html,NONE,1.1 packman.html,NONE,1.1 python.gif,NONE,1.1 pythonsmall.gif,NONE,1.1 shell.html,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv23138 Added Files: PackageManager.gif finder.html index.html intro.html packman.html python.gif pythonsmall.gif shell.html Log Message: Adding MacPython online help. Only the basics are installed, with a placeholder for the full documentation (pointing to the online docs and explaining you can also install them locally to make them searchable, etc). --- NEW FILE: PackageManager.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: finder.html --- Python and the Finder

Running Python scripts from the Finder

The application PythonLauncher will start a Python interpreter when you drop a Python source file onto it, any file with a .py or .pyw extension. If you set PythonLauncher as the default application to open a file ( tell me more) this also works when you double click a Python script.

PythonLauncher has preferences per filetype for selecting the interpreter to use, and how to launch it: in a Terminal window or not, etc. Holding the Option key while launching your script will bring up a window that allows changing these settings for a single run.


--- NEW FILE: index.html --- MacPython Help

MacPython Help

Choose a topic, or enter keywords into the search field:


--- NEW FILE: intro.html --- What is MacPython?

What is MacPython?

Python is a programming language. MacPython is a package containing that programming language plus Mac-specific tools and extensions.


The Python Language

The Python programming language is available for many hardware platforms, and most general documentation is Unix- or Windows-centered. Keep this in mind when reading the rest of this help, or information on the web.

The Python website, www.python.org, has a Beginners Guide section including an executive summary on the language and a comparison of Python to other languages. Or read the (rather longwinded) Python Tutorial in the Python Language and runtime documentation.

MacPython contains a complete unix interpreter so if you are familiar with Python on unix you should feel right at home.

MacPython additions

The MacPython Integrated Development Environment (IDE) allows easy editing, running and debugging of scripts. Read the Introduction to the IDE to whet your appetite.

MacPython comes with lots of modules that allow access to MacOS-specific technology, such as Carbon, Quicktime and AppleScript. See the Macintosh Modules section of the Python Language and runtime documentation, but please keep in mind that some information there still pertains to Mac OS 9. Full access to the Cocoa APIs and tools such as Interface Builder is available separately through the Package Manager.

The Package Manager also gives you access to extension packages for cross-platform GUI development (Tkinter, wxPython, PyOpenGL), image processing (PIL), scientific computing (Numeric) and much more. PyObjC deserves a special mention: it allows transparent access to Cocoa and Interface Builder, similar to what Java provides, thereby making Python a first class citizen in the Mac OS X developer world.

Python scripts can be saved as applets, semi-standalone applications that work just like a normal application. Additionally you can even create true standalone application that have everything embedded and can be shipped to anyone, without the need to install Python. You do not need to install the Apple Developer Tools for this.

--- NEW FILE: packman.html --- Python Package Manager

Installing additional Python Packages

The Python Package Manager helps you installing additional packages that enhance Python. It determines the exact MacOS version and Python version you have and uses that information to download a database that has packages that are test and tried on that combination. In other words: if something is in your Package Manager window but does not work you are free to blame the database maintainer.

PackageManager then checks which of the packages you have installed and which ones not. This should also work when you have installed packages outside of PackageManager. You can select packages and install them, and PackageManager will work out the requirements and install these too.

Often PackageManager will list a package in two flavors: binary and source. Binary should always work, source will only work if you have installed the Apple Developer Tools. PackageManager will warn you about this, and also about other external dependencies.

PackageManager is available as a separate application and also as a function of the IDE, through the File->Package Manager menu entry.


--- NEW FILE: python.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: pythonsmall.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: shell.html --- Python and the Unix Shell

Running Python scripts from the Unix Shell

MacPython 2.3 installs a perfectly normal Unix commandline python interpreter in /usr/local/bin/python. As of Mac OS X 10.2, however, /usr/local/bin is not on the search path of your shell. Moreover, Apple's python 2.2, which lives in /usr/bin is on your search path, so this can lead to confusion.

If you use tcsh you should add the following line to the file .login in your home directory and restart Terminal:
setenv PATH /usr/local/bin:$PATH

If you use bash or zsh you should add the following line to the file .profile in your home directory and restart Terminal:
export PATH=/usr/local/bin:$PATH

GUI scripts

Due to the way MacOS handles windowing applications you need to run all scripts that use the window manager (be it through Carbon, Cocoa, Tkinter, wxPython, PyOpenGL or anything else) with the pythonw interpreter, also installed in /usr/local/bin.

Running with python results in an inability to bring the script to the front, or interacting with it.


From jackjansen@users.sourceforge.net Tue Mar 11 22:59:28 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 14:59:28 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial IDE.gif,NONE,1.1 entering_in_new_window.gif,NONE,1.1 hello_world.gif,NONE,1.1 index.html,NONE,1.1 loading_ide.gif,NONE,1.1 making_new_window.gif,NONE,1.1 new_ide_window.gif,NONE,1.1 new_window_made.gif,NONE,1.1 output_window.gif,NONE,1.1 saving_edited_file.gif,NONE,1.1 simple_commands.gif,NONE,1.1 syntax_error.gif,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv23138/macpython_ide_tutorial Added Files: IDE.gif entering_in_new_window.gif hello_world.gif index.html loading_ide.gif making_new_window.gif new_ide_window.gif new_window_made.gif output_window.gif saving_edited_file.gif simple_commands.gif syntax_error.gif Log Message: Adding MacPython online help. Only the basics are installed, with a placeholder for the full documentation (pointing to the online docs and explaining you can also install them locally to make them searchable, etc). --- NEW FILE: IDE.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: entering_in_new_window.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: hello_world.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: index.html --- One Day of MacPython IDE Toying

One Day of MacPython IDE Toying

This document gives a very basic introduction to the MacPython Integrated Development Environment on Mac OS. It was written specifically for MacPython 2.3 on Mac OS X, but most of it is applicable to MacPython-OS9 too. It is based on "One Day of IDLE Toying" by Danny Yoo, which you should read if you want to use the cross-platform IDLE Python development environment.



Ok, let's assume that we've already installed Python. (If not, we can visit: http://www.cwi.nl/~jack/macpython.html or http://python.org and download the most recent Python interpreter. Get the Mac OSX binary installer.) The first thing we'd like to do is actually start running it! We can do this by opening up the IDE, which should be in Applications under the newly-created MacPython program folder:



The IDE starts up and shows an interactive window:

If the window does not show up (because you have run the IDE before and closed it: it remembers that between runs) open it with the Windows->Python Interactive menu entry.

This is the interactive window to the IDE, it allows us to enter commands directly into Python, and as soon as we enter a command, Python will execute it and spit out its result back to us. We'll be using this interactive window a lot when we're exploring Python: it's very nice because we get back our results immediately. If it helps, we can think of it as a very powerful calculator.



Let's try something now! As per tradition, let's get Python to say the immortal words, "Hello World".

Those '>>>' signs act as a prompt for us: Python is ready to read in a new command by giving us that visual cue. Also, we notice that as we enter commands, Python will give us its output immediately.



Ok, this seems pretty simple enough. Let's try a few more commands. If we look below:

we'll see the result of running a few more commands. Don't worry too much about knowing the exact rules for making programs yet: the idea is that we can experiment with Python by typing in commands. If things don't work, then we can correct the mistake, and try it again.

If you got to this point, you now know enough to start playing around with Python! Crack open one of the tutorials from the Python For Beginners web page, and start exploring with the interpreter. No time limit here. *grin*



Now that we've paddled long enough, we might be asking: ok, this is neat, but if we close down Python and start it up again, how do we get the computer to remember what we typed?

The solution is a little subtle: we can't directly save what's on the interpreter window, because it will include both our commands and the system's responses. What we'd like is to make a prepared file, with just our own commands, and to be able to save that file as a document. When we're in the mood, we can later open that file and "run" Python over it, saving us the time of retyping the whole thing over again.

Let's try this. First, let's start with a clean slate by opening up a new window.

Here's the result of that menu command:

We notice that there's nothing in this new window. What this means is that this file is purely for our commands: Python won't interject with its own responses as we enter the program, that is, not until we tell it to. This is called an edit window, and it is very similar to edit windows in other editors such as TextEdit or BBEdit.



What we wanted to do before was save some of the stuff we had tried out on the interpreter window. Let's do that by typing (or copy/pasting) those commands into our Program window.

Ok, we're done with copying and pasting. One big thing to notice is that we're careful to get rid of the ">>>" prompts because there's not really part of our program. The interpreter uses them just to tell us that we're in the interpreter, but now that we're editing in a separate file, we can remove the artifacts that the interpreter introduces. I have added an extra empty print statement so our output ends with a newline.



Let's save the file now. The Save command is located under the File menu:



Now that we've saved the program, how do we run the program? Use the Run All button at the top of the editing window, or the equivalent menu command Python->Run Window. The output will appear in a new window called Output Window.

By the way, one thing to notice is that I made a typo: I didn't quite copy exactly what I had entered in the interpreter window before. Does this affect things?

Ooops. Here is an example of what Python calls a "syntax error". Python sees that we made a typo, and warns us to take a much closer look at our program. The designers of Python feel that having the system point out the error is better than trying to guess at what the programmer meant. Press the Edit button and you will be brought to the trouble spot.

Python is often perceptive enough to direct us toward the problem, and in this case, it's telling us that we forgot to put something at the end of this line. In this case, we need to add an additional quotation mark. Let's add that in now.

Other errors, which usually occur later, when your program has already done something, result in a different dialog that allows you to look at variables and such in addition to only showing you where the error occurred.



Ok, let's say that we fixed that silly typo. Let's try to run the program again. This gives us a new window, the Output window, showing the output of our program:



As we play with Python, we'll find ourselves "switching modes" between the Interpreter window and the Program window. However, if we try anything more complicated than two or three lines it is often a good idea to work in an edit window, and align your edit and output window such that you can see them at the same time.

This is pretty much all we need to know about the MacPython IDE to actually do interesting things. There is a lot more to the IDE, here is a quick breakdown of things to see and explore:

  • All sorts of edit commands such as find and replace can be used in the editor windows. See the edit menu.
  • The bottom of the edit window has the scrollbar, but at the left are two navigation devices: a line number box that you can also type numbers into to quickly go to a specific place, and a popup menu that lists all classes, functions and methods in your file.
  • Above the vertical scrollbar you find another popup menu, this influences how the Run command works. You should try the debugger some time! If you do, and you wonder what the new small column on the left of your script is: you can click in it to make Python stop when it reaches this line so you can inspect things. The profiler is also nifty: it shows you where your program is spending its time.
  • The module browser (Python->Module Browser) shows you all Python modules currently loaded. You can look at the contents of the module with Browse... and (for modules written in Python) at the source with Source...
  • The Package Manager (under the File menu, also available as a separate application) allows you to easily install Python extension packages for all sorts of things: scientific computation, image processing, building user interfaces and more.
  • The Help menu gives you quick access to both the Python documentation, if you have installed it with the Package Manager, and the Apple Developer documentation.
  • The File->Save as Applet menu command saves your script as a MacOSX application. This allows you to create a script that you can drop files on, and much more. The IDE itself is such an applet, completely written in Python.
--- NEW FILE: loading_ide.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: making_new_window.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: new_ide_window.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: new_window_made.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: output_window.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: saving_edited_file.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: simple_commands.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: syntax_error.gif --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Tue Mar 11 23:07:12 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 11 Mar 2003 15:07:12 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv26015 Modified Files: Makefile Log Message: Add a simple Apple Help book to the framework. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Makefile 25 Feb 2003 12:41:10 -0000 1.37 --- Makefile 11 Mar 2003 23:07:08 -0000 1.38 *************** *** 44,48 **** APPTEMPLATE=$(srcdir)/Mac/OSXResources/app ! APPSUBDIRS=MacOS Resources Resources/English.lproj CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py compileall=$(srcdir)/Lib/compileall.py --- 44,53 ---- APPTEMPLATE=$(srcdir)/Mac/OSXResources/app ! APPSUBDIRS=MacOS Resources Resources/English.lproj \ ! Resources/English.lproj/Documentation \ ! Resources/English.lproj/Documentation/doc \ ! Resources/English.lproj/Documentation/macpython_ide_tutorial ! DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation ! DOCINDEX=$(DOCDIR)/"Documentation idx" CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py compileall=$(srcdir)/Lib/compileall.py *************** *** 58,61 **** --- 63,69 ---- install_Python: + @if test ! -f $(DOCINDEX); then \ + echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \ + fi @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ if test ! -d $$i; then \ *************** *** 83,86 **** --- 91,98 ---- *.orig) ;; \ *~) ;; \ + *idx) \ + echo $(CPMAC) "$$i" $$b; \ + $(CPMAC) "$$i" $$b; \ + ;; \ *) \ if test -d $$i; then continue; fi; \ *************** *** 95,102 **** done; \ done ! $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(APPINSTALLDIR)/Contents/MacOS/python ! # Finally create the documentation symlink ! $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation ! install_IDE: $(INSTALLED_PYTHONW) --- 107,111 ---- done; \ done ! $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(APPINSTALLDIR)/Contents/MacOS/python install_IDE: $(INSTALLED_PYTHONW) From bwarsaw@users.sourceforge.net Wed Mar 12 02:54:20 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 11 Mar 2003 18:54:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv9438 Modified Files: _compat21.py Log Message: Python 2.1 doesn't have True and False Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _compat21.py 11 Mar 2003 04:41:18 -0000 1.6 --- _compat21.py 12 Mar 2003 02:54:17 -0000 1.7 *************** *** 8,11 **** --- 8,14 ---- from types import StringType, UnicodeType + False = 0 + True = 1 + From bwarsaw@users.sourceforge.net Wed Mar 12 03:14:15 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 11 Mar 2003 19:14:15 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv15432 Modified Files: test_email.py Log Message: test_whitespace_eater_unicode(): Make this test Python 2.1 compatible. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_email.py 11 Mar 2003 05:04:54 -0000 1.44 --- test_email.py 12 Mar 2003 03:14:11 -0000 1.45 *************** *** 1289,1293 **** dh = decode_header(s) eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard ', None)]) ! hu = unicode(make_header(dh)).encode('latin-1') eq(hu, 'Andr\xe9 Pirard ') --- 1289,1296 ---- dh = decode_header(s) eq(dh, [('Andr\xe9', 'iso-8859-1'), ('Pirard ', None)]) ! # Python 2.1's unicode() builtin doesn't call the object's ! # __unicode__() method. Use the following alternative instead. ! #hu = unicode(make_header(dh)).encode('latin-1') ! hu = make_header(dh).__unicode__().encode('latin-1') eq(hu, 'Andr\xe9 Pirard ') From bwarsaw@users.sourceforge.net Wed Mar 12 03:43:12 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 11 Mar 2003 19:43:12 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib mimelib.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24071 Modified Files: mimelib.tex Log Message: Update the package version number Index: mimelib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/mimelib.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mimelib.tex 10 Oct 2002 15:58:19 -0000 1.4 --- mimelib.tex 12 Mar 2003 03:43:09 -0000 1.5 *************** *** 13,19 **** \date{\today} ! \release{2.4.2} % software release, not documentation \setreleaseinfo{} % empty for final release ! \setshortversion{2.4} % major.minor only for software \begin{document} --- 13,19 ---- \date{\today} ! \release{2.5b1} % software release, not documentation \setreleaseinfo{} % empty for final release ! \setshortversion{2.5} % major.minor only for software \begin{document} From rhettinger@users.sourceforge.net Wed Mar 12 04:25:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 11 Mar 2003 20:25:44 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.215,2.216 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv4713/Objects Modified Files: typeobject.c Log Message: SF bug #699934: Obscure error message Clarify error message for mro conflicts. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.215 retrieving revision 2.216 diff -C2 -d -r2.215 -r2.216 *** typeobject.c 7 Mar 2003 15:13:17 -0000 2.215 --- typeobject.c 12 Mar 2003 04:25:42 -0000 2.216 *************** *** 1077,1081 **** n = PyDict_Size(set); ! off = PyOS_snprintf(buf, sizeof(buf), "MRO conflict among bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { --- 1077,1084 ---- n = PyDict_Size(set); ! off = PyOS_snprintf(buf, sizeof(buf), "Cannot create class.\ ! The superclasses have conflicting\n\ ! inheritance trees which leave the method resolution order (MRO)\n\ ! undefined for bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { From rhettinger@users.sourceforge.net Wed Mar 12 04:25:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 11 Mar 2003 20:25:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.186,1.187 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4713/Lib/test Modified Files: test_descr.py Log Message: SF bug #699934: Obscure error message Clarify error message for mro conflicts. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** test_descr.py 27 Feb 2003 20:04:19 -0000 1.186 --- test_descr.py 12 Mar 2003 04:25:42 -0000 1.187 *************** *** 1063,1066 **** --- 1063,1070 ---- Pane, ScrollingMixin, EditingMixin, object)) + mro_err_msg = """Cannot create class.The superclasses have conflicting + inheritance trees which leave the method resolution order (MRO) + undefined for bases """ + def mro_disagreement(): if verbose: print "Testing error messages for MRO disagreement..." *************** *** 1080,1086 **** raises(TypeError, "duplicate base class A", type, "X", (A, A), {}) ! raises(TypeError, "MRO conflict among bases ", type, "X", (A, B), {}) ! raises(TypeError, "MRO conflict among bases ", type, "X", (A, C, B), {}) # Test a slightly more complex error --- 1084,1090 ---- raises(TypeError, "duplicate base class A", type, "X", (A, A), {}) ! raises(TypeError, mro_err_msg, type, "X", (A, B), {}) ! raises(TypeError, mro_err_msg, type, "X", (A, C, B), {}) # Test a slightly more complex error *************** *** 1090,1094 **** class HVGrid(HorizontalGrid, VerticalGrid): pass class VHGrid(VerticalGrid, HorizontalGrid): pass ! raises(TypeError, "MRO conflict among bases ", type, "ConfusedGrid", (HVGrid, VHGrid), {}) --- 1094,1098 ---- class HVGrid(HorizontalGrid, VerticalGrid): pass class VHGrid(VerticalGrid, HorizontalGrid): pass ! raises(TypeError, mro_err_msg, type, "ConfusedGrid", (HVGrid, VHGrid), {}) From rhettinger@users.sourceforge.net Wed Mar 12 04:46:54 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 11 Mar 2003 20:46:54 -0800 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.177,1.178 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv10667 Modified Files: tut.tex Log Message: SF bug #699237: Tutorial uses omitted slice indices before explaining them Moved up the explanation of slice default arguments. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** tut.tex 1 Mar 2003 03:20:39 -0000 1.177 --- tut.tex 12 Mar 2003 04:46:52 -0000 1.178 *************** *** 641,644 **** --- 641,655 ---- \end{verbatim} + Slice indices have useful defaults; an omitted first index defaults to + zero, an omitted second index defaults to the size of the string being + sliced. + + \begin{verbatim} + >>> word[:2] # The first two characters + 'He' + >>> word[2:] # All but the first two characters + 'lpA' + \end{verbatim} + Unlike a C string, Python strings cannot be changed. Assigning to an indexed position in the string results in an error: *************** *** 663,677 **** >>> 'Splat' + word[4] 'SplatA' - \end{verbatim} - - Slice indices have useful defaults; an omitted first index defaults to - zero, an omitted second index defaults to the size of the string being - sliced. - - \begin{verbatim} - >>> word[:2] # The first two characters - 'He' - >>> word[2:] # All but the first two characters - 'lpA' \end{verbatim} --- 674,677 ---- From jackjansen@users.sourceforge.net Wed Mar 12 13:47:42 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 12 Mar 2003 05:47:42 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_macfs.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25906 Modified Files: test_macfs.py Log Message: Filter out the depracation warning for macfs. Index: test_macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macfs.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_macfs.py 11 Mar 2003 21:48:55 -0000 1.4 --- test_macfs.py 12 Mar 2003 13:47:39 -0000 1.5 *************** *** 2,5 **** --- 2,7 ---- import unittest + import warnings + warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) import macfs import os From akuchling@users.sourceforge.net Wed Mar 12 14:11:02 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 12 Mar 2003 06:11:02 -0800 Subject: [Python-checkins] python/dist/src/Lib asynchat.py,1.15,1.15.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3417 Modified Files: Tag: release22-maint asynchat.py Log Message: [Backport patch #649762] Fix for asynchat endless loop When the null string is used as the terminator, it used to be the same as None, meaning "collect all the data". In the current code, however, it falls into an endless loop; this change reverts to the old behavior. Index: asynchat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v retrieving revision 1.15 retrieving revision 1.15.22.1 diff -C2 -d -r1.15 -r1.15.22.1 *** asynchat.py 8 Apr 2001 07:23:44 -0000 1.15 --- asynchat.py 12 Mar 2003 14:11:00 -0000 1.15.22.1 *************** *** 95,99 **** lb = len(self.ac_in_buffer) terminator = self.get_terminator() ! if terminator is None: # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) --- 95,99 ---- lb = len(self.ac_in_buffer) terminator = self.get_terminator() ! if terminator is None or terminator == '': # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) From akuchling@users.sourceforge.net Wed Mar 12 14:17:41 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 12 Mar 2003 06:17:41 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.65,1.337.2.4.2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv6701 Modified Files: Tag: release22-maint NEWS Log Message: Add item Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.65 retrieving revision 1.337.2.4.2.66 diff -C2 -d -r1.337.2.4.2.65 -r1.337.2.4.2.66 *** NEWS 4 Mar 2003 00:50:23 -0000 1.337.2.4.2.65 --- NEWS 12 Mar 2003 14:17:38 -0000 1.337.2.4.2.66 *************** *** 100,103 **** --- 100,106 ---- set properly in out-of-tree builds. + - SF #649762, fix infinite loop in asynchat when null string used as terminator + + What's New in Python 2.2.2 (final) ? Release date: 14-Oct-2002 From akuchling@users.sourceforge.net Wed Mar 12 14:28:24 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 12 Mar 2003 06:28:24 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.66,1.337.2.4.2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13121 Modified Files: Tag: release22-maint NEWS Log Message: Add some more Distutil changes Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.66 retrieving revision 1.337.2.4.2.67 diff -C2 -d -r1.337.2.4.2.66 -r1.337.2.4.2.67 *** NEWS 12 Mar 2003 14:17:38 -0000 1.337.2.4.2.66 --- NEWS 12 Mar 2003 14:28:21 -0000 1.337.2.4.2.67 *************** *** 102,105 **** --- 102,114 ---- - SF #649762, fix infinite loop in asynchat when null string used as terminator + - SF #570655, fix misleading option text for bdist_rpm + + - Distutils: Allow unknown keyword arguments to the setup() function + and the Extension constructor, printing a warning about them instead + of reporting an error and stopping. + + - Distutils: Translate spaces in the machine name to underscores + (Power Macintosh -> Power_Macintosh) + What's New in Python 2.2.2 (final) ? From cliffwells18@users.sourceforge.net Wed Mar 12 18:55:46 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Wed, 12 Mar 2003 10:55:46 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv20478/util Log Message: Directory /cvsroot/python/python/nondist/sandbox/csv/util added to the repository From cliffwells18@users.sourceforge.net Wed Mar 12 18:56:50 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Wed, 12 Mar 2003 10:56:50 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv __init__.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv In directory sc8-pr-cvs1:/tmp/cvs-serv20740 Added Files: __init__.py Log Message: Make cvs into a package so we can have a util package --- NEW FILE: __init__.py --- From cliffwells18@users.sourceforge.net Wed Mar 12 18:57:46 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Wed, 12 Mar 2003 10:57:46 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util __init__.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv21281 Added Files: __init__.py Log Message: Create util package --- NEW FILE: __init__.py --- From cliffwells18@users.sourceforge.net Wed Mar 12 18:58:26 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Wed, 12 Mar 2003 10:58:26 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv21719 Added Files: sniffer.py Log Message: Initial commit of sniffer.py --- NEW FILE: sniffer.py --- """ dialect = Sniffer().sniff(file('csv/easy.csv')) print "delimiter", dialect.delimiter print "quotechar", dialect.quotechar print "skipinitialspace", dialect.skipinitialspace """ from csv import csv import re, string class Sniffer: """ "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) Sniffer.dialect will be either a csv.Dialect object or None if the file format couldn't be determined. """ def __init__(self, sample = 16 * 1024): # in case there is more than one possible delimiter self.preferred = [',', '\t', ';', ' ', ':'] # amount of data (in bytes) to sample self.sample = sample def sniff(self, fileobj): """ Takes a file-like object and returns a dialect (or None) """ data = fileobj.read(self.sample) quotechar, delimiter, skipinitialspace = self._guessQuoteAndDelimiter(data) if delimiter is None: delimiter, skipinitialspace = self._guessDelimiter(data) print quotechar, delimiter, skipinitialspace class Dialect(csv.Dialect): _name = "sniffed" lineterminator = '\r\n' quoting = csv.QUOTE_MINIMAL escapechar = '' doublequote = False Dialect.delimiter = delimiter Dialect.quotechar = quotechar Dialect.skipinitialspace = skipinitialspace return Dialect() def _guessQuoteAndDelimiter(self, data): """ Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', The quote with the most wins, same with the delimiter. If there is no quotechar the delimiter can't be determined this way. """ for restr in ('(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?P=delim)', # ,".*?", '(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)', # ".*?", '(?P>[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?:$|\n)', # ,".*?" '(?:^|\n)(?P["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space) regexp = re.compile(restr, re.S | re.M) matches = regexp.findall(data) if matches: print restr print matches break if not matches: return ('', None, 0) # (quotechar, delimiter, skipinitialspace) quotes = {} delims = {} spaces = 0 for m in matches: n = regexp.groupindex['quote'] - 1 key = m[n] if key: quotes[key] = quotes.get(key, 0) + 1 try: n = regexp.groupindex['delim'] - 1 key = m[n] except KeyError: continue if key: delims[key] = delims.get(key, 0) + 1 try: n = regexp.groupindex['space'] - 1 except KeyError: continue if m[n]: spaces += 1 print "QUOTES", quotes print "DELIMS", delims quotechar = reduce(lambda a, b, quotes = quotes: (quotes[a] > quotes[b]) and a or b, quotes.keys()) if delims: delim = reduce(lambda a, b, delims = delims: (delims[a] > delims[b]) and a or b, delims.keys()) skipinitialspace = delims[delim] == spaces if delim == '\n': # most likely a file with a single column delim = None else: # there is *no* delimiter, it's a single column of quoted data delim = '' skipinitialspace = 0 return (quotechar, delim, skipinitialspace) def _guessDelimiter(self, data): """ The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table of the frequency of each character on every line. 2) build a table of freqencies of this frequency (meta-frequency?), e.g. "x occurred 5 times in 10 rows, 6 times in 1000 rows, 7 times in 2 rows" 3) use the mode of the meta-frequency to determine the /expected/ frequency for that character 4) find out how often the character actually meets that goal 5) the character that best meets its goal is the delimiter For performance reasons, the data is evaluated in chunks, so it can try and evaluate the smallest portion of the data possible, evaluating additional chunks as necessary. """ data = filter(None, data.split('\n')) ascii = [chr(c) for c in range(127)] # 7-bit ASCII # build frequency tables chunkLength = min(10, len(data)) iteration = 0 charFrequency = {} modes = {} delims = {} start, end = 0, min(chunkLength, len(data)) while start < len(data): iteration += 1 for line in data[start:end]: for char in ascii: metafrequency = charFrequency.get(char, {}) freq = line.strip().count(char) # must count even if frequency is 0 metafrequency[freq] = metafrequency.get(freq, 0) + 1 # value is the mode charFrequency[char] = metafrequency for char in charFrequency.keys(): items = charFrequency[char].items() if len(items) == 1 and items[0][0] == 0: continue # get the mode of the frequencies if len(items) > 1: modes[char] = reduce(lambda a, b: a[1] > b[1] and a or b, items) # adjust the mode - subtract the sum of all other frequencies items.remove(modes[char]) modes[char] = (modes[char][0], modes[char][1] - reduce(lambda a, b: (0, a[1] + b[1]), items)[1]) else: modes[char] = items[0] # build a list of possible delimiters modeList = modes.items() total = float(chunkLength * iteration) consistency = 1.0 # (rows of consistent data) / (number of rows) = 100% threshold = 0.9 # minimum consistency threshold while len(delims) == 0 and consistency >= threshold: for k, v in modeList: if v[0] > 0 and v[1] > 0: if (v[1]/total) >= consistency: delims[k] = v consistency -= 0.01 if len(delims) == 1: delim = delims.keys()[0] skipinitialspace = data[0].count(delim) == data[0].count("%c " % delim) return (delim, skipinitialspace) # analyze another chunkLength lines start = end end += chunkLength if not delims: return None # if there's more than one, fall back to a 'preferred' list if len(delims) > 1: for d in self.preferred: if d in delims.keys(): skipinitialspace = data[0].count(d) == data[0].count("%c " % d) return (d, skipinitialspace) # finally, just return the first damn character in the list delim = delims.keys()[0] skipinitialspace = data[0].count(delim) == data[0].count("%c " % delim) return (delim, skipinitialspace) From cliffwells18@users.sourceforge.net Wed Mar 12 21:45:08 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Wed, 12 Mar 2003 13:45:08 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv7661 Modified Files: sniffer.py Log Message: Removed debugging statements Index: sniffer.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/util/sniffer.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sniffer.py 12 Mar 2003 18:58:24 -0000 1.1 --- sniffer.py 12 Mar 2003 21:45:05 -0000 1.2 *************** *** 33,38 **** delimiter, skipinitialspace = self._guessDelimiter(data) - print quotechar, delimiter, skipinitialspace - class Dialect(csv.Dialect): _name = "sniffed" --- 33,36 ---- *************** *** 67,72 **** matches = regexp.findall(data) if matches: - print restr - print matches break --- 65,68 ---- *************** *** 95,101 **** if m[n]: spaces += 1 - - print "QUOTES", quotes - print "DELIMS", delims quotechar = reduce(lambda a, b, quotes = quotes: --- 91,94 ---- From mwh@users.sourceforge.net Thu Mar 13 13:56:55 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 13 Mar 2003 05:56:55 -0800 Subject: [Python-checkins] python/dist/src/Modules signalmodule.c,2.72,2.73 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22379/Modules Modified Files: signalmodule.c Log Message: Take out my (long since disabled) POSIX signal mask handling code. I'm not going to have the time or energy to get this working x-platform -- anyone who does is welcome to the code! Index: signalmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/signalmodule.c,v retrieving revision 2.72 retrieving revision 2.73 diff -C2 -d -r2.72 -r2.73 *** signalmodule.c 19 Feb 2003 15:53:15 -0000 2.72 --- signalmodule.c 13 Mar 2003 13:56:53 -0000 2.73 *************** *** 270,420 **** anything else -- the callable Python object used as a handler"); - #ifdef HAVE_SIGPROCMASK /* we assume that having SIGPROCMASK is enough - to guarantee full POSIX signal handling */ - /* returns 0 for success, <0 for failure (with exception set) */ - static int - _signal_list_to_sigset(PyObject* seq, sigset_t* set, char* mesg) - { - int i, len, val; - - seq = PySequence_Fast(seq, mesg); - if (!seq) - return -1; - - len = PySequence_Fast_GET_SIZE(seq); - - sigemptyset(set); - - for (i = 0; i < len; i++) { - val = PyInt_AsLong(PySequence_Fast_GET_ITEM(seq, i)); - if (val == -1 && PyErr_Occurred()) { - Py_DECREF(seq); - return -1; - } - if (sigaddset(set, val) < 0) { - Py_DECREF(seq); - PyErr_SetFromErrno(PyExc_ValueError); - return -1; - } - } - - Py_DECREF(seq); - return 0; - } - - static PyObject* - _signal_sigset_to_list(sigset_t* set) - { - PyObject* ret; - PyObject* ob; - int i; - - ret = PyList_New(0); - if (!ret) - return NULL; - - for (i = 1; i < NSIG; i++) { - if (sigismember(set, i)) { - ob = PyInt_FromLong(i); - if (!ob) { - Py_DECREF(ret); - return NULL; - } - PyList_Append(ret, ob); - Py_DECREF(ob); - } - } - - return ret; - } - - static PyObject* - signal_sigprocmask(PyObject* self, PyObject* args) - { - int how; - sigset_t newset, oldset; - PyObject* seq; - - if (!PyArg_ParseTuple(args, "iO", &how, &seq)) - return NULL; - - if (_signal_list_to_sigset(seq, &newset, - "sigprocmask requires a sequence") < 0) - return NULL; - - if (sigprocmask(how, &newset, &oldset) < 0) { - return PyErr_SetFromErrno(PyExc_ValueError); - } - - if (PyErr_CheckSignals()) - return NULL; - - return _signal_sigset_to_list(&oldset); - } - - PyDoc_STRVAR(sigprocmask_doc, - "sigprocmask(how, sigset) -> sigset\n\ - \n\ - Change the list of currently blocked signals. The parameter how should be\n\ - one of SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK and sigset should be a\n\ - sequence of signal numbers. The behaviour of the call depends on the value\n\ - of how:\n\ - \n\ - SIG_BLOCK\n\ - The set of blocked signals is the union of the current set and the\n\ - sigset argument.\n\ - SIG_UNBLOCK\n\ - The signals in sigset are removed from the current set of blocked\n\ - signals. It is legal to attempt to unblock a signal which is not\n\ - blocked.\n\ - SIG_SETMASK\n\ - The set of blocked signals is set to the argument set.\n\ - \n\ - A list contating the numbers of the previously blocked signals is returned."); - - static PyObject* - signal_sigpending(PyObject* self) - { - sigset_t set; - - if (sigpending(&set) < 0) { - return PyErr_SetFromErrno(PyExc_ValueError); - } - - return _signal_sigset_to_list(&set); - } - - PyDoc_STRVAR(sigpending_doc, - "sigpending() -> sigset\n\ - \n\ - Return the set of pending signals, i.e. a list containing the numbers of\n\ - those signals that have been raised while blocked."); - - static PyObject* - signal_sigsuspend(PyObject* self, PyObject* arg) - { - sigset_t set; - - if (_signal_list_to_sigset(arg, &set, - "sigsuspend requires a sequence") < 0) - return NULL; - - Py_BEGIN_ALLOW_THREADS - sigsuspend(&set); - Py_END_ALLOW_THREADS - - if (PyErr_CheckSignals()) - return NULL; - - Py_INCREF(Py_None); - return Py_None; - } - - PyDoc_STRVAR(sigsuspend_doc, - "sigsuspend(sigset) -> None\n\ - \n\ - Temporarily replace the signal mask with sigset (which should be a sequence\n\ - of signal numbers) and suspend the process until a signal is received."); - #endif /* List of functions defined in the module */ --- 270,273 ---- *************** *** 431,442 **** {"default_int_handler", signal_default_int_handler, METH_VARARGS, default_int_handler_doc}, - #ifdef HAVE_SIGPROCMASK - {"sigprocmask", (PyCFunction)signal_sigprocmask, - METH_VARARGS, sigprocmask_doc}, - {"sigpending", (PyCFunction)signal_sigpending, - METH_NOARGS, sigpending_doc}, - {"sigsuspend", (PyCFunction)signal_sigsuspend, - METH_O, sigsuspend_doc}, - #endif {NULL, NULL} /* sentinel */ }; --- 284,287 ---- *************** *** 454,461 **** default_int_handler() -- default SIGINT handler\n\ \n\ - sigpending() |\n\ - sigprocmask() |-- posix signal mask handling [Unix only]\n\ - sigsuspend() |\n\ - \n\ Constants:\n\ \n\ --- 299,302 ---- *************** *** 706,721 **** Py_XDECREF(x); #endif - #ifdef HAVE_SIGPROCMASK - x = PyInt_FromLong(SIG_BLOCK); - PyDict_SetItemString(d, "SIG_BLOCK", x); - Py_XDECREF(x); - x = PyInt_FromLong(SIG_UNBLOCK); - PyDict_SetItemString(d, "SIG_UNBLOCK", x); - Py_XDECREF(x); - x = PyInt_FromLong(SIG_SETMASK); - PyDict_SetItemString(d, "SIG_SETMASK", x); - Py_XDECREF(x); - #endif - if (!PyErr_Occurred()) return; --- 547,550 ---- From mwh@users.sourceforge.net Thu Mar 13 13:56:55 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 13 Mar 2003 05:56:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_signal.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22379/Lib/test Modified Files: test_signal.py Log Message: Take out my (long since disabled) POSIX signal mask handling code. I'm not going to have the time or energy to get this working x-platform -- anyone who does is welcome to the code! Index: test_signal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_signal.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_signal.py 23 Jul 2002 19:04:01 -0000 1.12 --- test_signal.py 13 Mar 2003 13:56:52 -0000 1.13 *************** *** 65,127 **** print "KeyboardInterrupt (assume the alarm() went off)" - - if hasattr(signal, "sigprocmask"): - class HupDelivered(Exception): - pass - def hup(signum, frame): - raise HupDelivered - def hup2(signum, frame): - signal.signal(signal.SIGHUP, hup) - return - signal.signal(signal.SIGHUP, hup) - - if verbose: - print "blocking SIGHUP" - - defaultmask = signal.sigprocmask(signal.SIG_BLOCK, [signal.SIGHUP]) - - if verbose: - print "sending SIGHUP" - - try: - os.kill(pid, signal.SIGHUP) - except HupDelivered: - raise TestFailed, "HUP not blocked" - - if signal.SIGHUP not in signal.sigpending(): - raise TestFailed, "HUP not pending" - - if verbose: - print "unblocking SIGHUP" - - try: - signal.sigprocmask(signal.SIG_UNBLOCK, [signal.SIGHUP]) - except HupDelivered: - pass - else: - raise TestFailed, "HUP not delivered" - - if verbose: - print "testing sigsuspend" - - signal.sigprocmask(signal.SIG_BLOCK, [signal.SIGHUP]) - signal.signal(signal.SIGHUP, hup2) - - if not os.fork(): - time.sleep(2) - os.kill(pid, signal.SIGHUP) - time.sleep(2) - os.kill(pid, signal.SIGHUP) - os._exit(0) - else: - try: - signal.sigsuspend(defaultmask) - except: - raise TestFailed, "sigsuspend erroneously raised" - - try: - signal.sigsuspend(defaultmask) - except HupDelivered: - pass - else: - raise TestFailed, "sigsupsend didn't raise" --- 65,66 ---- From mwh@users.sourceforge.net Thu Mar 13 13:56:55 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 13 Mar 2003 05:56:55 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.694,1.695 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv22379/Misc Modified Files: NEWS Log Message: Take out my (long since disabled) POSIX signal mask handling code. I'm not going to have the time or energy to get this working x-platform -- anyone who does is welcome to the code! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.694 retrieving revision 1.695 diff -C2 -d -r1.694 -r1.695 *** NEWS 11 Mar 2003 21:43:55 -0000 1.694 --- NEWS 13 Mar 2003 13:56:50 -0000 1.695 *************** *** 983,989 **** is called. - - signal.sigpending, signal.sigprocmask and signal.sigsuspend have - been added where available. - - The sys module acquired a new attribute, api_version, which evaluates to the value of the PYTHON_API_VERSION macro with which the --- 983,986 ---- From mwh@users.sourceforge.net Thu Mar 13 13:57:22 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 13 Mar 2003 05:57:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libsignal.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv22379/Doc/lib Modified Files: libsignal.tex Log Message: Take out my (long since disabled) POSIX signal mask handling code. I'm not going to have the time or energy to get this working x-platform -- anyone who does is welcome to the code! Index: libsignal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsignal.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libsignal.tex 27 May 2002 15:08:24 -0000 1.24 --- libsignal.tex 13 Mar 2003 13:56:49 -0000 1.25 *************** *** 19,22 **** --- 19,26 ---- \item + There is no way to ``block'' signals temporarily from critical + sections (since this is not supported by all \UNIX{} flavors). + + \item Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the *************** *** 89,102 **** \end{datadesc} - \begin{datadesc}{SIG_BLOCK} - \end{datadesc} - \begin{datadesc}{SIG_UNBLOCK} - \end{datadesc} - \begin{datadesc}{SIG_SETMASK} - These constants are for use as the first parameter of the - \function{sigprocmask} function described below. - \end{datadesc} - - The \module{signal} module defines the following functions: --- 93,96 ---- *************** *** 149,192 **** reference manual for a description of frame objects). \obindex{frame} - \end{funcdesc} - - The following functions are supported if your platform does. Most - modern \UNIX-alikes now do. - - \begin{funcdesc}{sigpending}{} - Return the set of pending signals, i.e. a list containing the - numbers of those signals that have been raised while blocked. - \versionadded{2.3} - \end{funcdesc} - - \begin{funcdesc}{sigprocmask}{how, sigset} - Change the list of currently blocked signals. The parameter - \var{how} should be one of \constant{SIG_BLOCK}, - \constant{SIG_UNBLOCK} or \constant{SIG_SETMASK} and \var{sigset} - should be a sequence of signal numbers. The behaviour of the call - depends on the value of \var{how}: - - \begin{tableii}{l|l}{textrm}{Value of \var{how}}{Behaviour of call} - \lineii{\constant{SIG_BLOCK}} - {The set of blocked signals is the union of the current set - and \var{sigset}.} - \lineii{\constant{SIG_UNBLOCK}} - {The signals in \var{sigset} are removed from the current - set of blocked signals. It is legal to attempt to unblock - a signal which is not blocked.} - \lineii{\constant{SIG_SETMASK}} - {The set of blocked signals is set to the \var{sigset}.} - \end{tableii} - - A list contating the numbers of the previously blocked signals is - returned. - \versionadded{2.3} - \end{funcdesc} - - \begin{funcdesc}{sigsuspend}{sigset} - Temporarily replace the signal mask with \var{sigset} (which should - be a sequnce of signal numbers) and suspend the process until a - signal is received. - \versionadded{2.3} \end{funcdesc} --- 143,146 ---- From mwh@users.sourceforge.net Thu Mar 13 13:57:22 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 13 Mar 2003 05:57:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv22379/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Take out my (long since disabled) POSIX signal mask handling code. I'm not going to have the time or energy to get this working x-platform -- anyone who does is welcome to the code! Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** whatsnew23.tex 9 Mar 2003 07:19:38 -0000 1.129 --- whatsnew23.tex 13 Mar 2003 13:56:50 -0000 1.130 *************** *** 1486,1493 **** \item Support for more advanced POSIX signal handling was added ! to the \module{signal} module by adding the \function{sigpending}, ! \function{sigprocmask} and \function{sigsuspend} functions where supported ! by the platform. These functions make it possible to avoid some previously ! unavoidable race conditions with signal handling. \item The \module{socket} module now supports timeouts. You --- 1486,1491 ---- \item Support for more advanced POSIX signal handling was added ! to the \module{signal} but then removed again as it proved impossible ! to make it work reliably across platforms. \item The \module{socket} module now supports timeouts. You From rhettinger@users.sourceforge.net Fri Mar 14 01:37:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 13 Mar 2003 17:37:44 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.353,2.354 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv32028 Modified Files: ceval.c Log Message: SF patch #701907: More use of fast_next_opcode My previous patches should have used fast_next_opcode in a few places instead of continue. Also, applied one PyInt_AS_LONG macro in a place where the type had already been checked. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.353 retrieving revision 2.354 diff -C2 -d -r2.353 -r2.354 *** ceval.c 1 Mar 2003 03:36:33 -0000 2.353 --- ceval.c 14 Mar 2003 01:37:42 -0000 2.354 *************** *** 884,888 **** SET_TOP(w); SET_SECOND(v); ! continue; case ROT_THREE: --- 884,888 ---- SET_TOP(w); SET_SECOND(v); ! goto fast_next_opcode; case ROT_THREE: *************** *** 893,897 **** SET_SECOND(x); SET_THIRD(v); ! continue; case ROT_FOUR: --- 893,897 ---- SET_SECOND(x); SET_THIRD(v); ! goto fast_next_opcode; case ROT_FOUR: *************** *** 904,908 **** SET_THIRD(x); SET_FOURTH(u); ! continue; case DUP_TOP: --- 904,908 ---- SET_THIRD(x); SET_FOURTH(u); ! goto fast_next_opcode; case DUP_TOP: *************** *** 910,914 **** Py_INCREF(v); PUSH(v); ! continue; case DUP_TOPX: --- 910,914 ---- Py_INCREF(v); PUSH(v); ! goto fast_next_opcode; case DUP_TOPX: *************** *** 1595,1599 **** v = POP(); if (PyInt_Check(v)) { ! why = (enum why_code) PyInt_AsLong(v); if (why == WHY_RETURN || why == WHY_YIELD || --- 1595,1599 ---- v = POP(); if (PyInt_Check(v)) { ! why = (enum why_code) PyInt_AS_LONG(v); if (why == WHY_RETURN || why == WHY_YIELD || *************** *** 1973,1985 **** case JUMP_FORWARD: JUMPBY(oparg); ! continue; case JUMP_IF_FALSE: w = TOP(); if (w == Py_True) ! continue; if (w == Py_False) { JUMPBY(oparg); ! continue; } err = PyObject_IsTrue(w); --- 1973,1985 ---- case JUMP_FORWARD: JUMPBY(oparg); ! goto fast_next_opcode; case JUMP_IF_FALSE: w = TOP(); if (w == Py_True) ! goto fast_next_opcode; if (w == Py_False) { JUMPBY(oparg); ! goto fast_next_opcode; } err = PyObject_IsTrue(w); *************** *** 1995,2002 **** w = TOP(); if (w == Py_False) ! continue; if (w == Py_True) { JUMPBY(oparg); ! continue; } err = PyObject_IsTrue(w); --- 1995,2002 ---- w = TOP(); if (w == Py_False) ! goto fast_next_opcode; if (w == Py_True) { JUMPBY(oparg); ! goto fast_next_opcode; } err = PyObject_IsTrue(w); *************** *** 2013,2017 **** case JUMP_ABSOLUTE: JUMPTO(oparg); ! continue; case GET_ITER: --- 2013,2017 ---- case JUMP_ABSOLUTE: JUMPTO(oparg); ! goto fast_next_opcode; case GET_ITER: From fdrake@users.sourceforge.net Fri Mar 14 16:21:59 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 14 Mar 2003 08:21:59 -0800 Subject: [Python-checkins] python/dist/src/Lib HTMLParser.py,1.11,1.12 sgmllib.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20740 Modified Files: HTMLParser.py sgmllib.py Log Message: Accept commas in unquoted attribute values. This closes SF patch #669683. Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** HTMLParser.py 14 May 2002 15:50:11 -0000 1.11 --- HTMLParser.py 14 Mar 2003 16:21:54 -0000 1.12 *************** *** 27,31 **** attrfind = re.compile( r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*' ! r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~]*))?') locatestarttagend = re.compile(r""" --- 27,31 ---- attrfind = re.compile( r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*' ! r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~]*))?') locatestarttagend = re.compile(r""" Index: sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** sgmllib.py 2 Jun 2002 00:40:04 -0000 1.41 --- sgmllib.py 14 Mar 2003 16:21:55 -0000 1.42 *************** *** 35,39 **** attrfind = re.compile( r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*' ! r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~\'"]*))?') --- 35,39 ---- attrfind = re.compile( r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*' ! r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"]*))?') From fdrake@users.sourceforge.net Fri Mar 14 16:22:01 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 14 Mar 2003 08:22:01 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_htmlparser.py,1.9,1.10 test_sgmllib.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20740/test Modified Files: test_htmlparser.py test_sgmllib.py Log Message: Accept commas in unquoted attribute values. This closes SF patch #669683. Index: test_htmlparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmlparser.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_htmlparser.py 23 Jul 2002 19:03:54 -0000 1.9 --- test_htmlparser.py 14 Mar 2003 16:21:56 -0000 1.10 *************** *** 198,201 **** --- 198,205 ---- ("starttag", "a", [("b", ""), ("c", "")]), ]) + # Regression test for SF patch #669683. + self._run_check("", [ + ("starttag", "e", [("a", "rgb(1,2,3)")]), + ]) def test_attr_entity_replacement(self): Index: test_sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sgmllib.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_sgmllib.py 25 Sep 2002 16:29:17 -0000 1.4 --- test_sgmllib.py 14 Mar 2003 16:21:57 -0000 1.5 *************** *** 201,204 **** --- 201,208 ---- ("starttag", "a", [("b", ""), ("c", "")]), ]) + # Regression test for SF patch #669683. + self.check_events("", [ + ("starttag", "e", [("a", "rgb(1,2,3)")]), + ]) def test_attr_funky_names(self): From gvanrossum@users.sourceforge.net Fri Mar 14 17:21:06 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 14 Mar 2003 09:21:06 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21199 Modified Files: timeit.py Log Message: Implement some recommendations from Raymond H: - Make all local variables in the template start with an underscore, to prevent name conflicts with the timed code. - Added a method to print a traceback that shows source lines from the expanded template. - Use that method in main(). Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** timeit.py 7 Mar 2003 01:33:18 -0000 1.6 --- timeit.py 14 Mar 2003 17:21:00 -0000 1.7 *************** *** 59,62 **** --- 59,63 ---- __all__ = ["Timer"] + dummy_src_name = "" default_number = 1000000 default_repeat = 10 *************** *** 73,83 **** # being indented 8 spaces. template = """ ! def inner(seq, timer): %(setup)s ! t0 = timer() ! for i in seq: %(stmt)s ! t1 = timer() ! return t1-t0 """ --- 74,84 ---- # being indented 8 spaces. template = """ ! def inner(_seq, _timer): %(setup)s ! _t0 = _timer() ! for _i in _seq: %(stmt)s ! _t1 = _timer() ! return _t1 - _t0 """ *************** *** 108,116 **** setup = reindent(setup, 4) src = template % {'stmt': stmt, 'setup': setup} ! code = compile(src, "", "exec") ns = {} exec code in globals(), ns self.inner = ns["inner"] def timeit(self, number=default_number): """Time 'number' executions of the main statement. --- 109,142 ---- setup = reindent(setup, 4) src = template % {'stmt': stmt, 'setup': setup} ! self.src = src # Save for traceback display ! code = compile(src, dummy_src_name, "exec") ns = {} exec code in globals(), ns self.inner = ns["inner"] + def print_exc(self, file=None): + """Helper to print a traceback from the timed code. + + Typical use: + + t = Timer(...) # outside the try/except + try: + t.timeit(...) # or t.repeat(...) + except: + t.print_exc() + + The advantage over the standard traceback is that source lines + in the compiled template will be displayed. + + The optional file argument directs where the traceback is + sent; it defaults to sys.stderr. + """ + import linecache, traceback + linecache.cache[dummy_src_name] = (len(self.src), + None, + self.src.split("\n"), + dummy_src_name) + traceback.print_exc(file=file) + def timeit(self, number=default_number): """Time 'number' executions of the main statement. *************** *** 163,166 **** --- 189,196 ---- The return value is an exit code to be passed to sys.exit(); it may be None to indicate success. + + When an exception happens during timing, a traceback is printed to + stderr and the return value is 1. Exceptions at other times + (including the template compilation) are not caught. """ if args is None: *************** *** 202,216 **** for i in range(1, 10): number = 10**i ! x = t.timeit(number) if x >= 0.2: break ! r = t.repeat(repeat, number) best = min(r) print "%d loops," % number, usec = best * 1e6 / number if repeat > 1: ! print "best of %d: %.3f usec" % (repeat, usec) else: ! print "time: %.3f usec" % usec return None --- 232,254 ---- for i in range(1, 10): number = 10**i ! try: ! x = t.timeit(number) ! except: ! t.print_exc() ! return 1 if x >= 0.2: break ! try: ! r = t.repeat(repeat, number) ! except: ! t.print_exc() ! return 1 best = min(r) print "%d loops," % number, usec = best * 1e6 / number if repeat > 1: ! print "best of %d: %.3f usec per loop" % (repeat, usec) else: ! print "time: %.3f usec per loop" % usec return None From cliffwells18@users.sourceforge.net Fri Mar 14 21:10:34 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Fri, 14 Mar 2003 13:10:34 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv29487 Modified Files: sniffer.py Log Message: Minor bugfixes. No longer punts when there isn't a quotechar or delimiter, just returns '' instead. Index: sniffer.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/util/sniffer.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sniffer.py 12 Mar 2003 21:45:05 -0000 1.2 --- sniffer.py 14 Mar 2003 21:10:27 -0000 1.3 *************** *** 7,17 **** from csv import csv ! import re, string class Sniffer: """ "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) ! Sniffer.dialect will be either a csv.Dialect object or None ! if the file format couldn't be determined. """ def __init__(self, sample = 16 * 1024): --- 7,16 ---- from csv import csv ! import re class Sniffer: """ "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) ! Returns a csv.Dialect object. """ def __init__(self, sample = 16 * 1024): *************** *** 184,188 **** if not delims: ! return None # if there's more than one, fall back to a 'preferred' list --- 183,187 ---- if not delims: ! return ('', 0) # if there's more than one, fall back to a 'preferred' list From gvanrossum@users.sourceforge.net Fri Mar 14 21:51:39 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 14 Mar 2003 13:51:39 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.228,1.229 NEWS,1.695,1.696 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14617/Misc Modified Files: ACKS NEWS Log Message: - New function time.tzset() provides access to the C library tzet() function, if supported. (SF patch #675422, by Stuart Bishop.) Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.228 retrieving revision 1.229 diff -C2 -d -r1.228 -r1.229 *** ACKS 9 Mar 2003 07:05:43 -0000 1.228 --- ACKS 14 Mar 2003 21:51:33 -0000 1.229 *************** *** 51,54 **** --- 51,55 ---- Ron Bickers Dominic Binks + Stuart Bishop Roy Bixler Martin Bless Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.695 retrieving revision 1.696 diff -C2 -d -r1.695 -r1.696 *** NEWS 13 Mar 2003 13:56:50 -0000 1.695 --- NEWS 14 Mar 2003 21:51:35 -0000 1.696 *************** *** 33,36 **** --- 33,39 ---- ----------------- + - New function time.tzset() provides access to the C library tzet() + function, if supported. (SF patch #675422.) + - Using createfilehandler, deletefilehandler, createtimerhandler functions on Tkinter.tkinter (_tkinter module) no longer crashes the interpreter. From gvanrossum@users.sourceforge.net Fri Mar 14 21:51:39 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 14 Mar 2003 13:51:39 -0800 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.134,2.135 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14617/Modules Modified Files: timemodule.c Log Message: - New function time.tzset() provides access to the C library tzet() function, if supported. (SF patch #675422, by Stuart Bishop.) Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.134 retrieving revision 2.135 diff -C2 -d -r2.134 -r2.135 *** timemodule.c 19 Jan 2003 04:54:58 -0000 2.134 --- timemodule.c 14 Mar 2003 21:51:36 -0000 2.135 *************** *** 555,637 **** #endif /* HAVE_MKTIME */ ! static PyMethodDef time_methods[] = { ! {"time", time_time, METH_VARARGS, time_doc}, ! #ifdef HAVE_CLOCK ! {"clock", time_clock, METH_VARARGS, clock_doc}, ! #endif ! {"sleep", time_sleep, METH_VARARGS, sleep_doc}, ! {"gmtime", time_gmtime, METH_VARARGS, gmtime_doc}, ! {"localtime", time_localtime, METH_VARARGS, localtime_doc}, ! {"asctime", time_asctime, METH_VARARGS, asctime_doc}, ! {"ctime", time_ctime, METH_VARARGS, ctime_doc}, ! #ifdef HAVE_MKTIME ! {"mktime", time_mktime, METH_VARARGS, mktime_doc}, ! #endif ! #ifdef HAVE_STRFTIME ! {"strftime", time_strftime, METH_VARARGS, strftime_doc}, ! #endif ! {"strptime", time_strptime, METH_VARARGS, strptime_doc}, ! {NULL, NULL} /* sentinel */ ! }; ! PyDoc_STRVAR(module_doc, ! "This module provides various functions to manipulate time values.\n\ ! \n\ ! There are two standard representations of time. One is the number\n\ ! of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer\n\ ! or a floating point number (to represent fractions of seconds).\n\ ! The Epoch is system-defined; on Unix, it is generally January 1st, 1970.\n\ ! The actual value can be retrieved by calling gmtime(0).\n\ ! \n\ ! The other representation is a tuple of 9 integers giving local time.\n\ ! The tuple items are:\n\ ! year (four digits, e.g. 1998)\n\ ! month (1-12)\n\ ! day (1-31)\n\ ! hours (0-23)\n\ ! minutes (0-59)\n\ ! seconds (0-59)\n\ ! weekday (0-6, Monday is 0)\n\ ! Julian day (day in the year, 1-366)\n\ ! DST (Daylight Savings Time) flag (-1, 0 or 1)\n\ ! If the DST flag is 0, the time is given in the regular time zone;\n\ ! if it is 1, the time is given in the DST time zone;\n\ ! if it is -1, mktime() should guess based on the date and time.\n\ ! \n\ ! Variables:\n\ ! \n\ ! timezone -- difference in seconds between UTC and local standard time\n\ ! altzone -- difference in seconds between UTC and local DST time\n\ ! daylight -- whether local time should reflect DST\n\ ! tzname -- tuple of (standard time zone name, DST time zone name)\n\ ! \n\ ! Functions:\n\ \n\ ! time() -- return current time in seconds since the Epoch as a float\n\ ! clock() -- return CPU time since process start as a float\n\ ! sleep() -- delay for a number of seconds given as a float\n\ ! gmtime() -- convert seconds since Epoch to UTC tuple\n\ ! localtime() -- convert seconds since Epoch to local time tuple\n\ ! asctime() -- convert time tuple to string\n\ ! ctime() -- convert time in seconds to string\n\ ! mktime() -- convert local time tuple to seconds since Epoch\n\ ! strftime() -- convert time tuple to string according to format specification\n\ ! strptime() -- parse string to time tuple according to format specification"); ! PyMODINIT_FUNC ! 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(); --- 555,615 ---- #endif /* HAVE_MKTIME */ ! #ifdef HAVE_WORKING_TZSET ! void inittimezone(PyObject *module); + static PyObject * + time_tzset(PyObject *self, PyObject *args) + { + PyObject* m; ! if (!PyArg_ParseTuple(args, ":tzset")) ! return NULL; ! ! m = PyImport_ImportModule("time"); ! if (m == NULL) { ! return NULL; ! } ! ! tzset(); ! ! /* Reset timezone, altzone, daylight and tzname */ ! inittimezone(m); ! Py_DECREF(m); ! ! Py_INCREF(Py_None); ! return Py_None; ! } ! ! PyDoc_STRVAR(tzset_doc, ! "tzset(zone)\n\ \n\ ! Initialize, or reinitialize, the local timezone to the value stored in\n\ ! os.environ['TZ']. The TZ environment variable should be specified in\n\ ! standard Uniz timezone format as documented in the tzset man page\n\ ! (eg. 'US/Eastern', 'Europe/Amsterdam'). Unknown timezones will silently\n\ ! fall back to UTC. If the TZ environment variable is not set, the local\n\ ! timezone is set to the systems best guess of wallclock time.\n\ ! Changing the TZ environment variable without calling tzset *may* change\n\ ! the local timezone used by methods such as localtime, but this behaviour\n\ ! should not be relied on."); ! #endif /* HAVE_WORKING_TZSET */ + void inittimezone(PyObject *m) { + /* This code moved from inittime wholesale to allow calling it from + time_tzset. In the future, some parts of it can be moved back + (for platforms that don't HAVE_WORKING_TZSET, when we know what they + are), and the extranious calls to tzset(3) should be removed. + I havn't done this yet, as I don't want to change this code as + little as possible when introducing the time.tzset and time.tzsetwall + methods. This should simply be a method of doing the following once, + at the top of this function and removing the call to tzset() from + time_tzset(): ! #ifdef HAVE_TZSET ! tzset() ! #endif ! And I'm lazy and hate C so nyer. ! */ #if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) tzset(); *************** *** 713,716 **** --- 691,784 ---- #endif /* __CYGWIN__ */ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ + } + + + static PyMethodDef time_methods[] = { + {"time", time_time, METH_VARARGS, time_doc}, + #ifdef HAVE_CLOCK + {"clock", time_clock, METH_VARARGS, clock_doc}, + #endif + {"sleep", time_sleep, METH_VARARGS, sleep_doc}, + {"gmtime", time_gmtime, METH_VARARGS, gmtime_doc}, + {"localtime", time_localtime, METH_VARARGS, localtime_doc}, + {"asctime", time_asctime, METH_VARARGS, asctime_doc}, + {"ctime", time_ctime, METH_VARARGS, ctime_doc}, + #ifdef HAVE_MKTIME + {"mktime", time_mktime, METH_VARARGS, mktime_doc}, + #endif + #ifdef HAVE_STRFTIME + {"strftime", time_strftime, METH_VARARGS, strftime_doc}, + #endif + {"strptime", time_strptime, METH_VARARGS, strptime_doc}, + #ifdef HAVE_WORKING_TZSET + {"tzset", time_tzset, METH_VARARGS, tzset_doc}, + #endif + {NULL, NULL} /* sentinel */ + }; + + + PyDoc_STRVAR(module_doc, + "This module provides various functions to manipulate time values.\n\ + \n\ + There are two standard representations of time. One is the number\n\ + of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer\n\ + or a floating point number (to represent fractions of seconds).\n\ + The Epoch is system-defined; on Unix, it is generally January 1st, 1970.\n\ + The actual value can be retrieved by calling gmtime(0).\n\ + \n\ + The other representation is a tuple of 9 integers giving local time.\n\ + The tuple items are:\n\ + year (four digits, e.g. 1998)\n\ + month (1-12)\n\ + day (1-31)\n\ + hours (0-23)\n\ + minutes (0-59)\n\ + seconds (0-59)\n\ + weekday (0-6, Monday is 0)\n\ + Julian day (day in the year, 1-366)\n\ + DST (Daylight Savings Time) flag (-1, 0 or 1)\n\ + If the DST flag is 0, the time is given in the regular time zone;\n\ + if it is 1, the time is given in the DST time zone;\n\ + if it is -1, mktime() should guess based on the date and time.\n\ + \n\ + Variables:\n\ + \n\ + timezone -- difference in seconds between UTC and local standard time\n\ + altzone -- difference in seconds between UTC and local DST time\n\ + daylight -- whether local time should reflect DST\n\ + tzname -- tuple of (standard time zone name, DST time zone name)\n\ + \n\ + Functions:\n\ + \n\ + time() -- return current time in seconds since the Epoch as a float\n\ + clock() -- return CPU time since process start as a float\n\ + sleep() -- delay for a number of seconds given as a float\n\ + gmtime() -- convert seconds since Epoch to UTC tuple\n\ + localtime() -- convert seconds since Epoch to local time tuple\n\ + asctime() -- convert time tuple to string\n\ + ctime() -- convert time in seconds to string\n\ + mktime() -- convert local time tuple to seconds since Epoch\n\ + strftime() -- convert time tuple to string according to format specification\n\ + strptime() -- parse string to time tuple according to format specification\n\ + tzset() -- change the local timezone"); + + + PyMODINIT_FUNC + 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); + + /* Set, or reset, module variables like time.timezone */ + inittimezone(m); + #ifdef MS_WINDOWS /* Helper to allow interrupts for Windows. *************** *** 902,903 **** --- 970,973 ---- return 0; } + + From gvanrossum@users.sourceforge.net Fri Mar 14 21:52:06 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 14 Mar 2003 13:52:06 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_time.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14617/Lib/test Modified Files: test_time.py Log Message: - New function time.tzset() provides access to the C library tzet() function, if supported. (SF patch #675422, by Stuart Bishop.) Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_time.py 23 Jul 2002 19:04:06 -0000 1.11 --- test_time.py 14 Mar 2003 21:51:33 -0000 1.12 *************** *** 49,57 **** self.fail('conversion specifier: %r failed.' % format) - def test_asctime(self): time.asctime(time.gmtime(self.t)) self.assertRaises(TypeError, time.asctime, 0) def test_main(): --- 49,138 ---- self.fail('conversion specifier: %r failed.' % format) def test_asctime(self): time.asctime(time.gmtime(self.t)) self.assertRaises(TypeError, time.asctime, 0) + def test_tzset(self): + from os import environ + + # Epoch time of midnight Dec 25th 2002. Never DST in northern + # hemisphere. + xmas2002 = 1040774400.0 + + org_TZ = environ.get('TZ',None) + try: + + # Make sure we can switch to UTC time and results are correct + # Note that unknown timezones default to UTC. + for tz in ('UTC','GMT','Luna/Tycho'): + environ['TZ'] = 'US/Eastern' + time.tzset() + environ['TZ'] = tz + time.tzset() + self.failUnlessEqual( + time.gmtime(xmas2002),time.localtime(xmas2002) + ) + self.failUnlessEqual(time.timezone,time.altzone) + self.failUnlessEqual(time.daylight,0) + self.failUnlessEqual(time.timezone,0) + self.failUnlessEqual(time.altzone,0) + self.failUnlessEqual(time.localtime(xmas2002).tm_isdst,0) + + # Make sure we can switch to US/Eastern + environ['TZ'] = 'US/Eastern' + time.tzset() + self.failIfEqual(time.gmtime(xmas2002),time.localtime(xmas2002)) + self.failUnlessEqual(time.tzname,('EST','EDT')) + self.failUnlessEqual(len(time.tzname),2) + self.failUnlessEqual(time.daylight,1) + self.failUnlessEqual(time.timezone,18000) + self.failUnlessEqual(time.altzone,14400) + self.failUnlessEqual(time.localtime(xmas2002).tm_isdst,0) + self.failUnlessEqual(len(time.tzname),2) + + # Now go to the southern hemisphere. We want somewhere all OS's + # know about that has DST. + environ['TZ'] = 'Australia/Melbourne' + time.tzset() + self.failIfEqual(time.gmtime(xmas2002),time.localtime(xmas2002)) + self.failUnless(time.tzname[0] in ('EST','AEST')) + self.failUnless(time.tzname[1] in ('EST','EDT','AEDT')) + self.failUnlessEqual(len(time.tzname),2) + self.failUnlessEqual(time.daylight,1) + self.failUnlessEqual(time.timezone,-36000) + self.failUnlessEqual(time.altzone,-39600) + self.failUnlessEqual(time.localtime(xmas2002).tm_isdst,1) + + # Get some times from a timezone that isn't wallclock timezone + del environ['TZ'] + time.tzset() + if time.timezone == 0: + environ['TZ'] = 'US/Eastern' + else: + environ['TZ'] = 'UTC' + time.tzset() + nonlocal = time.localtime(xmas2002) + + # Then the same time in wallclock timezone + del environ['TZ'] + time.tzset() + local = time.localtime(xmas2002) + + # And make sure they arn't the same + self.failIfEqual(local,nonlocal) + + # Do some basic sanity checking after wallclock time set + self.failUnlessEqual(len(time.tzname),2) + time.daylight + time.timezone + time.altzone + finally: + # Repair TZ environment variable in case any other tests + # rely on it. + if org_TZ is not None: + environ['TZ'] = org_TZ + elif environ.has_key('TZ'): + del environ['TZ'] + def test_main(): From gvanrossum@users.sourceforge.net Fri Mar 14 21:52:06 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 14 Mar 2003 13:52:06 -0800 Subject: [Python-checkins] python/dist/src configure,1.381,1.382 configure.in,1.392,1.393 pyconfig.h.in,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv14617 Modified Files: configure configure.in pyconfig.h.in Log Message: - New function time.tzset() provides access to the C library tzet() function, if supported. (SF patch #675422, by Stuart Bishop.) Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.381 retrieving revision 1.382 diff -C2 -d -r1.381 -r1.382 *** configure 25 Feb 2003 13:14:43 -0000 1.381 --- configure 14 Mar 2003 21:51:20 -0000 1.382 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.391 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.392 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 16547,16550 **** --- 16547,16618 ---- cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_NICE 1 + _ACEOF + + fi + + # tzset(3) exists and works like we expect it to + echo "$as_me:$LINENO: checking for working tzset()" >&5 + echo $ECHO_N "checking for working tzset()... $ECHO_C" >&6 + if test "${ac_cv_working_tzset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + + if test "$cross_compiling" = yes; then + ac_cv_working_tzset=no + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include + #include + int main() + { + int gmt_hour; + int eastern_hour; + time_t now; + now = time((time_t*)NULL); + putenv("TZ=GMT"); + tzset(); + gmt_hour = localtime(&now)->tm_hour; + putenv("TZ=US/Eastern"); + tzset(); + eastern_hour = localtime(&now)->tm_hour; + if (eastern_hour == gmt_hour) + exit(1); + exit(0); + } + + _ACEOF + rm -f conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_tzset=yes + else + echo "$as_me: program exited with status $ac_status" >&5 + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ( exit $ac_status ) + ac_cv_working_tzset=no + fi + rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + fi + fi + + echo "$as_me:$LINENO: result: $ac_cv_working_tzset" >&5 + echo "${ECHO_T}$ac_cv_working_tzset" >&6 + if test "$ac_cv_working_tzset" = yes + then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_WORKING_TZSET 1 _ACEOF Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.392 retrieving revision 1.393 diff -C2 -d -r1.392 -r1.393 *** configure.in 25 Feb 2003 13:14:42 -0000 1.392 --- configure.in 14 Mar 2003 21:51:31 -0000 1.393 *************** *** 2501,2504 **** --- 2501,2537 ---- fi + # tzset(3) exists and works like we expect it to + AC_MSG_CHECKING(for working tzset()) + AC_CACHE_VAL(ac_cv_working_tzset, [ + AC_TRY_RUN([ + #include + #include + int main() + { + int gmt_hour; + int eastern_hour; + time_t now; + now = time((time_t*)NULL); + putenv("TZ=GMT"); + tzset(); + gmt_hour = localtime(&now)->tm_hour; + putenv("TZ=US/Eastern"); + tzset(); + eastern_hour = localtime(&now)->tm_hour; + if (eastern_hour == gmt_hour) + exit(1); + exit(0); + } + ], + ac_cv_working_tzset=yes, + ac_cv_working_tzset=no, + ac_cv_working_tzset=no)]) + AC_MSG_RESULT($ac_cv_working_tzset) + if test "$ac_cv_working_tzset" = yes + then + AC_DEFINE(HAVE_WORKING_TZSET, 1, + [Define if tzset() actually switches the local timezone in a meaningful way.]) + fi + # Look for subsecond timestamps in struct stat AC_MSG_CHECKING(for tv_nsec in struct stat) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** pyconfig.h.in 19 Feb 2003 15:25:10 -0000 1.72 --- pyconfig.h.in 14 Mar 2003 21:51:32 -0000 1.73 *************** *** 614,617 **** --- 614,621 ---- #undef HAVE_WCSCOLL + /* Define if tzset() actually switches the local timezone in a meaningful way. + */ + #undef HAVE_WORKING_TZSET + /* Define to 1 if you have the `_getpty' function. */ #undef HAVE__GETPTY From cliffwells18@users.sourceforge.net Sat Mar 15 00:42:49 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Fri, 14 Mar 2003 16:42:49 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv16961 Modified Files: sniffer.py Log Message: Fixed return value of delim when there's only a single column (return '' rather than None). Index: sniffer.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/util/sniffer.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sniffer.py 14 Mar 2003 21:10:27 -0000 1.3 --- sniffer.py 15 Mar 2003 00:42:46 -0000 1.4 *************** *** 9,12 **** --- 9,13 ---- import re + # ------------------------------------------------------------------------------ class Sniffer: """ *************** *** 57,60 **** --- 58,62 ---- """ + matches = [] for restr in ('(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?P=delim)', # ,".*?", '(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)', # ".*?", *************** *** 99,103 **** skipinitialspace = delims[delim] == spaces if delim == '\n': # most likely a file with a single column ! delim = None else: # there is *no* delimiter, it's a single column of quoted data --- 101,105 ---- skipinitialspace = delims[delim] == spaces if delim == '\n': # most likely a file with a single column ! delim = '' else: # there is *no* delimiter, it's a single column of quoted data *************** *** 198,201 **** --- 200,274 ---- + # ------------------------------------------------------------------------------ + def hasHeaders(data, columns = 0): + """ + PROTOTYPE: + hasHeaders(data, columns = 0) + DESCRIPTION: + Decides whether row 0 is a header row + ARGUMENTS: + - data is a list of lists of data (as returned by importDSV) + - columns is either the expected number of columns in each row or 0 + RETURNS: + - true if data has header row + """ + + # Algorithm: creates a dictionary of types of data in each column. If any column + # is of a single type (say, integers), *except* for the first row, then the first + # row is presumed to be labels. If the type can't be determined, it is assumed to + # be a string in which case the length of the string is the determining factor: if + # all of the rows except for the first are the same length, it's a header. + # Finally, a 'vote' is taken at the end for each column, adding or subtracting from + # the likelihood of the first row being a header. + + if type(data) != type([]): + raise InvalidData, "list expected." + if len(data) < 2: return 0 + + if not columns: + columns = modeOfLengths(data) + + columnTypes = {} + for i in range(columns): columnTypes[i] = None + + for row in data[1:]: + if len(row) != columns: + continue # skip rows that have irregular number of columns + for col in columnTypes.keys(): + try: + try: + # is it a built-in type (besides string)? + thisType = type(eval(row[col])) + except OverflowError: + # a long int? + thisType = type(eval(row[col] + 'L')) + thisType = type(0) # treat long ints as int + except: + # fallback to length of string + thisType = len(row[col]) + + if thisType != columnTypes[col]: + if columnTypes[col] is None: # add new column type + columnTypes[col] = thisType + else: # type is inconsistent, remove column from consideration + del columnTypes[col] + + # finally, compare results against first row and vote on whether it's a header + hasHeader = 0 + for col, colType in columnTypes.items(): + if type(colType) == type(0): # it's a length + if len(data[0][col]) != colType: + hasHeader += 1 + else: + hasHeader -= 1 + else: # attempt typecast + try: + eval("%s(%s)" % (colType.__name__, data[0][col])) + except: + hasHeader += 1 + else: + hasHeader -= 1 + + return hasHeader > 0 From cliffwells18@users.sourceforge.net Sat Mar 15 01:08:24 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Fri, 14 Mar 2003 17:08:24 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv25919 Modified Files: sniffer.py Log Message: Working but inefficient hasHeaders() function. Index: sniffer.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/util/sniffer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sniffer.py 15 Mar 2003 00:42:46 -0000 1.4 --- sniffer.py 15 Mar 2003 01:08:21 -0000 1.5 *************** *** 201,217 **** # ------------------------------------------------------------------------------ ! def hasHeaders(data, columns = 0): ! """ ! PROTOTYPE: ! hasHeaders(data, columns = 0) ! DESCRIPTION: ! Decides whether row 0 is a header row ! ARGUMENTS: ! - data is a list of lists of data (as returned by importDSV) ! - columns is either the expected number of columns in each row or 0 ! RETURNS: ! - true if data has header row ! """ ! # Algorithm: creates a dictionary of types of data in each column. If any column # is of a single type (say, integers), *except* for the first row, then the first --- 201,205 ---- # ------------------------------------------------------------------------------ ! def hasHeaders(fileObj, dialect): # Algorithm: creates a dictionary of types of data in each column. If any column # is of a single type (say, integers), *except* for the first row, then the first *************** *** 222,236 **** # the likelihood of the first row being a header. ! if type(data) != type([]): ! raise InvalidData, "list expected." ! if len(data) < 2: return 0 ! if not columns: ! columns = modeOfLengths(data) columnTypes = {} for i in range(columns): columnTypes[i] = None ! for row in data[1:]: if len(row) != columns: continue # skip rows that have irregular number of columns --- 210,232 ---- # the likelihood of the first row being a header. ! def seval(item): ! """ ! Strips parens from item prior to calling eval in an attempt to make it safer ! """ ! item = item.replace('(', '').replace(')', '') ! return eval(item) ! reader = csv.reader(fileObj, ! delimiter = dialect.delimiter, ! quotechar = dialect.quotechar, ! skipinitialspace = dialect.skipinitialspace) + header = reader.next() # assume first row is header + + columns = len(header) columnTypes = {} for i in range(columns): columnTypes[i] = None ! for row in reader: if len(row) != columns: continue # skip rows that have irregular number of columns *************** *** 239,246 **** try: # is it a built-in type (besides string)? ! thisType = type(eval(row[col])) except OverflowError: # a long int? ! thisType = type(eval(row[col] + 'L')) thisType = type(0) # treat long ints as int except: --- 235,242 ---- try: # is it a built-in type (besides string)? ! thisType = type(seval(row[col])) except OverflowError: # a long int? ! thisType = type(seval(row[col] + 'L')) thisType = type(0) # treat long ints as int except: *************** *** 254,262 **** del columnTypes[col] ! # finally, compare results against first row and vote on whether it's a header hasHeader = 0 for col, colType in columnTypes.items(): if type(colType) == type(0): # it's a length ! if len(data[0][col]) != colType: hasHeader += 1 else: --- 250,258 ---- del columnTypes[col] ! # finally, compare results against first row and "vote" on whether it's a header hasHeader = 0 for col, colType in columnTypes.items(): if type(colType) == type(0): # it's a length ! if len(header[col]) != colType: hasHeader += 1 else: *************** *** 264,268 **** else: # attempt typecast try: ! eval("%s(%s)" % (colType.__name__, data[0][col])) except: hasHeader += 1 --- 260,264 ---- else: # attempt typecast try: ! eval("%s(%s)" % (colType.__name__, header[col])) except: hasHeader += 1 From cliffwells18@users.sourceforge.net Sat Mar 15 01:15:05 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Fri, 14 Mar 2003 17:15:05 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv27901 Modified Files: sniffer.py Log Message: Added arbitrary limit to hasHeaders(). Index: sniffer.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/util/sniffer.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sniffer.py 15 Mar 2003 01:08:21 -0000 1.5 --- sniffer.py 15 Mar 2003 01:15:03 -0000 1.6 *************** *** 214,219 **** Strips parens from item prior to calling eval in an attempt to make it safer """ ! item = item.replace('(', '').replace(')', '') ! return eval(item) reader = csv.reader(fileObj, --- 214,218 ---- Strips parens from item prior to calling eval in an attempt to make it safer """ ! return eval(item.replace('(', '').replace(')', '')) reader = csv.reader(fileObj, *************** *** 227,234 **** columnTypes = {} for i in range(columns): columnTypes[i] = None ! for row in reader: if len(row) != columns: continue # skip rows that have irregular number of columns for col in columnTypes.keys(): try: --- 226,239 ---- columnTypes = {} for i in range(columns): columnTypes[i] = None ! ! checked = 0 for row in reader: + if checked > 20: # arbitrary number of rows to check, to keep it sane + break + checked += 1 + if len(row) != columns: continue # skip rows that have irregular number of columns + for col in columnTypes.keys(): try: From gvanrossum@users.sourceforge.net Sat Mar 15 12:01:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 15 Mar 2003 04:01:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_time.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28372 Modified Files: test_time.py Log Message: If time.tzset doesn't exist, don't test it. Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_time.py 14 Mar 2003 21:51:33 -0000 1.12 --- test_time.py 15 Mar 2003 12:01:52 -0000 1.13 *************** *** 54,57 **** --- 54,60 ---- def test_tzset(self): + if not hasattr(time, "tzset"): + return # Can't test this; don't want the test suite to fail + from os import environ From gvanrossum@users.sourceforge.net Sat Mar 15 12:25:02 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 15 Mar 2003 04:25:02 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1863 Modified Files: timeit.py Log Message: Change the default number of repetitions to 3, both in the Timer class (from 10) and in main() (from 1). Add a -v option that shows the raw times. Repeating it cranks up the display precision. Always use the "best of N" form of output. Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** timeit.py 14 Mar 2003 17:21:00 -0000 1.7 --- timeit.py 15 Mar 2003 12:25:00 -0000 1.8 *************** *** 12,19 **** Options: -n/--number N: how many times to execute 'statement' (default: see below) ! -r/--repeat N: how many times to repeat the timer (default 1) -s/--setup S: statement to be executed once initially (default 'pass') -t/--time: use time.time() (default on Unix) -c/--clock: use time.clock() (default on Windows) -h/--help: print this usage message and exit statement: statement to be timed (default 'pass') --- 12,20 ---- Options: -n/--number N: how many times to execute 'statement' (default: see below) ! -r/--repeat N: how many times to repeat the timer (default 3) -s/--setup S: statement to be executed once initially (default 'pass') -t/--time: use time.time() (default on Unix) -c/--clock: use time.clock() (default on Windows) + -v/--verbose: print raw timing results; repeat for more digits precision -h/--help: print this usage message and exit statement: statement to be timed (default 'pass') *************** *** 34,39 **** other processes running on the same computer may interfere with the timing. The best thing to do when accurate timing is necessary is to ! repeat the timing a few times and use the best time; the -r option is ! good for this. On Unix, you can use clock() to measure CPU time. Note: there is a certain baseline overhead associated with executing a --- 35,41 ---- other processes running on the same computer may interfere with the timing. The best thing to do when accurate timing is necessary is to ! repeat the timing a few times and use the best time. The -r option is ! good for this; the default of 3 repetitions is probably enough in most ! cases. On Unix, you can use clock() to measure CPU time. Note: there is a certain baseline overhead associated with executing a *************** *** 61,65 **** dummy_src_name = "" default_number = 1000000 ! default_repeat = 10 if sys.platform == "win32": --- 63,67 ---- dummy_src_name = "" default_number = 1000000 ! default_repeat = 3 if sys.platform == "win32": *************** *** 160,164 **** This is a convenience function that calls the timer() repeatedly, returning a list of results. The first argument ! specifies how many times to call timer(), defaulting to 10; the second argument specifies the timer argument, defaulting to one million. --- 162,166 ---- This is a convenience function that calls the timer() repeatedly, returning a list of results. The first argument ! specifies how many times to call timer(), defaulting to 3; the second argument specifies the timer argument, defaulting to one million. *************** *** 198,204 **** import getopt try: ! opts, args = getopt.getopt(args, "n:s:r:tch", ["number=", "setup=", "repeat=", ! "time", "clock", "help"]) except getopt.error, err: print err --- 200,206 ---- import getopt try: ! opts, args = getopt.getopt(args, "n:s:r:tcvh", ["number=", "setup=", "repeat=", ! "time", "clock", "verbose", "help"]) except getopt.error, err: print err *************** *** 209,213 **** number = 0 # auto-determine setup = [] ! repeat = 1 for o, a in opts: if o in ("-n", "--number"): --- 211,217 ---- number = 0 # auto-determine setup = [] ! repeat = default_repeat ! verbose = 0 ! precision = 3 for o, a in opts: if o in ("-n", "--number"): *************** *** 223,226 **** --- 227,234 ---- if o in ("-c", "--clock"): timer = time.clock + if o in ("-v", "--verbose"): + if verbose: + precision += 1 + verbose += 1 if o in ("-h", "--help"): print __doc__, *************** *** 237,240 **** --- 245,250 ---- t.print_exc() return 1 + if verbose: + print "%d loops -> %.*g secs" % (number, precision, x) if x >= 0.2: break *************** *** 245,254 **** return 1 best = min(r) print "%d loops," % number, usec = best * 1e6 / number ! if repeat > 1: ! print "best of %d: %.3f usec per loop" % (repeat, usec) ! else: ! print "time: %.3f usec per loop" % usec return None --- 255,263 ---- return 1 best = min(r) + if verbose: + print "raw times:", " ".join(["%.*g" % (precision, x) for x in r]) print "%d loops," % number, usec = best * 1e6 / number ! print "best of %d: %.*g usec per loop" % (repeat, precision, usec) return None From rhettinger@users.sourceforge.net Sun Mar 16 03:11:07 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 15 Mar 2003 19:11:07 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.354,2.355 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv12161 Modified Files: ceval.c Log Message: Introduced macros for a simple opcode prediction protocol. Applied to common cases: COMPARE_OP is often followed by a JUMP_IF. JUMP_IF is usually followed by POP_TOP. Shows improved timings on PyStone, PyBench, and specific tests using timeit.py: python timeit.py -s "x=1" "if x==1: pass" python timeit.py -s "x=1" "if x==2: pass" python timeit.py -s "x=1" "if x: pass" python timeit.py -s "x=100" "while x!=1: x-=1" Potential future candidates: GET_ITER predicts FOR_ITER FOR_ITER predicts STORE_FAST or UNPACK_SEQUENCE Also, applied missing goto fast_next_opcode to DUP_TOPX. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.354 retrieving revision 2.355 diff -C2 -d -r2.354 -r2.355 *** ceval.c 14 Mar 2003 01:37:42 -0000 2.354 --- ceval.c 16 Mar 2003 03:11:04 -0000 2.355 *************** *** 603,606 **** --- 603,626 ---- #define JUMPBY(x) (next_instr += (x)) + /* OpCode prediction macros + Some opcodes tend to come in pairs thus making it possible to predict + the second code when the first is run. For example, COMPARE_OP is often + followed by JUMP_IF_FALSE or JUMP_IF_TRUE. And, those opcodes are often + followed by a POP_TOP. + + Verifying the prediction costs a single high-speed test of register + variable against a constant. If the pairing was good, then the odds + processor has a high likelihood of making its own successful branch + prediction which results in a nearly zero overhead transition to the + next opcode. + + A successful prediction saves a trip through the eval-loop including + its two unpredictable branches, the HASARG test and the switch-case. + */ + + #define PREDICT(op) if (*next_instr == op) goto PRED_##op + #define PREDICTED(op) PRED_##op: next_instr++ + #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr += 3, (next_instr[-1]<<8) + next_instr[-2]) + /* Stack manipulation macros */ *************** *** 874,877 **** --- 894,898 ---- goto fast_next_opcode; + PREDICTED(POP_TOP); case POP_TOP: v = POP(); *************** *** 921,925 **** SET_TOP(x); SET_SECOND(w); ! continue; } else if (oparg == 3) { x = TOP(); --- 942,946 ---- SET_TOP(x); SET_SECOND(w); ! goto fast_next_opcode; } else if (oparg == 3) { x = TOP(); *************** *** 933,937 **** SET_SECOND(w); SET_THIRD(v); ! continue; } Py_FatalError("invalid argument to DUP_TOPX" --- 954,958 ---- SET_SECOND(w); SET_THIRD(v); ! goto fast_next_opcode; } Py_FatalError("invalid argument to DUP_TOPX" *************** *** 1919,1924 **** Py_DECREF(w); SET_TOP(x); ! if (x != NULL) continue; ! break; case IMPORT_NAME: --- 1940,1947 ---- Py_DECREF(w); SET_TOP(x); ! if (x == NULL) break; ! PREDICT(JUMP_IF_FALSE); ! PREDICT(JUMP_IF_TRUE); ! continue; case IMPORT_NAME: *************** *** 1975,1982 **** goto fast_next_opcode; case JUMP_IF_FALSE: w = TOP(); ! if (w == Py_True) goto fast_next_opcode; if (w == Py_False) { JUMPBY(oparg); --- 1998,2008 ---- goto fast_next_opcode; + PREDICTED_WITH_ARG(JUMP_IF_FALSE); case JUMP_IF_FALSE: w = TOP(); ! if (w == Py_True) { ! PREDICT(POP_TOP); goto fast_next_opcode; + } if (w == Py_False) { JUMPBY(oparg); *************** *** 1992,1999 **** continue; case JUMP_IF_TRUE: w = TOP(); ! if (w == Py_False) goto fast_next_opcode; if (w == Py_True) { JUMPBY(oparg); --- 2018,2028 ---- continue; + PREDICTED_WITH_ARG(JUMP_IF_TRUE); case JUMP_IF_TRUE: w = TOP(); ! if (w == Py_False) { ! PREDICT(POP_TOP); goto fast_next_opcode; + } if (w == Py_True) { JUMPBY(oparg); From rhettinger@users.sourceforge.net Sun Mar 16 15:41:17 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 16 Mar 2003 07:41:17 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.355,2.356 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv11890 Modified Files: ceval.c Log Message: Fix comment and whitespace. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.355 retrieving revision 2.356 diff -C2 -d -r2.355 -r2.356 *** ceval.c 16 Mar 2003 03:11:04 -0000 2.355 --- ceval.c 16 Mar 2003 15:41:11 -0000 2.356 *************** *** 610,614 **** Verifying the prediction costs a single high-speed test of register ! variable against a constant. If the pairing was good, then the odds processor has a high likelihood of making its own successful branch prediction which results in a nearly zero overhead transition to the --- 610,614 ---- Verifying the prediction costs a single high-speed test of register ! variable against a constant. If the pairing was good, then the processor has a high likelihood of making its own successful branch prediction which results in a nearly zero overhead transition to the *************** *** 619,625 **** */ ! #define PREDICT(op) if (*next_instr == op) goto PRED_##op #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr += 3, (next_instr[-1]<<8) + next_instr[-2]) /* Stack manipulation macros */ --- 619,626 ---- */ ! #define PREDICT(op) if (*next_instr == op) goto PRED_##op #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr += 3, \ ! (next_instr[-1]<<8) + next_instr[-2]) /* Stack manipulation macros */ From rhettinger@users.sourceforge.net Sun Mar 16 20:14:47 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 16 Mar 2003 12:14:47 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.356,2.357 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27026 Modified Files: ceval.c Log Message: Eliminate data dependency in predict macro. Added two predictions: GET_ITER --> FOR_ITER FOR_ITER --> STORE_FAST or UNPACK_SEQUENCE Improves timings on pybench and timeit.py. Pystone results are neutral. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.356 retrieving revision 2.357 diff -C2 -d -r2.356 -r2.357 *** ceval.c 16 Mar 2003 15:41:11 -0000 2.356 --- ceval.c 16 Mar 2003 20:14:44 -0000 2.357 *************** *** 621,626 **** #define PREDICT(op) if (*next_instr == op) goto PRED_##op #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr += 3, \ ! (next_instr[-1]<<8) + next_instr[-2]) /* Stack manipulation macros */ --- 621,626 ---- #define PREDICT(op) if (*next_instr == op) goto PRED_##op #define PREDICTED(op) PRED_##op: next_instr++ ! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr[2]<<8) + \ ! next_instr[1]; next_instr += 3 /* Stack manipulation macros */ *************** *** 890,893 **** --- 890,894 ---- goto fast_next_opcode; + PREDICTED_WITH_ARG(STORE_FAST); case STORE_FAST: v = POP(); *************** *** 1676,1679 **** --- 1677,1681 ---- break; + PREDICTED_WITH_ARG(UNPACK_SEQUENCE); case UNPACK_SEQUENCE: v = POP(); *************** *** 2052,2055 **** --- 2054,2058 ---- if (x != NULL) { SET_TOP(x); + PREDICT(FOR_ITER); continue; } *************** *** 2057,2060 **** --- 2060,2064 ---- break; + PREDICTED_WITH_ARG(FOR_ITER); case FOR_ITER: /* before: [iter]; after: [iter, iter()] *or* [] */ *************** *** 2063,2066 **** --- 2067,2072 ---- if (x != NULL) { PUSH(x); + PREDICT(STORE_FAST); + PREDICT(UNPACK_SEQUENCE); continue; } From jackjansen@users.sourceforge.net Sun Mar 16 20:42:02 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 16 Mar 2003 12:42:02 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial index.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv6940 Modified Files: index.html Log Message: Lots of textual changes suggested by Matthew Moelter. Index: index.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.html 11 Mar 2003 22:59:17 -0000 1.1 --- index.html 16 Mar 2003 20:41:58 -0000 1.2 *************** *** 14,18 ****

This document gives a very basic introduction to the ! MacPython Integrated Development Environment on Mac OS. It was written specifically for MacPython 2.3 on Mac OS X, but most of it is applicable to MacPython-OS9 too. It is based on --- 14,18 ----

This document gives a very basic introduction to the ! MacPython Integrated Development Environment (IDE) on Mac OS. It was written specifically for MacPython 2.3 on Mac OS X, but most of it is applicable to MacPython-OS9 too. It is based on *************** *** 48,52 ****

This is the interactive window to the IDE, it allows us to enter commands directly into Python, and as soon as we enter a command, ! Python will execute it and spit out its result back to us. We'll be using this interactive window a lot when we're exploring Python: it's very nice because we get back our results immediately. If it helps, --- 48,52 ----

This is the interactive window to the IDE, it allows us to enter commands directly into Python, and as soon as we enter a command, ! Python will execute it and spit its result back to us. We'll be using this interactive window a lot when we're exploring Python: it's very nice because we get back our results immediately. If it helps, *************** *** 87,91 **** the computer to remember what we typed?

!

The solution is a little subtle: we can't directly save what's on the interpreter window, because it will include both our commands and the system's responses. What we'd like is to make a prepared file, --- 87,91 ---- the computer to remember what we typed?

!

The solution is a little subtle: we can't directly save what's in the interpreter window, because it will include both our commands and the system's responses. What we'd like is to make a prepared file, *************** *** 114,118 ****

What we wanted to do before was save some of the stuff we had tried out on the interpreter window. Let's do that by typing (or ! copy/pasting) those commands into our Program window.

--- 114,118 ----

What we wanted to do before was save some of the stuff we had tried out on the interpreter window. Let's do that by typing (or ! copy/pasting) those commands into our edit window.

*************** *** 120,124 **** One big thing to notice is that we're careful to get rid of the ">>>" ! prompts because there's not really part of our program. The interpreter uses them just to tell us that we're in the interpreter, but now that we're editing in a separate file, we can remove the --- 120,124 ---- One big thing to notice is that we're careful to get rid of the ">>>" ! prompts because they're not really part of our program. The interpreter uses them just to tell us that we're in the interpreter, but now that we're editing in a separate file, we can remove the *************** *** 130,134 ****

!

Let's save the file now. The Save command is located under the File menu:

--- 130,134 ----

!

Let's save the file now. The Save command is located under the File menu:

*************** *** 156,165 ****

Python is often perceptive enough to direct us toward the problem, and in this case, it's telling us that we forgot to put something at ! the end of this line. In this case, we need to add an additional ! quotation mark. Let's add that in now.

Other errors, which usually occur later, when your program has already done something, result in a different dialog that allows you ! to look at variables and such in addition to only showing you where the error occurred.

--- 156,165 ----

Python is often perceptive enough to direct us toward the problem, and in this case, it's telling us that we forgot to put something at ! the end of this line. In this case, we need to add a ! quotation mark at the end. Let's add that in now.

Other errors, which usually occur later, when your program has already done something, result in a different dialog that allows you ! to look at variables and such in addition to showing you where the error occurred.

*************** *** 174,180 ****

As we play with Python, we'll find ourselves "switching modes" ! between the Interpreter window and the Program window. However, if we try anything more complicated than two or three lines it ! is often a good idea to work in an edit window, and align your edit and output window such that you can see them at the same time.

--- 174,180 ----

As we play with Python, we'll find ourselves "switching modes" ! between the Interpreter window and the edit window. However, if we try anything more complicated than two or three lines it ! is often a good idea to work in an edit window. Align your edit and output window such that you can see them at the same time.

*************** *** 185,192 ****
  • All sorts of edit commands such as find and replace can be ! used in the editor windows. See the edit menu.
  • The bottom of the edit window has the scrollbar, but at the ! left are two navigation devices: a line number box that you can also type numbers into to quickly go to a specific place, and a popup menu that lists all classes, functions and methods in your file.
  • --- 185,192 ----
    • All sorts of edit commands such as find and replace can be ! used in the editor windows. See the Edit menu.
    • The bottom of the edit window has the scrollbar, but at the ! left are two navigation devices: a line number box that you can type numbers into to quickly go to a specific place, and a popup menu that lists all classes, functions and methods in your file.
    • From jackjansen@users.sourceforge.net Sun Mar 16 21:04:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 16 Mar 2003 13:04:55 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv15759 Modified Files: PackageManager.py Log Message: - Don't ask for bring-to-front when quitting through an appleevent. - Changed checkbox labels as suggested by Kevin Ollivier. Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PackageManager.py 28 Feb 2003 15:19:51 -0000 1.4 --- PackageManager.py 16 Mar 2003 21:04:50 -0000 1.5 *************** *** 111,116 **** def quitevent(self, theAppleEvent, theReply): - from Carbon import AE - AE.AEInteractWithUser(50000000) self._quit() --- 111,114 ---- *************** *** 273,277 **** def setupwidgets(self): ! self.w = W.Window((580, 400), "Python Install Manager", minsize = (300, 200), tabbable = 0) ## self.w.divline = W.HorizontalLine((0, 20, 0, 0)) self.w.titlebar = W.TextBox((4, 4, 40, 12), 'Packages:') --- 271,275 ---- def setupwidgets(self): ! self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0) ## self.w.divline = W.HorizontalLine((0, 20, 0, 0)) self.w.titlebar = W.TextBox((4, 4, 40, 12), 'Packages:') *************** *** 283,290 **** self.w.message = W.TextBox((64, -48, 0, 12), '') self.w.homepage_button = W.Button((4, -28, 96, 18), 'View homepage', self.do_homepage) ! self.w.verbose_button = W.CheckBox((-288, -26, 60, 18), 'Verbose') ! self.w.recursive_button = W.CheckBox((-224, -26, 80, 18), 'Recursive', self.updatestatus) self.w.recursive_button.set(1) ! self.w.force_button = W.CheckBox((-140, -26, 60, 18), 'Force', self.updatestatus) self.w.install_button = W.Button((-76, -28, 56, 18), 'Install', self.do_install) self.w.open() --- 281,288 ---- self.w.message = W.TextBox((64, -48, 0, 12), '') self.w.homepage_button = W.Button((4, -28, 96, 18), 'View homepage', self.do_homepage) ! self.w.verbose_button = W.CheckBox((-358, -26, 60, 18), 'Verbose') ! self.w.recursive_button = W.CheckBox((-284, -26, 140, 18), 'Install dependencies', self.updatestatus) self.w.recursive_button.set(1) ! self.w.force_button = W.CheckBox((-160, -26, 80, 18), 'Overwrite', self.updatestatus) self.w.install_button = W.Button((-76, -28, 56, 18), 'Install', self.do_install) self.w.open() From jackjansen@users.sourceforge.net Sun Mar 16 22:09:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 16 Mar 2003 14:09:24 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv9930/Mac/Tools/IDE Modified Files: PythonIDEMain.py Log Message: The MacPython introductory help is now called MacPython Help, and the optional full documentation Python Documentation. Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** PythonIDEMain.py 3 Mar 2003 12:28:04 -0000 1.31 --- PythonIDEMain.py 16 Mar 2003 22:09:21 -0000 1.32 *************** *** 354,363 **** def makehelpmenu(self): ! docs = self.installdocumentation() self.helpmenu = m = self.gethelpmenu() docitem = FrameWork.MenuItem(m, "Python Documentation", None, self.domenu_localdocs) ! docitem.enable(docs) finditem = FrameWork.MenuItem(m, "Lookup in Python Documentation", None, 'lookuppython') ! finditem.enable(docs) if runningOnOSX(): FrameWork.Separator(m) --- 354,365 ---- def makehelpmenu(self): ! hashelp, hasdocs = self.installdocumentation() self.helpmenu = m = self.gethelpmenu() + helpitem = FrameWork.MenuItem(m, "MacPython Help", None, self.domenu_localhelp) + helpitem.enable(hashelp) docitem = FrameWork.MenuItem(m, "Python Documentation", None, self.domenu_localdocs) ! docitem.enable(hasdocs) finditem = FrameWork.MenuItem(m, "Lookup in Python Documentation", None, 'lookuppython') ! finditem.enable(hasdocs) if runningOnOSX(): FrameWork.Separator(m) *************** *** 371,375 **** def domenu_localdocs(self, *args): from Carbon import AH ! AH.AHGotoPage("Python Help", None, None) def domenu_appledocs(self, *args): --- 373,381 ---- def domenu_localdocs(self, *args): from Carbon import AH ! AH.AHGotoPage("Python Documentation", None, None) ! ! def domenu_localhelp(self, *args): ! from Carbon import AH ! AH.AHGotoPage("MacPython Help", None, None) def domenu_appledocs(self, *args): *************** *** 389,393 **** return try: ! AH.AHSearch("Python Help", searchstring) except AH.Error, arg: W.Message("AppleHelp Error: %s" % `arg`) --- 395,399 ---- return try: ! AH.AHSearch("Python Documentation", searchstring) except AH.Error, arg: W.Message("AppleHelp Error: %s" % `arg`) *************** *** 442,455 **** # the plist file) we refer it to Python.app python_app = os.path.join(sys.prefix, 'Resources/Python.app') ! doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation') ! if not os.path.isdir(doc_source): ! return 0 ! try: ! from Carbon import AH ! AH.AHRegisterHelpBook(python_app) ! except (ImportError, MacOS.Error), arg: ! W.Message("Cannot register Python documentation: %s" % `arg`) ! return 0 ! return 1 --- 448,462 ---- # the plist file) we refer it to Python.app python_app = os.path.join(sys.prefix, 'Resources/Python.app') ! help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation') ! doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/PythonDocumentation') ! has_help = os.path.isdir(help_source) ! has_doc = os.path.isdir(doc_source) ! if has_help or has_doc: ! try: ! from Carbon import AH ! AH.AHRegisterHelpBook(python_app) ! except (ImportError, MacOS.Error), arg: ! pass # W.Message("Cannot register Python Documentation: %s" % str(arg)) ! return has_help, has_doc From jackjansen@users.sourceforge.net Sun Mar 16 22:09:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 16 Mar 2003 14:09:24 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app Info.plist,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app In directory sc8-pr-cvs1:/tmp/cvs-serv9930/Mac/OSXResources/app Modified Files: Info.plist Log Message: The MacPython introductory help is now called MacPython Help, and the optional full documentation Python Documentation. Index: Info.plist =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Info.plist,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Info.plist 5 Mar 2003 16:13:19 -0000 1.9 --- Info.plist 16 Mar 2003 22:09:22 -0000 1.10 *************** *** 33,39 **** Documentation CFBundleHelpBookName ! Python Help CFBundleHelpTOCFile index.html --- 33,40 ---- Documentation + PythonDocumentation CFBundleHelpBookName ! MacPython Help CFBundleHelpTOCFile index.html From jackjansen@users.sourceforge.net Sun Mar 16 22:09:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 16 Mar 2003 14:09:24 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation index.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv9930/Mac/OSXResources/app/Resources/English.lproj/Documentation Modified Files: index.html Log Message: The MacPython introductory help is now called MacPython Help, and the optional full documentation Python Documentation. Index: index.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.html 11 Mar 2003 22:59:16 -0000 1.1 --- index.html 16 Mar 2003 22:09:22 -0000 1.2 *************** *** 8,12 **** ! --- 8,12 ---- ! From jackjansen@users.sourceforge.net Sun Mar 16 22:09:25 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 16 Mar 2003 14:09:25 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Doc setup.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv9930/Mac/OSX/Doc Modified Files: setup.py Log Message: The MacPython introductory help is now called MacPython Help, and the optional full documentation Python Documentation. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Doc/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 14 Feb 2003 23:46:22 -0000 1.1 --- setup.py 16 Mar 2003 22:09:22 -0000 1.2 *************** *** 33,37 **** self.build_dest = None self.download = 1 ! self.doc_version = '2.2.1' def finalize_options(self): --- 33,37 ---- self.build_dest = None self.download = 1 ! self.doc_version = '2.2.2' def finalize_options(self): *************** *** 47,57 **** def downloadDocs(self): workdir = os.getcwd() ! self.mkpath(self.build_html) os.chdir(self.build_base) ! self.spawn('curl','-O', 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % (self.doc_version,self.doc_version)) ! os.chdir(workdir) ! os.chdir(self.build_html) ! self.spawn('tar', '-xzf', '../html-%s.tgz' % self.doc_version) os.chdir(workdir) def buildDocsFromSource(self): --- 47,64 ---- def downloadDocs(self): workdir = os.getcwd() ! url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % \ ! (self.doc_version,self.doc_version) os.chdir(self.build_base) ! self.spawn('curl','-O', url) os.chdir(workdir) + tarfile = 'html-%s.tgz' % self.doc_version + ## This no longer works due to name changes + ## self.mkpath(self.build_html) + ## os.chdir(self.build_html) + ## self.spawn('tar', '-xzf', '../' + tarfile) + ## os.chdir(workdir) + print "** Please unpack %s" % os.path.join(self.build_base, tarfile) + print "** Unpack the files into %s" % self.build_html + raise RuntimeError, "You need to unpack the docs manually" def buildDocsFromSource(self): *************** *** 76,80 **** origIndex = file(os.path.join(self.build_html,ind_html)) r = re.compile('', re.DOTALL) ! hackedIndex.write(r.sub('',origIndex.read())) def hackFile(self,d,f): --- 83,87 ---- origIndex = file(os.path.join(self.build_html,ind_html)) r = re.compile('', re.DOTALL) ! hackedIndex.write(r.sub('',origIndex.read())) def hackFile(self,d,f): *************** *** 108,111 **** --- 115,119 ---- def run(self): self.ensure_finalized() + self.mkpath(self.build_base) self.ensureHtml() if not os.path.isdir(self.build_html): *************** *** 143,147 **** self.build_dest = build_cmd.build_dest if self.install_doc == None: ! self.install_doc = os.path.join(self.prefix, 'Resources/English.lproj/Documentation') print 'INSTALL', self.build_dest, '->', self.install_doc --- 151,155 ---- self.build_dest = build_cmd.build_dest if self.install_doc == None: ! self.install_doc = os.path.join(self.prefix, 'Resources/Python.app/Contents/Resources/English.lproj/PythonDocumentation') print 'INSTALL', self.build_dest, '->', self.install_doc From rhettinger@users.sourceforge.net Mon Mar 17 08:22:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 00:22:58 -0800 Subject: [Python-checkins] python/dist/src/Include object.h,2.113,2.114 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv29413/Include Modified Files: object.h Log Message: Created PyObject_GenericGetIter(). Factors out the common case of returning self. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.113 retrieving revision 2.114 diff -C2 -d -r2.113 -r2.114 *** object.h 7 Mar 2003 15:13:16 -0000 2.113 --- object.h 17 Mar 2003 08:22:55 -0000 2.114 *************** *** 386,389 **** --- 386,390 ---- PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); + PyAPI_FUNC(PyObject *) PyObject_GenericGetIter(PyObject *); PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, From rhettinger@users.sourceforge.net Mon Mar 17 08:22:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 00:22:59 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.199,2.200 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv29413/Objects Modified Files: object.c Log Message: Created PyObject_GenericGetIter(). Factors out the common case of returning self. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -d -r2.199 -r2.200 *** object.c 19 Feb 2003 03:19:29 -0000 2.199 --- object.c 17 Mar 2003 08:22:56 -0000 2.200 *************** *** 1302,1305 **** --- 1302,1312 ---- PyObject * + PyObject_GenericGetIter(PyObject *obj) + { + Py_INCREF(obj); + return obj; + } + + PyObject * PyObject_GenericGetAttr(PyObject *obj, PyObject *name) { From rhettinger@users.sourceforge.net Mon Mar 17 08:23:00 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 00:23:00 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.696,1.697 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29413/Misc Modified Files: NEWS Log Message: Created PyObject_GenericGetIter(). Factors out the common case of returning self. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.696 retrieving revision 1.697 diff -C2 -d -r1.696 -r1.697 *** NEWS 14 Mar 2003 21:51:35 -0000 1.696 --- NEWS 17 Mar 2003 08:22:57 -0000 1.697 *************** *** 87,90 **** --- 87,93 ---- ----- + - Added PyObject_GenericGetIter() to fill the tp_iter slot for the + typical case where the method returns its self argument. + - The extended type structure used for heap types (new-style classes defined by Python code using a class statement) is now From rhettinger@users.sourceforge.net Mon Mar 17 08:22:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 00:22:59 -0800 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29413/Modules Modified Files: itertoolsmodule.c Log Message: Created PyObject_GenericGetIter(). Factors out the common case of returning self. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** itertoolsmodule.c 1 Mar 2003 01:48:24 -0000 1.7 --- itertoolsmodule.c 17 Mar 2003 08:22:57 -0000 1.8 *************** *** 106,116 **** } - static PyObject * - cycle_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(cycle_doc, "cycle(iterable) --> cycle object\n\ --- 106,109 ---- *************** *** 148,152 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)cycle_getiter, /* tp_iter */ (iternextfunc)cycle_next, /* tp_iternext */ 0, /* tp_methods */ --- 141,145 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)cycle_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 262,272 **** } - static PyObject * - dropwhile_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(dropwhile_doc, "dropwhile(predicate, iterable) --> dropwhile object\n\ --- 255,258 ---- *************** *** 304,308 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)dropwhile_getiter, /* tp_iter */ (iternextfunc)dropwhile_next, /* tp_iternext */ 0, /* tp_methods */ --- 290,294 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)dropwhile_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 417,427 **** } - static PyObject * - takewhile_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(takewhile_doc, "takewhile(predicate, iterable) --> takewhile object\n\ --- 403,406 ---- *************** *** 459,463 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)takewhile_getiter, /* tp_iter */ (iternextfunc)takewhile_next, /* tp_iternext */ 0, /* tp_methods */ --- 438,442 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)takewhile_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 590,600 **** } - static PyObject * - islice_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(islice_doc, "islice(iterable, [start,] stop [, step]) --> islice object\n\ --- 569,572 ---- *************** *** 636,640 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)islice_getiter, /* tp_iter */ (iternextfunc)islice_next, /* tp_iternext */ 0, /* tp_methods */ --- 608,612 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)islice_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 740,750 **** } - static PyObject * - starmap_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(starmap_doc, "starmap(function, sequence) --> starmap object\n\ --- 712,715 ---- *************** *** 782,786 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)starmap_getiter, /* tp_iter */ (iternextfunc)starmap_next, /* tp_iternext */ 0, /* tp_methods */ --- 747,751 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)starmap_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 931,941 **** } - static PyObject * - imap_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(imap_doc, "imap(func, *iterables) --> imap object\n\ --- 896,899 ---- *************** *** 976,980 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)imap_getiter, /* tp_iter */ (iternextfunc)imap_next, /* tp_iternext */ 0, /* tp_methods */ --- 934,938 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)imap_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1075,1085 **** } - static PyObject * - chain_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(chain_doc, "chain(*iterables) --> chain object\n\ --- 1033,1036 ---- *************** *** 1118,1122 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)chain_getiter, /* tp_iter */ (iternextfunc)chain_next, /* tp_iternext */ 0, /* tp_methods */ --- 1069,1073 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)chain_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1232,1242 **** } - static PyObject * - ifilter_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(ifilter_doc, "ifilter(function or None, sequence) --> ifilter object\n\ --- 1183,1186 ---- *************** *** 1274,1278 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)ifilter_getiter, /* tp_iter */ (iternextfunc)ifilter_next, /* tp_iternext */ 0, /* tp_methods */ --- 1218,1222 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)ifilter_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1388,1398 **** } - static PyObject * - ifilterfalse_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(ifilterfalse_doc, "ifilterfalse(function or None, sequence) --> ifilterfalse object\n\ --- 1332,1335 ---- *************** *** 1430,1434 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)ifilterfalse_getiter, /* tp_iter */ (iternextfunc)ifilterfalse_next, /* tp_iternext */ 0, /* tp_methods */ --- 1367,1371 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)ifilterfalse_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1480,1490 **** } - static PyObject * - count_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(count_doc, "count([firstval]) --> count object\n\ --- 1417,1420 ---- *************** *** 1521,1525 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)count_getiter, /* tp_iter */ (iternextfunc)count_next, /* tp_iternext */ 0, /* tp_methods */ --- 1451,1455 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)count_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1666,1676 **** } - static PyObject * - izip_getiter(PyObject *lz) - { - Py_INCREF(lz); - return lz; - } - PyDoc_STRVAR(izip_doc, "izip(iter1 [,iter2 [...]]) --> izip object\n\ --- 1596,1599 ---- *************** *** 1712,1716 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)izip_getiter, /* tp_iter */ (iternextfunc)izip_next, /* tp_iternext */ 0, /* tp_methods */ --- 1635,1639 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)izip_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1785,1795 **** } - static PyObject * - repeat_getiter(PyObject *ro) - { - Py_INCREF(ro); - return ro; - } - PyDoc_STRVAR(repeat_doc, "repeat(element [,times]) -> create an iterator which returns the element\n\ --- 1708,1711 ---- *************** *** 1826,1830 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)repeat_getiter, /* tp_iter */ (iternextfunc)repeat_next, /* tp_iternext */ 0, /* tp_methods */ --- 1742,1746 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)repeat_next, /* tp_iternext */ 0, /* tp_methods */ From rhettinger@users.sourceforge.net Mon Mar 17 08:24:37 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 00:24:37 -0800 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.141,2.142 enumobject.c,1.3,1.4 iterobject.c,1.13,1.14 listobject.c,2.145,2.146 rangeobject.c,2.46,2.47 tupleobject.c,2.76,2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31085 Modified Files: dictobject.c enumobject.c iterobject.c listobject.c rangeobject.c tupleobject.c Log Message: Created PyObject_GenericGetIter(). Factors out the common case of returning self. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.141 retrieving revision 2.142 diff -C2 -d -r2.141 -r2.142 *** dictobject.c 6 Mar 2003 23:54:28 -0000 2.141 --- dictobject.c 17 Mar 2003 08:24:34 -0000 2.142 *************** *** 2014,2024 **** } - static PyObject * - dictiter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - static PyObject *dictiter_iternext(dictiterobject *di) { --- 2014,2017 ---- *************** *** 2070,2074 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)dictiter_getiter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 2063,2067 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ 0, /* tp_methods */ Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** enumobject.c 16 Jul 2002 21:02:42 -0000 1.3 --- enumobject.c 17 Mar 2003 08:24:34 -0000 1.4 *************** *** 79,89 **** } - static PyObject * - enum_getiter(PyObject *en) - { - Py_INCREF(en); - return en; - } - PyDoc_STRVAR(enum_doc, "enumerate(iterable) -> create an enumerating-iterator"); --- 79,82 ---- *************** *** 118,122 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)enum_getiter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ 0, /* tp_methods */ --- 111,115 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ 0, /* tp_methods */ Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iterobject.c 16 Aug 2002 17:01:08 -0000 1.13 --- iterobject.c 17 Mar 2003 08:24:34 -0000 1.14 *************** *** 45,55 **** static PyObject * - iter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - - static PyObject * iter_iternext(PyObject *iterator) { --- 45,48 ---- *************** *** 107,111 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 100,104 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ 0, /* tp_methods */ *************** *** 224,228 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 217,221 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ 0, /* tp_methods */ Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.145 retrieving revision 2.146 diff -C2 -d -r2.145 -r2.146 *** listobject.c 2 Jan 2003 20:51:08 -0000 2.145 --- listobject.c 17 Mar 2003 08:24:34 -0000 2.146 *************** *** 2399,2410 **** } - - static PyObject * - listiter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - static PyObject * listiter_next(listiterobject *it) --- 2399,2402 ---- *************** *** 2459,2463 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)listiter_getiter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ 0, /* tp_methods */ --- 2451,2455 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ 0, /* tp_methods */ Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -d -r2.46 -r2.47 *** rangeobject.c 11 Dec 2002 07:14:02 -0000 2.46 --- rangeobject.c 17 Mar 2003 08:24:34 -0000 2.47 *************** *** 247,257 **** static PyObject * - rangeiter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - - static PyObject * rangeiter_next(rangeiterobject *r) { --- 247,250 ---- *************** *** 289,293 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)rangeiter_getiter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ 0, /* tp_methods */ --- 282,286 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ 0, /* tp_methods */ Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -d -r2.76 -r2.77 *** tupleobject.c 29 Jan 2003 17:58:45 -0000 2.76 --- tupleobject.c 17 Mar 2003 08:24:35 -0000 2.77 *************** *** 780,791 **** } - - static PyObject * - tupleiter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - static PyObject * tupleiter_next(tupleiterobject *it) --- 780,783 ---- *************** *** 840,844 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)tupleiter_getiter, /* tp_iter */ (iternextfunc)tupleiter_next, /* tp_iternext */ }; --- 832,836 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)tupleiter_next, /* tp_iternext */ }; From rhettinger@users.sourceforge.net Mon Mar 17 08:35:54 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 00:35:54 -0800 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.32,1.33 arraymodule.c,2.84,2.85 xreadlinesmodule.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv4768 Modified Files: _hotshot.c arraymodule.c xreadlinesmodule.c Log Message: Created PyObject_GenericGetIter(). Factors out the common case of returning self. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** _hotshot.c 6 Jan 2003 12:41:25 -0000 1.32 --- _hotshot.c 17 Mar 2003 08:35:49 -0000 1.33 *************** *** 142,152 **** } - static PyObject * - logreader_tp_iter(LogReaderObject *self) - { - Py_INCREF(self); - return (PyObject *) self; - } - /* Log File Format --- 142,145 ---- *************** *** 1353,1357 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)logreader_tp_iter, /* tp_iter */ (iternextfunc)logreader_tp_iternext,/* tp_iternext */ logreader_methods, /* tp_methods */ --- 1346,1350 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)logreader_tp_iternext,/* tp_iternext */ logreader_methods, /* tp_methods */ Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -d -r2.84 -r2.85 *** arraymodule.c 24 Feb 2003 02:08:42 -0000 2.84 --- arraymodule.c 17 Mar 2003 08:35:49 -0000 2.85 *************** *** 1963,1973 **** static PyObject * - arrayiter_getiter(PyObject *it) - { - Py_INCREF(it); - return it; - } - - static PyObject * arrayiter_next(arrayiterobject *it) { --- 1963,1966 ---- *************** *** 2022,2026 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)arrayiter_getiter, /* tp_iter */ (iternextfunc)arrayiter_next, /* tp_iternext */ 0, /* tp_methods */ --- 2015,2019 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)arrayiter_next, /* tp_iternext */ 0, /* tp_methods */ Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** xreadlinesmodule.c 6 Aug 2002 17:14:04 -0000 1.13 --- xreadlinesmodule.c 17 Mar 2003 08:35:49 -0000 1.14 *************** *** 83,93 **** static PyObject * - xreadlines_getiter(PyXReadlinesObject *a) - { - Py_INCREF(a); - return (PyObject *)a; - } - - static PyObject * xreadlines_iternext(PyXReadlinesObject *a) { --- 83,86 ---- *************** *** 160,164 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)xreadlines_getiter, /* tp_iter */ (iternextfunc)xreadlines_iternext, /* tp_iternext */ }; --- 153,157 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)xreadlines_iternext, /* tp_iternext */ }; From jackjansen@users.sourceforge.net Mon Mar 17 10:54:44 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 17 Mar 2003 02:54:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv4420/Lib/plat-mac Modified Files: pimp.py Log Message: Capturing the exit status for the build process didn't work. Using popen2.Popen4() makes it work. Fixes #702180. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pimp.py 11 Mar 2003 14:37:19 -0000 1.13 --- pimp.py 17 Mar 2003 10:54:41 -0000 1.14 *************** *** 15,18 **** --- 15,19 ---- import sys import os + import popen2 import urllib import urllib2 *************** *** 396,409 **** if NO_EXECUTE: return 0 ! dummy, fp = os.popen4(cmd, "r") ! dummy.close() while 1: ! line = fp.readline() if not line: break if output: output.write(line) ! rv = fp.close() ! return rv def downloadPackageOnly(self, output=None): --- 397,409 ---- if NO_EXECUTE: return 0 ! child = popen2.Popen4(cmd) ! child.tochild.close() while 1: ! line = child.fromchild.readline() if not line: break if output: output.write(line) ! return child.wait() def downloadPackageOnly(self, output=None): *************** *** 589,593 **** installcmd = '"%s" setup.py install' % sys.executable if self._cmd(output, self._buildDirname, installcmd): ! return "install %s: running \"%s\" failed" % self.fullname() self.afterInstall() --- 589,594 ---- installcmd = '"%s" setup.py install' % sys.executable if self._cmd(output, self._buildDirname, installcmd): ! return "install %s: running \"%s\" failed" % \ ! (self.fullname(), installcmd) self.afterInstall() From twouters@users.sourceforge.net Mon Mar 17 11:24:32 2003 From: twouters@users.sourceforge.net (twouters@users.sourceforge.net) Date: Mon, 17 Mar 2003 03:24:32 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_binascii.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14143/Lib/test Modified Files: test_binascii.py Log Message: binascii_a2b_base64: Properly return an empty string if the input was all invalid, rather than returning a string of random garbage of the estimated result length. Closes SF patch #703471 by Hye-Shik Chang. Will backport to 2.2-maint (consider it done.) Index: test_binascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_binascii.py 30 Jul 2002 23:26:01 -0000 1.15 --- test_binascii.py 17 Mar 2003 11:24:29 -0000 1.16 *************** *** 70,73 **** --- 70,77 ---- verify(res == testdata) + # Test base64 with just invalid characters, which should return + # empty strings. TBD: shouldn't it raise an exception instead ? + verify(binascii.a2b_base64(fillers) == '') + # Test uu print "uu test" From twouters@users.sourceforge.net Mon Mar 17 11:24:32 2003 From: twouters@users.sourceforge.net (twouters@users.sourceforge.net) Date: Mon, 17 Mar 2003 03:24:32 -0800 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14143/Modules Modified Files: binascii.c Log Message: binascii_a2b_base64: Properly return an empty string if the input was all invalid, rather than returning a string of random garbage of the estimated result length. Closes SF patch #703471 by Hye-Shik Chang. Will backport to 2.2-maint (consider it done.) Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** binascii.c 15 Aug 2002 22:14:24 -0000 2.38 --- binascii.c 17 Mar 2003 11:24:29 -0000 2.39 *************** *** 409,415 **** } ! /* and set string size correctly */ if (bin_len > 0) _PyString_Resize(&rv, bin_len); return rv; } --- 409,422 ---- } ! /* And set string size correctly. If the result string is empty ! ** (because the input was all invalid) return the shared empty ! ** string instead; _PyString_Resize() won't do this for us. ! */ if (bin_len > 0) _PyString_Resize(&rv, bin_len); + else { + Py_DECREF(rv); + rv = PyString_FromString(""); + } return rv; } From twouters@users.sourceforge.net Mon Mar 17 11:34:04 2003 From: twouters@users.sourceforge.net (twouters@users.sourceforge.net) Date: Mon, 17 Mar 2003 03:34:04 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.229,1.230 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17766/Misc Modified Files: ACKS Log Message: Add Hye-Shik Chang for SF patch/bugreport #703471. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.229 retrieving revision 1.230 diff -C2 -d -r1.229 -r1.230 *** ACKS 14 Mar 2003 21:51:33 -0000 1.229 --- ACKS 17 Mar 2003 11:34:01 -0000 1.230 *************** *** 90,93 **** --- 90,94 ---- Per Cederqvist Octavian Cerna + Hye-Shik Chang Jeffrey Chang Brad Chapman From twouters@users.sourceforge.net Mon Mar 17 11:34:45 2003 From: twouters@users.sourceforge.net (twouters@users.sourceforge.net) Date: Mon, 17 Mar 2003 03:34:45 -0800 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.33.4.3,2.33.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18224/Modules Modified Files: Tag: release22-maint binascii.c Log Message: binascii_a2b_base64: Properly return an empty string if the input was all invalid, rather than returning a string of random garbage of the estimated result length. Closes SF patch #703471 by Hye-Shik Chang. Backport from 2.3. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.33.4.3 retrieving revision 2.33.4.4 diff -C2 -d -r2.33.4.3 -r2.33.4.4 *** binascii.c 25 Sep 2002 10:25:14 -0000 2.33.4.3 --- binascii.c 17 Mar 2003 11:34:43 -0000 2.33.4.4 *************** *** 412,415 **** --- 412,419 ---- if (bin_len > 0) _PyString_Resize(&rv, bin_len); + else { + Py_DECREF(rv); + return PyString_FromString(""); + } return rv; } From twouters@users.sourceforge.net Mon Mar 17 11:34:45 2003 From: twouters@users.sourceforge.net (twouters@users.sourceforge.net) Date: Mon, 17 Mar 2003 03:34:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_binascii.py,1.11,1.11.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18224/Lib/test Modified Files: Tag: release22-maint test_binascii.py Log Message: binascii_a2b_base64: Properly return an empty string if the input was all invalid, rather than returning a string of random garbage of the estimated result length. Closes SF patch #703471 by Hye-Shik Chang. Backport from 2.3. Index: test_binascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v retrieving revision 1.11 retrieving revision 1.11.10.1 diff -C2 -d -r1.11 -r1.11.10.1 *** test_binascii.py 18 Oct 2001 21:57:37 -0000 1.11 --- test_binascii.py 17 Mar 2003 11:34:43 -0000 1.11.10.1 *************** *** 70,73 **** --- 70,77 ---- verify(res == testdata) + # Test base64 with just invalid characters, which should return + # empty strings. + verify(binascii.a2b_base64(fillers) == '') + # Test uu print "uu test" From jackjansen@users.sourceforge.net Mon Mar 17 15:43:37 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 17 Mar 2003 07:43:37 -0800 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7873/Modules Modified Files: Setup.dist Log Message: Added a define EXTRAMACHDEPPATH which can be used to add sys.path items for specific platforms. Use this to add plat-mac and plat-mac/lib-scriptpackages on MacOSX. Also tested for not having adverse effects on Linux, and I think this code isn't used on Windows anyway. Fixes #661521. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Setup.dist 26 Jan 2003 11:48:19 -0000 1.36 --- Setup.dist 17 Mar 2003 15:43:34 -0000 1.37 *************** *** 93,96 **** --- 93,97 ---- # Path components for machine- or system-dependent modules and shared libraries MACHDEPPATH=:plat-$(MACHDEP) + EXTRAMACHDEPPATH= # Path component for the Tkinter-related modules *************** *** 98,102 **** TKPATH=:lib-tk ! COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(TKPATH) PYTHONPATH=$(COREPYTHONPATH) --- 99,103 ---- TKPATH=:lib-tk ! COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH) PYTHONPATH=$(COREPYTHONPATH) From jackjansen@users.sourceforge.net Mon Mar 17 15:43:37 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 17 Mar 2003 07:43:37 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.116,1.117 configure.in,1.393,1.394 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv7873 Modified Files: Makefile.pre.in configure.in Log Message: Added a define EXTRAMACHDEPPATH which can be used to add sys.path items for specific platforms. Use this to add plat-mac and plat-mac/lib-scriptpackages on MacOSX. Also tested for not having adverse effects on Linux, and I think this code isn't used on Windows anyway. Fixes #661521. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** Makefile.pre.in 4 Mar 2003 10:52:39 -0000 1.116 --- Makefile.pre.in 17 Mar 2003 15:43:32 -0000 1.117 *************** *** 613,616 **** --- 613,617 ---- PLATDIR= plat-$(MACHDEP) EXTRAPLATDIR= @EXTRAPLATDIR@ + EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@ MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR) XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax *************** *** 623,626 **** --- 624,628 ---- plat-mac/lib-scriptpackages/StdSuites \ plat-mac/lib-scriptpackages/Terminal + PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ encodings email email/test email/test/data compiler hotshot \ Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.393 retrieving revision 1.394 diff -C2 -d -r1.393 -r1.394 *** configure.in 14 Mar 2003 21:51:31 -0000 1.393 --- configure.in 17 Mar 2003 15:43:34 -0000 1.394 *************** *** 158,167 **** # And add extra plat-mac for darwin AC_SUBST(EXTRAPLATDIR) AC_MSG_CHECKING(EXTRAPLATDIR) if test -z "$EXTRAPLATDIR" then case $MACHDEP in ! darwin) EXTRAPLATDIR="\$(PLATMACDIRS)";; ! *) EXTRAPLATDIR="";; esac fi --- 158,174 ---- # And add extra plat-mac for darwin AC_SUBST(EXTRAPLATDIR) + AC_SUBST(EXTRAMACHDEPPATH) AC_MSG_CHECKING(EXTRAPLATDIR) if test -z "$EXTRAPLATDIR" then case $MACHDEP in ! darwin) ! EXTRAPLATDIR="\$(PLATMACDIRS)" ! EXTRAMACHDEPPATH="\$(PLATMACPATH)" ! ;; ! *) ! EXTRAPLATDIR="" ! EXTRAMACHDEPPATH="" ! ;; esac fi From jackjansen@users.sourceforge.net Mon Mar 17 15:44:27 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 17 Mar 2003 07:44:27 -0800 Subject: [Python-checkins] python/dist/src configure,1.382,1.383 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv9055 Modified Files: configure Log Message: Added a define EXTRAMACHDEPPATH which can be used to add sys.path items for specific platforms. Use this to add plat-mac and plat-mac/lib-scriptpackages on MacOSX. Also tested for not having adverse effects on Linux, and I think this code isn't used on Windows anyway. Fixes #661521. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.382 retrieving revision 1.383 diff -C2 -d -r1.382 -r1.383 *** configure 14 Mar 2003 21:51:20 -0000 1.382 --- configure 17 Mar 2003 15:44:10 -0000 1.383 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.392 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.393 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1391,1394 **** --- 1391,1395 ---- # And add extra plat-mac for darwin + echo "$as_me:$LINENO: checking EXTRAPLATDIR" >&5 echo $ECHO_N "checking EXTRAPLATDIR... $ECHO_C" >&6 *************** *** 1396,1401 **** then case $MACHDEP in ! darwin) EXTRAPLATDIR="\$(PLATMACDIRS)";; ! *) EXTRAPLATDIR="";; esac fi --- 1397,1408 ---- then case $MACHDEP in ! darwin) ! EXTRAPLATDIR="\$(PLATMACDIRS)" ! EXTRAMACHDEPPATH="\$(PLATMACPATH)" ! ;; ! *) ! EXTRAPLATDIR="" ! EXTRAMACHDEPPATH="" ! ;; esac fi *************** *** 17469,17472 **** --- 17476,17480 ---- s,@SGI_ABI@,$SGI_ABI,;t t s,@EXTRAPLATDIR@,$EXTRAPLATDIR,;t t + s,@EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t s,@CXX@,$CXX,;t t s,@MAINOBJ@,$MAINOBJ,;t t From jackjansen@users.sourceforge.net Mon Mar 17 15:45:42 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 17 Mar 2003 07:45:42 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.38,1.39 Mac.pth,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv9508 Modified Files: Makefile Removed Files: Mac.pth Log Message: Get rid of Mac.pth: plat-mac is now added through the normal mechanism. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Makefile 11 Mar 2003 23:07:08 -0000 1.38 --- Makefile 17 Mar 2003 15:45:38 -0000 1.39 *************** *** 16,20 **** PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH) APPINSTALLDIR=$(prefix)/Resources/Python.app - PTHFILE=$(srcdir)/Mac/OSX/Mac.pth # Variables for installing the "normal" unix binaries --- 16,19 ---- *************** *** 215,219 **** done - $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/ $(BUILDPYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) --- 214,217 ---- --- Mac.pth DELETED --- From loewis@users.sourceforge.net Mon Mar 17 18:30:20 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 17 Mar 2003 10:30:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode_file.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26562/Lib/test Modified Files: test_unicode_file.py Log Message: Test for UnicodeError instead of ImportError to determine whether the test file name can be encoded. Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_unicode_file.py 8 Mar 2003 10:25:31 -0000 1.7 --- test_unicode_file.py 17 Mar 2003 18:30:15 -0000 1.8 *************** *** 8,12 **** try: TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) ! except (ImportError, TypeError): # Either the file system encoding is None, or the file name # cannot be encoded in the file system encoding. --- 8,12 ---- try: TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) ! except (UnicodeError, TypeError): # Either the file system encoding is None, or the file name # cannot be encoded in the file system encoding. From bwarsaw@users.sourceforge.net Mon Mar 17 18:36:40 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 17 Mar 2003 10:36:40 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv29965 Modified Files: test_email.py Log Message: test_getaddresses_nasty(): A test for mimelib SF bug # 697641. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_email.py 12 Mar 2003 03:14:11 -0000 1.45 --- test_email.py 17 Mar 2003 18:36:37 -0000 1.46 *************** *** 1927,1930 **** --- 1927,1940 ---- ('Bud Person', 'bperson@dom.ain')]) + def test_getaddresses_nasty(self): + eq = self.assertEqual + eq(Utils.getaddresses(['foo: ;']), [('', '')]) + eq(Utils.getaddresses( + ['[]*-- =~$']), + [('', ''), ('', ''), ('', '*--')]) + eq(Utils.getaddresses( + ['foo: ;', '"Jason R. Mastaler" ']), + [('', ''), ('Jason R. Mastaler', 'jason@dom.ain')]) + def test_utils_quote_unquote(self): eq = self.assertEqual From bwarsaw@users.sourceforge.net Mon Mar 17 18:35:46 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 17 Mar 2003 10:35:46 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _parseaddr.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv29522 Modified Files: _parseaddr.py Log Message: getaddrlist(): Make sure this consumes all the data, and if there is no address there (perhaps because of invalid characters, it appends ('', '') to the result set. Closes mimelib SF bug # 697641. Index: _parseaddr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_parseaddr.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _parseaddr.py 30 Dec 2002 17:21:36 -0000 1.4 --- _parseaddr.py 17 Mar 2003 18:35:42 -0000 1.5 *************** *** 197,206 **** """ result = [] ! while True: ad = self.getaddress() if ad: result += ad else: ! break return result --- 197,206 ---- """ result = [] ! while self.pos < len(self.field): ad = self.getaddress() if ad: result += ad else: ! result.append(('', '')) return result From rhettinger@users.sourceforge.net Mon Mar 17 19:46:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 11:46:15 -0800 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.142,2.143 enumobject.c,1.4,1.5 iterobject.c,1.14,1.15 listobject.c,2.146,2.147 object.c,2.200,2.201 rangeobject.c,2.47,2.48 tupleobject.c,2.77,2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv29904/Objects Modified Files: dictobject.c enumobject.c iterobject.c listobject.c object.c rangeobject.c tupleobject.c Log Message: Renamed PyObject_GenericGetIter to PyObject_SelfIter to more accurately describe what the function does. Suggested by Thomas Wouters. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.142 retrieving revision 2.143 diff -C2 -d -r2.142 -r2.143 *** dictobject.c 17 Mar 2003 08:24:34 -0000 2.142 --- dictobject.c 17 Mar 2003 19:46:09 -0000 2.143 *************** *** 2063,2067 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 2063,2067 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ 0, /* tp_methods */ Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** enumobject.c 17 Mar 2003 08:24:34 -0000 1.4 --- enumobject.c 17 Mar 2003 19:46:09 -0000 1.5 *************** *** 111,115 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ 0, /* tp_methods */ --- 111,115 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ 0, /* tp_methods */ Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iterobject.c 17 Mar 2003 08:24:34 -0000 1.14 --- iterobject.c 17 Mar 2003 19:46:10 -0000 1.15 *************** *** 100,104 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 100,104 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ 0, /* tp_methods */ *************** *** 217,221 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 217,221 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ 0, /* tp_methods */ Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.146 retrieving revision 2.147 diff -C2 -d -r2.146 -r2.147 *** listobject.c 17 Mar 2003 08:24:34 -0000 2.146 --- listobject.c 17 Mar 2003 19:46:10 -0000 2.147 *************** *** 2451,2455 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ 0, /* tp_methods */ --- 2451,2455 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ 0, /* tp_methods */ Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.200 retrieving revision 2.201 diff -C2 -d -r2.200 -r2.201 *** object.c 17 Mar 2003 08:22:56 -0000 2.200 --- object.c 17 Mar 2003 19:46:11 -0000 2.201 *************** *** 1302,1306 **** PyObject * ! PyObject_GenericGetIter(PyObject *obj) { Py_INCREF(obj); --- 1302,1306 ---- PyObject * ! PyObject_SelfIter(PyObject *obj) { Py_INCREF(obj); Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** rangeobject.c 17 Mar 2003 08:24:34 -0000 2.47 --- rangeobject.c 17 Mar 2003 19:46:11 -0000 2.48 *************** *** 282,286 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ 0, /* tp_methods */ --- 282,286 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ 0, /* tp_methods */ Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -d -r2.77 -r2.78 *** tupleobject.c 17 Mar 2003 08:24:35 -0000 2.77 --- tupleobject.c 17 Mar 2003 19:46:11 -0000 2.78 *************** *** 832,836 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)tupleiter_next, /* tp_iternext */ }; --- 832,836 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)tupleiter_next, /* tp_iternext */ }; From rhettinger@users.sourceforge.net Mon Mar 17 19:46:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 11:46:35 -0800 Subject: [Python-checkins] python/dist/src/Include object.h,2.114,2.115 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv29904/Include Modified Files: object.h Log Message: Renamed PyObject_GenericGetIter to PyObject_SelfIter to more accurately describe what the function does. Suggested by Thomas Wouters. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.114 retrieving revision 2.115 diff -C2 -d -r2.114 -r2.115 *** object.h 17 Mar 2003 08:22:55 -0000 2.114 --- object.h 17 Mar 2003 19:45:59 -0000 2.115 *************** *** 386,390 **** PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); ! PyAPI_FUNC(PyObject *) PyObject_GenericGetIter(PyObject *); PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, --- 386,390 ---- PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); ! PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, From rhettinger@users.sourceforge.net Mon Mar 17 19:46:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 11:46:43 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.697,1.698 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29904/Misc Modified Files: NEWS Log Message: Renamed PyObject_GenericGetIter to PyObject_SelfIter to more accurately describe what the function does. Suggested by Thomas Wouters. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.697 retrieving revision 1.698 diff -C2 -d -r1.697 -r1.698 *** NEWS 17 Mar 2003 08:22:57 -0000 1.697 --- NEWS 17 Mar 2003 19:46:03 -0000 1.698 *************** *** 87,91 **** ----- ! - Added PyObject_GenericGetIter() to fill the tp_iter slot for the typical case where the method returns its self argument. --- 87,91 ---- ----- ! - Added PyObject_SelfIter() to fill the tp_iter slot for the typical case where the method returns its self argument. From rhettinger@users.sourceforge.net Mon Mar 17 19:46:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 17 Mar 2003 11:46:44 -0800 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.33,1.34 arraymodule.c,2.85,2.86 itertoolsmodule.c,1.8,1.9 xreadlinesmodule.c,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29904/Modules Modified Files: _hotshot.c arraymodule.c itertoolsmodule.c xreadlinesmodule.c Log Message: Renamed PyObject_GenericGetIter to PyObject_SelfIter to more accurately describe what the function does. Suggested by Thomas Wouters. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** _hotshot.c 17 Mar 2003 08:35:49 -0000 1.33 --- _hotshot.c 17 Mar 2003 19:46:07 -0000 1.34 *************** *** 1346,1350 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)logreader_tp_iternext,/* tp_iternext */ logreader_methods, /* tp_methods */ --- 1346,1350 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)logreader_tp_iternext,/* tp_iternext */ logreader_methods, /* tp_methods */ Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -d -r2.85 -r2.86 *** arraymodule.c 17 Mar 2003 08:35:49 -0000 2.85 --- arraymodule.c 17 Mar 2003 19:46:07 -0000 2.86 *************** *** 2015,2019 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)arrayiter_next, /* tp_iternext */ 0, /* tp_methods */ --- 2015,2019 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)arrayiter_next, /* tp_iternext */ 0, /* tp_methods */ Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** itertoolsmodule.c 17 Mar 2003 08:22:57 -0000 1.8 --- itertoolsmodule.c 17 Mar 2003 19:46:08 -0000 1.9 *************** *** 141,145 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)cycle_next, /* tp_iternext */ 0, /* tp_methods */ --- 141,145 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)cycle_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 290,294 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)dropwhile_next, /* tp_iternext */ 0, /* tp_methods */ --- 290,294 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)dropwhile_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 438,442 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)takewhile_next, /* tp_iternext */ 0, /* tp_methods */ --- 438,442 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)takewhile_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 608,612 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)islice_next, /* tp_iternext */ 0, /* tp_methods */ --- 608,612 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)islice_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 747,751 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)starmap_next, /* tp_iternext */ 0, /* tp_methods */ --- 747,751 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)starmap_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 934,938 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)imap_next, /* tp_iternext */ 0, /* tp_methods */ --- 934,938 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)imap_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1069,1073 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)chain_next, /* tp_iternext */ 0, /* tp_methods */ --- 1069,1073 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)chain_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1218,1222 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)ifilter_next, /* tp_iternext */ 0, /* tp_methods */ --- 1218,1222 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)ifilter_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1367,1371 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)ifilterfalse_next, /* tp_iternext */ 0, /* tp_methods */ --- 1367,1371 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)ifilterfalse_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1451,1455 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)count_next, /* tp_iternext */ 0, /* tp_methods */ --- 1451,1455 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)count_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1635,1639 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)izip_next, /* tp_iternext */ 0, /* tp_methods */ --- 1635,1639 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)izip_next, /* tp_iternext */ 0, /* tp_methods */ *************** *** 1742,1746 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)repeat_next, /* tp_iternext */ 0, /* tp_methods */ --- 1742,1746 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)repeat_next, /* tp_iternext */ 0, /* tp_methods */ Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** xreadlinesmodule.c 17 Mar 2003 08:35:49 -0000 1.14 --- xreadlinesmodule.c 17 Mar 2003 19:46:08 -0000 1.15 *************** *** 153,157 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_GenericGetIter, /* tp_iter */ (iternextfunc)xreadlines_iternext, /* tp_iternext */ }; --- 153,157 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)xreadlines_iternext, /* tp_iternext */ }; From bwarsaw@users.sourceforge.net Mon Mar 17 20:35:20 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 17 Mar 2003 12:35:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv21771 Modified Files: test_email.py Log Message: test_long_lines_with_different_header(): Another test from Jason. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test_email.py 17 Mar 2003 18:36:37 -0000 1.46 --- test_email.py 17 Mar 2003 20:35:14 -0000 1.47 *************** *** 842,845 **** --- 842,861 ---- ''') + def test_long_lines_with_different_header(self): + eq = self.ndiffAssertEqual + h = """\ + List-Unsubscribe: , + """ + msg = Message() + msg['List'] = h + msg['List'] = Header(h, header_name='List') + eq(msg.as_string(), """\ + List: List-Unsubscribe: , + + List: List-Unsubscribe: , + + + """) + From bwarsaw@users.sourceforge.net Mon Mar 17 20:36:30 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 17 Mar 2003 12:36:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv22307 Modified Files: Header.py Log Message: _encode_chunks(): Throw out empty chunks. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Header.py 10 Mar 2003 15:14:08 -0000 1.25 --- Header.py 17 Mar 2003 20:36:20 -0000 1.26 *************** *** 362,365 **** --- 362,367 ---- chunks = [] for header, charset in newchunks: + if not header: + continue if charset is None or charset.header_encoding is None: s = header From nnorwitz@users.sourceforge.net Tue Mar 18 13:30:18 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 18 Mar 2003 05:30:18 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_posix.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15534/Lib/test Modified Files: test_posix.py Log Message: Fix SF bug #697556, test_posix fails: getlogin getlogin() can fail for too many reasons, so remove the test Index: test_posix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posix.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_posix.py 23 Feb 2003 22:12:24 -0000 1.4 --- test_posix.py 18 Mar 2003 13:30:14 -0000 1.5 *************** *** 34,43 **** "getpid", "getpgrp", "getppid", "getuid", ] - # getlogin() only works when run from a tty (terminal) - try: - if os.isatty(sys.stdin.fileno()): - NO_ARG_FUNCTIONS.append("getlogin") - except: - pass for name in NO_ARG_FUNCTIONS: --- 34,37 ---- From jvr@users.sourceforge.net Tue Mar 18 18:48:20 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 18 Mar 2003 10:48:20 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze freeze.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv21968/Tools/freeze Modified Files: freeze.py Log Message: replace obsolete 'exceptions' implicit by 'warnings' Index: freeze.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** freeze.py 8 Mar 2003 19:50:38 -0000 1.43 --- freeze.py 18 Mar 2003 18:48:17 -0000 1.44 *************** *** 202,206 **** # modules that are imported by the Python runtime implicits = [] ! for module in ('site', 'exceptions',): if module not in exclude: implicits.append(module) --- 202,206 ---- # modules that are imported by the Python runtime implicits = [] ! for module in ('site', 'warnings',): if module not in exclude: implicits.append(module) From cliffwells18@users.sourceforge.net Tue Mar 18 21:18:16 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Tue, 18 Mar 2003 13:18:16 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv setup.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv In directory sc8-pr-cvs1:/tmp/cvs-serv27210 Modified Files: setup.py Log Message: Now installs package correctly. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/setup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setup.py 29 Jan 2003 11:44:55 -0000 1.3 --- setup.py 18 Mar 2003 21:18:14 -0000 1.4 *************** *** 4,8 **** setup(name = "_csv", description = "Fast CSV Parser", ! py_modules = ['csv'], ext_modules = [ Extension('_csv', --- 4,9 ---- setup(name = "_csv", description = "Fast CSV Parser", ! package_dir = {'csv': '.', 'csv/util': './util'}, ! packages = ['csv', 'csv/util'], ext_modules = [ Extension('_csv', From cliffwells18@users.sourceforge.net Tue Mar 18 21:19:03 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Tue, 18 Mar 2003 13:19:03 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv csv.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv In directory sc8-pr-cvs1:/tmp/cvs-serv27642 Modified Files: csv.py Log Message: Fixed excel dialect to initialize escapechar='' Index: csv.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/csv.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** csv.py 26 Feb 2003 22:33:48 -0000 1.34 --- csv.py 18 Mar 2003 21:19:00 -0000 1.35 *************** *** 69,72 **** --- 69,73 ---- delimiter = ',' quotechar = '"' + escapechar = '' doublequote = True skipinitialspace = False From montanaro@users.sourceforge.net Tue Mar 18 21:48:02 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 18 Mar 2003 13:48:02 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/test test_csv.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/test In directory sc8-pr-cvs1:/tmp/cvs-serv11045 Modified Files: test_csv.py Log Message: work with new csv package structure Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/test/test_csv.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_csv.py 26 Feb 2003 20:59:29 -0000 1.35 --- test_csv.py 18 Mar 2003 21:47:57 -0000 1.36 *************** *** 5,9 **** import unittest from StringIO import StringIO ! import csv import gc --- 5,9 ---- import unittest from StringIO import StringIO ! from csv import csv import gc From montanaro@users.sourceforge.net Tue Mar 18 21:49:03 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 18 Mar 2003 13:49:03 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv csv.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv In directory sc8-pr-cvs1:/tmp/cvs-serv11512 Modified Files: csv.py Log Message: correct _validate() test of escapechar. When quoting is not QUOTE_NONE we don't care what the value of escapechar is. Index: csv.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/csv.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** csv.py 18 Mar 2003 21:19:00 -0000 1.35 --- csv.py 18 Mar 2003 21:48:58 -0000 1.36 *************** *** 57,67 **** errors.append("skipinitialspace parameter must be True or False") - if (not isinstance(self.escapechar, str) or - len(self.escapechar) > 1): - errors.append("escapechar must be one-character string") - if self.quoting is None: errors.append("quoting parameter not set") return errors --- 57,68 ---- errors.append("skipinitialspace parameter must be True or False") if self.quoting is None: errors.append("quoting parameter not set") + if self.quoting is QUOTE_NONE: + if (not isinstance(self.escapechar, (unicode, str)) or + len(self.escapechar) > 1): + errors.append("escapechar must be a one-character string or unicode object") + return errors *************** *** 69,73 **** delimiter = ',' quotechar = '"' - escapechar = '' doublequote = True skipinitialspace = False --- 70,73 ---- From montanaro@users.sourceforge.net Tue Mar 18 23:07:04 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 18 Mar 2003 15:07:04 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/test test_csv.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/test In directory sc8-pr-cvs1:/tmp/cvs-serv15057 Modified Files: test_csv.py Log Message: add test using a space character as the delimiter (based upon problems Andrew Dalke had) Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/test/test_csv.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_csv.py 18 Mar 2003 21:47:57 -0000 1.36 --- test_csv.py 18 Mar 2003 23:07:00 -0000 1.37 *************** *** 194,197 **** --- 194,208 ---- self.assertRaises(csv.Error, myexceltsv) + def test_space_dialect(self): + class space(csv.excel): + delimiter = " " + quoting = csv.QUOTE_NONE + escapechar = "\\" + + s = StringIO("abc def\nc1ccccc1 benzene\n") + rdr = csv.reader(s, dialect=space()) + self.assertEqual(rdr.next(), ["abc", "def"]) + self.assertEqual(rdr.next(), ["c1ccccc1", "benzene"]) + def test_dialect_apply(self): class testA(csv.excel): From cliffwells18@users.sourceforge.net Wed Mar 19 00:29:14 2003 From: cliffwells18@users.sourceforge.net (cliffwells18@users.sourceforge.net) Date: Tue, 18 Mar 2003 16:29:14 -0800 Subject: [Python-checkins] python/nondist/sandbox/csv/util sniffer.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv11486 Modified Files: sniffer.py Log Message: Made hasHeaders() a method of Sniffer class. Changed Sniffer.sniff to return a class rather than a class instance, to be compatible with csv.register_dialect(). Index: sniffer.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/csv/util/sniffer.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sniffer.py 15 Mar 2003 01:15:03 -0000 1.6 --- sniffer.py 19 Mar 2003 00:29:12 -0000 1.7 *************** *** 27,30 **** --- 27,33 ---- Takes a file-like object and returns a dialect (or None) """ + + self.fileobj = fileobj + data = fileobj.read(self.sample) *************** *** 37,41 **** lineterminator = '\r\n' quoting = csv.QUOTE_MINIMAL ! escapechar = '' doublequote = False Dialect.delimiter = delimiter --- 40,44 ---- lineterminator = '\r\n' quoting = csv.QUOTE_MINIMAL ! # escapechar = '' doublequote = False Dialect.delimiter = delimiter *************** *** 43,49 **** Dialect.skipinitialspace = skipinitialspace ! return Dialect() def _guessQuoteAndDelimiter(self, data): """ --- 46,61 ---- Dialect.skipinitialspace = skipinitialspace ! self.dialect = Dialect ! return self.dialect + def hasHeaders(self): + return self._hasHeaders(self.fileobj, self.dialect) + + + def register_dialect(self, name = 'sniffed'): + csv.register_dialect(name, self.dialect) + + def _guessQuoteAndDelimiter(self, data): """ *************** *** 200,276 **** ! # ------------------------------------------------------------------------------ ! def hasHeaders(fileObj, dialect): ! # Algorithm: creates a dictionary of types of data in each column. If any column ! # is of a single type (say, integers), *except* for the first row, then the first ! # row is presumed to be labels. If the type can't be determined, it is assumed to ! # be a string in which case the length of the string is the determining factor: if ! # all of the rows except for the first are the same length, it's a header. ! # Finally, a 'vote' is taken at the end for each column, adding or subtracting from ! # the likelihood of the first row being a header. ! def seval(item): ! """ ! Strips parens from item prior to calling eval in an attempt to make it safer ! """ ! return eval(item.replace('(', '').replace(')', '')) ! reader = csv.reader(fileObj, ! delimiter = dialect.delimiter, ! quotechar = dialect.quotechar, ! skipinitialspace = dialect.skipinitialspace) ! header = reader.next() # assume first row is header ! columns = len(header) ! columnTypes = {} ! for i in range(columns): columnTypes[i] = None ! checked = 0 ! for row in reader: ! if checked > 20: # arbitrary number of rows to check, to keep it sane ! break ! checked += 1 ! ! if len(row) != columns: ! continue # skip rows that have irregular number of columns ! ! for col in columnTypes.keys(): ! try: try: ! # is it a built-in type (besides string)? ! thisType = type(seval(row[col])) ! except OverflowError: ! # a long int? ! thisType = type(seval(row[col] + 'L')) ! thisType = type(0) # treat long ints as int ! except: ! # fallback to length of string ! thisType = len(row[col]) ! if thisType != columnTypes[col]: ! if columnTypes[col] is None: # add new column type ! columnTypes[col] = thisType ! else: # type is inconsistent, remove column from consideration ! del columnTypes[col] ! ! # finally, compare results against first row and "vote" on whether it's a header ! hasHeader = 0 ! for col, colType in columnTypes.items(): ! if type(colType) == type(0): # it's a length ! if len(header[col]) != colType: ! hasHeader += 1 ! else: ! hasHeader -= 1 ! else: # attempt typecast ! try: ! eval("%s(%s)" % (colType.__name__, header[col])) ! except: ! hasHeader += 1 ! else: ! hasHeader -= 1 - return hasHeader > 0 - --- 212,289 ---- ! def _hasHeaders(self, fileobj, dialect): ! # Creates a dictionary of types of data in each column. If any column ! # is of a single type (say, integers), *except* for the first row, then the first ! # row is presumed to be labels. If the type can't be determined, it is assumed to ! # be a string in which case the length of the string is the determining factor: if ! # all of the rows except for the first are the same length, it's a header. ! # Finally, a 'vote' is taken at the end for each column, adding or subtracting from ! # the likelihood of the first row being a header. ! def seval(item): ! """ ! Strips parens from item prior to calling eval in an attempt to make it safer ! """ ! return eval(item.replace('(', '').replace(')', '')) ! fileobj.seek(0) # rewind the fileobj - this might not work for some file-like objects... ! reader = csv.reader(fileobj, ! delimiter = dialect.delimiter, ! quotechar = dialect.quotechar, ! skipinitialspace = dialect.skipinitialspace) ! header = reader.next() # assume first row is header ! columns = len(header) ! columnTypes = {} ! for i in range(columns): columnTypes[i] = None ! ! checked = 0 ! for row in reader: ! if checked > 20: # arbitrary number of rows to check, to keep it sane ! break ! checked += 1 ! ! if len(row) != columns: ! continue # skip rows that have irregular number of columns ! ! for col in columnTypes.keys(): try: ! try: ! # is it a built-in type (besides string)? ! thisType = type(seval(row[col])) ! except OverflowError: ! # a long int? ! thisType = type(seval(row[col] + 'L')) ! thisType = type(0) # treat long ints as int ! except: ! # fallback to length of string ! thisType = len(row[col]) ! if thisType != columnTypes[col]: ! if columnTypes[col] is None: # add new column type ! columnTypes[col] = thisType ! else: # type is inconsistent, remove column from consideration ! del columnTypes[col] ! ! # finally, compare results against first row and "vote" on whether it's a header ! hasHeader = 0 ! for col, colType in columnTypes.items(): ! if type(colType) == type(0): # it's a length ! if len(header[col]) != colType: ! hasHeader += 1 ! else: ! hasHeader -= 1 ! else: # attempt typecast ! try: ! eval("%s(%s)" % (colType.__name__, header[col])) ! except: ! hasHeader += 1 ! else: ! hasHeader -= 1 ! ! return hasHeader > 0 From niemeyer@users.sourceforge.net Wed Mar 19 00:35:37 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 18 Mar 2003 16:35:37 -0800 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv14162/Include Modified Files: pystate.h Log Message: Fixed SF bug #663074. The codec system was using global static variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure. Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** pystate.h 19 Feb 2003 15:53:14 -0000 2.22 --- pystate.h 19 Mar 2003 00:35:35 -0000 2.23 *************** *** 23,26 **** --- 23,30 ---- PyObject *builtins; + PyObject *codec_search_path; + PyObject *codec_search_cache; + PyObject *codec_error_registry; + #ifdef HAVE_DLOPEN int dlopenflags; From niemeyer@users.sourceforge.net Wed Mar 19 00:35:38 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 18 Mar 2003 16:35:38 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.698,1.699 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14162/Misc Modified Files: NEWS Log Message: Fixed SF bug #663074. The codec system was using global static variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.698 retrieving revision 1.699 diff -C2 -d -r1.698 -r1.699 *** NEWS 17 Mar 2003 19:46:03 -0000 1.698 --- NEWS 19 Mar 2003 00:35:35 -0000 1.699 *************** *** 30,33 **** --- 30,38 ---- if the key value was larger than 2**32. See SF bug #689659. + - Fixed SF bug #663074. The codec system was using global static + variables to store internal data. As a result, any atempts to use the + unicode system with multiple active interpreters, or successive + interpreter executions, would fail. + Extension modules ----------------- From niemeyer@users.sourceforge.net Wed Mar 19 00:35:38 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 18 Mar 2003 16:35:38 -0800 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.20,2.21 pystate.c,2.23,2.24 pythonrun.c,2.181,2.182 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv14162/Python Modified Files: codecs.c pystate.c pythonrun.c Log Message: Fixed SF bug #663074. The codec system was using global static variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure. Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** codecs.c 14 Feb 2003 20:25:56 -0000 2.20 --- codecs.c 19 Mar 2003 00:35:35 -0000 2.21 *************** *** 12,23 **** #include - /* --- Globals ------------------------------------------------------------ */ - - static PyObject *_PyCodec_SearchPath; - static PyObject *_PyCodec_SearchCache; - - /* Flag used for lazy import of the standard encodings package */ - static int import_encodings_called = 0; - /* --- Codec Registry ----------------------------------------------------- */ --- 12,15 ---- *************** *** 33,65 **** */ ! static ! int import_encodings(void) ! { ! PyObject *mod; ! ! import_encodings_called = 1; ! mod = PyImport_ImportModuleEx("encodings", NULL, NULL, NULL); ! if (mod == NULL) { ! if (PyErr_ExceptionMatches(PyExc_ImportError)) { ! /* Ignore ImportErrors... this is done so that ! distributions can disable the encodings package. Note ! that other errors are not masked, e.g. SystemErrors ! raised to inform the user of an error in the Python ! configuration are still reported back to the user. */ ! PyErr_Clear(); ! return 0; ! } ! return -1; ! } ! Py_DECREF(mod); ! return 0; ! } int PyCodec_Register(PyObject *search_function) { ! if (!import_encodings_called) { ! if (import_encodings()) ! goto onError; ! } if (search_function == NULL) { PyErr_BadArgument(); --- 25,35 ---- */ ! static int _PyCodecRegistry_Init(void); /* Forward */ int PyCodec_Register(PyObject *search_function) { ! PyInterpreterState *interp = PyThreadState_Get()->interp; ! if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) ! goto onError; if (search_function == NULL) { PyErr_BadArgument(); *************** *** 71,75 **** goto onError; } ! return PyList_Append(_PyCodec_SearchPath, search_function); onError: --- 41,45 ---- goto onError; } ! return PyList_Append(interp->codec_search_path, search_function); onError: *************** *** 125,128 **** --- 95,99 ---- PyObject *_PyCodec_Lookup(const char *encoding) { + PyInterpreterState *interp; PyObject *result, *args = NULL, *v; int i, len; *************** *** 132,145 **** goto onError; } ! if (_PyCodec_SearchCache == NULL || ! _PyCodec_SearchPath == NULL) { ! PyErr_SetString(PyExc_SystemError, ! "codec module not properly initialized"); goto onError; - } - if (!import_encodings_called) { - if (import_encodings()) - goto onError; - } /* Convert the encoding to a normalized Python string: all --- 103,110 ---- goto onError; } ! ! interp = PyThreadState_Get()->interp; ! if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; /* Convert the encoding to a normalized Python string: all *************** *** 152,156 **** /* First, try to lookup the name in the registry dictionary */ ! result = PyDict_GetItem(_PyCodec_SearchCache, v); if (result != NULL) { Py_INCREF(result); --- 117,121 ---- /* First, try to lookup the name in the registry dictionary */ ! result = PyDict_GetItem(interp->codec_search_cache, v); if (result != NULL) { Py_INCREF(result); *************** *** 165,169 **** PyTuple_SET_ITEM(args,0,v); ! len = PyList_Size(_PyCodec_SearchPath); if (len < 0) goto onError; --- 130,134 ---- PyTuple_SET_ITEM(args,0,v); ! len = PyList_Size(interp->codec_search_path); if (len < 0) goto onError; *************** *** 178,182 **** PyObject *func; ! func = PyList_GetItem(_PyCodec_SearchPath, i); if (func == NULL) goto onError; --- 143,147 ---- PyObject *func; ! func = PyList_GetItem(interp->codec_search_path, i); if (func == NULL) goto onError; *************** *** 204,208 **** /* Cache and return the result */ ! PyDict_SetItem(_PyCodec_SearchCache, v, result); Py_DECREF(args); return result; --- 169,173 ---- /* Cache and return the result */ ! PyDict_SetItem(interp->codec_search_cache, v, result); Py_DECREF(args); return result; *************** *** 423,428 **** } - static PyObject *_PyCodec_ErrorRegistry; - /* Register the error handling callback function error under the name name. This function will be called by the codec when it encounters --- 388,391 ---- *************** *** 433,441 **** int PyCodec_RegisterError(const char *name, PyObject *error) { if (!PyCallable_Check(error)) { PyErr_SetString(PyExc_TypeError, "handler must be callable"); return -1; } ! return PyDict_SetItemString( _PyCodec_ErrorRegistry, (char *)name, error); } --- 396,408 ---- int PyCodec_RegisterError(const char *name, PyObject *error) { + PyInterpreterState *interp = PyThreadState_Get()->interp; + if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) + return -1; if (!PyCallable_Check(error)) { PyErr_SetString(PyExc_TypeError, "handler must be callable"); return -1; } ! return PyDict_SetItemString(interp->codec_error_registry, ! (char *)name, error); } *************** *** 447,453 **** PyObject *handler = NULL; if (name==NULL) name = "strict"; ! handler = PyDict_GetItemString(_PyCodec_ErrorRegistry, (char *)name); if (!handler) PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name); --- 414,424 ---- PyObject *handler = NULL; + PyInterpreterState *interp = PyThreadState_Get()->interp; + if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) + return NULL; + if (name==NULL) name = "strict"; ! handler = PyDict_GetItemString(interp->codec_error_registry, (char *)name); if (!handler) PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name); *************** *** 763,768 **** #endif ! ! void _PyCodecRegistry_Init(void) { static struct { --- 734,738 ---- #endif ! static int _PyCodecRegistry_Init(void) { static struct { *************** *** 814,850 **** #endif }; - if (_PyCodec_SearchPath == NULL) - _PyCodec_SearchPath = PyList_New(0); - if (_PyCodec_SearchCache == NULL) - _PyCodec_SearchCache = PyDict_New(); - if (_PyCodec_ErrorRegistry == NULL) { - int i; - _PyCodec_ErrorRegistry = PyDict_New(); ! if (_PyCodec_ErrorRegistry) { ! for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) { ! PyObject *func = PyCFunction_New(&methods[i].def, NULL); ! int res; ! if (!func) ! Py_FatalError("can't initialize codec error registry"); ! res = PyCodec_RegisterError(methods[i].name, func); ! Py_DECREF(func); ! if (res) ! Py_FatalError("can't initialize codec error registry"); ! } } } ! if (_PyCodec_SearchPath == NULL || ! _PyCodec_SearchCache == NULL) Py_FatalError("can't initialize codec registry"); - } ! void _PyCodecRegistry_Fini(void) ! { ! Py_XDECREF(_PyCodec_SearchPath); ! _PyCodec_SearchPath = NULL; ! Py_XDECREF(_PyCodec_SearchCache); ! _PyCodec_SearchCache = NULL; ! Py_XDECREF(_PyCodec_ErrorRegistry); ! _PyCodec_ErrorRegistry = NULL; } --- 784,831 ---- #endif }; ! PyInterpreterState *interp = PyThreadState_Get()->interp; ! PyObject *mod; ! int i; ! ! if (interp->codec_search_path != NULL) ! return 0; ! ! interp->codec_search_path = PyList_New(0); ! interp->codec_search_cache = PyDict_New(); ! interp->codec_error_registry = PyDict_New(); ! ! if (interp->codec_error_registry) { ! for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) { ! PyObject *func = PyCFunction_New(&methods[i].def, NULL); ! int res; ! if (!func) ! Py_FatalError("can't initialize codec error registry"); ! res = PyCodec_RegisterError(methods[i].name, func); ! Py_DECREF(func); ! if (res) ! Py_FatalError("can't initialize codec error registry"); } } ! ! if (interp->codec_search_path == NULL || ! interp->codec_search_cache == NULL || ! interp->codec_error_registry == NULL) Py_FatalError("can't initialize codec registry"); ! mod = PyImport_ImportModuleEx("encodings", NULL, NULL, NULL); ! if (mod == NULL) { ! if (PyErr_ExceptionMatches(PyExc_ImportError)) { ! /* Ignore ImportErrors... this is done so that ! distributions can disable the encodings package. Note ! that other errors are not masked, e.g. SystemErrors ! raised to inform the user of an error in the Python ! configuration are still reported back to the user. */ ! PyErr_Clear(); ! return 0; ! } ! return -1; ! } ! Py_DECREF(mod); ! return 0; } Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** pystate.c 19 Feb 2003 15:53:17 -0000 2.23 --- pystate.c 19 Mar 2003 00:35:36 -0000 2.24 *************** *** 50,53 **** --- 50,56 ---- interp->builtins = NULL; interp->tstate_head = NULL; + interp->codec_search_path = NULL; + interp->codec_search_cache = NULL; + interp->codec_error_registry = NULL; #ifdef HAVE_DLOPEN #ifdef RTLD_NOW *************** *** 76,79 **** --- 79,85 ---- PyThreadState_Clear(p); HEAD_UNLOCK(); + ZAP(interp->codec_search_path); + ZAP(interp->codec_search_cache); + ZAP(interp->codec_error_registry); ZAP(interp->modules); ZAP(interp->sysdict); Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.181 retrieving revision 2.182 diff -C2 -d -r2.181 -r2.182 *** pythonrun.c 5 Mar 2003 17:31:21 -0000 2.181 --- pythonrun.c 19 Mar 2003 00:35:36 -0000 2.182 *************** *** 50,55 **** extern void _PyUnicode_Init(void); extern void _PyUnicode_Fini(void); - extern void _PyCodecRegistry_Init(void); - extern void _PyCodecRegistry_Fini(void); int Py_DebugFlag; /* Needed by parser.c */ --- 50,53 ---- *************** *** 145,151 **** Py_FatalError("Py_Initialize: can't make modules dictionary"); - /* Init codec registry */ - _PyCodecRegistry_Init(); - #ifdef Py_USING_UNICODE /* Init Unicode implementation; relies on the codec registry */ --- 143,146 ---- *************** *** 257,263 **** /* Disable signal handling */ PyOS_FiniInterrupts(); - - /* Cleanup Codec registry */ - _PyCodecRegistry_Fini(); /* drop module references we saved */ --- 252,255 ---- From jackjansen@users.sourceforge.net Wed Mar 19 22:51:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 19 Mar 2003 14:51:45 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules macosmodule.c,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv27647 Modified Files: macosmodule.c Log Message: GetCreatorAndType and SetCreatorAndType have been undeprecated. Spotted by Just. Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** macosmodule.c 23 Feb 2003 23:23:47 -0000 1.65 --- macosmodule.c 19 Mar 2003 22:51:42 -0000 1.66 *************** *** 305,309 **** /* Miscellaneous File System Operations */ ! static char getcrtp_doc[] = "Obsolete, use macfs module"; static PyObject * --- 305,309 ---- /* Miscellaneous File System Operations */ ! static char getcrtp_doc[] = "Get MacOS 4-char creator and type for a file"; static PyObject * *************** *** 327,331 **** } ! static char setcrtp_doc[] = "Obsolete, use macfs module"; static PyObject * --- 327,331 ---- } ! static char setcrtp_doc[] = "Set MacOS 4-char creator and type for a file"; static PyObject * From nnorwitz@users.sourceforge.net Thu Mar 20 04:33:19 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 19 Mar 2003 20:33:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_ioctl.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11301/Lib/test Modified Files: test_ioctl.py Log Message: Skip the ioctl test if we can't open /dev/tty. This happens on Solaris (and probably other Unixes) when run without a terminal (eg, from cron or at). Index: test_ioctl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ioctl.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_ioctl.py 3 Mar 2003 12:29:42 -0000 1.1 --- test_ioctl.py 20 Mar 2003 04:33:16 -0000 1.2 *************** *** 9,12 **** --- 9,18 ---- raise TestSkipped("termios module doesn't have TIOCGPGRP") + try: + tty = open("/dev/tty", "r") + tty.close() + except IOError: + raise TestSkipped("Unable to open /dev/tty") + class IoctlTests(unittest.TestCase): def test_ioctl(self): From fdrake@users.sourceforge.net Thu Mar 20 17:39:42 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 20 Mar 2003 09:39:42 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10101 Modified Files: libos.tex Log Message: - explain what a UNC path is in the makedirs() description, since they're actually mentioned there - remove some extraneous paragraph separations - \versionadded --> \versionchanged in one place Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** libos.tex 3 Mar 2003 17:32:12 -0000 1.115 --- libos.tex 20 Mar 2003 17:39:38 -0000 1.116 *************** *** 712,716 **** Availability: Macintosh, \UNIX, Windows. ! \versionadded[On Windows NT/2k/XP and Unix, if \var{path} is a Unicode object, the result will be a list of Unicode objects.]{2.3} \end{funcdesc} --- 712,716 ---- Availability: Macintosh, \UNIX, Windows. ! \versionchanged[On Windows NT/2k/XP and Unix, if \var{path} is a Unicode object, the result will be a list of Unicode objects.]{2.3} \end{funcdesc} *************** *** 743,747 **** defines the newly created device special file (probably using \function{os.makedev()}), otherwise it is ignored. - \versionadded{2.3} \end{funcdesc} --- 743,746 ---- *************** *** 749,753 **** \begin{funcdesc}{major}{device} Extracts a device major number from a raw device number. - \versionadded{2.3} \end{funcdesc} --- 748,751 ---- *************** *** 755,759 **** \begin{funcdesc}{minor}{device} Extracts a device minor number from a raw device number. - \versionadded{2.3} \end{funcdesc} --- 753,756 ---- *************** *** 761,765 **** \begin{funcdesc}{makedev}{major, minor} Composes a raw device number from the major and minor device numbers. - \versionadded{2.3} \end{funcdesc} --- 758,761 ---- *************** *** 774,784 **** \begin{funcdesc}{makedirs}{path\optional{, mode}} ! \index{directory!creating} ! Recursive directory creation function. Like \function{mkdir()}, but makes all intermediate-level directories needed to contain the leaf directory. Throws an \exception{error} exception if the leaf directory already exists or cannot be created. The default \var{mode} is \code{0777} (octal). This function does not properly handle UNC ! paths (only relevant on Windows systems). \versionadded{1.5.2} \end{funcdesc} --- 770,782 ---- \begin{funcdesc}{makedirs}{path\optional{, mode}} ! Recursive directory creation function.\index{directory!creating} ! \index{UNC paths!and \function{os.makedirs()}} ! Like \function{mkdir()}, but makes all intermediate-level directories needed to contain the leaf directory. Throws an \exception{error} exception if the leaf directory already exists or cannot be created. The default \var{mode} is \code{0777} (octal). This function does not properly handle UNC ! paths (only relevant on Windows systems; Universal Naming Convention ! paths are those that use the `\code{\e\e host\e path}' syntax). \versionadded{1.5.2} \end{funcdesc} From fdrake@users.sourceforge.net Thu Mar 20 17:42:54 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 20 Mar 2003 09:42:54 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.74.2.1.2.12,1.74.2.1.2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11734 Modified Files: Tag: release22-maint libos.tex Log Message: - explain what a UNC path is in the makedirs() description, since they're actually mentioned there Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.12 retrieving revision 1.74.2.1.2.13 diff -C2 -d -r1.74.2.1.2.12 -r1.74.2.1.2.13 *** libos.tex 14 Feb 2003 06:46:24 -0000 1.74.2.1.2.12 --- libos.tex 20 Mar 2003 17:42:48 -0000 1.74.2.1.2.13 *************** *** 673,682 **** \begin{funcdesc}{makedirs}{path\optional{, mode}} \index{directory!creating} ! Recursive directory creation function. Like \function{mkdir()}, but makes all intermediate-level directories needed to contain the leaf directory. Throws an \exception{error} exception if the leaf directory already exists or cannot be created. The default \var{mode} is \code{0777} (octal). This function does not properly handle UNC ! paths (only relevant on Windows systems). \versionadded{1.5.2} \end{funcdesc} --- 673,685 ---- \begin{funcdesc}{makedirs}{path\optional{, mode}} \index{directory!creating} ! Recursive directory creation function.\index{directory!creating} ! \index{UNC paths!and \function{os.makedirs()}} ! Like \function{mkdir()}, but makes all intermediate-level directories needed to contain the leaf directory. Throws an \exception{error} exception if the leaf directory already exists or cannot be created. The default \var{mode} is \code{0777} (octal). This function does not properly handle UNC ! paths (only relevant on Windows systems; Universal Naming Convention ! paths are those that use the `\code{\e\e host\e path}' syntax). \versionadded{1.5.2} \end{funcdesc} From montanaro@users.sourceforge.net Thu Mar 20 17:58:16 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 09:58:16 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19874 Modified Files: libsocket.tex Log Message: add descriptions of {get,set}defaulttimeout. Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** libsocket.tex 13 Jun 2002 15:07:43 -0000 1.68 --- libsocket.tex 20 Mar 2003 17:58:12 -0000 1.69 *************** *** 350,353 **** --- 350,367 ---- \end{funcdesc} + \begin{funcdesc}{getdefaulttimeout}{} + Return the default timeout in floating seconds for new socket objects. + A value of \code{None} indicates that new socket objects have no timeout. + When the socket module is first imported, the default is \code{None}. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{setdefaulttimeout}{timeout} + Set the default timeout in floating seconds for new socket objects. + A value of \code{None} indicates that new socket objects have no timeout. + When the socket module is first imported, the default is \code{None}. + \versionadded{2.3} + \end{funcdesc} + \begin{datadesc}{SocketType} This is a Python type object that represents the socket object type. From fdrake@users.sourceforge.net Thu Mar 20 18:17:19 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:17:19 -0800 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv32744 Modified Files: ref3.tex Log Message: - apply SF patch #700798: fixes and cleanups for descriptor info - use a TeX "tie" to prevent word-wrapping in "section x.y"-like text Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** ref3.tex 5 Mar 2003 14:20:58 -0000 1.101 --- ref3.tex 20 Mar 2003 18:17:16 -0000 1.102 *************** *** 408,412 **** Dictionaries are mutable; they can be created by the ! \code{\{...\}} notation (see section \ref{dict}, ``Dictionary Displays''). --- 408,412 ---- Dictionaries are mutable; they can be created by the ! \code{\{...\}} notation (see section~\ref{dict}, ``Dictionary Displays''). *************** *** 419,423 **** \item[Callable types] These\obindex{callable} are the types to which the function call ! operation (see section \ref{calls}, ``Calls'') can be applied: \indexii{function}{call} \index{invocation} --- 419,423 ---- \item[Callable types] These\obindex{callable} are the types to which the function call ! operation (see section~\ref{calls}, ``Calls'') can be applied: \indexii{function}{call} \index{invocation} *************** *** 428,432 **** \item[User-defined functions] A user-defined function object is created by a function definition ! (see section \ref{function}, ``Function definitions''). It should be called with an argument list containing the same number of items as the function's formal --- 428,432 ---- \item[User-defined functions] A user-defined function object is created by a function definition ! (see section~\ref{function}, ``Function definitions''). It should be called with an argument list containing the same number of items as the function's formal *************** *** 602,607 **** \item[Modules] ! Modules are imported by the \keyword{import} statement (see section ! \ref{import}, ``The \keyword{import} statement''). A module object has a namespace implemented by a dictionary object (this is the dictionary referenced by the func_globals attribute of --- 602,607 ---- \item[Modules] ! Modules are imported by the \keyword{import} statement (see ! section~\ref{import}, ``The \keyword{import} statement''). A module object has a namespace implemented by a dictionary object (this is the dictionary referenced by the func_globals attribute of *************** *** 638,643 **** \item[Classes] ! Class objects are created by class definitions (see section ! \ref{class}, ``Class definitions''). A class has a namespace implemented by a dictionary object. Class attribute references are translated to --- 638,643 ---- \item[Classes] ! Class objects are created by class definitions (see ! section~\ref{class}, ``Class definitions''). A class has a namespace implemented by a dictionary object. Class attribute references are translated to *************** *** 709,713 **** Class instances can pretend to be numbers, sequences, or mappings if they have methods with certain special names. See ! section \ref{specialnames}, ``Special method names.'' \obindex{numeric} \obindex{sequence} --- 709,713 ---- Class instances can pretend to be numbers, sequences, or mappings if they have methods with certain special names. See ! section~\ref{specialnames}, ``Special method names.'' \obindex{numeric} \obindex{sequence} *************** *** 866,870 **** traceback. When an exception handler is entered, the stack trace is made available to the program. ! (See section \ref{try}, ``The \code{try} statement.'') It is accessible as \code{sys.exc_traceback}, and also as the third item of the tuple returned by \code{sys.exc_info()}. The latter is --- 866,870 ---- traceback. When an exception handler is entered, the stack trace is made available to the program. ! (See section~\ref{try}, ``The \code{try} statement.'') It is accessible as \code{sys.exc_traceback}, and also as the third item of the tuple returned by \code{sys.exc_info()}. The latter is *************** *** 1212,1216 **** In order to avoid infinite recursion in this method, its implementation should always call the base class method with the same ! name to access any attributes it needs to access, for example, \samp{object.__getattribute__(self, name)}. \end{methoddesc} --- 1212,1216 ---- In order to avoid infinite recursion in this method, its implementation should always call the base class method with the same ! name to access any attributes it needs, for example, \samp{object.__getattribute__(self, name)}. \end{methoddesc} *************** *** 1219,1230 **** The following methods only apply when an instance of the class ! containing the method (a so-called \emph{descriptor} class) is in the class dictionary of another new-style class, known as the \emph{owner} class. In the examples below, ``the attribute'' refers to ! the attribute whose name is the key of the property in the accessed class' \code{__dict__}. \begin{methoddesc}[object]{__get__}{self, instance, owner} ! Called to get the attribute of the owner class (class attribute acess) or of an instance of that class (instance attribute acces). \var{owner} is always the owner class, while \var{instance} is the --- 1219,1230 ---- The following methods only apply when an instance of the class ! containing the method (a so-called \emph{descriptor} class) appears in the class dictionary of another new-style class, known as the \emph{owner} class. In the examples below, ``the attribute'' refers to ! the attribute whose name is the key of the property in the owner class' \code{__dict__}. \begin{methoddesc}[object]{__get__}{self, instance, owner} ! Called to get the attribute of the owner class (class attribute access) or of an instance of that class (instance attribute acces). \var{owner} is always the owner class, while \var{instance} is the From fdrake@users.sourceforge.net Thu Mar 20 18:22:53 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:22:53 -0800 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.82.4.7,1.82.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv3723 Modified Files: Tag: release22-maint ref3.tex Log Message: - backport portions of SF patch #700798: fixes and cleanups for descriptor info - use a TeX "tie" to prevent word-wrapping in "section x.y"-like text Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.82.4.7 retrieving revision 1.82.4.8 diff -C2 -d -r1.82.4.7 -r1.82.4.8 *** ref3.tex 19 Jan 2003 14:54:08 -0000 1.82.4.7 --- ref3.tex 20 Mar 2003 18:22:50 -0000 1.82.4.8 *************** *** 389,393 **** Dictionaries are mutable; they can be created by the ! \code{\{...\}} notation (see section \ref{dict}, ``Dictionary Displays''). --- 389,393 ---- Dictionaries are mutable; they can be created by the ! \code{\{...\}} notation (see section~\ref{dict}, ``Dictionary Displays''). *************** *** 400,404 **** \item[Callable types] These\obindex{callable} are the types to which the function call ! operation (see section \ref{calls}, ``Calls'') can be applied: \indexii{function}{call} \index{invocation} --- 400,404 ---- \item[Callable types] These\obindex{callable} are the types to which the function call ! operation (see section~\ref{calls}, ``Calls'') can be applied: \indexii{function}{call} \index{invocation} *************** *** 409,413 **** \item[User-defined functions] A user-defined function object is created by a function definition ! (see section \ref{function}, ``Function definitions''). It should be called with an argument list containing the same number of items as the function's formal --- 409,413 ---- \item[User-defined functions] A user-defined function object is created by a function definition ! (see section~\ref{function}, ``Function definitions''). It should be called with an argument list containing the same number of items as the function's formal *************** *** 577,582 **** \item[Modules] ! Modules are imported by the \keyword{import} statement (see section ! \ref{import}, ``The \keyword{import} statement''). A module object has a namespace implemented by a dictionary object (this is the dictionary referenced by the func_globals attribute of --- 577,582 ---- \item[Modules] ! Modules are imported by the \keyword{import} statement (see ! section~\ref{import}, ``The \keyword{import} statement''). A module object has a namespace implemented by a dictionary object (this is the dictionary referenced by the func_globals attribute of *************** *** 613,618 **** \item[Classes] ! Class objects are created by class definitions (see section ! \ref{class}, ``Class definitions''). A class has a namespace implemented by a dictionary object. Class attribute references are translated to --- 613,618 ---- \item[Classes] ! Class objects are created by class definitions (see ! section~\ref{class}, ``Class definitions''). A class has a namespace implemented by a dictionary object. Class attribute references are translated to *************** *** 684,688 **** Class instances can pretend to be numbers, sequences, or mappings if they have methods with certain special names. See ! section \ref{specialnames}, ``Special method names.'' \obindex{numeric} \obindex{sequence} --- 684,688 ---- Class instances can pretend to be numbers, sequences, or mappings if they have methods with certain special names. See ! section~\ref{specialnames}, ``Special method names.'' \obindex{numeric} \obindex{sequence} *************** *** 834,838 **** traceback. When an exception handler is entered, the stack trace is made available to the program. ! (See section \ref{try}, ``The \code{try} statement.'') It is accessible as \code{sys.exc_traceback}, and also as the third item of the tuple returned by \code{sys.exc_info()}. The latter is --- 834,838 ---- traceback. When an exception handler is entered, the stack trace is made available to the program. ! (See section~\ref{try}, ``The \code{try} statement.'') It is accessible as \code{sys.exc_traceback}, and also as the third item of the tuple returned by \code{sys.exc_info()}. The latter is From tim_one@users.sourceforge.net Thu Mar 20 18:31:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:31:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_struct.py,1.14,1.14.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv6172/Lib/test Modified Files: Tag: release22-maint test_struct.py Log Message: SF bug 705836: struct.pack of floats in non-native endian order pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Index: test_struct.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_struct.py,v retrieving revision 1.14 retrieving revision 1.14.12.1 diff -C2 -d -r1.14 -r1.14.12.1 *** test_struct.py 15 Sep 2001 02:35:15 -0000 1.14 --- test_struct.py 20 Mar 2003 18:30:52 -0000 1.14.12.1 *************** *** 394,395 **** --- 394,441 ---- test_p_code() + + + ########################################################################### + # SF bug 705836. "f" had a severe rounding bug, where a carry + # from the low-order discarded bits could propagate into the exponent + # field, causing the result to be wrong by a factor of 2. + + def test_705836(): + import math + + for base in range(1, 33): + # smaller <- largest representable float less than base. + delta = 0.5 + while base - delta / 2.0 != base: + delta /= 2.0 + smaller = base - delta + # Packing this rounds away a solid string of trailing 1 bits. + packed = struct.pack("f", smaller) + verify(bigpacked == string_reverse(packed), + ">f pack should be byte-reversal of f", bigpacked)[0] + verify(base == unpacked) + + # Largest finite IEEE single. + big = (1 << 24) - 1 + big = math.ldexp(big, 127 - 23) + packed = struct.pack(">f", big) + unpacked = struct.unpack(">f", packed)[0] + verify(big == unpacked) + + # The same, but tack on a 1 bit so it rounds up to infinity. + big = (1 << 25) - 1 + big = math.ldexp(big, 127 - 24) + try: + packed = struct.pack(">f", big) + except OverflowError: + pass + else: + TestFailed("expected OverflowError") + + test_705836() From tim_one@users.sourceforge.net Thu Mar 20 18:31:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:31:30 -0800 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.73.2.1.2.3,2.73.2.1.2.4 structmodule.c,2.51.8.1,2.51.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv6172/Modules Modified Files: Tag: release22-maint cPickle.c structmodule.c Log Message: SF bug 705836: struct.pack of floats in non-native endian order pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.73.2.1.2.3 retrieving revision 2.73.2.1.2.4 diff -C2 -d -r2.73.2.1.2.3 -r2.73.2.1.2.4 *** cPickle.c 24 Sep 2002 11:53:34 -0000 2.73.2.1.2.3 --- cPickle.c 20 Mar 2003 18:31:13 -0000 2.73.2.1.2.4 *************** *** 706,710 **** static int put(Picklerobject *self, PyObject *ob) { ! if (ob->ob_refcnt < 2 || self->fast) return 0; --- 706,710 ---- static int put(Picklerobject *self, PyObject *ob) { ! if (ob->ob_refcnt < 2 || self->fast) return 0; *************** *** 922,926 **** } ! int fast_save_leave(Picklerobject *self, PyObject *obj) { --- 922,926 ---- } ! int fast_save_leave(Picklerobject *self, PyObject *obj) { *************** *** 1065,1074 **** } ! if (e >= 1024) { ! /* XXX 1024 itself is reserved for Inf/NaN */ ! PyErr_SetString(PyExc_OverflowError, ! "float too large to pack with d format"); ! return -1; ! } else if (e < -1022) { /* Gradual underflow */ --- 1065,1070 ---- } ! if (e >= 1024) ! goto Overflow; else if (e < -1022) { /* Gradual underflow */ *************** *** 1084,1090 **** --- 1080,1103 ---- f *= 268435456.0; /* 2**28 */ fhi = (long) floor(f); /* Truncate */ + assert(fhi < 268435456); + f -= (double)fhi; f *= 16777216.0; /* 2**24 */ flo = (long) floor(f + 0.5); /* Round */ + assert(flo <= 16777216); + if (flo >> 24) { + /* The carry propagated out of a string of 24 1 bits. */ + flo = 0; + ++fhi; + if (fhi >> 28) { + /* And it also progagated out of the next + * 28 bits. + */ + fhi = 0; + ++e; + if (e >= 2047) + goto Overflow; + } + } /* First byte */ *************** *** 1132,1135 **** --- 1145,1153 ---- return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with d format"); + return -1; } *************** *** 2104,2110 **** static PyObject * Pickle_clear_memo(Picklerobject *self, PyObject *args) { ! if (!PyArg_ParseTuple(args,":clear_memo")) return NULL; ! if (self->memo) PyDict_Clear(self->memo); Py_INCREF(Py_None); --- 2122,2128 ---- static PyObject * Pickle_clear_memo(Picklerobject *self, PyObject *args) { ! if (!PyArg_ParseTuple(args,":clear_memo")) return NULL; ! if (self->memo) PyDict_Clear(self->memo); Py_INCREF(Py_None); *************** *** 2121,2125 **** /* Can be called by Python code or C code */ ! if (args && !PyArg_ParseTuple(args, "|i:getvalue", &clear)) return NULL; --- 2139,2143 ---- /* Can be called by Python code or C code */ ! if (args && !PyArg_ParseTuple(args, "|i:getvalue", &clear)) return NULL; *************** *** 2483,2487 **** static PyGetSetDef Pickler_getsets[] = { ! {"persistent_id", (getter)Pickler_get_pers_func, (setter)Pickler_set_pers_func}, {"inst_persistent_id", NULL, (setter)Pickler_set_inst_pers_func}, --- 2501,2505 ---- static PyGetSetDef Pickler_getsets[] = { ! {"persistent_id", (getter)Pickler_get_pers_func, (setter)Pickler_set_pers_func}, {"inst_persistent_id", NULL, (setter)Pickler_set_inst_pers_func}, Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.51.8.1 retrieving revision 2.51.8.2 diff -C2 -d -r2.51.8.1 -r2.51.8.2 *** structmodule.c 23 Sep 2002 20:54:04 -0000 2.51.8.1 --- structmodule.c 20 Mar 2003 18:31:20 -0000 2.51.8.2 *************** *** 226,235 **** } ! if (e >= 128) { ! /* XXX 128 itself is reserved for Inf/NaN */ ! PyErr_SetString(PyExc_OverflowError, ! "float too large to pack with f format"); ! return -1; ! } else if (e < -126) { /* Gradual underflow */ --- 226,231 ---- } ! if (e >= 128) ! goto Overflow; else if (e < -126) { /* Gradual underflow */ *************** *** 244,247 **** --- 240,251 ---- f *= 8388608.0; /* 2**23 */ fbits = (long) floor(f + 0.5); /* Round */ + assert(fbits <= 8388608); + if (fbits >> 23) { + /* The carry propagated out of a string of 23 1 bits. */ + fbits = 0; + ++e; + if (e >= 255) + goto Overflow; + } /* First byte */ *************** *** 262,265 **** --- 266,274 ---- /* Done */ return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with f format"); + return -1; } *************** *** 297,306 **** } ! if (e >= 1024) { ! /* XXX 1024 itself is reserved for Inf/NaN */ ! PyErr_SetString(PyExc_OverflowError, ! "float too large to pack with d format"); ! return -1; ! } else if (e < -1022) { /* Gradual underflow */ --- 306,311 ---- } ! if (e >= 1024) ! goto Overflow; else if (e < -1022) { /* Gradual underflow */ *************** *** 316,322 **** --- 321,342 ---- f *= 268435456.0; /* 2**28 */ fhi = (long) floor(f); /* Truncate */ + assert(fhi < 268435456); + f -= (double)fhi; f *= 16777216.0; /* 2**24 */ flo = (long) floor(f + 0.5); /* Round */ + assert(flo <= 16777216); + if (flo >> 24) { + /* The carry propagated out of a string of 24 1 bits. */ + flo = 0; + ++fhi; + if (fhi >> 28) { + /* And it also progagated out of the next 28 bits. */ + fhi = 0; + ++e; + if (e >= 2047) + goto Overflow; + } + } /* First byte */ *************** *** 354,357 **** --- 374,382 ---- /* Done */ return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with d format"); + return -1; } From tim_one@users.sourceforge.net Thu Mar 20 18:31:45 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:31:45 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.67,1.337.2.4.2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv6172/Misc Modified Files: Tag: release22-maint NEWS Log Message: SF bug 705836: struct.pack of floats in non-native endian order pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.67 retrieving revision 1.337.2.4.2.68 diff -C2 -d -r1.337.2.4.2.67 -r1.337.2.4.2.68 *** NEWS 12 Mar 2003 14:28:21 -0000 1.337.2.4.2.67 --- NEWS 20 Mar 2003 18:30:55 -0000 1.337.2.4.2.68 *************** *** 3,6 **** --- 3,14 ---- ============================ + - SF #705836: The platform-independent routines for packing floats in + IEEE formats (struct.pack's f, d codes; pickle and + cPickle's protocol 1 pickling of floats) ignored that rounding can + cause a carry to propagate. The worst consequence was that, in rare + cases, f could produce strings that, when unpacked again, + were a factor of 2 away from the original float. This has been + fixed. + - Backported SF patch #676342: after using pdb, the readline command completion was botched. *************** *** 32,36 **** 2.2.3 and 2.3. (SF #660455) ! - SF bug #678518: fix some bugs in the parser module. - Bastion.py and rexec.py are disabled. These modules are not safe in --- 40,44 ---- 2.2.3 and 2.3. (SF #660455) ! - SF bug #678518: fix some bugs in the parser module. - Bastion.py and rexec.py are disabled. These modules are not safe in *************** *** 104,108 **** - SF #570655, fix misleading option text for bdist_rpm ! - Distutils: Allow unknown keyword arguments to the setup() function and the Extension constructor, printing a warning about them instead of reporting an error and stopping. --- 112,116 ---- - SF #570655, fix misleading option text for bdist_rpm ! - Distutils: Allow unknown keyword arguments to the setup() function and the Extension constructor, printing a warning about them instead of reporting an error and stopping. *************** *** 420,424 **** - The randint() method is rehabilitated (i.e. no longer deprecated). ! - In copy.py: when an object is copied through its __reduce__ method, there was no check for a __setstate__ method on the result [SF --- 428,432 ---- - The randint() method is rehabilitated (i.e. no longer deprecated). ! - In copy.py: when an object is copied through its __reduce__ method, there was no check for a __setstate__ method on the result [SF From tim_one@users.sourceforge.net Thu Mar 20 18:32:39 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:32:39 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_struct.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv9471/Lib/test Modified Files: test_struct.py Log Message: SF bug 705836: struct.pack of floats in non-native endian order pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Bugfix candidate, but I already backported this to 2.2. In 2.3, this code remains in severe need of refactoring. Index: test_struct.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_struct.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_struct.py 27 Feb 2003 20:14:50 -0000 1.16 --- test_struct.py 20 Mar 2003 18:31:59 -0000 1.17 *************** *** 391,392 **** --- 391,438 ---- test_p_code() + + + ########################################################################### + # SF bug 705836. "f" had a severe rounding bug, where a carry + # from the low-order discarded bits could propagate into the exponent + # field, causing the result to be wrong by a factor of 2. + + def test_705836(): + import math + + for base in range(1, 33): + # smaller <- largest representable float less than base. + delta = 0.5 + while base - delta / 2.0 != base: + delta /= 2.0 + smaller = base - delta + # Packing this rounds away a solid string of trailing 1 bits. + packed = struct.pack("f", smaller) + verify(bigpacked == string_reverse(packed), + ">f pack should be byte-reversal of f", bigpacked)[0] + verify(base == unpacked) + + # Largest finite IEEE single. + big = (1 << 24) - 1 + big = math.ldexp(big, 127 - 23) + packed = struct.pack(">f", big) + unpacked = struct.unpack(">f", packed)[0] + verify(big == unpacked) + + # The same, but tack on a 1 bit so it rounds up to infinity. + big = (1 << 25) - 1 + big = math.ldexp(big, 127 - 24) + try: + packed = struct.pack(">f", big) + except OverflowError: + pass + else: + TestFailed("expected OverflowError") + + test_705836() From tim_one@users.sourceforge.net Thu Mar 20 18:32:51 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:32:51 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.699,1.700 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9471/Misc Modified Files: NEWS Log Message: SF bug 705836: struct.pack of floats in non-native endian order pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Bugfix candidate, but I already backported this to 2.2. In 2.3, this code remains in severe need of refactoring. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.699 retrieving revision 1.700 diff -C2 -d -r1.699 -r1.700 *** NEWS 19 Mar 2003 00:35:35 -0000 1.699 --- NEWS 20 Mar 2003 18:32:03 -0000 1.700 *************** *** 38,41 **** --- 38,49 ---- ----------------- + - The platform-independent routines for packing floats in IEEE formats + (struct.pack's f, d codes; pickle and cPickle's protocol 1 + pickling of floats) ignored that rounding can cause a carry to + propagate. The worst consequence was that, in rare cases, f + could produce strings that, when unpacked again, were a factor of 2 + away from the original float. This has been fixed. See SF bug + #705836. + - New function time.tzset() provides access to the C library tzet() function, if supported. (SF patch #675422.) From tim_one@users.sourceforge.net Thu Mar 20 18:32:18 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 10:32:18 -0800 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.140,2.141 structmodule.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9471/Modules Modified Files: cPickle.c structmodule.c Log Message: SF bug 705836: struct.pack of floats in non-native endian order pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Bugfix candidate, but I already backported this to 2.2. In 2.3, this code remains in severe need of refactoring. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.140 retrieving revision 2.141 diff -C2 -d -r2.140 -r2.141 *** cPickle.c 19 Feb 2003 01:45:13 -0000 2.140 --- cPickle.c 20 Mar 2003 18:32:08 -0000 2.141 *************** *** 1157,1166 **** } ! if (e >= 1024) { ! /* XXX 1024 itself is reserved for Inf/NaN */ ! PyErr_SetString(PyExc_OverflowError, ! "float too large to pack with d format"); ! return -1; ! } else if (e < -1022) { /* Gradual underflow */ --- 1157,1162 ---- } ! if (e >= 1024) ! goto Overflow; else if (e < -1022) { /* Gradual underflow */ *************** *** 1177,1183 **** --- 1173,1196 ---- f *= 268435456.0; /* 2**28 */ fhi = (long) floor(f); /* Truncate */ + assert(fhi < 268435456); + f -= (double)fhi; f *= 16777216.0; /* 2**24 */ flo = (long) floor(f + 0.5); /* Round */ + assert(flo <= 16777216); + if (flo >> 24) { + /* The carry propagated out of a string of 24 1 bits. */ + flo = 0; + ++fhi; + if (fhi >> 28) { + /* And it also progagated out of the next + * 28 bits. + */ + fhi = 0; + ++e; + if (e >= 2047) + goto Overflow; + } + } /* First byte */ *************** *** 1225,1228 **** --- 1238,1246 ---- return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with d format"); + return -1; } Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** structmodule.c 3 Sep 2002 18:42:21 -0000 2.57 --- structmodule.c 20 Mar 2003 18:32:13 -0000 2.58 *************** *** 225,234 **** } ! if (e >= 128) { ! /* XXX 128 itself is reserved for Inf/NaN */ ! PyErr_SetString(PyExc_OverflowError, ! "float too large to pack with f format"); ! return -1; ! } else if (e < -126) { /* Gradual underflow */ --- 225,230 ---- } ! if (e >= 128) ! goto Overflow; else if (e < -126) { /* Gradual underflow */ *************** *** 243,246 **** --- 239,250 ---- f *= 8388608.0; /* 2**23 */ fbits = (long) floor(f + 0.5); /* Round */ + assert(fbits <= 8388608); + if (fbits >> 23) { + /* The carry propagated out of a string of 23 1 bits. */ + fbits = 0; + ++e; + if (e >= 255) + goto Overflow; + } /* First byte */ *************** *** 261,264 **** --- 265,273 ---- /* Done */ return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with f format"); + return -1; } *************** *** 296,305 **** } ! if (e >= 1024) { ! /* XXX 1024 itself is reserved for Inf/NaN */ ! PyErr_SetString(PyExc_OverflowError, ! "float too large to pack with d format"); ! return -1; ! } else if (e < -1022) { /* Gradual underflow */ --- 305,310 ---- } ! if (e >= 1024) ! goto Overflow; else if (e < -1022) { /* Gradual underflow */ *************** *** 315,321 **** --- 320,341 ---- f *= 268435456.0; /* 2**28 */ fhi = (long) floor(f); /* Truncate */ + assert(fhi < 268435456); + f -= (double)fhi; f *= 16777216.0; /* 2**24 */ flo = (long) floor(f + 0.5); /* Round */ + assert(flo <= 16777216); + if (flo >> 24) { + /* The carry propagated out of a string of 24 1 bits. */ + flo = 0; + ++fhi; + if (fhi >> 28) { + /* And it also progagated out of the next 28 bits. */ + fhi = 0; + ++e; + if (e >= 2047) + goto Overflow; + } + } /* First byte */ *************** *** 353,356 **** --- 373,381 ---- /* Done */ return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with d format"); + return -1; } From tim_one@users.sourceforge.net Thu Mar 20 20:54:03 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 12:54:03 -0800 Subject: [Python-checkins] python/dist/src/Include floatobject.h,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv6732/python/Include Modified Files: floatobject.h Log Message: New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is a refactoring to get all the duplicates of this delicate code out of the cPickle and struct modules. Index: floatobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/floatobject.h,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** floatobject.h 12 Aug 2002 07:21:56 -0000 2.21 --- floatobject.h 20 Mar 2003 20:53:29 -0000 2.22 *************** *** 48,51 **** --- 48,93 ---- PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v); + /* _PyFloat_{Pack,Unpack}{4,8} + * + * The struct and pickle (at least) modules need an efficient platform- + * independent way to store floating-point values as byte strings. + * The Pack routines produce a string from a C double, and the Unpack + * routines produce a C double from such a string. The suffix (4 or 8) + * specifies the number of bytes in the string. + * + * Excepting NaNs and infinities (which aren't handled correctly), the 4- + * byte format is identical to the IEEE-754 single precision format, and + * the 8-byte format to the IEEE-754 double precision format. On non- + * IEEE platforms with more precision, or larger dynamic range, than + * 754 supports, not all values can be packed; on non-IEEE platforms with + * less precision, or smaller dynamic range, not all values can be + * unpacked. What happens in such cases is partly accidental (alas). + */ + + /* The pack routines write 4 or 8 bytes, starting at p. le is a bool + * argument, true if you want the string in little-endian format (exponent + * last, at p+3 or p+7), false if you want big-endian format (exponent + * first, at p). + * Return value: 0 if all is OK, -1 if error (and an exception is + * set, most likely OverflowError). + * Bug: What this does is undefined if x is a NaN or infinity. + * Bug: -0.0 and +0.0 produce the same string. + */ + PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); + PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); + + /* The unpack routines read 4 or 8 bytes, starting at p. le is a bool + * argument, true if the string is in little-endian format (exponent + * last, at p+3 or p+7), false if big-endian (exponent first, at p). + * Return value: The unpacked double. On error, this is -1.0 and + * PyErr_Occurred() is true (and an exception is set, most likely + * OverflowError). + * Bug: What this does is undefined if the string represents a NaN or + * infinity. + */ + PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); + PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); + + #ifdef __cplusplus } From tim_one@users.sourceforge.net Thu Mar 20 20:53:34 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 12:53:34 -0800 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.141,2.142 structmodule.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv6732/python/Modules Modified Files: cPickle.c structmodule.c Log Message: New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is a refactoring to get all the duplicates of this delicate code out of the cPickle and struct modules. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.141 retrieving revision 2.142 diff -C2 -d -r2.141 -r2.142 *** cPickle.c 20 Mar 2003 18:32:08 -0000 2.141 --- cPickle.c 20 Mar 2003 20:53:30 -0000 2.142 *************** *** 1125,1228 **** if (self->bin) { - int s, e; - double f; - long fhi, flo; char str[9]; ! unsigned char *p = (unsigned char *)str; ! ! *p = BINFLOAT; ! p++; ! ! if (x < 0) { ! s = 1; ! x = -x; ! } ! else ! s = 0; ! ! f = frexp(x, &e); ! ! /* Normalize f to be in the range [1.0, 2.0) */ ! if (0.5 <= f && f < 1.0) { ! f *= 2.0; ! e--; ! } ! else if (f == 0.0) { ! e = 0; ! } ! else { ! PyErr_SetString(PyExc_SystemError, ! "frexp() result out of range"); return -1; - } - - if (e >= 1024) - goto Overflow; - else if (e < -1022) { - /* Gradual underflow */ - f = ldexp(f, 1022 + e); - e = 0; - } - else if (!(e == 0 && f == 0.0)) { - e += 1023; - f -= 1.0; /* Get rid of leading 1 */ - } - - /* fhi receives the high 28 bits; - flo the low 24 bits (== 52 bits) */ - f *= 268435456.0; /* 2**28 */ - fhi = (long) floor(f); /* Truncate */ - assert(fhi < 268435456); - - f -= (double)fhi; - f *= 16777216.0; /* 2**24 */ - flo = (long) floor(f + 0.5); /* Round */ - assert(flo <= 16777216); - if (flo >> 24) { - /* The carry propagated out of a string of 24 1 bits. */ - flo = 0; - ++fhi; - if (fhi >> 28) { - /* And it also progagated out of the next - * 28 bits. - */ - fhi = 0; - ++e; - if (e >= 2047) - goto Overflow; - } - } - - /* First byte */ - *p = (s<<7) | (e>>4); - p++; - - /* Second byte */ - *p = (unsigned char) (((e&0xF)<<4) | (fhi>>24)); - p++; - - /* Third byte */ - *p = (unsigned char) ((fhi>>16) & 0xFF); - p++; - - /* Fourth byte */ - *p = (unsigned char) ((fhi>>8) & 0xFF); - p++; - - /* Fifth byte */ - *p = (unsigned char) (fhi & 0xFF); - p++; - - /* Sixth byte */ - *p = (unsigned char) ((flo>>16) & 0xFF); - p++; - - /* Seventh byte */ - *p = (unsigned char) ((flo>>8) & 0xFF); - p++; - - /* Eighth byte */ - *p = (unsigned char) (flo & 0xFF); - if (self->write_func(self, str, 9) < 0) return -1; --- 1125,1132 ---- if (self->bin) { char str[9]; ! str[0] = BINFLOAT; ! if (_PyFloat_Pack8(x, (unsigned char *)&str[1], 0) < 0) return -1; if (self->write_func(self, str, 9) < 0) return -1; *************** *** 1238,1246 **** return 0; - - Overflow: - PyErr_SetString(PyExc_OverflowError, - "float too large to pack with d format"); - return -1; } --- 1142,1145 ---- *************** *** 3373,3379 **** load_binfloat(Unpicklerobject *self) { ! PyObject *py_float = 0; ! int s, e; ! long fhi, flo; double x; char *p; --- 3272,3276 ---- load_binfloat(Unpicklerobject *self) { ! PyObject *py_float; double x; char *p; *************** *** 3382,3434 **** return -1; ! /* First byte */ ! s = (*p>>7) & 1; ! e = (*p & 0x7F) << 4; ! p++; ! ! /* Second byte */ ! e |= (*p>>4) & 0xF; ! fhi = (*p & 0xF) << 24; ! p++; ! ! /* Third byte */ ! fhi |= (*p & 0xFF) << 16; ! p++; ! ! /* Fourth byte */ ! fhi |= (*p & 0xFF) << 8; ! p++; ! ! /* Fifth byte */ ! fhi |= *p & 0xFF; ! p++; ! ! /* Sixth byte */ ! flo = (*p & 0xFF) << 16; ! p++; ! ! /* Seventh byte */ ! flo |= (*p & 0xFF) << 8; ! p++; ! ! /* Eighth byte */ ! flo |= *p & 0xFF; ! ! x = (double)fhi + (double)flo / 16777216.0; /* 2**24 */ ! x /= 268435456.0; /* 2**28 */ ! ! /* XXX This sadly ignores Inf/NaN */ ! if (e == 0) ! e = -1022; ! else { ! x += 1.0; ! e -= 1023; ! } ! x = ldexp(x, e); ! ! if (s) ! x = -x; ! if (!( py_float = PyFloat_FromDouble(x))) return -1; PDATA_PUSH(self->stack, py_float, -1); --- 3279,3289 ---- return -1; ! x = _PyFloat_Unpack8((unsigned char *)p, 0); ! if (x == -1.0 && PyErr_Occurred()) ! return -1; ! py_float = PyFloat_FromDouble(x); ! if (py_float == NULL) ! return -1; PDATA_PUSH(self->stack, py_float, -1); Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** structmodule.c 20 Mar 2003 18:32:13 -0000 2.58 --- structmodule.c 20 Mar 2003 20:53:31 -0000 2.59 *************** *** 186,484 **** /* Floating point helpers */ - /* These use ANSI/IEEE Standard 754-1985 (Standard for Binary Floating - Point Arithmetic). See the following URL: - http://www.psc.edu/general/software/packages/ieee/ieee.html */ - - /* XXX Inf/NaN are not handled quite right (but underflow is!) */ - - static int - pack_float(double x, /* The number to pack */ - char *p, /* Where to pack the high order byte */ - int incr) /* 1 for big-endian; -1 for little-endian */ - { - int s; - int e; - double f; - long fbits; - - if (x < 0) { - s = 1; - x = -x; - } - else - s = 0; - - f = frexp(x, &e); - - /* Normalize f to be in the range [1.0, 2.0) */ - if (0.5 <= f && f < 1.0) { - f *= 2.0; - e--; - } - else if (f == 0.0) { - e = 0; - } - else { - PyErr_SetString(PyExc_SystemError, - "frexp() result out of range"); - return -1; - } - - if (e >= 128) - goto Overflow; - else if (e < -126) { - /* Gradual underflow */ - f = ldexp(f, 126 + e); - e = 0; - } - else if (!(e == 0 && f == 0.0)) { - e += 127; - f -= 1.0; /* Get rid of leading 1 */ - } - - f *= 8388608.0; /* 2**23 */ - fbits = (long) floor(f + 0.5); /* Round */ - assert(fbits <= 8388608); - if (fbits >> 23) { - /* The carry propagated out of a string of 23 1 bits. */ - fbits = 0; - ++e; - if (e >= 255) - goto Overflow; - } - - /* First byte */ - *p = (s<<7) | (e>>1); - p += incr; - - /* Second byte */ - *p = (char) (((e&1)<<7) | (fbits>>16)); - p += incr; - - /* Third byte */ - *p = (fbits>>8) & 0xFF; - p += incr; - - /* Fourth byte */ - *p = fbits&0xFF; - - /* Done */ - return 0; - - Overflow: - PyErr_SetString(PyExc_OverflowError, - "float too large to pack with f format"); - return -1; - } - - static int - pack_double(double x, /* The number to pack */ - char *p, /* Where to pack the high order byte */ - int incr) /* 1 for big-endian; -1 for little-endian */ - { - int s; - int e; - double f; - long fhi, flo; - - if (x < 0) { - s = 1; - x = -x; - } - else - s = 0; - - f = frexp(x, &e); - - /* Normalize f to be in the range [1.0, 2.0) */ - if (0.5 <= f && f < 1.0) { - f *= 2.0; - e--; - } - else if (f == 0.0) { - e = 0; - } - else { - PyErr_SetString(PyExc_SystemError, - "frexp() result out of range"); - return -1; - } - - if (e >= 1024) - goto Overflow; - else if (e < -1022) { - /* Gradual underflow */ - f = ldexp(f, 1022 + e); - e = 0; - } - else if (!(e == 0 && f == 0.0)) { - e += 1023; - f -= 1.0; /* Get rid of leading 1 */ - } - - /* fhi receives the high 28 bits; flo the low 24 bits (== 52 bits) */ - f *= 268435456.0; /* 2**28 */ - fhi = (long) floor(f); /* Truncate */ - assert(fhi < 268435456); - - f -= (double)fhi; - f *= 16777216.0; /* 2**24 */ - flo = (long) floor(f + 0.5); /* Round */ - assert(flo <= 16777216); - if (flo >> 24) { - /* The carry propagated out of a string of 24 1 bits. */ - flo = 0; - ++fhi; - if (fhi >> 28) { - /* And it also progagated out of the next 28 bits. */ - fhi = 0; - ++e; - if (e >= 2047) - goto Overflow; - } - } - - /* First byte */ - *p = (s<<7) | (e>>4); - p += incr; - - /* Second byte */ - *p = (char) (((e&0xF)<<4) | (fhi>>24)); - p += incr; - - /* Third byte */ - *p = (fhi>>16) & 0xFF; - p += incr; - - /* Fourth byte */ - *p = (fhi>>8) & 0xFF; - p += incr; - - /* Fifth byte */ - *p = fhi & 0xFF; - p += incr; - - /* Sixth byte */ - *p = (flo>>16) & 0xFF; - p += incr; - - /* Seventh byte */ - *p = (flo>>8) & 0xFF; - p += incr; - - /* Eighth byte */ - *p = flo & 0xFF; - p += incr; - - /* Done */ - return 0; - - Overflow: - PyErr_SetString(PyExc_OverflowError, - "float too large to pack with d format"); - return -1; - } - static PyObject * ! unpack_float(const char *p, /* Where the high order byte is */ ! int incr) /* 1 for big-endian; -1 for little-endian */ { - int s; - int e; - long f; double x; ! /* First byte */ ! s = (*p>>7) & 1; ! e = (*p & 0x7F) << 1; ! p += incr; ! ! /* Second byte */ ! e |= (*p>>7) & 1; ! f = (*p & 0x7F) << 16; ! p += incr; ! ! /* Third byte */ ! f |= (*p & 0xFF) << 8; ! p += incr; ! ! /* Fourth byte */ ! f |= *p & 0xFF; ! ! x = (double)f / 8388608.0; ! ! /* XXX This sadly ignores Inf/NaN issues */ ! if (e == 0) ! e = -126; ! else { ! x += 1.0; ! e -= 127; ! } ! x = ldexp(x, e); ! ! if (s) ! x = -x; ! return PyFloat_FromDouble(x); } static PyObject * ! unpack_double(const char *p, /* Where the high order byte is */ ! int incr) /* 1 for big-endian; -1 for little-endian */ { - int s; - int e; - long fhi, flo; double x; ! /* First byte */ ! s = (*p>>7) & 1; ! e = (*p & 0x7F) << 4; ! p += incr; ! ! /* Second byte */ ! e |= (*p>>4) & 0xF; ! fhi = (*p & 0xF) << 24; ! p += incr; ! ! /* Third byte */ ! fhi |= (*p & 0xFF) << 16; ! p += incr; ! ! /* Fourth byte */ ! fhi |= (*p & 0xFF) << 8; ! p += incr; ! ! /* Fifth byte */ ! fhi |= *p & 0xFF; ! p += incr; ! ! /* Sixth byte */ ! flo = (*p & 0xFF) << 16; ! p += incr; ! ! /* Seventh byte */ ! flo |= (*p & 0xFF) << 8; ! p += incr; ! ! /* Eighth byte */ ! flo |= *p & 0xFF; ! p += incr; ! ! x = (double)fhi + (double)flo / 16777216.0; /* 2**24 */ ! x /= 268435456.0; /* 2**28 */ ! ! /* XXX This sadly ignores Inf/NaN */ ! if (e == 0) ! e = -1022; ! else { ! x += 1.0; ! e -= 1023; ! } ! x = ldexp(x, e); ! ! if (s) ! x = -x; ! return PyFloat_FromDouble(x); } --- 186,210 ---- /* Floating point helpers */ static PyObject * ! unpack_float(const char *p, /* start of 4-byte string */ ! int le) /* true for little-endian, false for big-endian */ { double x; ! x = _PyFloat_Unpack4((unsigned char *)p, le); ! if (x == -1.0 && PyErr_Occurred()) ! return NULL; return PyFloat_FromDouble(x); } static PyObject * ! unpack_double(const char *p, /* start of 8-byte string */ ! int le) /* true for little-endian, false for big-endian */ { double x; ! x = _PyFloat_Unpack8((unsigned char *)p, le); ! if (x == -1.0 && PyErr_Occurred()) ! return NULL; return PyFloat_FromDouble(x); } *************** *** 888,892 **** bu_float(const char *p, const formatdef *f) { ! return unpack_float(p, 1); } --- 614,618 ---- bu_float(const char *p, const formatdef *f) { ! return unpack_float(p, 0); } *************** *** 894,898 **** bu_double(const char *p, const formatdef *f) { ! return unpack_double(p, 1); } --- 620,624 ---- bu_double(const char *p, const formatdef *f) { ! return unpack_double(p, 0); } *************** *** 968,972 **** return -1; } ! return pack_float(x, p, 1); } --- 694,698 ---- return -1; } ! return _PyFloat_Pack4(x, (unsigned char *)p, 0); } *************** *** 980,984 **** return -1; } ! return pack_double(x, p, 1); } --- 706,710 ---- return -1; } ! return _PyFloat_Pack8(x, (unsigned char *)p, 0); } *************** *** 1054,1058 **** lu_float(const char *p, const formatdef *f) { ! return unpack_float(p+3, -1); } --- 780,784 ---- lu_float(const char *p, const formatdef *f) { ! return unpack_float(p, 1); } *************** *** 1060,1064 **** lu_double(const char *p, const formatdef *f) { ! return unpack_double(p+7, -1); } --- 786,790 ---- lu_double(const char *p, const formatdef *f) { ! return unpack_double(p, 1); } *************** *** 1134,1138 **** return -1; } ! return pack_float(x, p+3, -1); } --- 860,864 ---- return -1; } ! return _PyFloat_Pack4(x, (unsigned char *)p, 1); } *************** *** 1146,1150 **** return -1; } ! return pack_double(x, p+7, -1); } --- 872,876 ---- return -1; } ! return _PyFloat_Pack8(x, (unsigned char *)p, 1); } From tim_one@users.sourceforge.net Thu Mar 20 20:53:35 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 12:53:35 -0800 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.120,2.121 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv6732/python/Objects Modified Files: floatobject.c Log Message: New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is a refactoring to get all the duplicates of this delicate code out of the cPickle and struct modules. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.120 retrieving revision 2.121 diff -C2 -d -r2.120 -r2.121 *** floatobject.c 29 Jan 2003 17:58:45 -0000 2.120 --- floatobject.c 20 Mar 2003 20:53:32 -0000 2.121 *************** *** 905,906 **** --- 905,1219 ---- } } + + /*---------------------------------------------------------------------------- + * _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h. + * + * TODO: On platforms that use the standard IEEE-754 single and double + * formats natively, these routines could simply copy the bytes. + */ + int + _PyFloat_Pack4(double x, unsigned char *p, int le) + { + unsigned char sign; + int e; + double f; + unsigned int fbits; + int incr = 1; + + if (le) { + p += 3; + incr = -1; + } + + if (x < 0) { + sign = 1; + x = -x; + } + else + sign = 0; + + f = frexp(x, &e); + + /* Normalize f to be in the range [1.0, 2.0) */ + if (0.5 <= f && f < 1.0) { + f *= 2.0; + e--; + } + else if (f == 0.0) + e = 0; + else { + PyErr_SetString(PyExc_SystemError, + "frexp() result out of range"); + return -1; + } + + if (e >= 128) + goto Overflow; + else if (e < -126) { + /* Gradual underflow */ + f = ldexp(f, 126 + e); + e = 0; + } + else if (!(e == 0 && f == 0.0)) { + e += 127; + f -= 1.0; /* Get rid of leading 1 */ + } + + f *= 8388608.0; /* 2**23 */ + fbits = (long) floor(f + 0.5); /* Round */ + assert(fbits <= 8388608); + if (fbits >> 23) { + /* The carry propagated out of a string of 23 1 bits. */ + fbits = 0; + ++e; + if (e >= 255) + goto Overflow; + } + + /* First byte */ + *p = (sign << 7) | (e >> 1); + p += incr; + + /* Second byte */ + *p = (char) (((e & 1) << 7) | (fbits >> 16)); + p += incr; + + /* Third byte */ + *p = (fbits >> 8) & 0xFF; + p += incr; + + /* Fourth byte */ + *p = fbits & 0xFF; + + /* Done */ + return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with f format"); + return -1; + } + + int + _PyFloat_Pack8(double x, unsigned char *p, int le) + { + unsigned char sign; + int e; + double f; + unsigned int fhi, flo; + int incr = 1; + + if (le) { + p += 7; + incr = -1; + } + + if (x < 0) { + sign = 1; + x = -x; + } + else + sign = 0; + + f = frexp(x, &e); + + /* Normalize f to be in the range [1.0, 2.0) */ + if (0.5 <= f && f < 1.0) { + f *= 2.0; + e--; + } + else if (f == 0.0) + e = 0; + else { + PyErr_SetString(PyExc_SystemError, + "frexp() result out of range"); + return -1; + } + + if (e >= 1024) + goto Overflow; + else if (e < -1022) { + /* Gradual underflow */ + f = ldexp(f, 1022 + e); + e = 0; + } + else if (!(e == 0 && f == 0.0)) { + e += 1023; + f -= 1.0; /* Get rid of leading 1 */ + } + + /* fhi receives the high 28 bits; flo the low 24 bits (== 52 bits) */ + f *= 268435456.0; /* 2**28 */ + fhi = (unsigned int)f; /* Truncate */ + assert(fhi < 268435456); + + f -= (double)fhi; + f *= 16777216.0; /* 2**24 */ + flo = (unsigned int)(f + 0.5); /* Round */ + assert(flo <= 16777216); + if (flo >> 24) { + /* The carry propagated out of a string of 24 1 bits. */ + flo = 0; + ++fhi; + if (fhi >> 28) { + /* And it also progagated out of the next 28 bits. */ + fhi = 0; + ++e; + if (e >= 2047) + goto Overflow; + } + } + + /* First byte */ + *p = (sign << 7) | (e >> 4); + p += incr; + + /* Second byte */ + *p = (unsigned char) (((e & 0xF) << 4) | (fhi >> 24)); + p += incr; + + /* Third byte */ + *p = (fhi >> 16) & 0xFF; + p += incr; + + /* Fourth byte */ + *p = (fhi >> 8) & 0xFF; + p += incr; + + /* Fifth byte */ + *p = fhi & 0xFF; + p += incr; + + /* Sixth byte */ + *p = (flo >> 16) & 0xFF; + p += incr; + + /* Seventh byte */ + *p = (flo >> 8) & 0xFF; + p += incr; + + /* Eighth byte */ + *p = flo & 0xFF; + p += incr; + + /* Done */ + return 0; + + Overflow: + PyErr_SetString(PyExc_OverflowError, + "float too large to pack with d format"); + return -1; + } + + double + _PyFloat_Unpack4(const unsigned char *p, int le) + { + unsigned char sign; + int e; + unsigned int f; + double x; + int incr = 1; + + if (le) { + p += 3; + incr = -1; + } + + /* First byte */ + sign = (*p >> 7) & 1; + e = (*p & 0x7F) << 1; + p += incr; + + /* Second byte */ + e |= (*p >> 7) & 1; + f = (*p & 0x7F) << 16; + p += incr; + + /* Third byte */ + f |= *p << 8; + p += incr; + + /* Fourth byte */ + f |= *p; + + x = (double)f / 8388608.0; + + /* XXX This sadly ignores Inf/NaN issues */ + if (e == 0) + e = -126; + else { + x += 1.0; + e -= 127; + } + x = ldexp(x, e); + + if (sign) + x = -x; + + return x; + } + + double + _PyFloat_Unpack8(const unsigned char *p, int le) + { + unsigned char sign; + int e; + unsigned int fhi, flo; + double x; + int incr = 1; + + if (le) { + p += 7; + incr = -1; + } + + /* First byte */ + sign = (*p >> 7) & 1; + e = (*p & 0x7F) << 4; + p += incr; + + /* Second byte */ + e |= (*p >> 4) & 0xF; + fhi = (*p & 0xF) << 24; + p += incr; + + /* Third byte */ + fhi |= *p << 16; + p += incr; + + /* Fourth byte */ + fhi |= *p << 8; + p += incr; + + /* Fifth byte */ + fhi |= *p; + p += incr; + + /* Sixth byte */ + flo = *p << 16; + p += incr; + + /* Seventh byte */ + flo |= *p << 8; + p += incr; + + /* Eighth byte */ + flo |= *p; + + x = (double)fhi + (double)flo / 16777216.0; /* 2**24 */ + x /= 268435456.0; /* 2**28 */ + + /* XXX This sadly ignores Inf/NaN */ + if (e == 0) + e = -1022; + else { + x += 1.0; + e -= 1023; + } + x = ldexp(x, e); + + if (sign) + x = -x; + + return x; + } From jvr@users.sourceforge.net Thu Mar 20 21:37:50 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 20 Mar 2003 13:37:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv2916 Modified Files: bundlebuilder.py Log Message: set $PYTHONHOME in the bootstrap script, for no good reason really, except to avoid getpath.c giving unsollicited advice on stderr. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** bundlebuilder.py 5 Mar 2003 14:44:54 -0000 1.20 --- bundlebuilder.py 20 Mar 2003 21:37:05 -0000 1.21 *************** *** 273,276 **** --- 273,277 ---- sys.argv.insert(1, mainprogram) os.environ["PYTHONPATH"] = resdir + os.environ["PYTHONHOME"] = resdir os.environ["PYTHONEXECUTABLE"] = executable os.execve(executable, sys.argv, os.environ) From fdrake@users.sourceforge.net Thu Mar 20 22:18:02 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 20 Mar 2003 14:18:02 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23654 Modified Files: libstdtypes.tex Log Message: - added example of using a comparison function with list.sort(), and explained the construction of a [(key, value), ...] list as an alternative - note that support for cmpfunc=None was added in 2.3 Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** libstdtypes.tex 6 Mar 2003 23:54:27 -0000 1.120 --- libstdtypes.tex 20 Mar 2003 22:17:59 -0000 1.121 *************** *** 1000,1009 **** the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process ! down considerably; e.g. to sort a list in reverse order it is much ! faster to call method \method{sort()} followed by \method{reverse()} ! than to use method \method{sort()} with a comparison function that reverses the ordering of the elements. Passing \constant{None} as the comparison function is semantically equivalent to calling \method{sort()} with no comparison function. \item[(9)] Whether the \method{sort()} method is stable is not defined by --- 1000,1031 ---- the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process ! down considerably; for example to sort a list in reverse order it is much ! faster to call \method{sort()} followed by \method{reverse()} ! than to use \method{sort()} with a comparison function that reverses the ordering of the elements. Passing \constant{None} as the comparison function is semantically equivalent to calling \method{sort()} with no comparison function. + \versionchanged[Support for \code{None} as an equivalent to omitting + \var{cmpfunc} was added]{2.3} + + As an example of using the \var{cmpfunc} argument to the + \method{sort()} method, consider sorting a list of sequences by the + second element of that list: + + \begin{verbatim} + def mycmp(a, b): + return cmp(a[1], b[1]) + + mylist.sort(mycmp) + \end{verbatim} + + A more time-efficient approach for reasonably-sized data structures can + often be used: + + \begin{verbatim} + tmplist = [(x[1], x) for x in mylist] + tmplist.sort() + mylist = [x for (key, x) in tmplist] + \end{verbatim} \item[(9)] Whether the \method{sort()} method is stable is not defined by From fdrake@users.sourceforge.net Thu Mar 20 22:20:53 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 20 Mar 2003 14:20:53 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.20,1.80.6.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24949a Modified Files: Tag: release22-maint libstdtypes.tex Log Message: - added example of using a comparison function with list.sort(), and explained the construction of a [(key, value), ...] list as an alternative - backport additional notes on list use from Python 2.3 documentation; mostly warnings about what not to rely on Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.20 retrieving revision 1.80.6.21 diff -C2 -d -r1.80.6.20 -r1.80.6.21 *** libstdtypes.tex 4 Mar 2003 00:50:20 -0000 1.80.6.20 --- libstdtypes.tex 20 Mar 2003 22:20:43 -0000 1.80.6.21 *************** *** 922,926 **** {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 922,926 ---- {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7), (8), (9)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} *************** *** 965,973 **** the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process ! down considerably; e.g. to sort a list in reverse order it is much ! faster to use calls to the methods \method{sort()} and ! \method{reverse()} than to use the built-in function ! \function{sort()} with a comparison function that reverses the ! ordering of the elements. \end{description} --- 965,1002 ---- the first argument is considered smaller than, equal to, or larger than the second argument. Note that this slows the sorting process ! down considerably; for example, to sort a list in reverse order it is much ! faster to call \method{sort()} followed by \method{reverse()} ! than to use \method{sort()} with a comparison function that ! reverses the ordering of the elements. ! ! As an example of using the \var{cmpfunc} argument to the ! \method{sort()} method, consider sorting a list of sequences by the ! second element of that list: ! ! \begin{verbatim} ! def mycmp(a, b): ! return cmp(a[1], b[1]) ! ! mylist.sort(mycmp) ! \end{verbatim} ! ! A more time-efficient approach for reasonably-sized data structures can ! often be used: ! ! \begin{verbatim} ! tmplist = [(x[1], x) for x in mylist] ! tmplist.sort() ! mylist = [x for (key, x) in tmplist] ! \end{verbatim} ! ! \item[(8)] Whether the \method{sort()} method is stable is not defined by ! the language (a sort is stable if it guarantees not to change the ! relative order of elements that compare equal). In the C ! implementation of Python, sorts were stable only by accident through ! Python 2.2. Code that intends to be portable across ! implementations and versions must not rely on stability. ! ! \item[(9)] While a list is being sorted, the effect of attempting to ! mutate, or even inspect, the list is undefined. \end{description} From montanaro@users.sourceforge.net Thu Mar 20 22:51:45 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 14:51:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/csv - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv In directory sc8-pr-cvs1:/tmp/cvs-serv7869/Lib/csv Log Message: Directory /cvsroot/python/python/dist/src/Lib/csv added to the repository From montanaro@users.sourceforge.net Thu Mar 20 23:29:14 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:29:14 -0800 Subject: [Python-checkins] python/dist/src/Modules _csv.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24199/Modules Added Files: _csv.c Log Message: new CSV file processing module - see PEP 305 --- NEW FILE: _csv.c --- /* TODO: */ #include "Python.h" #include "structmember.h" /* begin 2.2 compatibility macros */ #ifndef PyDoc_STRVAR /* Define macros for inline documentation. */ #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #ifdef WITH_DOC_STRINGS #define PyDoc_STR(str) str #else #define PyDoc_STR(str) "" #endif #endif /* ifndef PyDoc_STRVAR */ #ifndef PyMODINIT_FUNC [...1426 lines suppressed...] /* Add quote styles into dictionary */ for (style = quote_styles; style->name; style++) { v = PyInt_FromLong(style->style); if (v == NULL) return; res = PyModule_AddObject(module, style->name, v); if (res < 0) return; } /* Add the Dialect type */ if (PyModule_AddObject(module, "Dialect", (PyObject *)&Dialect_Type)) return; /* Add the CSV exception object to the module. */ error_obj = PyErr_NewException("_csv.Error", NULL, NULL); if (error_obj == NULL) return; PyModule_AddObject(module, "Error", error_obj); } From montanaro@users.sourceforge.net Thu Mar 20 23:29:14 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:29:14 -0800 Subject: [Python-checkins] python/dist/src/Lib/csv __init__.py,NONE,1.1 csv.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv In directory sc8-pr-cvs1:/tmp/cvs-serv24199/Lib/csv Added Files: __init__.py csv.py Log Message: new CSV file processing module - see PEP 305 --- NEW FILE: __init__.py --- --- NEW FILE: csv.py --- from _csv import Error, __version__, writer, reader, register_dialect, \ unregister_dialect, get_dialect, list_dialects, \ QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \ __doc__ __all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE", "Error", "Dialect", "excel", "excel_tab", "reader", "writer", "register_dialect", "get_dialect", "list_dialects", "unregister_dialect", "__version__", "DictReader", "DictWriter" ] class Dialect: _name = "" _valid = False # placeholders delimiter = None quotechar = None escapechar = None doublequote = None skipinitialspace = None lineterminator = None quoting = None def __init__(self): if self.__class__ != Dialect: self._valid = True errors = self._validate() if errors != []: raise Error, "Dialect did not validate: %s" % ", ".join(errors) def _validate(self): errors = [] if not self._valid: errors.append("can't directly instantiate Dialect class") if self.delimiter is None: errors.append("delimiter character not set") elif (not isinstance(self.delimiter, str) or len(self.delimiter) > 1): errors.append("delimiter must be one-character string") if self.quotechar is None: if self.quoting != QUOTE_NONE: errors.append("quotechar not set") elif (not isinstance(self.quotechar, str) or len(self.quotechar) > 1): errors.append("quotechar must be one-character string") if self.lineterminator is None: errors.append("lineterminator not set") elif not isinstance(self.lineterminator, str): errors.append("lineterminator must be a string") if self.doublequote not in (True, False): errors.append("doublequote parameter must be True or False") if self.skipinitialspace not in (True, False): errors.append("skipinitialspace parameter must be True or False") if self.quoting is None: errors.append("quoting parameter not set") if self.quoting is QUOTE_NONE: if (not isinstance(self.escapechar, (unicode, str)) or len(self.escapechar) > 1): errors.append("escapechar must be a one-character string or unicode object") return errors class excel(Dialect): delimiter = ',' quotechar = '"' doublequote = True skipinitialspace = False lineterminator = '\r\n' quoting = QUOTE_MINIMAL register_dialect("excel", excel) class excel_tab(excel): delimiter = '\t' register_dialect("excel-tab", excel_tab) class DictReader: def __init__(self, f, fieldnames, restkey=None, restval=None, dialect="excel", *args): self.fieldnames = fieldnames # list of keys for the dict self.restkey = restkey # key to catch long rows self.restval = restval # default value for short rows self.reader = reader(f, dialect, *args) def __iter__(self): return self def next(self): row = self.reader.next() # unlike the basic reader, we prefer not to return blanks, # because we will typically wind up with a dict full of None # values while row == []: row = self.reader.next() d = dict(zip(self.fieldnames, row)) lf = len(self.fieldnames) lr = len(row) if lf < lr: d[self.restkey] = row[lf:] elif lf > lr: for key in self.fieldnames[lr:]: d[key] = self.restval return d class DictWriter: def __init__(self, f, fieldnames, restval="", extrasaction="raise", dialect="excel", *args): self.fieldnames = fieldnames # list of keys for the dict self.restval = restval # for writing short dicts if extrasaction.lower() not in ("raise", "ignore"): raise ValueError, \ ("extrasaction (%s) must be 'raise' or 'ignore'" % extrasaction) self.extrasaction = extrasaction self.writer = writer(f, dialect, *args) def _dict_to_list(self, rowdict): if self.extrasaction == "raise": for k in rowdict.keys(): if k not in self.fieldnames: raise ValueError, "dict contains fields not in fieldnames" return [rowdict.get(key, self.restval) for key in self.fieldnames] def writerow(self, rowdict): return self.writer.writerow(self._dict_to_list(rowdict)) def writerows(self, rowdicts): rows = [] for rowdict in rowdicts: rows.append(self._dict_to_list(rowdict)) return self.writer.writerows(rows) From montanaro@users.sourceforge.net Thu Mar 20 23:29:14 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:29:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcsv.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24199/Doc/lib Added Files: libcsv.tex Log Message: new CSV file processing module - see PEP 305 --- NEW FILE: libcsv.tex --- \section{\module{csv} --- CSV File Reading and Writing} \declaremodule{standard}{csv} \modulesynopsis{Write and read tabular data to and from delimited files.} \versionadded{2.3} \index{csv} \indexii{data}{tabular} The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. There is no ``CSV standard'', so the format is operationally defined by the many applications which read and write it. The lack of a standard means that subtle differences often exist in the data produced and consumed by different applications. These differences can make it annoying to process CSV files from multiple sources. Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer. The \module{csv} module implements classes to read and write tabular data in CSV format. It allows programmers to say, ``write this data in the format preferred by Excel,'' or ``read data from this file which was generated by Excel,'' without knowing the precise details of the CSV format used by Excel. Programmers can also describe the CSV formats understood by other applications or define their own special-purpose CSV formats. The \module{csv} module's \class{reader} and \class{writer} objects read and write sequences. Programmers can also read and write data in dictionary form using the \class{DictReader} and \class{DictWriter} classes. \note{The first version of the \module{csv} module doesn't support Unicode input. Also, there are currently some issues regarding \ASCII{} NUL characters. Accordingly, all input should generally be plain \ASCII{} to be safe. These restrictions will be removed in the future.} \begin{seealso} % \seemodule{array}{Arrays of uniformly types numeric values.} \seepep{305}{CSV File API} {The Python Enhancement Proposal which proposed this addition to Python.} \end{seealso} \subsection{Module Contents} The \module{csv} module defines the following functions: \begin{funcdesc}{reader}{csvfile\optional{, dialect=\code{'excel'}\optional{, fmtparam}}} Return a reader object which will iterate over lines in the given {}\var{csvfile}. \var{csvfile} can be any object which supports the iterator protocol and returns a string each time its \method{next} method is called. An optional \var{dialect} parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the \class{Dialect} class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual formatting parameters in the current dialect. For more information about the dialect and formatting parameters, see section~\ref{fmt-params}, ``Dialects and Formatting Parameters'' for details of these parameters. All data read are returned as strings. No automatic data type conversion is performed. \end{funcdesc} \begin{funcdesc}{writer}{csvfile\optional{, dialect=\code{'excel'}\optional{, fmtparam}}} Return a writer object responsible for converting the user's data into delimited strings on the given file-like object. An optional {}\var{dialect} parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the \class{Dialect} class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual formatting parameters in the current dialect. For more information about the dialect and formatting parameters, see section~\ref{fmt-params}, ``Dialects and Formatting Parameters'' for details of these parameters. To make it as easy as possible to interface with modules which implement the DB API, the value \constant{None} is written as the empty string. While this isn't a reversible transformation, it makes it easier to dump SQL NULL data values to CSV files without preprocessing the data returned from a \code{cursor.fetch*()} call. All other non-string data are stringified with \function{str()} before being written. \end{funcdesc} \begin{funcdesc}{register_dialect}{name, dialect} Associate \var{dialect} with \var{name}. \var{dialect} must be a subclass of \class{csv.Dialect}. \var{name} must be a string or Unicode object. \end{funcdesc} \begin{funcdesc}{unregister_dialect}{name} Delete the dialect associated with \var{name} from the dialect registry. An \exception{Error} is raised if \var{name} is not a registered dialect name. \end{funcdesc} \begin{funcdesc}{get_dialect}{name} Return the dialect associated with \var{name}. An \exception{Error} is raised if \var{name} is not a registered dialect name. \end{funcdesc} \begin{funcdesc}{list_dialects}{} Return the names of all registered dialects. \end{funcdesc} The \module{csv} module defines the following classes: \begin{classdesc}{DictReader}{csvfile, fieldnames\optional{, restkey=\code{None}\optional{, restval=\code{None}\optional{, dialect=\code{'excel'}\optional{, fmtparam}}}}} Create an object which operates like a regular reader but maps the information read into a dict whose keys are given by the \var{fieldnames} parameter. If the row read has fewer fields than the fieldnames sequence, the value of \var{restval} will be used as the default value. If the row read has more fields than the fieldnames sequence, the remaining data is added as a sequence keyed by the value of \var{restkey}. If the row read has fewer fields than the fieldnames sequence, the remaining keys take the value of the optiona \var{restval} parameter. All other parameters are interpreted as for regular readers. \end{classdesc} \begin{classdesc}{DictWriter}{csvfile, fieldnames\optional{, restval=""\optional{, extrasaction=\code{'raise'}\optional{, dialect=\code{'excel'}\optional{, fmtparam}}}}} Create an object which operates like a regular writer but maps dictionaries onto output rows. The \var{fieldnames} parameter identifies the order in which values in the dictionary passed to the \method{writerow()} method are written to the \var{csvfile}. The optional \var{restval} parameter specifies the value to be written if the dictionary is missing a key in \var{fieldnames}. If the dictionary passed to the \method{writerow()} method contains a key not found in \var{fieldnames}, the optional \var{extrasaction} parameter indicates what action to take. If it is set to \code{'raise'} a \exception{ValueError} is raised. If it is set to \code{'ignore'}, extra values in the dictionary are ignored. All other parameters are interpreted as for regular writers. \end{classdesc} \begin{classdesc*}{Dialect}{} The \class{Dialect} class is a container class relied on primarily for its attributes, which are used to define the parameters for a specific \class{reader} or \class{writer} instance. Dialect objects support the following data attributes: \begin{memberdesc}[string]{delimiter} A one-character string used to separate fields. It defaults to \code{","}. \end{memberdesc} \begin{memberdesc}[boolean]{doublequote} Controls how instances of \var{quotechar} appearing inside a field should be themselves be quoted. When \constant{True}, the character is doubledd. When \constant{False}, the \var{escapechar} must be a one-character string which is used as a prefix to the \var{quotechar}. It defaults to \constant{True}. \end{memberdesc} \begin{memberdesc}{escapechar} A one-character string used to escape the \var{delimiter} if \var{quoting} is set to \constant{QUOTE_NONE}. It defaults to \constant{None}. \end{memberdesc} \begin{memberdesc}[string]{lineterminator} The string used to terminate lines in the CSV file. It defaults to \code{"\e r\e n"}. \end{memberdesc} \begin{memberdesc}[string]{quotechar} A one-character string used to quote elements containing the \var{delimiter} or which start with the \var{quotechar}. It defaults to \code{'"'}. \end{memberdesc} \begin{memberdesc}[integer]{quoting} Controls when quotes should be generated by the writer. It can take on any of the \code{QUOTE_*} constants defined below and defaults to \constant{QUOTE_MINIMAL}. \end{memberdesc} \begin{memberdesc}[boolean]{skipinitialspace} When \constant{True}, whitespace immediately following the \var{delimiter} is ignored. The default is \constant{False}. \end{memberdesc} \end{classdesc*} The \module{csv} module defines the following constants: \begin{datadesc}{QUOTE_ALWAYS} Instructs \class{writer} objects to quote all fields. \end{datadesc} \begin{datadesc}{QUOTE_MINIMAL} Instructs \class{writer} objects to only quote those fields which contain the current \var{delimiter} or begin with the current \var{quotechar}. \end{datadesc} \begin{datadesc}{QUOTE_NONNUMERIC} Instructs \class{writer} objects to quote all non-numeric fields. \end{datadesc} \begin{datadesc}{QUOTE_NONE} Instructs \class{writer} objects to never quote fields. When the current \var{delimiter} occurs in output data it is preceded by the current \var{escapechar} character. When \constant{QUOTE_NONE} is in effect, it is an error not to have a single-character \var{escapechar} defined, even if no data to be written contains the \var{delimiter} character. \end{datadesc} The \module{csv} module defines the following exception: \begin{excdesc}{Error} Raised by any of the functions when an error is detected. \end{excdesc} \subsection{Dialects and Formatting Parameters\label{fmt-params}} To make it easier to specify the format of input and output records, specific formatting parameters are grouped together into dialects. A dialect is a subclass of the \class{Dialect} class having a set of specific methods and a single \method{validate()} method. When creating \class{reader} or \class{writer} objects, the programmer can specify a string or a subclass of the \class{Dialect} class as the dialect parameter. In addition to, or instead of, the \var{dialect} parameter, the programmer can also specify individual formatting parameters, which have the same names as the attributes defined above for the \class{Dialect} class. \subsection{Reader Objects} \class{DictReader} and \var{reader} objects have the following public methods: \begin{methoddesc}{next}{} Return the next row of the reader's iterable object as a list, parsed according to the current dialect. \end{methoddesc} \subsection{Writer Objects} \class{DictWriter} and \var{writer} objects have the following public methods: \begin{methoddesc}{writerow}{row} Write the \var{row} parameter to the writer's file object, formatted according to the current dialect. \end{methoddesc} \begin{methoddesc}{writerows}{rows} Write all the \var{rows} parameters to the writer's file object, formatted according to the current dialect. \end{methoddesc} \subsection{Examples} The ``Hello, world'' of csv reading is \begin{verbatim} reader = csv.reader(file("some.csv")) for row in reader: print row \end{verbatim} The corresponding simplest possible writing example is \begin{verbatim} writer = csv.writer(file("some.csv", "w")) for row in someiterable: writer.writerow(row) \end{verbatim} From montanaro@users.sourceforge.net Thu Mar 20 23:29:14 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:29:14 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24199/Lib/test Added Files: test_csv.py Log Message: new CSV file processing module - see PEP 305 --- NEW FILE: test_csv.py --- # Copyright (C) 2001,2002 Python Software Foundation # csv package unit tests import sys import unittest from StringIO import StringIO from csv import csv import gc class Test_Csv(unittest.TestCase): """ Test the underlying C csv parser in ways that are not appropriate from the high level interface. Further tests of this nature are done in TestDialectRegistry. """ def test_reader_arg_valid(self): self.assertRaises(TypeError, csv.reader) self.assertRaises(TypeError, csv.reader, None) self.assertRaises(AttributeError, csv.reader, [], bad_attr = 0) self.assertRaises(csv.Error, csv.reader, [], 'foo') class BadClass: def __init__(self): raise IOError self.assertRaises(IOError, csv.reader, [], BadClass) self.assertRaises(TypeError, csv.reader, [], None) class BadDialect: bad_attr = 0 self.assertRaises(AttributeError, csv.reader, [], BadDialect) def test_writer_arg_valid(self): self.assertRaises(TypeError, csv.writer) self.assertRaises(TypeError, csv.writer, None) self.assertRaises(AttributeError, csv.writer, StringIO(), bad_attr = 0) def _test_attrs(self, obj): self.assertEqual(obj.dialect.delimiter, ',') obj.dialect.delimiter = '\t' self.assertEqual(obj.dialect.delimiter, '\t') self.assertRaises(TypeError, delattr, obj.dialect, 'delimiter') self.assertRaises(TypeError, setattr, obj.dialect, 'lineterminator', None) obj.dialect.escapechar = None self.assertEqual(obj.dialect.escapechar, None) self.assertRaises(TypeError, delattr, obj.dialect, 'quoting') self.assertRaises(TypeError, setattr, obj.dialect, 'quoting', None) obj.dialect.quoting = csv.QUOTE_MINIMAL self.assertEqual(obj.dialect.quoting, csv.QUOTE_MINIMAL) def test_reader_attrs(self): self._test_attrs(csv.reader([])) def test_writer_attrs(self): self._test_attrs(csv.writer(StringIO())) def _write_test(self, fields, expect, **kwargs): fileobj = StringIO() writer = csv.writer(fileobj, **kwargs) writer.writerow(fields) self.assertEqual(fileobj.getvalue(), expect + writer.dialect.lineterminator) def test_write_arg_valid(self): self.assertRaises(csv.Error, self._write_test, None, '') self._write_test((), '') self._write_test([None], '""') self.assertRaises(csv.Error, self._write_test, [None], None, quoting = csv.QUOTE_NONE) # Check that exceptions are passed up the chain class BadList: def __len__(self): return 10; def __getitem__(self, i): if i > 2: raise IOError self.assertRaises(IOError, self._write_test, BadList(), '') class BadItem: def __str__(self): raise IOError self.assertRaises(IOError, self._write_test, [BadItem()], '') def test_write_bigfield(self): # This exercises the buffer realloc functionality bigstring = 'X' * 50000 self._write_test([bigstring,bigstring], '%s,%s' % \ (bigstring, bigstring)) def test_write_quoting(self): self._write_test(['a','1','p,q'], 'a,1,"p,q"') self.assertRaises(csv.Error, self._write_test, ['a','1','p,q'], 'a,1,"p,q"', quoting = csv.QUOTE_NONE) self._write_test(['a','1','p,q'], 'a,1,"p,q"', quoting = csv.QUOTE_MINIMAL) self._write_test(['a','1','p,q'], '"a",1,"p,q"', quoting = csv.QUOTE_NONNUMERIC) self._write_test(['a','1','p,q'], '"a","1","p,q"', quoting = csv.QUOTE_ALL) def test_write_escape(self): self._write_test(['a','1','p,q'], 'a,1,"p,q"', escapechar='\\') # FAILED - needs to be fixed [am]: # self._write_test(['a','1','p,"q"'], 'a,1,"p,\\"q\\"', # escapechar='\\', doublequote = 0) self._write_test(['a','1','p,q'], 'a,1,p\\,q', escapechar='\\', quoting = csv.QUOTE_NONE) def test_writerows(self): class BrokenFile: def write(self, buf): raise IOError writer = csv.writer(BrokenFile()) self.assertRaises(IOError, writer.writerows, [['a']]) fileobj = StringIO() writer = csv.writer(fileobj) self.assertRaises(TypeError, writer.writerows, None) writer.writerows([['a','b'],['c','d']]) self.assertEqual(fileobj.getvalue(), "a,b\r\nc,d\r\n") def _read_test(self, input, expect, **kwargs): reader = csv.reader(input, **kwargs) result = list(reader) self.assertEqual(result, expect) def test_read_oddinputs(self): self._read_test([], []) self._read_test([''], [[]]) self.assertRaises(csv.Error, self._read_test, ['"ab"c'], None, strict = 1) # cannot handle null bytes for the moment self.assertRaises(csv.Error, self._read_test, ['ab\0c'], None, strict = 1) self._read_test(['"ab"c'], [['abc']], doublequote = 0) def test_read_eol(self): self._read_test(['a,b'], [['a','b']]) self._read_test(['a,b\n'], [['a','b']]) self._read_test(['a,b\r\n'], [['a','b']]) self._read_test(['a,b\r'], [['a','b']]) self.assertRaises(csv.Error, self._read_test, ['a,b\rc,d'], []) self.assertRaises(csv.Error, self._read_test, ['a,b\nc,d'], []) self.assertRaises(csv.Error, self._read_test, ['a,b\r\nc,d'], []) def test_read_escape(self): self._read_test(['a,\\b,c'], [['a', '\\b', 'c']], escapechar='\\') self._read_test(['a,b\\,c'], [['a', 'b,c']], escapechar='\\') self._read_test(['a,"b\\,c"'], [['a', 'b,c']], escapechar='\\') self._read_test(['a,"b,\\c"'], [['a', 'b,\\c']], escapechar='\\') self._read_test(['a,"b,c\\""'], [['a', 'b,c"']], escapechar='\\') self._read_test(['a,"b,c"\\'], [['a', 'b,c\\']], escapechar='\\') def test_read_bigfield(self): # This exercises the buffer realloc functionality bigstring = 'X' * 50000 bigline = '%s,%s' % (bigstring, bigstring) self._read_test([bigline], [[bigstring, bigstring]]) class TestDialectRegistry(unittest.TestCase): def test_registry_badargs(self): self.assertRaises(TypeError, csv.list_dialects, None) self.assertRaises(TypeError, csv.get_dialect) self.assertRaises(csv.Error, csv.get_dialect, None) self.assertRaises(csv.Error, csv.get_dialect, "nonesuch") self.assertRaises(TypeError, csv.unregister_dialect) self.assertRaises(csv.Error, csv.unregister_dialect, None) self.assertRaises(csv.Error, csv.unregister_dialect, "nonesuch") self.assertRaises(TypeError, csv.register_dialect, None) self.assertRaises(TypeError, csv.register_dialect, None, None) self.assertRaises(TypeError, csv.register_dialect, "nonesuch", None) class bogus: def __init__(self): raise KeyError self.assertRaises(KeyError, csv.register_dialect, "nonesuch", bogus) def test_registry(self): class myexceltsv(csv.excel): delimiter = "\t" name = "myexceltsv" expected_dialects = csv.list_dialects() + [name] expected_dialects.sort() csv.register_dialect(name, myexceltsv) try: self.failUnless(isinstance(csv.get_dialect(name), myexceltsv)) got_dialects = csv.list_dialects() got_dialects.sort() self.assertEqual(expected_dialects, got_dialects) finally: csv.unregister_dialect(name) def test_incomplete_dialect(self): class myexceltsv(csv.Dialect): delimiter = "\t" self.assertRaises(csv.Error, myexceltsv) def test_space_dialect(self): class space(csv.excel): delimiter = " " quoting = csv.QUOTE_NONE escapechar = "\\" s = StringIO("abc def\nc1ccccc1 benzene\n") rdr = csv.reader(s, dialect=space()) self.assertEqual(rdr.next(), ["abc", "def"]) self.assertEqual(rdr.next(), ["c1ccccc1", "benzene"]) def test_dialect_apply(self): class testA(csv.excel): delimiter = "\t" class testB(csv.excel): delimiter = ":" class testC(csv.excel): delimiter = "|" csv.register_dialect('testC', testC) try: fileobj = StringIO() writer = csv.writer(fileobj) writer.writerow([1,2,3]) self.assertEqual(fileobj.getvalue(), "1,2,3\r\n") fileobj = StringIO() writer = csv.writer(fileobj, testA) writer.writerow([1,2,3]) self.assertEqual(fileobj.getvalue(), "1\t2\t3\r\n") fileobj = StringIO() writer = csv.writer(fileobj, dialect=testB()) writer.writerow([1,2,3]) self.assertEqual(fileobj.getvalue(), "1:2:3\r\n") fileobj = StringIO() writer = csv.writer(fileobj, dialect='testC') writer.writerow([1,2,3]) self.assertEqual(fileobj.getvalue(), "1|2|3\r\n") fileobj = StringIO() writer = csv.writer(fileobj, dialect=testA, delimiter=';') writer.writerow([1,2,3]) self.assertEqual(fileobj.getvalue(), "1;2;3\r\n") finally: csv.unregister_dialect('testC') def test_bad_dialect(self): # Unknown parameter self.assertRaises(AttributeError, csv.reader, [], bad_attr = 0) # Bad values self.assertRaises(TypeError, csv.reader, [], delimiter = None) self.assertRaises(TypeError, csv.reader, [], quoting = -1) self.assertRaises(TypeError, csv.reader, [], quoting = 100) class TestCsvBase(unittest.TestCase): def readerAssertEqual(self, input, expected_result): reader = csv.reader(StringIO(input), dialect = self.dialect) fields = list(reader) self.assertEqual(fields, expected_result) def writerAssertEqual(self, input, expected_result): fileobj = StringIO() writer = csv.writer(fileobj, dialect = self.dialect) writer.writerows(input) self.assertEqual(fileobj.getvalue(), expected_result) class TestDialectExcel(TestCsvBase): dialect = 'excel' def test_single(self): self.readerAssertEqual('abc', [['abc']]) def test_simple(self): self.readerAssertEqual('1,2,3,4,5', [['1','2','3','4','5']]) def test_blankline(self): self.readerAssertEqual('', []) def test_empty_fields(self): self.readerAssertEqual(',', [['', '']]) def test_singlequoted(self): self.readerAssertEqual('""', [['']]) def test_singlequoted_left_empty(self): self.readerAssertEqual('"",', [['','']]) def test_singlequoted_right_empty(self): self.readerAssertEqual(',""', [['','']]) def test_single_quoted_quote(self): self.readerAssertEqual('""""', [['"']]) def test_quoted_quotes(self): self.readerAssertEqual('""""""', [['""']]) def test_inline_quote(self): self.readerAssertEqual('a""b', [['a""b']]) def test_inline_quotes(self): self.readerAssertEqual('a"b"c', [['a"b"c']]) def test_quotes_and_more(self): self.readerAssertEqual('"a"b', [['ab']]) def test_lone_quote(self): self.readerAssertEqual('a"b', [['a"b']]) def test_quote_and_quote(self): self.readerAssertEqual('"a" "b"', [['a "b"']]) def test_space_and_quote(self): self.readerAssertEqual(' "a"', [[' "a"']]) def test_quoted(self): self.readerAssertEqual('1,2,3,"I think, therefore I am",5,6', [['1', '2', '3', 'I think, therefore I am', '5', '6']]) def test_quoted_quote(self): self.readerAssertEqual('1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"', [['1', '2', '3', '"I see," said the blind man', 'as he picked up his hammer and saw']]) def test_quoted_nl(self): input = '''\ 1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw" 9,8,7,6''' self.readerAssertEqual(input, [['1', '2', '3', '"I see,"\nsaid the blind man', 'as he picked up his\nhammer and saw'], ['9','8','7','6']]) def test_dubious_quote(self): self.readerAssertEqual('12,12,1",', [['12', '12', '1"', '']]) def test_null(self): self.writerAssertEqual([], '') def test_single(self): self.writerAssertEqual([['abc']], 'abc\r\n') def test_simple(self): self.writerAssertEqual([[1, 2, 'abc', 3, 4]], '1,2,abc,3,4\r\n') def test_quotes(self): self.writerAssertEqual([[1, 2, 'a"bc"', 3, 4]], '1,2,"a""bc""",3,4\r\n') def test_quote_fieldsep(self): self.writerAssertEqual([['abc,def']], '"abc,def"\r\n') def test_newlines(self): self.writerAssertEqual([[1, 2, 'a\nbc', 3, 4]], '1,2,"a\nbc",3,4\r\n') class EscapedExcel(csv.excel): quoting = csv.QUOTE_NONE escapechar = '\\' class TestEscapedExcel(TestCsvBase): dialect = EscapedExcel() def test_escape_fieldsep(self): self.writerAssertEqual([['abc,def']], 'abc\\,def\r\n') def test_read_escape_fieldsep(self): self.readerAssertEqual('abc\\,def\r\n', [['abc,def']]) class QuotedEscapedExcel(csv.excel): quoting = csv.QUOTE_NONNUMERIC escapechar = '\\' class TestQuotedEscapedExcel(TestCsvBase): dialect = QuotedEscapedExcel() def test_write_escape_fieldsep(self): self.writerAssertEqual([['abc,def']], '"abc,def"\r\n') def test_read_escape_fieldsep(self): self.readerAssertEqual('"abc\\,def"\r\n', [['abc,def']]) # Disabled, pending support in csv.utils module class TestDictFields(unittest.TestCase): ### "long" means the row is longer than the number of fieldnames ### "short" means there are fewer elements in the row than fieldnames def test_write_simple_dict(self): fileobj = StringIO() writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"]) writer.writerow({"f1": 10, "f3": "abc"}) self.assertEqual(fileobj.getvalue(), "10,,abc\r\n") def test_write_no_fields(self): fileobj = StringIO() self.assertRaises(TypeError, csv.DictWriter, fileobj) def test_read_dict_fields(self): reader = csv.DictReader(StringIO("1,2,abc\r\n"), fieldnames=["f1", "f2", "f3"]) self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) def test_read_long(self): reader = csv.DictReader(StringIO("1,2,abc,4,5,6\r\n"), fieldnames=["f1", "f2"]) self.assertEqual(reader.next(), {"f1": '1', "f2": '2', None: ["abc", "4", "5", "6"]}) def test_read_long_with_rest(self): reader = csv.DictReader(StringIO("1,2,abc,4,5,6\r\n"), fieldnames=["f1", "f2"], restkey="_rest") self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "_rest": ["abc", "4", "5", "6"]}) def test_read_short(self): reader = csv.DictReader(["1,2,abc,4,5,6\r\n","1,2,abc\r\n"], fieldnames="1 2 3 4 5 6".split(), restval="DEFAULT") self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', "4": '4', "5": '5', "6": '6'}) self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', "4": 'DEFAULT', "5": 'DEFAULT', "6": 'DEFAULT'}) def test_read_with_blanks(self): reader = csv.DictReader(["1,2,abc,4,5,6\r\n","\r\n", "1,2,abc,4,5,6\r\n"], fieldnames="1 2 3 4 5 6".split()) self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', "4": '4', "5": '5', "6": '6'}) self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', "4": '4', "5": '5', "6": '6'}) class TestArrayWrites(unittest.TestCase): def test_int_write(self): import array contents = [(20-i) for i in range(20)] a = array.array('i', contents) fileobj = StringIO() writer = csv.writer(fileobj, dialect="excel") writer.writerow(a) expected = ",".join([str(i) for i in a])+"\r\n" self.assertEqual(fileobj.getvalue(), expected) def test_double_write(self): import array contents = [(20-i)*0.1 for i in range(20)] a = array.array('d', contents) fileobj = StringIO() writer = csv.writer(fileobj, dialect="excel") writer.writerow(a) expected = ",".join([str(i) for i in a])+"\r\n" self.assertEqual(fileobj.getvalue(), expected) def test_float_write(self): import array contents = [(20-i)*0.1 for i in range(20)] a = array.array('f', contents) fileobj = StringIO() writer = csv.writer(fileobj, dialect="excel") writer.writerow(a) expected = ",".join([str(i) for i in a])+"\r\n" self.assertEqual(fileobj.getvalue(), expected) def test_char_write(self): import array, string a = array.array('c', string.letters) fileobj = StringIO() writer = csv.writer(fileobj, dialect="excel") writer.writerow(a) expected = ",".join(a)+"\r\n" self.assertEqual(fileobj.getvalue(), expected) class TestDialectValidity(unittest.TestCase): def test_quoting(self): class mydialect(csv.Dialect): delimiter = ";" escapechar = '\\' doublequote = False skipinitialspace = True lineterminator = '\r\n' quoting = csv.QUOTE_NONE d = mydialect() mydialect.quoting = None self.assertRaises(csv.Error, mydialect) mydialect.quoting = csv.QUOTE_NONE mydialect.escapechar = None self.assertRaises(csv.Error, mydialect) mydialect.doublequote = True mydialect.quoting = csv.QUOTE_ALL mydialect.quotechar = '"' d = mydialect() mydialect.quotechar = "''" self.assertRaises(csv.Error, mydialect) mydialect.quotechar = 4 self.assertRaises(csv.Error, mydialect) def test_delimiter(self): class mydialect(csv.Dialect): delimiter = ";" escapechar = '\\' doublequote = False skipinitialspace = True lineterminator = '\r\n' quoting = csv.QUOTE_NONE d = mydialect() mydialect.delimiter = ":::" self.assertRaises(csv.Error, mydialect) mydialect.delimiter = 4 self.assertRaises(csv.Error, mydialect) def test_lineterminator(self): class mydialect(csv.Dialect): delimiter = ";" escapechar = '\\' doublequote = False skipinitialspace = True lineterminator = '\r\n' quoting = csv.QUOTE_NONE d = mydialect() mydialect.lineterminator = ":::" d = mydialect() mydialect.lineterminator = 4 self.assertRaises(csv.Error, mydialect) if not hasattr(sys, "gettotalrefcount"): print "*** skipping leakage tests ***" else: class NUL: def write(s, *args): pass writelines = write class TestLeaks(unittest.TestCase): def test_create_read(self): delta = 0 lastrc = sys.gettotalrefcount() for i in xrange(20): gc.collect() self.assertEqual(gc.garbage, []) rc = sys.gettotalrefcount() csv.reader(["a,b,c\r\n"]) csv.reader(["a,b,c\r\n"]) csv.reader(["a,b,c\r\n"]) delta = rc-lastrc lastrc = rc # if csv.reader() leaks, last delta should be 3 or more self.assertEqual(delta < 3, True) def test_create_write(self): delta = 0 lastrc = sys.gettotalrefcount() s = NUL() for i in xrange(20): gc.collect() self.assertEqual(gc.garbage, []) rc = sys.gettotalrefcount() csv.writer(s) csv.writer(s) csv.writer(s) delta = rc-lastrc lastrc = rc # if csv.writer() leaks, last delta should be 3 or more self.assertEqual(delta < 3, True) def test_read(self): delta = 0 rows = ["a,b,c\r\n"]*5 lastrc = sys.gettotalrefcount() for i in xrange(20): gc.collect() self.assertEqual(gc.garbage, []) rc = sys.gettotalrefcount() rdr = csv.reader(rows) for row in rdr: pass delta = rc-lastrc lastrc = rc # if reader leaks during read, delta should be 5 or more self.assertEqual(delta < 5, True) def test_write(self): delta = 0 rows = [[1,2,3]]*5 s = NUL() lastrc = sys.gettotalrefcount() for i in xrange(20): gc.collect() self.assertEqual(gc.garbage, []) rc = sys.gettotalrefcount() writer = csv.writer(s) for row in rows: writer.writerow(row) delta = rc-lastrc lastrc = rc # if writer leaks during write, last delta should be 5 or more self.assertEqual(delta < 5, True) def _testclasses(): mod = sys.modules[__name__] return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] def suite(): suite = unittest.TestSuite() for testclass in _testclasses(): suite.addTest(unittest.makeSuite(testclass)) return suite if __name__ == '__main__': unittest.main(defaultTest='suite') From montanaro@users.sourceforge.net Thu Mar 20 23:31:04 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:31:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/csv/util - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv25338/Lib/csv/util Log Message: Directory /cvsroot/python/python/dist/src/Lib/csv/util added to the repository From montanaro@users.sourceforge.net Thu Mar 20 23:31:26 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:31:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/csv/util sniffer.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv25444/Lib/csv/util Added Files: sniffer.py Log Message: forgot Cliff's sniffer --- NEW FILE: sniffer.py --- """ dialect = Sniffer().sniff(file('csv/easy.csv')) print "delimiter", dialect.delimiter print "quotechar", dialect.quotechar print "skipinitialspace", dialect.skipinitialspace """ from csv import csv import re # ------------------------------------------------------------------------------ class Sniffer: """ "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) Returns a csv.Dialect object. """ def __init__(self, sample = 16 * 1024): # in case there is more than one possible delimiter self.preferred = [',', '\t', ';', ' ', ':'] # amount of data (in bytes) to sample self.sample = sample def sniff(self, fileobj): """ Takes a file-like object and returns a dialect (or None) """ self.fileobj = fileobj data = fileobj.read(self.sample) quotechar, delimiter, skipinitialspace = self._guessQuoteAndDelimiter(data) if delimiter is None: delimiter, skipinitialspace = self._guessDelimiter(data) class Dialect(csv.Dialect): _name = "sniffed" lineterminator = '\r\n' quoting = csv.QUOTE_MINIMAL # escapechar = '' doublequote = False Dialect.delimiter = delimiter Dialect.quotechar = quotechar Dialect.skipinitialspace = skipinitialspace self.dialect = Dialect return self.dialect def hasHeaders(self): return self._hasHeaders(self.fileobj, self.dialect) def register_dialect(self, name = 'sniffed'): csv.register_dialect(name, self.dialect) def _guessQuoteAndDelimiter(self, data): """ Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', The quote with the most wins, same with the delimiter. If there is no quotechar the delimiter can't be determined this way. """ matches = [] for restr in ('(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?P=delim)', # ,".*?", '(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)', # ".*?", '(?P>[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?:$|\n)', # ,".*?" '(?:^|\n)(?P["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space) regexp = re.compile(restr, re.S | re.M) matches = regexp.findall(data) if matches: break if not matches: return ('', None, 0) # (quotechar, delimiter, skipinitialspace) quotes = {} delims = {} spaces = 0 for m in matches: n = regexp.groupindex['quote'] - 1 key = m[n] if key: quotes[key] = quotes.get(key, 0) + 1 try: n = regexp.groupindex['delim'] - 1 key = m[n] except KeyError: continue if key: delims[key] = delims.get(key, 0) + 1 try: n = regexp.groupindex['space'] - 1 except KeyError: continue if m[n]: spaces += 1 quotechar = reduce(lambda a, b, quotes = quotes: (quotes[a] > quotes[b]) and a or b, quotes.keys()) if delims: delim = reduce(lambda a, b, delims = delims: (delims[a] > delims[b]) and a or b, delims.keys()) skipinitialspace = delims[delim] == spaces if delim == '\n': # most likely a file with a single column delim = '' else: # there is *no* delimiter, it's a single column of quoted data delim = '' skipinitialspace = 0 return (quotechar, delim, skipinitialspace) def _guessDelimiter(self, data): """ The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table of the frequency of each character on every line. 2) build a table of freqencies of this frequency (meta-frequency?), e.g. "x occurred 5 times in 10 rows, 6 times in 1000 rows, 7 times in 2 rows" 3) use the mode of the meta-frequency to determine the /expected/ frequency for that character 4) find out how often the character actually meets that goal 5) the character that best meets its goal is the delimiter For performance reasons, the data is evaluated in chunks, so it can try and evaluate the smallest portion of the data possible, evaluating additional chunks as necessary. """ data = filter(None, data.split('\n')) ascii = [chr(c) for c in range(127)] # 7-bit ASCII # build frequency tables chunkLength = min(10, len(data)) iteration = 0 charFrequency = {} modes = {} delims = {} start, end = 0, min(chunkLength, len(data)) while start < len(data): iteration += 1 for line in data[start:end]: for char in ascii: metafrequency = charFrequency.get(char, {}) freq = line.strip().count(char) # must count even if frequency is 0 metafrequency[freq] = metafrequency.get(freq, 0) + 1 # value is the mode charFrequency[char] = metafrequency for char in charFrequency.keys(): items = charFrequency[char].items() if len(items) == 1 and items[0][0] == 0: continue # get the mode of the frequencies if len(items) > 1: modes[char] = reduce(lambda a, b: a[1] > b[1] and a or b, items) # adjust the mode - subtract the sum of all other frequencies items.remove(modes[char]) modes[char] = (modes[char][0], modes[char][1] - reduce(lambda a, b: (0, a[1] + b[1]), items)[1]) else: modes[char] = items[0] # build a list of possible delimiters modeList = modes.items() total = float(chunkLength * iteration) consistency = 1.0 # (rows of consistent data) / (number of rows) = 100% threshold = 0.9 # minimum consistency threshold while len(delims) == 0 and consistency >= threshold: for k, v in modeList: if v[0] > 0 and v[1] > 0: if (v[1]/total) >= consistency: delims[k] = v consistency -= 0.01 if len(delims) == 1: delim = delims.keys()[0] skipinitialspace = data[0].count(delim) == data[0].count("%c " % delim) return (delim, skipinitialspace) # analyze another chunkLength lines start = end end += chunkLength if not delims: return ('', 0) # if there's more than one, fall back to a 'preferred' list if len(delims) > 1: for d in self.preferred: if d in delims.keys(): skipinitialspace = data[0].count(d) == data[0].count("%c " % d) return (d, skipinitialspace) # finally, just return the first damn character in the list delim = delims.keys()[0] skipinitialspace = data[0].count(delim) == data[0].count("%c " % delim) return (delim, skipinitialspace) def _hasHeaders(self, fileobj, dialect): # Creates a dictionary of types of data in each column. If any column # is of a single type (say, integers), *except* for the first row, then the first # row is presumed to be labels. If the type can't be determined, it is assumed to # be a string in which case the length of the string is the determining factor: if # all of the rows except for the first are the same length, it's a header. # Finally, a 'vote' is taken at the end for each column, adding or subtracting from # the likelihood of the first row being a header. def seval(item): """ Strips parens from item prior to calling eval in an attempt to make it safer """ return eval(item.replace('(', '').replace(')', '')) fileobj.seek(0) # rewind the fileobj - this might not work for some file-like objects... reader = csv.reader(fileobj, delimiter = dialect.delimiter, quotechar = dialect.quotechar, skipinitialspace = dialect.skipinitialspace) header = reader.next() # assume first row is header columns = len(header) columnTypes = {} for i in range(columns): columnTypes[i] = None checked = 0 for row in reader: if checked > 20: # arbitrary number of rows to check, to keep it sane break checked += 1 if len(row) != columns: continue # skip rows that have irregular number of columns for col in columnTypes.keys(): try: try: # is it a built-in type (besides string)? thisType = type(seval(row[col])) except OverflowError: # a long int? thisType = type(seval(row[col] + 'L')) thisType = type(0) # treat long ints as int except: # fallback to length of string thisType = len(row[col]) if thisType != columnTypes[col]: if columnTypes[col] is None: # add new column type columnTypes[col] = thisType else: # type is inconsistent, remove column from consideration del columnTypes[col] # finally, compare results against first row and "vote" on whether it's a header hasHeader = 0 for col, colType in columnTypes.items(): if type(colType) == type(0): # it's a length if len(header[col]) != colType: hasHeader += 1 else: hasHeader -= 1 else: # attempt typecast try: eval("%s(%s)" % (colType.__name__, header[col])) except: hasHeader += 1 else: hasHeader -= 1 return hasHeader > 0 From montanaro@users.sourceforge.net Thu Mar 20 23:34:25 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:34:25 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv26751 Modified Files: setup.py Log Message: build _csv extension module Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** setup.py 6 Mar 2003 23:03:43 -0000 1.155 --- setup.py 20 Mar 2003 23:34:22 -0000 1.156 *************** *** 430,433 **** --- 430,436 ---- exts.append( Extension('crypt', ['cryptmodule.c'], libraries=libs) ) + # CSV files + exts.append( Extension('_csv', ['_csv.c']) ) + # socket(2) exts.append( Extension('_socket', ['socketmodule.c'], From montanaro@users.sourceforge.net Thu Mar 20 23:35:43 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:35:43 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.117,1.118 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv27282 Modified Files: Makefile.pre.in Log Message: include the csv package during installation Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** Makefile.pre.in 17 Mar 2003 15:43:32 -0000 1.117 --- Makefile.pre.in 20 Mar 2003 23:35:38 -0000 1.118 *************** *** 627,631 **** LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ encodings email email/test email/test/data compiler hotshot \ ! logging bsddb bsddb/test \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) --- 627,631 ---- LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ encodings email email/test email/test/data compiler hotshot \ ! logging bsddb bsddb/test csv \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) From montanaro@users.sourceforge.net Thu Mar 20 23:36:58 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:36:58 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.700,1.701 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv27744 Modified Files: NEWS Log Message: announce csv package Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.700 retrieving revision 1.701 diff -C2 -d -r1.700 -r1.701 *** NEWS 20 Mar 2003 18:32:03 -0000 1.700 --- NEWS 20 Mar 2003 23:36:55 -0000 1.701 *************** *** 84,87 **** --- 84,89 ---- not both of them. (SF patch #695090 from Bernhard Herzog) + - New csv package makes it easy to read/write CSV files. + Tools/Demos ----------- From montanaro@users.sourceforge.net Thu Mar 20 23:37:26 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:37:26 -0800 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv27970 Modified Files: Setup.dist Log Message: add _csv build line Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Setup.dist 17 Mar 2003 15:43:34 -0000 1.37 --- Setup.dist 20 Mar 2003 23:37:24 -0000 1.38 *************** *** 192,195 **** --- 192,198 ---- #xreadlines xreadlinesmodule.c + # CSV file helper + #_csv _csv.c + # Socket module helper for socket(2) #_socket socketmodule.c From montanaro@users.sourceforge.net Thu Mar 20 23:41:07 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:41:07 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.230,1.231 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29601 Modified Files: ACKS Log Message: add several people involved with PEP 305 and the csv package Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.230 retrieving revision 1.231 diff -C2 -d -r1.230 -r1.231 *** ACKS 17 Mar 2003 11:34:01 -0000 1.230 --- ACKS 20 Mar 2003 23:41:03 -0000 1.231 *************** *** 15,18 **** --- 15,19 ---- Jyrki Alakuijala Billy G. Allie + Kevin Altis Mark Anacker Anders Andersen *************** *** 354,357 **** --- 355,359 ---- Gordon McMillan Jay T. Miller + Andrew McNamara Caolan McNamara Craig McPheeters *************** *** 564,567 **** --- 566,570 ---- Zack Weinberg Edward Welbourne + Cliff Wells Rickard Westman Mats Wichmann From montanaro@users.sourceforge.net Thu Mar 20 23:35:05 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 20 Mar 2003 15:35:05 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex,1.215,1.216 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26976 Modified Files: lib.tex Log Message: include csv doc section - Fred, you may want to change the location Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** lib.tex 10 Mar 2003 00:07:14 -0000 1.215 --- lib.tex 20 Mar 2003 23:35:00 -0000 1.216 *************** *** 258,261 **** --- 258,262 ---- \input{libnetrc} \input{librobotparser} + \input{libcsv} \input{markup} % Structured Markup Processing Tools From nnorwitz@users.sourceforge.net Fri Mar 21 00:28:32 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 20 Mar 2003 16:28:32 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.99,1.100 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv18773 Modified Files: Makefile.deps Log Message: Add new CSV module to doc dependancies Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** Makefile.deps 10 Mar 2003 00:07:13 -0000 1.99 --- Makefile.deps 21 Mar 2003 00:28:30 -0000 1.100 *************** *** 337,340 **** --- 337,341 ---- lib/libturtle.tex \ lib/libtarfile.tex \ + lib/libcsv.tex \ lib/libcfgparser.tex From gvanrossum@users.sourceforge.net Fri Mar 21 01:16:01 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:16:01 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4787 Modified Files: test_csv.py Log Message: The message "*** skipping leakage tests ***" was causing the test to fail in a non-debug build. Only print this in verbose test mode. Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_csv.py 20 Mar 2003 23:29:12 -0000 1.1 --- test_csv.py 21 Mar 2003 01:15:58 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- from csv import csv import gc + from test.test_support import verbose class Test_Csv(unittest.TestCase): *************** *** 534,538 **** if not hasattr(sys, "gettotalrefcount"): ! print "*** skipping leakage tests ***" else: class NUL: --- 535,539 ---- if not hasattr(sys, "gettotalrefcount"): ! if verbose: print "*** skipping leakage tests ***" else: class NUL: From tim_one@users.sourceforge.net Fri Mar 21 01:35:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:35:30 -0800 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11500/Modules Modified Files: _csv.c Log Message: Squash compiler wng about signed-vs-unsigned mismatch. Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _csv.c 20 Mar 2003 23:29:12 -0000 1.1 --- _csv.c 21 Mar 2003 01:35:28 -0000 1.2 *************** *** 648,652 **** return NULL; } ! if (strlen(line) < PyString_GET_SIZE(lineobj)) { self->had_parse_error = 1; Py_DECREF(lineobj); --- 648,652 ---- return NULL; } ! if (strlen(line) < (size_t)PyString_GET_SIZE(lineobj)) { self->had_parse_error = 1; Py_DECREF(lineobj); From nnorwitz@users.sourceforge.net Fri Mar 21 01:39:16 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:39:16 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_pty.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12847/Lib/test Modified Files: test_pty.py Log Message: Prevent the pty test from hanging by setting an alarm. Currently, test_pty hangs on AIX & HPUX if run after test_openpty. Index: test_pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_pty.py 1 Jan 2003 14:53:27 -0000 1.17 --- test_pty.py 21 Mar 2003 01:39:14 -0000 1.18 *************** *** 1,3 **** ! import pty, os, sys from test.test_support import verbose, TestFailed, TestSkipped --- 1,3 ---- ! import pty, os, sys, signal from test.test_support import verbose, TestFailed, TestSkipped *************** *** 15,48 **** # because pty code is not too portable. ! try: ! debug("Calling master_open()") ! master_fd, slave_name = pty.master_open() ! debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) ! debug("Calling slave_open(%s)"%`slave_name`) ! slave_fd = pty.slave_open(slave_name) ! debug("Got slave_fd '%d'"%slave_fd) ! except OSError: ! # " An optional feature could not be imported " ... ? ! raise TestSkipped, "Pseudo-terminals (seemingly) not functional." ! if not os.isatty(slave_fd): ! raise TestFailed, "slave_fd is not a tty" ! # IRIX apparently turns \n into \r\n. Allow that, but avoid allowing other ! # differences (like extra whitespace, trailing garbage, etc.) ! debug("Writing to slave_fd") ! os.write(slave_fd, TEST_STRING_1) ! s1 = os.read(master_fd, 1024) ! sys.stdout.write(s1.replace("\r\n", "\n")) ! debug("Writing chunked output") ! os.write(slave_fd, TEST_STRING_2[:5]) ! os.write(slave_fd, TEST_STRING_2[5:]) ! s2 = os.read(master_fd, 1024) ! sys.stdout.write(s2.replace("\r\n", "\n")) ! os.close(slave_fd) ! os.close(master_fd) # basic pty passed. --- 15,64 ---- # because pty code is not too portable. ! def test_basic_pty(): ! try: ! debug("Calling master_open()") ! master_fd, slave_name = pty.master_open() ! debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) ! debug("Calling slave_open(%s)"%`slave_name`) ! slave_fd = pty.slave_open(slave_name) ! debug("Got slave_fd '%d'"%slave_fd) ! except OSError: ! # " An optional feature could not be imported " ... ? ! raise TestSkipped, "Pseudo-terminals (seemingly) not functional." ! if not os.isatty(slave_fd): ! raise TestFailed, "slave_fd is not a tty" ! # IRIX apparently turns \n into \r\n. Allow that, but avoid allowing other ! # differences (like extra whitespace, trailing garbage, etc.) ! debug("Writing to slave_fd") ! os.write(slave_fd, TEST_STRING_1) ! s1 = os.read(master_fd, 1024) ! sys.stdout.write(s1.replace("\r\n", "\n")) ! debug("Writing chunked output") ! os.write(slave_fd, TEST_STRING_2[:5]) ! os.write(slave_fd, TEST_STRING_2[5:]) ! s2 = os.read(master_fd, 1024) ! sys.stdout.write(s2.replace("\r\n", "\n")) ! os.close(slave_fd) ! os.close(master_fd) ! ! def handle_sig(sig, frame): ! raise TestFailed, "isatty hung" ! ! # isatty() and close() can hang on some platforms ! # set an alarm before running the test to make sure we don't hang forever ! old_alarm = signal.signal(signal.SIGALRM, handle_sig) ! signal.alarm(10) ! ! try: ! test_basic_pty() ! finally: ! # remove alarm, restore old alarm handler ! signal.alarm(0) ! signal.signal(signal.SIGALRM, old_alarm) # basic pty passed. From nnorwitz@users.sourceforge.net Fri Mar 21 01:43:01 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:43:01 -0800 Subject: [Python-checkins] python/dist/src configure,1.383,1.384 configure.in,1.394,1.395 pyconfig.h.in,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv13668 Modified Files: configure configure.in pyconfig.h.in Log Message: /dev/ptmx doesn't exist on AIX, they had to be different and use /dev/ptc. Otherwise, the 2 devices seem to work the same for allocating a pseudo-tty. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.383 retrieving revision 1.384 diff -C2 -d -r1.383 -r1.384 *** configure 17 Mar 2003 15:44:10 -0000 1.383 --- configure 21 Mar 2003 01:42:56 -0000 1.384 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.393 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.394 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 16815,16818 **** --- 16815,16835 ---- cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTMX 1 + _ACEOF + + else + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + fi + + echo "$as_me:$LINENO: checking for /dev/ptc" >&5 + echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6 + + if test -e /dev/ptc + then + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + + cat >>confdefs.h <<\_ACEOF + #define HAVE_DEV_PTC 1 _ACEOF Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.394 retrieving revision 1.395 diff -C2 -d -r1.394 -r1.395 *** configure.in 17 Mar 2003 15:43:34 -0000 1.394 --- configure.in 21 Mar 2003 01:42:58 -0000 1.395 *************** *** 2603,2606 **** --- 2603,2617 ---- fi + AC_MSG_CHECKING(for /dev/ptc) + + if test -e /dev/ptc + then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTC, 1, + [Define if we have /dev/ptc.]) + else + AC_MSG_RESULT(no) + fi + AC_CHECK_TYPE(socklen_t,, AC_DEFINE(socklen_t,int, Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** pyconfig.h.in 14 Mar 2003 21:51:32 -0000 1.73 --- pyconfig.h.in 21 Mar 2003 01:42:58 -0000 1.74 *************** *** 69,72 **** --- 69,75 ---- #undef HAVE_DEVICE_MACROS + /* Define if we have /dev/ptc. */ + #undef HAVE_DEV_PTC + /* Define if we have /dev/ptmx. */ #undef HAVE_DEV_PTMX From nnorwitz@users.sourceforge.net Fri Mar 21 01:43:33 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:43:33 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.291,2.292 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14537/Modules Modified Files: posixmodule.c Log Message: Add support for os.openpty() on AIX which uses /dev/ptc instead of /dev/ptmx. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.291 retrieving revision 2.292 diff -C2 -d -r2.291 -r2.292 *** posixmodule.c 5 Mar 2003 14:15:21 -0000 2.291 --- posixmodule.c 21 Mar 2003 01:43:31 -0000 2.292 *************** *** 2573,2576 **** --- 2573,2584 ---- #endif + /* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ + #ifdef HAVE_DEV_PTC + #define DEV_PTY_FILE "/dev/ptc" + #define HAVE_DEV_PTMX + #else + #define DEV_PTY_FILE "/dev/ptmx" + #endif + #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) #ifdef HAVE_PTY_H *************** *** 2608,2612 **** if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) return posix_error(); ! #elif HAVE__GETPTY slave_name = _getpty(&master_fd, O_RDWR, 0666, 0); if (slave_name == NULL) --- 2616,2620 ---- if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) return posix_error(); ! #elif defined(HAVE__GETPTY) slave_name = _getpty(&master_fd, O_RDWR, 0666, 0); if (slave_name == NULL) *************** *** 2617,2621 **** return posix_error(); #else ! master_fd = open("/dev/ptmx", O_RDWR | O_NOCTTY); /* open master */ if (master_fd < 0) return posix_error(); --- 2625,2629 ---- return posix_error(); #else ! master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */ if (master_fd < 0) return posix_error(); *************** *** 2638,2642 **** if (slave_fd < 0) return posix_error(); ! #ifndef __CYGWIN__ ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ --- 2646,2650 ---- if (slave_fd < 0) return posix_error(); ! #if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ From tim_one@users.sourceforge.net Fri Mar 21 01:55:43 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:55:43 -0800 Subject: [Python-checkins] python/dist/src/PC dllbase_nt.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv18873/PC Modified Files: dllbase_nt.txt Log Message: Teach the Windows build & installer about the new csv module + DLL. Index: dllbase_nt.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/dllbase_nt.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dllbase_nt.txt 16 Dec 2002 20:18:14 -0000 1.6 --- dllbase_nt.txt 21 Mar 2003 01:55:41 -0000 1.7 *************** *** 33,36 **** --- 33,37 ---- - bZ2 1D170000 - 1D180000 - datetime 1D180000 - 1D190000 + - _csv 1D180000 - 1D1A0000 Other extension modules From tim_one@users.sourceforge.net Fri Mar 21 01:55:44 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 17:55:44 -0800 Subject: [Python-checkins] python/dist/src/PCbuild _csv.dsp,NONE,1.1 pcbuild.dsw,1.33,1.34 python20.wse,1.118,1.119 readme.txt,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv18873/PCbuild Modified Files: pcbuild.dsw python20.wse readme.txt Added Files: _csv.dsp Log Message: Teach the Windows build & installer about the new csv module + DLL. --- NEW FILE: _csv.dsp --- # Microsoft Developer Studio Project File - Name="_csv" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=_csv - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "_csv.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "_csv.mak" CFG="_csv - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "_csv - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_csv - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "_csv" # PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "_csv - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_csv" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" 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 "C:\Program Files\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_csv.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_csv - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_csv" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" 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 "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_csv_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "_csv - Win32 Release" # Name "_csv - Win32 Debug" # Begin Source File SOURCE=..\Modules\_csv.c # End Source File # End Target # End Project Index: pcbuild.dsw =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pcbuild.dsw,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** pcbuild.dsw 16 Dec 2002 20:18:21 -0000 1.33 --- pcbuild.dsw 21 Mar 2003 01:55:41 -0000 1.34 *************** *** 19,22 **** --- 19,37 ---- ############################################################################### + Project: "_csv"=.\_csv.dsp - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ + Begin Project Dependency + Project_Dep_Name pythoncore + End Project Dependency + }}} + + ############################################################################### + Project: "_socket"=.\_socket.dsp - Package Owner=<4> Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** python20.wse 19 Feb 2003 02:41:44 -0000 1.118 --- python20.wse 21 Mar 2003 01:55:41 -0000 1.119 *************** *** 1701,1704 **** --- 1701,1709 ---- end item: Install File + Source=.\_csv.pyd + Destination=%MAINDIR%\DLLs\_csv.pyd + Flags=0000000000000010 + end + item: Install File Source=.\_sre.pyd Destination=%MAINDIR%\DLLs\_sre.pyd *************** *** 1792,1795 **** --- 1797,1805 ---- end item: Install File + Source=.\_csv.lib + Destination=%MAINDIR%\libs\_csv.lib + Flags=0000000000000010 + end + item: Install File Source=.\_sre.lib Destination=%MAINDIR%\libs\_sre.lib *************** *** 1924,1927 **** --- 1934,1945 ---- Description=Python compiler written in Python Flags=0000000000000010 + end + item: Remark + end + item: Install File + Source=..\lib\csv\*.py + Destination=%MAINDIR%\Lib\csv + Description=CSV package + Flags=0000000100000010 end item: Remark Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** readme.txt 29 Jan 2003 00:38:42 -0000 1.40 --- readme.txt 21 Mar 2003 01:55:41 -0000 1.41 *************** *** 40,43 **** --- 40,45 ---- pythonw pythonw.exe, a variant of python.exe that doesn't pop up a DOS box + _csv + C support for the comma-separated values module _socket socketmodule.c From tim_one@users.sourceforge.net Fri Mar 21 02:02:04 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 18:02:04 -0800 Subject: [Python-checkins] python/dist/src/PC dllbase_nt.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv21156/PC Modified Files: dllbase_nt.txt Log Message: Changed the DLL base-address assignment for _csv so it no longer obviously overlaps w/ datetime (but may -- no time for more here now). Index: dllbase_nt.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/dllbase_nt.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dllbase_nt.txt 21 Mar 2003 01:55:41 -0000 1.7 --- dllbase_nt.txt 21 Mar 2003 02:02:02 -0000 1.8 *************** *** 33,37 **** - bZ2 1D170000 - 1D180000 - datetime 1D180000 - 1D190000 ! - _csv 1D180000 - 1D1A0000 Other extension modules --- 33,37 ---- - bZ2 1D170000 - 1D180000 - datetime 1D180000 - 1D190000 ! - _csv 1D190000 - 1D1A0000 Other extension modules From tim_one@users.sourceforge.net Fri Mar 21 02:02:05 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 20 Mar 2003 18:02:05 -0800 Subject: [Python-checkins] python/dist/src/PCbuild _csv.dsp,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv21156/PCbuild Modified Files: _csv.dsp Log Message: Changed the DLL base-address assignment for _csv so it no longer obviously overlaps w/ datetime (but may -- no time for more here now). Index: _csv.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_csv.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _csv.dsp 21 Mar 2003 01:55:41 -0000 1.1 --- _csv.dsp 21 Mar 2003 02:02:02 -0000 1.2 *************** *** 55,59 **** 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 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_csv.pyd" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- 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 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_csv.pyd" # SUBTRACT LINK32 /pdb:none *************** *** 83,87 **** 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 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_csv_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 83,87 ---- 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 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_csv_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none From nnorwitz@users.sourceforge.net Fri Mar 21 03:08:34 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 20 Mar 2003 19:08:34 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.292,2.293 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16710/Modules Modified Files: posixmodule.c Log Message: Get rid of warning on IRIX Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.292 retrieving revision 2.293 diff -C2 -d -r2.292 -r2.293 *** posixmodule.c 21 Mar 2003 01:43:31 -0000 2.292 --- posixmodule.c 21 Mar 2003 03:08:31 -0000 2.293 *************** *** 2574,2578 **** /* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ ! #ifdef HAVE_DEV_PTC #define DEV_PTY_FILE "/dev/ptc" #define HAVE_DEV_PTMX --- 2574,2579 ---- /* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ ! /* IRIX has both /dev/ptc and /dev/ptmx, use ptmx */ ! #if defined(HAVE_DEV_PTC) && !defined(HAVE_DEV_PTMX) #define DEV_PTY_FILE "/dev/ptc" #define HAVE_DEV_PTMX From nnorwitz@users.sourceforge.net Fri Mar 21 03:09:02 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 20 Mar 2003 19:09:02 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.156,1.157 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv16919 Modified Files: setup.py Log Message: Get locale module to build on aix4 Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** setup.py 20 Mar 2003 23:34:22 -0000 1.156 --- setup.py 21 Mar 2003 03:08:59 -0000 1.157 *************** *** 336,340 **** exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support ! if platform in ['cygwin']: locale_libs = ['intl'] else: --- 336,340 ---- exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support ! if platform in ['cygwin', 'aix4']: locale_libs = ['intl'] else: From jvr@users.sourceforge.net Fri Mar 21 09:27:02 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 21 Mar 2003 01:27:02 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv26609 Modified Files: bundlebuilder.py Log Message: Patch #681927 from Robin Dunn: add option to add shared libraries or frameworks to the bundle. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** bundlebuilder.py 20 Mar 2003 21:37:05 -0000 1.21 --- bundlebuilder.py 21 Mar 2003 09:26:59 -0000 1.22 *************** *** 95,98 **** --- 95,102 ---- files = [] + # List of shared libraries (dylibs, Frameworks) to bundle with the app + # will be placed in Contents/Frameworks + libs = [] + # Directory where the bundle will be assembled. builddir = "build" *************** *** 169,172 **** --- 173,179 ---- files.append((path, pathjoin("Contents", "Resources", os.path.basename(path)))) + for path in self.libs: + files.append((path, pathjoin("Contents", "Frameworks", + os.path.basename(path)))) if self.symlink: self.message("Making symbolic links", 1) *************** *** 269,272 **** --- 276,280 ---- executable = os.path.join(execdir, "%(executable)s") resdir = os.path.join(os.path.dirname(execdir), "Resources") + libdir = os.path.join(os.path.dirname(execdir), "Frameworks") mainprogram = os.path.join(resdir, "%(mainprogram)s") *************** *** 275,278 **** --- 283,287 ---- os.environ["PYTHONHOME"] = resdir os.environ["PYTHONEXECUTABLE"] = executable + os.environ["DYLD_LIBRARY_PATH"] = libdir os.execve(executable, sys.argv, os.environ) """ *************** *** 698,701 **** --- 707,712 ---- --standalone build a standalone application, which is fully independent of a Python installation + --lib=FILE shared library or framework to be copied into + the bundle -x, --exclude=MODULE exclude module (with --standalone) -i, --include=MODULE include module (with --standalone) *************** *** 721,725 **** "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "argv", "standalone", ! "exclude=", "include=", "package=", "strip", "iconfile=") try: --- 732,737 ---- "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "argv", "standalone", ! "exclude=", "include=", "package=", "strip", "iconfile=", ! "lib=") try: *************** *** 751,754 **** --- 763,768 ---- elif opt == '--iconfile': builder.iconfile = arg + elif opt == "--lib": + builder.libs.append(arg) elif opt == "--nib": builder.nibname = arg From jvr@users.sourceforge.net Fri Mar 21 11:32:39 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 21 Mar 2003 03:32:39 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv11164 Modified Files: bundlebuilder.py Log Message: only set $PYTHONHOME when building a standalone app. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** bundlebuilder.py 21 Mar 2003 09:26:59 -0000 1.22 --- bundlebuilder.py 21 Mar 2003 11:32:37 -0000 1.23 *************** *** 281,285 **** sys.argv.insert(1, mainprogram) os.environ["PYTHONPATH"] = resdir ! os.environ["PYTHONHOME"] = resdir os.environ["PYTHONEXECUTABLE"] = executable os.environ["DYLD_LIBRARY_PATH"] = libdir --- 281,286 ---- sys.argv.insert(1, mainprogram) os.environ["PYTHONPATH"] = resdir ! if %(standalone)s: ! os.environ["PYTHONHOME"] = resdir os.environ["PYTHONEXECUTABLE"] = executable os.environ["DYLD_LIBRARY_PATH"] = libdir *************** *** 446,449 **** --- 447,451 ---- while os.path.islink(hashbang): hashbang = os.readlink(hashbang) + standalone = self.standalone open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) os.chmod(bootstrappath, 0775) From jackjansen@users.sourceforge.net Fri Mar 21 12:04:21 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:04:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetypes.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv20157/Lib/plat-mac Modified Files: aetypes.py Log Message: Patch 702620 by Donovan Preston: Fix AE inheritance. Index: aetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetypes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** aetypes.py 12 Feb 2003 15:37:25 -0000 1.3 --- aetypes.py 21 Mar 2003 12:04:18 -0000 1.4 *************** *** 503,511 **** # Also, dictionaries _propdict and _elemdict must be set to map property # and element names to the correct classes ! def __init__(self, which, fr = None): SelectableItem.__init__(self, self.want, which, fr) - self._propdict = {} - self._elemdict = {} def __repr__(self): --- 503,511 ---- # Also, dictionaries _propdict and _elemdict must be set to map property # and element names to the correct classes ! ! _propdict = {} ! _elemdict = {} def __init__(self, which, fr = None): SelectableItem.__init__(self, self.want, which, fr) def __repr__(self): From jackjansen@users.sourceforge.net Fri Mar 21 12:04:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:04:22 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv20157/Mac/scripts Modified Files: gensuitemodule.py Log Message: Patch 702620 by Donovan Preston: Fix AE inheritance. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** gensuitemodule.py 6 Mar 2003 23:04:38 -0000 1.29 --- gensuitemodule.py 21 Mar 2003 12:04:19 -0000 1.30 *************** *** 322,333 **** # Generate property dicts and element dicts for all types declared in this module ! fp.write("def getbaseclasses(v):\n") ! fp.write("\tif hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'):\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") ! fp.write("\t\tfor superclass in v._superclassnames:\n") ! ## fp.write("\t\t\tgetbaseclasses(superclass)\n") ! fp.write("\t\t\tv._propdict.update(getattr(eval(superclass), '_privpropdict', {}))\n") ! fp.write("\t\t\tv._elemdict.update(getattr(eval(superclass), '_privelemdict', {}))\n") fp.write("\t\tv._propdict.update(v._privpropdict)\n") fp.write("\t\tv._elemdict.update(v._privelemdict)\n") --- 322,334 ---- # Generate property dicts and element dicts for all types declared in this module ! fp.write("\ndef getbaseclasses(v):\n") ! fp.write("\tif not v._propdict:\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") ! fp.write("\t\tfor superclassname in getattr(v, '_superclassnames', []):\n") ! fp.write("\t\t\tsuperclass = eval(superclassname)\n") ! fp.write("\t\t\tgetbaseclasses(superclass)\n") ! fp.write("\t\t\tv._propdict.update(getattr(superclass, '_propdict', {}))\n") ! fp.write("\t\t\tv._elemdict.update(getattr(superclass, '_elemdict', {}))\n") fp.write("\t\tv._propdict.update(v._privpropdict)\n") fp.write("\t\tv._elemdict.update(v._privelemdict)\n") From jackjansen@users.sourceforge.net Fri Mar 21 12:54:04 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:54:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_macfs.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7468 Modified Files: test_macfs.py Log Message: Adding unicode filename support to FSRefs broke things on MacOS9. "Fixed" by disabling unicode filenames on OS9. Index: test_macfs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_macfs.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_macfs.py 12 Mar 2003 13:47:39 -0000 1.5 --- test_macfs.py 21 Mar 2003 12:54:02 -0000 1.6 *************** *** 6,9 **** --- 6,10 ---- import macfs import os + import sys import tempfile from test import test_support *************** *** 31,37 **** def test_fsref_unicode(self): ! testfn_unicode = unicode(test_support.TESTFN) ! fsr = macfs.FSRef(testfn_unicode) ! self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) def test_coercion(self): --- 32,39 ---- def test_fsref_unicode(self): ! if sys.getfilesystemencoding(): ! testfn_unicode = unicode(test_support.TESTFN) ! fsr = macfs.FSRef(testfn_unicode) ! self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) def test_coercion(self): From jackjansen@users.sourceforge.net Fri Mar 21 12:54:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:54:26 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/file filesupport.py,1.16,1.17 _Filemodule.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/file In directory sc8-pr-cvs1:/tmp/cvs-serv7609 Modified Files: filesupport.py _Filemodule.c Log Message: Adding unicode filename support to FSRefs broke things on MacOS9. "Fixed" by disabling unicode filenames on OS9. Index: filesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filesupport.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** filesupport.py 11 Mar 2003 21:48:57 -0000 1.16 --- filesupport.py 21 Mar 2003 12:54:24 -0000 1.17 *************** *** 253,257 **** if ( PyMac_GetFSRef(v, &fsr) ) { #else ! if ( PyArg_Parse(v, "O&", FSRef_Convert, &fsr) ) { #endif err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL); --- 253,258 ---- if ( PyMac_GetFSRef(v, &fsr) ) { #else ! if (FSRef_Check(v)) { ! fsr = ((FSRefObject *)v)->ob_itself; #endif err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL); Index: _Filemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/_Filemodule.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** _Filemodule.c 11 Mar 2003 21:48:56 -0000 1.18 --- _Filemodule.c 21 Mar 2003 12:54:24 -0000 1.19 *************** *** 3195,3199 **** if ( PyMac_GetFSRef(v, &fsr) ) { #else ! if ( PyArg_Parse(v, "O&", FSRef_Convert, &fsr) ) { #endif err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL); --- 3195,3200 ---- if ( PyMac_GetFSRef(v, &fsr) ) { #else ! if (FSRef_Check(v)) { ! fsr = ((FSRefObject *)v)->ob_itself; #endif err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL); From jackjansen@users.sourceforge.net Fri Mar 21 12:55:13 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:55:13 -0800 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7914 Modified Files: tempfile.py Log Message: Getting rid of macfs. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** tempfile.py 30 Dec 2002 22:36:09 -0000 1.54 --- tempfile.py 21 Mar 2003 12:55:10 -0000 1.55 *************** *** 34,39 **** if _os.name == 'mac': ! import macfs as _macfs ! import MACFS as _MACFS try: --- 34,39 ---- if _os.name == 'mac': ! import Carbon.Folder as _Folder ! import Carbon.Folders as _Folders try: *************** *** 125,133 **** if _os.name == 'mac': try: ! refnum, dirid = _macfs.FindFolder(_MACFS.kOnSystemDisk, ! _MACFS.kTemporaryFolderType, 1) ! dirname = _macfs.FSSpec((refnum, dirid, '')).as_pathname() dirlist.append(dirname) ! except _macfs.error: pass elif _os.name == 'riscos': --- 125,133 ---- if _os.name == 'mac': try: ! fsr = _Folder.FSFindFolder(_Folders.kOnSystemDisk, ! _Folders.kTemporaryFolderType, 1) ! dirname = fsr.as_pathname() dirlist.append(dirname) ! except _Folder.error: pass elif _os.name == 'riscos': From jackjansen@users.sourceforge.net Fri Mar 21 12:55:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:55:41 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib/mkcwproject __init__.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/mkcwproject In directory sc8-pr-cvs1:/tmp/cvs-serv8108 Modified Files: __init__.py Log Message: Getting rid of macfs. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/mkcwproject/__init__.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** __init__.py 26 Jun 2002 20:35:18 -0000 1.13 --- __init__.py 21 Mar 2003 12:55:38 -0000 1.14 *************** *** 3,7 **** import os from Carbon import AppleEvents ! import macfs def mkproject(outputfile, modulename, settings, force=0, templatename=None): --- 3,7 ---- import os from Carbon import AppleEvents ! import Carbon.File def mkproject(outputfile, modulename, settings, force=0, templatename=None): *************** *** 59,64 **** cw = cwtalker.MyCodeWarrior(start=1) cw.send_timeout = AppleEvents.kNoTimeOut ! xmlfss = macfs.FSSpec(xmlfile) ! prjfss = macfs.FSSpec(projectfile) cw.my_mkproject(prjfss, xmlfss) cw.Close_Project() --- 59,64 ---- cw = cwtalker.MyCodeWarrior(start=1) cw.send_timeout = AppleEvents.kNoTimeOut ! xmlfss = Carbon.File.FSSpec(xmlfile) ! prjfss = Carbon.File.FSSpec(projectfile) cw.my_mkproject(prjfss, xmlfss) cw.Close_Project() *************** *** 67,71 **** cw = cwtalker.MyCodeWarrior(start=1) cw.send_timeout = AppleEvents.kNoTimeOut ! prjfss = macfs.FSSpec(projectfile) cw.open(prjfss) cw.Make_Project() # XXX Should set target --- 67,71 ---- cw = cwtalker.MyCodeWarrior(start=1) cw.send_timeout = AppleEvents.kNoTimeOut ! prjfss = Carbon.File.FSSpec(projectfile) cw.open(prjfss) cw.Make_Project() # XXX Should set target *************** *** 75,79 **** cw = cwtalker.MyCodeWarrior(start=1) cw.send_timeout = AppleEvents.kNoTimeOut ! prjfss = macfs.FSSpec(projectfile) cw.open(prjfss) cw.Remove_Binaries() --- 75,79 ---- cw = cwtalker.MyCodeWarrior(start=1) cw.send_timeout = AppleEvents.kNoTimeOut ! prjfss = Carbon.File.FSSpec(projectfile) cw.open(prjfss) cw.Remove_Binaries() From jackjansen@users.sourceforge.net Fri Mar 21 12:56:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 04:56:29 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts genpluginprojects.py,1.40,1.41 fullbuild.py,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv8398 Modified Files: genpluginprojects.py fullbuild.py Log Message: Added _csv module, and getting rid of macfs. Index: genpluginprojects.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genpluginprojects.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** genpluginprojects.py 21 Feb 2003 22:33:55 -0000 1.40 --- genpluginprojects.py 21 Mar 2003 12:56:27 -0000 1.41 *************** *** 110,113 **** --- 110,114 ---- libraries=["gdbm.ppc.gusi.lib"], extradirs=["::::gdbm:mac", "::::gdbm"]) + genpluginproject("carbon", "_csv", sources=["_csv.c"]) genpluginproject("carbon", "_weakref", sources=["_weakref.c"]) genpluginproject("carbon", "_symtable", sources=["symtablemodule.c"]) Index: fullbuild.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/fullbuild.py,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** fullbuild.py 26 Jan 2003 21:40:00 -0000 1.90 --- fullbuild.py 21 Mar 2003 12:56:27 -0000 1.91 *************** *** 16,20 **** import os import sys ! import macfs import MacOS import EasyDialogs --- 16,20 ---- import os import sys ! import Carbon.File import MacOS import EasyDialogs *************** *** 97,101 **** file = os.path.join(top, file) try: ! fss = macfs.FSSpec(file) except MacOS.Error: print '** file not found:', file --- 97,101 ---- file = os.path.join(top, file) try: ! fss = Carbon.File.FSSpec(file) except MacOS.Error: print '** file not found:', file *************** *** 195,198 **** --- 195,199 ---- ## ]) buildmwproject(top, "CWIE", [ + (":Mac:Build:_csv.carbon.mcp", "_csv.carbon"), (":Mac:Build:_weakref.carbon.mcp", "_weakref.carbon"), (":Mac:Build:_symtable.carbon.mcp", "_symtable.carbon"), From gvanrossum@users.sourceforge.net Fri Mar 21 14:54:23 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 21 Mar 2003 06:54:23 -0800 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28269 Modified Files: timeit.py Log Message: Rename variables _seq to _it and seq to it, to emphasize that this is an iterator (which can only be used once!). Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** timeit.py 15 Mar 2003 12:25:00 -0000 1.8 --- timeit.py 21 Mar 2003 14:54:19 -0000 1.9 *************** *** 76,83 **** # being indented 8 spaces. template = """ ! def inner(_seq, _timer): %(setup)s _t0 = _timer() ! for _i in _seq: %(stmt)s _t1 = _timer() --- 76,83 ---- # being indented 8 spaces. template = """ ! def inner(_it, _timer): %(setup)s _t0 = _timer() ! for _i in _it: %(stmt)s _t1 = _timer() *************** *** 152,159 **** """ if itertools: ! seq = itertools.repeat(None, number) else: ! seq = [None] * number ! return self.inner(seq, self.timer) def repeat(self, repeat=default_repeat, number=default_number): --- 152,159 ---- """ if itertools: ! it = itertools.repeat(None, number) else: ! it = [None] * number ! return self.inner(it, self.timer) def repeat(self, repeat=default_repeat, number=default_number): From jackjansen@users.sourceforge.net Fri Mar 21 16:07:42 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 08:07:42 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv27648 Modified Files: gensuitemodule.py Log Message: Allow gensuitemodule to be run non-interactively, from the OSX command line. 90% of the work is done, missing enums still cause a dialog to appear. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** gensuitemodule.py 21 Mar 2003 12:04:19 -0000 1.30 --- gensuitemodule.py 21 Mar 2003 16:07:39 -0000 1.31 *************** *** 21,24 **** --- 21,25 ---- from Carbon.Res import * import MacOS + import getopt _MAC_LIB_FOLDER=os.path.dirname(aetools.__file__) *************** *** 26,33 **** DEFAULT_USER_PACKAGEFOLDER=distutils.sysconfig.get_python_lib() def main(): if len(sys.argv) > 1: ! for filename in sys.argv[1:]: ! processfile(filename) else: # The dialogOptionFlags below allows selection of .app bundles. --- 27,74 ---- DEFAULT_USER_PACKAGEFOLDER=distutils.sysconfig.get_python_lib() + def usage(): + sys.stderr.write("Usage: %s [opts] application-or-resource-file\n" % sys.argv[0]) + sys.stderr.write("""Options: + --output pkgdir Pathname of the output package (short: -o) + --resource Parse resource file in stead of launching application (-r) + --base package Use another base package in stead of default StdSuites (-b) + --edit old=new Edit suite names, use empty new to skip a suite (-e) + """) + sys.exit(1) + def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:" ! LONGOPTS = ("resource", "base=", "output=", "edit=") ! try: ! opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) ! except getopt.GetoptError: ! usage() ! ! process_func = processfile ! basepkgname = 'StdSuites' ! output = None ! edit_modnames = [] ! ! for o, a in opts: ! if o in ('-r', '--resource'): ! process_func = processfile_fromresource ! if o in ('-b', '--base'): ! basepkgname = a ! if o in ('-o', '--output'): ! output = a ! if o in ('-e', '--edit'): ! split = a.split('=') ! if len(split) != 2: ! usage() ! edit_modnames.append(split) ! ! if output and len(args) > 1: ! sys.stderr.write("%s: cannot specify --output with multiple inputs\n" % sys.argv[0]) ! sys.exit(1) ! ! for filename in args: ! process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames) else: # The dialogOptionFlags below allows selection of .app bundles. *************** *** 44,48 **** processfile_fromresource(filename) ! def processfile_fromresource(fullname): """Process all resources in a single file""" cur = CurResFile() --- 85,89 ---- processfile_fromresource(filename) ! def processfile_fromresource(fullname, output=None, basepkgname=None, edit_modnames=None): """Process all resources in a single file""" cur = CurResFile() *************** *** 71,77 **** # switch back (needed for dialogs in Python) UseResFile(cur) ! compileaetelist(aetelist, fullname) ! def processfile(fullname): """Ask an application for its terminology and process that""" aedescobj, launched = OSATerminology.GetSysTerminology(fullname) --- 112,119 ---- # switch back (needed for dialogs in Python) UseResFile(cur) ! compileaetelist(aetelist, fullname, output=output, ! basepkgname=basepkgname, edit_modnames=edit_modnames) ! def processfile(fullname, output=None, basepkgname=None, edit_modnames=None): """Ask an application for its terminology and process that""" aedescobj, launched = OSATerminology.GetSysTerminology(fullname) *************** *** 87,95 **** aedata = raw[0] aete = decode(aedata.data) ! compileaete(aete, None, fullname) ! def compileaetelist(aetelist, fullname): for aete, resinfo in aetelist: ! compileaete(aete, resinfo, fullname) def decode(data): --- 129,138 ---- aedata = raw[0] aete = decode(aedata.data) ! compileaete(aete, None, fullname, output=output, basepkgname=basepkgname) ! def compileaetelist(aetelist, fullname, output=None, basepkgname=None, edit_modnames=None): for aete, resinfo in aetelist: ! compileaete(aete, resinfo, fullname, output=output, ! basepkgname=basepkgname, edit_modnames=edit_modnames) def decode(data): *************** *** 256,260 **** ] ! def compileaete(aete, resinfo, fname): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete --- 299,303 ---- ] ! def compileaete(aete, resinfo, fname, output=None, basepkgname=None, edit_modnames=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete *************** *** 268,281 **** if len(packagename) > 27: packagename = packagename[:27] ! pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename, ! defaultLocation=DEFAULT_USER_PACKAGEFOLDER) if not pathname: return packagename = os.path.split(os.path.normpath(pathname))[1] ! basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)', ! defaultLocation=DEFAULT_STANDARD_PACKAGEFOLDER) if basepkgname: dirname, basepkgname = os.path.split(os.path.normpath(basepkgname)) ! if not dirname in sys.path: sys.path.insert(0, dirname) basepackage = __import__(basepkgname) --- 311,331 ---- if len(packagename) > 27: packagename = packagename[:27] ! if output: ! # XXXX Put this in site-packages if it isn't a full pathname? ! if not os.path.exists(output): ! os.mkdir(output) ! pathname = output ! else: ! pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename, ! defaultLocation=DEFAULT_USER_PACKAGEFOLDER) if not pathname: return packagename = os.path.split(os.path.normpath(pathname))[1] ! if not basepkgname: ! basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)', ! defaultLocation=DEFAULT_STANDARD_PACKAGEFOLDER) if basepkgname: dirname, basepkgname = os.path.split(os.path.normpath(basepkgname)) ! if dirname and not dirname in sys.path: sys.path.insert(0, dirname) basepackage = __import__(basepkgname) *************** *** 286,290 **** allsuites = [] for suite in suites: ! code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage) if not code: continue --- 336,341 ---- allsuites = [] for suite in suites: ! code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage, ! output=output, edit_modnames=edit_modnames) if not code: continue *************** *** 295,302 **** for suiteinfo in allsuites: compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, allprecompinfo) ! initfilename = EasyDialogs.AskFileForSave(message='Package module', ! savedFileName='__init__.py') ! if not initfilename: ! return fp = open(initfilename, 'w') MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT') --- 346,350 ---- for suiteinfo in allsuites: compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, allprecompinfo) ! initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT') *************** *** 359,363 **** fp.close() ! def precompilesuite(suite, basepackage=None): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared --- 407,411 ---- fp.close() ! def precompilesuite(suite, basepackage=None, edit_modnames=None, output=None): """Parse a single suite without generating the output. This step is needed so we can resolve recursive references by suites to enums/comps/etc declared *************** *** 368,373 **** if len(modname) > 28: modname = modname[:27] ! pathname = EasyDialogs.AskFileForSave(message='Python output file', ! savedFileName=modname+'.py') if not pathname: return None, None, None, None, None --- 416,430 ---- if len(modname) > 28: modname = modname[:27] ! if edit_modnames is None: ! pathname = EasyDialogs.AskFileForSave(message='Python output file', ! savedFileName=modname+'.py') ! else: ! for old, new in edit_modnames: ! if old == modname: ! modname = new ! if modname: ! pathname = os.path.join(output, modname + '.py') ! else: ! pathname = None if not pathname: return None, None, None, None, None From jackjansen@users.sourceforge.net Fri Mar 21 16:28:17 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 08:28:17 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv6872 Modified Files: gensuitemodule.py Log Message: Got rid of the "enum not found" interaction, and added code to allow overriding the creator signature. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** gensuitemodule.py 21 Mar 2003 16:07:39 -0000 1.31 --- gensuitemodule.py 21 Mar 2003 16:28:09 -0000 1.32 *************** *** 34,37 **** --- 34,38 ---- --base package Use another base package in stead of default StdSuites (-b) --edit old=new Edit suite names, use empty new to skip a suite (-e) + --creator code Set creator code for package (-c) """) sys.exit(1) *************** *** 39,44 **** def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:" ! LONGOPTS = ("resource", "base=", "output=", "edit=") try: opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) --- 40,45 ---- def main(): if len(sys.argv) > 1: ! SHORTOPTS = "rb:o:e:c:" ! LONGOPTS = ("resource", "base=", "output=", "edit=", "creator=") try: opts, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) *************** *** 50,53 **** --- 51,55 ---- output = None edit_modnames = [] + creatorsignature = None for o, a in opts: *************** *** 63,66 **** --- 65,74 ---- usage() edit_modnames.append(split) + if o in ('-c', '--creator'): + if len(a) != 4: + sys.stderr.write("creator must be 4-char string\n") + sys.exit(1) + creatorsignature = a + if output and len(args) > 1: *************** *** 70,74 **** for filename in args: process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames) else: # The dialogOptionFlags below allows selection of .app bundles. --- 78,82 ---- for filename in args: process_func(filename, output=output, basepkgname=basepkgname, ! edit_modnames=edit_modnames, creatorsignature=creatorsignature) else: # The dialogOptionFlags below allows selection of .app bundles. *************** *** 85,89 **** processfile_fromresource(filename) ! def processfile_fromresource(fullname, output=None, basepkgname=None, edit_modnames=None): """Process all resources in a single file""" cur = CurResFile() --- 93,98 ---- processfile_fromresource(filename) ! def processfile_fromresource(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Process all resources in a single file""" cur = CurResFile() *************** *** 113,119 **** UseResFile(cur) compileaetelist(aetelist, fullname, output=output, ! basepkgname=basepkgname, edit_modnames=edit_modnames) ! def processfile(fullname, output=None, basepkgname=None, edit_modnames=None): """Ask an application for its terminology and process that""" aedescobj, launched = OSATerminology.GetSysTerminology(fullname) --- 122,130 ---- UseResFile(cur) compileaetelist(aetelist, fullname, output=output, ! basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature) ! def processfile(fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" aedescobj, launched = OSATerminology.GetSysTerminology(fullname) *************** *** 129,138 **** aedata = raw[0] aete = decode(aedata.data) ! compileaete(aete, None, fullname, output=output, basepkgname=basepkgname) ! def compileaetelist(aetelist, fullname, output=None, basepkgname=None, edit_modnames=None): for aete, resinfo in aetelist: compileaete(aete, resinfo, fullname, output=output, ! basepkgname=basepkgname, edit_modnames=edit_modnames) def decode(data): --- 140,152 ---- aedata = raw[0] aete = decode(aedata.data) ! compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature) ! def compileaetelist(aetelist, fullname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): for aete, resinfo in aetelist: compileaete(aete, resinfo, fullname, output=output, ! basepkgname=basepkgname, edit_modnames=edit_modnames, ! creatorsignature=creatorsignature) def decode(data): *************** *** 299,307 **** ] ! def compileaete(aete, resinfo, fname, output=None, basepkgname=None, edit_modnames=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete major, minor = divmod(version, 256) ! creatorsignature, dummy = MacOS.GetCreatorAndType(fname) packagename = identify(os.path.splitext(os.path.basename(fname))[0]) if language: --- 313,323 ---- ] ! def compileaete(aete, resinfo, fname, output=None, basepkgname=None, ! edit_modnames=None, creatorsignature=None): """Generate code for a full aete resource. fname passed for doc purposes""" [version, language, script, suites] = aete major, minor = divmod(version, 256) ! if not creatorsignature: ! creatorsignature, dummy = MacOS.GetCreatorAndType(fname) packagename = identify(os.path.splitext(os.path.basename(fname))[0]) if language: *************** *** 345,349 **** allsuites.append(suiteinfo) for suiteinfo in allsuites: ! compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, allprecompinfo) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') --- 361,366 ---- allsuites.append(suiteinfo) for suiteinfo in allsuites: ! compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, ! allprecompinfo, interact=(edit_modnames is None)) initfilename = os.path.join(output, '__init__.py') fp = open(initfilename, 'w') *************** *** 444,448 **** findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule) for cls in classes: objc.compileclass(cls) --- 461,465 ---- findenumsinevent(event, enumsneeded) ! objc = ObjectCompiler(None, basemodule, interact=(edit_modnames is None)) for cls in classes: objc.compileclass(cls) *************** *** 463,467 **** return code, suite, pathname, modname, precompinfo ! def compilesuite((suite, pathname, modname), major, minor, language, script, fname, basepackage, precompinfo): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite --- 480,485 ---- return code, suite, pathname, modname, precompinfo ! def compilesuite((suite, pathname, modname), major, minor, language, script, ! fname, basepackage, precompinfo, interact=1): """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite *************** *** 501,505 **** fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo) for cls in classes: objc.compileclass(cls) --- 519,523 ---- fp.write("\tpass\n\n") ! objc = ObjectCompiler(fp, basemodule, precompinfo, interact=interact) for cls in classes: objc.compileclass(cls) *************** *** 655,659 **** class CodeNameMapper: ! def __init__(self): self.code2name = { "property" : {}, --- 673,677 ---- class CodeNameMapper: ! def __init__(self, interact=1): self.code2name = { "property" : {}, *************** *** 670,673 **** --- 688,692 ---- self.modulename = None self.star_imported = 0 + self.can_interact = interact def addnamecode(self, type, name, code): *************** *** 713,720 **** class ObjectCompiler: ! def __init__(self, fp, basesuite=None, othernamemappers=None): self.fp = fp self.basesuite = basesuite ! self.namemappers = [CodeNameMapper()] if othernamemappers: self.othernamemappers = othernamemappers[:] --- 732,740 ---- class ObjectCompiler: ! def __init__(self, fp, basesuite=None, othernamemappers=None, interact=1): self.fp = fp self.basesuite = basesuite ! self.can_interact = interact ! self.namemappers = [CodeNameMapper(self.can_interact)] if othernamemappers: self.othernamemappers = othernamemappers[:] *************** *** 722,726 **** self.othernamemappers = [] if basesuite: ! basemapper = CodeNameMapper() basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) --- 742,746 ---- self.othernamemappers = [] if basesuite: ! basemapper = CodeNameMapper(self.can_interact) basemapper.addmodule(basesuite, '', 1) self.namemappers.append(basemapper) *************** *** 756,764 **** m = None if not m: return None, None, None ! mapper = CodeNameMapper() mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) def askdefinitionmodule(self, type, code): path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) if not path: return --- 776,787 ---- m = None if not m: return None, None, None ! mapper = CodeNameMapper(self.can_interact) mapper.addmodule(m, m.__name__, 0) self.namemappers.append(mapper) def askdefinitionmodule(self, type, code): + if not self.can_interact: + print "** No definition for %s '%s' found" % (type, code) + return None path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code)) if not path: return From jackjansen@users.sourceforge.net Fri Mar 21 16:30:56 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 08:30:56 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts genallsuites.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv8134 Added Files: genallsuites.py Log Message: Generate all the standard OSA suite packages. Has absolute pathname dependencies all over the place, but this is better than nothing, for now. --- NEW FILE: genallsuites.py --- # Generate all the standard scripting suite packages. # Note that this module needs *serious* hand-crafting because of all the # absolute paths. It is, however, a great leap forward compared to the time # when this information was only stored in Jack's brain:-) import sys import os import gensuitemodule DSTDIR="/Users/jack/src/python/Lib/plat-mac/lib-scriptpackages" APPLESCRIPT="/Volumes/Sap/System Folder/Extensions/AppleScript" CODEWARRIOR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5" EXPLORER="/Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer" FINDER="/Volumes/Sap/System Folder/Finder" NETSCAPE="/Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2" TERMINAL="/Applications/Utilities/Terminal.app/Contents/Resources/Terminal.rsrc" gensuitemodule.processfile_fromresource(APPLESCRIPT, output=os.path.join(DSTDIR, 'StdSuites'), basepkgname='_builtinSuites', edit_modnames=[]) gensuitemodule.processfile_fromresource(CODEWARRIOR, output=os.path.join(DSTDIR, 'CodeWarrior'), basepkgname='StdSuites', edit_modnames=[]) gensuitemodule.processfile_fromresource(EXPLORER, output=os.path.join(DSTDIR, 'Explorer'), basepkgname='StdSuites', edit_modnames=[]) gensuitemodule.processfile_fromresource(FINDER, output=os.path.join(DSTDIR, 'Finder'), basepkgname='StdSuites', edit_modnames=[]) gensuitemodule.processfile_fromresource(NETSCAPE, output=os.path.join(DSTDIR, 'Netscape'), basepkgname='StdSuites', edit_modnames=[('WorldWideWeb_suite_2c__as_d', 'WorldWideWeb_suite')]) gensuitemodule.processfile_fromresource(TERMINAL, output=os.path.join(DSTDIR, 'Terminal'), basepkgname='StdSuites', edit_modnames=[], creatorsignature='trmx') From jackjansen@users.sourceforge.net Fri Mar 21 16:42:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 08:42:39 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd _Qdmodule.c,1.16,1.17 qdsupport.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory sc8-pr-cvs1:/tmp/cvs-serv13171 Modified Files: _Qdmodule.c qdsupport.py Log Message: Give a better error message when a string of the wrong size is passed to RawBitMap. Index: _Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/_Qdmodule.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _Qdmodule.c 23 Dec 2002 23:16:23 -0000 1.16 --- _Qdmodule.c 21 Mar 2003 16:42:36 -0000 1.17 *************** *** 15,21 **** /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) --- 15,21 ---- /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ ! PyErr_SetString(PyExc_NotImplementedError, \ ! "Not available in this shared library/OS version"); \ ! return NULL; \ }} while(0) *************** *** 6259,6263 **** return NULL; if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { ! PyErr_BadArgument(); return NULL; } --- 6259,6265 ---- return NULL; if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { ! PyErr_Format(PyExc_TypeError, ! "Argument size was %d, should be %d (sizeof BitMap) or %d (sizeof PixMap)", ! PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } Index: qdsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdsupport.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** qdsupport.py 12 Dec 2002 10:31:52 -0000 1.42 --- qdsupport.py 21 Mar 2003 16:42:36 -0000 1.43 *************** *** 421,425 **** return NULL; if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { ! PyErr_BadArgument(); return NULL; } --- 421,427 ---- return NULL; if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { ! PyErr_Format(PyExc_TypeError, ! "Argument size was %d, should be %d (sizeof BitMap) or %d (sizeof PixMap)", ! PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } From tim_one@users.sourceforge.net Fri Mar 21 17:10:06 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 21 Mar 2003 09:10:06 -0800 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.121,2.122 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv30278/Objects Modified Files: floatobject.c Log Message: _PyFloat_Pack4(): Removed needless call of floor(). Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.121 retrieving revision 2.122 diff -C2 -d -r2.121 -r2.122 *** floatobject.c 20 Mar 2003 20:53:32 -0000 2.121 --- floatobject.c 21 Mar 2003 17:10:03 -0000 2.122 *************** *** 961,965 **** f *= 8388608.0; /* 2**23 */ ! fbits = (long) floor(f + 0.5); /* Round */ assert(fbits <= 8388608); if (fbits >> 23) { --- 961,965 ---- f *= 8388608.0; /* 2**23 */ ! fbits = (unsigned int)(f + 0.5); /* Round */ assert(fbits <= 8388608); if (fbits >> 23) { From akuchling@users.sourceforge.net Fri Mar 21 17:23:11 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 21 Mar 2003 09:23:11 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv6841 Modified Files: whatsnew23.tex Log Message: Update datetime section a bit Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** whatsnew23.tex 13 Mar 2003 13:56:50 -0000 1.130 --- whatsnew23.tex 21 Mar 2003 17:23:07 -0000 1.131 *************** *** 1680,1685 **** \subsection{Date/Time Type} - % XXX This is out-of-date already: timetz and so on have gone away. - Date and time types suitable for expressing timestamps were added as the \module{datetime} module. The types don't support different --- 1680,1683 ---- *************** *** 1690,1697 **** and year; \class{time}, consisting of hour, minute, and second; and \class{datetime}, which contains all the attributes of both ! \class{date} and \class{time}. These basic types don't understand ! time zones, but there are subclasses named \class{timetz} and ! \class{datetimetz} that do. There's also a ! \class{timedelta} class representing a difference between two points in time, and time zone logic is implemented by classes inheriting from the abstract \class{tzinfo} class. --- 1688,1693 ---- and year; \class{time}, consisting of hour, minute, and second; and \class{datetime}, which contains all the attributes of both ! \class{date} and \class{time}. There's also a ! \class{timedelta} class representing differences between two points in time, and time zone logic is implemented by classes inheriting from the abstract \class{tzinfo} class. *************** *** 1700,1704 **** supplying keyword arguments to the appropriate constructor, e.g. \code{datetime.date(year=1972, month=10, day=15)}, or by using ! one of a number of class methods. For example, the \method{today()} class method returns the current local date. --- 1696,1700 ---- supplying keyword arguments to the appropriate constructor, e.g. \code{datetime.date(year=1972, month=10, day=15)}, or by using ! one of a number of class methods. For example, the \method{date.today()} class method returns the current local date. *************** *** 1733,1737 **** result is the same as that of \method{isoformat()}). \class{date} and \class{datetime} instances can be subtracted from each other, and ! added to \class{timedelta} instances. For more information, refer to the \ulink{module's reference --- 1729,1735 ---- result is the same as that of \method{isoformat()}). \class{date} and \class{datetime} instances can be subtracted from each other, and ! added to \class{timedelta} instances. The largest missing feature is ! that there's no support for parsing strings and getting back a ! \class{date} or \class{datetime}. For more information, refer to the \ulink{module's reference *************** *** 1824,1837 **** \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}} ! An experimental feature added to Python 2.1 was pymalloc, a ! specialized object allocator written by Vladimir Marangozov. Pymalloc ! is intended to be faster than the system \cfunction{malloc()} and ! to have less memory overhead for allocation patterns typical of Python ! programs. The allocator uses C's \cfunction{malloc()} function to get ! large pools of memory and then fulfills smaller memory requests from ! these pools. In 2.1 and 2.2, pymalloc was an experimental feature and wasn't ! enabled by default; you had to explicitly turn it on by providing the \longprogramopt{with-pymalloc} option to the \program{configure} script. In 2.3, pymalloc has had further enhancements and is now --- 1822,1836 ---- \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}} ! Pymalloc, a specialized object allocator written by Vladimir ! Marangozov, was a feature added to Python 2.1. Pymalloc is intended ! to be faster than the system \cfunction{malloc()} and to have less ! memory overhead for allocation patterns typical of Python programs. ! The allocator uses C's \cfunction{malloc()} function to get large ! pools of memory and then fulfills smaller memory requests from these ! pools. In 2.1 and 2.2, pymalloc was an experimental feature and wasn't ! enabled by default; you had to explicitly enable it when compiling ! Python by providing the \longprogramopt{with-pymalloc} option to the \program{configure} script. In 2.3, pymalloc has had further enhancements and is now From akuchling@users.sourceforge.net Fri Mar 21 18:10:14 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 21 Mar 2003 10:10:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv6513 Modified Files: whatsnew23.tex Log Message: Add PEP305 section Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** whatsnew23.tex 21 Mar 2003 17:23:07 -0000 1.131 --- whatsnew23.tex 21 Mar 2003 18:10:12 -0000 1.132 *************** *** 835,838 **** --- 835,888 ---- %====================================================================== + \section{PEP 305: Comma-separated Files \label{section-pep305}} + + Comma-separated files are a format frequently used for exporting data + from databases and spreadsheets. Python 2.3 adds a parser for + comma-separated files. + The format is deceptively simple at first glance: + + \begin{verbatim} + Costs,150,200,3.95 + \end{verbatim} + + Read a line and call \code{line.split(',')}: what could be simpler? + But toss in string data that can contain commas, and things get more + complicated: + + \begin{verbatim} + "Costs",150,200,3.95,"Includes taxes, shipping, and sundry items" + \end{verbatim} + + A big ugly regular expression can parse this, but using the new + \module{csv} package is much simpler: + + \begin{verbatim} + from csv import csv + + input = open('datafile', 'rb') + reader = csv.reader(input) + for line in reader: + print line + \end{verbatim} + + The \function{reader} function takes a number of different options. + The field separator isn't limited to the comma and can be changed to + any character, and so can the quoting and line-ending characters. + + Different dialects of comma-separated files can be defined and + registered; currently there are two, both for Microsoft Excel. + A separate \class{csv.writer} class will generate comma-separated files + from a succession of tuples or lists, quoting strings that contain the + delimiter. + + \begin{seealso} + + \seepep{305}{CSV File API}{Written and implemented + by Kevin Altis, Dave Cole, Andrew McNamara, Skip Montanaro, Cliff Wells. + } + + \end{seealso} + + %====================================================================== \section{Extended Slices\label{section-slices}} From akuchling@users.sourceforge.net Fri Mar 21 18:32:45 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 21 Mar 2003 10:32:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv21709 Modified Files: whatsnew23.tex Log Message: Add PEP 307 section Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** whatsnew23.tex 21 Mar 2003 18:10:12 -0000 1.132 --- whatsnew23.tex 21 Mar 2003 18:32:43 -0000 1.133 *************** *** 885,888 **** --- 885,932 ---- %====================================================================== + \section{PEP 307: Pickle Enhancements \label{section-pep305}} + + The \module{pickle} and \module{cPickle} modules received some + attention during the 2.3 development cycle. In 2.2, new-style classes + could be pickled without difficult, but they weren't pickled very + compactly; \pep{307} quotes a trivial example where a new-style class + results in a pickled string three times longer than that for a classic + class. + + The solution was to invent a new pickle protocol. The + \function{pickle.dumps()} function has supported a text-or-binary flag + for a long time. In 2.3, this flag is redefined from a Boolean to an + integer; 0 is the old text-mode pickle format, 1 is the old binary + format, and now 2 is a new 2.3-specific format. (A new constant, + \constant{pickle.HIGHEST_PROTOCOL}, can be used to select the fanciest + protocol available.) + + Unpickling is no longer considered a safe operation. 2.2's + \module{pickle} provided hooks for trying to prevent unsafe classes + from being unpickled (specifically, a + \member{__safe_for_unpickling__} attribute), but none of this code + was ever audited and therefore it's all been ripped out in 2.3. You + should not unpickle untrusted data in any version of Python. + + To reduce the pickling overhead for new-style classes, a new interface + for customizing pickling was added using three special methods: + \method{__getstate__}, \method{__setstate__}, and + \method{__getnewargs__}. Consult \pep{307} for the full semantics + of these methods. + + As a way to compress pickles yet further, it's now possible to use + integer codes instead of long strings to identify pickled classes. + The Python Software Foundation will maintain a list of standardized + codes; there's also a range of codes for private use. Currently no + codes have been specified. + + \begin{seealso} + + \seepep{307}{Extensions to the pickle protocol}{Written and implemented + by Guido van Rossum and Tim Peters.} + + \end{seealso} + + %====================================================================== \section{Extended Slices\label{section-slices}} From bwarsaw@users.sourceforge.net Fri Mar 21 18:58:02 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 21 Mar 2003 10:58:02 -0800 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv5659 Modified Files: __init__.py Log Message: Email version 2.5 -- I will now backport this to Python 2.2.3. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** __init__.py 11 Mar 2003 05:05:21 -0000 1.24 --- __init__.py 21 Mar 2003 18:57:59 -0000 1.25 *************** *** 5,9 **** """ ! __version__ = '2.5b1' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5' __all__ = [ From rhettinger@users.sourceforge.net Fri Mar 21 19:57:11 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 21 Mar 2003 11:57:11 -0800 Subject: [Python-checkins] python/nondist/peps pep-0279.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv30550 Modified Files: pep-0279.txt Log Message: Reference the itertools module Index: pep-0279.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0279.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0279.txt 29 Apr 2002 16:03:43 -0000 1.13 --- pep-0279.txt 21 Mar 2003 19:57:09 -0000 1.14 *************** *** 172,178 **** 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. --- 172,178 ---- use of generators. ! This proposal originally included another function iterzip(). ! That was subsequently implemented as the izip() function in ! the itertools module. From bwarsaw@users.sourceforge.net Fri Mar 21 21:14:50 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 21 Mar 2003 13:14:50 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib mimelib.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30110 Modified Files: mimelib.tex Log Message: email is at version 2.5 now Index: mimelib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/mimelib.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mimelib.tex 12 Mar 2003 03:43:09 -0000 1.5 --- mimelib.tex 21 Mar 2003 21:14:48 -0000 1.6 *************** *** 13,17 **** \date{\today} ! \release{2.5b1} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.5} % major.minor only for software --- 13,17 ---- \date{\today} ! \release{2.5} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.5} % major.minor only for software From bwarsaw@users.sourceforge.net Fri Mar 21 21:09:35 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 21 Mar 2003 13:09:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test/data audiotest.au,NONE,1.1.8.1 msg_34.txt,NONE,1.1.8.1 msg_35.txt,NONE,1.1.8.1 msg_21.txt,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory sc8-pr-cvs1:/tmp/cvs-serv27730/Lib/email/test/data Modified Files: Tag: release22-maint msg_21.txt Added Files: Tag: release22-maint audiotest.au msg_34.txt msg_35.txt Log Message: Backporting email 2.5 to Python 2.2 maint branch. --- NEW FILE: audiotest.au --- (This appears to be a binary file; contents omitted.) --- NEW FILE: msg_34.txt --- From: aperson@dom.ain To: bperson@dom.ain Content-Type: multipart/digest; boundary=XYZ --XYZ Content-Type: text/plain This is a text plain part that is counter to recommended practice in RFC 2046, $5.1.5, but is not illegal --XYZ From: cperson@dom.ain To: dperson@dom.ain A submessage --XYZ-- --- NEW FILE: msg_35.txt --- From: aperson@dom.ain To: bperson@dom.ain Subject: here's something interesting counter to RFC 2822, there's no separating newline here Index: msg_21.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/data/msg_21.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** msg_21.txt 4 Oct 2002 17:40:57 -0000 1.1.2.1 --- msg_21.txt 21 Mar 2003 21:09:32 -0000 1.1.2.2 *************** *** 11,15 **** One - --BOUNDARY Content-Type: text/plain; charset="us-ascii" --- 11,14 ---- *************** *** 18,22 **** Two - --BOUNDARY-- End of MIME message --- 17,20 ---- From bwarsaw@users.sourceforge.net Fri Mar 21 21:09:34 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 21 Mar 2003 13:09:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.17.2.5,1.17.2.6 test_email_codecs.py,1.3.2.2,1.3.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv27730/Lib/email/test Modified Files: Tag: release22-maint test_email.py test_email_codecs.py Log Message: Backporting email 2.5 to Python 2.2 maint branch. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.17.2.5 retrieving revision 1.17.2.6 diff -C2 -d -r1.17.2.5 -r1.17.2.6 *** test_email.py 29 Oct 2002 22:01:06 -0000 1.17.2.5 --- test_email.py 21 Mar 2003 21:09:32 -0000 1.17.2.6 *************** *** 1,14 **** ! # Copyright (C) 2001,2002 Python Software Foundation # email package unit tests - import sys import os import time - import unittest import base64 import difflib from cStringIO import StringIO [...1008 lines suppressed...] ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"')) *************** *** 2314,2317 **** --- 2629,2643 ---- msg = self._msgobj('msg_32.txt') eq(msg.get_content_charset(), 'us-ascii') + + def test_rfc2231_no_language_or_charset(self): + m = '''\ + Content-Transfer-Encoding: 8bit + Content-Disposition: inline; filename="file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm" + Content-Type: text/html; NAME*0=file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEM; NAME*1=P_nsmail.htm + + ''' + msg = email.message_from_string(m) + self.assertEqual(msg.get_param('NAME'), + (None, None, 'file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm')) Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_codecs.py,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** test_email_codecs.py 4 Oct 2002 18:00:13 -0000 1.3.2.2 --- test_email_codecs.py 21 Mar 2003 21:09:32 -0000 1.3.2.3 *************** *** 29,33 **** h.append(jhello, j) h.append(ghello, g) ! eq(h.encode(), 'Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?=\n =?iso-8859-1?q?Gr=FC=DF_Gott!?=') eq(decode_header(h.encode()), [('Hello World!', None), --- 29,40 ---- h.append(jhello, j) h.append(ghello, g) ! # BAW: This used to -- and maybe should -- fold the two iso-8859-1 ! # chunks into a single encoded word. However it doesn't violate the ! # standard to have them as two encoded chunks and maybe it's ! # reasonable for each .append() call to result in a separate ! # encoded word. ! eq(h.encode(), """\ ! Hello World! =?iso-2022-jp?b?GyRCJU8lbSE8JW8hPCVrJUkhKhsoQg==?= ! =?iso-8859-1?q?Gr=FC=DF?= =?iso-8859-1?q?_Gott!?=""") eq(decode_header(h.encode()), [('Hello World!', None), *************** *** 38,58 **** # test a very long header enc = h.encode() ! # BAW: The following used to pass. Sadly, the test afterwards is what ! # happens now. I've no idea which is right. Please, any Japanese and ! # RFC 2047 experts, please verify! ! ## eq(enc, '''\ ! ##=?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYRsoQg==?= ! ## =?iso-2022-jp?b?GyRCITwlayRPO0oycTxUJE4+NRsoQg==?= ! ## =?iso-2022-jp?b?GyRCRyckckJUJEMkRiQkJF4kORsoQg==?=''') ! eq(enc, """\ ! =?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYRsoQg==?= ! =?iso-2022-jp?b?GyRCITwlayRPO0oycTxUJE4+NUcnJHJCVCRDJEYkJCReJDkbKEI=?=""") ! # BAW: same deal here. :( ! ## self.assertEqual( ! ## decode_header(enc), ! ## [("test-ja \x1b$B$XEj9F$5$l$?%a\x1b(B\x1b$B!<%k$O;J2q5\x1b(B\x1b$BG'$rBT$C$F$$$^$9\x1b(B", 'iso-2022-jp')]) ! self.assertEqual( ! decode_header(enc), ! [("test-ja \x1b$B$XEj9F$5$l$?%a\x1b(B\x1b$B!<%k$O;J2q5G'$rBT$C$F$$$^$9\x1b(B", 'iso-2022-jp')]) --- 45,54 ---- # test a very long header enc = h.encode() ! # TK: splitting point may differ by codec design and/or Header encoding ! eq(enc , """\ ! =?iso-2022-jp?b?dGVzdC1qYSAbJEIkWEVqOUYkNSRsJD8lYSE8JWskTztKGyhC?= ! =?iso-2022-jp?b?GyRCMnE8VCROPjVHJyRyQlQkQyRGJCQkXiQ5GyhC?=""") ! # TK: full decode comparison ! eq(h.__unicode__().encode('euc-jp'), long) From bwarsaw@users.sourceforge.net Fri Mar 21 21:24:30 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 21 Mar 2003 13:24:30 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib email.tex,1.9.6.3,1.9.6.4 emailcharsets.tex,1.1.2.2,1.1.2.3 emailheaders.tex,1.2.2.1,1.2.2.2 emailiter.tex,1.2.12.1,1.2.12.2 emailmessage.tex,1.4.8.2,1.4.8.3 emailmimebase.tex,1.2.2.1,1.2.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2338 Modified Files: Tag: release22-maint email.tex emailcharsets.tex emailheaders.tex emailiter.tex emailmessage.tex emailmimebase.tex Log Message: Backporting docs for email 2.5 Index: email.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/email.tex,v retrieving revision 1.9.6.3 retrieving revision 1.9.6.4 diff -C2 -d -r1.9.6.3 -r1.9.6.4 *** email.tex 4 Oct 2002 17:24:23 -0000 1.9.6.3 --- email.tex 21 Mar 2003 21:24:24 -0000 1.9.6.4 *************** *** 324,330 **** \verbatiminput{email-mime.py} ! Here's an example\footnote{Thanks to Matthew Dixon Cowles for the ! original inspiration and examples.} of how to send the entire contents ! of a directory as an email message: \verbatiminput{email-dir.py} --- 324,331 ---- \verbatiminput{email-mime.py} ! Here's an example of how to send the entire contents of a directory as ! an email message: ! \footnote{Thanks to Matthew Dixon Cowles for the original inspiration ! and examples.} \verbatiminput{email-dir.py} Index: emailcharsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailcharsets.tex,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** emailcharsets.tex 10 Oct 2002 19:10:45 -0000 1.1.2.2 --- emailcharsets.tex 21 Mar 2003 21:24:26 -0000 1.1.2.3 *************** *** 178,181 **** --- 178,182 ---- \begin{methoddesc}[Charset]{__str__}{} Returns \var{input_charset} as a string coerced to lower case. + \method{__repr__()} is an alias for \method{__str__()}. \end{methoddesc} Index: emailheaders.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailheaders.tex,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** emailheaders.tex 4 Oct 2002 17:24:23 -0000 1.2.2.1 --- emailheaders.tex 21 Mar 2003 21:24:26 -0000 1.2.2.2 *************** *** 49,53 **** \begin{classdesc}{Header}{\optional{s\optional{, charset\optional{, ! maxlinelen\optional{, header_name\optional{, continuation_ws}}}}}} Create a MIME-compliant header that can contain strings in different character sets. --- 49,54 ---- \begin{classdesc}{Header}{\optional{s\optional{, charset\optional{, ! maxlinelen\optional{, header_name\optional{, continuation_ws\optional{, ! errors}}}}}}} Create a MIME-compliant header that can contain strings in different character sets. *************** *** 80,84 **** \end{classdesc} ! \begin{methoddesc}[Header]{append}{s\optional{, charset}} Append the string \var{s} to the MIME header. --- 81,88 ---- \end{classdesc} ! Optional \var{errors} is passed straight through to the ! \method{append()} method. ! ! \begin{methoddesc}[Header]{append}{s\optional{, charset\optional{, errors}}} Append the string \var{s} to the MIME header. *************** *** 101,110 **** in order: \code{us-ascii}, the \var{charset} hint, \code{utf-8}. The first character set to not provoke a \exception{UnicodeError} is used. \end{methoddesc} ! \begin{methoddesc}[Header]{encode}{} Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-\ASCII{} parts in base64 or ! quoted-printable encodings. \end{methoddesc} --- 105,120 ---- in order: \code{us-ascii}, the \var{charset} hint, \code{utf-8}. The first character set to not provoke a \exception{UnicodeError} is used. + + Optional \var{errors} is passed through to any \function{unicode()} or + \function{ustr.encode()} call, and defaults to ``strict''. \end{methoddesc} ! \begin{methoddesc}[Header]{encode}{\optional{splitchars}} Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-\ASCII{} parts in base64 or ! quoted-printable encodings. Optional \var{splitchars} is a string ! containing characters to split long ASCII lines on, in rough support ! of \rfc{2822}'s \emph{highest level syntactic breaks}. This doesn't ! affect \rfc{2047} encoded lines. \end{methoddesc} Index: emailiter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailiter.tex,v retrieving revision 1.2.12.1 retrieving revision 1.2.12.2 diff -C2 -d -r1.2.12.1 -r1.2.12.2 *** emailiter.tex 4 Oct 2002 17:24:23 -0000 1.2.12.1 --- emailiter.tex 21 Mar 2003 21:24:27 -0000 1.2.12.2 *************** *** 7,11 **** trees. ! \begin{funcdesc}{body_line_iterator}{msg} This iterates over all the payloads in all the subparts of \var{msg}, returning the string payloads line-by-line. It skips over all the --- 7,11 ---- trees. ! \begin{funcdesc}{body_line_iterator}{msg\optional{, decode}} This iterates over all the payloads in all the subparts of \var{msg}, returning the string payloads line-by-line. It skips over all the *************** *** 14,17 **** --- 14,19 ---- flat text representation of the message from a file using \method{readline()}, skipping over all the intervening headers. + + Optional \var{decode} is passed through to \method{Message.get_payload()}. \end{funcdesc} Index: emailmessage.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmessage.tex,v retrieving revision 1.4.8.2 retrieving revision 1.4.8.3 diff -C2 -d -r1.4.8.2 -r1.4.8.3 *** emailmessage.tex 10 Oct 2002 19:10:45 -0000 1.4.8.2 --- emailmessage.tex 21 Mar 2003 21:24:27 -0000 1.4.8.3 *************** *** 88,94 **** \samp{base64}. If some other encoding is used, or \mailheader{Content-Transfer-Encoding} header is ! missing, the payload is returned as-is (undecoded). If the message is ! a multipart and the \var{decode} flag is \code{True}, then \code{None} is ! returned. The default for \var{decode} is \code{False}. \end{methoddesc} --- 88,95 ---- \samp{base64}. If some other encoding is used, or \mailheader{Content-Transfer-Encoding} header is ! missing, or if the payload has bogus base64 data, the payload is ! returned as-is (undecoded). If the message is a multipart and the ! \var{decode} flag is \code{True}, then \code{None} is returned. The ! default for \var{decode} is \code{False}. \end{methoddesc} Index: emailmimebase.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmimebase.tex,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** emailmimebase.tex 4 Oct 2002 17:24:23 -0000 1.2.2.1 --- emailmimebase.tex 21 Mar 2003 21:24:27 -0000 1.2.2.2 *************** *** 152,157 **** character set of the text and is passed as a parameter to the \class{MIMENonMultipart} constructor; it defaults to \code{us-ascii}. No ! guessing or encoding is performed on the text data, but a newline is ! appended to \var{_text} if it doesn't already end with a newline. \deprecated{2.2.2}{The \var{_encoding} argument has been deprecated. --- 152,156 ---- character set of the text and is passed as a parameter to the \class{MIMENonMultipart} constructor; it defaults to \code{us-ascii}. No ! guessing or encoding is performed on the text data. \deprecated{2.2.2}{The \var{_encoding} argument has been deprecated. From bwarsaw@users.sourceforge.net Fri Mar 21 21:09:34 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 21 Mar 2003 13:09:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _parseaddr.py,NONE,1.5.2.1 Charset.py,1.7.2.3,1.7.2.4 Generator.py,1.6.10.3,1.6.10.4 Header.py,1.13.2.2,1.13.2.3 MIMEText.py,1.3.10.1,1.3.10.2 Message.py,1.9.6.2,1.9.6.3 Parser.py,1.5.10.3,1.5.10.4 Utils.py,1.9.6.1,1.9.6.2 __init__.py,1.4.10.4,1.4.10.5 _compat21.py,1.4.2.1,1.4.2.2 _compat22.py,1.4.2.1,1.4.2.2 base64MIME.py,1.5.2.1,1.5.2.2 quopriMIME.py,1.4.2.1,1.4.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv27730/Lib/email Modified Files: Tag: release22-maint Charset.py Generator.py Header.py MIMEText.py Message.py Parser.py Utils.py __init__.py _compat21.py _compat22.py base64MIME.py quopriMIME.py Added Files: Tag: release22-maint _parseaddr.py Log Message: Backporting email 2.5 to Python 2.2 maint branch. --- NEW FILE: _parseaddr.py --- # Copyright (C) 2002 Python Software Foundation """Email address parsing code. Lifted directly from rfc822.py. This should eventually be rewritten. """ import time from types import TupleType try: True, False except NameError: True = 1 False = 0 SPACE = ' ' EMPTYSTRING = '' COMMASPACE = ', ' # Parse a date field _monthnames = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec', 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'] _daynames = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] # The timezone table does not include the military time zones defined # in RFC822, other than Z. According to RFC1123, the description in # RFC822 gets the signs wrong, so we can't rely on any such time # zones. RFC1123 recommends that numeric timezone indicators be used # instead of timezone names. _timezones = {'UT':0, 'UTC':0, 'GMT':0, 'Z':0, 'AST': -400, 'ADT': -300, # Atlantic (used in Canada) 'EST': -500, 'EDT': -400, # Eastern 'CST': -600, 'CDT': -500, # Central 'MST': -700, 'MDT': -600, # Mountain 'PST': -800, 'PDT': -700 # Pacific } def parsedate_tz(data): """Convert a date string to a time tuple. Accounts for military timezones. """ data = data.split() # The FWS after the comma after the day-of-week is optional, so search and # adjust for this. if data[0].endswith(',') or data[0].lower() in _daynames: # There's a dayname here. Skip it del data[0] else: i = data[0].rfind(',') if i < 0: return None data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') if len(stuff) == 3: data = stuff + data[1:] if len(data) == 4: s = data[3] i = s.find('+') if i > 0: data[3:] = [s[:i], s[i+1:]] else: data.append('') # Dummy tz if len(data) < 5: return None data = data[:5] [dd, mm, yy, tm, tz] = data mm = mm.lower() if mm not in _monthnames: dd, mm = mm, dd.lower() if mm not in _monthnames: return None mm = _monthnames.index(mm) + 1 if mm > 12: mm -= 12 if dd[-1] == ',': dd = dd[:-1] i = yy.find(':') if i > 0: yy, tm = tm, yy if yy[-1] == ',': yy = yy[:-1] if not yy[0].isdigit(): yy, tz = tz, yy if tm[-1] == ',': tm = tm[:-1] tm = tm.split(':') if len(tm) == 2: [thh, tmm] = tm tss = '0' elif len(tm) == 3: [thh, tmm, tss] = tm else: return None try: yy = int(yy) dd = int(dd) thh = int(thh) tmm = int(tmm) tss = int(tss) except ValueError: return None tzoffset = None tz = tz.upper() if _timezones.has_key(tz): tzoffset = _timezones[tz] else: try: tzoffset = int(tz) except ValueError: pass # Convert a timezone offset into seconds ; -0500 -> -18000 if tzoffset: if tzoffset < 0: tzsign = -1 tzoffset = -tzoffset else: tzsign = 1 tzoffset = tzsign * ( (tzoffset/100)*3600 + (tzoffset % 100)*60) tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset) return tuple def parsedate(data): """Convert a time string to a time tuple.""" t = parsedate_tz(data) if isinstance(t, TupleType): return t[:9] else: return t def mktime_tz(data): """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.""" if data[9] is None: # No zone info, so localtime is better assumption than GMT return time.mktime(data[:8] + (-1,)) else: t = time.mktime(data[:8] + (0,)) return t - data[9] - time.timezone def quote(str): """Add quotes around a string.""" return str.replace('\\', '\\\\').replace('"', '\\"') class AddrlistClass: """Address parser class by Ben Escoto. To understand what this class does, it helps to have a copy of RFC 2822 in front of you. Note: this class interface is deprecated and may be removed in the future. Use rfc822.AddressList instead. """ def __init__(self, field): """Initialize a new instance. `field' is an unparsed address header field, containing one or more addresses. """ self.specials = '()<>@,:;.\"[]' self.pos = 0 self.LWS = ' \t' self.CR = '\r\n' self.atomends = self.specials + self.LWS + self.CR # Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it # is obsolete syntax. RFC 2822 requires that we recognize obsolete # syntax, so allow dots in phrases. self.phraseends = self.atomends.replace('.', '') self.field = field self.commentlist = [] def gotonext(self): """Parse up to the start of the next address.""" while self.pos < len(self.field): if self.field[self.pos] in self.LWS + '\n\r': self.pos += 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) else: break def getaddrlist(self): """Parse all addresses. Returns a list containing all of the addresses. """ result = [] while self.pos < len(self.field): ad = self.getaddress() if ad: result += ad else: result.append(('', '')) return result def getaddress(self): """Parse the next address.""" self.commentlist = [] self.gotonext() oldpos = self.pos oldcl = self.commentlist plist = self.getphraselist() self.gotonext() returnlist = [] if self.pos >= len(self.field): # Bad email address technically, no domain. if plist: returnlist = [(SPACE.join(self.commentlist), plist[0])] elif self.field[self.pos] in '.@': # email address is just an addrspec # this isn't very efficient since we start over self.pos = oldpos self.commentlist = oldcl addrspec = self.getaddrspec() returnlist = [(SPACE.join(self.commentlist), addrspec)] elif self.field[self.pos] == ':': # address is a group returnlist = [] fieldlen = len(self.field) self.pos += 1 while self.pos < len(self.field): self.gotonext() if self.pos < fieldlen and self.field[self.pos] == ';': self.pos += 1 break returnlist = returnlist + self.getaddress() elif self.field[self.pos] == '<': # Address is a phrase then a route addr routeaddr = self.getrouteaddr() if self.commentlist: returnlist = [(SPACE.join(plist) + ' (' + ' '.join(self.commentlist) + ')', routeaddr)] else: returnlist = [(SPACE.join(plist), routeaddr)] else: if plist: returnlist = [(SPACE.join(self.commentlist), plist[0])] elif self.field[self.pos] in self.specials: self.pos += 1 self.gotonext() if self.pos < len(self.field) and self.field[self.pos] == ',': self.pos += 1 return returnlist def getrouteaddr(self): """Parse a route address (Return-path value). This method just skips all the route stuff and returns the addrspec. """ if self.field[self.pos] != '<': return expectroute = False self.pos += 1 self.gotonext() adlist = '' while self.pos < len(self.field): if expectroute: self.getdomain() expectroute = False elif self.field[self.pos] == '>': self.pos += 1 break elif self.field[self.pos] == '@': self.pos += 1 expectroute = True elif self.field[self.pos] == ':': self.pos += 1 else: adlist = self.getaddrspec() self.pos += 1 break self.gotonext() return adlist def getaddrspec(self): """Parse an RFC 2822 addr-spec.""" aslist = [] self.gotonext() while self.pos < len(self.field): if self.field[self.pos] == '.': aslist.append('.') self.pos += 1 elif self.field[self.pos] == '"': aslist.append('"%s"' % self.getquote()) elif self.field[self.pos] in self.atomends: break else: aslist.append(self.getatom()) self.gotonext() if self.pos >= len(self.field) or self.field[self.pos] != '@': return EMPTYSTRING.join(aslist) aslist.append('@') self.pos += 1 self.gotonext() return EMPTYSTRING.join(aslist) + self.getdomain() def getdomain(self): """Get the complete domain name from an address.""" sdlist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos += 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) elif self.field[self.pos] == '[': sdlist.append(self.getdomainliteral()) elif self.field[self.pos] == '.': self.pos += 1 sdlist.append('.') elif self.field[self.pos] in self.atomends: break else: sdlist.append(self.getatom()) return EMPTYSTRING.join(sdlist) def getdelimited(self, beginchar, endchars, allowcomments=True): """Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `endchars' is a sequence of allowable end-delimiting characters. Parsing stops when one of these is encountered. If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed within the parsed fragment. """ if self.field[self.pos] != beginchar: return '' slist = [''] quote = False self.pos += 1 while self.pos < len(self.field): if quote: slist.append(self.field[self.pos]) quote = False elif self.field[self.pos] in endchars: self.pos += 1 break elif allowcomments and self.field[self.pos] == '(': slist.append(self.getcomment()) elif self.field[self.pos] == '\\': quote = True else: slist.append(self.field[self.pos]) self.pos += 1 return EMPTYSTRING.join(slist) def getquote(self): """Get a quote-delimited fragment from self's field.""" return self.getdelimited('"', '"\r', False) def getcomment(self): """Get a parenthesis-delimited fragment from self's field.""" return self.getdelimited('(', ')\r', True) def getdomainliteral(self): """Parse an RFC 2822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', False) def getatom(self, atomends=None): """Parse an RFC 2822 atom. Optional atomends specifies a different set of end token delimiters (the default is to use self.atomends). This is used e.g. in getphraselist() since phrase endings must not include the `.' (which is legal in phrases).""" atomlist = [''] if atomends is None: atomends = self.atomends while self.pos < len(self.field): if self.field[self.pos] in atomends: break else: atomlist.append(self.field[self.pos]) self.pos += 1 return EMPTYSTRING.join(atomlist) def getphraselist(self): """Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. """ plist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos += 1 elif self.field[self.pos] == '"': plist.append(self.getquote()) elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) elif self.field[self.pos] in self.phraseends: break else: plist.append(self.getatom(self.phraseends)) return plist class AddressList(AddrlistClass): """An AddressList encapsulates a list of parsed RFC 2822 addresses.""" def __init__(self, field): AddrlistClass.__init__(self, field) if field: self.addresslist = self.getaddrlist() else: self.addresslist = [] def __len__(self): return len(self.addresslist) def __str__(self): return COMMASPACE.join(map(dump_address_pair, self.addresslist)) def __add__(self, other): # Set union newaddr = AddressList(None) newaddr.addresslist = self.addresslist[:] for x in other.addresslist: if not x in self.addresslist: newaddr.addresslist.append(x) return newaddr def __iadd__(self, other): # Set union, in-place for x in other.addresslist: if not x in self.addresslist: self.addresslist.append(x) return self def __sub__(self, other): # Set difference newaddr = AddressList(None) for x in self.addresslist: if not x in other.addresslist: newaddr.addresslist.append(x) return newaddr def __isub__(self, other): # Set difference, in-place for x in other.addresslist: if x in self.addresslist: self.addresslist.remove(x) return self def __getitem__(self, index): # Make indexing, slices, and 'in' work return self.addresslist[index] Index: Charset.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v retrieving revision 1.7.2.3 retrieving revision 1.7.2.4 diff -C2 -d -r1.7.2.3 -r1.7.2.4 *** Charset.py 14 Oct 2002 17:26:00 -0000 1.7.2.3 --- Charset.py 21 Mar 2003 21:09:31 -0000 1.7.2.4 *************** *** 36,39 **** --- 36,53 ---- 'iso-8859-1': (QP, QP, None), 'iso-8859-2': (QP, QP, None), + 'iso-8859-3': (QP, QP, None), + 'iso-8859-4': (QP, QP, None), + # iso-8859-5 is Cyrillic, and not especially used + # iso-8859-6 is Arabic, also not particularly used + # iso-8859-7 is Greek, QP will not make it readable + # iso-8859-8 is Hebrew, QP will not make it readable + 'iso-8859-9': (QP, QP, None), + 'iso-8859-10': (QP, QP, None), + # iso-8859-11 is Thai, QP will not make it readable + 'iso-8859-13': (QP, QP, None), + 'iso-8859-14': (QP, QP, None), + 'iso-8859-15': (QP, QP, None), + 'windows-1252':(QP, QP, None), + 'viscii': (QP, QP, None), 'us-ascii': (None, None, None), 'big5': (BASE64, BASE64, None), *************** *** 53,56 **** --- 67,89 ---- 'latin_1': 'iso-8859-1', 'latin-1': 'iso-8859-1', + 'latin_2': 'iso-8859-2', + 'latin-2': 'iso-8859-2', + 'latin_3': 'iso-8859-3', + 'latin-3': 'iso-8859-3', + 'latin_4': 'iso-8859-4', + 'latin-4': 'iso-8859-4', + 'latin_5': 'iso-8859-9', + 'latin-5': 'iso-8859-9', + 'latin_6': 'iso-8859-10', + 'latin-6': 'iso-8859-10', + 'latin_7': 'iso-8859-13', + 'latin-7': 'iso-8859-13', + 'latin_8': 'iso-8859-14', + 'latin-8': 'iso-8859-14', + 'latin_9': 'iso-8859-15', + 'latin-9': 'iso-8859-15', + 'cp949': 'ks_c_5601-1987', + 'euc_jp': 'euc-jp', + 'euc_kr': 'euc-kr', 'ascii': 'us-ascii', } *************** *** 70,73 **** --- 103,110 ---- 'iso-2022-jp': 'japanese.iso-2022-jp', 'shift_jis': 'japanese.shift_jis', + 'euc-kr': 'korean.euc-kr', + 'ks_c_5601-1987': 'korean.cp949', + 'iso-2022-kr': 'korean.iso-2022-kr', + 'johab': 'korean.johab', 'gb2132': 'eucgb2312_cn', 'big5': 'big5_tw', *************** *** 198,201 **** --- 235,240 ---- return self.input_charset.lower() + __repr__ = __str__ + def __eq__(self, other): return str(self) == str(other).lower() *************** *** 322,326 **** return email.base64MIME.header_encode(s, cset) elif self.header_encoding == QP: ! return email.quopriMIME.header_encode(s, cset) elif self.header_encoding == SHORTEST: lenb64 = email.base64MIME.base64_len(s) --- 361,365 ---- return email.base64MIME.header_encode(s, cset) elif self.header_encoding == QP: ! return email.quopriMIME.header_encode(s, cset, maxlinelen=None) elif self.header_encoding == SHORTEST: lenb64 = email.base64MIME.base64_len(s) *************** *** 329,333 **** return email.base64MIME.header_encode(s, cset) else: ! return email.quopriMIME.header_encode(s, cset) else: return s --- 368,372 ---- return email.base64MIME.header_encode(s, cset) else: ! return email.quopriMIME.header_encode(s, cset, maxlinelen=None) else: return s *************** *** 349,353 **** if self.body_encoding is BASE64: return email.base64MIME.body_encode(s) ! elif self.header_encoding is QP: return email.quopriMIME.body_encode(s) else: --- 388,392 ---- if self.body_encoding is BASE64: return email.base64MIME.body_encode(s) ! elif self.body_encoding is QP: return email.quopriMIME.body_encode(s) else: Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.6.10.3 retrieving revision 1.6.10.4 diff -C2 -d -r1.6.10.3 -r1.6.10.4 *** Generator.py 14 Oct 2002 17:26:01 -0000 1.6.10.3 --- Generator.py 21 Mar 2003 21:09:31 -0000 1.6.10.4 *************** *** 5,10 **** """ - import time import re import random --- 5,11 ---- """ import re + import time + import locale import random *************** *** 13,16 **** --- 14,18 ---- from email.Header import Header + from email.Parser import NLCRE try: *************** *** 160,201 **** def _write_headers(self, msg): for h, v in msg.items(): ! # RFC 2822 says that lines SHOULD be no more than maxheaderlen ! # characters wide, so we're well within our rights to split long ! # headers. ! text = '%s: %s' % (h, v) ! if self.__maxheaderlen > 0 and len(text) > self.__maxheaderlen: ! text = self._split_header(text) ! print >> self._fp, text # A blank line always separates headers from body print >> self._fp - def _split_header(self, text): - maxheaderlen = self.__maxheaderlen - # Find out whether any lines in the header are really longer than - # maxheaderlen characters wide. There could be continuation lines - # that actually shorten it. Also, replace hard tabs with 8 spaces. - lines = [s.replace('\t', SPACE8) for s in text.splitlines()] - for line in lines: - if len(line) > maxheaderlen: - break - else: - # No line was actually longer than maxheaderlen characters, so - # just return the original unchanged. - return text - # If we have raw 8bit data in a byte string, we have no idea what the - # encoding is. I think there is no safe way to split this string. If - # it's ascii-subset, then we could do a normal ascii split, but if - # it's multibyte then we could break the string. There's no way to - # know so the least harm seems to be to not split the string and risk - # it being too long. - if _is8bitstring(text): - return text - # The `text' argument already has the field name prepended, so don't - # provide it here or the first line will get folded too short. - h = Header(text, maxlinelen=maxheaderlen, - # For backwards compatibility, we use a hard tab here - continuation_ws='\t') - return h.encode() - # # Handlers for writing types and subtypes --- 162,188 ---- def _write_headers(self, msg): for h, v in msg.items(): ! print >> self._fp, '%s:' % h, ! if self.__maxheaderlen == 0: ! # Explicit no-wrapping ! print >> self._fp, v ! elif isinstance(v, Header): ! # Header instances know what to do ! print >> self._fp, v.encode() ! elif _is8bitstring(v): ! # If we have raw 8bit data in a byte string, we have no idea ! # what the encoding is. There is no safe way to split this ! # string. If it's ascii-subset, then we could do a normal ! # ascii split, but if it's multibyte then we could break the ! # string. There's no way to know so the least harm seems to ! # be to not split the string and risk it being too long. ! print >> self._fp, v ! else: ! # Header's got lots of smarts, so use it. ! print >> self._fp, Header( ! v, maxlinelen=self.__maxheaderlen, ! header_name=h, continuation_ws='\t').encode() # A blank line always separates headers from body print >> self._fp # # Handlers for writing types and subtypes *************** *** 259,262 **** --- 246,257 ---- if msg.preamble is not None: self._fp.write(msg.preamble) + # If preamble is the empty string, the length of the split will be + # 1, but the last element will be the empty string. If it's + # anything else but does not end in a line separator, the length + # will be > 1 and not end in an empty string. We need to + # guarantee a newline after the preamble, but don't add too many. + plines = NLCRE.split(msg.preamble) + if plines <> [''] and plines[-1] <> '': + self._fp.write('\n') # First boundary is a bit different; it doesn't have a leading extra # newline. *************** *** 365,369 **** # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! boundary = ('=' * 15) + repr(random.random()).split('.')[1] + '==' if text is None: return boundary --- 360,365 ---- # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! dp = locale.localeconv().get('decimal_point', '.') ! boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '==' if text is None: return boundary Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.13.2.2 retrieving revision 1.13.2.3 diff -C2 -d -r1.13.2.2 -r1.13.2.3 *** Header.py 14 Oct 2002 17:26:02 -0000 1.13.2.2 --- Header.py 21 Mar 2003 21:09:31 -0000 1.13.2.3 *************** *** 5,12 **** --- 5,14 ---- import re + import binascii from types import StringType, UnicodeType import email.quopriMIME import email.base64MIME + from email.Errors import HeaderParseError from email.Charset import Charset *************** *** 26,31 **** --- 28,36 ---- CRLF = '\r\n' NL = '\n' + SPACE = ' ' + USPACE = u' ' SPACE8 = ' ' * 8 EMPTYSTRING = '' + UEMPTYSTRING = u'' MAXLINELEN = 76 *************** *** 48,51 **** --- 53,63 ---- ''', re.VERBOSE | re.IGNORECASE) + pcre = re.compile('([,;])') + + # Field name regexp, including trailing colon, but not separating whitespace, + # according to RFC 2822. Character range is from tilde to exclamation mark. + # For use with .match() + fcre = re.compile(r'[\041-\176]+:$') + *************** *** 62,65 **** --- 74,80 ---- header, otherwise a lower-case string containing the name of the character set specified in the encoded string. + + An email.Errors.HeaderParseError may be raised when certain decoding error + occurs (e.g. a base64 decoding exception). """ # If no encoding, just return the header *************** *** 80,84 **** # Should we continue a long line? if decoded and decoded[-1][1] is None: ! decoded[-1] = (decoded[-1][0] + dec, None) else: decoded.append((unenc, None)) --- 95,99 ---- # Should we continue a long line? if decoded and decoded[-1][1] is None: ! decoded[-1] = (decoded[-1][0] + SPACE + unenc, None) else: decoded.append((unenc, None)) *************** *** 86,95 **** charset, encoding = [s.lower() for s in parts[0:2]] encoded = parts[2] ! dec = '' if encoding == 'q': dec = email.quopriMIME.header_decode(encoded) elif encoding == 'b': ! dec = email.base64MIME.decode(encoded) ! else: dec = encoded --- 101,116 ---- charset, encoding = [s.lower() for s in parts[0:2]] encoded = parts[2] ! dec = None if encoding == 'q': dec = email.quopriMIME.header_decode(encoded) elif encoding == 'b': ! try: ! dec = email.base64MIME.decode(encoded) ! except binascii.Error: ! # Turn this into a higher level exception. BAW: Right ! # now we throw the lower level exception away but ! # when/if we get exception chaining, we'll preserve it. ! raise HeaderParseError ! if dec is None: dec = encoded *************** *** 127,132 **** class Header: ! def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, ! continuation_ws=' '): """Create a MIME-compliant header that can contain many character sets. --- 148,154 ---- class Header: ! def __init__(self, s=None, charset=None, ! maxlinelen=None, header_name=None, ! continuation_ws=' ', errors='strict'): """Create a MIME-compliant header that can contain many character sets. *************** *** 151,154 **** --- 173,178 ---- either a space or a hard tab) which will be prepended to continuation lines. + + errors is passed through to the .append() call. """ if charset is None: *************** *** 162,166 **** self._chunks = [] if s is not None: ! self.append(s, charset) if maxlinelen is None: maxlinelen = MAXLINELEN --- 186,190 ---- self._chunks = [] if s is not None: ! self.append(s, charset, errors) if maxlinelen is None: maxlinelen = MAXLINELEN *************** *** 183,189 **** def __unicode__(self): """Helper for the built-in unicode function.""" ! # charset item is a Charset instance so we need to stringify it. ! uchunks = [unicode(s, str(charset)) for s, charset in self._chunks] ! return u''.join(uchunks) # Rich comparison operators for equality only. BAW: does it make sense to --- 207,228 ---- def __unicode__(self): """Helper for the built-in unicode function.""" ! uchunks = [] ! lastcs = None ! for s, charset in self._chunks: ! # We must preserve spaces between encoded and non-encoded word ! # boundaries, which means for us we need to add a space when we go ! # from a charset to None/us-ascii, or from None/us-ascii to a ! # charset. Only do this for the second and subsequent chunks. ! nextcs = charset ! if uchunks: ! if lastcs is not None: ! if nextcs is None or nextcs == 'us-ascii': ! uchunks.append(USPACE) ! nextcs = None ! elif nextcs is not None and nextcs <> 'us-ascii': ! uchunks.append(USPACE) ! lastcs = nextcs ! uchunks.append(unicode(s, str(charset))) ! return UEMPTYSTRING.join(uchunks) # Rich comparison operators for equality only. BAW: does it make sense to *************** *** 197,201 **** return not self == other ! def append(self, s, charset=None): """Append a string to the MIME header. --- 236,240 ---- return not self == other ! def append(self, s, charset=None, errors='strict'): """Append a string to the MIME header. *************** *** 214,217 **** --- 253,259 ---- following charsets in order: us-ascii, the charset hint, utf-8. The first character set not to provoke a UnicodeError is used. + + Optional `errors' is passed as the third argument to any unicode() or + ustr.encode() call. """ if charset is None: *************** *** 228,237 **** # converted to a unicode with the input codec of the charset. incodec = charset.input_codec or 'us-ascii' ! ustr = unicode(s, incodec) # Now make sure that the unicode could be converted back to a # byte string with the output codec, which may be different # than the iput coded. Still, use the original byte string. outcodec = charset.output_codec or 'us-ascii' ! ustr.encode(outcodec) elif isinstance(s, UnicodeType): # Now we have to be sure the unicode string can be converted --- 270,279 ---- # converted to a unicode with the input codec of the charset. incodec = charset.input_codec or 'us-ascii' ! ustr = unicode(s, incodec, errors) # Now make sure that the unicode could be converted back to a # byte string with the output codec, which may be different # than the iput coded. Still, use the original byte string. outcodec = charset.output_codec or 'us-ascii' ! ustr.encode(outcodec, errors) elif isinstance(s, UnicodeType): # Now we have to be sure the unicode string can be converted *************** *** 241,245 **** try: outcodec = charset.output_codec or 'us-ascii' ! s = s.encode(outcodec) break except UnicodeError: --- 283,287 ---- try: outcodec = charset.output_codec or 'us-ascii' ! s = s.encode(outcodec, errors) break except UnicodeError: *************** *** 249,259 **** self._chunks.append((s, charset)) ! def _split(self, s, charset, firstline=False): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) ! encoded = charset.from_splittable(splittable) elen = charset.encoded_header_len(encoded) ! ! if elen <= self._maxlinelen: return [(encoded, charset)] # If we have undetermined raw 8bit characters sitting in a byte --- 291,301 ---- self._chunks.append((s, charset)) ! def _split(self, s, charset, maxlinelen, splitchars): # Split up a header safely for use with encode_chunks. splittable = charset.to_splittable(s) ! encoded = charset.from_splittable(splittable, True) elen = charset.encoded_header_len(encoded) ! # If the line's encoded length first, just return it ! if elen <= maxlinelen: return [(encoded, charset)] # If we have undetermined raw 8bit characters sitting in a byte *************** *** 263,267 **** # be to not split the header at all, but that means they could go out # longer than maxlinelen. ! elif charset == '8bit': return [(s, charset)] # BAW: I'm not sure what the right test here is. What we're trying to --- 305,309 ---- # be to not split the header at all, but that means they could go out # longer than maxlinelen. ! if charset == '8bit': return [(s, charset)] # BAW: I'm not sure what the right test here is. What we're trying to *************** *** 276,374 **** # although it's possible that other charsets may also benefit from the # higher-level syntactic breaks. - # elif charset == 'us-ascii': ! return self._ascii_split(s, charset, firstline) # BAW: should we use encoded? elif elen == len(s): # We can split on _maxlinelen boundaries because we know that the # encoding won't change the size of the string ! splitpnt = self._maxlinelen first = charset.from_splittable(splittable[:splitpnt], False) last = charset.from_splittable(splittable[splitpnt:], False) else: ! # Divide and conquer. ! halfway = _floordiv(len(splittable), 2) ! first = charset.from_splittable(splittable[:halfway], False) ! last = charset.from_splittable(splittable[halfway:], False) ! # Do the split ! return self._split(first, charset, firstline) + \ ! self._split(last, charset) ! def _ascii_split(self, s, charset, firstline): ! # Attempt to split the line at the highest-level syntactic break ! # possible. Note that we don't have a lot of smarts about field ! # syntax; we just try to break on semi-colons, then whitespace. ! rtn = [] ! lines = s.splitlines() ! while lines: ! line = lines.pop(0) ! if firstline: ! maxlinelen = self._firstlinelen ! firstline = False ! else: ! #line = line.lstrip() ! maxlinelen = self._maxlinelen ! # Short lines can remain unchanged ! if len(line.replace('\t', SPACE8)) <= maxlinelen: ! rtn.append(line) ! else: ! oldlen = len(line) ! # Try to break the line on semicolons, but if that doesn't ! # work, try to split on folding whitespace. ! while len(line) > maxlinelen: ! i = line.rfind(';', 0, maxlinelen) ! if i < 0: ! break ! rtn.append(line[:i] + ';') ! line = line[i+1:] ! # Is the remaining stuff still longer than maxlinelen? ! if len(line) <= maxlinelen: ! # Splitting on semis worked ! rtn.append(line) ! continue ! # Splitting on semis didn't finish the job. If it did any ! # work at all, stick the remaining junk on the front of the ! # `lines' sequence and let the next pass do its thing. ! if len(line) <> oldlen: ! lines.insert(0, line) ! continue ! # Otherwise, splitting on semis didn't help at all. ! parts = re.split(r'(\s+)', line) ! if len(parts) == 1 or (len(parts) == 3 and ! parts[0].endswith(':')): ! # This line can't be split on whitespace. There's now ! # little we can do to get this into maxlinelen. BAW: ! # We're still potentially breaking the RFC by possibly ! # allowing lines longer than the absolute maximum of 998 ! # characters. For now, let it slide. ! # ! # len(parts) will be 1 if this line has no `Field: ' ! # prefix, otherwise it will be len(3). ! rtn.append(line) ! continue ! # There is whitespace we can split on. ! first = parts.pop(0) ! sublines = [first] ! acc = len(first) ! while parts: ! len0 = len(parts[0]) ! len1 = len(parts[1]) ! if acc + len0 + len1 <= maxlinelen: ! sublines.append(parts.pop(0)) ! sublines.append(parts.pop(0)) ! acc += len0 + len1 ! else: ! # Split it here, but don't forget to ignore the ! # next whitespace-only part ! if first <> '': ! rtn.append(EMPTYSTRING.join(sublines)) ! del parts[0] ! first = parts.pop(0) ! sublines = [first] ! acc = len(first) ! rtn.append(EMPTYSTRING.join(sublines)) ! return [(chunk, charset) for chunk in rtn] ! def _encode_chunks(self, newchunks): # MIME-encode a header with many different charsets and/or encodings. # --- 318,346 ---- # although it's possible that other charsets may also benefit from the # higher-level syntactic breaks. elif charset == 'us-ascii': ! return self._split_ascii(s, charset, maxlinelen, splitchars) # BAW: should we use encoded? elif elen == len(s): # We can split on _maxlinelen boundaries because we know that the # encoding won't change the size of the string ! splitpnt = maxlinelen first = charset.from_splittable(splittable[:splitpnt], False) last = charset.from_splittable(splittable[splitpnt:], False) else: ! # Binary search for split point ! first, last = _binsplit(splittable, charset, maxlinelen) ! # first is of the proper length so just wrap it in the appropriate ! # chrome. last must be recursively split. ! fsplittable = charset.to_splittable(first) ! fencoded = charset.from_splittable(fsplittable, True) ! chunk = [(fencoded, charset)] ! return chunk + self._split(last, charset, self._maxlinelen, splitchars) ! def _split_ascii(self, s, charset, firstlen, splitchars): ! chunks = _split_ascii(s, firstlen, self._maxlinelen, ! self._continuation_ws, splitchars) ! return zip(chunks, [charset]*len(chunks)) ! def _encode_chunks(self, newchunks, maxlinelen): # MIME-encode a header with many different charsets and/or encodings. # *************** *** 388,404 **** # =?charset1?q?Mar=EDa_Gonz=E1lez_Alonso?=\n # =?charset2?b?SvxyZ2VuIEL2aW5n?=" - # chunks = [] for header, charset in newchunks: if charset is None or charset.header_encoding is None: ! # There's no encoding for this chunk's charsets ! _max_append(chunks, header, self._maxlinelen) else: ! _max_append(chunks, charset.header_encode(header), ! self._maxlinelen, ' ') joiner = NL + self._continuation_ws return joiner.join(chunks) ! def encode(self): """Encode a message header into an RFC-compliant format. --- 360,381 ---- # =?charset1?q?Mar=EDa_Gonz=E1lez_Alonso?=\n # =?charset2?b?SvxyZ2VuIEL2aW5n?=" chunks = [] for header, charset in newchunks: + if not header: + continue if charset is None or charset.header_encoding is None: ! s = header else: ! s = charset.header_encode(header) ! # Don't add more folding whitespace than necessary ! if chunks and chunks[-1].endswith(' '): ! extra = '' ! else: ! extra = ' ' ! _max_append(chunks, s, maxlinelen, extra) joiner = NL + self._continuation_ws return joiner.join(chunks) ! def encode(self, splitchars=';, '): """Encode a message header into an RFC-compliant format. *************** *** 417,423 **** If the given charset is not known or an error occurs during conversion, this function will return the header untouched. """ newchunks = [] for s, charset in self._chunks: ! newchunks += self._split(s, charset, True) ! return self._encode_chunks(newchunks) --- 394,515 ---- If the given charset is not known or an error occurs during conversion, this function will return the header untouched. + + Optional splitchars is a string containing characters to split long + ASCII lines on, in rough support of RFC 2822's `highest level + syntactic breaks'. This doesn't affect RFC 2047 encoded lines. """ newchunks = [] + maxlinelen = self._firstlinelen + lastlen = 0 for s, charset in self._chunks: ! # The first bit of the next chunk should be just long enough to ! # fill the next line. Don't forget the space separating the ! # encoded words. ! targetlen = maxlinelen - lastlen - 1 ! if targetlen < charset.encoded_header_len(''): ! # Stick it on the next line ! targetlen = maxlinelen ! newchunks += self._split(s, charset, targetlen, splitchars) ! lastchunk, lastcharset = newchunks[-1] ! lastlen = lastcharset.encoded_header_len(lastchunk) ! return self._encode_chunks(newchunks, maxlinelen) ! ! ! ! def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): ! lines = [] ! maxlen = firstlen ! for line in s.splitlines(): ! # Ignore any leading whitespace (i.e. continuation whitespace) already ! # on the line, since we'll be adding our own. ! line = line.lstrip() ! if len(line) < maxlen: ! lines.append(line) ! maxlen = restlen ! continue ! # Attempt to split the line at the highest-level syntactic break ! # possible. Note that we don't have a lot of smarts about field ! # syntax; we just try to break on semi-colons, then commas, then ! # whitespace. ! for ch in splitchars: ! if line.find(ch) >= 0: ! break ! else: ! # There's nothing useful to split the line on, not even spaces, so ! # just append this line unchanged ! lines.append(line) ! maxlen = restlen ! continue ! # Now split the line on the character plus trailing whitespace ! cre = re.compile(r'%s\s*' % ch) ! if ch in ';,': ! eol = ch ! else: ! eol = '' ! joiner = eol + ' ' ! joinlen = len(joiner) ! wslen = len(continuation_ws.replace('\t', SPACE8)) ! this = [] ! linelen = 0 ! for part in cre.split(line): ! curlen = linelen + max(0, len(this)-1) * joinlen ! partlen = len(part) ! onfirstline = not lines ! # We don't want to split after the field name, if we're on the ! # first line and the field name is present in the header string. ! if ch == ' ' and onfirstline and \ ! len(this) == 1 and fcre.match(this[0]): ! this.append(part) ! linelen += partlen ! elif curlen + partlen > maxlen: ! if this: ! lines.append(joiner.join(this) + eol) ! # If this part is longer than maxlen and we aren't already ! # splitting on whitespace, try to recursively split this line ! # on whitespace. ! if partlen > maxlen and ch <> ' ': ! subl = _split_ascii(part, maxlen, restlen, ! continuation_ws, ' ') ! lines.extend(subl[:-1]) ! this = [subl[-1]] ! else: ! this = [part] ! linelen = wslen + len(this[-1]) ! maxlen = restlen ! else: ! this.append(part) ! linelen += partlen ! # Put any left over parts on a line by themselves ! if this: ! lines.append(joiner.join(this)) ! return lines ! ! ! ! def _binsplit(splittable, charset, maxlinelen): ! i = 0 ! j = len(splittable) ! while i < j: ! # Invariants: ! # 1. splittable[:k] fits for all k <= i (note that we *assume*, ! # at the start, that splittable[:0] fits). ! # 2. splittable[:k] does not fit for any k > j (at the start, ! # this means we shouldn't look at any k > len(splittable)). ! # 3. We don't know about splittable[:k] for k in i+1..j. ! # 4. We want to set i to the largest k that fits, with i <= k <= j. ! # ! m = (i+j+1) >> 1 # ceiling((i+j)/2); i < m <= j ! chunk = charset.from_splittable(splittable[:m], True) ! chunklen = charset.encoded_header_len(chunk) ! if chunklen <= maxlinelen: ! # m is acceptable, so is a new lower bound. ! i = m ! else: ! # m is not acceptable, so final i must be < m. ! j = m - 1 ! # i == j. Invariant #1 implies that splittable[:i] fits, and ! # invariant #2 implies that splittable[:i+1] does not fit, so i ! # is what we're looking for. ! first = charset.from_splittable(splittable[:i], False) ! last = charset.from_splittable(splittable[i:], False) ! return first, last Index: MIMEText.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/MIMEText.py,v retrieving revision 1.3.10.1 retrieving revision 1.3.10.2 diff -C2 -d -r1.3.10.1 -r1.3.10.2 *** MIMEText.py 4 Oct 2002 17:24:24 -0000 1.3.10.1 --- MIMEText.py 21 Mar 2003 21:09:31 -0000 1.3.10.2 *************** *** 18,23 **** """Create a text/* type MIME document. ! _text is the string for this message object. If the text does not end ! in a newline, one is added. _subtype is the MIME sub content type, defaulting to "plain". --- 18,22 ---- """Create a text/* type MIME document. ! _text is the string for this message object. _subtype is the MIME sub content type, defaulting to "plain". *************** *** 36,41 **** MIMENonMultipart.__init__(self, 'text', _subtype, **{'charset': _charset}) - if _text and not _text.endswith('\n'): - _text += '\n' self.set_payload(_text, _charset) if _encoder is not None: --- 35,38 ---- Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.9.6.2 retrieving revision 1.9.6.3 diff -C2 -d -r1.9.6.2 -r1.9.6.3 *** Message.py 10 Oct 2002 19:09:24 -0000 1.9.6.2 --- Message.py 21 Mar 2003 21:09:31 -0000 1.9.6.3 *************** *** 6,9 **** --- 6,11 ---- import re + import uu + import binascii import warnings from cStringIO import StringIO *************** *** 11,16 **** # Intrapackage imports - from email import Errors from email import Utils from email import Charset --- 13,18 ---- # Intrapackage imports from email import Utils + from email import Errors from email import Charset *************** *** 165,176 **** i returns that index into the payload. ! Optional decode is a flag (defaulting to False) indicating whether the ! payload should be decoded or not, according to the ! Content-Transfer-Encoding header. When True and the message is not a ! multipart, the payload will be decoded if this header's value is ! `quoted-printable' or `base64'. If some other encoding is used, or ! the header is missing, the payload is returned as-is (undecoded). If ! the message is a multipart and the decode flag is True, then None is ! returned. """ if i is None: --- 167,182 ---- i returns that index into the payload. ! Optional decode is a flag indicating whether the payload should be ! decoded or not, according to the Content-Transfer-Encoding header ! (default is False). ! ! When True and the message is not a multipart, the payload will be ! decoded if this header's value is `quoted-printable' or `base64'. If ! some other encoding is used, or the header is missing, or if the ! payload has bogus data (i.e. bogus base64 or uuencoded data), the ! payload is returned as-is. ! ! If the message is a multipart and the decode flag is True, then None ! is returned. """ if i is None: *************** *** 183,191 **** if self.is_multipart(): return None ! cte = self.get('content-transfer-encoding', '') ! if cte.lower() == 'quoted-printable': return Utils._qdecode(payload) ! elif cte.lower() == 'base64': ! return Utils._bdecode(payload) # Everything else, including encodings with 8bit or 7bit are returned # unchanged. --- 189,209 ---- if self.is_multipart(): return None ! cte = self.get('content-transfer-encoding', '').lower() ! if cte == 'quoted-printable': return Utils._qdecode(payload) ! elif cte == 'base64': ! try: ! return Utils._bdecode(payload) ! except binascii.Error: ! # Incorrect padding ! return payload ! elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): ! sfp = StringIO() ! try: ! uu.decode(StringIO(payload+'\n'), sfp) ! payload = sfp.getvalue() ! except uu.Error: ! # Some decoding problem ! return payload # Everything else, including encodings with 8bit or 7bit are returned # unchanged. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.5.10.3 retrieving revision 1.5.10.4 diff -C2 -d -r1.5.10.3 -r1.5.10.4 *** Parser.py 7 Oct 2002 17:02:40 -0000 1.5.10.3 --- Parser.py 21 Mar 2003 21:09:31 -0000 1.5.10.4 *************** *** 21,25 **** False = 0 ! nlcre = re.compile('\r\n|\r|\n') --- 21,25 ---- False = 0 ! NLCRE = re.compile('\r\n|\r|\n') *************** *** 60,66 **** """ root = self._class() ! self._parseheaders(root, fp) if not headersonly: ! self._parsebody(root, fp) return root --- 60,66 ---- """ root = self._class() ! firstbodyline = self._parseheaders(root, fp) if not headersonly: ! self._parsebody(root, fp, firstbodyline) return root *************** *** 81,84 **** --- 81,85 ---- lastvalue = [] lineno = 0 + firstbodyline = None while True: # Don't strip the line before we test for the end condition, *************** *** 121,131 **** if self._strict: raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''"%line) elif lineno == 1 and line.startswith('--'): # allow through duplicate boundary tags. continue else: ! raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''"%line) if lastheader: container[lastheader] = NL.join(lastvalue) --- 122,135 ---- if self._strict: raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''" % line) elif lineno == 1 and line.startswith('--'): # allow through duplicate boundary tags. continue else: ! # There was no separating blank line as mandated by RFC ! # 2822, but we're in non-strict mode. So just offer up ! # this current line as the first body line. ! firstbodyline = line ! break if lastheader: container[lastheader] = NL.join(lastvalue) *************** *** 135,140 **** if lastheader: container[lastheader] = NL.join(lastvalue) ! def _parsebody(self, container, fp): # Parse the body, but first split the payload on the content-type # boundary if present. --- 139,145 ---- if lastheader: container[lastheader] = NL.join(lastvalue) + return firstbodyline ! def _parsebody(self, container, fp, firstbodyline=None): # Parse the body, but first split the payload on the content-type # boundary if present. *************** *** 153,156 **** --- 158,163 ---- separator = '--' + boundary payload = fp.read() + if firstbodyline is not None: + payload = firstbodyline + '\n' + payload # We use an RE here because boundaries can have trailing # whitespace. *************** *** 170,174 **** # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = nlcre.search(payload, start) if mo: start += len(mo.group(0)) --- 177,181 ---- # Find out what kind of line endings we're using start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = NLCRE.search(payload, start) if mo: start += len(mo.group(0)) *************** *** 222,228 **** msgobj = self.parsestr(parthdrs, headersonly=1) # while submsgobj is the message itself - submsgobj = self.parsestr(part) - msgobj.attach(submsgobj) msgobj.set_default_type('message/rfc822') else: msgobj = self.parsestr(part) --- 229,239 ---- msgobj = self.parsestr(parthdrs, headersonly=1) # while submsgobj is the message itself msgobj.set_default_type('message/rfc822') + maintype = msgobj.get_content_maintype() + if maintype in ('message', 'multipart'): + submsgobj = self.parsestr(part) + msgobj.attach(submsgobj) + else: + msgobj.set_payload(part) else: msgobj = self.parsestr(part) *************** *** 257,261 **** container.attach(msg) else: ! container.set_payload(fp.read()) --- 268,275 ---- container.attach(msg) else: ! text = fp.read() ! if firstbodyline is not None: ! text = firstbodyline + '\n' + text ! container.set_payload(text) *************** *** 271,275 **** interested in is the message headers. """ ! def _parsebody(self, container, fp): # Consume but do not parse, the body ! container.set_payload(fp.read()) --- 285,292 ---- interested in is the message headers. """ ! def _parsebody(self, container, fp, firstbodyline=None): # Consume but do not parse, the body ! text = fp.read() ! if firstbodyline is not None: ! text = firstbodyline + '\n' + text ! container.set_payload(text) Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.9.6.1 retrieving revision 1.9.6.2 diff -C2 -d -r1.9.6.1 -r1.9.6.2 *** Utils.py 4 Oct 2002 17:24:24 -0000 1.9.6.1 --- Utils.py 21 Mar 2003 21:09:31 -0000 1.9.6.2 *************** *** 14,24 **** from types import ListType ! from rfc822 import quote ! from rfc822 import AddressList as _AddressList ! from rfc822 import mktime_tz # We need wormarounds for bugs in these methods in older Pythons (see below) ! from rfc822 import parsedate as _parsedate ! from rfc822 import parsedate_tz as _parsedate_tz try: --- 14,24 ---- from types import ListType ! from email._parseaddr import quote ! from email._parseaddr import AddressList as _AddressList ! from email._parseaddr import mktime_tz # We need wormarounds for bugs in these methods in older Pythons (see below) ! from email._parseaddr import parsedate as _parsedate ! from email._parseaddr import parsedate_tz as _parsedate_tz try: *************** *** 55,60 **** CRLF = '\r\n' ! specialsre = re.compile(r'[][\()<>@,:;".]') ! escapesre = re.compile(r'[][\()"]') --- 55,60 ---- CRLF = '\r\n' ! specialsre = re.compile(r'[][\\()<>@,:;".]') ! escapesre = re.compile(r'[][\\()"]') *************** *** 67,72 **** def _bdecode(s): - if not s: - return s # We can't quite use base64.encodestring() since it tacks on a "courtesy # newline". Blech! --- 67,70 ---- *************** *** 281,287 **** """Decode string according to RFC 2231""" import urllib ! charset, language, s = s.split("'", 2) ! s = urllib.unquote(s) ! return charset, language, s --- 279,287 ---- """Decode string according to RFC 2231""" import urllib ! parts = s.split("'", 2) ! if len(parts) == 1: ! return None, None, s ! charset, language, s = parts ! return charset, language, urllib.unquote(s) *************** *** 336,340 **** value.append(continuation) charset, language, value = decode_rfc2231(EMPTYSTRING.join(value)) ! new_params.append((name, ! (charset, language, '"%s"' % quote(value)))) return new_params --- 336,340 ---- value.append(continuation) charset, language, value = decode_rfc2231(EMPTYSTRING.join(value)) ! new_params.append( ! (name, (charset, language, '"%s"' % quote(value)))) return new_params Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.4.10.4 retrieving revision 1.4.10.5 diff -C2 -d -r1.4.10.4 -r1.4.10.5 *** __init__.py 14 Oct 2002 17:26:02 -0000 1.4.10.4 --- __init__.py 21 Mar 2003 21:09:31 -0000 1.4.10.5 *************** *** 5,9 **** """ ! __version__ = '2.4.3' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5' __all__ = [ Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** _compat21.py 4 Oct 2002 17:24:24 -0000 1.4.2.1 --- _compat21.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 *************** *** 8,11 **** --- 8,14 ---- from types import StringType, UnicodeType + False = 0 + True = 1 + *************** *** 32,36 **** def _isstring(obj): ! return isinstance(obj, StringType) or isinstance(obj, UnicodeType) --- 35,39 ---- def _isstring(obj): ! return isinstance(obj, StringType) or isinstance(obj, UnicodeType) *************** *** 38,46 **** # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg): ! """Iterate over the parts, returning string payloads line-by-line.""" lines = [] for subpart in msg.walk(): ! payload = subpart.get_payload() if _isstring(payload): for line in StringIO(payload).readlines(): --- 41,52 ---- # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg, decode=False): ! """Iterate over the parts, returning string payloads line-by-line. ! ! Optional decode (default False) is passed through to .get_payload(). ! """ lines = [] for subpart in msg.walk(): ! payload = subpart.get_payload(decode=decode) if _isstring(payload): for line in StringIO(payload).readlines(): Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** _compat22.py 4 Oct 2002 17:24:24 -0000 1.4.2.1 --- _compat22.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 *************** *** 39,46 **** # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg): ! """Iterate over the parts, returning string payloads line-by-line.""" for subpart in msg.walk(): ! payload = subpart.get_payload() if _isstring(payload): for line in StringIO(payload): --- 39,49 ---- # These two functions are imported into the Iterators.py interface module. # The Python 2.2 version uses generators for efficiency. ! def body_line_iterator(msg, decode=False): ! """Iterate over the parts, returning string payloads line-by-line. ! ! Optional decode (default False) is passed through to .get_payload(). ! """ for subpart in msg.walk(): ! payload = subpart.get_payload(decode=decode) if _isstring(payload): for line in StringIO(payload): Index: base64MIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/base64MIME.py,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** base64MIME.py 4 Oct 2002 17:24:24 -0000 1.5.2.1 --- base64MIME.py 21 Mar 2003 21:09:31 -0000 1.5.2.2 *************** *** 103,109 **** max_unencoded = _floordiv(max_encoded * 3, 4) - # BAW: Ben's original code used a step of max_unencoded, but I think it - # ought to be max_encoded. Otherwise, where's max_encoded used? I'm - # still not sure what the for i in range(0, len(header), max_unencoded): base64ed.append(b2a_base64(header[i:i+max_unencoded])) --- 103,106 ---- Index: quopriMIME.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** quopriMIME.py 4 Oct 2002 17:24:24 -0000 1.4.2.1 --- quopriMIME.py 21 Mar 2003 21:09:31 -0000 1.4.2.2 *************** *** 83,87 **** if not L: L.append(s.lstrip()) ! elif len(L[-1]) + len(s) < maxlen: L[-1] += extra + s else: --- 83,87 ---- if not L: L.append(s.lstrip()) ! elif len(L[-1]) + len(s) <= maxlen: L[-1] += extra + s else: *************** *** 117,121 **** with each line wrapped safely at, at most, maxlinelen characters (defaults ! to 76 characters). End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted --- 117,122 ---- with each line wrapped safely at, at most, maxlinelen characters (defaults ! to 76 characters). If maxlinelen is None, the entire string is encoded in ! one chunk with no splitting. End-of-line characters (\\r, \\n, \\r\\n) will be automatically converted *************** *** 135,141 **** # Quopri encode each line, in encoded chunks no greater than maxlinelen in ! # lenght, after the RFC chrome is added in. quoted = [] ! max_encoded = maxlinelen - len(charset) - MISC_LEN for c in header: --- 136,146 ---- # Quopri encode each line, in encoded chunks no greater than maxlinelen in ! # length, after the RFC chrome is added in. quoted = [] ! if maxlinelen is None: ! # An obnoxiously large number that's good enough ! max_encoded = 100000 ! else: ! max_encoded = maxlinelen - len(charset) - MISC_LEN - 1 for c in header: From jvr@users.sourceforge.net Fri Mar 21 22:22:21 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 21 Mar 2003 14:22:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv26423 Modified Files: bundlebuilder.py Log Message: use os.path.realpath() instead of os.readlink() Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** bundlebuilder.py 21 Mar 2003 11:32:37 -0000 1.23 --- bundlebuilder.py 21 Mar 2003 22:22:19 -0000 1.24 *************** *** 444,450 **** hashbang = "/usr/bin/python" else: ! hashbang = sys.executable ! while os.path.islink(hashbang): ! hashbang = os.readlink(hashbang) standalone = self.standalone open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) --- 444,448 ---- hashbang = "/usr/bin/python" else: ! hashbang = os.path.realpath(sys.executable) standalone = self.standalone open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) From jackjansen@users.sourceforge.net Fri Mar 21 23:49:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 15:49:30 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv29450/Dist Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/Dist added to the repository From jackjansen@users.sourceforge.net Fri Mar 21 23:49:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 15:49:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv29549/resources Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources added to the repository From jackjansen@users.sourceforge.net Fri Mar 21 23:52:38 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 15:52:38 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources Welcome.txt,NONE,1.1 postflight,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv29757/resources Added Files: Welcome.txt postflight Log Message: Tools to build a disk image with a binary installer for MacPython-OSX, donated by Robin Dunn and the rest of the wxPythonMac crew. These are the versions from cvs.wxwindows.org as of 22-Mar-03, checked in for reference. --- NEW FILE: Welcome.txt --- Welcome! This program will install Python 2.3a2 for Mac OS X as a Framework. Build number: 3 Build date: Thu Mar 20 18:54:52 PST 2003 --- NEW FILE: postflight --- #!/bin/sh #---------------------------------------------------------------------- # Create the unix tools and compile the .py files after Python has been # installed. #---------------------------------------------------------------------- PYVER=2.3 PKG=$1 DEST=$2 # if destination is / then use usr/local/bin, otherwise just bin if [ "$DEST" = "/" ]; then TOOLDIR=/usr/local/bin DEST= else TOOLDIR=$DEST/bin fi # Make sure the dir exists mkdir -p $TOOLDIR # Make some links to the python executable if [ -e $TOOLDIR/python$PYVER ]; then rm $TOOLDIR/python$PYVER fi ln -fs $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python $TOOLDIR/python$PYVER if [ -e $TOOLDIR/python ]; then rm $TOOLDIR/python fi ln -fs python$PYVER $TOOLDIR/python # make the pythonw script cat > $TOOLDIR/pythonw < Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv29757 Added Files: README.txt build makedmg Log Message: Tools to build a disk image with a binary installer for MacPython-OSX, donated by Robin Dunn and the rest of the wxPythonMac crew. These are the versions from cvs.wxwindows.org as of 22-Mar-03, checked in for reference. --- NEW FILE: README.txt --- This is a set of build scripts and such for MacPython-OSX 2.3 that I will use until there are standard distributions from Jack. --- NEW FILE: build --- #!/bin/sh -e #---------------------------------------------------------------------- # Build MacPython 2.3 and make an Installer package of it # TODO: Parameterize the versions, builddirs, etc... # Script configs PYVERSION=2.3a2 PYVER=2.3 BUILDNUM=3 DOCLEANUP=no PROGDIR="`dirname \"$0\"`" TMPDIR=/tmp/_py #TMPDIR=/projects/_py BUILDROOT=$TMPDIR/build INSTALLROOT=$TMPDIR/install DMGDIR=$TMPDIR/dmg RESOURCEDIR=$PROGDIR/resources DESTDIR=/projects/wx/wxPython/dist PYTHONSRC=/projects/Python-$PYVERSION WASTEDIR=/projects/waste # Setup mkdir -p $BUILDROOT mkdir -p $INSTALLROOT rm -rf $DMGDIR mkdir -p $DMGDIR/root # Configure and build Python pushd $BUILDROOT # Check if we should build and install the docs, but only if it # doesn't appear to be done already. TODO: fix this path to be version independent if [ ! -e "build/temp.darwin-6.3-Power Macintosh-2.3/build-html/build-html idx" ]; then read -p "Build the Python docs? (y/N)? " builddocs fi # If the filesystem is case-sensitive then "python" will be built, but # some parts of the install expect "python.exe which is what is built # on a case-insensitive filesystem. Make a link just in case it is # needed. if [ ! -e python.exe ]; then ln -s python python.exe fi # Make a link to the waste dir so that lib can be found. This allows # the PythonIDE to be built if [ ! -e waste ]; then ln -s $WASTEDIR waste fi $PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x make make frameworkinstall if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build echo "" read -p "When the help indexer is done press Enter..." ans ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py install \ --prefix=$INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER fi popd # Make the Installer package: # First, remove the unix tools as their paths will be wrong. We'll recreate # them in the postinstall. rm -r $INSTALLROOT/usr # Next, remove the .pyc/.pyo files python $PROGDIR/../zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER # Make the welcome message cat > $RESOURCEDIR/Welcome.txt <); close( MYPIPE); $dmgsize /= 1024; $dmgsize = int($dmgsize + 4); if( $dmgsize < 5 ) { $dmgsize = 5 } # create disk image system "cd \"$dst\"; $hdiUtilExec create -megabytes $dmgsize -ov \"_${name}\""; if( $? ) { die "couldn't create disk image\n"; } # format disk image if( not open( MYPIPE, "cd \"$dst\"; $hdiDrvExec -nomount \"_${name}.dmg\" |") ) { die "couldn't open pipe\n"; } (my $dev) = split( /\t/, ); $dev =~ s/^(.*\S)\s*$/$1/; my( $part, $raw, $pname); while( ) { ($part,$pname) = split /\t/; if( $pname =~ m/^Apple_HFS/ ) { $part =~ s/^\s*(.*\S)\s*$/$1/; $raw = $part; $raw =~ s/^(\/dev\/)(.+)/$1r$2/; last; } } close( MYPIPE); system "cd \"$dst\" ; $newfsExec -v \"$name\" $raw"; if( $? ) { system "$hdiUtilExec eject $dev"; die "couldn't format disk image\n"; } system "$hdiUtilExec eject $dev"; if( $? ) { die "couldn't eject disk image\n"; } # copy files if( not open( MYPIPE, "cd \"$dst\"; $hdiDrvExec \"_${name}.dmg\" |") ) { die "couldn't open pipe\n"; } ($dev) = split( /\t/, ); $dev =~ s/^(.*\S)\s*$/$1/; my $vname; while( ) { ($part,$pname,$vname) = split /\t/; if( $pname =~ m/^Apple_HFS/ ) { $vname =~ s/^(.*\S)\s*$/$1/; last; } } close( MYPIPE); system "$dittoExec \"${src}\" \"${vname}\""; if( $? ) { system "$hdiUtilExec eject $dev"; die "couldn't copy files\n"; } system "$hdiUtilExec eject $dev"; if( $? ) { die "couldn't eject disk image\n"; } # convert disk image system "cd \"$dst\"; $hdiUtilExec convert \"_${name}.dmg\" -format UDCO -o \"${name}\""; if( $? ) { die "couldn't convert disk image\n"; } } From jackjansen@users.sourceforge.net Sat Mar 22 00:02:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 16:02:26 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv4163 Modified Files: build Log Message: Lots of tweaks to make this work in the new setting. Not fully tested yet. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build 21 Mar 2003 23:52:36 -0000 1.1 --- build 22 Mar 2003 00:02:23 -0000 1.2 *************** *** 12,15 **** --- 12,23 ---- PROGDIR="`dirname \"$0\"`" + case x$PROGDIR in + x|x.) PROGDIR=`pwd` ;; + x/*) ;; + *) echo "Please run with a full pathname" + exit 1 + ;; + esac + TMPDIR=/tmp/_py #TMPDIR=/projects/_py *************** *** 19,25 **** DMGDIR=$TMPDIR/dmg RESOURCEDIR=$PROGDIR/resources ! DESTDIR=/projects/wx/wxPython/dist ! PYTHONSRC=/projects/Python-$PYVERSION ! WASTEDIR=/projects/waste # Setup --- 27,33 ---- DMGDIR=$TMPDIR/dmg RESOURCEDIR=$PROGDIR/resources ! DESTDIR=$TMPDIR/dist ! PYTHONSRC=$PROGDIR/../../.. ! WASTEDIR=$PYTHONSRC/../waste # Setup *************** *** 72,79 **** # First, remove the unix tools as their paths will be wrong. We'll recreate # them in the postinstall. ! rm -r $INSTALLROOT/usr # Next, remove the .pyc/.pyo files ! python $PROGDIR/../zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER # Make the welcome message --- 80,88 ---- # First, remove the unix tools as their paths will be wrong. We'll recreate # them in the postinstall. ! rm -rf $INSTALLROOT/usr # Next, remove the .pyc/.pyo files ! python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/lib/python$PYVER ! python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools # Make the welcome message *************** *** 87,99 **** EOF - - # fix a bug in the IDLE install - IDLERES=$INSTALLROOT/Applications/MacPython-2.3/IDLE.app/Contents/Resources - mv $IDLERES/idlelib/idle $IDLERES - - # Finally, build the package... rm -rf MacPython-OSX.pkg ! python $PROGDIR/../buildpkg.py \ --Title=MacPython-OSX \ --Version=$PYVERSION-$BUILDNUM \ --- 96,102 ---- EOF # Finally, build the package... rm -rf MacPython-OSX.pkg ! python $PYTHONSRC/Mac/scripts/buildpkg.py \ --Title=MacPython-OSX \ --Version=$PYVERSION-$BUILDNUM \ *************** *** 109,113 **** # ...and then make a disk image containing the package. mv MacPython-OSX.pkg $DMGDIR/root ! $PROGDIR/../makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR --- 112,116 ---- # ...and then make a disk image containing the package. mv MacPython-OSX.pkg $DMGDIR/root ! $PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-OSX-$PYVERSION-$BUILDNUM echo Moving $DMGDIR/MacPython-OSX-$PYVERSION-$BUILDNUM to $DESTDIR *************** *** 127,129 **** --- 130,133 ---- echo " $DMGDIR" fi + echo "Your installer can be found in $DESTDIR" From jackjansen@users.sourceforge.net Sat Mar 22 00:02:26 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 21 Mar 2003 16:02:26 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources postflight,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv4163/resources Modified Files: postflight Log Message: Lots of tweaks to make this work in the new setting. Not fully tested yet. Index: postflight =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/postflight,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** postflight 21 Mar 2003 23:52:36 -0000 1.1 --- postflight 22 Mar 2003 00:02:23 -0000 1.2 *************** *** 23,43 **** # Make some links to the python executable ! if [ -e $TOOLDIR/python$PYVER ]; then ! rm $TOOLDIR/python$PYVER ! fi ! ln -fs $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python $TOOLDIR/python$PYVER ! ! if [ -e $TOOLDIR/python ]; then ! rm $TOOLDIR/python ! fi ! ln -fs python$PYVER $TOOLDIR/python # make the pythonw script ! cat > $TOOLDIR/pythonw < $TOOLDIR/pythonw$PYVER < Message-ID: On Thu, 20 Mar 2003 tim_one@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Objects > In directory sc8-pr-cvs1:/tmp/cvs-serv6732/python/Objects > > Modified Files: > floatobject.c > Log Message: > New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is a > refactoring to get all the duplicates of this delicate code out of the > cPickle and struct modules. > > > Index: floatobject.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v > retrieving revision 2.120 > retrieving revision 2.121 > diff -C2 -d -r2.120 -r2.121 > *** floatobject.c 29 Jan 2003 17:58:45 -0000 2.120 > --- floatobject.c 20 Mar 2003 20:53:32 -0000 2.121 > *************** > *** 905,906 **** > --- 905,1219 ---- > } > } > + > + /*---------------------------------------------------------------------------- > + * _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h. > + * > + * TODO: On platforms that use the standard IEEE-754 single and double > + * formats natively, these routines could simply copy the bytes. > + */ > + int > + _PyFloat_Pack4(double x, unsigned char *p, int le) > + { For those platforms that build cStringIO and struct as DL extensions, shouldn't these be declared with the PyAPI_FUNC() macro? -- 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 nnorwitz@users.sourceforge.net Sat Mar 22 00:23:06 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 21 Mar 2003 16:23:06 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv17517 Modified Files: Makefile.deps Log Message: Add lib/mimelib.tex to dependencies Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** Makefile.deps 21 Mar 2003 00:28:30 -0000 1.100 --- Makefile.deps 22 Mar 2003 00:23:04 -0000 1.101 *************** *** 97,100 **** --- 97,101 ---- lib/emailparser.tex \ lib/emailutil.tex \ + lib/mimelib.tex \ lib/libintro.tex \ lib/libobjs.tex \ From tim_one@users.sourceforge.net Sat Mar 22 01:16:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 21 Mar 2003 17:16:08 -0800 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv12180/PCbuild Modified Files: python20.wse Log Message: Stop creating empty CVS directories in the csv subtree. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** python20.wse 21 Mar 2003 01:55:41 -0000 1.119 --- python20.wse 22 Mar 2003 01:16:05 -0000 1.120 *************** *** 1941,1945 **** Destination=%MAINDIR%\Lib\csv Description=CSV package ! Flags=0000000100000010 end item: Remark --- 1941,1951 ---- Destination=%MAINDIR%\Lib\csv Description=CSV package ! Flags=0000000000000010 ! end ! item: Install File ! Source=..\lib\csv\util\*.py ! Destination=%MAINDIR%\Lib\csv\util ! Description=CSV package ! Flags=0000000000000010 end item: Remark From tim.one@comcast.net Sat Mar 22 01:25:10 2003 From: tim.one@comcast.net (Tim Peters) Date: Fri, 21 Mar 2003 20:25:10 -0500 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.120,2.121 In-Reply-To: Message-ID: >> Modified Files: >> floatobject.c >> Log Message: >> New private API functions _PyFloat_{Pack,Unpack}(4,8}. >> ... [Andrew MacIntyre] > For those platforms that build cStringIO and struct as DL extensions, > shouldn't these be declared with the PyAPI_FUNC() macro? They are, in floatobject.h. floatobject.c contains their definitions (as opposed to their declarations); all uses of PyAPI_FUNC() are in header files. From tim_one@users.sourceforge.net Sat Mar 22 02:08:32 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 21 Mar 2003 18:08:32 -0800 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.98.4.10,1.98.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv1036/PCbuild Modified Files: Tag: release22-maint python20.wse Log Message: Synch the Windows installer with changes in the email package. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.10 retrieving revision 1.98.4.11 diff -C2 -d -r1.98.4.10 -r1.98.4.11 *** python20.wse 14 Oct 2002 15:09:12 -0000 1.98.4.10 --- python20.wse 22 Mar 2003 02:08:30 -0000 1.98.4.11 *************** *** 1930,1933 **** --- 1930,1939 ---- Flags=0000000000000010 end + item: Install File + Source=..\lib\email\test\data\*.au + Destination=%MAINDIR%\Lib\email\test\data + Description=email test data + Flags=0000000000000010 + end item: Remark end From barry@python.org Sat Mar 22 03:30:03 2003 From: barry@python.org (Barry Warsaw) Date: Fri, 21 Mar 2003 22:30:03 -0500 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.100,1.101 In-Reply-To: Message-ID: <91C0D997-5C16-11D7-8EF8-003065EEFAC8@python.org> On Friday, March 21, 2003, at 07:23 PM, nnorwitz@users.sourceforge.net wrote: > Add lib/mimelib.tex to dependencies Actually, no. mimelib.tex is just boilerplate for generating the standalone email package's documentation. It isn't used to build Python's docs. -Barry From neal@metaslash.com Sat Mar 22 03:58:39 2003 From: neal@metaslash.com (Neal Norwitz) Date: Fri, 21 Mar 2003 22:58:39 -0500 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.100,1.101 In-Reply-To: <91C0D997-5C16-11D7-8EF8-003065EEFAC8@python.org> References: <91C0D997-5C16-11D7-8EF8-003065EEFAC8@python.org> Message-ID: <20030322035839.GU14067@epoch.metaslash.com> On Fri, Mar 21, 2003 at 10:30:03PM -0500, Barry Warsaw wrote: > On Friday, March 21, 2003, at 07:23 PM, nnorwitz@users.sourceforge.net > wrote: > > >Add lib/mimelib.tex to dependencies > > Actually, no. mimelib.tex is just boilerplate for generating the > standalone email package's documentation. It isn't used to build > Python's docs. After mimelib.tex was updated, I tried to make the docs, but nothing happened. So I added the lib/mimelib.tex dependency which then made the docs. Now I know that it's only for the standalone package. Should I back out the change? Neal From fdrake@acm.org Sat Mar 22 04:25:58 2003 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 21 Mar 2003 23:25:58 -0500 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.100,1.101 In-Reply-To: <20030322035839.GU14067@epoch.metaslash.com> References: <91C0D997-5C16-11D7-8EF8-003065EEFAC8@python.org> <20030322035839.GU14067@epoch.metaslash.com> Message-ID: <15995.58838.643878.197227@grendel.zope.com> Neal Norwitz writes: > After mimelib.tex was updated, I tried to make the docs, but nothing > happened. So I added the lib/mimelib.tex dependency which then made > the docs. Now I know that it's only for the standalone package. > Should I back out the change? Yes. If you'd like to add targets to build paper-*/mimelib.pdf (or even to call it paper-*/email.pdf), and corresponding targets for other formats, that would be fine, but those should not be included among the default collection of targets, and won't be distributed as part of the standard Python documentation. mimelib.tex is really only included as a convenience since the rest of the documentation for the standalone email package is part of Python's CVS. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From barry@python.org Sat Mar 22 04:48:09 2003 From: barry@python.org (Barry Warsaw) Date: 21 Mar 2003 23:48:09 -0500 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.100,1.101 In-Reply-To: <15995.58838.643878.197227@grendel.zope.com> References: <91C0D997-5C16-11D7-8EF8-003065EEFAC8@python.org> <20030322035839.GU14067@epoch.metaslash.com> <15995.58838.643878.197227@grendel.zope.com> Message-ID: <1048308489.18777.2.camel@geddy> On Fri, 2003-03-21 at 23:25, Fred L. Drake, Jr. wrote: > Neal Norwitz writes: > > After mimelib.tex was updated, I tried to make the docs, but nothing > > happened. So I added the lib/mimelib.tex dependency which then made > > the docs. Now I know that it's only for the standalone package. > > Should I back out the change? > > Yes. If you'd like to add targets to build paper-*/mimelib.pdf (or > even to call it paper-*/email.pdf), and corresponding targets for > other formats, that would be fine, but those should not be included > among the default collection of targets, and won't be distributed as > part of the standard Python documentation. mimelib.tex is really only > included as a convenience since the rest of the documentation for the > standalone email package is part of Python's CVS. I don't feel a burning need to do other formats. I distribute PostScript, PDF, and html with the standalone email package. -Barry From fdrake@acm.org Sat Mar 22 04:55:45 2003 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 21 Mar 2003 23:55:45 -0500 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.100,1.101 In-Reply-To: <1048308489.18777.2.camel@geddy> References: <91C0D997-5C16-11D7-8EF8-003065EEFAC8@python.org> <20030322035839.GU14067@epoch.metaslash.com> <15995.58838.643878.197227@grendel.zope.com> <1048308489.18777.2.camel@geddy> Message-ID: <15995.60625.757430.219342@grendel.zope.com> Barry Warsaw writes: > I don't feel a burning need to do other formats. I distribute > PostScript, PDF, and html with the standalone email package. I think the PostScript and HTML qualify as other formats. ;-) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From goodger@users.sourceforge.net Sat Mar 22 06:38:54 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 21 Mar 2003 22:38:54 -0800 Subject: [Python-checkins] python/nondist/peps pep-0305.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv31939 Modified Files: pep-0305.txt Log Message: fixed lists Index: pep-0305.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0305.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pep-0305.txt 13 Feb 2003 19:01:17 -0000 1.15 --- pep-0305.txt 22 Mar 2003 06:38:51 -0000 1.16 *************** *** 28,32 **** - Better motivation for the choice of passing a file object to the ! constructors. See http://manatee.mojam.com/pipermail/csv/2003-January/000179.html - Unicode. ugh. --- 28,33 ---- - Better motivation for the choice of passing a file object to the ! constructors. See ! http://manatee.mojam.com/pipermail/csv/2003-January/000179.html - Unicode. ugh. *************** *** 40,55 **** mechanisms and line endings. The authors intend the proposed module to solve this one parsing problem efficiently. The authors do not ! intend to address any of these related topics:: ! - data interpretation (is a field containing the string "10" ! supposed to be a string, a float or an int? is it a number in ! base 10, base 16 or base 2? is a number in quotes a number or a ! string?) ! - locale-specific data representation (should the number 1.23 be ! written as "1.23" or "1,23" or "1 23"?) -- this may eventually ! be addressed. ! - fixed width tabular data - can already be parsed reliably. --- 41,55 ---- mechanisms and line endings. The authors intend the proposed module to solve this one parsing problem efficiently. The authors do not ! intend to address any of these related topics: ! - data interpretation (is a field containing the string "10" supposed ! to be a string, a float or an int? is it a number in base 10, base ! 16 or base 2? is a number in quotes a number or a string?) ! - locale-specific data representation (should the number 1.23 be ! written as "1.23" or "1,23" or "1 23"?) -- this may eventually be ! addressed. ! - fixed width tabular data - can already be parsed reliably. *************** *** 247,288 **** In addition to the dialect argument, both the reader and writer constructors take several specific formatting parameters, specified as ! keyword parameters. The formatting parameters understood are:: ! - ``quotechar`` specifies a one-character string to use as the ! quoting character. It defaults to '"'. Setting this to None ! has the same effect as setting quoting to csv.QUOTE_NONE. ! - ``delimiter`` specifies a one-character string to use as the ! field separator. It defaults to ','. ! - ``escapechar`` specifies a one-character string used to escape ! the delimiter when quotechar is set to None. ! - ``skipinitialspace`` specifies how to interpret whitespace which ! immediately follows a delimiter. It defaults to False, which ! means that whitespace immediately following a delimiter is part ! of the following field. ! - ``lineterminator`` specifies the character sequence which should ! terminate rows. ! - ``quoting`` controls when quotes should be generated by the ! writer. It can take on any of the following module constants:: ! * csv.QUOTE_MINIMAL means only when required, for example, ! when a field contains either the quotechar or the delimiter ! * csv.QUOTE_ALL means that quotes are always placed around ! fields. ! * csv.QUOTE_NONNUMERIC means that quotes are always placed ! around nonnumeric fields. ! * csv.QUOTE_NONE means that quotes are never placed around ! fields. ! - ``doublequote`` controls the handling of quotes inside fields. ! When True two consecutive quotes are interpreted as one during ! read, and when writing, each quote is written as two quotes. When processing a dialect setting and one or more of the other --- 247,286 ---- In addition to the dialect argument, both the reader and writer constructors take several specific formatting parameters, specified as ! keyword parameters. The formatting parameters understood are: ! - ``quotechar`` specifies a one-character string to use as the quoting ! character. It defaults to '"'. Setting this to None has the same ! effect as setting quoting to csv.QUOTE_NONE. ! - ``delimiter`` specifies a one-character string to use as the field ! separator. It defaults to ','. ! - ``escapechar`` specifies a one-character string used to escape the ! delimiter when quotechar is set to None. ! - ``skipinitialspace`` specifies how to interpret whitespace which ! immediately follows a delimiter. It defaults to False, which means ! that whitespace immediately following a delimiter is part of the ! following field. ! - ``lineterminator`` specifies the character sequence which should ! terminate rows. ! - ``quoting`` controls when quotes should be generated by the writer. ! It can take on any of the following module constants:: ! * csv.QUOTE_MINIMAL means only when required, for example, when a ! field contains either the quotechar or the delimiter ! * csv.QUOTE_ALL means that quotes are always placed around fields. ! * csv.QUOTE_NONNUMERIC means that quotes are always placed around ! nonnumeric fields. ! * csv.QUOTE_NONE means that quotes are never placed around fields. ! - ``doublequote`` controls the handling of quotes inside fields. When ! True two consecutive quotes are interpreted as one during read, and ! when writing, each quote is written as two quotes. When processing a dialect setting and one or more of the other *************** *** 331,335 **** - Issues ====== --- 329,332 ---- *************** *** 377,384 **** csv.py. ! 8. Are quote character and delimiters limited to single characters? For the time being, yes. ! 9. How should rows of different lengths be handled? Interpretation of the data is the application's job. There is no such thing as a "short row" or a "long row" at this level. --- 374,381 ---- csv.py. ! 7. Are quote character and delimiters limited to single characters? For the time being, yes. ! 8. How should rows of different lengths be handled? Interpretation of the data is the application's job. There is no such thing as a "short row" or a "long row" at this level. From goodger@users.sourceforge.net Sat Mar 22 06:39:56 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 21 Mar 2003 22:39:56 -0800 Subject: [Python-checkins] python/nondist/peps pep-0305.txt,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv32122 Modified Files: pep-0305.txt Log Message: one more fix Index: pep-0305.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0305.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pep-0305.txt 22 Mar 2003 06:38:51 -0000 1.16 --- pep-0305.txt 22 Mar 2003 06:39:54 -0000 1.17 *************** *** 268,272 **** - ``quoting`` controls when quotes should be generated by the writer. ! It can take on any of the following module constants:: * csv.QUOTE_MINIMAL means only when required, for example, when a --- 268,272 ---- - ``quoting`` controls when quotes should be generated by the writer. ! It can take on any of the following module constants: * csv.QUOTE_MINIMAL means only when required, for example, when a From nnorwitz@users.sourceforge.net Sat Mar 22 16:19:54 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 22 Mar 2003 08:19:54 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv25827/Doc Modified Files: Makefile.deps Log Message: Back out previous change as discussed on python-checkins Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** Makefile.deps 22 Mar 2003 00:23:04 -0000 1.101 --- Makefile.deps 22 Mar 2003 16:19:52 -0000 1.102 *************** *** 97,101 **** lib/emailparser.tex \ lib/emailutil.tex \ - lib/mimelib.tex \ lib/libintro.tex \ lib/libobjs.tex \ --- 97,100 ---- From nnorwitz@users.sourceforge.net Sat Mar 22 16:35:39 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 22 Mar 2003 08:35:39 -0800 Subject: [Python-checkins] python/dist/src/Python dynload_aix.c,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv29905/Python Modified Files: dynload_aix.c Log Message: Include Python.h first which defines _XOPEN_SOURCE which allows the file to compile and removes a warning about _XOPEN_SOURCE being redefined (works on AIX 4.3 and 5.1 at least). Index: dynload_aix.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/dynload_aix.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** dynload_aix.c 31 Dec 2002 00:06:24 -0000 2.13 --- dynload_aix.c 22 Mar 2003 16:35:37 -0000 2.14 *************** *** 2,5 **** --- 2,8 ---- /* Support for dynamic loading of extension modules */ + #include "Python.h" + #include "importdl.h" + #include /* for isdigit() */ #include /* for global errno */ *************** *** 7,13 **** #include /* for malloc(), free() */ #include - - #include "Python.h" - #include "importdl.h" --- 10,13 ---- From tim_one@users.sourceforge.net Sun Mar 23 02:51:03 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 22 Mar 2003 18:51:03 -0800 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18845/Misc Modified Files: SpecialBuilds.txt Log Message: When Py_TRACE_REFS is defined, a list of all live objects is maintained in a doubly-linked list, exposed by sys.getobjects(). Unfortunately, it's not really all live objects, and it seems my fate to bump into programs where sys.gettotalrefcount() keeps going up but where the reference leaks aren't accounted for by anything in the list of all objects. This patch helps a little: if COUNT_ALLOCS is also defined, from now on type objects will also appear in this list, provided at least one object of a type has been allocated. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SpecialBuilds.txt 5 Feb 2003 23:12:57 -0000 1.13 --- SpecialBuilds.txt 23 Mar 2003 02:51:01 -0000 1.14 *************** *** 35,42 **** Turn on heavy reference debugging. This is major surgery. Every PyObject grows two more pointers, to maintain a doubly-linked list of all live ! heap-allocated objects (note that, e.g., most builtin type objects are not ! in this list, as they're statically allocated). Note that because the ! fundamental PyObject layout changes, Python modules compiled with ! Py_TRACE_REFS are incompatible with modules compiled without it. Py_TRACE_REFS implies Py_REF_DEBUG. --- 35,46 ---- Turn on heavy reference debugging. This is major surgery. Every PyObject grows two more pointers, to maintain a doubly-linked list of all live ! heap-allocated objects. Most builtin type objects are not in this list, ! as they're statically allocated. Starting in Python 2.3, if COUNT_ALLOCS ! (see below) is also defined, a static type object T does appear in this ! list if at least one object of type T has been created. ! ! Note that because the fundamental PyObject layout changes, Python modules ! compiled with Py_TRACE_REFS are incompatible with modules compiled without ! it. Py_TRACE_REFS implies Py_REF_DEBUG. *************** *** 171,174 **** --- 175,183 ---- all heap-allocated type objects immortal, except for those for which no object of that type is ever allocated. + + Starting with Python 2.3, If Py_TRACE_REFS is also defined, COUNT_ALLOCS + arranges to ensure that the type object for each allocated object + appears in the doubly-linked list of all objects maintained by + Py_TRACE_REFS. Special gimmicks: From tim_one@users.sourceforge.net Sun Mar 23 02:51:04 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 22 Mar 2003 18:51:04 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.201,2.202 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv18845/Objects Modified Files: object.c Log Message: When Py_TRACE_REFS is defined, a list of all live objects is maintained in a doubly-linked list, exposed by sys.getobjects(). Unfortunately, it's not really all live objects, and it seems my fate to bump into programs where sys.gettotalrefcount() keeps going up but where the reference leaks aren't accounted for by anything in the list of all objects. This patch helps a little: if COUNT_ALLOCS is also defined, from now on type objects will also appear in this list, provided at least one object of a type has been allocated. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.201 retrieving revision 2.202 diff -C2 -d -r2.201 -r2.202 *** object.c 17 Mar 2003 19:46:11 -0000 2.201 --- object.c 23 Mar 2003 02:51:01 -0000 2.202 *************** *** 18,21 **** --- 18,26 ---- Do not call them otherwise, they do not initialize the object! */ + #ifdef Py_TRACE_REFS + /* Head of doubly-linked list of all objects. */ + static PyObject refchain = {&refchain, &refchain}; + #endif + #ifdef COUNT_ALLOCS static PyTypeObject *type_list; *************** *** 85,88 **** --- 90,103 ---- Py_INCREF(tp); type_list = tp; + #ifdef Py_REF_DEBUG + /* Also insert in the doubly-linked list of all objects. */ + if (tp->_ob_next == NULL) { + PyObject *op = (PyObject *)tp; + op->_ob_next = refchain._ob_next; + op->_ob_prev = &refchain; + refchain._ob_next->_ob_prev = op; + refchain._ob_next = op; + } + #endif } tp->tp_allocs++; *************** *** 1936,1941 **** #ifdef Py_TRACE_REFS - - static PyObject refchain = {&refchain, &refchain}; void --- 1951,1954 ---- From tim_one@users.sourceforge.net Sun Mar 23 03:04:35 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 22 Mar 2003 19:04:35 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.202,2.203 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv24131/python/objects Modified Files: object.c Log Message: Oops! Used a wrong preprocessor symbol. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.202 retrieving revision 2.203 diff -C2 -d -r2.202 -r2.203 *** object.c 23 Mar 2003 02:51:01 -0000 2.202 --- object.c 23 Mar 2003 03:04:32 -0000 2.203 *************** *** 90,94 **** Py_INCREF(tp); type_list = tp; ! #ifdef Py_REF_DEBUG /* Also insert in the doubly-linked list of all objects. */ if (tp->_ob_next == NULL) { --- 90,94 ---- Py_INCREF(tp); type_list = tp; ! #ifdef Py_TRACE_REFS /* Also insert in the doubly-linked list of all objects. */ if (tp->_ob_next == NULL) { From tim_one@users.sourceforge.net Sun Mar 23 03:33:15 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 22 Mar 2003 19:33:15 -0800 Subject: [Python-checkins] python/dist/src/Include object.h,2.115,2.116 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv30969/python/Include Modified Files: object.h Log Message: Refactored some of the Py_TRACE_REFS code. New private API function _Py_AddToAllObjects() that simply inserts an object at the front of the doubly-linked list of all objects. Changed PyType_Ready() (the closest thing we've got to a choke point for type objects) to call that. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.115 retrieving revision 2.116 diff -C2 -d -r2.115 -r2.116 *** object.h 17 Mar 2003 19:45:59 -0000 2.115 --- object.h 23 Mar 2003 03:33:13 -0000 2.116 *************** *** 583,586 **** --- 583,587 ---- PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); + PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *); #else From tim_one@users.sourceforge.net Sun Mar 23 03:33:16 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 22 Mar 2003 19:33:16 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.203,2.204 typeobject.c,2.216,2.217 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv30969/python/Objects Modified Files: object.c typeobject.c Log Message: Refactored some of the Py_TRACE_REFS code. New private API function _Py_AddToAllObjects() that simply inserts an object at the front of the doubly-linked list of all objects. Changed PyType_Ready() (the closest thing we've got to a choke point for type objects) to call that. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.203 retrieving revision 2.204 diff -C2 -d -r2.203 -r2.204 *** object.c 23 Mar 2003 03:04:32 -0000 2.203 --- object.c 23 Mar 2003 03:33:13 -0000 2.204 *************** *** 21,24 **** --- 21,34 ---- /* Head of doubly-linked list of all objects. */ static PyObject refchain = {&refchain, &refchain}; + + /* Insert op at the fron of the doubly-linked list of all objects. */ + void + _Py_AddToAllObjects(PyObject *op) + { + op->_ob_next = refchain._ob_next; + op->_ob_prev = &refchain; + refchain._ob_next->_ob_prev = op; + refchain._ob_next = op; + } #endif *************** *** 92,101 **** #ifdef Py_TRACE_REFS /* Also insert in the doubly-linked list of all objects. */ ! if (tp->_ob_next == NULL) { ! PyObject *op = (PyObject *)tp; ! op->_ob_next = refchain._ob_next; ! op->_ob_prev = &refchain; ! refchain._ob_next->_ob_prev = op; ! refchain._ob_next = op; } #endif --- 102,108 ---- #ifdef Py_TRACE_REFS /* Also insert in the doubly-linked list of all objects. */ ! if (tp->_ob_prev == NULL) { ! assert(tp->_ob_next == NULL); ! _Py_AddToAllObjects((PyObject *)tp); } #endif *************** *** 1957,1964 **** _Py_INC_REFTOTAL; op->ob_refcnt = 1; ! op->_ob_next = refchain._ob_next; ! op->_ob_prev = &refchain; ! refchain._ob_next->_ob_prev = op; ! refchain._ob_next = op; _Py_INC_TPALLOCS(op); } --- 1964,1968 ---- _Py_INC_REFTOTAL; op->ob_refcnt = 1; ! _Py_AddToAllObjects(op); _Py_INC_TPALLOCS(op); } Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.216 retrieving revision 2.217 diff -C2 -d -r2.216 -r2.217 *** typeobject.c 12 Mar 2003 04:25:42 -0000 2.216 --- typeobject.c 23 Mar 2003 03:33:13 -0000 2.217 *************** *** 3053,3056 **** --- 3053,3068 ---- type->tp_flags |= Py_TPFLAGS_READYING; + #ifdef Py_TRACE_REFS + /* PyType_Ready is the closest thing we have to a choke point + * for type objects, so is the best place I can think of to try + * to get type objects into the doubly-linked list of all objects. + * Still, not all type objects go thru PyType_Ready. + */ + if (type->_ob_next == NULL) { + assert(type->_ob_prev == NULL); + _Py_AddToAllObjects((PyObject *)type); + } + #endif + /* Initialize tp_base (defaults to BaseObject unless that's us) */ base = type->tp_base; From tim_one@users.sourceforge.net Sun Mar 23 05:35:38 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 22 Mar 2003 21:35:38 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.217,2.218 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv27711/python/Objects Modified Files: typeobject.c Log Message: slot_sq_contains(): This leaked a reference to the result of calling __contains__(). Bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.217 retrieving revision 2.218 diff -C2 -d -r2.217 -r2.218 *** typeobject.c 23 Mar 2003 03:33:13 -0000 2.217 --- typeobject.c 23 Mar 2003 05:35:36 -0000 2.218 *************** *** 4017,4024 **** { PyObject *func, *res, *args; static PyObject *contains_str; func = lookup_maybe(self, "__contains__", &contains_str); - if (func != NULL) { args = Py_BuildValue("(O)", value); --- 4017,4025 ---- { PyObject *func, *res, *args; + int result = -1; + static PyObject *contains_str; func = lookup_maybe(self, "__contains__", &contains_str); if (func != NULL) { args = Py_BuildValue("(O)", value); *************** *** 4030,4043 **** } Py_DECREF(func); ! if (res == NULL) ! return -1; ! return PyObject_IsTrue(res); } ! else if (PyErr_Occurred()) ! return -1; ! else { ! return _PySequence_IterSearch(self, value, ! PY_ITERSEARCH_CONTAINS); } } --- 4031,4044 ---- } Py_DECREF(func); ! if (res != NULL) { ! result = PyObject_IsTrue(res); ! Py_DECREF(res); ! } } ! else if (! PyErr_Occurred()) { ! result = _PySequence_IterSearch(self, value, ! PY_ITERSEARCH_CONTAINS); } + return result; } *************** *** 4686,4690 **** /* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper ! functions. The offsets here are relative to the 'PyHeapTypeObject' structure, which incorporates the additional structures used for numbers, sequences and mappings. --- 4687,4691 ---- /* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper ! functions. The offsets here are relative to the 'PyHeapTypeObject' structure, which incorporates the additional structures used for numbers, sequences and mappings. *************** *** 5217,5221 **** In the latter case, the first slotdef entry encoutered wins. Since ! slotdef entries are sorted by the offset of the slot in the PyHeapTypeObject, this gives us some control over disambiguating between competing slots: the members of PyHeapTypeObject are listed from most --- 5218,5222 ---- In the latter case, the first slotdef entry encoutered wins. Since ! slotdef entries are sorted by the offset of the slot in the PyHeapTypeObject, this gives us some control over disambiguating between competing slots: the members of PyHeapTypeObject are listed from most From nnorwitz@users.sourceforge.net Sun Mar 23 13:21:05 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 23 Mar 2003 05:21:05 -0800 Subject: [Python-checkins] python/dist/src/Modules zipimport.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9458/Modules Modified Files: zipimport.c Log Message: Make private function and data static. Index: zipimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** zipimport.c 28 Feb 2003 08:54:01 -0000 1.11 --- zipimport.c 23 Mar 2003 13:21:03 -0000 1.12 *************** *** 21,25 **** are swapped by initzipimport() if we run in optimized mode. Also, '/' is replaced by SEP there. */ ! struct st_zip_searchorder zip_searchorder[] = { {"/__init__.pyc", IS_PACKAGE | IS_BYTECODE}, {"/__init__.pyo", IS_PACKAGE | IS_BYTECODE}, --- 21,25 ---- are swapped by initzipimport() if we run in optimized mode. Also, '/' is replaced by SEP there. */ ! static struct st_zip_searchorder zip_searchorder[] = { {"/__init__.pyc", IS_PACKAGE | IS_BYTECODE}, {"/__init__.pyo", IS_PACKAGE | IS_BYTECODE}, *************** *** 983,987 **** /* Convert the date/time values found in the Zip archive to a value that's compatible with the time stamp stored in .pyc files. */ ! time_t parse_dostime(int dostime, int dosdate) { struct tm stm; --- 983,988 ---- /* Convert the date/time values found in the Zip archive to a value that's compatible with the time stamp stored in .pyc files. */ ! static time_t ! parse_dostime(int dostime, int dosdate) { struct tm stm; From nnorwitz@users.sourceforge.net Sun Mar 23 14:31:05 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 23 Mar 2003 06:31:05 -0800 Subject: [Python-checkins] python/dist/src/Python import.c,2.219,2.220 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5935/Python Modified Files: import.c Log Message: SF patch #708201, unchecked return value in import.c by Jason Harper Will backport. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.219 retrieving revision 2.220 diff -C2 -d -r2.219 -r2.220 *** import.c 17 Feb 2003 18:18:00 -0000 2.219 --- import.c 23 Mar 2003 14:31:01 -0000 2.220 *************** *** 1925,1928 **** --- 1925,1930 ---- pname = PyString_FromString(name); + if (pname == NULL) + return NULL; result = PyImport_Import(pname); Py_DECREF(pname); From montanaro@users.sourceforge.net Sun Mar 23 14:32:56 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun, 23 Mar 2003 06:32:56 -0800 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv6598 Modified Files: _csv.c Log Message: add comment about 2.2 compatibility dump empty TODO comment Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _csv.c 21 Mar 2003 01:35:28 -0000 1.2 --- _csv.c 23 Mar 2003 14:32:54 -0000 1.3 *************** *** 1,7 **** ! /* TODO: */ #include "Python.h" #include "structmember.h" /* begin 2.2 compatibility macros */ --- 1,19 ---- ! /* csv module */ ! ! /* ! ! This module provides the low-level underpinnings of a CSV reading/writing ! module. Users should not use this module directly, but import the csv.py ! module instead. ! ! **** For people modifying this code, please note that as of this writing ! **** (2003-03-23), it is intended that this code should work with Python ! **** 2.2. ! */ #include "Python.h" #include "structmember.h" + /* begin 2.2 compatibility macros */ From nnorwitz@users.sourceforge.net Sun Mar 23 14:32:59 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 23 Mar 2003 06:32:59 -0800 Subject: [Python-checkins] python/dist/src/Python import.c,2.192.6.3,2.192.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv6551/Python Modified Files: Tag: release22-maint import.c Log Message: Backport 2.220, SF patch #708201, unchecked return value in import.c by Jason Harper Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.192.6.3 retrieving revision 2.192.6.4 diff -C2 -d -r2.192.6.3 -r2.192.6.4 *** import.c 13 Feb 2003 17:01:28 -0000 2.192.6.3 --- import.c 23 Mar 2003 14:32:56 -0000 2.192.6.4 *************** *** 1617,1620 **** --- 1617,1622 ---- pname = PyString_FromString(name); + if (pname == NULL) + return NULL; result = PyImport_Import(pname); Py_DECREF(pname); From nnorwitz@users.sourceforge.net Sun Mar 23 14:36:53 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 23 Mar 2003 06:36:53 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.32,2.126.4.33 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv7534/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: Backport Tim's checkin 2.218: slot_sq_contains(): This leaked a reference to the result of calling __contains__(). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.32 retrieving revision 2.126.4.33 diff -C2 -d -r2.126.4.32 -r2.126.4.33 *** typeobject.c 2 Feb 2003 19:59:59 -0000 2.126.4.32 --- typeobject.c 23 Mar 2003 14:36:50 -0000 2.126.4.33 *************** *** 3026,3033 **** { PyObject *func, *res, *args; static PyObject *contains_str; func = lookup_maybe(self, "__contains__", &contains_str); - if (func != NULL) { args = Py_BuildValue("(O)", value); --- 3026,3034 ---- { PyObject *func, *res, *args; + int result = -1; + static PyObject *contains_str; func = lookup_maybe(self, "__contains__", &contains_str); if (func != NULL) { args = Py_BuildValue("(O)", value); *************** *** 3039,3052 **** } Py_DECREF(func); ! if (res == NULL) ! return -1; ! return PyObject_IsTrue(res); } ! else if (PyErr_Occurred()) ! return -1; ! else { ! return _PySequence_IterSearch(self, value, ! PY_ITERSEARCH_CONTAINS); } } --- 3040,3053 ---- } Py_DECREF(func); ! if (res != NULL) { ! result = PyObject_IsTrue(res); ! Py_DECREF(res); ! } } ! else if (! PyErr_Occurred()) { ! result = _PySequence_IterSearch(self, value, ! PY_ITERSEARCH_CONTAINS); } + return result; } From tim_one@users.sourceforge.net Sun Mar 23 17:52:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 23 Mar 2003 09:52:30 -0800 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.282,2.283 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2910/Python Modified Files: bltinmodule.c Log Message: Improved new Py_TRACE_REFS gimmicks. Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.282 retrieving revision 2.283 diff -C2 -d -r2.282 -r2.283 *** bltinmodule.c 23 Feb 2003 21:45:43 -0000 2.282 --- bltinmodule.c 23 Mar 2003 17:52:28 -0000 2.283 *************** *** 1819,1825 **** dict = PyModule_GetDict(mod); #define SETBUILTIN(NAME, OBJECT) \ ! if (PyDict_SetItemString(dict, NAME, (PyObject *)OBJECT) < 0) \ ! return NULL SETBUILTIN("None", Py_None); --- 1819,1838 ---- dict = PyModule_GetDict(mod); + #ifdef Py_TRACE_REFS + /* __builtin__ exposes a number of statically allocated objects + * that, before this code was added in 2.3, never showed up in + * the list of "all objects" maintained by Py_TRACE_REFS. As a + * result, programs leaking references to None and False (etc) + * couldn't be diagnosed by examining sys.getobjects(0). + */ + #define ADD_TO_ALL(OBJECT) _Py_AddToAllObjects((PyObject *)(OBJECT), 0) + #else + #define ADD_TO_ALL(OBJECT) (void)0 + #endif + #define SETBUILTIN(NAME, OBJECT) \ ! if (PyDict_SetItemString(dict, NAME, (PyObject *)OBJECT) < 0) \ ! return NULL; \ ! ADD_TO_ALL(OBJECT) SETBUILTIN("None", Py_None); *************** *** 1865,1868 **** --- 1878,1882 ---- return mod; + #undef ADD_TO_ALL #undef SETBUILTIN } From tim_one@users.sourceforge.net Sun Mar 23 17:52:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 23 Mar 2003 09:52:30 -0800 Subject: [Python-checkins] python/dist/src/Include object.h,2.116,2.117 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv2910/Include Modified Files: object.h Log Message: Improved new Py_TRACE_REFS gimmicks. Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -d -r2.116 -r2.117 *** object.h 23 Mar 2003 03:33:13 -0000 2.116 --- object.h 23 Mar 2003 17:52:28 -0000 2.117 *************** *** 583,587 **** PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); ! PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *); #else --- 583,587 ---- PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); ! PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); #else From tim_one@users.sourceforge.net Sun Mar 23 17:52:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 23 Mar 2003 09:52:30 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.204,2.205 typeobject.c,2.218,2.219 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv2910/Objects Modified Files: object.c typeobject.c Log Message: Improved new Py_TRACE_REFS gimmicks. Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.204 retrieving revision 2.205 diff -C2 -d -r2.204 -r2.205 *** object.c 23 Mar 2003 03:33:13 -0000 2.204 --- object.c 23 Mar 2003 17:52:28 -0000 2.205 *************** *** 19,35 **** #ifdef Py_TRACE_REFS ! /* Head of doubly-linked list of all objects. */ static PyObject refchain = {&refchain, &refchain}; ! /* Insert op at the fron of the doubly-linked list of all objects. */ void ! _Py_AddToAllObjects(PyObject *op) { ! op->_ob_next = refchain._ob_next; ! op->_ob_prev = &refchain; ! refchain._ob_next->_ob_prev = op; ! refchain._ob_next = op; ! } #endif #ifdef COUNT_ALLOCS --- 19,58 ---- #ifdef Py_TRACE_REFS ! /* Head of circular doubly-linked list of all objects. These are linked ! * together via the _ob_prev and _ob_next members of a PyObject, which ! * exist only in a Py_TRACE_REFS build. ! */ static PyObject refchain = {&refchain, &refchain}; ! /* Insert op at the front of the list of all objects. If force is true, ! * op is added even if _ob_prev and _ob_next are non-NULL already. If ! * force is false amd _ob_prev or _ob_next are non-NULL, do nothing. ! * force should be true if and only if op points to freshly allocated, ! * uninitialized memory, or you've unlinked op from the list and are ! * relinking it into the font. ! * Note that objects are normally added to the list via _Py_NewReference, ! * which is called by PyObject_Init. Not all objects are initialized that ! * way, though; exceptions include statically allocated type objects, and ! * statically allocated singletons (like Py_True and Py_None). ! */ void ! _Py_AddToAllObjects(PyObject *op, int force) { ! #ifdef Py_DEBUG ! if (!force) { ! /* If it's initialized memory, op must be in or out of ! * the list unambiguously. ! */ ! assert((op->_ob_prev == NULL) == (op->_ob_next == NULL)); ! } #endif + if (force || op->_ob_prev == NULL) { + op->_ob_next = refchain._ob_next; + op->_ob_prev = &refchain; + refchain._ob_next->_ob_prev = op; + refchain._ob_next = op; + } + } + #endif /* Py_TRACE_REFS */ #ifdef COUNT_ALLOCS *************** *** 101,109 **** type_list = tp; #ifdef Py_TRACE_REFS ! /* Also insert in the doubly-linked list of all objects. */ ! if (tp->_ob_prev == NULL) { ! assert(tp->_ob_next == NULL); ! _Py_AddToAllObjects((PyObject *)tp); ! } #endif } --- 124,131 ---- type_list = tp; #ifdef Py_TRACE_REFS ! /* Also insert in the doubly-linked list of all objects, ! * if not already there. ! */ ! _Py_AddToAllObjects((PyObject *)tp, 0); #endif } *************** *** 1964,1968 **** _Py_INC_REFTOTAL; op->ob_refcnt = 1; ! _Py_AddToAllObjects(op); _Py_INC_TPALLOCS(op); } --- 1986,1990 ---- _Py_INC_REFTOTAL; op->ob_refcnt = 1; ! _Py_AddToAllObjects(op, 1); _Py_INC_TPALLOCS(op); } Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.218 retrieving revision 2.219 diff -C2 -d -r2.218 -r2.219 *** typeobject.c 23 Mar 2003 05:35:36 -0000 2.218 --- typeobject.c 23 Mar 2003 17:52:28 -0000 2.219 *************** *** 3059,3066 **** * Still, not all type objects go thru PyType_Ready. */ ! if (type->_ob_next == NULL) { ! assert(type->_ob_prev == NULL); ! _Py_AddToAllObjects((PyObject *)type); ! } #endif --- 3059,3063 ---- * Still, not all type objects go thru PyType_Ready. */ ! _Py_AddToAllObjects((PyObject *)type, 0); #endif From tim_one@users.sourceforge.net Sun Mar 23 18:06:15 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 23 Mar 2003 10:06:15 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.205,2.206 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv9820/Objects Modified Files: object.c Log Message: Typo in comment. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.205 retrieving revision 2.206 diff -C2 -d -r2.205 -r2.206 *** object.c 23 Mar 2003 17:52:28 -0000 2.205 --- object.c 23 Mar 2003 18:06:08 -0000 2.206 *************** *** 30,34 **** * force should be true if and only if op points to freshly allocated, * uninitialized memory, or you've unlinked op from the list and are ! * relinking it into the font. * Note that objects are normally added to the list via _Py_NewReference, * which is called by PyObject_Init. Not all objects are initialized that --- 30,34 ---- * force should be true if and only if op points to freshly allocated, * uninitialized memory, or you've unlinked op from the list and are ! * relinking it into the front. * Note that objects are normally added to the list via _Py_NewReference, * which is called by PyObject_Init. Not all objects are initialized that From jackjansen@users.sourceforge.net Sun Mar 23 22:05:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:05:55 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv27995 Modified Files: gensuitemodule.py Log Message: Not all objects have an _propdict and _privpropdict, so cater for that. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** gensuitemodule.py 21 Mar 2003 16:28:09 -0000 1.32 --- gensuitemodule.py 23 Mar 2003 22:05:53 -0000 1.33 *************** *** 388,392 **** # Generate property dicts and element dicts for all types declared in this module fp.write("\ndef getbaseclasses(v):\n") ! fp.write("\tif not v._propdict:\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") --- 388,392 ---- # Generate property dicts and element dicts for all types declared in this module fp.write("\ndef getbaseclasses(v):\n") ! fp.write("\tif not getattr(v, '_propdict', None):\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") *************** *** 396,401 **** fp.write("\t\t\tv._propdict.update(getattr(superclass, '_propdict', {}))\n") fp.write("\t\t\tv._elemdict.update(getattr(superclass, '_elemdict', {}))\n") ! fp.write("\t\tv._propdict.update(v._privpropdict)\n") ! fp.write("\t\tv._elemdict.update(v._privelemdict)\n") fp.write("\n") fp.write("import StdSuites\n") --- 396,401 ---- fp.write("\t\t\tv._propdict.update(getattr(superclass, '_propdict', {}))\n") fp.write("\t\t\tv._elemdict.update(getattr(superclass, '_elemdict', {}))\n") ! fp.write("\t\tv._propdict.update(getattr(v, '_privpropdict', {}))\n") ! fp.write("\t\tv._elemdict.update(getattr(v, '_privelemdict', {}))\n") fp.write("\n") fp.write("import StdSuites\n") From jackjansen@users.sourceforge.net Sun Mar 23 22:07:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:07:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.1,1.2 Metrowerks_Shell_Suite.py,1.1,1.2 Required.py,1.1,1.2 Standard_Suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv28308/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Regenerated with Donovan Prestons patch #702620. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CodeWarrior_suite.py 30 Dec 2002 22:04:21 -0000 1.1 --- CodeWarrior_suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/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 """ Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Metrowerks_Shell_Suite.py 30 Dec 2002 22:04:21 -0000 1.1 --- Metrowerks_Shell_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/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 """ Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Required.py 30 Dec 2002 22:04:21 -0000 1.1 --- Required.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/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 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Dec 2002 22:04:21 -0000 1.1 --- Standard_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/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 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Dec 2002 22:04:21 -0000 1.1 --- __init__.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 1,4 **** """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 Resource aete resid 0 AppleEvent Suites """ --- 1,4 ---- """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 Resource aete resid 0 AppleEvent Suites """ *************** *** 31,43 **** from CodeWarrior_suite import * from Metrowerks_Shell_Suite import * def getbaseclasses(v): ! if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): v._propdict = {} v._elemdict = {} ! for superclass in v._superclassnames: ! v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) ! v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) ! v._propdict.update(v._privpropdict) ! v._elemdict.update(v._privelemdict) import StdSuites --- 31,46 ---- from CodeWarrior_suite import * from Metrowerks_Shell_Suite import * + def getbaseclasses(v): ! if not getattr(v, '_propdict', None): v._propdict = {} v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites From jackjansen@users.sourceforge.net Sun Mar 23 22:07:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:07:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.1,1.2 Netscape_Suite.py,1.1,1.2 Required_Suite.py,1.1,1.2 Standard_Suite.py,1.1,1.2 URL_Suite.py,1.1,1.2 Web_Browser_Suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv28308/Explorer Modified Files: Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py Standard_Suite.py URL_Suite.py Web_Browser_Suite.py __init__.py Log Message: Regenerated with Donovan Prestons patch #702620. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Microsoft_Internet_Explorer.py 30 Dec 2002 22:04:22 -0000 1.1 --- Microsoft_Internet_Explorer.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Netscape_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Netscape_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 30 Dec 2002 22:04:22 -0000 1.1 --- Required_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Standard_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 30 Dec 2002 22:04:22 -0000 1.1 --- URL_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 30 Dec 2002 22:04:22 -0000 1.1 --- Web_Browser_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Dec 2002 22:04:22 -0000 1.1 --- __init__.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 1,4 **** """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer Resource aete resid 0 """ *************** *** 39,51 **** from Microsoft_Internet_Explorer import * from Netscape_Suite import * def getbaseclasses(v): ! if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): v._propdict = {} v._elemdict = {} ! for superclass in v._superclassnames: ! v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) ! v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) ! v._propdict.update(v._privpropdict) ! v._elemdict.update(v._privelemdict) import StdSuites --- 39,54 ---- from Microsoft_Internet_Explorer import * from Netscape_Suite import * + def getbaseclasses(v): ! if not getattr(v, '_propdict', None): v._propdict = {} v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites From jackjansen@users.sourceforge.net Sun Mar 23 22:07:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:07:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.1,1.2 PowerPlant.py,1.1,1.2 Required_suite.py,1.1,1.2 Standard_Suite.py,1.1,1.2 Standard_URL_suite.py,1.1,1.2 Text.py,1.1,1.2 WorldWideWeb_suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv28308/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Regenerated with Donovan Prestons patch #702620. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mozilla_suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Mozilla_suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PowerPlant.py 30 Dec 2002 22:04:22 -0000 1.1 --- PowerPlant.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Required_suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Required_suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Standard_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_URL_suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Standard_URL_suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text.py 30 Dec 2002 22:04:22 -0000 1.1 --- Text.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WorldWideWeb_suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- WorldWideWeb_suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Dec 2002 22:04:22 -0000 1.1 --- __init__.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 1,4 **** """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicatorâ„¢ Folder/Netscape Communicatorâ„¢ Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicatorâ„¢ Folder/Netscape Communicatorâ„¢ Resource aete resid 0 """ *************** *** 43,55 **** from PowerPlant import * from Text import * def getbaseclasses(v): ! if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): v._propdict = {} v._elemdict = {} ! for superclass in v._superclassnames: ! v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) ! v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) ! v._propdict.update(v._privpropdict) ! v._elemdict.update(v._privelemdict) import StdSuites --- 43,58 ---- from PowerPlant import * from Text import * + def getbaseclasses(v): ! if not getattr(v, '_propdict', None): v._propdict = {} v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites From jackjansen@users.sourceforge.net Sun Mar 23 22:07:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:07:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Containers_and_folders.py,1.1,1.2 Earlier_terms.py,1.1,1.2 Enumerations.py,1.1,1.2 Files_and_suitcases.py,1.1,1.2 Finder_Basics.py,1.1,1.2 Finder_items.py,1.1,1.2 Obsolete_terms.py,1.1,1.2 Process_classes.py,1.1,1.2 Standard_Suite.py,1.1,1.2 Type_Definitions.py,1.1,1.2 Window_classes.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv28308/Finder Modified Files: 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: Regenerated with Donovan Prestons patch #702620. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Containers_and_folders.py 30 Dec 2002 22:04:22 -0000 1.1 --- Containers_and_folders.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Earlier_terms.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Earlier_terms.py 30 Dec 2002 22:04:22 -0000 1.1 --- Earlier_terms.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Enumerations.py 30 Dec 2002 22:04:22 -0000 1.1 --- Enumerations.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Files_and_suitcases.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Files_and_suitcases.py 30 Dec 2002 22:04:22 -0000 1.1 --- Files_and_suitcases.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Finder_Basics.py 30 Dec 2002 22:04:22 -0000 1.1 --- Finder_Basics.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Finder_items.py 30 Dec 2002 22:04:22 -0000 1.1 --- Finder_items.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Obsolete_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Obsolete_terms.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Obsolete_terms.py 30 Dec 2002 22:04:22 -0000 1.1 --- Obsolete_terms.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Process_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Process_classes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Process_classes.py 30 Dec 2002 22:04:22 -0000 1.1 --- Process_classes.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Standard_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Type_Definitions.py 30 Dec 2002 22:04:22 -0000 1.1 --- Type_Definitions.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Window_classes.py 30 Dec 2002 22:04:22 -0000 1.1 --- Window_classes.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Dec 2002 22:04:22 -0000 1.1 --- __init__.py 23 Mar 2003 22:07:27 -0000 1.2 *************** *** 1,4 **** """ ! Package generated from /Volumes/Sap/System Folder/Finder Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from /Volumes/Moes/Systeemmap/Finder Resource aete resid 0 """ *************** *** 59,71 **** from Enumerations import * from Obsolete_terms import * def getbaseclasses(v): ! if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): v._propdict = {} v._elemdict = {} ! for superclass in v._superclassnames: ! v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) ! v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) ! v._propdict.update(v._privpropdict) ! v._elemdict.update(v._privelemdict) import StdSuites --- 59,74 ---- from Enumerations import * from Obsolete_terms import * + def getbaseclasses(v): ! if not getattr(v, '_propdict', None): v._propdict = {} v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites From jackjansen@users.sourceforge.net Sun Mar 23 22:07:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:07:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.1,1.2 Macintosh_Connectivity_Clas.py,1.1,1.2 QuickDraw_Graphics_Suite.py,1.1,1.2 QuickDraw_Graphics_Suppleme.py,1.1,1.2 Required_Suite.py,1.1,1.2 Standard_Suite.py,1.1,1.2 Table_Suite.py,1.1,1.2 Text_Suite.py,1.1,1.2 Type_Names_Suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv28308/StdSuites Modified Files: 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: Regenerated with Donovan Prestons patch #702620. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AppleScript_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- AppleScript_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Macintosh_Connectivity_Clas.py 30 Dec 2002 22:04:22 -0000 1.1 --- Macintosh_Connectivity_Clas.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QuickDraw_Graphics_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- QuickDraw_Graphics_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QuickDraw_Graphics_Suppleme.py 30 Dec 2002 22:04:22 -0000 1.1 --- QuickDraw_Graphics_Suppleme.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Required_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Required_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Standard_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Standard_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 126,130 **** Required argument: the object to close Keyword argument saving: specifies whether changes should be saved before closing ! Keyword argument saving_in: the file in which to save the object Keyword argument _attributes: AppleEvent attribute dictionary """ --- 126,130 ---- Required argument: the object to close Keyword argument saving: specifies whether changes should be saved before closing ! Keyword argument saving_in: the file or alias in which to save the object Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 305,309 **** """save: Save an object Required argument: the object to save, usually a document or window ! Keyword argument in_: the file in which to save the object Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary --- 305,309 ---- """save: Save an object Required argument: the object to save, usually a document or window ! Keyword argument in_: the file or alias in which to save the object Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 486,490 **** class file(aetools.ComponentItem): ! """file - a file on a disk or server (or a file yet to be created) """ want = 'file' class stationery(aetools.NProperty): --- 486,490 ---- class file(aetools.ComponentItem): ! """file - a file on a disk or server """ want = 'file' class stationery(aetools.NProperty): Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Table_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Table_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Text_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Type_Names_Suite.py 30 Dec 2002 22:04:22 -0000 1.1 --- Type_Names_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Dec 2002 22:04:22 -0000 1.1 --- __init__.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 1,4 **** """ ! Package generated from /Volumes/Sap/System Folder/Extensions/AppleScript Resource aeut resid 0 Standard Event Suites for English """ --- 1,4 ---- """ ! Package generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript Resource aeut resid 0 Standard Event Suites for English """ *************** *** 51,63 **** from Macintosh_Connectivity_Clas import * from Type_Names_Suite import * def getbaseclasses(v): ! if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): v._propdict = {} v._elemdict = {} ! for superclass in v._superclassnames: ! v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) ! v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) ! v._propdict.update(v._privpropdict) ! v._elemdict.update(v._privelemdict) import StdSuites --- 51,66 ---- from Macintosh_Connectivity_Clas import * from Type_Names_Suite import * + def getbaseclasses(v): ! if not getattr(v, '_propdict', None): v._propdict = {} v._elemdict = {} ! for superclassname in getattr(v, '_superclassnames', []): ! superclass = eval(superclassname) ! getbaseclasses(superclass) ! v._propdict.update(getattr(superclass, '_propdict', {})) ! v._elemdict.update(getattr(superclass, '_elemdict', {})) ! v._propdict.update(getattr(v, '_privpropdict', {})) ! v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites From jackjansen@users.sourceforge.net Sun Mar 23 22:07:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 23 Mar 2003 14:07:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Invisible_Suite.py,NONE,1.1 Terminal_Suite.py,1.1,1.2 __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv28308/Terminal Modified Files: Terminal_Suite.py __init__.py Added Files: Invisible_Suite.py Log Message: Regenerated with Donovan Prestons patch #702620. --- NEW FILE: Invisible_Suite.py --- """Suite Invisible Suite: Terms and Events for controlling the application Level 1, version 1 Generated from /Applications/Utilities/Terminal.app/Contents/Resources/Terminal.rsrc AETE/AEUT resource version 1/0, language 0, script 0 """ import aetools import MacOS _code = 'tpnm' from StdSuites.Type_Names_Suite import * class Invisible_Suite_Events(Type_Names_Suite_Events): pass class application(aetools.ComponentItem): """application - The application """ want = 'capp' class properties(aetools.NProperty): """properties - every property of the application """ which = 'pALL' want = 'reco' application._superclassnames = [] application._privpropdict = { 'properties' : properties, } application._privelemdict = { } # # Indices of types declared in this module # _classdeclarations = { 'capp' : application, } _propdeclarations = { 'pALL' : properties, } _compdeclarations = { } _enumdeclarations = { } Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 Dec 2002 22:04:22 -0000 1.1 --- Terminal_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 17,21 **** Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'core' _subcode = 'oapp' --- 17,21 ---- Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'aevt' _subcode = 'oapp' *************** *** 36,40 **** Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'core' _subcode = 'quit' --- 36,40 ---- Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'aevt' _subcode = 'quit' *************** *** 74,82 **** _argmap_do_script = { 'with_command' : 'cmnd', } ! def do_script(self, _no_object=None, _attributes={}, **_arguments): """do script: Run a UNIX shell script or command ! Keyword argument with_command: data to be passed to the Terminal application as the command line Keyword argument _attributes: AppleEvent attribute dictionary """ --- 74,85 ---- _argmap_do_script = { 'with_command' : 'cmnd', + 'in_' : 'kfil', } ! def do_script(self, _object, _attributes={}, **_arguments): """do script: Run a UNIX shell script or command ! Required argument: data to be passed to the Terminal application as the command line ! Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter ! Keyword argument in_: the window in which to execute the command Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 85,89 **** aetools.keysubst(_arguments, self._argmap_do_script) ! if _no_object != None: raise TypeError, 'No direct arg expected' --- 88,92 ---- aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object *************** *** 123,130 **** which = 'pidx' want = 'long' ! class visible(aetools.NProperty): ! """visible - Is the window visible? """ ! which = 'pvis' ! want = 'bool' class has_close_box(aetools.NProperty): """has close box - Does the window have a close box? """ --- 126,133 ---- which = 'pidx' want = 'long' ! class bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ ! which = 'pbnd' ! want = 'qdrt' class has_close_box(aetools.NProperty): """has close box - Does the window have a close box? """ *************** *** 139,142 **** --- 142,153 ---- which = 'isfl' want = 'bool' + class miniaturizable(aetools.NProperty): + """miniaturizable - Is the window miniaturizable? """ + which = 'ismn' + want = 'bool' + class miniaturized(aetools.NProperty): + """miniaturized - Is the window miniaturized? """ + which = 'pmnd' + want = 'bool' class modal(aetools.NProperty): """modal - Is the window modal? """ *************** *** 147,150 **** --- 158,165 ---- which = 'prsz' want = 'bool' + class visible(aetools.NProperty): + """visible - Is the window visible? """ + which = 'pvis' + want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 155,174 **** which = 'pzum' want = 'bool' - class miniaturizable(aetools.NProperty): - """miniaturizable - Is the window miniaturizable? """ - which = 'mini' - want = 'bool' - class miniaturized(aetools.NProperty): - """miniaturized - Is the window miniaturized? """ - which = 'mina' - want = 'bool' class position(aetools.NProperty): ! """position - the upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' class title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ --- 170,189 ---- which = 'pzum' want = 'bool' class position(aetools.NProperty): ! """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = 'QDpt' ! class origin(aetools.NProperty): ! """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ ! which = 'pori' ! want = 'list' ! class size(aetools.NProperty): ! """size - the width and height of the window """ ! which = 'psiz' ! want = 'list' ! class frame(aetools.NProperty): ! """frame - the origin and size of the window """ ! which = 'pfra' ! want = 'list' class title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ *************** *** 227,255 **** which = 'pbtc' want = 'TEXT' windows = window ! application._propdict = { 'name' : name, 'version' : version, 'frontmost' : frontmost, } ! application._elemdict = { 'window' : window, } ! window._propdict = { 'name' : name, 'index' : index, ! 'visible' : visible, 'has_close_box' : has_close_box, 'has_title_bar' : has_title_bar, 'floating' : floating, 'modal' : modal, 'resizable' : resizable, 'zoomable' : zoomable, 'zoomed' : zoomed, - 'miniaturizable' : miniaturizable, - 'miniaturized' : miniaturized, 'position' : position, ! 'bounds' : bounds, 'title_displays_device_name' : title_displays_device_name, 'title_displays_shell_path' : title_displays_shell_path, --- 242,283 ---- which = 'pbtc' want = 'TEXT' + class busy(aetools.NProperty): + """busy - Is the window busy running a process? """ + which = 'busy' + want = 'bool' + class processes(aetools.NProperty): + """processes - a list of the currently running processes """ + which = 'prcs' + want = 'list' windows = window ! application._superclassnames = [] ! application._privpropdict = { 'name' : name, 'version' : version, 'frontmost' : frontmost, } ! application._privelemdict = { 'window' : window, } ! window._superclassnames = [] ! window._privpropdict = { 'name' : name, 'index' : index, ! 'bounds' : bounds, 'has_close_box' : has_close_box, 'has_title_bar' : has_title_bar, 'floating' : floating, + 'miniaturizable' : miniaturizable, + 'miniaturized' : miniaturized, 'modal' : modal, 'resizable' : resizable, + 'visible' : visible, 'zoomable' : zoomable, 'zoomed' : zoomed, 'position' : position, ! 'origin' : origin, ! 'size' : size, ! 'frame' : frame, 'title_displays_device_name' : title_displays_device_name, 'title_displays_shell_path' : title_displays_shell_path, *************** *** 266,271 **** 'normal_text_color' : normal_text_color, 'bold_text_color' : bold_text_color, } ! window._elemdict = { } --- 294,302 ---- 'normal_text_color' : normal_text_color, 'bold_text_color' : bold_text_color, + 'busy' : busy, + 'processes' : processes, + 'frontmost' : frontmost, } ! window._privelemdict = { } *************** *** 279,311 **** _propdeclarations = { ! 'tdfn' : title_displays_file_name, ! 'mini' : miniaturizable, ! 'vers' : version, ! 'pidx' : index, 'prsz' : resizable, 'pbnd' : bounds, ! 'mina' : miniaturized, ! 'pbcl' : background_color, 'tddn' : title_displays_device_name, 'iszm' : zoomable, 'hclb' : has_close_box, 'isfl' : floating, ! 'pcnt' : contents, 'ppos' : position, 'ptxc' : normal_text_color, 'pcuc' : cursor_color, 'tdsp' : title_displays_shell_path, 'pvis' : visible, ! 'tdct' : title_displays_custom_title, 'pmod' : modal, 'titl' : custom_title, 'pisf' : frontmost, 'hist' : history, 'pzum' : zoomed, ! 'crow' : number_of_rows, 'pnam' : name, 'ccol' : number_of_columns, 'tdws' : title_displays_window_size, ! 'pbtc' : bold_text_color, 'ptit' : has_title_bar, } --- 310,347 ---- _propdeclarations = { ! 'pori' : origin, 'prsz' : resizable, + 'vers' : version, + 'prcs' : processes, + 'pbtc' : bold_text_color, 'pbnd' : bounds, ! 'crow' : number_of_rows, ! 'pcnt' : contents, 'tddn' : title_displays_device_name, 'iszm' : zoomable, 'hclb' : has_close_box, 'isfl' : floating, ! 'busy' : busy, ! 'pfra' : frame, 'ppos' : position, 'ptxc' : normal_text_color, + 'tdfn' : title_displays_file_name, 'pcuc' : cursor_color, 'tdsp' : title_displays_shell_path, 'pvis' : visible, ! 'pidx' : index, 'pmod' : modal, 'titl' : custom_title, 'pisf' : frontmost, + 'pmnd' : miniaturized, + 'tdct' : title_displays_custom_title, 'hist' : history, 'pzum' : zoomed, ! 'ismn' : miniaturizable, ! 'pbcl' : background_color, 'pnam' : name, 'ccol' : number_of_columns, 'tdws' : title_displays_window_size, ! 'psiz' : size, 'ptit' : has_title_bar, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 30 Dec 2002 22:04:22 -0000 1.1 --- __init__.py 23 Mar 2003 22:07:28 -0000 1.2 *************** *** 3,15 **** Resource aete resid 0 Terminal Terminology """ - # Note: hand-edited _signature to 'trmx'. - import aetools Error = aetools.Error import Terminal_Suite _code_to_module = { 'trmx' : Terminal_Suite, } --- 3,15 ---- Resource aete resid 0 Terminal Terminology """ import aetools Error = aetools.Error import Terminal_Suite + import Invisible_Suite _code_to_module = { 'trmx' : Terminal_Suite, + 'tpnm' : Invisible_Suite, } *************** *** 18,28 **** --- 18,143 ---- _code_to_fullname = { 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), + 'tpnm' : ('Terminal.Invisible_Suite', 'Invisible_Suite'), } from Terminal_Suite import * + from Invisible_Suite import * + + def getbaseclasses(v): + if not getattr(v, '_propdict', None): + v._propdict = {} + v._elemdict = {} + for superclassname in getattr(v, '_superclassnames', []): + superclass = eval(superclassname) + getbaseclasses(superclass) + v._propdict.update(getattr(superclass, '_propdict', {})) + v._elemdict.update(getattr(superclass, '_elemdict', {})) + v._propdict.update(getattr(v, '_privpropdict', {})) + v._elemdict.update(getattr(v, '_privelemdict', {})) + + import StdSuites + + # + # Set property and element dictionaries now that all classes have been defined + # + getbaseclasses(window) + getbaseclasses(application) + getbaseclasses(application) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.plain_text) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + + # + # Indices of types declared in this module + # + _classdeclarations = { + 'cwin' : window, + 'capp' : application, + 'capp' : application, + 'shor' : StdSuites.Type_Names_Suite.small_integer, + 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, + 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, + 'clrt' : StdSuites.Type_Names_Suite.color_table, + 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, + 'TEXT' : StdSuites.Type_Names_Suite.plain_text, + 'elin' : StdSuites.Type_Names_Suite.type_element_info, + 'insl' : StdSuites.Type_Names_Suite.location_reference, + 'vers' : StdSuites.Type_Names_Suite.version, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'cmen' : StdSuites.Type_Names_Suite.menu_item, + 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, + 'aete' : StdSuites.Type_Names_Suite.application_dictionary, + 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, + 'cmnu' : StdSuites.Type_Names_Suite.menu, + 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, + 'evin' : StdSuites.Type_Names_Suite.type_event_info, + 'sing' : StdSuites.Type_Names_Suite.small_real, + 'suin' : StdSuites.Type_Names_Suite.type_suite_info, + 'trot' : StdSuites.Type_Names_Suite.rotation, + 'fixd' : StdSuites.Type_Names_Suite.fixed, + 'styl' : StdSuites.Type_Names_Suite.scrap_styles, + 'lpnt' : StdSuites.Type_Names_Suite.long_point, + 'gcli' : StdSuites.Type_Names_Suite.type_class_info, + 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, + 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, + 'tdas' : StdSuites.Type_Names_Suite.dash_style, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, + 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, + 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, + 'exte' : StdSuites.Type_Names_Suite.extended_real, + 'comp' : StdSuites.Type_Names_Suite.double_integer, + 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, + 'null' : StdSuites.Type_Names_Suite.null, + 'targ' : StdSuites.Type_Names_Suite.target_id, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + } class Terminal(Terminal_Suite_Events, + Invisible_Suite_Events, aetools.TalkTo): _signature = 'trmx' + + _moduleName = 'Terminal' From tim.one@comcast.net Mon Mar 24 01:53:49 2003 From: tim.one@comcast.net (Tim Peters) Date: Sun, 23 Mar 2003 20:53:49 -0500 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.32,2.126.4.33 In-Reply-To: Message-ID: [nnorwitz@users.sourceforge.net] > Modified Files: > Tag: release22-maint > typeobject.c > Log Message: > Backport Tim's checkin 2.218: > slot_sq_contains(): This leaked a reference to the result of calling > __contains__(). Thanks, Neal! You beat me to it, and I'm grateful. From jackjansen@users.sourceforge.net Mon Mar 24 12:12:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 24 Mar 2003 04:12:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv30503 Modified Files: EasyDialogs.py Log Message: Allow floating point values in ProgressBar. Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/EasyDialogs.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EasyDialogs.py 3 Mar 2003 12:25:02 -0000 1.10 --- EasyDialogs.py 24 Mar 2003 12:12:24 -0000 1.11 *************** *** 291,294 **** --- 291,296 ---- value = int(value/(maxval/32767.0)) maxval = 32767 + maxval = int(maxval) + value = int(value) progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) From jackjansen@users.sourceforge.net Mon Mar 24 12:14:01 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 24 Mar 2003 04:14:01 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.701,1.702 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31055/Misc Modified Files: NEWS Log Message: Added a Mac note that EasyDialogs dialogs now bring the application to the foreground. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.701 retrieving revision 1.702 diff -C2 -d -r1.701 -r1.702 *** NEWS 20 Mar 2003 23:36:55 -0000 1.701 --- NEWS 24 Mar 2003 12:13:54 -0000 1.702 *************** *** 134,138 **** the window manager, false otherwise. ! - EasyDialogs dialogs are now movable-modal. --- 134,140 ---- the window manager, false otherwise. ! - EasyDialogs dialogs are now movable-modal, and if the application is ! currently in the background they will ask to be moved to the foreground ! before displaying. From tim_one@users.sourceforge.net Mon Mar 24 17:22:29 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 09:22:29 -0800 Subject: [Python-checkins] python/dist/src/Python compile.c,2.275,2.276 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5907/python/Python Modified Files: compile.c Log Message: symtable_cellvar_offsets(): This leaked references to little integers in normal cases, and also in error cases. Bugfix candidate. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.275 retrieving revision 2.276 diff -C2 -d -r2.275 -r2.276 *** compile.c 12 Feb 2003 16:56:51 -0000 2.275 --- compile.c 24 Mar 2003 17:22:24 -0000 2.276 *************** *** 4497,4501 **** PyObject *varnames, int flags) { ! PyObject *v, *w, *d, *list = NULL; int i, pos; --- 4497,4502 ---- PyObject *varnames, int flags) { ! PyObject *v = NULL; ! PyObject *w, *d, *list = NULL; int i, pos; *************** *** 4531,4534 **** --- 4532,4536 ---- if (PyDict_DelItem(*cellvars, PyList_GET_ITEM(list, i)) < 0) goto fail; + Py_DECREF(v); } pos = 0; *************** *** 4539,4542 **** --- 4541,4545 ---- if (PyDict_SetItem(d, v, w) < 0) { Py_DECREF(w); + v = NULL; goto fail; } *************** *** 4548,4551 **** --- 4551,4555 ---- fail: Py_DECREF(d); + Py_XDECREF(v); return -1; } From jhylton@users.sourceforge.net Mon Mar 24 21:23:31 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 24 Mar 2003 13:23:31 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.12,1.1.2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27835 Modified Files: Tag: ast-branch ast.c Log Message: Generate the appropriate BoolOp opcode. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -C2 -d -r1.1.2.12 -r1.1.2.13 *** ast.c 21 Oct 2002 21:45:45 -0000 1.1.2.12 --- ast.c 24 Mar 2003 21:23:27 -0000 1.1.2.13 *************** *** 687,691 **** asdl_seq_SET(seq, i / 2, e); } ! return BoolOp(Or, seq); break; case not_test: --- 687,696 ---- asdl_seq_SET(seq, i / 2, e); } ! if (strcmp(STR(CHILD(n, 1)), "and")) ! return BoolOp(Or, seq); ! else { ! assert(strcmp(STR(CHILD(n, 1)), "or")); ! return BoolOp(And, seq); ! } break; case not_test: From jhylton@users.sourceforge.net Mon Mar 24 21:36:54 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 24 Mar 2003 13:36:54 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.13,1.1.2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv15055 Modified Files: Tag: ast-branch ast.c Log Message: Use strcmp in a more straightforward way. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -C2 -d -r1.1.2.13 -r1.1.2.14 *** ast.c 24 Mar 2003 21:23:27 -0000 1.1.2.13 --- ast.c 24 Mar 2003 21:36:49 -0000 1.1.2.14 *************** *** 687,695 **** asdl_seq_SET(seq, i / 2, e); } ! if (strcmp(STR(CHILD(n, 1)), "and")) ! return BoolOp(Or, seq); ! else { ! assert(strcmp(STR(CHILD(n, 1)), "or")); return BoolOp(And, seq); } break; --- 687,695 ---- asdl_seq_SET(seq, i / 2, e); } ! if (!strcmp(STR(CHILD(n, 1)), "and")) return BoolOp(And, seq); + else { + assert(!strcmp(STR(CHILD(n, 1)), "or")); + return BoolOp(Or, seq); } break; From jhylton@users.sourceforge.net Mon Mar 24 22:57:50 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 24 Mar 2003 14:57:50 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.17,1.1.2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv14382 Modified Files: Tag: ast-branch newcompile.c Log Message: Several fixes to get function arguments working correctly. Set nameops using varnames instead of names. Initialize varnames from ste_varnames at the outset, so that all local variables have the correct offset. Initialize newly allocated memory when a block gets resized. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.17 retrieving revision 1.1.2.18 diff -C2 -d -r1.1.2.17 -r1.1.2.18 *** newcompile.c 17 Feb 2003 04:31:27 -0000 1.1.2.17 --- newcompile.c 24 Mar 2003 22:57:46 -0000 1.1.2.18 *************** *** 193,196 **** --- 193,219 ---- } + static PyObject * + list2dict(PyObject *list) + { + int i, n; + PyObject *v, *dict = PyDict_New(); + + n = PyList_Size(list); + for (i = 0; i < n; i++) { + v = PyInt_FromLong(i); + if (!v) { + Py_DECREF(dict); + return NULL; + } + if (PyDict_SetItem(dict, PyList_GET_ITEM(list, i), v) < 0) { + Py_DECREF(v); + Py_DECREF(dict); + return NULL; + } + Py_DECREF(v); + } + return dict; + } + static int compiler_enter_scope(struct compiler *c, identifier name, void *key) *************** *** 206,210 **** Py_INCREF(name); u->u_name = name; ! u->u_varnames = u->u_ste->ste_varnames; Py_INCREF(u->u_varnames); u->u_nblocks = 0; --- 229,233 ---- Py_INCREF(name); u->u_name = name; ! u->u_varnames = list2dict(u->u_ste->ste_varnames); Py_INCREF(u->u_varnames); u->u_nblocks = 0; *************** *** 378,389 **** if (b->b_iused == b->b_ialloc) { void *ptr; ! int newsize; ! b->b_ialloc *= 2; ! newsize = sizeof(struct basicblock) ! + ((b->b_ialloc - DEFAULT_BLOCK_SIZE) ! * sizeof(struct instr)); ptr = PyObject_Realloc((void *)b, newsize); if (ptr == NULL) return -1; if (ptr != (void *)b) { fprintf(stderr, "resize block %d\n", block); --- 401,419 ---- if (b->b_iused == b->b_ialloc) { void *ptr; ! int oldsize, newsize; ! oldsize = sizeof(struct basicblock); ! if (b->b_ialloc > DEFAULT_BLOCK_SIZE) ! oldsize += ((b->b_ialloc - DEFAULT_BLOCK_SIZE) ! * sizeof(struct instr)); ! newsize = oldsize + b->b_ialloc * sizeof(struct instr); ! if (newsize <= 0) { ! PyErr_NoMemory(); ! return 0; ! } ! b->b_ialloc <<= 1; ptr = PyObject_Realloc((void *)b, newsize); if (ptr == NULL) return -1; + memset(ptr + oldsize, 0, newsize - oldsize); if (ptr != (void *)b) { fprintf(stderr, "resize block %d\n", block); *************** *** 957,960 **** --- 987,992 ---- optype = OP_NAME; scope = PyST_GetScope(c->u->u_ste, name); + fprintf(stderr, "nameop name=%s scope=%d\n", + PyString_AS_STRING(name), scope); switch (scope) { case FREE: *************** *** 973,979 **** optype = OP_GLOBAL; break; - default: - assert(0); } switch (optype) { --- 1005,1011 ---- optype = OP_GLOBAL; break; } + if (optype == OP_DEREF) + abort(); switch (optype) { *************** *** 999,1002 **** --- 1031,1036 ---- assert(0); /* impossible */ } + ADDOP_O(c, op, name, varnames); + return 1; break; case OP_GLOBAL: *************** *** 1040,1048 **** int end, jumpi, i, n; asdl_seq *s; ! if (e->v.BoolOp.op == And) jumpi = JUMP_IF_FALSE; else jumpi = JUMP_IF_TRUE; end = compiler_new_block(c); if (end < 0) --- 1074,1085 ---- int end, jumpi, i, n; asdl_seq *s; ! ! assert(e->kind == BoolOp_kind); if (e->v.BoolOp.op == And) jumpi = JUMP_IF_FALSE; else jumpi = JUMP_IF_TRUE; + fprintf(stderr, "op = %d jump = %d\n", + e->v.BoolOp.op, jumpi); end = compiler_new_block(c); if (end < 0) *************** *** 1053,1057 **** VISIT(c, expr, asdl_seq_GET(s, i)); ADDOP_JREL(c, jumpi, end); - NEXT_BLOCK(c); ADDOP(c, POP_TOP) } --- 1090,1093 ---- *************** *** 1450,1454 **** if (!names) goto error; ! varnames = PySequence_Tuple(c->u->u_varnames); if (!varnames) goto error; --- 1486,1490 ---- if (!names) goto error; ! varnames = PySequence_Tuple(c->u->u_ste->ste_varnames); if (!varnames) goto error; From jhylton@users.sourceforge.net Mon Mar 24 22:59:08 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 24 Mar 2003 14:59:08 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.18,1.1.2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv16734 Modified Files: Tag: ast-branch newcompile.c Log Message: Remove some debugging prints. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -C2 -d -r1.1.2.18 -r1.1.2.19 *** newcompile.c 24 Mar 2003 22:57:46 -0000 1.1.2.18 --- newcompile.c 24 Mar 2003 22:59:04 -0000 1.1.2.19 *************** *** 987,992 **** optype = OP_NAME; scope = PyST_GetScope(c->u->u_ste, name); - fprintf(stderr, "nameop name=%s scope=%d\n", - PyString_AS_STRING(name), scope); switch (scope) { case FREE: --- 987,990 ---- *************** *** 1080,1085 **** else jumpi = JUMP_IF_TRUE; - fprintf(stderr, "op = %d jump = %d\n", - e->v.BoolOp.op, jumpi); end = compiler_new_block(c); if (end < 0) --- 1078,1081 ---- From nascheme@users.sourceforge.net Mon Mar 24 23:26:12 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:26:12 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.19,1.1.2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv17687 Modified Files: Tag: ast-branch newcompile.c Log Message: Implement code generation for assert statement (still need to check Py_Optimize flag). Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -C2 -d -r1.1.2.19 -r1.1.2.20 *** newcompile.c 24 Mar 2003 22:59:04 -0000 1.1.2.19 --- newcompile.c 24 Mar 2003 23:26:07 -0000 1.1.2.20 *************** *** 286,291 **** for (i = 0; i < u->u_nblocks; i++) { assert(u->u_blocks[i]); ! assert(u->u_blocks[i] != 0xcbcbcbcb); ! assert(u->u_blocks[i] != 0xfbfbfbfb); } } --- 286,291 ---- for (i = 0; i < u->u_nblocks; i++) { assert(u->u_blocks[i]); ! assert(u->u_blocks[i] != (void *)0xcbcbcbcb); ! assert(u->u_blocks[i] != (void *)0xfbfbfbfb); } } *************** *** 809,812 **** --- 809,841 ---- static int + compiler_assert(struct compiler *c, stmt_ty s) + { + static PyObject *assertion_error = NULL; + int end; + + if (assertion_error == NULL) { + assertion_error = PyString_FromString("AssertionError"); + if (assertion_error == NULL) + return 0; + } + VISIT(c, expr, s->v.Assert.test); + end = compiler_new_block(c); + if (end < 0) + return 0; + ADDOP_JREL(c, JUMP_IF_TRUE, end); + ADDOP_O(c, LOAD_GLOBAL, assertion_error, names); + if (s->v.Assert.msg) { + VISIT(c, expr, s->v.Assert.msg); + ADDOP_I(c, RAISE_VARARGS, 2); + } + else { + ADDOP_I(c, RAISE_VARARGS, 1); + } + compiler_use_block(c, end); + return 1; + } + + + static int compiler_visit_stmt(struct compiler *c, stmt_ty s) { *************** *** 881,885 **** break; case Assert_kind: ! break; case Import_kind: break; --- 910,914 ---- break; case Assert_kind: ! return compiler_assert(c, s); case Import_kind: break; From nascheme@users.sourceforge.net Mon Mar 24 23:29:27 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:29:27 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.20,1.1.2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20816 Modified Files: Tag: ast-branch newcompile.c Log Message: Don't generate code for asserts if Py_OptimizeFlag is true. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.20 retrieving revision 1.1.2.21 diff -C2 -d -r1.1.2.20 -r1.1.2.21 *** newcompile.c 24 Mar 2003 23:26:07 -0000 1.1.2.20 --- newcompile.c 24 Mar 2003 23:29:23 -0000 1.1.2.21 *************** *** 814,817 **** --- 814,819 ---- int end; + if (Py_OptimizeFlag) + return 0; if (assertion_error == NULL) { assertion_error = PyString_FromString("AssertionError"); From tim_one@users.sourceforge.net Mon Mar 24 23:37:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:37:49 -0800 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp,1.37,1.37.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv28236/PCbuild Modified Files: Tag: ast-branch pythoncore.dsp Log Message: Sundry changes to get this branch closer to working on Windows. Worst hack so far is taking _hotshot out of the compile; unclear why(!) the compiler hates _hotshot.c on this branch. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.37 retrieving revision 1.37.2.1 diff -C2 -d -r1.37 -r1.37.2.1 *** pythoncore.dsp 16 Jun 2002 01:34:49 -0000 1.37 --- pythoncore.dsp 24 Mar 2003 23:37:45 -0000 1.37.2.1 *************** *** 451,469 **** # Begin Source File - SOURCE=..\Python\compile.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\complexobject.c --- 451,454 ---- *************** *** 1240,1243 **** --- 1225,1243 ---- SOURCE=..\Python\mystrtoul.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=..\Python\newcompile.c !IF "$(CFG)" == "pythoncore - Win32 Release" From tim_one@users.sourceforge.net Mon Mar 24 23:37:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:37:50 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.21,1.1.2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28236/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Sundry changes to get this branch closer to working on Windows. Worst hack so far is taking _hotshot out of the compile; unclear why(!) the compiler hates _hotshot.c on this branch. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.21 retrieving revision 1.1.2.22 diff -C2 -d -r1.1.2.21 -r1.1.2.22 *** newcompile.c 24 Mar 2003 23:29:23 -0000 1.1.2.21 --- newcompile.c 24 Mar 2003 23:37:46 -0000 1.1.2.22 *************** *** 89,93 **** static PyCodeObject *assemble(struct compiler *); ! static char *opnames[]; #define IS_JUMP(I) ((I)->i_jrel || (I)->i_jabs) --- 89,93 ---- static PyCodeObject *assemble(struct compiler *); ! static char *opnames[144]; #define IS_JUMP(I) ((I)->i_jrel || (I)->i_jabs) *************** *** 415,419 **** if (ptr == NULL) return -1; ! memset(ptr + oldsize, 0, newsize - oldsize); if (ptr != (void *)b) { fprintf(stderr, "resize block %d\n", block); --- 415,419 ---- if (ptr == NULL) return -1; ! memset((char *)ptr + oldsize, 0, newsize - oldsize); if (ptr != (void *)b) { fprintf(stderr, "resize block %d\n", block); *************** *** 1136,1141 **** ADDOP(c, DUP_TOP); ADDOP(c, ROT_THREE); ADDOP_I(c, COMPARE_OP, ! asdl_seq_GET(e->v.Compare.ops, i - 1)); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); --- 1136,1142 ---- ADDOP(c, DUP_TOP); ADDOP(c, ROT_THREE); + /* XXX We're casting a void* to an int in the next stmt -- bad */ ADDOP_I(c, COMPARE_OP, ! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1)); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); From tim_one@users.sourceforge.net Mon Mar 24 23:38:17 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:38:17 -0800 Subject: [Python-checkins] python/dist/src/Include asdl.h,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28236/Include Modified Files: Tag: ast-branch asdl.h Log Message: Sundry changes to get this branch closer to working on Windows. Worst hack so far is taking _hotshot out of the compile; unclear why(!) the compiler hates _hotshot.c on this branch. Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/asdl.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** asdl.h 30 Sep 2002 18:22:58 -0000 1.1.2.3 --- asdl.h 24 Mar 2003 23:37:43 -0000 1.1.2.4 *************** *** 6,10 **** typedef PyObject * object; ! #include /* It would be nice if the code generated by asdl_c.py was completely --- 6,10 ---- typedef PyObject * object; ! typedef enum {false, true} bool; /* It would be nice if the code generated by asdl_c.py was completely From jhylton@users.sourceforge.net Mon Mar 24 23:42:02 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:42:02 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.22,1.1.2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv1117 Modified Files: Tag: ast-branch newcompile.c Log Message: Add code generation for string constants. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.22 retrieving revision 1.1.2.23 diff -C2 -d -r1.1.2.22 -r1.1.2.23 *** newcompile.c 24 Mar 2003 23:37:46 -0000 1.1.2.22 --- newcompile.c 24 Mar 2003 23:41:57 -0000 1.1.2.23 *************** *** 1215,1218 **** --- 1215,1219 ---- break; case Str_kind: + ADDOP_O(c, LOAD_CONST, e->v.Str.s, consts); break; /* The following exprs can be assignment targets. */ From tim_one@users.sourceforge.net Mon Mar 24 23:44:22 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:44:22 -0800 Subject: [Python-checkins] python/dist/src/Include compile.h,2.37.2.4,2.37.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv2961/Include Modified Files: Tag: ast-branch compile.h Log Message: Redeclared stuff to stop wngs about signed-vs-unsigned mismatches. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37.2.4 retrieving revision 2.37.2.5 diff -C2 -d -r2.37.2.4 -r2.37.2.5 *** compile.h 21 Oct 2002 21:26:20 -0000 2.37.2.4 --- compile.h 24 Mar 2003 23:44:18 -0000 2.37.2.5 *************** *** 39,44 **** struct basicblock { ! size_t b_iused; ! size_t b_ialloc; /* If b_next is non-zero, it is the block id of the next block reached by normal control flow. --- 39,44 ---- struct basicblock { ! int b_iused; ! int b_ialloc; /* If b_next is non-zero, it is the block id of the next block reached by normal control flow. From tim_one@users.sourceforge.net Mon Mar 24 23:44:24 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:44:24 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.23,1.1.2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2961/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Redeclared stuff to stop wngs about signed-vs-unsigned mismatches. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -C2 -d -r1.1.2.23 -r1.1.2.24 *** newcompile.c 24 Mar 2003 23:41:57 -0000 1.1.2.23 --- newcompile.c 24 Mar 2003 23:44:19 -0000 1.1.2.24 *************** *** 1390,1394 **** blocksize(struct basicblock *b) { ! int i, size = 0; for (i = 0; i < b->b_iused; i++) --- 1390,1395 ---- blocksize(struct basicblock *b) { ! int i; ! int size = 0; for (i = 0; i < b->b_iused; i++) *************** *** 1423,1427 **** a->a_offset += size; if (ext > 0) { ! *code++ = EXTENDED_ARG; *code++ = ext & 0xff; *code++ = ext >> 8; --- 1424,1428 ---- a->a_offset += size; if (ext > 0) { ! *code++ = (char)EXTENDED_ARG; *code++ = ext & 0xff; *code++ = ext >> 8; From gvanrossum@users.sourceforge.net Mon Mar 24 23:49:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:49:55 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.219,2.220 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8633 Modified Files: typeobject.c Log Message: Refactoring: rename update_these_slots() into update_subclasses() and generalize to take a callback function and a void * data argument. This might come in handy later... :-) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.219 retrieving revision 2.220 diff -C2 -d -r2.219 -r2.220 *** typeobject.c 23 Mar 2003 17:52:28 -0000 2.219 --- typeobject.c 24 Mar 2003 23:49:49 -0000 2.220 *************** *** 131,134 **** --- 131,140 ---- static void update_all_slots(PyTypeObject *); + typedef int (*update_callback)(PyTypeObject *, void *); + static int update_subclasses(PyTypeObject *type, PyObject *name, + update_callback callback, void *data); + static int recurse_down_subclasses(PyTypeObject *type, PyObject *name, + update_callback callback, void *data); + static int mro_subclasses(PyTypeObject *type, PyObject* temp) *************** *** 2032,2035 **** --- 2038,2045 ---- return -1; } + /* XXX Example of how I expect this to be used... + if (update_subclasses(type, name, invalidate_cache, NULL) < 0) + return -1; + */ if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) return -1; *************** *** 4994,4998 **** } ! /* 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 --- 5004,5008 ---- } ! /* Common code for update_slots_callback() 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 *************** *** 5069,5117 **** } ! static 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) { ! 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) - { - PyTypeObject *subclass; - PyObject *ref, *subclasses, *dict; - int i, n; - - subclasses = type->tp_subclasses; - if (subclasses == NULL) - return 0; - assert(PyList_Check(subclasses)); - n = PyList_GET_SIZE(subclasses); - for (i = 0; i < n; i++) { - ref = PyList_GET_ITEM(subclasses, i); - assert(PyWeakref_CheckRef(ref)); - subclass = (PyTypeObject *)PyWeakref_GET_OBJECT(ref); - assert(subclass != NULL); - if ((PyObject *)subclass == Py_None) - continue; - assert(PyType_Check(subclass)); - /* Avoid recursing down into unaffected classes */ - dict = subclass->tp_dict; - if (dict != NULL && PyDict_Check(dict) && - PyDict_GetItem(dict, name) != NULL) - continue; - if (update_these_slots(subclass, pp, name) < 0) - return -1; - } return 0; } --- 5079,5091 ---- } ! /* In the type, update the slots whose slotdefs are gathered in the pp array. ! This is a callback for update_subclasses(). */ static int ! update_slots_callback(PyTypeObject *type, void *data) { ! slotdef **pp = (slotdef **)data; ! for (; *pp; pp++) update_one_slot(type, *pp); return 0; } *************** *** 5176,5180 **** if (ptrs[0] == NULL) return 0; /* Not an attribute that affects any slots */ ! return update_these_slots(type, ptrs, name); } --- 5150,5155 ---- if (ptrs[0] == NULL) return 0; /* Not an attribute that affects any slots */ ! return update_subclasses(type, name, ! update_slots_callback, (void *)ptrs); } *************** *** 5204,5207 **** --- 5179,5227 ---- } + /* recurse_down_subclasses() and update_subclasses() are mutually + recursive functions to call a callback for all subclasses, + but refraining from recursing into subclasses that define 'name'. */ + + static int + update_subclasses(PyTypeObject *type, PyObject *name, + update_callback callback, void *data) + { + if (callback(type, data) < 0) + return -1; + return recurse_down_subclasses(type, name, callback, data); + } + + static int + recurse_down_subclasses(PyTypeObject *type, PyObject *name, + update_callback callback, void *data) + { + PyTypeObject *subclass; + PyObject *ref, *subclasses, *dict; + int i, n; + + subclasses = type->tp_subclasses; + if (subclasses == NULL) + return 0; + assert(PyList_Check(subclasses)); + n = PyList_GET_SIZE(subclasses); + for (i = 0; i < n; i++) { + ref = PyList_GET_ITEM(subclasses, i); + assert(PyWeakref_CheckRef(ref)); + subclass = (PyTypeObject *)PyWeakref_GET_OBJECT(ref); + assert(subclass != NULL); + if ((PyObject *)subclass == Py_None) + continue; + assert(PyType_Check(subclass)); + /* Avoid recursing down into unaffected classes */ + dict = subclass->tp_dict; + if (dict != NULL && PyDict_Check(dict) && + PyDict_GetItem(dict, name) != NULL) + continue; + if (update_subclasses(subclass, name, callback, data) < 0) + return -1; + } + return 0; + } + /* This function is called by PyType_Ready() to populate the type's dictionary with method descriptors for function slots. For each *************** *** 5217,5224 **** slotdef entries are sorted by the offset of the slot in the PyHeapTypeObject, this gives us some control over disambiguating ! between competing slots: the members of PyHeapTypeObject are listed from most ! general to least general, so the most general slot is preferred. In ! particular, because as_mapping comes before as_sequence, for a type ! that defines both mp_subscript and sq_item, mp_subscript wins. This only adds new descriptors and doesn't overwrite entries in --- 5237,5245 ---- slotdef entries are sorted by the offset of the slot in the PyHeapTypeObject, this gives us some control over disambiguating ! between competing slots: the members of PyHeapTypeObject are listed ! from most general to least general, so the most general slot is ! preferred. In particular, because as_mapping comes before as_sequence, ! for a type that defines both mp_subscript and sq_item, mp_subscript ! wins. This only adds new descriptors and doesn't overwrite entries in From tim_one@users.sourceforge.net Mon Mar 24 23:55:22 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 15:55:22 -0800 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.19,1.19.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv12248/Modules Modified Files: Tag: ast-branch _hotshot.c Log Message: Put _hotshot back into this branch, after fixing the compiler problem. The latter remains a mystery -- simply added an include of code.h before compile.h, like every module that imports compile.h does. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** _hotshot.c 30 Jun 2002 15:26:09 -0000 1.19 --- _hotshot.c 24 Mar 2003 23:55:19 -0000 1.19.2.1 *************** *** 4,7 **** --- 4,8 ---- #include "Python.h" + #include "code.h" #include "compile.h" #include "eval.h" From skip@pobox.com Tue Mar 25 00:02:21 2003 From: skip@pobox.com (Skip Montanaro) Date: Mon, 24 Mar 2003 18:02:21 -0600 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.20, 1.1.2.21 In-Reply-To: References: Message-ID: <15999.40077.517325.750015@montanaro.dyndns.org> nascheme> Modified Files: nascheme> Tag: ast-branch nascheme> newcompile.c nascheme> Log Message: nascheme> Don't generate code for asserts if Py_OptimizeFlag is true. ... nascheme> Index: newcompile.c nascheme> RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v ... Something doesn't look right. Why are you operating on a file in the Attic? Doesn't its presence there imply it was "cvs remove"d at one point? Maybe I've just never noticed it before. Skip From tim_one@users.sourceforge.net Tue Mar 25 00:06:44 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 24 Mar 2003 16:06:44 -0800 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp,1.37.2.1,1.37.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv16597/PCbuild Modified Files: Tag: ast-branch pythoncore.dsp Log Message: Forgot to check in this part of the _hotshot repair. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.37.2.1 retrieving revision 1.37.2.2 diff -C2 -d -r1.37.2.1 -r1.37.2.2 *** pythoncore.dsp 24 Mar 2003 23:37:45 -0000 1.37.2.1 --- pythoncore.dsp 25 Mar 2003 00:06:36 -0000 1.37.2.2 *************** *** 271,274 **** --- 271,304 ---- # Begin Source File + SOURCE=..\Python\asdl.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=..\Python\ast.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\audioop.c *************** *** 451,454 **** --- 481,499 ---- # Begin Source File + SOURCE=..\Objects\codeobject.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\complexobject.c *************** *** 1405,1408 **** --- 1450,1468 ---- SOURCE=..\Python\pystate.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="..\Python\Python-ast.c" !IF "$(CFG)" == "pythoncore - Win32 Release" From tim.one@comcast.net Tue Mar 25 00:09:38 2003 From: tim.one@comcast.net (Tim Peters) Date: Mon, 24 Mar 2003 19:09:38 -0500 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.20, 1.1.2.21 In-Reply-To: <15999.40077.517325.750015@montanaro.dyndns.org> Message-ID: [Skip Montanaro] > nascheme> Modified Files: > nascheme> Tag: ast-branch > nascheme> newcompile.c > nascheme> Log Message: > nascheme> Don't generate code for asserts if Py_OptimizeFlag is true. > ... > nascheme> Index: newcompile.c > nascheme> RCS file: > /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v > ... > > Something doesn't look right. Why are you operating on a file in > the Attic? > Doesn't its presence there imply it was "cvs remove"d at one point? > Maybe I've just never noticed it before. We're working on a branch. Files that are brand new on a branch also live in the Attic. Don't blame me -- I think Neil designed CVS . From jeremy@alum.mit.edu Tue Mar 25 03:42:42 2003 From: jeremy@alum.mit.edu (Jeremy Hylton) Date: 24 Mar 2003 22:42:42 -0500 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.20,1.1.2.21 In-Reply-To: References: Message-ID: <1048563761.22335.6.camel@localhost.localdomain> On Mon, 2003-03-24 at 18:29, nascheme@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Python > In directory sc8-pr-cvs1:/tmp/cvs-serv20816 > > Modified Files: > Tag: ast-branch > newcompile.c > Log Message: > Don't generate code for asserts if Py_OptimizeFlag is true. > + if (Py_OptimizeFlag) > + return 0; > if (assertion_error == NULL) { > assertion_error = PyString_FromString("AssertionError"); I think that should be return 1. A return 0 indicates that an error has occurred and compilation should stop. Jeremy From jhylton@users.sourceforge.net Tue Mar 25 03:38:13 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 24 Mar 2003 19:38:13 -0800 Subject: [Python-checkins] python/dist/src/Python compile.txt,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22097 Modified Files: Tag: ast-branch compile.txt Log Message: Add a few more notes about what should be in the code gen section. Index: compile.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/compile.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** compile.txt 18 Feb 2003 13:24:25 -0000 1.1.2.1 --- compile.txt 25 Mar 2003 03:38:11 -0000 1.1.2.2 *************** *** 93,96 **** --- 93,130 ---- and the helper functions and macros. + - for each ast type (mod, stmt, expr, ...) define function with a + switch statement. inline code generation for simple things, + call function compiler_xxx where xxx is kind name for others. + + - use VISIT macro to invoke compiler_visit_XXX + + - user VISIT_SEQ macro to invoke compiler_visit_XXX for a sequence + of type XXX + + - all functions return true on success, false on failure + + - code generator uses basic blocks + + - each block has single entry point + - possibly multiple exit points + - when generating jumps, always jump to a block + - for code unit, blocks identified by int id + + - NEW_BLOCK() -- create block and set it as current + - NEXT_BLOCK() -- NEW_BLOCK() plus jump from current block + - compiler_new_block() -- create a block but don't use it + (used for generating jumps) + + - code generated with ADDOP macros add opcode to current block + ADDOP() -- opcode with no arguments + ADDOP_O() -- oparg is a PyObject * + ADDOP_I() -- oparg is a number + ADDOP_JABS() -- oparg is an absolute jump to block id + ADDOP_JREL() -- oparg is a relative jump to block id + XXX no need for JABS() and JREL(), always computed at the + end from block id + + - symbol table pass and compiler_nameop() + Code Objects ------------ From jackjansen@users.sourceforge.net Tue Mar 25 10:20:58 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 25 Mar 2003 02:20:58 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist makedmg,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv10448/Mac/OSX/Dist Modified Files: makedmg Log Message: Frank Vercruesse gave an okay on removing the copyright notice: "Hereby I make the script in question available under the terms and conditions of the latest Python License." Index: makedmg =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/makedmg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** makedmg 21 Mar 2003 23:52:36 -0000 1.1 --- makedmg 25 Mar 2003 10:20:55 -0000 1.2 *************** *** 5,9 **** # usage: makedmg src dst name # ! # (C)opyright 2002 Frank Vercruesse --- 5,9 ---- # usage: makedmg src dst name # ! # Donated by Frank Vercruesse From jackjansen@users.sourceforge.net Tue Mar 25 10:20:58 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 25 Mar 2003 02:20:58 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.231,1.232 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv10448/Misc Modified Files: ACKS Log Message: Frank Vercruesse gave an okay on removing the copyright notice: "Hereby I make the script in question available under the terms and conditions of the latest Python License." Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.231 retrieving revision 1.232 diff -C2 -d -r1.231 -r1.232 *** ACKS 20 Mar 2003 23:41:03 -0000 1.231 --- ACKS 25 Mar 2003 10:20:54 -0000 1.232 *************** *** 546,549 **** --- 546,550 ---- Doobee R. Tzeck Lionel Ulmer + Frank Vercruesse Jaap Vermeulen Al Vezza From tim_one@users.sourceforge.net Tue Mar 25 15:25:39 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 07:25:39 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.24,1.1.2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv10490/Python Modified Files: Tag: ast-branch newcompile.c Log Message: compiler_compare(): assert that at least one comparison operator exists. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.24 retrieving revision 1.1.2.25 diff -C2 -d -r1.1.2.24 -r1.1.2.25 *** newcompile.c 24 Mar 2003 23:44:19 -0000 1.1.2.24 --- newcompile.c 25 Mar 2003 15:25:35 -0000 1.1.2.25 *************** *** 1131,1134 **** --- 1131,1135 ---- VISIT(c, expr, e->v.Compare.left); n = asdl_seq_LEN(e->v.Compare.ops); + assert(n > 0); if (n > 1) cleanup = compiler_new_block(c); *************** *** 1143,1151 **** ADDOP(c, POP_TOP); } ! if (n) { ! VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); ! ADDOP_I(c, COMPARE_OP, ! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, n - 1)); ! } if (n > 1) { int end = compiler_new_block(c); --- 1144,1150 ---- ADDOP(c, POP_TOP); } ! VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); ! ADDOP_I(c, COMPARE_OP, ! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, n - 1)); if (n > 1) { int end = compiler_new_block(c); From nascheme@users.sourceforge.net Tue Mar 25 15:45:00 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Tue, 25 Mar 2003 07:45:00 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.25,1.1.2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24810 Modified Files: Tag: ast-branch newcompile.c Log Message: Fix return value (although it doesn't seem to be checked). Add skeleton function to generate code for AugAssign_kind nodes. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.25 retrieving revision 1.1.2.26 diff -C2 -d -r1.1.2.25 -r1.1.2.26 *** newcompile.c 25 Mar 2003 15:25:35 -0000 1.1.2.25 --- newcompile.c 25 Mar 2003 15:44:55 -0000 1.1.2.26 *************** *** 815,819 **** if (Py_OptimizeFlag) ! return 0; if (assertion_error == NULL) { assertion_error = PyString_FromString("AssertionError"); --- 815,819 ---- if (Py_OptimizeFlag) ! return 1; if (assertion_error == NULL) { assertion_error = PyString_FromString("AssertionError"); *************** *** 838,841 **** --- 838,848 ---- } + static int + compiler_augassign(struct compiler *c, stmt_ty s) + { + /* XXX unfinished */ + return 0; + } + static int *************** *** 878,882 **** break; case AugAssign_kind: ! break; case Print_kind: return compiler_print(c, s); --- 885,889 ---- break; case AugAssign_kind: ! return compiler_augassign(c, s); case Print_kind: return compiler_print(c, s); From jhylton@users.sourceforge.net Tue Mar 25 15:53:04 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 07:53:04 -0800 Subject: [Python-checkins] python/dist/src/Include Python-ast.h,1.1.2.5,1.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv30165/Include Modified Files: Tag: ast-branch Python-ast.h Log Message: Change expr context to have AugLoad and AugStore. Index: Python-ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/Python-ast.h,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** Python-ast.h 2 Oct 2002 11:48:43 -0000 1.1.2.5 --- Python-ast.h 25 Mar 2003 15:53:01 -0000 1.1.2.6 *************** *** 1,3 **** ! /* File automatically generated by ../Parser/asdl_c.py */ #include "asdl.h" --- 1,3 ---- ! /* File automatically generated by Parser/asdl_c.py */ #include "asdl.h" *************** *** 9,14 **** typedef struct _expr *expr_ty; ! typedef enum _expr_context { Load=1, Store=2, Del=3, AugStore=4, Param=5 } ! expr_context_ty; typedef struct _slice *slice_ty; --- 9,14 ---- typedef struct _expr *expr_ty; ! typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, ! Param=6 } expr_context_ty; typedef struct _slice *slice_ty; From jhylton@users.sourceforge.net Tue Mar 25 15:53:06 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 07:53:06 -0800 Subject: [Python-checkins] python/dist/src/Python Python-ast.c,1.1.2.5,1.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv30165/Python Modified Files: Tag: ast-branch Python-ast.c Log Message: Change expr context to have AugLoad and AugStore. Index: Python-ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/Python-ast.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** Python-ast.c 2 Oct 2002 11:48:44 -0000 1.1.2.5 --- Python-ast.c 25 Mar 2003 15:53:03 -0000 1.1.2.6 *************** *** 1,3 **** ! /* File automatically generated by ../Parser/asdl_c.py */ #include "Python.h" --- 1,3 ---- ! /* File automatically generated by Parser/asdl_c.py */ #include "Python.h" *************** *** 1505,1513 **** marshal_write_int(buf, off, 3); break; ! case AugStore: marshal_write_int(buf, off, 4); break; ! case Param: marshal_write_int(buf, off, 5); break; } --- 1505,1516 ---- marshal_write_int(buf, off, 3); break; ! case AugLoad: marshal_write_int(buf, off, 4); break; ! case AugStore: marshal_write_int(buf, off, 5); + break; + case Param: + marshal_write_int(buf, off, 6); break; } From jhylton@users.sourceforge.net Tue Mar 25 15:53:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 07:53:05 -0800 Subject: [Python-checkins] python/dist/src/Parser Python.asdl,1.1.2.5,1.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv30165/Parser Modified Files: Tag: ast-branch Python.asdl Log Message: Change expr context to have AugLoad and AugStore. Index: Python.asdl =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/Python.asdl,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** Python.asdl 2 Oct 2002 11:47:54 -0000 1.1.2.5 --- Python.asdl 25 Mar 2003 15:53:02 -0000 1.1.2.6 *************** *** 71,75 **** | Tuple(expr *elts, expr_context ctx) ! expr_context = Load | Store | Del | AugStore | Param slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step) --- 71,75 ---- | Tuple(expr *elts, expr_context ctx) ! expr_context = Load | Store | Del | AugLoad | AugStore | Param slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step) From jhylton@users.sourceforge.net Tue Mar 25 15:54:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 07:54:52 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.26,1.1.2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv31187/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Random motion towards augmented assignments. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.26 retrieving revision 1.1.2.27 diff -C2 -d -r1.1.2.26 -r1.1.2.27 *** newcompile.c 25 Mar 2003 15:44:55 -0000 1.1.2.26 --- newcompile.c 25 Mar 2003 15:54:45 -0000 1.1.2.27 *************** *** 82,85 **** --- 82,86 ---- static int compiler_visit_stmt(struct compiler *, stmt_ty); static int compiler_visit_expr(struct compiler *, expr_ty); + static int compiler_augassign(struct compiler *, stmt_ty); static int compiler_visit_slice(struct compiler *, slice_ty); *************** *** 87,90 **** --- 88,93 ---- static void compiler_pop_fblock(struct compiler *, enum fblocktype, int); + static int inplace_binop(struct compiler *, operator_ty); + static PyCodeObject *assemble(struct compiler *); *************** *** 886,889 **** --- 889,893 ---- case AugAssign_kind: return compiler_augassign(c, s); + break; case Print_kind: return compiler_print(c, s); *************** *** 1015,1018 **** --- 1019,1058 ---- } + static int + inplace_binop(struct compiler *c, operator_ty op) + { + switch (op) { + case Add: + return INPLACE_ADD; + case Sub: + return INPLACE_SUBTRACT; + case Mult: + return INPLACE_MULTIPLY; + case Div: + if (c->c_flags && c->c_flags->cf_flags & CO_FUTURE_DIVISION) + return INPLACE_TRUE_DIVIDE; + else + return INPLACE_DIVIDE; + case Mod: + return INPLACE_MODULO; + case Pow: + return INPLACE_POWER; + case LShift: + return INPLACE_LSHIFT; + case RShift: + return INPLACE_RSHIFT; + case BitOr: + return INPLACE_OR; + case BitXor: + return INPLACE_XOR; + case BitAnd: + return INPLACE_AND; + case FloorDiv: + return INPLACE_FLOOR_DIVIDE; + } + assert(0); + return 0; + } + static int compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx) *************** *** 1227,1233 **** --- 1267,1279 ---- VISIT(c, expr, e->v.Attribute.value); switch (e->v.Attribute.ctx) { + case AugLoad: + ADDOP(c, DUP_TOP); + /* Fall through to load */ case Load: ADDOP_O(c, LOAD_ATTR, e->v.Attribute.attr, names); break; + case AugStore: + ADDOP(c, ROT_TWO); + /* Fall through to save */ case Store: ADDOP_O(c, STORE_ATTR, e->v.Attribute.attr, names); *************** *** 1236,1242 **** ADDOP_O(c, DELETE_ATTR, e->v.Attribute.attr, names); break; - case AugStore: - /* XXX */ - break; case Param: assert(0); --- 1282,1285 ---- *************** *** 1260,1263 **** --- 1303,1340 ---- ADDOP_I(c, BUILD_TUPLE, asdl_seq_LEN(e->v.Tuple.elts)); break; + } + return 1; + } + + static int + compiler_augassign(struct compiler *c, stmt_ty s) + { + expr_ty e = s->v.AugAssign.target; + expr_ty auge; + + assert(s->kind == AugAssign_kind); + + switch (e->kind) { + case Attribute_kind: + auge = Attribute(e->v.Attribute.value, e->v.Attribute.attr, + AugLoad); + VISIT(c, expr, auge); + VISIT(c, expr, s->v.AugAssign.value); + ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); + auge->v.Attribute.ctx = AugStore; + VISIT(c, expr, auge); + free(auge); + break; + case Subscript_kind: + break; + case Name_kind: + VISIT(c, expr, s->v.AugAssign.target); + VISIT(c, expr, s->v.AugAssign.value); + ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); + return compiler_nameop(c, e->v.Name.id, Store); + break; + default: + fprintf(stderr, "invalid node type for augmented assignment\n"); + return 0; } return 1; From jhylton@users.sourceforge.net Tue Mar 25 16:17:12 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 08:17:12 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.27,1.1.2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv13002 Modified Files: Tag: ast-branch newcompile.c Log Message: Remove duplicate augassign. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.27 retrieving revision 1.1.2.28 diff -C2 -d -r1.1.2.27 -r1.1.2.28 *** newcompile.c 25 Mar 2003 15:54:45 -0000 1.1.2.27 --- newcompile.c 25 Mar 2003 16:17:04 -0000 1.1.2.28 *************** *** 842,853 **** static int - compiler_augassign(struct compiler *c, stmt_ty s) - { - /* XXX unfinished */ - return 0; - } - - - static int compiler_visit_stmt(struct compiler *c, stmt_ty s) { --- 842,845 ---- *************** *** 1090,1093 **** --- 1082,1086 ---- case Load: op = LOAD_DEREF; break; case Store: op = STORE_DEREF; break; + case AugLoad: case AugStore: break; *************** *** 1102,1105 **** --- 1095,1099 ---- case Store: op = STORE_FAST; break; case Del: op = DELETE_FAST; break; + case AugLoad: case AugStore: break; *************** *** 1115,1118 **** --- 1109,1113 ---- case Store: op = STORE_GLOBAL; break; case Del: op = DELETE_GLOBAL; break; + case AugLoad: case AugStore: break; *************** *** 1126,1129 **** --- 1121,1125 ---- case Store: op = STORE_NAME; break; case Del: op = DELETE_NAME; break; + case AugLoad: case AugStore: break; From tim_one@users.sourceforge.net Tue Mar 25 16:27:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 08:27:01 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.28,1.1.2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19075/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Trimmed trailing whitespace. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.28 retrieving revision 1.1.2.29 diff -C2 -d -r1.1.2.28 -r1.1.2.29 *** newcompile.c 25 Mar 2003 16:17:04 -0000 1.1.2.28 --- newcompile.c 25 Mar 2003 16:26:54 -0000 1.1.2.29 *************** *** 312,320 **** else c->u = NULL; ! return 1; /* XXX void? */ } ! /* Allocate a new block and return its index in c_blocks. Returns -1 on error. */ --- 312,320 ---- else c->u = NULL; ! return 1; /* XXX void? */ } ! /* Allocate a new block and return its index in c_blocks. Returns -1 on error. */ *************** *** 329,333 **** u = c->u; if (u->u_nblocks == u->u_nalloc) { ! int newsize = ((u->u_nalloc + u->u_nalloc) * sizeof(struct basicblock *)); u->u_blocks = (struct basicblock **)PyObject_Realloc( --- 329,333 ---- u = c->u; if (u->u_nblocks == u->u_nalloc) { ! int newsize = ((u->u_nalloc + u->u_nalloc) * sizeof(struct basicblock *)); u->u_blocks = (struct basicblock **)PyObject_Realloc( *************** *** 407,411 **** oldsize = sizeof(struct basicblock); if (b->b_ialloc > DEFAULT_BLOCK_SIZE) ! oldsize += ((b->b_ialloc - DEFAULT_BLOCK_SIZE) * sizeof(struct instr)); newsize = oldsize + b->b_ialloc * sizeof(struct instr); --- 407,411 ---- oldsize = sizeof(struct basicblock); if (b->b_ialloc > DEFAULT_BLOCK_SIZE) ! oldsize += ((b->b_ialloc - DEFAULT_BLOCK_SIZE) * sizeof(struct instr)); newsize = oldsize + b->b_ialloc * sizeof(struct instr); *************** *** 450,454 **** static int ! compiler_addop_o(struct compiler *c, int opcode, PyObject *dict, PyObject *o) { --- 450,454 ---- static int ! compiler_addop_o(struct compiler *c, int opcode, PyObject *dict, PyObject *o) { *************** *** 468,472 **** Py_DECREF(v); } ! else arg = PyInt_AsLong(v); return compiler_addop_i(c, opcode, arg); --- 468,472 ---- Py_DECREF(v); } ! else arg = PyInt_AsLong(v); return compiler_addop_i(c, opcode, arg); *************** *** 516,520 **** from the current block to the new block. */ ! #define NEW_BLOCK(C) { \ --- 516,520 ---- from the current block to the new block. */ ! #define NEW_BLOCK(C) { \ *************** *** 554,558 **** /* VISIT and VISIT_SEQ takes an ASDL type as their second argument. They use ! the ASDL name to synthesize the name of the C type and the visit function. */ --- 554,558 ---- /* VISIT and VISIT_SEQ takes an ASDL type as their second argument. They use ! the ASDL name to synthesize the name of the C type and the visit function. */ *************** *** 561,565 **** return 0; \ } ! #define VISIT_SEQ(C, TYPE, SEQ) { \ int i; \ --- 561,565 ---- return 0; \ } ! #define VISIT_SEQ(C, TYPE, SEQ) { \ int i; \ *************** *** 612,616 **** assert(s->kind == FunctionDef_kind); ! fprintf(stderr, "function %s\n", PyString_AS_STRING(s->v.FunctionDef.name)); --- 612,616 ---- assert(s->kind == FunctionDef_kind); ! fprintf(stderr, "function %s\n", PyString_AS_STRING(s->v.FunctionDef.name)); *************** *** 631,635 **** if (!compiler_nameop(c, s->v.FunctionDef.name, Store)) return 0; ! return 1; } --- 631,635 ---- if (!compiler_nameop(c, s->v.FunctionDef.name, Store)) return 0; ! return 1; } *************** *** 676,680 **** { int end, next, elif = 1; ! assert(s->kind == If_kind); end = compiler_new_block(c); --- 676,680 ---- { int end, next, elif = 1; ! assert(s->kind == If_kind); end = compiler_new_block(c); *************** *** 764,768 **** /* XXX should the two POP instructions be in a separate block ! if there is no else clause ? */ if (orelse == -1) --- 764,768 ---- /* XXX should the two POP instructions be in a separate block ! if there is no else clause ? */ if (orelse == -1) *************** *** 776,780 **** VISIT_SEQ(c, stmt, s->v.While.orelse); compiler_use_block(c, end); ! return 1; } --- 776,780 ---- VISIT_SEQ(c, stmt, s->v.While.orelse); compiler_use_block(c, end); ! return 1; } *************** *** 807,811 **** break; } ! return 1; } --- 807,811 ---- break; } ! return 1; } *************** *** 873,879 **** VISIT(c, expr, s->v.Assign.value); for (i = 0; i < n; i++) { ! if (i < n - 1) ADDOP(c, DUP_TOP); ! VISIT(c, expr, (expr_ty)asdl_seq_GET(s->v.Assign.targets, i)); } --- 873,879 ---- VISIT(c, expr, s->v.Assign.value); for (i = 0; i < n; i++) { ! if (i < n - 1) ADDOP(c, DUP_TOP); ! VISIT(c, expr, (expr_ty)asdl_seq_GET(s->v.Assign.targets, i)); } *************** *** 976,980 **** } ! static int binop(struct compiler *c, operator_ty op) { --- 976,980 ---- } ! static int binop(struct compiler *c, operator_ty op) { *************** *** 984,988 **** case Sub: return BINARY_SUBTRACT; ! case Mult: return BINARY_MULTIPLY; case Div: --- 984,988 ---- case Sub: return BINARY_SUBTRACT; ! case Mult: return BINARY_MULTIPLY; case Div: *************** *** 995,999 **** case Pow: return BINARY_POWER; ! case LShift: return BINARY_LSHIFT; case RShift: --- 995,999 ---- case Pow: return BINARY_POWER; ! case LShift: return BINARY_LSHIFT; case RShift: *************** *** 1001,1005 **** case BitOr: return BINARY_OR; ! case BitXor: return BINARY_XOR; case BitAnd: --- 1001,1005 ---- case BitOr: return BINARY_OR; ! case BitXor: return BINARY_XOR; case BitAnd: *************** *** 1011,1015 **** } ! static int inplace_binop(struct compiler *c, operator_ty op) { --- 1011,1015 ---- } ! static int inplace_binop(struct compiler *c, operator_ty op) { *************** *** 1019,1023 **** case Sub: return INPLACE_SUBTRACT; ! case Mult: return INPLACE_MULTIPLY; case Div: --- 1019,1023 ---- case Sub: return INPLACE_SUBTRACT; ! case Mult: return INPLACE_MULTIPLY; case Div: *************** *** 1030,1034 **** case Pow: return INPLACE_POWER; ! case LShift: return INPLACE_LSHIFT; case RShift: --- 1030,1034 ---- case Pow: return INPLACE_POWER; ! case LShift: return INPLACE_LSHIFT; case RShift: *************** *** 1036,1040 **** case BitOr: return INPLACE_OR; ! case BitXor: return INPLACE_XOR; case BitAnd: --- 1036,1040 ---- case BitOr: return INPLACE_OR; ! case BitXor: return INPLACE_XOR; case BitAnd: *************** *** 1129,1133 **** break; } ! assert(op); ADDOP_O(c, op, name, names); --- 1129,1133 ---- break; } ! assert(op); ADDOP_O(c, op, name, names); *************** *** 1181,1190 **** ADDOP(c, ROT_THREE); /* XXX We're casting a void* to an int in the next stmt -- bad */ ! ADDOP_I(c, COMPARE_OP, (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1)); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); ADDOP(c, POP_TOP); ! } VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); ADDOP_I(c, COMPARE_OP, --- 1181,1190 ---- ADDOP(c, ROT_THREE); /* XXX We're casting a void* to an int in the next stmt -- bad */ ! ADDOP_I(c, COMPARE_OP, (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1)); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); ADDOP(c, POP_TOP); ! } VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); ADDOP_I(c, COMPARE_OP, *************** *** 1199,1207 **** } return 1; ! } ! ! static int compiler_visit_expr(struct compiler *c, expr_ty e) { --- 1199,1207 ---- } return 1; ! } ! ! static int compiler_visit_expr(struct compiler *c, expr_ty e) { *************** *** 1209,1213 **** switch (e->kind) { ! case BoolOp_kind: return compiler_boolop(c, e); break; --- 1209,1213 ---- switch (e->kind) { ! case BoolOp_kind: return compiler_boolop(c, e); break; *************** *** 1253,1257 **** ADDOP(c, UNARY_CONVERT); break; ! case Num_kind: ADDOP_O(c, LOAD_CONST, e->v.Num.n, consts); break; --- 1253,1257 ---- ADDOP(c, UNARY_CONVERT); break; ! case Num_kind: ADDOP_O(c, LOAD_CONST, e->v.Num.n, consts); break; *************** *** 1287,1291 **** VISIT(c, slice, e->v.Subscript.slice); break; ! case Name_kind: return compiler_name(c, e); break; --- 1287,1291 ---- VISIT(c, slice, e->v.Subscript.slice); break; ! case Name_kind: return compiler_name(c, e); break; *************** *** 1303,1307 **** } ! static int compiler_augassign(struct compiler *c, stmt_ty s) { --- 1303,1307 ---- } ! static int compiler_augassign(struct compiler *c, stmt_ty s) { *************** *** 1337,1341 **** } ! static int compiler_push_fblock(struct compiler *c, enum fblocktype t, int b) { --- 1337,1341 ---- } ! static int compiler_push_fblock(struct compiler *c, enum fblocktype t, int b) { *************** *** 1374,1378 **** loc = Py_None; } ! u = Py_BuildValue("(ziOO)", c->c_filename, c->u->u_lineno, Py_None, loc); if (!u) --- 1374,1378 ---- loc = Py_None; } ! u = Py_BuildValue("(ziOO)", c->c_filename, c->u->u_lineno, Py_None, loc); if (!u) *************** *** 1497,1503 **** } code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; ! fprintf(stderr, "emit %3d %-15s %5d\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], i->i_oparg, a->a_offset, size, ext); a->a_offset += size; --- 1497,1503 ---- } code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; ! fprintf(stderr, "emit %3d %-15s %5d\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], i->i_oparg, a->a_offset, size, ext); a->a_offset += size; *************** *** 1555,1559 **** } } ! return 1; } --- 1555,1559 ---- } } ! return 1; } *************** *** 1601,1605 **** if (!filename) goto error; ! nlocals = PyList_GET_SIZE(c->u->u_varnames); co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), 0, --- 1601,1605 ---- if (!filename) goto error; ! nlocals = PyList_GET_SIZE(c->u->u_varnames); co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), 0, *************** *** 1607,1611 **** nil, nil, filename, c->u->u_name, ! 0, filename); /* XXX lnotab */ error: --- 1607,1611 ---- nil, nil, filename, c->u->u_name, ! 0, filename); /* XXX lnotab */ error: *************** *** 1616,1620 **** Py_XDECREF(name); return co; ! } --- 1616,1620 ---- Py_XDECREF(name); return co; ! } *************** *** 1626,1630 **** PyCodeObject *co = NULL; ! /* Make sure every block that falls off the end returns None. XXX NEXT_BLOCK() isn't quite right, because if the last block ends with a jump or return b_next shouldn't set. --- 1626,1630 ---- PyCodeObject *co = NULL; ! /* Make sure every block that falls off the end returns None. XXX NEXT_BLOCK() isn't quite right, because if the last block ends with a jump or return b_next shouldn't set. From jhylton@users.sourceforge.net Tue Mar 25 16:28:00 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 08:28:00 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.29,1.1.2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19828 Modified Files: Tag: ast-branch newcompile.c Log Message: Special-case AugStore, because we don't need to load the base value. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.29 retrieving revision 1.1.2.30 diff -C2 -d -r1.1.2.29 -r1.1.2.30 *** newcompile.c 25 Mar 2003 16:26:54 -0000 1.1.2.29 --- newcompile.c 25 Mar 2003 16:27:56 -0000 1.1.2.30 *************** *** 1261,1265 **** /* The following exprs can be assignment targets. */ case Attribute_kind: ! VISIT(c, expr, e->v.Attribute.value); switch (e->v.Attribute.ctx) { case AugLoad: --- 1261,1266 ---- /* The following exprs can be assignment targets. */ case Attribute_kind: ! if (e->v.Attribute.ctx != AugStore) ! VISIT(c, expr, e->v.Attribute.value); switch (e->v.Attribute.ctx) { case AugLoad: From tim_one@users.sourceforge.net Tue Mar 25 16:38:54 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 08:38:54 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.30,1.1.2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv25865/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Map from our internal codes for comparison operators to the codes used by ceval.h. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.30 retrieving revision 1.1.2.31 diff -C2 -d -r1.1.2.30 -r1.1.2.31 *** newcompile.c 25 Mar 2003 16:27:56 -0000 1.1.2.30 --- newcompile.c 25 Mar 2003 16:38:49 -0000 1.1.2.31 *************** *** 1012,1015 **** --- 1012,1043 ---- static int + cmpop(cmpop_ty op) + { + switch (op) { + case Eq: + return PyCmp_EQ; + case NotEq: + return PyCmp_NE; + case Lt: + return PyCmp_LT; + case LtE: + return PyCmp_LE; + case Gt: + return PyCmp_GT; + case GtE: + return PyCmp_GE; + case Is: + return PyCmp_IS; + case IsNot: + return PyCmp_IS_NOT; + case In: + return PyCmp_IN; + case NotIn: + return PyCmp_NOT_IN; + } + return PyCmp_BAD; + } + + static int inplace_binop(struct compiler *c, operator_ty op) { *************** *** 1180,1186 **** ADDOP(c, DUP_TOP); ADDOP(c, ROT_THREE); ! /* XXX We're casting a void* to an int in the next stmt -- bad */ ADDOP_I(c, COMPARE_OP, ! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1)); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); --- 1208,1214 ---- ADDOP(c, DUP_TOP); ADDOP(c, ROT_THREE); ! /* XXX We're casting a void* to cmpop_ty in the next stmt. */ ADDOP_I(c, COMPARE_OP, ! cmpop((cmpop_ty)asdl_seq_GET(e->v.Compare.ops, i - 1))); ADDOP_JREL(c, JUMP_IF_FALSE, cleanup); NEXT_BLOCK(c); *************** *** 1189,1193 **** VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); ADDOP_I(c, COMPARE_OP, ! (cmpop_ty)asdl_seq_GET(e->v.Compare.ops, n - 1)); if (n > 1) { int end = compiler_new_block(c); --- 1217,1222 ---- VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); ADDOP_I(c, COMPARE_OP, ! /* XXX We're casting a void* to cmpop_ty in the next stmt. */ ! cmpop((cmpop_ty)asdl_seq_GET(e->v.Compare.ops, n - 1))); if (n > 1) { int end = compiler_new_block(c); From twouters@users.sourceforge.net Tue Mar 25 18:50:28 2003 From: twouters@users.sourceforge.net (twouters@users.sourceforge.net) Date: Tue, 25 Mar 2003 10:50:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_commands.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30099/Lib/test Modified Files: test_commands.py Log Message: CommandTests.testgetoutput(): Make sure we aren't masking any errors raised in tempfile.mkdtemp() by referencing the (then) unbound local 'dir'. Index: test_commands.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_commands.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_commands.py 5 Dec 2002 20:18:39 -0000 1.9 --- test_commands.py 25 Mar 2003 18:50:19 -0000 1.10 *************** *** 28,31 **** --- 28,32 ---- # under our exclusive control; from that, we can invent a pathname # that we _know_ won't exist. This is guaranteed to fail. + dir = None try: dir = tempfile.mkdtemp() *************** *** 35,39 **** self.assertNotEquals(status, 0) finally: ! os.rmdir(dir) def test_getstatus(self): --- 36,41 ---- self.assertNotEquals(status, 0) finally: ! if dir is not None: ! os.rmdir(dir) def test_getstatus(self): From nnorwitz@users.sourceforge.net Tue Mar 25 18:51:05 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 25 Mar 2003 10:51:05 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.31,1.1.2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv31804/Python Modified Files: Tag: ast-branch newcompile.c Log Message: implement subscripts, augmented and regular Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.31 retrieving revision 1.1.2.32 diff -C2 -d -r1.1.2.31 -r1.1.2.32 *** newcompile.c 25 Mar 2003 16:38:49 -0000 1.1.2.31 --- newcompile.c 25 Mar 2003 18:51:00 -0000 1.1.2.32 *************** *** 1314,1319 **** break; case Subscript_kind: ! VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); break; case Name_kind: --- 1314,1347 ---- break; case Subscript_kind: ! switch (e->v.Subscript.ctx) { ! case AugLoad: ! VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP_I(c, DUP_TOPX, 2); ! ADDOP(c, BINARY_SUBSCR); ! break; ! case Load: ! VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP(c, BINARY_SUBSCR); ! break; ! case AugStore: ! ADDOP(c, ROT_THREE); ! ADDOP(c, STORE_SUBSCR); ! break; ! case Store: ! VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP(c, STORE_SUBSCR); ! break; ! case Del: ! VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP(c, DELETE_SUBSCR); ! break; ! case Param: ! assert(0); ! break; ! } break; case Name_kind: *************** *** 1353,1356 **** --- 1381,1392 ---- break; case Subscript_kind: + auge = Subscript(e->v.Subscript.value, e->v.Subscript.slice, + AugLoad); + VISIT(c, expr, auge); + VISIT(c, expr, s->v.AugAssign.value); + ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); + auge->v.Subscript.ctx = AugStore; + VISIT(c, expr, auge); + free(auge); break; case Name_kind: *************** *** 1422,1425 **** --- 1458,1472 ---- compiler_visit_slice(struct compiler *c, slice_ty s) { + switch (s->kind) { + case Ellipsis_kind: + break; + case Slice_kind: + break; + case ExtSlice_kind: + break; + case Index_kind: + VISIT(c, expr, s->v.Index.value); + break; + } return 1; } From tim_one@users.sourceforge.net Tue Mar 25 19:09:21 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 11:09:21 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.14,1.1.2.15 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5930/Python Modified Files: Tag: ast-branch ast.c Log Message: Copied a small mountain of code for parsing string literals from compile.c, and fiddled it just enough to compile in this new context. Nothing calls it yet. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -C2 -d -r1.1.2.14 -r1.1.2.15 *** ast.c 24 Mar 2003 21:36:49 -0000 1.1.2.14 --- ast.c 25 Mar 2003 19:09:16 -0000 1.1.2.15 *************** *** 26,30 **** static expr_ty ast_for_call(const node *, expr_ty); ! static PyObject *parsenumber(char *); extern grammar _PyParser_Grammar; /* From graminit.c */ --- 26,32 ---- static expr_ty ast_for_call(const node *, expr_ty); ! static PyObject *parsenumber(const char *); ! static PyObject *parsestr(const char *s); ! static PyObject *parsestrplus(node *n); extern grammar _PyParser_Grammar; /* From graminit.c */ *************** *** 1445,1451 **** static PyObject * ! parsenumber(char *s) { ! char *end; long x; double dx; --- 1447,1453 ---- static PyObject * ! parsenumber(const char *s) { ! const char *end; long x; double dx; *************** *** 1461,1472 **** #endif if (*end == 'l' || *end == 'L') ! return PyLong_FromString(s, (char **)0, 0); if (s[0] == '0') ! x = (long) PyOS_strtoul((char *)s, &end, 0); else ! x = PyOS_strtol(s, &end, 0); if (*end == '\0') { if (errno != 0) ! return PyLong_FromString(s, (char **)0, 0); return PyInt_FromLong(x); } --- 1463,1474 ---- #endif if (*end == 'l' || *end == 'L') ! return PyLong_FromString((char *)s, (char **)0, 0); if (s[0] == '0') ! x = (long) PyOS_strtoul((char *)s, (char **)&end, 0); else ! x = PyOS_strtol((char *)s, (char **)&end, 0); if (*end == '\0') { if (errno != 0) ! return PyLong_FromString((char *)s, (char **)0, 0); return PyInt_FromLong(x); } *************** *** 1488,1490 **** --- 1490,1675 ---- return PyFloat_FromDouble(dx); } + } + + static PyObject * + parsestr(const char *s) + { + PyObject *v; + size_t len; + char *buf; + char *p; + const char *end; + int c; + int first = *s; + int quote = first; + int rawmode = 0; + int unicode = 0; + + if (isalpha(quote) || quote == '_') { + if (quote == 'u' || quote == 'U') { + quote = *++s; + unicode = 1; + } + if (quote == 'r' || quote == 'R') { + quote = *++s; + rawmode = 1; + } + } + if (quote != '\'' && quote != '\"') { + PyErr_BadInternalCall(); + return NULL; + } + s++; + len = strlen(s); + if (len > INT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "string to parse is too long"); + return NULL; + } + if (s[--len] != quote) { + PyErr_BadInternalCall(); + return NULL; + } + if (len >= 4 && s[0] == quote && s[1] == quote) { + s += 2; + len -= 2; + if (s[--len] != quote || s[--len] != quote) { + PyErr_BadInternalCall(); + return NULL; + } + } + #ifdef Py_USING_UNICODE + if (unicode || Py_UnicodeFlag) { + if (rawmode) + v = PyUnicode_DecodeRawUnicodeEscape( + s, len, NULL); + else + v = PyUnicode_DecodeUnicodeEscape( + s, len, NULL); + return v; + + } + #endif + if (rawmode || strchr(s, '\\') == NULL) + return PyString_FromStringAndSize(s, len); + v = PyString_FromStringAndSize((char *)NULL, len); + if (v == NULL) + return NULL; + p = buf = PyString_AsString(v); + end = s + len; + while (s < end) { + if (*s != '\\') { + *p++ = *s++; + continue; + } + s++; + switch (*s++) { + /* XXX This assumes ASCII! */ + case '\n': break; + case '\\': *p++ = '\\'; break; + case '\'': *p++ = '\''; break; + case '\"': *p++ = '\"'; break; + case 'b': *p++ = '\b'; break; + case 'f': *p++ = '\014'; break; /* FF */ + case 't': *p++ = '\t'; break; + case 'n': *p++ = '\n'; break; + case 'r': *p++ = '\r'; break; + case 'v': *p++ = '\013'; break; /* VT */ + case 'a': *p++ = '\007'; break; /* BEL, not classic C */ + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = s[-1] - '0'; + if ('0' <= *s && *s <= '7') { + c = (c<<3) + *s++ - '0'; + if ('0' <= *s && *s <= '7') + c = (c<<3) + *s++ - '0'; + } + *p++ = c; + break; + case 'x': + if (isxdigit(Py_CHARMASK(s[0])) + && isxdigit(Py_CHARMASK(s[1]))) { + unsigned int x = 0; + c = Py_CHARMASK(*s); + s++; + if (isdigit(c)) + x = c - '0'; + else if (islower(c)) + x = 10 + c - 'a'; + else + x = 10 + c - 'A'; + x = x << 4; + c = Py_CHARMASK(*s); + s++; + if (isdigit(c)) + x += c - '0'; + else if (islower(c)) + x += 10 + c - 'a'; + else + x += 10 + c - 'A'; + *p++ = x; + break; + } + Py_DECREF(v); + PyErr_SetString(PyExc_ValueError, + "invalid \\x escape"); + return NULL; + #ifndef Py_USING_UNICODE + case 'u': + case 'U': + case 'N': + if (unicode) { + Py_DECREF(v); + com_error(com, PyExc_ValueError, + "Unicode escapes not legal " + "when Unicode disabled"); + return NULL; + } + #endif + default: + *p++ = '\\'; + *p++ = s[-1]; + break; + } + } + _PyString_Resize(&v, (int)(p - buf)); + return v; + } + + static PyObject * + parsestrplus(node *n) + { + PyObject *v; + int i; + REQ(CHILD(n, 0), STRING); + if ((v = parsestr(STR(CHILD(n, 0)))) != NULL) { + /* String literal concatenation */ + for (i = 1; i < NCH(n); i++) { + PyObject *s; + s = parsestr(STR(CHILD(n, i))); + if (s == NULL) + goto onError; + if (PyString_Check(v) && PyString_Check(s)) { + PyString_ConcatAndDel(&v, s); + if (v == NULL) + goto onError; + } + #ifdef Py_USING_UNICODE + else { + PyObject *temp; + temp = PyUnicode_Concat(v, s); + Py_DECREF(s); + if (temp == NULL) + goto onError; + Py_DECREF(v); + v = temp; + } + #endif + } + } + return v; + + onError: + Py_XDECREF(v); + return NULL; } From tim_one@users.sourceforge.net Tue Mar 25 19:24:46 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 11:24:46 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.15,1.1.2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv12526/Python Modified Files: Tag: ast-branch ast.c Log Message: Trimmed trailing whitespace; added a comment for parsestr(). Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -C2 -d -r1.1.2.15 -r1.1.2.16 *** ast.c 25 Mar 2003 19:09:16 -0000 1.1.2.15 --- ast.c 25 Mar 2003 19:24:42 -0000 1.1.2.16 *************** *** 36,44 **** Use this routine to determine how big a sequence is needed for the statements in a parse tree. Its raison d'etre is this bit of ! grammar: stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE ! A simple_stmt can contain multiple small_stmt elements joined by semicolons. If the arg is a simple_stmt, the number of --- 36,44 ---- Use this routine to determine how big a sequence is needed for the statements in a parse tree. Its raison d'etre is this bit of ! grammar: stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE ! A simple_stmt can contain multiple small_stmt elements joined by semicolons. If the arg is a simple_stmt, the number of *************** *** 112,116 **** if (num == 1) { s = ast_for_stmt(ch); ! if (!s) goto error; asdl_seq_APPEND(stmts, s); --- 112,116 ---- if (num == 1) { s = ast_for_stmt(ch); ! if (!s) goto error; asdl_seq_APPEND(stmts, s); *************** *** 160,164 **** } } ! return Interactive(stmts); } --- 160,164 ---- } } ! return Interactive(stmts); } *************** *** 254,260 **** n = CHILD(n, 0); switch (STR(n)[0]) { ! case '+': return Add; ! case '-': return Sub; case '/': --- 254,260 ---- n = CHILD(n, 0); switch (STR(n)[0]) { ! case '+': return Add; ! case '-': return Sub; case '/': *************** *** 263,277 **** else return Div; ! case '%': return Mod; ! case '<': return LShift; ! case '>': return RShift; ! case '&': return BitAnd; ! case '^': return BitXor; ! case '|': return BitOr; case '*': --- 263,277 ---- else return Div; ! case '%': return Mod; ! case '<': return LShift; ! case '>': return RShift; ! case '&': return BitAnd; ! case '^': return BitXor; ! case '|': return BitOr; case '*': *************** *** 296,316 **** 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; } --- 296,316 ---- 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; } *************** *** 319,323 **** /* handle "not in" and "is not" */ switch (TYPE(CHILD(n, 0))) { ! case NAME: if (strcmp(STR(CHILD(n, 1)), "in") == 0) return NotIn; --- 319,323 ---- /* handle "not in" and "is not" */ switch (TYPE(CHILD(n, 0))) { ! case NAME: if (strcmp(STR(CHILD(n, 1)), "in") == 0) return NotIn; *************** *** 353,357 **** /* parameters: '(' [varargslist] ')' ! varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [','] */ --- 353,357 ---- /* parameters: '(' [varargslist] ')' ! varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [','] */ *************** *** 432,436 **** /* lambdef: 'lambda' [varargslist] ':' test */ if (NCH(n) == 3) ! return Lambda(arguments(NULL, NULL, NULL, NULL), ast_for_expr(CHILD(n, 2))); else --- 432,436 ---- /* lambdef: 'lambda' [varargslist] ':' test */ if (NCH(n) == 3) ! return Lambda(arguments(NULL, NULL, NULL, NULL), ast_for_expr(CHILD(n, 2))); else *************** *** 487,491 **** ast_for_listcomp(const node *n) { ! /* listmaker: test ( list_for | (',' test)* [','] ) list_for: 'for' exprlist 'in' testlist_safe [list_iter] list_iter: list_for | list_if --- 487,491 ---- ast_for_listcomp(const node *n) { ! /* listmaker: test ( list_for | (',' test)* [','] ) list_for: 'for' exprlist 'in' testlist_safe [list_iter] list_iter: list_for | list_if *************** *** 500,504 **** REQ(n, listmaker); assert(NCH(n) > 1); ! target = ast_for_expr(CHILD(n, 0)); if (!target) --- 500,504 ---- REQ(n, listmaker); assert(NCH(n) > 1); ! target = ast_for_expr(CHILD(n, 0)); if (!target) *************** *** 515,519 **** 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 --- 515,519 ---- 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 *************** *** 547,552 **** ast_for_atom(const node *n) { ! /* atom: '(' [testlist] ')' | '[' [listmaker] ']' ! | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ */ node *ch = CHILD(n, 0); --- 547,552 ---- ast_for_atom(const node *n) { ! /* atom: '(' [testlist] ')' | '[' [listmaker] ']' ! | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ */ node *ch = CHILD(n, 0); *************** *** 619,623 **** if (NCH(n) == 1 && TYPE(ch) == test) return Index(ast_for_expr(ch)); ! if (TYPE(ch) == test) lower = ast_for_expr(ch); --- 619,623 ---- if (NCH(n) == 1 && TYPE(ch) == test) return Index(ast_for_expr(ch)); ! if (TYPE(ch) == test) lower = ast_for_expr(ch); *************** *** 645,649 **** step = ast_for_expr(ch); } ! return Slice(lower, upper, step); } --- 645,649 ---- step = ast_for_expr(ch); } ! return Slice(lower, upper, step); } *************** *** 713,717 **** for (i = 1; i < NCH(n); i += 2) { /* XXX cmpop_ty is just an enum */ ! asdl_seq_SET(ops, i / 2, (void *)ast_for_comp_op(CHILD(n, i))); asdl_seq_SET(cmps, i / 2, ast_for_expr(CHILD(n, i + 1))); --- 713,717 ---- for (i = 1; i < NCH(n); i += 2) { /* XXX cmpop_ty is just an enum */ ! asdl_seq_SET(ops, i / 2, (void *)ast_for_comp_op(CHILD(n, i))); asdl_seq_SET(cmps, i / 2, ast_for_expr(CHILD(n, i + 1))); *************** *** 760,764 **** if (NCH(n) == 1) return e; ! /* power: atom trailer* ('**' factor)* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME */ if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { --- 760,764 ---- if (NCH(n) == 1) return e; ! /* power: atom trailer* ('**' factor)* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME */ if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { *************** *** 784,788 **** asdl_seq *slices = asdl_seq_new(NCH(ch) / 2); for (j = 0; j < NCH(ch); j += 2) ! asdl_seq_SET(slices, j / 2, ast_for_slice(CHILD(ch, j))); new = Subscript(e, ExtSlice(slices), Load); --- 784,788 ---- asdl_seq *slices = asdl_seq_new(NCH(ch) / 2); for (j = 0; j < NCH(ch); j += 2) ! asdl_seq_SET(slices, j / 2, ast_for_slice(CHILD(ch, j))); new = Subscript(e, ExtSlice(slices), Load); *************** *** 806,814 **** } ! static expr_ty ast_for_call(const node *n, expr_ty func) { /* ! arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) argument: [test '='] test # Really [keyword '='] test --- 806,814 ---- } ! static expr_ty ast_for_call(const node *n, expr_ty func) { /* ! arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) argument: [test '='] test # Really [keyword '='] test *************** *** 837,841 **** } } ! /* XXX syntax error if more than 255 arguments */ --- 837,841 ---- } } ! /* XXX syntax error if more than 255 arguments */ *************** *** 848,855 **** /* n could be a testlist, a listmaker with no list_for, or a testlist1 from inside backquotes. */ ! if (NCH(n) == 1) return ast_for_expr(CHILD(n, 0)); ! else return Tuple(seq_for_testlist(n), Load); } --- 848,855 ---- /* n could be a testlist, a listmaker with no list_for, or a testlist1 from inside backquotes. */ ! if (NCH(n) == 1) return ast_for_expr(CHILD(n, 0)); ! else return Tuple(seq_for_testlist(n), Load); } *************** *** 859,867 **** { REQ(n, expr_stmt); ! /* expr_stmt: testlist (augassign testlist | ('=' testlist)*) testlist: test (',' test)* [','] ! augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=' ! test: ... here starts the operator precendence dance */ --- 859,867 ---- { REQ(n, expr_stmt); ! /* expr_stmt: testlist (augassign testlist | ('=' testlist)*) testlist: test (',' test)* [','] ! augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=' ! test: ... here starts the operator precendence dance */ *************** *** 900,905 **** ast_for_print_stmt(const node *n) { ! /* print_stmt: 'print' ( [ test (',' test)* [','] ] ! | '>>' test [ (',' test)+ [','] ] ) */ expr_ty dest = NULL; --- 900,905 ---- ast_for_print_stmt(const node *n) { ! /* print_stmt: 'print' ( [ test (',' test)* [','] ] ! | '>>' test [ (',' test)+ [','] ] ) */ expr_ty dest = NULL; *************** *** 955,959 **** { /* ! flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt break_stmt: 'break' --- 955,959 ---- { /* ! flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt break_stmt: 'break' *************** *** 985,994 **** return Raise(ast_for_expr(CHILD(n, 1)), NULL, NULL, LINENO(n)); else if (NCH(ch) == 4) ! return Raise(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), NULL, LINENO(n)); 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)), LINENO(n)); default: --- 985,994 ---- return Raise(ast_for_expr(CHILD(n, 1)), NULL, NULL, LINENO(n)); else if (NCH(ch) == 4) ! return Raise(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), NULL, LINENO(n)); 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)), LINENO(n)); default: *************** *** 1037,1041 **** 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; --- 1037,1041 ---- 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; *************** *** 1067,1072 **** { /* ! import_stmt: 'import' dotted_as_name (',' dotted_as_name)* ! | 'from' dotted_name 'import' ('*' | import_as_name (',' import_as_name)*) */ --- 1067,1072 ---- { /* ! import_stmt: 'import' dotted_as_name (',' dotted_as_name)* ! | 'from' dotted_name 'import' ('*' | import_as_name (',' import_as_name)*) */ *************** *** 1117,1124 **** return Exec(ast_for_expr(CHILD(n, 1)), NULL, NULL, LINENO(n)); else if (NCH(n) == 4) ! return Exec(ast_for_expr(CHILD(n, 1)), ast_for_expr(CHILD(n, 3)), NULL, LINENO(n)); 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)), LINENO(n)); --- 1117,1124 ---- return Exec(ast_for_expr(CHILD(n, 1)), NULL, NULL, LINENO(n)); else if (NCH(n) == 4) ! return Exec(ast_for_expr(CHILD(n, 1)), ast_for_expr(CHILD(n, 3)), NULL, LINENO(n)); 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)), LINENO(n)); *************** *** 1199,1203 **** ast_for_if_stmt(const node *n) { ! /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] */ --- 1199,1203 ---- ast_for_if_stmt(const node *n) { ! /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] */ *************** *** 1210,1218 **** ast_for_suite(CHILD(n, 3)), NULL, LINENO(n)); 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)), --- 1210,1218 ---- ast_for_suite(CHILD(n, 3)), NULL, LINENO(n)); 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)), *************** *** 1222,1226 **** 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; --- 1222,1226 ---- 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; *************** *** 1234,1238 **** 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)), LINENO(n))); /* the just-created orelse handled the last elif */ --- 1234,1238 ---- 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)), LINENO(n))); /* the just-created orelse handled the last elif */ *************** *** 1240,1244 **** } else orelse = NULL; ! for (i = 0; i < n_elif; i++) { int off = 5 + (n_elif - i - 1) * 4; --- 1240,1244 ---- } else orelse = NULL; ! for (i = 0; i < n_elif; i++) { int off = 5 + (n_elif - i - 1) * 4; *************** *** 1254,1258 **** orelse, LINENO(n)); } ! return NULL; } --- 1254,1258 ---- orelse, LINENO(n)); } ! return NULL; } *************** *** 1269,1273 **** else return While(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), ast_for_suite(CHILD(n, 6)), LINENO(n)); --- 1269,1273 ---- else return While(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), ast_for_suite(CHILD(n, 6)), LINENO(n)); *************** *** 1311,1315 **** return excepthandler(NULL, NULL, ast_for_suite(body)); else if (NCH(exc) == 2) ! return excepthandler(ast_for_expr(CHILD(exc, 1)), NULL, ast_for_suite(body)); else { --- 1311,1315 ---- return excepthandler(NULL, NULL, ast_for_suite(body)); else if (NCH(exc) == 2) ! return excepthandler(ast_for_expr(CHILD(exc, 1)), NULL, ast_for_suite(body)); else { *************** *** 1332,1337 **** ast_for_suite(CHILD(n, 5)), LINENO(n)); } else { ! /* try_stmt: ('try' ':' suite (except_clause ':' suite)+ ! ['else' ':' suite] */ asdl_seq *handlers; --- 1332,1337 ---- ast_for_suite(CHILD(n, 5)), LINENO(n)); } else { ! /* try_stmt: ('try' ':' suite (except_clause ':' suite)+ ! ['else' ':' suite] */ asdl_seq *handlers; *************** *** 1361,1365 **** asdl_seq *bases; REQ(n, classdef); ! if (NCH(n) == 4) return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, ast_for_suite(CHILD(n, 3)), LINENO(n)); --- 1361,1365 ---- asdl_seq *bases; REQ(n, classdef); ! if (NCH(n) == 4) return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, ast_for_suite(CHILD(n, 3)), LINENO(n)); *************** *** 1393,1398 **** 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 */ --- 1393,1398 ---- 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 */ *************** *** 1420,1424 **** } } else { ! /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef */ --- 1420,1424 ---- } } else { ! /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef */ *************** *** 1492,1495 **** --- 1492,1499 ---- } + /* s is a Python string literal, including the bracketing quote characters, + * and r &/or u prefixes (if any), and embedded escape sequences (if any). + * parsestr parses it, and returns the decoded Python string object. + */ static PyObject * parsestr(const char *s) *************** *** 1523,1527 **** len = strlen(s); if (len > INT_MAX) { ! PyErr_SetString(PyExc_OverflowError, "string to parse is too long"); return NULL; --- 1527,1531 ---- len = strlen(s); if (len > INT_MAX) { ! PyErr_SetString(PyExc_OverflowError, "string to parse is too long"); return NULL; *************** *** 1548,1552 **** s, len, NULL); return v; ! } #endif --- 1552,1556 ---- s, len, NULL); return v; ! } #endif *************** *** 1588,1592 **** break; case 'x': ! if (isxdigit(Py_CHARMASK(s[0])) && isxdigit(Py_CHARMASK(s[1]))) { unsigned int x = 0; --- 1592,1596 ---- break; case 'x': ! if (isxdigit(Py_CHARMASK(s[0])) && isxdigit(Py_CHARMASK(s[1]))) { unsigned int x = 0; *************** *** 1612,1616 **** } Py_DECREF(v); ! PyErr_SetString(PyExc_ValueError, "invalid \\x escape"); return NULL; --- 1616,1620 ---- } Py_DECREF(v); ! PyErr_SetString(PyExc_ValueError, "invalid \\x escape"); return NULL; From tim_one@users.sourceforge.net Tue Mar 25 19:27:16 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 11:27:16 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.16,1.1.2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv13305/Python Modified Files: Tag: ast-branch ast.c Log Message: parsestr(): Repaired code invoked only when Unicode not enabled. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -C2 -d -r1.1.2.16 -r1.1.2.17 *** ast.c 25 Mar 2003 19:24:42 -0000 1.1.2.16 --- ast.c 25 Mar 2003 19:27:11 -0000 1.1.2.17 *************** *** 1625,1629 **** if (unicode) { Py_DECREF(v); ! com_error(com, PyExc_ValueError, "Unicode escapes not legal " "when Unicode disabled"); --- 1625,1629 ---- if (unicode) { Py_DECREF(v); ! PyErr_SetString(PyExc_ValueError, "Unicode escapes not legal " "when Unicode disabled"); From tim_one@users.sourceforge.net Tue Mar 25 19:35:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 11:35:30 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.17,1.1.2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv16204/Python Modified Files: Tag: ast-branch ast.c Log Message: parsestrplus(): Added a comment; reindented to match the rest of the file. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.17 retrieving revision 1.1.2.18 diff -C2 -d -r1.1.2.17 -r1.1.2.18 *** ast.c 25 Mar 2003 19:27:11 -0000 1.1.2.17 --- ast.c 25 Mar 2003 19:35:25 -0000 1.1.2.18 *************** *** 1641,1644 **** --- 1641,1648 ---- } + /* Build a Python string object out of a STRING atom. This takes care of + * compile-time literal catenation, calling parsestr() on each piece, and + * pasting the intermediate results together. + */ static PyObject * parsestrplus(node *n) *************** *** 1650,1672 **** /* String literal concatenation */ for (i = 1; i < NCH(n); i++) { ! PyObject *s; ! s = parsestr(STR(CHILD(n, i))); ! if (s == NULL) ! goto onError; ! if (PyString_Check(v) && PyString_Check(s)) { ! PyString_ConcatAndDel(&v, s); ! if (v == NULL) ! goto onError; ! } #ifdef Py_USING_UNICODE ! else { ! PyObject *temp; ! temp = PyUnicode_Concat(v, s); ! Py_DECREF(s); ! if (temp == NULL) ! goto onError; ! Py_DECREF(v); ! v = temp; ! } #endif } --- 1654,1676 ---- /* String literal concatenation */ for (i = 1; i < NCH(n); i++) { ! PyObject *s; ! s = parsestr(STR(CHILD(n, i))); ! if (s == NULL) ! goto onError; ! if (PyString_Check(v) && PyString_Check(s)) { ! PyString_ConcatAndDel(&v, s); ! if (v == NULL) ! goto onError; ! } #ifdef Py_USING_UNICODE ! else { ! PyObject *temp; ! temp = PyUnicode_Concat(v, s); ! Py_DECREF(s); ! if (temp == NULL) ! goto onError; ! Py_DECREF(v); ! v = temp; ! } #endif } From tim_one@users.sourceforge.net Tue Mar 25 19:42:27 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 11:42:27 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.18,1.1.2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19184/Python Modified Files: Tag: ast-branch ast.c Log Message: String literals are now compiled correctly, including compile-time string catenation. Error cases will probably blow up, due to NULL PyObjects getting returned from helper routines that callers aren't expecting. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -C2 -d -r1.1.2.18 -r1.1.2.19 *** ast.c 25 Mar 2003 19:35:25 -0000 1.1.2.18 --- ast.c 25 Mar 2003 19:42:23 -0000 1.1.2.19 *************** *** 28,32 **** static PyObject *parsenumber(const char *); static PyObject *parsestr(const char *s); ! static PyObject *parsestrplus(node *n); extern grammar _PyParser_Grammar; /* From graminit.c */ --- 28,32 ---- static PyObject *parsenumber(const char *); static PyObject *parsestr(const char *s); ! static PyObject *parsestrplus(const node *n); extern grammar _PyParser_Grammar; /* From graminit.c */ *************** *** 558,562 **** break; case STRING: ! return Str(PyString_FromString(STR(ch))); break; case NUMBER: --- 558,563 ---- break; case STRING: ! /* XXX parsestrplus can return NULL. */ ! return Str(parsestrplus(n)); break; case NUMBER: *************** *** 1646,1650 **** */ static PyObject * ! parsestrplus(node *n) { PyObject *v; --- 1647,1651 ---- */ static PyObject * ! parsestrplus(const node *n) { PyObject *v; From nnorwitz@users.sourceforge.net Tue Mar 25 19:57:47 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 25 Mar 2003 11:57:47 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.32,1.1.2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27247/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Get all sorts of slicing working, including augmented assignment Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.32 retrieving revision 1.1.2.33 diff -C2 -d -r1.1.2.32 -r1.1.2.33 *** newcompile.c 25 Mar 2003 18:51:00 -0000 1.1.2.32 --- newcompile.c 25 Mar 2003 19:57:40 -0000 1.1.2.33 *************** *** 83,87 **** static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); ! static int compiler_visit_slice(struct compiler *, slice_ty); static int compiler_push_fblock(struct compiler *, enum fblocktype, int); --- 83,88 ---- static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); ! static int compiler_visit_slice(struct compiler *c, slice_ty s, ! expr_context_ty ctx); static int compiler_push_fblock(struct compiler *, enum fblocktype, int); *************** *** 562,565 **** --- 563,571 ---- } + #define VISIT_SLICE(C, V, CTX) {\ + if (!compiler_visit_slice((C), (V), (CTX))) \ + return 0; \ + } + #define VISIT_SEQ(C, TYPE, SEQ) { \ int i; \ *************** *** 1317,1342 **** case AugLoad: VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP_I(c, DUP_TOPX, 2); ! ADDOP(c, BINARY_SUBSCR); break; case Load: VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP(c, BINARY_SUBSCR); break; case AugStore: ! ADDOP(c, ROT_THREE); ! ADDOP(c, STORE_SUBSCR); break; case Store: VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP(c, STORE_SUBSCR); break; case Del: VISIT(c, expr, e->v.Subscript.value); ! VISIT(c, slice, e->v.Subscript.slice); ! ADDOP(c, DELETE_SUBSCR); break; case Param: --- 1323,1342 ---- case AugLoad: VISIT(c, expr, e->v.Subscript.value); ! VISIT_SLICE(c, e->v.Subscript.slice, AugLoad); break; case Load: VISIT(c, expr, e->v.Subscript.value); ! VISIT_SLICE(c, e->v.Subscript.slice, Load); break; case AugStore: ! VISIT_SLICE(c, e->v.Subscript.slice, AugStore); break; case Store: VISIT(c, expr, e->v.Subscript.value); ! VISIT_SLICE(c, e->v.Subscript.slice, Store); break; case Del: VISIT(c, expr, e->v.Subscript.value); ! VISIT_SLICE(c, e->v.Subscript.slice, Del); break; case Param: *************** *** 1456,1470 **** static int ! compiler_visit_slice(struct compiler *c, slice_ty s) { switch (s->kind) { case Ellipsis_kind: break; case Slice_kind: ! break; case ExtSlice_kind: break; case Index_kind: VISIT(c, expr, s->v.Index.value); break; } --- 1456,1538 ---- static int ! compiler_slice(struct compiler *c, slice_ty s, int op, expr_context_ty ctx) ! { ! int slice_offset = 0, stack_count = 0; ! assert(s->kind == Slice_kind); ! if (s->v.Slice.lower) { ! stack_count++; ! slice_offset |= 1; ! if (ctx != AugStore) ! VISIT(c, expr, s->v.Slice.lower); ! } ! if (s->v.Slice.upper) { ! stack_count++; ! slice_offset |= 2; ! if (ctx != AugStore) ! VISIT(c, expr, s->v.Slice.upper); ! } ! ! if (ctx == AugLoad) { ! switch (stack_count) { ! case 0: ADDOP(c, DUP_TOP); break; ! case 1: ADDOP_I(c, DUP_TOPX, 2); break; ! case 2: ADDOP_I(c, DUP_TOPX, 3); break; ! } ! } ! else if (ctx == AugStore) { ! switch (stack_count) { ! case 0: ADDOP(c, ROT_TWO); break; ! case 1: ADDOP(c, ROT_THREE); break; ! case 2: ADDOP(c, ROT_FOUR); break; ! } ! } ! ! ADDOP(c, op + slice_offset); ! return 1; ! } ! ! static int ! compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx) { + int op; switch (s->kind) { case Ellipsis_kind: + ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts); break; case Slice_kind: ! switch (ctx) { ! case AugLoad: /* fall through to Load */ ! case Load: op = SLICE; break; ! case AugStore:/* fall through to Store */ ! case Store: op = STORE_SLICE; break; ! case Del: op = DELETE_SLICE; break; ! default: ! fprintf(stderr, "invalid slice kind %d " ! "in compiler_visit_slice\n", ctx); ! return 0; ! } ! return compiler_slice(c, s, op, ctx); case ExtSlice_kind: break; case Index_kind: VISIT(c, expr, s->v.Index.value); + switch (ctx) { + case AugLoad: /* fall through to Load */ + case Load: op = BINARY_SUBSCR; break; + case AugStore:/* fall through to Store */ + case Store: op = STORE_SUBSCR; break; + case Del: op = DELETE_SUBSCR; break; + default: + fprintf(stderr, "invalid index kind %d " + "in compiler_visit_slice\n", ctx); + return 0; + } + if (ctx == AugLoad) { + ADDOP_I(c, DUP_TOPX, 2); + } + else if (ctx == AugStore) { + ADDOP(c, ROT_THREE); + } + ADDOP(c, op); break; } From gvanrossum@users.sourceforge.net Tue Mar 25 20:15:29 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 25 Mar 2003 12:15:29 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.206,2.206.2.1 typeobject.c,2.220,2.220.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv2467 Modified Files: Tag: cache-attr-branch object.c typeobject.c Log Message: (Experimental branch checkin.) (Ping (mostly) & Guido) Try to speed up instance attribute lookup by caching stuff. Works fine, and is even faster in many cases, but is slower when the attribute is found in the first class tried. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.206 retrieving revision 2.206.2.1 diff -C2 -d -r2.206 -r2.206.2.1 *** object.c 23 Mar 2003 18:06:08 -0000 2.206 --- object.c 25 Mar 2003 20:15:15 -0000 2.206.2.1 *************** *** 1352,1362 **** } PyObject * PyObject_GenericGetAttr(PyObject *obj, PyObject *name) { PyTypeObject *tp = obj->ob_type; PyObject *descr = NULL; PyObject *res = NULL; ! descrgetfunc f; long dictoffset; PyObject **dictptr; --- 1352,1446 ---- } + #define GET_DESCR_FIELD(descr, field) \ + (((descr) != NULL && \ + PyType_HasFeature((descr)->ob_type, Py_TPFLAGS_HAVE_CLASS)) ? \ + (descr)->ob_type->field : NULL) + + /* Find the dict where an attribute resides, and remember whether its value */ + /* is a data descriptor. The dict is returned un-INCREFed. */ + PyObject *_PyObject_FindAttr(PyTypeObject *tp, PyObject *name, + int *is_data_descr) + { + PyObject *pair = NULL; + PyObject *flag = NULL; + PyObject *where = NULL; + PyObject *descr = NULL; + + if (tp->tp_cache != NULL) { + pair = PyDict_GetItem(tp->tp_cache, name); + /* pair is not owned by this func */ + if (pair) { + flag = PyTuple_GET_ITEM(pair, 0); + where = PyTuple_GET_ITEM(pair, 1); + goto done; + } + } + + /* Inline _PyType_Lookup */ + { + int i, n; + PyObject *mro, *base, *dict; + + /* Look in tp_dict of types in MRO */ + mro = tp->tp_mro; + assert(mro != NULL); + assert(PyTuple_Check(mro)); + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + base = PyTuple_GET_ITEM(mro, i); + if (PyClass_Check(base)) { + dict = ((PyClassObject *) base)->cl_dict; + } else { + assert(PyType_Check(base)); + dict = ((PyTypeObject *) base)->tp_dict; + } + assert(dict && PyDict_Check(dict)); + descr = PyDict_GetItem(dict, name); + if (descr != NULL) { + if (GET_DESCR_FIELD(descr, tp_descr_set)) { + /* It's a data descriptor. */ + flag = Py_True; + } else { + flag = Py_False; + } + where = dict; + break; + } + } + } + + if (flag == NULL) { + flag = Py_False; + where = Py_None; + } + + if (tp->tp_cache != NULL) { + pair = PyTuple_New(2); + Py_INCREF(flag); + PyTuple_SetItem(pair, 0, flag); + Py_INCREF(where); + PyTuple_SetItem(pair, 1, where); + PyDict_SetItem(tp->tp_cache, name, pair); + Py_DECREF(pair); + } + + done: + *is_data_descr = (flag == Py_True); + if (where == Py_None) { + return NULL; + } else { + return where; + } + } + PyObject * PyObject_GenericGetAttr(PyObject *obj, PyObject *name) { PyTypeObject *tp = obj->ob_type; + PyObject *where; + int is_data_descr = 0; PyObject *descr = NULL; PyObject *res = NULL; ! descrgetfunc descr_get; long dictoffset; PyObject **dictptr; *************** *** 1388,1460 **** } ! /* Inline _PyType_Lookup */ ! { ! int i, n; ! PyObject *mro, *base, *dict; ! ! /* Look in tp_dict of types in MRO */ ! mro = tp->tp_mro; ! assert(mro != NULL); ! assert(PyTuple_Check(mro)); ! n = PyTuple_GET_SIZE(mro); ! for (i = 0; i < n; i++) { ! base = PyTuple_GET_ITEM(mro, i); ! if (PyClass_Check(base)) ! dict = ((PyClassObject *)base)->cl_dict; ! else { ! assert(PyType_Check(base)); ! dict = ((PyTypeObject *)base)->tp_dict; ! } ! assert(dict && PyDict_Check(dict)); ! descr = PyDict_GetItem(dict, name); ! if (descr != NULL) ! break; ! } ! } ! f = NULL; ! if (descr != NULL && ! PyType_HasFeature(descr->ob_type, Py_TPFLAGS_HAVE_CLASS)) { ! f = descr->ob_type->tp_descr_get; ! if (f != NULL && PyDescr_IsData(descr)) { ! res = f(descr, obj, (PyObject *)obj->ob_type); ! goto done; ! } ! } ! /* Inline _PyObject_GetDictPtr */ ! dictoffset = tp->tp_dictoffset; ! if (dictoffset != 0) { ! PyObject *dict; ! if (dictoffset < 0) { ! int tsize; ! size_t size; ! tsize = ((PyVarObject *)obj)->ob_size; ! if (tsize < 0) ! tsize = -tsize; ! size = _PyObject_VAR_SIZE(tp, tsize); ! dictoffset += (long)size; ! assert(dictoffset > 0); ! assert(dictoffset % SIZEOF_VOID_P == 0); ! } ! dictptr = (PyObject **) ((char *)obj + dictoffset); ! dict = *dictptr; ! if (dict != NULL) { ! res = PyDict_GetItem(dict, name); ! if (res != NULL) { ! Py_INCREF(res); ! goto done; } } } ! if (f != NULL) { ! res = f(descr, obj, (PyObject *)obj->ob_type); ! goto done; ! } - if (descr != NULL) { Py_INCREF(descr); res = descr; --- 1472,1520 ---- } ! /* Locate the attribute among the base classes. */ ! where = _PyObject_FindAttr(tp, name, &is_data_descr); ! /* Data descriptor takes priority over instance attribute. */ ! if (!is_data_descr) { ! /* Inline _PyObject_GetDictPtr */ ! dictoffset = tp->tp_dictoffset; ! if (dictoffset != 0) { ! PyObject *dict; ! if (dictoffset < 0) { ! int tsize; ! size_t size; ! tsize = ((PyVarObject *)obj)->ob_size; ! if (tsize < 0) ! tsize = -tsize; ! size = _PyObject_VAR_SIZE(tp, tsize); ! dictoffset += (long)size; ! assert(dictoffset > 0); ! assert(dictoffset % SIZEOF_VOID_P == 0); ! } ! dictptr = (PyObject **) ((char *)obj + dictoffset); ! dict = *dictptr; ! if (dict != NULL) { ! res = PyDict_GetItem(dict, name); ! if (res != NULL) { ! Py_INCREF(res); ! goto done; ! } } } } ! if (where != NULL) { ! descr = PyDict_GetItem(where, name); ! assert(descr != NULL); ! descr_get = GET_DESCR_FIELD(descr, tp_descr_get); ! ! if (descr_get != NULL) { ! res = descr_get(descr, obj, (PyObject *) tp); ! goto done; ! } Py_INCREF(descr); res = descr; *************** *** 1465,1468 **** --- 1525,1529 ---- "'%.50s' object has no attribute '%.400s'", tp->tp_name, PyString_AS_STRING(name)); + done: Py_DECREF(name); *************** *** 1474,1479 **** { PyTypeObject *tp = obj->ob_type; ! PyObject *descr; ! descrsetfunc f; PyObject **dictptr; int res = -1; --- 1535,1542 ---- { PyTypeObject *tp = obj->ob_type; ! PyObject *where; ! int is_data_descr = 0; ! PyObject *descr = NULL; ! descrsetfunc descr_set; PyObject **dictptr; int res = -1; *************** *** 1505,1517 **** } ! descr = _PyType_Lookup(tp, name); ! f = NULL; ! if (descr != NULL && ! PyType_HasFeature(descr->ob_type, Py_TPFLAGS_HAVE_CLASS)) { ! f = descr->ob_type->tp_descr_set; ! if (f != NULL && PyDescr_IsData(descr)) { ! res = f(descr, obj, value); ! goto done; ! } } --- 1568,1583 ---- } ! /* Locate the attribute among the base classes. */ ! where = _PyObject_FindAttr(tp, name, &is_data_descr); ! if (where != NULL) { ! descr = PyDict_GetItem(where, name); ! } ! if (is_data_descr) { ! /* Data descriptor takes priority over instance attribute. */ ! assert(descr != NULL); ! descr_set = GET_DESCR_FIELD(descr, tp_descr_set); ! assert(descr_set != NULL && PyDescr_IsData(descr)); ! res = descr_set(descr, obj, value); ! goto done; } *************** *** 1536,1544 **** } - if (f != NULL) { - res = f(descr, obj, value); - goto done; - } - if (descr == NULL) { PyErr_Format(PyExc_AttributeError, --- 1602,1605 ---- *************** *** 1551,1554 **** --- 1612,1616 ---- "'%.50s' object attribute '%.400s' is read-only", tp->tp_name, PyString_AS_STRING(name)); + done: Py_DECREF(name); Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.220 retrieving revision 2.220.2.1 diff -C2 -d -r2.220 -r2.220.2.1 *** typeobject.c 24 Mar 2003 23:49:49 -0000 2.220 --- typeobject.c 25 Mar 2003 20:15:21 -0000 2.220.2.1 *************** *** 179,184 **** type_set_bases(PyTypeObject *type, PyObject *value, void *context) { ! int i, r = 0; PyObject *ob, *temp; PyTypeObject *new_base, *old_base; PyObject *old_bases, *old_mro; --- 179,185 ---- type_set_bases(PyTypeObject *type, PyObject *value, void *context) { ! int i, r = 0, cacheable; PyObject *ob, *temp; + PyObject *ref, *subclass_list, *subclass; PyTypeObject *new_base, *old_base; PyObject *old_bases, *old_mro; *************** *** 206,209 **** --- 207,211 ---- return -1; } + for (i = 0; i < PyTuple_GET_SIZE(value); i++) { ob = PyTuple_GET_ITEM(value, i); *************** *** 226,232 **** new_base = best_base(value); ! if (!new_base) { return -1; - } if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) --- 228,233 ---- new_base = best_base(value); ! if (!new_base) return -1; if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) *************** *** 243,251 **** type->tp_base = new_base; ! if (mro_internal(type) < 0) { goto bail; - } - temp = PyList_New(0); if (!temp) goto bail; --- 244,250 ---- type->tp_base = new_base; ! if (mro_internal(type) < 0) goto bail; if (!temp) goto bail; *************** *** 269,272 **** --- 268,312 ---- Py_DECREF(temp); + /* If there's a classic class among the bases, we can't use the cache */ + cacheable = 1; + temp = type->tp_mro; + assert(PyTuple_Check(temp)); + for (i = 0; i < PyTuple_GET_SIZE(temp); i++) { + PyObject *t = PyTuple_GET_ITEM(temp, i); + if (PyClass_Check(t)) { + cacheable = 0; + break; + } + } + + /* Invalidate the cache for this type and all subclasses. */ + Py_XDECREF(type->tp_cache); + if (cacheable) + type->tp_cache = PyDict_New(); + else + type->tp_cache = NULL; + + subclass_list = type->tp_subclasses; + if (subclass_list != NULL) { + assert(PyList_Check(subclass_list)); + for (i = 0; i < PyList_GET_SIZE(subclass_list); i++) { + ref = PyList_GET_ITEM(subclass_list, i); + assert(PyWeakref_CheckRef(ref)); + subclass = PyWeakref_GET_OBJECT(ref); + assert(subclass != NULL); + if (subclass != Py_None) { + PyTypeObject *sc; + assert(PyType_Check(subclass)); + sc = (PyTypeObject *)subclass; + if (sc->tp_cache && cacheable) { + PyDict_Clear(sc->tp_cache); + } else { + Py_XDECREF(sc->tp_cache); + sc->tp_cache = NULL; + } + } + } + } + /* any base that was in __bases__ but now isn't, we need to remove |type| from its tp_subclasses. *************** *** 323,326 **** --- 363,376 ---- static PyObject * + type_cache(PyTypeObject *type, void *context) + { + if (type->tp_cache == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return PyDictProxy_New(type->tp_cache); + } + + static PyObject * type_get_doc(PyTypeObject *type, void *context) { *************** *** 348,351 **** --- 398,402 ---- {"__module__", (getter)type_module, (setter)type_set_module, NULL}, {"__dict__", (getter)type_dict, NULL, NULL}, + {"__cache__", (getter)type_cache, NULL, NULL}, {"__doc__", (getter)type_get_doc, NULL, NULL}, {0} *************** *** 1304,1309 **** base_i = (PyTypeObject *)base_proto; if (base_i->tp_dict == NULL) { ! if (PyType_Ready(base_i) < 0) return NULL; } candidate = solid_base(base_i); --- 1355,1361 ---- base_i = (PyTypeObject *)base_proto; if (base_i->tp_dict == NULL) { ! if (PyType_Ready(base_i) < 0) { return NULL; + } } candidate = solid_base(base_i); *************** *** 1326,1332 **** } } ! if (base == NULL) PyErr_SetString(PyExc_TypeError, "a new-style class can't have only classic bases"); return base; } --- 1378,1385 ---- } } ! if (base == NULL) { PyErr_SetString(PyExc_TypeError, "a new-style class can't have only classic bases"); + } return base; } *************** *** 2029,2034 **** --- 2082,2108 ---- static int + invalidate_cache(PyTypeObject *type, void *data) + { + PyObject *name = (PyObject *)data; + if (type->tp_cache != NULL) { + assert(PyDict_Check(type->tp_cache)); + if (PyDict_DelItem(type->tp_cache, name) != 0) { + PyErr_Clear(); + } + } + return 0; + } + + #define GET_DESCR_FIELD(descr, field) \ + (((descr) != NULL && \ + PyType_HasFeature((descr)->ob_type, Py_TPFLAGS_HAVE_CLASS)) ? \ + (descr)->ob_type->field : NULL) + + static int type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) { + PyObject *old; + int was_data_descr, is_data_descr; + if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { PyErr_Format( *************** *** 2038,2047 **** return -1; } ! /* XXX Example of how I expect this to be used... ! if (update_subclasses(type, name, invalidate_cache, NULL) < 0) ! return -1; ! */ if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) return -1; return update_slot(type, name); } --- 2112,2128 ---- return -1; } ! ! /* If this change affects attribute lookup, invalidate cache entries. */ ! old = PyDict_GetItem(type->tp_dict, name); ! was_data_descr = (old != NULL) && GET_DESCR_FIELD(old, tp_descr_set); ! is_data_descr = (value != NULL) && GET_DESCR_FIELD(value, tp_descr_set); ! if (was_data_descr != is_data_descr || ! (old == NULL) != (value == NULL)) { ! update_subclasses(type, name, invalidate_cache, name); ! } ! if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) return -1; + return update_slot(type, name); } *************** *** 3053,3057 **** PyObject *dict, *bases; PyTypeObject *base; ! int i, n; if (type->tp_flags & Py_TPFLAGS_READY) { --- 3134,3138 ---- PyObject *dict, *bases; PyTypeObject *base; ! int i, n, cacheable; if (type->tp_flags & Py_TPFLAGS_READY) { *************** *** 3140,3147 **** assert(PyTuple_Check(bases)); n = PyTuple_GET_SIZE(bases); for (i = 1; i < n; i++) { PyObject *b = PyTuple_GET_ITEM(bases, i); ! if (PyType_Check(b)) inherit_slots(type, (PyTypeObject *)b); } --- 3221,3241 ---- assert(PyTuple_Check(bases)); n = PyTuple_GET_SIZE(bases); + cacheable = 1; for (i = 1; i < n; i++) { PyObject *b = PyTuple_GET_ITEM(bases, i); ! if (PyType_Check(b)) { inherit_slots(type, (PyTypeObject *)b); + } else { + /* Cache only works if all bases are new-style. */ + cacheable = 0; + } + } + + /* Initialize the attribute location cache. */ + Py_XDECREF(type->tp_cache); + if (cacheable) { + type->tp_cache = PyDict_New(); + } else { + type->tp_cache = NULL; } *************** *** 3236,3240 **** assert(PyWeakref_CheckRef(ref)); if (PyWeakref_GET_OBJECT(ref) == (PyObject*)type) { ! /* this can't fail, right? */ PySequence_DelItem(list, i); return; --- 3330,3334 ---- assert(PyWeakref_CheckRef(ref)); if (PyWeakref_GET_OBJECT(ref) == (PyObject*)type) { ! /* XXX What if the following fails? */ PySequence_DelItem(list, i); return; From nnorwitz@users.sourceforge.net Tue Mar 25 20:18:01 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 25 Mar 2003 12:18:01 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.33,1.1.2.34 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv3835/Python Modified Files: Tag: ast-branch newcompile.c Log Message: implement simple import stmt Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.33 retrieving revision 1.1.2.34 diff -C2 -d -r1.1.2.33 -r1.1.2.34 *** newcompile.c 25 Mar 2003 19:57:40 -0000 1.1.2.33 --- newcompile.c 25 Mar 2003 20:17:57 -0000 1.1.2.34 *************** *** 818,821 **** --- 818,841 ---- static int + compiler_import(struct compiler *c, stmt_ty s) + { + int i, n = asdl_seq_LEN(s->v.Import.names); + for (i = 0; i < n; i++) { + alias_ty alias = asdl_seq_GET(s->v.Import.names, i); + identifier store_name; + ADDOP_O(c, LOAD_CONST, Py_None, consts); + ADDOP_O(c, IMPORT_NAME, alias->name, varnames); + + store_name = alias->name; + if (alias->asname) + store_name = alias->asname; + + if (!compiler_nameop(c, store_name, Store)) + return 0; + } + return 1; + } + + static int compiler_assert(struct compiler *c, stmt_ty s) { *************** *** 923,927 **** return compiler_assert(c, s); case Import_kind: ! break; case ImportFrom_kind: break; --- 943,947 ---- return compiler_assert(c, s); case Import_kind: ! return compiler_import(c, s); case ImportFrom_kind: break; From nnorwitz@users.sourceforge.net Tue Mar 25 20:53:31 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 25 Mar 2003 12:53:31 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.34,1.1.2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19161/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Implement from/import stmt Fix import x as y to lookup in the proper location (names, not varnames) Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.34 retrieving revision 1.1.2.35 diff -C2 -d -r1.1.2.34 -r1.1.2.35 *** newcompile.c 25 Mar 2003 20:17:57 -0000 1.1.2.34 --- newcompile.c 25 Mar 2003 20:53:22 -0000 1.1.2.35 *************** *** 825,829 **** identifier store_name; ADDOP_O(c, LOAD_CONST, Py_None, consts); ! ADDOP_O(c, IMPORT_NAME, alias->name, varnames); store_name = alias->name; --- 825,829 ---- identifier store_name; ADDOP_O(c, LOAD_CONST, Py_None, consts); ! ADDOP_O(c, IMPORT_NAME, alias->name, names); store_name = alias->name; *************** *** 838,841 **** --- 838,874 ---- static int + compiler_from_import(struct compiler *c, stmt_ty s) + { + int i, n = asdl_seq_LEN(s->v.ImportFrom.names); + PyObject *names = PyTuple_New(n); + if (!names) + return 0; + + /* build up the names */ + for (i = 0; i < n; i++) { + alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i); + PyTuple_SET_ITEM(names, i, alias->name); + } + + ADDOP_O(c, LOAD_CONST, names, consts); + ADDOP_O(c, IMPORT_NAME, s->v.ImportFrom.module, names); + for (i = 0; i < n; i++) { + alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i); + identifier store_name; + + ADDOP_O(c, IMPORT_FROM, alias->name, names); + store_name = alias->name; + if (alias->asname) + store_name = alias->asname; + + if (!compiler_nameop(c, store_name, Store)) + return 0; + } + /* remove imported module */ + ADDOP(c, POP_TOP); + return 1; + } + + static int compiler_assert(struct compiler *c, stmt_ty s) { *************** *** 945,949 **** return compiler_import(c, s); case ImportFrom_kind: ! break; case Exec_kind: VISIT(c, expr, s->v.Exec.body); --- 978,982 ---- return compiler_import(c, s); case ImportFrom_kind: ! return compiler_from_import(c, s); case Exec_kind: VISIT(c, expr, s->v.Exec.body); From tim_one@users.sourceforge.net Tue Mar 25 21:01:29 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 13:01:29 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.35,1.1.2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22227/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Compiling a two-branch if/else got into an infinite loop. Repaired. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.35 retrieving revision 1.1.2.36 diff -C2 -d -r1.1.2.35 -r1.1.2.36 *** newcompile.c 25 Mar 2003 20:53:22 -0000 1.1.2.35 --- newcompile.c 25 Mar 2003 21:01:24 -0000 1.1.2.36 *************** *** 681,685 **** compiler_if(struct compiler *c, stmt_ty s) { ! int end, next, elif = 1; assert(s->kind == If_kind); --- 681,685 ---- compiler_if(struct compiler *c, stmt_ty s) { ! int end, next; assert(s->kind == If_kind); *************** *** 687,691 **** if (end < 0) return 0; ! while (elif) { next = compiler_new_block(c); if (next < 0) --- 687,691 ---- if (end < 0) return 0; ! for (;;) { next = compiler_new_block(c); if (next < 0) *************** *** 701,713 **** stmt_ty t = asdl_seq_GET(s->v.If.orelse, 0); if (t->kind == If_kind) { - elif = 1; s = t; c->u->u_lineno = t->lineno; } } else ! elif = 0; ! if (!elif) ! VISIT_SEQ(c, stmt, s->v.If.orelse); } compiler_use_block(c, end); --- 701,714 ---- stmt_ty t = asdl_seq_GET(s->v.If.orelse, 0); if (t->kind == If_kind) { s = t; c->u->u_lineno = t->lineno; } + else { + VISIT_SEQ(c, stmt, s->v.If.orelse); + break; + } } else ! break; } compiler_use_block(c, end); From gvanrossum@users.sourceforge.net Tue Mar 25 21:19:11 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 25 Mar 2003 13:19:11 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.220.2.1,2.220.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv29431 Modified Files: Tag: cache-attr-branch typeobject.c Log Message: Ouch. I'd deleted the wrong line in type_set_bases. :-( Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.220.2.1 retrieving revision 2.220.2.2 diff -C2 -d -r2.220.2.1 -r2.220.2.2 *** typeobject.c 25 Mar 2003 20:15:21 -0000 2.220.2.1 --- typeobject.c 25 Mar 2003 21:19:02 -0000 2.220.2.2 *************** *** 247,250 **** --- 247,251 ---- goto bail; + temp = PyList_New(0); if (!temp) goto bail; From jhylton@users.sourceforge.net Tue Mar 25 21:23:46 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 13:23:46 -0800 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.10,2.10.8.11 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv31198 Modified Files: Tag: ast-branch symtable.c Log Message: Don't mark var as free unless block is nested. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.10 retrieving revision 2.10.8.11 diff -C2 -d -r2.10.8.10 -r2.10.8.11 *** symtable.c 21 Oct 2002 21:31:11 -0000 2.10.8.10 --- symtable.c 25 Mar 2003 21:23:39 -0000 2.10.8.11 *************** *** 335,339 **** int analyze_name(PyObject *dict, PyObject *name, int flags, PyObject *bound, ! PyObject *local, PyObject *free) { if (flags & DEF_GLOBAL) { --- 335,339 ---- int analyze_name(PyObject *dict, PyObject *name, int flags, PyObject *bound, ! PyObject *local, PyObject *free, int nested) { if (flags & DEF_GLOBAL) { *************** *** 349,353 **** return 1; } ! if (bound && PyDict_GetItem(bound, name)) { SET_SCOPE(dict, name, FREE); if (PyDict_SetItem(free, name, Py_None) < 0) --- 349,354 ---- return 1; } ! /* If the function is nested, then it can have free vars. */ ! if (nested && bound && PyDict_GetItem(bound, name)) { SET_SCOPE(dict, name, FREE); if (PyDict_SetItem(free, name, Py_None) < 0) *************** *** 444,448 **** while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) { flags = PyInt_AS_LONG(v); ! if (!analyze_name(scope, name, flags, bound, local, free)) goto error; } --- 445,450 ---- while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) { flags = PyInt_AS_LONG(v); ! if (!analyze_name(scope, name, flags, bound, local, free, ! ste->ste_nested)) goto error; } From jhylton@users.sourceforge.net Tue Mar 25 21:40:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 25 Mar 2003 13:40:23 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.36,1.1.2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5457 Modified Files: Tag: ast-branch newcompile.c Log Message: Pop it! Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.36 retrieving revision 1.1.2.37 diff -C2 -d -r1.1.2.36 -r1.1.2.37 *** newcompile.c 25 Mar 2003 21:01:24 -0000 1.1.2.36 --- newcompile.c 25 Mar 2003 21:40:06 -0000 1.1.2.37 *************** *** 1003,1007 **** } else { ! ADDOP(c, DUP_TOP); } break; --- 1003,1007 ---- } else { ! ADDOP(c, POP_TOP); } break; From tim_one@users.sourceforge.net Tue Mar 25 22:05:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 25 Mar 2003 14:05:08 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.37,1.1.2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv14774 Modified Files: Tag: ast-branch newcompile.c Log Message: Change "if" generation to reduce (or eliminate) the chance that we generate code that doesn't end with "return None". In debug block output, display each block's next block too. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.37 retrieving revision 1.1.2.38 diff -C2 -d -r1.1.2.37 -r1.1.2.38 *** newcompile.c 25 Mar 2003 21:40:06 -0000 1.1.2.37 --- newcompile.c 25 Mar 2003 22:04:59 -0000 1.1.2.38 *************** *** 83,87 **** static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); ! static int compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx); --- 83,87 ---- static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); ! static int compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx); *************** *** 712,716 **** break; } ! compiler_use_block(c, end); return 1; } --- 712,716 ---- break; } ! compiler_use_next_block(c, end); return 1; } *************** *** 1844,1849 **** for (i = a.a_nblocks - 1; i >= 0; i--) { struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; ! fprintf(stderr, "block %d(%d): used=%d alloc=%d\n", ! i, a.a_postorder[i], b->b_iused, b->b_ialloc); for (j = 0; j < b->b_iused; j++) { if (!assemble_emit(&a, &b->b_instr[j])) --- 1844,1849 ---- for (i = a.a_nblocks - 1; i >= 0; i--) { struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; ! fprintf(stderr, "block %d(%d): used=%d alloc=%d next=%d\n", ! i, a.a_postorder[i], b->b_iused, b->b_ialloc, b->b_next); for (j = 0; j < b->b_iused; j++) { if (!assemble_emit(&a, &b->b_instr[j])) From nnorwitz@users.sourceforge.net Tue Mar 25 22:21:24 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 25 Mar 2003 14:21:24 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.19,1.1.2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22627/Python Modified Files: Tag: ast-branch ast.c Log Message: assign to the target variable in a for loop (was loading) Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -C2 -d -r1.1.2.19 -r1.1.2.20 *** ast.c 25 Mar 2003 19:42:23 -0000 1.1.2.19 --- ast.c 25 Mar 2003 22:21:20 -0000 1.1.2.20 *************** *** 1287,1291 **** 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); --- 1287,1291 ---- seq = ast_for_suite(CHILD(n, 8)); ! _target = ast_for_exprlist(CHILD(n, 1), Store); if (asdl_seq_LEN(_target) == 1) { target = asdl_seq_GET(_target, 0); From gvanrossum@users.sourceforge.net Tue Mar 25 22:23:28 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 25 Mar 2003 14:23:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_cache_attr.py,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23282a Added Files: Tag: cache-attr-branch test_cache_attr.py Log Message: Tests for the cache-attr code, by Aahz. --- NEW FILE: test_cache_attr.py --- import unittest from test import test_support def _make_complex_mro_bases(): class C(object): pass class D(C): pass class E(C): pass class F(D,E): pass class G(object): pass class H(G): pass return C,D,E,F,G,H class SimpleUpdatesTestCases(unittest.TestCase): def test_instance(self): class C(object): pass x = C() self.failIf(hasattr(x,'foo'), "x doesn't have a foo yet") x.foo = 1 self.failUnless(x.foo == 1, "x.foo should be 1") C.foo = 'spam' self.failUnless(x.foo == 1, "x.foo should override C.foo") del C.foo self.failUnless(x.foo == 1, "x.foo should still be 1") x.foo = 'eggs' self.failUnless(x.foo == 'eggs', "x.foo should be updated") del x.foo self.failIf(hasattr(x,'foo'), "Shouldn't be caching foo") x.foo = 'monty' self.failUnless(x.foo == 'monty', "x.foo should be 'monty'") self.failUnless(x.foo == 'monty', "x.foo should correctly cache 'monty'") def test_class(self): class C(object): pass self.failIf(hasattr(C,'foo'), "C doesn't have a foo yet") C.foo = 1 self.failUnless(C.foo == 1, "C.foo should be 1") x = C() self.failUnless(x.foo == 1, "x.foo should be C.foo") self.failUnless(x.foo == 1, "x.foo should correctly cache C.foo") C.foo = 'spam' self.failUnless(x.foo == 'spam', "x should get C.foo update") del C.foo self.failIf(hasattr(x,'foo'), "x shouldn't cache foo") self.failIf(hasattr(C,'foo'), "C shouldn't cache foo") def test_single_inheritance1(self): class C(object): pass class D(C): pass self.failIf(hasattr(D,'foo'), "D shouldn't have foo yet") C.foo = 1 self.failUnless(D.foo == 1, "D.foo should be C.foo") x = D() self.failUnless(x.foo == 1, "x.foo should be C.foo") del C.foo self.failIf(hasattr(D,'foo'), "D shouldn't cache foo") def test_single_inheritance2(self): class C(object): pass C.foo = 1 class D(C): pass self.failUnless(D.foo == 1, "D.foo should be C.foo") D.foo = 'spam' self.failUnless(D.foo == 'spam', "D.foo should override C.foo") del D.foo x = D() x.foo = 'eggs' self.failUnless(x.foo == 'eggs', "x.foo should override C.foo") self.failIf(D.foo == 'eggs', "D.foo should be C.foo, not x.foo") def test_multiple_inheritance(self): class C(object): def plugh(self): return 'dragon' class D(object): def plugh(self): return 'dwarf' def maze(self): return 'twisty' class E(C,D): pass self.failIf(hasattr(E,'foo'), "E shouldn't have foo yet") E.foo = 1 self.failUnless(E.foo == 1, "E.foo should be 1") self.failIf(hasattr(C,'foo'), "C shouldn't have foo") self.failIf(hasattr(D,'foo'), "D shouldn't have foo") C.foo = 'spam' self.failUnless(E.foo == 1, "E.foo should be 1") D.foo = 'eggs' self.failUnless(E.foo == 1, "E.foo should be 1") x = E() self.failUnless(x.foo == 1, "x.foo should be E.foo") x.foo = 'bar' self.failUnless(x.foo == 'bar', "x.foo should be 'bar'") del x.foo del E.foo self.failUnless(x.foo == 'spam', "x.foo should be C.foo") self.failUnless(E.foo == 'spam', "E.foo should be C.foo") del C.foo self.failUnless(x.foo == 'eggs', "x.foo should be D.foo") self.failUnless(E.foo == 'eggs', "E.foo should be D.foo") del D.foo self.failIf(hasattr(x,'foo'), "x shouldn't cache foo") self.failIf(hasattr(E,'foo'), "E shouldn't cache foo") D.xyzzy = 123 self.failIf(hasattr(C,'xyzzy'), "C shouldn't have D.xyzzy") self.failUnless(E.xyzzy == 123, "E.xyzzy should be D.xyzzy") self.failUnless(x.xyzzy == 123, "x.xyzzy should be D.xyzzy") self.failUnless(x.plugh() == 'dragon', "x.plugh() should call C.plugh()") self.failUnless(x.plugh() == 'dragon', "x.plugh() should call C.plugh()") self.failUnless(x.maze() == 'twisty', "x.maze() should call D.maze()") def maze(self): return 'passage' C.maze = maze self.failUnless(x.maze() == 'passage', "x.maze() should call C.maze()") def maze(self): return 'twisty passage' import new x.maze = new.instancemethod(maze, x, C) self.failUnless(x.maze() == 'twisty passage', "x.maze() should call x.maze()") def test_complex_mro1(self): C,D,E,F,G,H = _make_complex_mro_bases() class J(F,H): pass C.foo = 1 x = F() self.failUnless(x.foo == 1, "x.foo should be C.foo") y = J() self.failUnless(y.foo == 1, "y.foo should be C.foo") z = H() self.failIf(hasattr(z,'foo'), "z should not have C.foo") G.foo = 'spam' self.failIf(y.foo == 'spam', "G.foo should not mask C.foo") def test_complex_mro2(self): C,D,E,F,G,H = _make_complex_mro_bases() class J(H,F): pass C.foo = 1 x = J() self.failUnless(x.foo == 1, "x.foo should be C.foo") G.foo = 'spam' self.failUnless(x.foo == 'spam', "G.foo should mask C.foo") class DescriptorsTestCases(unittest.TestCase): pass class ClassicClassesTestCases(unittest.TestCase): pass class TestCacheDirectly(unittest.TestCase): pass def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SimpleUpdatesTestCases)) suite.addTest(unittest.makeSuite(DescriptorsTestCases)) suite.addTest(unittest.makeSuite(ClassicClassesTestCases)) test_support.run_suite(suite) if __name__=='__main__': test_main() From nnorwitz@users.sourceforge.net Tue Mar 25 22:26:19 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 25 Mar 2003 14:26:19 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.38,1.1.2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24235/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Use compiler_use_next_block() when preceding op is not a jump. Get for loops to work. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.38 retrieving revision 1.1.2.39 diff -C2 -d -r1.1.2.38 -r1.1.2.39 *** newcompile.c 25 Mar 2003 22:04:59 -0000 1.1.2.38 --- newcompile.c 25 Mar 2003 22:26:15 -0000 1.1.2.39 *************** *** 731,736 **** VISIT(c, expr, s->v.For.iter); ADDOP(c, GET_ITER); ! compiler_use_block(c, start); ! ADDOP_I(c, FOR_ITER, cleanup); VISIT(c, expr, s->v.For.target); VISIT_SEQ(c, stmt, s->v.For.body); --- 731,736 ---- VISIT(c, expr, s->v.For.iter); ADDOP(c, GET_ITER); ! compiler_use_next_block(c, start); ! ADDOP_JREL(c, FOR_ITER, cleanup); VISIT(c, expr, s->v.For.target); VISIT_SEQ(c, stmt, s->v.For.body); *************** *** 740,744 **** compiler_pop_fblock(c, LOOP, start); VISIT_SEQ(c, stmt, s->v.For.orelse); ! compiler_use_block(c, end); return 1; } --- 740,744 ---- compiler_pop_fblock(c, LOOP, start); VISIT_SEQ(c, stmt, s->v.For.orelse); ! compiler_use_next_block(c, end); return 1; } *************** *** 782,786 **** if (orelse != -1) VISIT_SEQ(c, stmt, s->v.While.orelse); ! compiler_use_block(c, end); return 1; --- 782,786 ---- if (orelse != -1) VISIT_SEQ(c, stmt, s->v.While.orelse); ! compiler_use_next_block(c, end); return 1; *************** *** 1251,1255 **** } VISIT(c, expr, asdl_seq_GET(s, n)); ! compiler_use_block(c, end); return 1; } --- 1251,1255 ---- } VISIT(c, expr, asdl_seq_GET(s, n)); ! compiler_use_next_block(c, end); return 1; } *************** *** 1285,1289 **** ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); ! compiler_use_block(c, end); } return 1; --- 1285,1289 ---- ADDOP(c, ROT_TWO); ADDOP(c, POP_TOP); ! compiler_use_next_block(c, end); } return 1; From ping@users.sourceforge.net Tue Mar 25 23:04:53 2003 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Tue, 25 Mar 2003 15:04:53 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.206.2.1,2.206.2.2 typeobject.c,2.220.2.2,2.220.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv6080 Modified Files: Tag: cache-attr-branch object.c typeobject.c Log Message: Change cache from (isdata, where) pairs to (where, descr, isdata) triples. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.206.2.1 retrieving revision 2.206.2.2 diff -C2 -d -r2.206.2.1 -r2.206.2.2 *** object.c 25 Mar 2003 20:15:15 -0000 2.206.2.1 --- object.c 25 Mar 2003 23:04:43 -0000 2.206.2.2 *************** *** 1357,1376 **** (descr)->ob_type->field : NULL) ! /* Find the dict where an attribute resides, and remember whether its value */ ! /* is a data descriptor. The dict is returned un-INCREFed. */ PyObject *_PyObject_FindAttr(PyTypeObject *tp, PyObject *name, ! int *is_data_descr) { ! PyObject *pair = NULL; ! PyObject *flag = NULL; ! PyObject *where = NULL; ! PyObject *descr = NULL; if (tp->tp_cache != NULL) { ! pair = PyDict_GetItem(tp->tp_cache, name); /* pair is not owned by this func */ ! if (pair) { ! flag = PyTuple_GET_ITEM(pair, 0); ! where = PyTuple_GET_ITEM(pair, 1); goto done; } --- 1357,1379 ---- (descr)->ob_type->field : NULL) ! /* Find the dict where an attribute resides, and return it un-INCREFed. */ ! /* In addition, cache/return whether the value is a descriptor-with-set; and */ ! /* cache/return the value itself if the value is a descriptor-with-get. */ PyObject *_PyObject_FindAttr(PyTypeObject *tp, PyObject *name, ! PyObject **descr, int *isdata) { ! PyObject *triple = NULL; ! PyObject *value; ! PyObject *cache_where = Py_None; ! PyObject *cache_descr = Py_None; ! PyObject *cache_isdata = Py_False; if (tp->tp_cache != NULL) { ! triple = PyDict_GetItem(tp->tp_cache, name); /* pair is not owned by this func */ ! if (triple) { ! cache_where = PyTuple_GET_ITEM(triple, 0); ! cache_descr = PyTuple_GET_ITEM(triple, 1); ! cache_isdata = PyTuple_GET_ITEM(triple, 2); goto done; } *************** *** 1396,1408 **** } assert(dict && PyDict_Check(dict)); ! descr = PyDict_GetItem(dict, name); ! if (descr != NULL) { ! if (GET_DESCR_FIELD(descr, tp_descr_set)) { ! /* It's a data descriptor. */ ! flag = Py_True; ! } else { ! flag = Py_False; ! } ! where = dict; break; } --- 1399,1409 ---- } assert(dict && PyDict_Check(dict)); ! value = PyDict_GetItem(dict, name); ! if (value != NULL) { ! cache_where = dict; ! if (GET_DESCR_FIELD(value, tp_descr_get)) ! cache_descr = value; ! if (GET_DESCR_FIELD(value, tp_descr_set)) ! cache_isdata = Py_True; break; } *************** *** 1410,1435 **** } - if (flag == NULL) { - flag = Py_False; - where = Py_None; - } - if (tp->tp_cache != NULL) { ! pair = PyTuple_New(2); ! Py_INCREF(flag); ! PyTuple_SetItem(pair, 0, flag); ! Py_INCREF(where); ! PyTuple_SetItem(pair, 1, where); ! PyDict_SetItem(tp->tp_cache, name, pair); ! Py_DECREF(pair); } done: ! *is_data_descr = (flag == Py_True); ! if (where == Py_None) { return NULL; ! } else { ! return where; ! } } --- 1411,1436 ---- } if (tp->tp_cache != NULL) { ! triple = PyTuple_New(3); ! Py_INCREF(cache_where); ! PyTuple_SetItem(triple, 0, cache_where); ! Py_INCREF(cache_descr); ! PyTuple_SetItem(triple, 1, cache_descr); ! Py_INCREF(cache_isdata); ! PyTuple_SetItem(triple, 2, cache_isdata); ! PyDict_SetItem(tp->tp_cache, name, triple); ! Py_DECREF(triple); } done: ! if (cache_descr == Py_None) ! *descr = NULL; ! else ! *descr = cache_descr; ! *isdata = (cache_isdata == Py_True); ! if (cache_where == Py_None) return NULL; ! else ! return cache_where; } *************** *** 1439,1444 **** PyTypeObject *tp = obj->ob_type; PyObject *where; - int is_data_descr = 0; PyObject *descr = NULL; PyObject *res = NULL; descrgetfunc descr_get; --- 1440,1445 ---- PyTypeObject *tp = obj->ob_type; PyObject *where; PyObject *descr = NULL; + int isdata = 0; PyObject *res = NULL; descrgetfunc descr_get; *************** *** 1473,1480 **** /* Locate the attribute among the base classes. */ ! where = _PyObject_FindAttr(tp, name, &is_data_descr); /* Data descriptor takes priority over instance attribute. */ ! if (!is_data_descr) { /* Inline _PyObject_GetDictPtr */ --- 1474,1481 ---- /* Locate the attribute among the base classes. */ ! where = _PyObject_FindAttr(tp, name, &descr, &isdata); /* Data descriptor takes priority over instance attribute. */ ! if (!isdata) { /* Inline _PyObject_GetDictPtr */ *************** *** 1507,1522 **** } ! if (where != NULL) { ! descr = PyDict_GetItem(where, name); ! assert(descr != NULL); descr_get = GET_DESCR_FIELD(descr, tp_descr_get); ! if (descr_get != NULL) { ! res = descr_get(descr, obj, (PyObject *) tp); ! goto done; ! } ! ! Py_INCREF(descr); ! res = descr; goto done; } --- 1508,1522 ---- } ! if (descr != NULL) { descr_get = GET_DESCR_FIELD(descr, tp_descr_get); + assert(descr_get != NULL); + res = descr_get(descr, obj, (PyObject *)tp); + goto done; + } ! if (where != NULL) { ! res = PyDict_GetItem(where, name); ! assert(res != NULL); ! Py_INCREF(res); goto done; } *************** *** 1536,1541 **** PyTypeObject *tp = obj->ob_type; PyObject *where; ! int is_data_descr = 0; ! PyObject *descr = NULL; descrsetfunc descr_set; PyObject **dictptr; --- 1536,1541 ---- PyTypeObject *tp = obj->ob_type; PyObject *where; ! PyObject *descr; ! int isdata = 0; descrsetfunc descr_set; PyObject **dictptr; *************** *** 1569,1581 **** /* Locate the attribute among the base classes. */ ! where = _PyObject_FindAttr(tp, name, &is_data_descr); ! if (where != NULL) { ! descr = PyDict_GetItem(where, name); ! } ! if (is_data_descr) { /* Data descriptor takes priority over instance attribute. */ ! assert(descr != NULL); descr_set = GET_DESCR_FIELD(descr, tp_descr_set); ! assert(descr_set != NULL && PyDescr_IsData(descr)); res = descr_set(descr, obj, value); goto done; --- 1569,1578 ---- /* Locate the attribute among the base classes. */ ! where = _PyObject_FindAttr(tp, name, &descr, &isdata); ! if (isdata) { /* Data descriptor takes priority over instance attribute. */ ! assert(descr != NULL); /* XXX Will fail if set but no get! */ descr_set = GET_DESCR_FIELD(descr, tp_descr_set); ! assert(descr_set != NULL); res = descr_set(descr, obj, value); goto done; Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.220.2.2 retrieving revision 2.220.2.3 diff -C2 -d -r2.220.2.2 -r2.220.2.3 *** typeobject.c 25 Mar 2003 21:19:02 -0000 2.220.2.2 --- typeobject.c 25 Mar 2003 23:04:48 -0000 2.220.2.3 *************** *** 2104,2108 **** { PyObject *old; ! int was_data_descr, is_data_descr; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { --- 2104,2108 ---- { PyObject *old; ! int wasdata, isdata, wasdescr, isdescr, wasnull, isnull; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { *************** *** 2116,2125 **** /* If this change affects attribute lookup, invalidate cache entries. */ old = PyDict_GetItem(type->tp_dict, name); ! was_data_descr = (old != NULL) && GET_DESCR_FIELD(old, tp_descr_set); ! is_data_descr = (value != NULL) && GET_DESCR_FIELD(value, tp_descr_set); ! if (was_data_descr != is_data_descr || ! (old == NULL) != (value == NULL)) { update_subclasses(type, name, invalidate_cache, name); - } if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) --- 2116,2127 ---- /* If this change affects attribute lookup, invalidate cache entries. */ old = PyDict_GetItem(type->tp_dict, name); ! wasnull = (old == NULL); ! isnull = (value == NULL); ! wasdescr = (GET_DESCR_FIELD(old, tp_descr_get) != NULL); ! isdescr = (GET_DESCR_FIELD(value, tp_descr_get) != NULL); ! wasdata = (GET_DESCR_FIELD(old, tp_descr_set) != NULL); ! isdata = (GET_DESCR_FIELD(value, tp_descr_set) != NULL); ! if (wasnull != isnull || wasdescr != isdescr || wasdata != isdata) update_subclasses(type, name, invalidate_cache, name); if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) From rhettinger@users.sourceforge.net Wed Mar 26 01:07:57 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 25 Mar 2003 17:07:57 -0800 Subject: [Python-checkins] python/dist/src/Python compile.c,2.276,2.277 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv12892 Modified Files: compile.c Log Message: SF patch #707257: Improve code generation Adds a single function to improve generated bytecode. Has a single line attachment point, so it is completely de-coupled from both the compiler and ceval.c. Makes three simple transforms that do not require a basic block analysis or re-ordering of code. Gives improved timings on pystone, pybench, and any code using either "while 1" or "x,y=y,x". Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.276 retrieving revision 2.277 diff -C2 -d -r2.276 -r2.277 *** compile.c 24 Mar 2003 17:22:24 -0000 2.276 --- compile.c 26 Mar 2003 01:07:54 -0000 2.277 *************** *** 324,327 **** --- 324,420 ---- } + #define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1])) + #define UNCONDITIONAL_JUMP(op) (op==JUMP_ABSOLUTE || op==JUMP_FORWARD) + #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (arr[i]==JUMP_ABSOLUTE ? 0 : i+3)) + #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 + + static PyObject * + optimize_code(PyObject *code, PyObject* consts) + { + int i, j, codelen; + int tgt, tgttgt, opcode; + unsigned char *codestr; + + /* Make a modifiable copy of the code string */ + if (!PyString_Check(code)) + goto exitUnchanged; + codelen = PyString_Size(code); + codestr = PyMem_Malloc(codelen); + if (codestr == NULL) + goto exitUnchanged; + codestr = memcpy(codestr, PyString_AS_STRING(code), codelen); + assert(PyTuple_Check(consts)); + + for (i=0 ; ico_stacksize = stacksize; co->co_flags = flags; ! Py_INCREF(code); ! co->co_code = code; Py_INCREF(consts); co->co_consts = consts; --- 460,464 ---- co->co_stacksize = stacksize; co->co_flags = flags; ! co->co_code = optimize_code(code, consts); Py_INCREF(consts); co->co_consts = consts; From ping@users.sourceforge.net Wed Mar 26 02:16:29 2003 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Tue, 25 Mar 2003 18:16:29 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.206.2.2,2.206.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv5139 Modified Files: Tag: cache-attr-branch object.c Log Message: Minor adjustments. Seems to be a touch faster for method lookup. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.206.2.2 retrieving revision 2.206.2.3 diff -C2 -d -r2.206.2.2 -r2.206.2.3 *** object.c 25 Mar 2003 23:04:43 -0000 2.206.2.2 --- object.c 26 Mar 2003 02:16:26 -0000 2.206.2.3 *************** *** 1358,1389 **** /* Find the dict where an attribute resides, and return it un-INCREFed. */ ! /* In addition, cache/return whether the value is a descriptor-with-set; and */ ! /* cache/return the value itself if the value is a descriptor-with-get. */ PyObject *_PyObject_FindAttr(PyTypeObject *tp, PyObject *name, PyObject **descr, int *isdata) { ! PyObject *triple = NULL; ! PyObject *value; ! PyObject *cache_where = Py_None; ! PyObject *cache_descr = Py_None; ! PyObject *cache_isdata = Py_False; if (tp->tp_cache != NULL) { triple = PyDict_GetItem(tp->tp_cache, name); - /* pair is not owned by this func */ if (triple) { ! cache_where = PyTuple_GET_ITEM(triple, 0); ! cache_descr = PyTuple_GET_ITEM(triple, 1); ! cache_isdata = PyTuple_GET_ITEM(triple, 2); ! goto done; } } ! /* Inline _PyType_Lookup */ { int i, n; PyObject *mro, *base, *dict; ! /* Look in tp_dict of types in MRO */ mro = tp->tp_mro; assert(mro != NULL); --- 1358,1390 ---- /* Find the dict where an attribute resides, and return it un-INCREFed. */ ! /* In addition, cache/return whether the value is a descr-with-set; and */ ! /* cache/return the value itself if the value is a descr-with-get. */ ! static inline PyObject *_PyObject_FindAttr(PyTypeObject *tp, PyObject *name, PyObject **descr, int *isdata) { ! PyObject *triple, *value; ! PyObject *cache_where, *cache_descr, *cache_isdata; if (tp->tp_cache != NULL) { + /* Fetch entry from the cache. */ triple = PyDict_GetItem(tp->tp_cache, name); if (triple) { ! *descr = PyTuple_GET_ITEM(triple, 1); ! *isdata = (PyTuple_GET_ITEM(triple, 2) == Py_True); ! return PyTuple_GET_ITEM(triple, 0); } } + + cache_where = Py_None; + cache_descr = Py_None; + cache_isdata = Py_False; ! /* Just like _PyType_Lookup, but keep information for the cache. */ { int i, n; PyObject *mro, *base, *dict; ! /* Look in tp_dict of types in MRO. */ mro = tp->tp_mro; assert(mro != NULL); *************** *** 1412,1415 **** --- 1413,1417 ---- if (tp->tp_cache != NULL) { + /* Add entry to the cache. */ triple = PyTuple_New(3); Py_INCREF(cache_where); *************** *** 1423,1436 **** } ! done: ! if (cache_descr == Py_None) ! *descr = NULL; ! else ! *descr = cache_descr; *isdata = (cache_isdata == Py_True); ! if (cache_where == Py_None) ! return NULL; ! else ! return cache_where; } --- 1425,1431 ---- } ! *descr = cache_descr; *isdata = (cache_isdata == Py_True); ! return cache_where; } *************** *** 1440,1445 **** PyTypeObject *tp = obj->ob_type; PyObject *where; ! PyObject *descr = NULL; ! int isdata = 0; PyObject *res = NULL; descrgetfunc descr_get; --- 1435,1440 ---- PyTypeObject *tp = obj->ob_type; PyObject *where; ! PyObject *descr; ! int isdata; PyObject *res = NULL; descrgetfunc descr_get; *************** *** 1508,1512 **** } ! if (descr != NULL) { descr_get = GET_DESCR_FIELD(descr, tp_descr_get); assert(descr_get != NULL); --- 1503,1507 ---- } ! if (descr != Py_None) { descr_get = GET_DESCR_FIELD(descr, tp_descr_get); assert(descr_get != NULL); *************** *** 1515,1519 **** } ! if (where != NULL) { res = PyDict_GetItem(where, name); assert(res != NULL); --- 1510,1514 ---- } ! if (where != Py_None) { res = PyDict_GetItem(where, name); assert(res != NULL); *************** *** 1599,1603 **** } ! if (descr == NULL) { PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", --- 1594,1598 ---- } ! if (descr == Py_None) { PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", From doerwalter@users.sourceforge.net Wed Mar 26 14:31:30 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 26 Mar 2003 06:31:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14334/Lib/test Modified Files: string_tests.py Log Message: Add two tests for simple error cases. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** string_tests.py 23 Feb 2003 23:15:26 -0000 1.28 --- string_tests.py 26 Mar 2003 14:31:25 -0000 1.29 *************** *** 629,630 **** --- 629,634 ---- self.checkequal(data, 'hello world', 'encode', 'zlib') self.checkequal('hello world', data, 'decode', 'zlib') + + self.checkraises(TypeError, 'xyz', 'decode', 42) + self.checkraises(TypeError, 'xyz', 'encode', 42) + From jackjansen@users.sourceforge.net Wed Mar 26 14:36:28 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 26 Mar 2003 06:36:28 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/quicktime MovieInWindow.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/quicktime In directory sc8-pr-cvs1:/tmp/cvs-serv16454 Modified Files: MovieInWindow.py Log Message: Modified to accept a command line argument too. Index: MovieInWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/quicktime/MovieInWindow.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MovieInWindow.py 26 Jan 2003 21:36:06 -0000 1.7 --- MovieInWindow.py 26 Mar 2003 14:36:25 -0000 1.8 *************** *** 15,18 **** --- 15,19 ---- import EasyDialogs import sys + import os *************** *** 23,37 **** # Get the movie file ! fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType ! if not fss: sys.exit(0) # Open the window bounds = (175, 75, 175+160, 75+120) ! theWindow = Win.NewCWindow(bounds, fss.as_tuple()[2], 1, 0, -1, 0, 0) Qd.SetPort(theWindow) # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil) ! playMovieInWindow(theWindow, fss, theWindow.GetWindowPort().GetPortBounds()) def playMovieInWindow(theWindow, theFile, movieBox): --- 24,41 ---- # Get the movie file ! if len(sys.argv) > 1: ! filename = sys.argv[1] ! else: ! filename = EasyDialogs.AskFileForOpen() # Was: QuickTime.MovieFileType ! if not filename: sys.exit(0) # Open the window bounds = (175, 75, 175+160, 75+120) ! theWindow = Win.NewCWindow(bounds, os.path.split(filename)[1], 1, 0, -1, 0, 0) Qd.SetPort(theWindow) # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil) ! playMovieInWindow(theWindow, filename, theWindow.GetWindowPort().GetPortBounds()) def playMovieInWindow(theWindow, theFile, movieBox): From doerwalter@users.sourceforge.net Wed Mar 26 16:03:21 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 26 Mar 2003 08:03:21 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.702,1.703 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28093/Misc Modified Files: NEWS Log Message: Fix typo. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.702 retrieving revision 1.703 diff -C2 -d -r1.702 -r1.703 *** NEWS 24 Mar 2003 12:13:54 -0000 1.702 --- NEWS 26 Mar 2003 16:03:16 -0000 1.703 *************** *** 509,513 **** ----- ! - Several tests weren't being run rom regrtest.py (test_timeout.py, test_tarfile.py, test_netrc.py, test_multifile.py, test_importhooks.py and test_imp.py). Now they are. (Note to --- 509,513 ---- ----- ! - Several tests weren't being run from regrtest.py (test_timeout.py, test_tarfile.py, test_netrc.py, test_multifile.py, test_importhooks.py and test_imp.py). Now they are. (Note to From bwarsaw@users.sourceforge.net Wed Mar 26 17:57:27 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 26 Mar 2003 09:57:27 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat22.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv22221 Modified Files: _compat22.py Log Message: typed_subpart_iterator(): Fix these to use non-deprecated APIs, i.e. get_content_maintype() and get_content_subtype(). Also, add True, False for Python 2.2.x where x < 2 compatibility. Index: _compat22.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _compat22.py 11 Mar 2003 04:41:35 -0000 1.5 --- _compat22.py 26 Mar 2003 17:57:25 -0000 1.6 *************** *** 2,6 **** # Author: barry@zope.com ! """Module containing compatibility functions for Python 2.1. """ --- 2,6 ---- # Author: barry@zope.com ! """Module containing compatibility functions for Python 2.2. """ *************** *** 10,13 **** --- 10,20 ---- from types import StringTypes + # Python 2.2.x where x < 2 lacks True/False + try: + True, False + except NameError: + True = 1 + False = 0 + *************** *** 59,63 **** """ for subpart in msg.walk(): ! if subpart.get_main_type('text') == maintype: ! if subtype is None or subpart.get_subtype('plain') == subtype: yield subpart --- 66,70 ---- """ for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: yield subpart From bwarsaw@users.sourceforge.net Wed Mar 26 17:56:25 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 26 Mar 2003 09:56:25 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _compat21.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv21839 Modified Files: _compat21.py Log Message: typed_subpart_iterator(): Fix these to use non-deprecated APIs, i.e. get_content_maintype() and get_content_subtype(). Index: _compat21.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat21.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _compat21.py 12 Mar 2003 02:54:17 -0000 1.7 --- _compat21.py 26 Mar 2003 17:56:21 -0000 1.8 *************** *** 64,69 **** parts = [] for subpart in msg.walk(): ! if subpart.get_main_type('text') == maintype: ! if subtype is None or subpart.get_subtype('plain') == subtype: parts.append(subpart) return parts --- 64,69 ---- parts = [] for subpart in msg.walk(): ! if subpart.get_content_maintype() == maintype: ! if subtype is None or subpart.get_content_subtype() == subtype: parts.append(subpart) return parts From bwarsaw@users.sourceforge.net Wed Mar 26 17:58:14 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 26 Mar 2003 09:58:14 -0800 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv22575 Modified Files: __init__.py Log Message: Temporary bump of the version number. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** __init__.py 21 Mar 2003 18:57:59 -0000 1.25 --- __init__.py 26 Mar 2003 17:58:11 -0000 1.26 *************** *** 5,9 **** """ ! __version__ = '2.5' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5+' __all__ = [ From jackjansen@users.sourceforge.net Wed Mar 26 23:14:47 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 26 Mar 2003 15:14:47 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv11325 Modified Files: gensuitemodule.py Log Message: If GetAppTerminology fails (which seems to be the usual case on OSX?) we try to manually launch the application and send it an ascr/gdte event to get its terminology. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** gensuitemodule.py 23 Mar 2003 22:05:53 -0000 1.33 --- gensuitemodule.py 26 Mar 2003 23:14:44 -0000 1.34 *************** *** 128,145 **** edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" ! aedescobj, launched = OSATerminology.GetSysTerminology(fullname) ! if launched: ! print "Launched", fullname ! raw = aetools.unpack(aedescobj) ! if not raw: ! print 'Unpack returned empty value:', raw ! return ! if not raw[0].data: ! print 'Unpack returned value without data:', raw ! return ! aedata = raw[0] aete = decode(aedata.data) compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, creatorsignature=creatorsignature) def compileaetelist(aetelist, fullname, output=None, basepkgname=None, --- 128,178 ---- edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" ! try: ! aedescobj, launched = OSATerminology.GetAppTerminology(fullname) ! except MacOS.Error, arg: ! if arg[0] == -1701: # errAEDescNotFound ! print "GetAppTerminology failed with errAEDescNotFound, trying manually" ! aedata, sig = getappterminology(fullname) ! if not creatorsignature: ! creatorsignature = sig ! else: ! raise ! else: ! if launched: ! print "Launched", fullname ! raw = aetools.unpack(aedescobj) ! if not raw: ! print 'Unpack returned empty value:', raw ! return ! if not raw[0].data: ! print 'Unpack returned value without data:', raw ! return ! aedata = raw[0] aete = decode(aedata.data) compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, creatorsignature=creatorsignature) + + def getappterminology(fullname): + """Get application terminology by sending an AppleEvent""" + # First check that we actually can send AppleEvents + if not MacOS.WMAvailable(): + raise RuntimeError, "Cannot send AppleEvents, no access to window manager" + # Next, a workaround for a bug in MacOS 10.2: sending events will hang unless + # you have created an event loop first. + import Carbon.Evt + Carbon.Evt.WaitNextEvent(0,0) + # Now get the signature of the application, hoping it is a bundle + pkginfo = os.path.join(fullname, 'Contents', 'PkgInfo') + if not os.path.exists(pkginfo): + raise RuntimeError, "No PkgInfo file found" + tp_cr = open(pkginfo, 'rb').read() + cr = tp_cr[4:8] + # Let's talk to it and ask for its AETE + talker = aetools.TalkTo(cr) + talker._start() + reply = talker.send("ascr", "gdte") + # Now pick the bits out of the return that we need. + return reply[1]['----'], cr + def compileaetelist(aetelist, fullname, output=None, basepkgname=None, *************** *** 335,338 **** --- 368,372 ---- pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename, defaultLocation=DEFAULT_USER_PACKAGEFOLDER) + output = pathname if not pathname: return From loewis@users.sourceforge.net Thu Mar 27 16:59:40 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 27 Mar 2003 08:59:40 -0800 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19838/Lib Modified Files: imaplib.py Log Message: Replace criterium with criterion. Fixes #705120. Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** imaplib.py 27 Feb 2003 20:14:34 -0000 1.60 --- imaplib.py 27 Mar 2003 16:59:36 -0000 1.61 *************** *** 574,578 **** """Search mailbox for matching messages. ! (typ, [data]) = .search(charset, criterium, ...) 'data' is space separated list of matching message numbers. --- 574,578 ---- """Search mailbox for matching messages. ! (typ, [data]) = .search(charset, criterion, ...) 'data' is space separated list of matching message numbers. From loewis@users.sourceforge.net Thu Mar 27 16:59:41 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 27 Mar 2003 08:59:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libimaplib.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19838/Doc/lib Modified Files: libimaplib.tex Log Message: Replace criterium with criterion. Fixes #705120. Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libimaplib.tex 2 Jan 2003 15:32:00 -0000 1.23 --- libimaplib.tex 27 Mar 2003 16:59:38 -0000 1.24 *************** *** 275,284 **** \end{methoddesc} ! \begin{methoddesc}{search}{charset, criterium\optional{, ...}} Search mailbox for matching messages. Returned data contains a space separated list of matching message numbers. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one ! criterium be specified; an exception will be raised when the server returns an error. --- 275,284 ---- \end{methoddesc} ! \begin{methoddesc}{search}{charset, criterion\optional{, ...}} Search mailbox for matching messages. Returned data contains a space separated list of matching message numbers. \var{charset} may be \code{None}, in which case no \samp{CHARSET} will be specified in the request to the server. The IMAP protocol requires that at least one ! criterion be specified; an exception will be raised when the server returns an error. *************** *** 326,335 **** \end{methoddesc} ! \begin{methoddesc}{sort}{sort_criteria, charset, search_criterium\optional{, ...}} The \code{sort} command is a variant of \code{search} with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. ! Sort has two arguments before the \var{search_criterium} argument(s); a parenthesized list of \var{sort_criteria}, and the searching \var{charset}. Note that unlike \code{search}, the searching \var{charset} argument is mandatory. --- 326,335 ---- \end{methoddesc} ! \begin{methoddesc}{sort}{sort_criteria, charset, search_criterion\optional{, ...}} The \code{sort} command is a variant of \code{search} with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. ! Sort has two arguments before the \var{search_criterion} argument(s); a parenthesized list of \var{sort_criteria}, and the searching \var{charset}. Note that unlike \code{search}, the searching \var{charset} argument is mandatory. From greg@users.sourceforge.net Thu Mar 27 17:23:31 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Thu, 27 Mar 2003 09:23:31 -0800 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31887/extsrc Modified Files: _bsddb.c Log Message: Adds support for the DBEnv->set_timeout() method. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _bsddb.c 3 Feb 2003 04:28:26 -0000 1.8 --- _bsddb.c 27 Mar 2003 17:23:25 -0000 1.9 *************** *** 3164,3167 **** --- 3164,3190 ---- #endif /* DBVER >= 41 */ + #if (DBVER >= 40) + static PyObject* + DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs) + { + int err; + u_int32_t flags=0; + u_int32_t timeout = 0; + char* kwnames[] = { "timeout", "flags", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames, + &timeout, &flags)) { + return NULL; + } + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->set_timeout(self->db_env, (db_timeout_t)timeout, flags); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + RETURN_NONE(); + } + #endif /* DBVER >= 40 */ + static PyObject* DBEnv_set_cachesize(DBEnvObject* self, PyObject* args) *************** *** 3956,3959 **** --- 3979,3985 ---- {"dbrename", (PyCFunction)DBEnv_dbrename, METH_VARARGS|METH_KEYWORDS}, {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS}, + #endif + #if (DBVER >= 40) + {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS}, #endif {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, From greg@users.sourceforge.net Thu Mar 27 17:23:32 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Thu, 27 Mar 2003 09:23:32 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_lock.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1:/tmp/cvs-serv31887/bsddb/test Modified Files: test_lock.py Log Message: Adds support for the DBEnv->set_timeout() method. Index: test_lock.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_lock.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_lock.py 28 Jan 2003 17:20:44 -0000 1.3 --- test_lock.py 27 Mar 2003 17:23:29 -0000 1.4 *************** *** 98,102 **** t.join() ! def theThread(self, sleepTime, lockType): --- 98,108 ---- t.join() ! def test03_set_timeout(self): ! # test that the set_timeout call works ! if hasattr(self.env, 'set_timeout'): ! self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT) ! self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT) ! self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT) ! self.env.set_timeout(7890123, db.DB_SET_TXN_TIMEOUT) def theThread(self, sleepTime, lockType): From greg@users.sourceforge.net Thu Mar 27 17:25:15 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Thu, 27 Mar 2003 09:25:15 -0800 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv426/extsrc Modified Files: _bsddb.c Log Message: 4.1.5 Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _bsddb.c 27 Mar 2003 17:23:25 -0000 1.9 --- _bsddb.c 27 Mar 2003 17:25:10 -0000 1.10 *************** *** 86,90 **** #define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR) ! #define PY_BSDDB_VERSION "4.1.4" static char *rcs_id = "$Id$"; --- 86,90 ---- #define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR) ! #define PY_BSDDB_VERSION "4.1.5" static char *rcs_id = "$Id$"; From jhylton@users.sourceforge.net Thu Mar 27 20:31:39 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 27 Mar 2003 12:31:39 -0800 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.11,2.10.8.12 newcompile.c,1.1.2.39,1.1.2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20947 Modified Files: Tag: ast-branch symtable.c newcompile.c Log Message: Add provisional support for list comps. No if branches. Add some comments. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.11 retrieving revision 2.10.8.12 diff -C2 -d -r2.10.8.11 -r2.10.8.12 *** symtable.c 25 Mar 2003 21:23:39 -0000 2.10.8.11 --- symtable.c 27 Mar 2003 20:31:30 -0000 2.10.8.12 *************** *** 775,782 **** VISIT_SEQ(st, expr, e->v.Dict.values); break; ! case ListComp_kind: VISIT(st, expr, e->v.ListComp.target); VISIT_SEQ(st, listcomp, e->v.ListComp.generators); break; case Compare_kind: VISIT(st, expr, e->v.Compare.left); --- 775,791 ---- VISIT_SEQ(st, expr, e->v.Dict.values); break; ! case ListComp_kind: { ! char tmpname[256]; ! identifier tmp; ! ! PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ! ++st->st_cur->ste_tmpname); ! tmp = PyString_FromString(tmpname); ! if (!symtable_add_def(st, tmp, DEF_LOCAL)) ! return 0; VISIT(st, expr, e->v.ListComp.target); VISIT_SEQ(st, listcomp, e->v.ListComp.generators); break; + } case Compare_kind: VISIT(st, expr, e->v.Compare.left); Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.39 retrieving revision 1.1.2.40 diff -C2 -d -r1.1.2.39 -r1.1.2.40 *** newcompile.c 25 Mar 2003 22:26:15 -0000 1.1.2.39 --- newcompile.c 27 Mar 2003 20:31:32 -0000 1.1.2.40 *************** *** 30,41 **** PyObject *u_name; ! PyObject *u_consts; ! PyObject *u_names; ! PyObject *u_varnames; ! int u_argcount; ! int u_nblocks; ! int u_nalloc; ! int u_curblock; struct basicblock u_exit; struct basicblock **u_blocks; --- 30,48 ---- PyObject *u_name; ! /* The following fields are dicts that map objects to ! the index of them in co_XXX. The index is used as ! the argument for opcodes that refer to those collections. ! */ ! PyObject *u_consts; /* all constants */ ! PyObject *u_names; /* all names */ ! PyObject *u_varnames; /* local variables */ ! int u_argcount; /* number of arguments for block */ ! int u_nblocks; /* number of used blocks in u_blocks ! u_nblocks < u_nalloc */ ! int u_nalloc; /* current alloc count for u_blocks */ ! int u_curblock; /* index of current block in u_blocks */ ! int u_tmpname; /* temporary variables for list comps */ ! identifier u_tmp; /* name for u_tmpname */ struct basicblock u_exit; struct basicblock **u_blocks; *************** *** 83,88 **** static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); ! static int compiler_visit_slice(struct compiler *c, slice_ty s, ! expr_context_ty ctx); static int compiler_push_fblock(struct compiler *, enum fblocktype, int); --- 90,96 ---- static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); ! static int compiler_visit_slice(struct compiler *, slice_ty, ! expr_context_ty); ! static int compiler_visit_listcomp(struct compiler *, listcomp_ty); static int compiler_push_fblock(struct compiler *, enum fblocktype, int); *************** *** 1291,1294 **** --- 1299,1330 ---- + static int + compiler_listcomp(struct compiler *c, expr_ty e) + { + char tmpname[256]; + identifier tmp; + static identifier append; + + assert(e->kind == ListComp_kind); + if (!append) { + append = PyString_InternFromString("append"); + if (!append) + return 0; + } + PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", + ++c->u->u_tmpname); + tmp = PyString_FromString(tmpname); + if (!tmp) + return 0; + ADDOP_I(c, BUILD_LIST, 0); + ADDOP(c, DUP_TOP); + ADDOP_O(c, LOAD_ATTR, append, names); + if (!compiler_nameop(c, tmp, Store)) + return 0; + c->u->u_tmp = tmp; + VISIT_SEQ(c, listcomp, e->v.ListComp.generators); + c->u->u_tmp = NULL; + return 1; + } static int *************** *** 1327,1330 **** --- 1363,1367 ---- break; case ListComp_kind: + return compiler_listcomp(c, e); break; case Compare_kind: *************** *** 1458,1461 **** --- 1495,1577 ---- static int + compiler_visit_listcomp(struct compiler *c, listcomp_ty l) + { + /* generate code for the iterator, then each of the ifs, + and then write to the target */ + + int start, anchor, skip, i, n; + expr_ty load_target; + + /* The target must be valid in an assignment context, + which limits the kinds of expressions that are valid. + We need to load and store the target, which means it + must be visited in two contexts. The ast provides + a store context, so create a copy for use in the load + context. + */ + switch (l->target->kind) { + case Attribute_kind: + load_target = Attribute(l->target->v.Attribute.value, + l->target->v.Attribute.attr, + Load); + break; + case Subscript_kind: + load_target = Subscript(l->target->v.Subscript.value, + l->target->v.Subscript.slice, + Load); + break; + case Name_kind: + load_target = Name(l->target->v.Name.id, Load); + break; + case List_kind: + load_target = List(l->target->v.List.elts, Load); + break; + case Tuple_kind: + load_target = Tuple(l->target->v.Tuple.elts, Load); + break; + default: + PyErr_Format(PyExc_SyntaxError, + "invalid list comp target: kind %d\n", + l->target->kind); + return 0; + } + + start = compiler_new_block(c); + skip = compiler_new_block(c); + anchor = compiler_new_block(c); + + VISIT(c, expr, l->iter); + ADDOP(c, GET_ITER); + compiler_use_next_block(c, start); + ADDOP_JREL(c, FOR_ITER, anchor); + NEXT_BLOCK(c); + VISIT(c, expr, l->target); + + n = asdl_seq_LEN(l->ifs); + for (i = 0; i < n; i++) { + expr_ty e = asdl_seq_GET(l->ifs, i); + VISIT(c, expr, e); + /* XXX not anchor? */ + ADDOP_JREL(c, JUMP_IF_FALSE, skip); + NEXT_BLOCK(c); + ADDOP(c, DUP_TOP); + } + + if (!compiler_nameop(c, c->u->u_tmp, Load)) + return 0; + VISIT(c, expr, load_target); + ADDOP_I(c, CALL_FUNCTION, 1); + ADDOP(c, POP_TOP); + + compiler_use_next_block(c, skip); + ADDOP_JABS(c, JUMP_ABSOLUTE, start); + compiler_use_next_block(c, anchor); + if (!compiler_nameop(c, c->u->u_tmp, Del)) + return 0; + + return 1; + } + + static int compiler_push_fblock(struct compiler *c, enum fblocktype t, int b) { *************** *** 1696,1703 **** } code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; ! fprintf(stderr, ! "emit %3d %-15s %5d\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], ! i->i_oparg, a->a_offset, size, ext); a->a_offset += size; if (ext > 0) { --- 1812,1825 ---- } code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; ! if (i->i_hasarg) ! fprintf(stderr, ! "emit %3d %-15s %5d\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], ! i->i_oparg, a->a_offset, size, ext); ! else ! fprintf(stderr, ! "emit %3d %-15s %s\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], ! " ", a->a_offset, size, ext); a->a_offset += size; if (ext > 0) { *************** *** 1844,1849 **** for (i = a.a_nblocks - 1; i >= 0; i--) { struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; ! fprintf(stderr, "block %d(%d): used=%d alloc=%d next=%d\n", ! i, a.a_postorder[i], b->b_iused, b->b_ialloc, b->b_next); for (j = 0; j < b->b_iused; j++) { if (!assemble_emit(&a, &b->b_instr[j])) --- 1966,1973 ---- for (i = a.a_nblocks - 1; i >= 0; i--) { struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; ! fprintf(stderr, ! "block %d: order=%d used=%d alloc=%d next=%d\n", ! i, a.a_postorder[i], b->b_iused, b->b_ialloc, ! b->b_next); for (j = 0; j < b->b_iused; j++) { if (!assemble_emit(&a, &b->b_instr[j])) From jhylton@users.sourceforge.net Thu Mar 27 20:44:45 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 27 Mar 2003 12:44:45 -0800 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.9.18.6,2.9.18.7 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv27787 Modified Files: Tag: ast-branch symtable.h Log Message: Add tmpname to symtable to handle implicit list comp vars. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9.18.6 retrieving revision 2.9.18.7 diff -C2 -d -r2.9.18.6 -r2.9.18.7 *** symtable.h 21 Oct 2002 21:26:52 -0000 2.9.18.6 --- symtable.h 27 Mar 2003 20:44:40 -0000 2.9.18.7 *************** *** 38,41 **** --- 38,42 ---- int ste_lineno; /* first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ + int ste_tmpname; /* counter for listcomp temp vars */ struct symtable *ste_table; } PySTEntryObject; From nascheme@users.sourceforge.net Fri Mar 28 02:05:30 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Thu, 27 Mar 2003 18:05:30 -0800 Subject: [Python-checkins] python/dist/src/Include Python-ast.h,1.1.2.6,1.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv5622/Include Modified Files: Tag: ast-branch Python-ast.h Log Message: Change ListComp node ("elt" seems more clear than "target"). Regenerate C files. Index: Python-ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/Python-ast.h,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** Python-ast.h 25 Mar 2003 15:53:01 -0000 1.1.2.6 --- Python-ast.h 28 Mar 2003 02:05:28 -0000 1.1.2.7 *************** *** 1,3 **** ! /* File automatically generated by Parser/asdl_c.py */ #include "asdl.h" --- 1,3 ---- ! /* File automatically generated by ../Parser/asdl_c.py */ #include "asdl.h" *************** *** 211,215 **** struct { ! expr_ty target; asdl_seq *generators; } ListComp; --- 211,215 ---- struct { ! expr_ty elt; asdl_seq *generators; } ListComp; *************** *** 358,362 **** expr_ty Lambda(arguments_ty args, expr_ty body); expr_ty Dict(asdl_seq * keys, asdl_seq * values); ! expr_ty ListComp(expr_ty target, asdl_seq * generators); expr_ty Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators); expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty --- 358,362 ---- expr_ty Lambda(arguments_ty args, expr_ty body); expr_ty Dict(asdl_seq * keys, asdl_seq * values); ! expr_ty ListComp(expr_ty elt, asdl_seq * generators); expr_ty Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators); expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty From nascheme@users.sourceforge.net Fri Mar 28 02:05:30 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Thu, 27 Mar 2003 18:05:30 -0800 Subject: [Python-checkins] python/dist/src/Parser Python.asdl,1.1.2.6,1.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv5622/Parser Modified Files: Tag: ast-branch Python.asdl Log Message: Change ListComp node ("elt" seems more clear than "target"). Regenerate C files. Index: Python.asdl =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/Python.asdl,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** Python.asdl 25 Mar 2003 15:53:02 -0000 1.1.2.6 --- Python.asdl 28 Mar 2003 02:05:27 -0000 1.1.2.7 *************** *** 53,57 **** | Lambda(arguments args, expr body) | Dict(expr* keys, expr *values) ! | ListComp(expr target, listcomp* generators) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 --- 53,57 ---- | Lambda(arguments args, expr body) | Dict(expr* keys, expr *values) ! | ListComp(expr elt, listcomp* generators) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 From nascheme@users.sourceforge.net Fri Mar 28 02:05:31 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Thu, 27 Mar 2003 18:05:31 -0800 Subject: [Python-checkins] python/dist/src/Python Python-ast.c,1.1.2.6,1.1.2.7 ast.c,1.1.2.20,1.1.2.21 symtable.c,2.10.8.12,2.10.8.13 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5622/Python Modified Files: Tag: ast-branch Python-ast.c ast.c symtable.c Log Message: Change ListComp node ("elt" seems more clear than "target"). Regenerate C files. Index: Python-ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/Python-ast.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** Python-ast.c 25 Mar 2003 15:53:03 -0000 1.1.2.6 --- Python-ast.c 28 Mar 2003 02:05:28 -0000 1.1.2.7 *************** *** 1,3 **** ! /* File automatically generated by Parser/asdl_c.py */ #include "Python.h" --- 1,3 ---- ! /* File automatically generated by ../Parser/asdl_c.py */ #include "Python.h" *************** *** 631,640 **** expr_ty ! ListComp(expr_ty target, asdl_seq * generators) { expr_ty p; ! if (!target) { PyErr_SetString(PyExc_ValueError, ! "field target is required for ListComp"); return NULL; } --- 631,640 ---- expr_ty ! ListComp(expr_ty elt, asdl_seq * generators) { expr_ty p; ! if (!elt) { PyErr_SetString(PyExc_ValueError, ! "field elt is required for ListComp"); return NULL; } *************** *** 645,649 **** } p->kind = ListComp_kind; ! p->v.ListComp.target = target; p->v.ListComp.generators = generators; return p; --- 645,649 ---- } p->kind = ListComp_kind; ! p->v.ListComp.elt = elt; p->v.ListComp.generators = generators; return p; *************** *** 1387,1391 **** case ListComp_kind: marshal_write_int(buf, off, 6); ! marshal_write_expr(buf, off, o->v.ListComp.target); marshal_write_int(buf, off, asdl_seq_LEN(o->v.ListComp.generators)); --- 1387,1391 ---- case ListComp_kind: marshal_write_int(buf, off, 6); ! marshal_write_expr(buf, off, o->v.ListComp.elt); marshal_write_int(buf, off, asdl_seq_LEN(o->v.ListComp.generators)); *************** *** 1403,1407 **** for (i = 0; i < asdl_seq_LEN(o->v.Compare.ops); i++) { void *elt = asdl_seq_GET(o->v.Compare.ops, i); ! marshal_write_cmpop(buf, off, (cmpop_ty)elt); } marshal_write_int(buf, off, --- 1403,1407 ---- for (i = 0; i < asdl_seq_LEN(o->v.Compare.ops); i++) { void *elt = asdl_seq_GET(o->v.Compare.ops, i); ! marshal_write_cmpop(buf, off, (cmpop_ty) elt); } marshal_write_int(buf, off, Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.20 retrieving revision 1.1.2.21 diff -C2 -d -r1.1.2.20 -r1.1.2.21 *** ast.c 25 Mar 2003 22:21:20 -0000 1.1.2.20 --- ast.c 28 Mar 2003 02:05:28 -0000 1.1.2.21 *************** *** 169,174 **** if (stmts) asdl_seq_free(stmts); ! fprintf(stderr, "error in PyAST_FromNode() exc? %d\n", ! PyErr_Occurred()); return NULL; } --- 169,174 ---- if (stmts) asdl_seq_free(stmts); ! fprintf(stderr, "error in PyAST_FromNode() exc?\n"); ! PyErr_Occurred(); return NULL; } *************** *** 493,497 **** testlist_safe: test [(',' test)+ [',']] */ ! expr_ty target; asdl_seq *listcomps; int i, n_fors; --- 493,497 ---- testlist_safe: test [(',' test)+ [',']] */ ! expr_ty elt; asdl_seq *listcomps; int i, n_fors; *************** *** 501,508 **** assert(NCH(n) > 1); ! target = ast_for_expr(CHILD(n, 0)); ! if (!target) return NULL; ! set_context(target, Store); n_fors = count_list_fors(n); --- 501,508 ---- assert(NCH(n) > 1); ! elt = ast_for_expr(CHILD(n, 0)); ! if (!elt) return NULL; ! set_context(elt, Load); n_fors = count_list_fors(n); *************** *** 541,545 **** } ! return ListComp(target, listcomps); } --- 541,545 ---- } ! return ListComp(elt, listcomps); } Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.12 retrieving revision 2.10.8.13 diff -C2 -d -r2.10.8.12 -r2.10.8.13 *** symtable.c 27 Mar 2003 20:31:30 -0000 2.10.8.12 --- symtable.c 28 Mar 2003 02:05:28 -0000 2.10.8.13 *************** *** 784,788 **** if (!symtable_add_def(st, tmp, DEF_LOCAL)) return 0; ! VISIT(st, expr, e->v.ListComp.target); VISIT_SEQ(st, listcomp, e->v.ListComp.generators); break; --- 784,788 ---- if (!symtable_add_def(st, tmp, DEF_LOCAL)) return 0; ! VISIT(st, expr, e->v.ListComp.elt); VISIT_SEQ(st, listcomp, e->v.ListComp.generators); break; From nascheme@users.sourceforge.net Fri Mar 28 02:08:01 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Thu, 27 Mar 2003 18:08:01 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.40,1.1.2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv6637/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Fix code generation for assignments to tuples and lists. Partially fix code generation for listcomps. Having more than one "for" still doesn't work correctly. Remove redundant break statements. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.40 retrieving revision 1.1.2.41 diff -C2 -d -r1.1.2.40 -r1.1.2.41 *** newcompile.c 27 Mar 2003 20:31:32 -0000 1.1.2.40 --- newcompile.c 28 Mar 2003 02:07:58 -0000 1.1.2.41 *************** *** 92,96 **** static int compiler_visit_slice(struct compiler *, slice_ty, expr_context_ty); - static int compiler_visit_listcomp(struct compiler *, listcomp_ty); static int compiler_push_fblock(struct compiler *, enum fblocktype, int); --- 92,95 ---- *************** *** 820,824 **** return compiler_error(c, "'continue' not allowed in 'finally' block"); - break; } --- 819,822 ---- *************** *** 949,965 **** case AugAssign_kind: return compiler_augassign(c, s); - break; case Print_kind: return compiler_print(c, s); - break; case For_kind: return compiler_for(c, s); - break; case While_kind: return compiler_while(c, s); - break; case If_kind: return compiler_if(c, s); - break; case Raise_kind: n = 0; --- 947,958 ---- *************** *** 1199,1203 **** ADDOP_O(c, op, name, varnames); return 1; - break; case OP_GLOBAL: switch (ctx) { --- 1192,1195 ---- *************** *** 1264,1267 **** --- 1256,1287 ---- static int + compiler_list(struct compiler *c, expr_ty e) + { + int n = asdl_seq_LEN(e->v.List.elts); + if (e->v.List.ctx == Store) { + ADDOP_I(c, UNPACK_SEQUENCE, n); + } + VISIT_SEQ(c, expr, e->v.List.elts); + if (e->v.List.ctx == Load) { + ADDOP_I(c, BUILD_LIST, n); + } + return 1; + } + + static int + compiler_tuple(struct compiler *c, expr_ty e) + { + int n = asdl_seq_LEN(e->v.Tuple.elts); + if (e->v.Tuple.ctx == Store) { + ADDOP_I(c, UNPACK_SEQUENCE, n); + } + VISIT_SEQ(c, expr, e->v.Tuple.elts); + if (e->v.Tuple.ctx == Load) { + ADDOP_I(c, BUILD_TUPLE, n); + } + return 1; + } + + static int compiler_compare(struct compiler *c, expr_ty e) { *************** *** 1298,1308 **** --- 1318,1373 ---- } + static int + compiler_listcomp_generator(struct compiler *c, listcomp_ty l, expr_ty elt) + { + /* generate code for the iterator, then each of the ifs, + and then write to the element */ + + int start, anchor, skip, i, n; + + start = compiler_new_block(c); + skip = compiler_new_block(c); + anchor = compiler_new_block(c); + + VISIT(c, expr, l->iter); + ADDOP(c, GET_ITER); + compiler_use_next_block(c, start); + ADDOP_JREL(c, FOR_ITER, anchor); + NEXT_BLOCK(c); + VISIT(c, expr, l->target); + + n = asdl_seq_LEN(l->ifs); + for (i = 0; i < n; i++) { + expr_ty e = asdl_seq_GET(l->ifs, i); + VISIT(c, expr, e); + /* XXX not anchor? */ + ADDOP_JREL(c, JUMP_IF_FALSE, skip); + NEXT_BLOCK(c); + ADDOP(c, DUP_TOP); + } + + if (!compiler_nameop(c, c->u->u_tmp, Load)) + return 0; + VISIT(c, expr, elt); + ADDOP_I(c, CALL_FUNCTION, 1); + ADDOP(c, POP_TOP); + + compiler_use_next_block(c, skip); + ADDOP_JABS(c, JUMP_ABSOLUTE, start); + compiler_use_next_block(c, anchor); + if (!compiler_nameop(c, c->u->u_tmp, Del)) + return 0; + + return 1; + } static int compiler_listcomp(struct compiler *c, expr_ty e) { + int i; char tmpname[256]; identifier tmp; static identifier append; + asdl_seq *generators = e->v.ListComp.generators; assert(e->kind == ListComp_kind); *************** *** 1323,1327 **** return 0; c->u->u_tmp = tmp; ! VISIT_SEQ(c, listcomp, e->v.ListComp.generators); c->u->u_tmp = NULL; return 1; --- 1388,1397 ---- return 0; c->u->u_tmp = tmp; ! for (i = 0; i < asdl_seq_LEN(generators); i++) { ! if (!compiler_listcomp_generator(c, ! asdl_seq_GET(generators, i), ! e->v.ListComp.elt)) ! return 0; ! } c->u->u_tmp = NULL; return 1; *************** *** 1336,1340 **** case BoolOp_kind: return compiler_boolop(c, e); - break; case BinOp_kind: VISIT(c, expr, e->v.BinOp.left); --- 1406,1409 ---- *************** *** 1364,1371 **** case ListComp_kind: return compiler_listcomp(c, e); - break; case Compare_kind: return compiler_compare(c, e); - break; case Call_kind: VISIT(c, expr, e->v.Call.func); --- 1433,1438 ---- *************** *** 1438,1451 **** case Name_kind: return compiler_name(c, e); - break; /* child nodes of List and Tuple will have expr_context set */ case List_kind: ! VISIT_SEQ(c, expr, e->v.List.elts); ! ADDOP_I(c, BUILD_LIST, asdl_seq_LEN(e->v.List.elts)); ! break; case Tuple_kind: ! VISIT_SEQ(c, expr, e->v.Tuple.elts); ! ADDOP_I(c, BUILD_TUPLE, asdl_seq_LEN(e->v.Tuple.elts)); ! break; } return 1; --- 1505,1513 ---- case Name_kind: return compiler_name(c, e); /* child nodes of List and Tuple will have expr_context set */ case List_kind: ! return compiler_list(c, e); case Tuple_kind: ! return compiler_tuple(c, e); } return 1; *************** *** 1486,1573 **** ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); return compiler_nameop(c, e->v.Name.id, Store); - break; default: fprintf(stderr, "invalid node type for augmented assignment\n"); return 0; } - return 1; - } - - static int - compiler_visit_listcomp(struct compiler *c, listcomp_ty l) - { - /* generate code for the iterator, then each of the ifs, - and then write to the target */ - - int start, anchor, skip, i, n; - expr_ty load_target; - - /* The target must be valid in an assignment context, - which limits the kinds of expressions that are valid. - We need to load and store the target, which means it - must be visited in two contexts. The ast provides - a store context, so create a copy for use in the load - context. - */ - switch (l->target->kind) { - case Attribute_kind: - load_target = Attribute(l->target->v.Attribute.value, - l->target->v.Attribute.attr, - Load); - break; - case Subscript_kind: - load_target = Subscript(l->target->v.Subscript.value, - l->target->v.Subscript.slice, - Load); - break; - case Name_kind: - load_target = Name(l->target->v.Name.id, Load); - break; - case List_kind: - load_target = List(l->target->v.List.elts, Load); - break; - case Tuple_kind: - load_target = Tuple(l->target->v.Tuple.elts, Load); - break; - default: - PyErr_Format(PyExc_SyntaxError, - "invalid list comp target: kind %d\n", - l->target->kind); - return 0; - } - - start = compiler_new_block(c); - skip = compiler_new_block(c); - anchor = compiler_new_block(c); - - VISIT(c, expr, l->iter); - ADDOP(c, GET_ITER); - compiler_use_next_block(c, start); - ADDOP_JREL(c, FOR_ITER, anchor); - NEXT_BLOCK(c); - VISIT(c, expr, l->target); - - n = asdl_seq_LEN(l->ifs); - for (i = 0; i < n; i++) { - expr_ty e = asdl_seq_GET(l->ifs, i); - VISIT(c, expr, e); - /* XXX not anchor? */ - ADDOP_JREL(c, JUMP_IF_FALSE, skip); - NEXT_BLOCK(c); - ADDOP(c, DUP_TOP); - } - - if (!compiler_nameop(c, c->u->u_tmp, Load)) - return 0; - VISIT(c, expr, load_target); - ADDOP_I(c, CALL_FUNCTION, 1); - ADDOP(c, POP_TOP); - - compiler_use_next_block(c, skip); - ADDOP_JABS(c, JUMP_ABSOLUTE, start); - compiler_use_next_block(c, anchor); - if (!compiler_nameop(c, c->u->u_tmp, Del)) - return 0; - return 1; } --- 1548,1555 ---- From rhettinger@users.sourceforge.net Fri Mar 28 12:05:05 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 28 Mar 2003 04:05:05 -0800 Subject: [Python-checkins] python/dist/src/Python compile.c,2.277,2.278 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv7004 Modified Files: compile.c Log Message: Factored out test for absolute jumps. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.277 retrieving revision 2.278 diff -C2 -d -r2.277 -r2.278 *** compile.c 26 Mar 2003 01:07:54 -0000 2.277 --- compile.c 28 Mar 2003 12:05:00 -0000 2.278 *************** *** 326,330 **** #define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1])) #define UNCONDITIONAL_JUMP(op) (op==JUMP_ABSOLUTE || op==JUMP_FORWARD) ! #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (arr[i]==JUMP_ABSOLUTE ? 0 : i+3)) #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 --- 326,331 ---- #define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1])) #define UNCONDITIONAL_JUMP(op) (op==JUMP_ABSOLUTE || op==JUMP_FORWARD) ! #define ABSOLUTE_JUMP(op) (op==JUMP_ABSOLUTE || op==CONTINUE_LOOP) ! #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3)) #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 *************** *** 395,399 **** if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */ opcode = JUMP_ABSOLUTE; ! if (opcode != JUMP_ABSOLUTE && opcode != CONTINUE_LOOP) tgttgt -= i + 3; /* Calc relative jump addr */ if (tgttgt < 0) /* No backward relative jumps */ --- 396,400 ---- if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */ opcode = JUMP_ABSOLUTE; ! if (!ABSOLUTE_JUMP(opcode)) tgttgt -= i + 3; /* Calc relative jump addr */ if (tgttgt < 0) /* No backward relative jumps */ From jhylton@users.sourceforge.net Fri Mar 28 16:20:04 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 28 Mar 2003 08:20:04 -0800 Subject: [Python-checkins] python/dist/src/Python compile.txt,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv6778 Modified Files: Tag: ast-branch compile.txt Log Message: Flesh out the notes a little. Index: compile.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/compile.txt,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** compile.txt 25 Mar 2003 03:38:11 -0000 1.1.2.2 --- compile.txt 28 Mar 2003 16:19:59 -0000 1.1.2.3 *************** *** 97,108 **** call function compiler_xxx where xxx is kind name for others. ! - use VISIT macro to invoke compiler_visit_XXX ! - user VISIT_SEQ macro to invoke compiler_visit_XXX for a sequence ! of type XXX - all functions return true on success, false on failure ! - code generator uses basic blocks - each block has single entry point --- 97,120 ---- call function compiler_xxx where xxx is kind name for others. ! The macros used to emit specific opcodes and to generate code for ! generic node types use string concatenation to produce calls to the ! appropriate C function for the type of the object. ! The VISIT macro generates code for an arbitrary node type, by calling ! an appropriate compiler_visit_TYPE function. The VISIT_SEQ macro ! calls the visit function for each element of a sequence. The VISIT ! macros take three arguments: ! ! - the current struct compiler ! - the name of the node's type (expr, stmt, ...) ! - the actual node reference ! ! The name of the node's type correspond to the names in the asdl ! definition. The string concatenation is used to allow a single VISIT ! macro to generate calls with the correct type. - all functions return true on success, false on failure ! Code is generate using a simple basic block interface. - each block has single entry point *************** *** 116,123 **** (used for generating jumps) ! - code generated with ADDOP macros add opcode to current block ! ADDOP() -- opcode with no arguments ! ADDOP_O() -- oparg is a PyObject * ! ADDOP_I() -- oparg is a number ADDOP_JABS() -- oparg is an absolute jump to block id ADDOP_JREL() -- oparg is a relative jump to block id --- 128,147 ---- (used for generating jumps) ! - There are five macros for generating opcodes in the current basic ! block. Each takes the current struct compiler * as the first ! argument and an opcode name as the second argument. ! ! ADDOP(c, opcode) -- opcode with no arguments ! ADDOP_I(c, opcode, oparg) -- oparg is a C int ! ADDOP_O(c, opcode, oparg, namespace) -- oparg is a PyObject * ! namespace is the name of a code object member that contains ! the set of objects. For example, ! ADDOP_O(c, LOAD_CONST, obj, consts) ! will make sure that obj is in co_consts and that the opcode ! argument will be an index into co_consts. The valid names ! are consts, names, varnames, ... ! ! - Explain what each namespace is for. ! ADDOP_JABS() -- oparg is an absolute jump to block id ADDOP_JREL() -- oparg is a relative jump to block id From ping@users.sourceforge.net Fri Mar 28 16:28:53 2003 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Fri, 28 Mar 2003 08:28:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/hotshot stones.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory sc8-pr-cvs1:/tmp/cvs-serv11288/hotshot Modified Files: stones.py Log Message: Move testing code into "if __name__ == '__main__'" so it's not run on import. Index: stones.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/stones.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stones.py 9 Aug 2002 16:37:34 -0000 1.2 --- stones.py 28 Mar 2003 16:28:48 -0000 1.3 *************** *** 6,31 **** import test.pystone ! if sys.argv[1:]: ! logfile = sys.argv[1] ! else: ! import tempfile ! logf = tempfile.NamedTemporaryFile() ! logfile = logf.name ! ! p = hotshot.Profile(logfile) ! benchtime, stones = p.runcall(test.pystone.pystones) ! p.close() ! print "Pystone(%s) time for %d passes = %g" % \ ! (test.pystone.__version__, test.pystone.LOOPS, benchtime) ! print "This machine benchmarks at %g pystones/second" % stones ! stats = hotshot.stats.load(logfile) ! stats.strip_dirs() ! stats.sort_stats('time', 'calls') ! try: ! stats.print_stats(20) ! except IOError, e: ! if e.errno != errno.EPIPE: ! raise --- 6,31 ---- import test.pystone + def main(logfile): + p = hotshot.Profile(logfile) + benchtime, stones = p.runcall(test.pystone.pystones) + p.close() ! print "Pystone(%s) time for %d passes = %g" % \ ! (test.pystone.__version__, test.pystone.LOOPS, benchtime) ! print "This machine benchmarks at %g pystones/second" % stones ! stats = hotshot.stats.load(logfile) ! stats.strip_dirs() ! stats.sort_stats('time', 'calls') ! try: ! stats.print_stats(20) ! except IOError, e: ! if e.errno != errno.EPIPE: ! raise ! if __name__ == '__main__': ! if sys.argv[1:]: ! main(sys.argv[1]) ! else: ! import tempfile ! main(tempfile.NamedTemporaryFile().name) From ping@users.sourceforge.net Fri Mar 28 16:29:54 2003 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Fri, 28 Mar 2003 08:29:54 -0800 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13580 Modified Files: inspect.py Log Message: Make module lookup a little more robust (certain kinds of fiddling to sys.modules previously produced an exception). Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** inspect.py 19 Jan 2003 13:21:20 -0000 1.41 --- inspect.py 28 Mar 2003 16:29:50 -0000 1.42 *************** *** 367,376 **** return None if file in modulesbyfile: ! return sys.modules[modulesbyfile[file]] for module in sys.modules.values(): if hasattr(module, '__file__'): modulesbyfile[getabsfile(module)] = module.__name__ if file in modulesbyfile: ! return sys.modules[modulesbyfile[file]] main = sys.modules['__main__'] if hasattr(main, object.__name__): --- 367,376 ---- return None if file in modulesbyfile: ! return sys.modules.get(modulesbyfile[file]) for module in sys.modules.values(): if hasattr(module, '__file__'): modulesbyfile[getabsfile(module)] = module.__name__ if file in modulesbyfile: ! return sys.modules.get(modulesbyfile[file]) main = sys.modules['__main__'] if hasattr(main, object.__name__): From ping@users.sourceforge.net Fri Mar 28 16:35:58 2003 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Fri, 28 Mar 2003 08:35:58 -0800 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14702 Modified Files: pydoc.py Log Message: Hide private names beginning with _ (but don't hide __special__ names). Clean up section headings; make the bars on the left less fat. Adjust the display of properties slightly. Don't show stuff inherited from the base 'object' type. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** pydoc.py 1 Mar 2003 15:22:41 -0000 1.79 --- pydoc.py 28 Mar 2003 16:35:51 -0000 1.80 *************** *** 45,49 **** # path will be displayed. ! import sys, imp, os, re, types, inspect from repr import Repr from string import expandtabs, find, join, lower, split, strip, rfind, rstrip --- 45,49 ---- # path will be displayed. ! import sys, imp, os, re, types, inspect, __builtin__ from repr import Repr from string import expandtabs, find, join, lower, split, strip, rfind, rstrip *************** *** 143,146 **** --- 143,155 ---- return yes, no + def visiblename(name): + """Decide whether to show documentation on a variable.""" + # Certain special names are redundant. + if name in ['__builtins__', '__doc__', '__file__', '__path__', + '__module__', '__name__']: return 0 + # Private names are hidden, but special names are displayed. + if name.startswith('__') and name.endswith('__'): return 1 + return not name.startswith('_') + # ----------------------------------------------------- module manipulation *************** *** 338,344 **** Python: %s ! %s ''' % (title, contents) --- 347,351 ---- Python: %s ! %s ''' % (title, contents) *************** *** 355,364 **** ''' % (bgcol, fgcol, title, fgcol, extras or ' ') ! def section(self, title, fgcol, bgcol, contents, width=10, ! prelude='', marginalia=None, gap='  '): """Format a section with a heading.""" if marginalia is None: marginalia = '' + ' ' * width + '' ! result = ''' --- 362,371 ---- ''' % (bgcol, fgcol, title, fgcol, extras or ' ') ! def section(self, title, fgcol, bgcol, contents, width=6, ! prelude='', marginalia=None, gap=' '): """Format a section with a heading.""" if marginalia is None: marginalia = '' + ' ' * width + '' ! result = '''

      *************** *** 530,535 **** for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! classes.append((key, value)) ! cdict[key] = cdict[value] = '#' + key for key, value in classes: for base in value.__bases__: --- 537,543 ---- for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! if visiblename(key): ! classes.append((key, value)) ! cdict[key] = cdict[value] = '#' + key for key, value in classes: for base in value.__bases__: *************** *** 543,552 **** for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! funcs.append((key, value)) ! fdict[key] = '#-' + key ! if inspect.isfunction(value): fdict[value] = fdict[key] data = [] for key, value in inspect.getmembers(object, isdata): ! if key not in ['__builtins__', '__doc__']: data.append((key, value)) --- 551,561 ---- for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! if visiblename(key): ! funcs.append((key, value)) ! fdict[key] = '#-' + key ! if inspect.isfunction(value): fdict[value] = fdict[key] data = [] for key, value in inspect.getmembers(object, isdata): ! if visiblename(key): data.append((key, value)) *************** *** 561,569 **** path = os.path.join(object.__path__[0], file) modname = inspect.getmodulename(file) ! if modname and modname not in modnames: ! modpkgs.append((modname, name, 0, 0)) ! modnames.append(modname) ! elif ispackage(path): ! modpkgs.append((file, name, 1, 0)) modpkgs.sort() contents = self.multicolumn(modpkgs, self.modpkglink) --- 570,579 ---- path = os.path.join(object.__path__[0], file) modname = inspect.getmodulename(file) ! if modname != '__init__': ! if modname and modname not in modnames: ! modpkgs.append((modname, name, 0, 0)) ! modnames.append(modname) ! elif ispackage(path): ! modpkgs.append((file, name, 1, 0)) modpkgs.sort() contents = self.multicolumn(modpkgs, self.modpkglink) *************** *** 659,668 **** funcs, classes, mdict) push('
      %s
      \n' % doc) ! for attr, tag in [("fget", " getter"), ! ("fset", " setter"), ! ("fdel", " deleter")]: func = getattr(value, attr) if func is not None: ! base = self.document(func, name + tag, mod, funcs, classes, mdict, object) push('
      %s
      \n' % base) --- 669,678 ---- funcs, classes, mdict) push('
      %s
      \n' % doc) ! for attr, tag in [('fget', 'get'), ! ('fset', 'set'), ! ('fdel', 'delete')]: func = getattr(value, attr) if func is not None: ! base = self.document(func, tag, mod, funcs, classes, mdict, object) push('
      %s
      \n' % base) *************** *** 691,695 **** return attrs ! attrs = inspect.classify_class_attrs(object) mdict = {} for key, kind, homecls, value in attrs: --- 701,706 ---- return attrs ! attrs = filter(lambda (name, kind, cls, value): visiblename(name), ! inspect.classify_class_attrs(object)) mdict = {} for key, kind, homecls, value in attrs: *************** *** 710,718 **** attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) ! if thisclass is object: ! tag = "defined here" else: ! tag = "inherited from %s" % self.classlink(thisclass, ! object.__module__) tag += ':
      \n' --- 721,732 ---- attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) ! if thisclass is __builtin__.object: ! attrs = inherited ! continue ! elif thisclass is object: ! tag = 'defined here' else: ! tag = 'inherited from %s' % self.classlink(thisclass, ! object.__module__) tag += ':
      \n' *************** *** 721,733 **** # Pump out the attrs, segregated by kind. ! attrs = spill("Methods %s" % tag, attrs, lambda t: t[1] == 'method') ! attrs = spill("Class methods %s" % tag, attrs, lambda t: t[1] == 'class method') ! attrs = spill("Static methods %s" % tag, attrs, lambda t: t[1] == 'static method') ! attrs = spillproperties("Properties %s" % tag, attrs, lambda t: t[1] == 'property') ! attrs = spilldata("Data and non-method functions %s" % tag, attrs, lambda t: t[1] == 'data') assert attrs == [] --- 735,747 ---- # Pump out the attrs, segregated by kind. ! attrs = spill('Methods %s' % tag, attrs, lambda t: t[1] == 'method') ! attrs = spill('Class methods %s' % tag, attrs, lambda t: t[1] == 'class method') ! attrs = spill('Static methods %s' % tag, attrs, lambda t: t[1] == 'static method') ! attrs = spillproperties('Properties %s' % tag, attrs, lambda t: t[1] == 'property') ! attrs = spilldata('Data and other attributes %s' % tag, attrs, lambda t: t[1] == 'data') assert attrs == [] *************** *** 748,754 **** title = title + '(%s)' % join(parents, ', ') doc = self.markup(getdoc(object), self.preformat, funcs, classes, mdict) ! doc = doc and '%s
       
      ' % doc or ' ' ! return self.section(title, '#000000', '#ffc8d8', contents, 5, doc) def formatvalue(self, object): --- 762,768 ---- title = title + '(%s)' % join(parents, ', ') doc = self.markup(getdoc(object), self.preformat, funcs, classes, mdict) ! doc = doc and '%s
       
      ' % doc ! return self.section(title, '#000000', '#ffc8d8', contents, 3, doc) def formatvalue(self, object): *************** *** 936,947 **** for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! classes.append((key, value)) funcs = [] for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! funcs.append((key, value)) data = [] for key, value in inspect.getmembers(object, isdata): ! if key not in ['__builtins__', '__doc__']: data.append((key, value)) --- 950,963 ---- for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! if visiblename(key): ! classes.append((key, value)) funcs = [] for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! if visiblename(key): ! funcs.append((key, value)) data = [] for key, value in inspect.getmembers(object, isdata): ! if visiblename(key): data.append((key, value)) *************** *** 951,958 **** path = os.path.join(object.__path__[0], file) modname = inspect.getmodulename(file) ! if modname and modname not in modpkgs: ! modpkgs.append(modname) ! elif ispackage(path): ! modpkgs.append(file + ' (package)') modpkgs.sort() result = result + self.section( --- 967,975 ---- path = os.path.join(object.__path__[0], file) modname = inspect.getmodulename(file) ! if modname != '__init__': ! if modname and modname not in modpkgs: ! modpkgs.append(modname) ! elif ispackage(path): ! modpkgs.append(file + ' (package)') modpkgs.sort() result = result + self.section( *************** *** 1053,1059 **** push(self.indent(doc)) need_blank_after_doc = 1 ! for attr, tag in [("fget", " getter"), ! ("fset", " setter"), ! ("fdel", " deleter")]: func = getattr(value, attr) if func is not None: --- 1070,1076 ---- push(self.indent(doc)) need_blank_after_doc = 1 ! for attr, tag in [('fget', ''), ! ('fset', ''), ! ('fdel', '')]: func = getattr(value, attr) if func is not None: *************** *** 1061,1067 **** push('') need_blank_after_doc = 0 ! base = self.docother(func, name + tag, mod, 70) push(self.indent(base)) - push('') return attrs --- 1078,1083 ---- push('') need_blank_after_doc = 0 ! base = self.document(func, tag, mod) push(self.indent(base)) return attrs *************** *** 1080,1084 **** return attrs ! attrs = inspect.classify_class_attrs(object) while attrs: if mro: --- 1096,1101 ---- return attrs ! attrs = filter(lambda (name, kind, cls, value): visiblename(name), ! inspect.classify_class_attrs(object)) while attrs: if mro: *************** *** 1088,1099 **** attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) ! if thisclass is object: tag = "defined here" else: tag = "inherited from %s" % classname(thisclass, object.__module__) # Sort attrs by name. ! attrs.sort(lambda t1, t2: cmp(t1[0], t2[0])) # Pump out the attrs, segregated by kind. --- 1105,1120 ---- attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) ! if thisclass is __builtin__.object: ! attrs = inherited ! continue ! elif thisclass is object: tag = "defined here" else: tag = "inherited from %s" % classname(thisclass, object.__module__) + filter(lambda t: not t[0].startswith('_'), attrs) # Sort attrs by name. ! attrs.sort() # Pump out the attrs, segregated by kind. *************** *** 1106,1111 **** attrs = spillproperties("Properties %s:\n" % tag, attrs, lambda t: t[1] == 'property') ! attrs = spilldata("Data and non-method functions %s:\n" % tag, ! attrs, lambda t: t[1] == 'data') assert attrs == [] attrs = inherited --- 1127,1132 ---- attrs = spillproperties("Properties %s:\n" % tag, attrs, lambda t: t[1] == 'property') ! attrs = spilldata("Data and other attributes %s:\n" % tag, attrs, ! lambda t: t[1] == 'data') assert attrs == [] attrs = inherited *************** *** 1317,1321 **** return object else: - import __builtin__ if hasattr(__builtin__, path): return getattr(__builtin__, path) --- 1338,1341 ---- *************** *** 1372,1377 **** modname = inspect.getmodulename(path) if modname: ! modname = pkgpath + modname ! if not modname in done: done[modname] = 1 writedoc(modname) --- 1392,1400 ---- modname = inspect.getmodulename(path) if modname: ! if modname == '__init__': ! modname = pkgpath[:-1] # remove trailing period ! else: ! modname = pkgpath + modname ! if modname not in done: done[modname] = 1 writedoc(modname) From jhylton@users.sourceforge.net Fri Mar 28 16:45:47 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 28 Mar 2003 08:45:47 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.41,1.1.2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22755 Modified Files: Tag: ast-branch newcompile.c Log Message: Make debug output look a little more like dis. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.41 retrieving revision 1.1.2.42 diff -C2 -d -r1.1.2.41 -r1.1.2.42 *** newcompile.c 28 Mar 2003 02:07:58 -0000 1.1.2.41 --- newcompile.c 28 Mar 2003 16:45:43 -0000 1.1.2.42 *************** *** 1774,1777 **** --- 1774,1796 ---- } + /* Produce output that looks rather like dis module output. */ + + static void + assemble_display(struct assembler *a, struct instr *i) + { + /* Dispatch the simple case first. */ + if (!i->i_hasarg) { + fprintf(stderr, "%5d %-20.20s\n", + a->a_offset, opnames[i->i_opcode]); + return; + } + + fprintf(stderr, "%5d %-20.20s %d", + a->a_offset, opnames[i->i_opcode], i->i_oparg); + if (i->i_jrel) + fprintf(stderr, " (to %d)", a->a_offset + i->i_oparg + 3); + fprintf(stderr, "\n"); + } + static int assemble_emit(struct assembler *a, struct instr *i) *************** *** 1794,1807 **** } code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; ! if (i->i_hasarg) ! fprintf(stderr, ! "emit %3d %-15s %5d\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], ! i->i_oparg, a->a_offset, size, ext); ! else ! fprintf(stderr, ! "emit %3d %-15s %s\toffset = %2d\tsize = %d\text = %d\n", ! i->i_opcode, opnames[i->i_opcode], ! " ", a->a_offset, size, ext); a->a_offset += size; if (ext > 0) { --- 1813,1817 ---- } code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; ! assemble_display(a, i); a->a_offset += size; if (ext > 0) { *************** *** 1949,1953 **** struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; fprintf(stderr, ! "block %d: order=%d used=%d alloc=%d next=%d\n", i, a.a_postorder[i], b->b_iused, b->b_ialloc, b->b_next); --- 1959,1963 ---- struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; fprintf(stderr, ! "\nblock %d: order=%d used=%d alloc=%d next=%d\n", i, a.a_postorder[i], b->b_iused, b->b_ialloc, b->b_next); From jhylton@users.sourceforge.net Fri Mar 28 17:22:32 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 28 Mar 2003 09:22:32 -0800 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.13,2.10.8.14 newcompile.c,1.1.2.42,1.1.2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv5708 Modified Files: Tag: ast-branch symtable.c newcompile.c Log Message: Add lambdas. Fix symtable bug where lambda args were visited in callers' namespace. Add debugging dump of symbol table in compiler. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.13 retrieving revision 2.10.8.14 diff -C2 -d -r2.10.8.13 -r2.10.8.14 *** symtable.c 28 Mar 2003 02:05:28 -0000 2.10.8.13 --- symtable.c 28 Mar 2003 17:22:24 -0000 2.10.8.14 *************** *** 761,774 **** VISIT(st, expr, e->v.UnaryOp.operand); break; ! case Lambda_kind: if (!symtable_add_def(st, GET_IDENTIFIER(lambda), DEF_LOCAL)) return 0; ! VISIT(st, arguments, e->v.Lambda.args); /* XXX how to get line numbers for expressions */ symtable_enter_block(st, GET_IDENTIFIER(lambda), FunctionBlock, (void *)e, 0); VISIT(st, expr, e->v.Lambda.body); symtable_exit_block(st, (void *)e); break; case Dict_kind: VISIT_SEQ(st, expr, e->v.Dict.keys); --- 761,777 ---- VISIT(st, expr, e->v.UnaryOp.operand); break; ! case Lambda_kind: { if (!symtable_add_def(st, GET_IDENTIFIER(lambda), DEF_LOCAL)) return 0; ! if (e->v.Lambda.args->defaults) ! VISIT_SEQ(st, expr, e->v.Lambda.args->defaults); /* XXX how to get line numbers for expressions */ symtable_enter_block(st, GET_IDENTIFIER(lambda), FunctionBlock, (void *)e, 0); + VISIT(st, arguments, e->v.Lambda.args); VISIT(st, expr, e->v.Lambda.body); symtable_exit_block(st, (void *)e); break; + } case Dict_kind: VISIT_SEQ(st, expr, e->v.Dict.keys); Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.42 retrieving revision 1.1.2.43 diff -C2 -d -r1.1.2.42 -r1.1.2.43 *** newcompile.c 28 Mar 2003 16:45:43 -0000 1.1.2.42 --- newcompile.c 28 Mar 2003 17:22:26 -0000 1.1.2.43 *************** *** 227,230 **** --- 227,265 ---- } + static void + compiler_display_symbols(PyObject *name, PyObject *symbols) + { + PyObject *key, *value; + int flags, pos = 0; + + fprintf(stderr, "block %s\n", PyString_AS_STRING(name)); + while (PyDict_Next(symbols, &pos, &key, &value)) { + flags = PyInt_AsLong(value); + fprintf(stderr, "var %s:", PyString_AS_STRING(key)); + if (flags & DEF_GLOBAL) + fprintf(stderr, " declared_global"); + if (flags & DEF_LOCAL) + fprintf(stderr, " local"); + if (flags & DEF_PARAM) + fprintf(stderr, " param"); + if (flags & DEF_STAR) + fprintf(stderr, " stararg"); + if (flags & DEF_DOUBLESTAR) + fprintf(stderr, " starstar"); + if (flags & DEF_INTUPLE) + fprintf(stderr, " tuple"); + if (flags & DEF_FREE) + fprintf(stderr, " free"); + if (flags & DEF_FREE_GLOBAL) + fprintf(stderr, " global"); + if (flags & DEF_FREE_CLASS) + fprintf(stderr, " free/class"); + if (flags & DEF_IMPORT) + fprintf(stderr, " import"); + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } + static int compiler_enter_scope(struct compiler *c, identifier name, void *key) *************** *** 257,260 **** --- 292,298 ---- return 0; + /* A little debugging output */ + compiler_display_symbols(name, u->u_ste->ste_symbols); + /* Push the old compiler_unit on the stack. */ if (c->u) { *************** *** 625,631 **** assert(s->kind == FunctionDef_kind); - fprintf(stderr, "function %s\n", - PyString_AS_STRING(s->v.FunctionDef.name)); - if (args->defaults) VISIT_SEQ(c, expr, args->defaults); --- 663,666 ---- *************** *** 649,652 **** --- 684,720 ---- static int + compiler_lambda(struct compiler *c, expr_ty e) + { + PyCodeObject *co; + identifier name; + arguments_ty args = e->v.Lambda.args; + assert(e->kind == Lambda_kind); + + name = PyString_InternFromString("lambda"); + if (!name) + return 0; + + if (args->defaults) + VISIT_SEQ(c, expr, args->defaults); + if (!compiler_enter_scope(c, name, (void *)e)) + return 0; + c->u->u_argcount = asdl_seq_LEN(e->v.Lambda.args->args); + VISIT(c, expr, e->v.Lambda.body); + ADDOP(c, RETURN_VALUE); + co = assemble(c); + if (co == NULL) + return 0; + compiler_exit_scope(c); + + /* XXX closure */ + ADDOP_O(c, LOAD_CONST, (PyObject *)co, consts); + ADDOP_I(c, MAKE_FUNCTION, c->u->u_argcount); + + Py_DECREF(name); + + return 1; + } + + static int compiler_print(struct compiler *c, stmt_ty s) { *************** *** 1416,1420 **** break; case Lambda_kind: ! break; case Dict_kind: /* XXX get rid of arg? */ --- 1484,1488 ---- break; case Lambda_kind: ! return compiler_lambda(c, e); case Dict_kind: /* XXX get rid of arg? */ From ping@users.sourceforge.net Fri Mar 28 18:07:21 2003 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Fri, 28 Mar 2003 10:07:21 -0800 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv23546 Modified Files: concrete.tex Log Message: PyWeakref_GetObject returns None (not NULL) when the referent is gone. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** concrete.tex 3 Feb 2003 05:13:24 -0000 1.20 --- concrete.tex 28 Mar 2003 18:07:16 -0000 1.21 *************** *** 2410,2414 **** \begin{cfuncdesc}{PyObject*}{PyWeakref_GetObject}{PyObject *ref} Returns the referenced object from a weak reference, \var{ref}. If ! the referent is no longer live, returns \NULL. \versionadded{2.2} \end{cfuncdesc} --- 2410,2414 ---- \begin{cfuncdesc}{PyObject*}{PyWeakref_GetObject}{PyObject *ref} Returns the referenced object from a weak reference, \var{ref}. If ! the referent is no longer live, returns \code{None}. \versionadded{2.2} \end{cfuncdesc} From loewis@users.sourceforge.net Fri Mar 28 18:37:08 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 28 Mar 2003 10:37:08 -0800 Subject: [Python-checkins] python/dist/src configure,1.384,1.385 configure.in,1.395,1.396 pyconfig.h.in,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv3564 Modified Files: configure configure.in pyconfig.h.in Log Message: Add test for setpgrp. Fixes #690317. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.384 retrieving revision 1.385 diff -C2 -d -r1.384 -r1.385 *** configure 21 Mar 2003 01:42:56 -0000 1.384 --- configure 28 Mar 2003 18:36:49 -0000 1.385 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.394 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.395 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 12104,12107 **** --- 12104,12108 ---- + for ac_func in alarm chown clock confstr ctermid execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ *************** *** 12112,12116 **** putenv readlink realpath \ select setegid seteuid setgid \ ! setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ --- 12113,12117 ---- putenv readlink realpath \ select setegid seteuid setgid \ ! setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ *************** *** 17667,17671 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 17668,17672 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.395 retrieving revision 1.396 diff -C2 -d -r1.395 -r1.396 *** configure.in 21 Mar 2003 01:42:58 -0000 1.395 --- configure.in 28 Mar 2003 18:37:00 -0000 1.396 *************** *** 1853,1857 **** putenv readlink realpath \ select setegid seteuid setgid \ ! setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ --- 1853,1857 ---- putenv readlink realpath \ select setegid seteuid setgid \ ! setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** pyconfig.h.in 21 Mar 2003 01:42:58 -0000 1.74 --- pyconfig.h.in 28 Mar 2003 18:37:01 -0000 1.75 *************** *** 379,382 **** --- 379,385 ---- #undef HAVE_SETPGID + /* Define to 1 if you have the `setpgrp' function. */ + #undef HAVE_SETPGRP + /* Define to 1 if you have the `setregid' function. */ #undef HAVE_SETREGID From jhylton@users.sourceforge.net Fri Mar 28 18:40:00 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 28 Mar 2003 10:40:00 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.43,1.1.2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv4949 Modified Files: Tag: ast-branch newcompile.c Log Message: import star Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.43 retrieving revision 1.1.2.44 diff -C2 -d -r1.1.2.43 -r1.1.2.44 *** newcompile.c 28 Mar 2003 17:22:26 -0000 1.1.2.43 --- newcompile.c 28 Mar 2003 18:39:55 -0000 1.1.2.44 *************** *** 916,919 **** --- 916,921 ---- { int i, n = asdl_seq_LEN(s->v.ImportFrom.names); + int star = 0; + PyObject *names = PyTuple_New(n); if (!names) *************** *** 932,935 **** --- 934,945 ---- identifier store_name; + if (i == 0 && + *PyString_AS_STRING(alias->name) == '*') { + assert(n == 1); + ADDOP(c, IMPORT_STAR); + star = 1; + break; + } + ADDOP_O(c, IMPORT_FROM, alias->name, names); store_name = alias->name; *************** *** 940,945 **** return 0; } ! /* remove imported module */ ! ADDOP(c, POP_TOP); return 1; } --- 950,956 ---- return 0; } ! if (!star) ! /* remove imported module */ ! ADDOP(c, POP_TOP); return 1; } *************** *** 1039,1045 **** --- 1050,1062 ---- ADDOP_I(c, RAISE_VARARGS, n); break; + /* just visit body of try/except and try/finally. + this isn't at all correct, but visits more code. + */ case TryExcept_kind: + VISIT_SEQ(c, stmt, s->v.TryExcept.body); break; case TryFinally_kind: + VISIT_SEQ(c, stmt, s->v.TryFinally.body); + VISIT_SEQ(c, stmt, s->v.TryFinally.finalbody); break; case Assert_kind: From loewis@users.sourceforge.net Fri Mar 28 18:43:36 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 28 Mar 2003 10:43:36 -0800 Subject: [Python-checkins] python/dist/src configure,1.385,1.386 configure.in,1.396,1.397 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv5937 Modified Files: configure configure.in Log Message: Disable _XOPEN_SOURCE for Solaris 2.6. Fixes #690317. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.385 retrieving revision 1.386 diff -C2 -d -r1.385 -r1.386 *** configure 28 Mar 2003 18:36:49 -0000 1.385 --- configure 28 Mar 2003 18:43:13 -0000 1.386 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.395 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.396 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1341,1344 **** --- 1341,1348 ---- # even though select is a POSIX function. Reported by J. Ribbens. OpenBSD/2.* | OpenBSD/3.[012]) + define_xopen_source=no;; + # On Solaris 2.6, sys/wait.h is inconsistent in the usage + # of union __?sigval. Reported by Stuart Bishop. + SunOS/5.6) define_xopen_source=no;; esac Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.396 retrieving revision 1.397 diff -C2 -d -r1.396 -r1.397 *** configure.in 28 Mar 2003 18:37:00 -0000 1.396 --- configure.in 28 Mar 2003 18:43:31 -0000 1.397 *************** *** 121,124 **** --- 121,128 ---- OpenBSD/2.* | OpenBSD/3.@<:@012@:>@) define_xopen_source=no;; + # On Solaris 2.6, sys/wait.h is inconsistent in the usage + # of union __?sigval. Reported by Stuart Bishop. + SunOS/5.6) + define_xopen_source=no;; esac From jhylton@users.sourceforge.net Fri Mar 28 19:19:44 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 28 Mar 2003 11:19:44 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.44,1.1.2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv21396 Modified Files: Tag: ast-branch newcompile.c Log Message: avoid generating code for function doc strings. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.44 retrieving revision 1.1.2.45 diff -C2 -d -r1.1.2.44 -r1.1.2.45 *** newcompile.c 28 Mar 2003 18:39:55 -0000 1.1.2.44 --- newcompile.c 28 Mar 2003 19:19:40 -0000 1.1.2.45 *************** *** 661,664 **** --- 661,665 ---- PyCodeObject *co; arguments_ty args = s->v.FunctionDef.args; + int i, n; assert(s->kind == FunctionDef_kind); *************** *** 668,672 **** return 0; c->u->u_argcount = asdl_seq_LEN(s->v.FunctionDef.args->args); ! VISIT_SEQ(c, stmt, s->v.FunctionDef.body); co = assemble(c); if (co == NULL) --- 669,680 ---- return 0; c->u->u_argcount = asdl_seq_LEN(s->v.FunctionDef.args->args); ! n = asdl_seq_LEN(s->v.FunctionDef.body); ! for (i = 0; i < n; i++) { ! stmt_ty s2 = asdl_seq_GET(s->v.FunctionDef.body, i); ! if (i == 0 && s2->kind == Expr_kind && ! s2->v.Expr.value->kind == Str_kind) ! continue; ! VISIT(c, stmt, s2); ! } co = assemble(c); if (co == NULL) From jhylton@users.sourceforge.net Fri Mar 28 19:47:22 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 28 Mar 2003 11:47:22 -0800 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.21,1.1.2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv32360 Modified Files: Tag: ast-branch ast.c Log Message: A parenthesized expression is not a tuple constructor. Just ignore the parens. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.21 retrieving revision 1.1.2.22 diff -C2 -d -r1.1.2.21 -r1.1.2.22 *** ast.c 28 Mar 2003 02:05:28 -0000 1.1.2.21 --- ast.c 28 Mar 2003 19:47:19 -0000 1.1.2.22 *************** *** 564,570 **** return Num(parsenumber(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) */ --- 564,569 ---- return Num(parsenumber(STR(ch))); break; ! case LPAR: /* some parenthesized expressions */ ! return ast_for_testlist(CHILD(n, 1)); break; case LSQB: /* list (or list comprehension) */ From jackjansen@users.sourceforge.net Fri Mar 28 22:01:44 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:01:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_scriptpackages.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19958 Added Files: test_scriptpackages.py Log Message: Minimal test suite of the generated packages in plat-mac/lib-scriptpackages. At the moment does little more than testing that the modules import correctly and some classes can be instantiated. --- NEW FILE: test_scriptpackages.py --- # Copyright (C) 2003 Python Software Foundation import unittest import os import sys import tempfile from test import test_support import aetools class TestScriptpackages(unittest.TestCase): def _test_scriptpackage(self, package, testobject=1): # Check that we can import the package mod = __import__(package) # Test that we can get the main event class klass = getattr(mod, package) # Test that we can instantiate that class talker = klass() if testobject: # Test that we can get an application object obj = mod.application(0) def test__builtinSuites(self): self._test_scriptpackage('_builtinSuites', testobject=0) def test_StdSuites(self): self._test_scriptpackage('StdSuites') def test_Finder(self): self._test_scriptpackage('Finder') def test_Terminal(self): self._test_scriptpackage('Terminal') def test_Netscape(self): self._test_scriptpackage('Netscape') def test_Explorer(self): self._test_scriptpackage('Explorer') def test_CodeWarrior(self): self._test_scriptpackage('CodeWarrior') def test_main(): test_support.run_unittest(TestScriptpackages) if __name__ == '__main__': test_main() From jackjansen@users.sourceforge.net Fri Mar 28 22:04:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:04:29 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv20738 Modified Files: gensuitemodule.py Log Message: - Sort various lists (list of events, OSA-classes, etc) before generating code. This makes it a lot easier to compare the generated code for two different versions of the suite. - Various tweaks to the code to generate suites without looking at resource files manually. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** gensuitemodule.py 26 Mar 2003 23:14:44 -0000 1.34 --- gensuitemodule.py 28 Mar 2003 22:04:22 -0000 1.35 *************** *** 131,136 **** aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: ! if arg[0] == -1701: # errAEDescNotFound ! print "GetAppTerminology failed with errAEDescNotFound, trying manually" aedata, sig = getappterminology(fullname) if not creatorsignature: --- 131,136 ---- aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: ! if arg[0] in (-1701, -192): # errAEDescNotFound, resNotFound ! print "GetAppTerminology failed with errAEDescNotFound/resNotFound, trying manually" aedata, sig = getappterminology(fullname) if not creatorsignature: *************** *** 151,155 **** aete = decode(aedata.data) compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature) def getappterminology(fullname): --- 151,155 ---- aete = decode(aedata.data) compileaete(aete, None, fullname, output=output, basepkgname=basepkgname, ! creatorsignature=creatorsignature, edit_modnames=edit_modnames) def getappterminology(fullname): *************** *** 162,175 **** import Carbon.Evt Carbon.Evt.WaitNextEvent(0,0) ! # Now get the signature of the application, hoping it is a bundle ! pkginfo = os.path.join(fullname, 'Contents', 'PkgInfo') ! if not os.path.exists(pkginfo): ! raise RuntimeError, "No PkgInfo file found" ! tp_cr = open(pkginfo, 'rb').read() ! cr = tp_cr[4:8] # Let's talk to it and ask for its AETE talker = aetools.TalkTo(cr) ! talker._start() reply = talker.send("ascr", "gdte") # Now pick the bits out of the return that we need. return reply[1]['----'], cr --- 162,183 ---- import Carbon.Evt Carbon.Evt.WaitNextEvent(0,0) ! if os.path.isdir(fullname): ! # Now get the signature of the application, hoping it is a bundle ! pkginfo = os.path.join(fullname, 'Contents', 'PkgInfo') ! if not os.path.exists(pkginfo): ! raise RuntimeError, "No PkgInfo file found" ! tp_cr = open(pkginfo, 'rb').read() ! cr = tp_cr[4:8] ! else: ! # Assume it is a file ! cr, tp = MacOS.GetCreatorAndType(fullname) # Let's talk to it and ask for its AETE talker = aetools.TalkTo(cr) ! try: ! talker._start() ! except (MacOS.Error, aetools.Error), arg: ! print 'Warning: start() failed, continuing anyway:', arg reply = talker.send("ascr", "gdte") + #reply2 = talker.send("ascr", "gdut") # Now pick the bits out of the return that we need. return reply[1]['----'], cr *************** *** 407,410 **** --- 415,419 ---- fp.write('import aetools\n') fp.write('Error = aetools.Error\n') + suitelist.sort() for code, modname in suitelist: fp.write("import %s\n" % modname) *************** *** 434,437 **** --- 443,447 ---- fp.write("\n") fp.write("import StdSuites\n") + allprecompinfo.sort() if allprecompinfo: fp.write("\n#\n# Set property and element dictionaries now that all classes have been defined\n#\n") *************** *** 518,521 **** --- 528,536 ---- """Generate code for a single suite""" [name, desc, code, level, version, events, classes, comps, enums] = suite + # Sort various lists, so re-generated source is easier compared + events.sort() + classes.sort() + comps.sort() + enums.sort() fp = open(pathname, 'w') From jackjansen@users.sourceforge.net Fri Mar 28 22:07:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:07:24 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Terminal_Suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv21742/Terminal Modified Files: Terminal_Suite.py __init__.py Log Message: Regenerated (from resource files) with sorting version of gensuitemodule. This is a first step towards regenerating the modules with newer, MacOSX, versions of these programs, and using the programmatic interface to get at the terminology in stead of poking in resource files. Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Terminal_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Terminal_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 *************** *** 13,25 **** class Terminal_Suite_Events: ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: Run the Terminal application 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' --- 13,27 ---- class Terminal_Suite_Events: ! def count(self, _object=None, _attributes={}, **_arguments): ! """count: Return the number of elements of a particular class within an object ! Required argument: a reference to the objects to be counted Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the number of objects counted """ ! _code = 'core' ! _subcode = 'cnte' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object *************** *** 32,44 **** return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit the Terminal application Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'aevt' ! _subcode = 'quit' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' --- 34,54 ---- return _arguments['----'] ! _argmap_do_script = { ! 'with_command' : 'cmnd', ! 'in_' : 'kfil', ! } ! ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Run a UNIX shell script or command ! Required argument: data to be passed to the Terminal application as the command line ! Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter ! Keyword argument in_: the window in which to execute the command Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'core' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object *************** *** 51,65 **** return _arguments['----'] ! def count(self, _object=None, _attributes={}, **_arguments): ! """count: Return the number of elements of a particular class within an object ! Required argument: a reference to the objects to be counted Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the number of objects counted """ ! _code = 'core' ! _subcode = 'cnte' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object --- 61,73 ---- return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit the Terminal application Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'aevt' ! _subcode = 'quit' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 72,92 **** return _arguments['----'] ! _argmap_do_script = { ! 'with_command' : 'cmnd', ! 'in_' : 'kfil', ! } ! ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Run a UNIX shell script or command ! Required argument: data to be passed to the Terminal application as the command line ! Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter ! Keyword argument in_: the window in which to execute the command Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'core' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) ! _arguments['----'] = _object --- 80,92 ---- return _arguments['----'] ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: Run the Terminal application 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' Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Mar 2003 22:07:28 -0000 1.2 --- __init__.py 28 Mar 2003 22:07:22 -0000 1.3 *************** *** 5,15 **** import aetools Error = aetools.Error - import Terminal_Suite import Invisible_Suite _code_to_module = { - 'trmx' : Terminal_Suite, 'tpnm' : Invisible_Suite, } --- 5,15 ---- import aetools Error = aetools.Error import Invisible_Suite + import Terminal_Suite _code_to_module = { 'tpnm' : Invisible_Suite, + 'trmx' : Terminal_Suite, } *************** *** 17,26 **** _code_to_fullname = { - 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), 'tpnm' : ('Terminal.Invisible_Suite', 'Invisible_Suite'), } - from Terminal_Suite import * from Invisible_Suite import * def getbaseclasses(v): --- 17,26 ---- _code_to_fullname = { 'tpnm' : ('Terminal.Invisible_Suite', 'Invisible_Suite'), + 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), } from Invisible_Suite import * + from Terminal_Suite import * def getbaseclasses(v): *************** *** 43,47 **** getbaseclasses(window) getbaseclasses(application) - getbaseclasses(application) getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) --- 43,46 ---- *************** *** 84,87 **** --- 83,87 ---- getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + getbaseclasses(application) # *************** *** 91,95 **** 'cwin' : window, 'capp' : application, - 'capp' : application, 'shor' : StdSuites.Type_Names_Suite.small_integer, 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, --- 91,94 ---- *************** *** 132,140 **** 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } ! class Terminal(Terminal_Suite_Events, ! Invisible_Suite_Events, aetools.TalkTo): _signature = 'trmx' --- 131,140 ---- 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + 'capp' : application, } ! class Terminal(Invisible_Suite_Events, ! Terminal_Suite_Events, aetools.TalkTo): _signature = 'trmx' From jackjansen@users.sourceforge.net Fri Mar 28 22:07:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:07:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.2,1.3 PowerPlant.py,1.2,1.3 Text.py,1.2,1.3 WorldWideWeb_suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv21742/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Regenerated (from resource files) with sorting version of gensuitemodule. This is a first step towards regenerating the modules with newer, MacOSX, versions of these programs, and using the programmatic interface to get at the terminology in stead of poking in resource files. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- Mozilla_suite.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 13,33 **** class Mozilla_suite_Events: ! _argmap_Read_help_file = { ! 'with_index' : 'idid', ! 'search_text' : 'sear', ! } ! ! def Read_help_file(self, _object, _attributes={}, **_arguments): ! """Read help file: Reads in the help file (file should be in the help file format) ! Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to \xd4DEFAULT\xd5) ! Keyword argument search_text: Optional text to search for Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'help' ! aetools.keysubst(_arguments, self._argmap_Read_help_file) ! _arguments['----'] = _object --- 13,26 ---- class Mozilla_suite_Events: ! def Get_Import_Data(self, _no_object=None, _attributes={}, **_arguments): ! """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. Keyword argument _attributes: AppleEvent attribute dictionary + Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, \xd4Brwz\xd5 browser, \xd4Addr\xd5 addressbook, \xd4Mesg\xd5 messenger, etc., 4 bytes) """ _code = 'MOSS' ! _subcode = 'Impt' ! if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 40,53 **** return _arguments['----'] ! 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 """ _code = 'MOSS' ! _subcode = 'book' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object --- 33,46 ---- return _arguments['----'] ! def Get_Profile_Name(self, _no_object=None, _attributes={}, **_arguments): ! """Get Profile Name: Get the current User Profile Keyword argument _attributes: AppleEvent attribute dictionary + Returns: Name of the current profile, like \xd2Joe Bloggs\xd3. This is the name of the profile folder in the Netscape Users folder. """ _code = 'MOSS' ! _subcode = 'upro' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 60,80 **** return _arguments['----'] ! _argmap_Go = { ! 'direction' : 'dire', ! } ! ! def Go(self, _object, _attributes={}, **_arguments): ! """Go: navigate a window: back, forward, again(reload), home) ! Required argument: window ! Keyword argument direction: undocumented, typecode 'dire' Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'gogo' ! aetools.keysubst(_arguments, self._argmap_Go) ! _arguments['----'] = _object - aetools.enumsubst(_arguments, 'dire', _Enum_dire) _reply, _arguments, _attributes = self.send(_code, _subcode, --- 53,67 ---- return _arguments['----'] ! def Get_workingURL(self, _no_object=None, _attributes={}, **_arguments): ! """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL Keyword argument _attributes: AppleEvent attribute dictionary + Returns: Will return text of the from \xd2FILE://foo/applicationname\xd3 """ _code = 'MOSS' ! _subcode = 'wurl' ! 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, *************** *** 86,100 **** return _arguments['----'] ! def Get_workingURL(self, _no_object=None, _attributes={}, **_arguments): ! """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Will return text of the from \xd2FILE://foo/applicationname\xd3 """ _code = 'MOSS' ! _subcode = 'wurl' ! 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, --- 73,93 ---- return _arguments['----'] ! _argmap_Go = { ! 'direction' : 'dire', ! } ! ! def Go(self, _object, _attributes={}, **_arguments): ! """Go: navigate a window: back, forward, again(reload), home) ! Required argument: window ! Keyword argument direction: undocumented, typecode 'dire' Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'gogo' ! aetools.keysubst(_arguments, self._argmap_Go) ! _arguments['----'] = _object + aetools.enumsubst(_arguments, 'dire', _Enum_dire) _reply, _arguments, _attributes = self.send(_code, _subcode, *************** *** 106,118 **** return _arguments['----'] ! def Open_Profile_Manager(self, _no_object=None, _attributes={}, **_arguments): ! """Open Profile Manager: Open the user profile manager (obsolete) Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'prfl' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' --- 99,112 ---- return _arguments['----'] ! def Handle_command(self, _object, _attributes={}, **_arguments): ! """Handle command: Handle a command ! Required argument: The command to handle Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'hcmd' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object *************** *** 125,135 **** return _arguments['----'] ! def Get_Import_Data(self, _no_object=None, _attributes={}, **_arguments): ! """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. Keyword argument _attributes: AppleEvent attribute dictionary - Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, \xd4Brwz\xd5 browser, \xd4Addr\xd5 addressbook, \xd4Mesg\xd5 messenger, etc., 4 bytes) """ _code = 'MOSS' ! _subcode = 'Impt' if _arguments: raise TypeError, 'No optional args expected' --- 119,128 ---- return _arguments['----'] ! def Open_Address_Book(self, _no_object=None, _attributes={}, **_arguments): ! """Open Address Book: Opens the address book Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'addr' if _arguments: raise TypeError, 'No optional args expected' *************** *** 145,158 **** return _arguments['----'] ! def Get_Profile_Name(self, _no_object=None, _attributes={}, **_arguments): ! """Get Profile Name: Get the current User Profile Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Name of the current profile, like \xd2Joe Bloggs\xd3. This is the name of the profile folder in the Netscape Users folder. """ _code = 'MOSS' ! _subcode = 'upro' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' --- 138,151 ---- return _arguments['----'] ! def Open_Component(self, _object, _attributes={}, **_arguments): ! """Open Component: Open a Communicator component ! Required argument: The component to open Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'cpnt' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object *************** *** 165,174 **** return _arguments['----'] ! def Open_Address_Book(self, _no_object=None, _attributes={}, **_arguments): ! """Open Address Book: Opens the address book Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'addr' if _arguments: raise TypeError, 'No optional args expected' --- 158,167 ---- return _arguments['----'] ! def Open_Profile_Manager(self, _no_object=None, _attributes={}, **_arguments): ! """Open Profile Manager: Open the user profile manager (obsolete) Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'prfl' if _arguments: raise TypeError, 'No optional args expected' *************** *** 184,194 **** return _arguments['----'] ! def Open_Component(self, _object, _attributes={}, **_arguments): ! """Open Component: Open a Communicator component ! Required argument: The component to open Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'cpnt' if _arguments: raise TypeError, 'No optional args expected' --- 177,187 ---- return _arguments['----'] ! 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 """ _code = 'MOSS' ! _subcode = 'book' if _arguments: raise TypeError, 'No optional args expected' *************** *** 204,216 **** return _arguments['----'] ! def Handle_command(self, _object, _attributes={}, **_arguments): ! """Handle command: Handle a command ! Required argument: The command to handle Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'hcmd' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object --- 197,216 ---- return _arguments['----'] ! _argmap_Read_help_file = { ! 'with_index' : 'idid', ! 'search_text' : 'sear', ! } ! ! def Read_help_file(self, _object, _attributes={}, **_arguments): ! """Read help file: Reads in the help file (file should be in the help file format) ! Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to \xd4DEFAULT\xd5) ! Keyword argument search_text: Optional text to search for Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' ! _subcode = 'help' ! aetools.keysubst(_arguments, self._argmap_Read_help_file) _arguments['----'] = _object *************** *** 224,234 **** return _arguments['----'] - _Enum_dire = { - 'again' : 'agai', # Again (reload) - 'home' : 'home', # Home - 'backward' : 'prev', # Previous page - 'forward' : 'next', # Next page - } - _Enum_comp = { 'Navigator' : 'navg', # The Navigator component --- 224,227 ---- *************** *** 238,241 **** --- 231,241 ---- 'Conference' : 'conf', # The Conference Component 'Calendar' : 'cald', # The Calendar Component + } + + _Enum_dire = { + 'again' : 'agai', # Again (reload) + 'home' : 'home', # Home + 'backward' : 'prev', # Previous page + 'forward' : 'next', # Next page } Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PowerPlant.py 23 Mar 2003 22:07:27 -0000 1.2 --- PowerPlant.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 13,31 **** class PowerPlant_Events: ! _argmap_select = { ! 'data' : 'data', } ! def select(self, _object, _attributes={}, **_arguments): ! """select: Sets the present selection ! Required argument: object to select or container of sub-objects to select ! Keyword argument data: sub-object(s) to select Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'misc' ! _subcode = 'slct' ! aetools.keysubst(_arguments, self._argmap_select) ! _arguments['----'] = _object --- 13,30 ---- class PowerPlant_Events: ! _argmap_SwitchTellTarget = { ! 'to' : 'data', } ! def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the \xd2focus\xd3 of AppleEvents ! Keyword argument to: reference to new focus of AppleEvents Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'ppnt' ! _subcode = 'sttg' ! aetools.keysubst(_arguments, self._argmap_SwitchTellTarget) ! if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 38,55 **** return _arguments['----'] ! _argmap_SwitchTellTarget = { ! 'to' : 'data', } ! def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the \xd2focus\xd3 of AppleEvents ! Keyword argument to: reference to new focus of AppleEvents Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'ppnt' ! _subcode = 'sttg' ! aetools.keysubst(_arguments, self._argmap_SwitchTellTarget) ! if _no_object != None: raise TypeError, 'No direct arg expected' --- 37,55 ---- return _arguments['----'] ! _argmap_select = { ! 'data' : 'data', } ! def select(self, _object, _attributes={}, **_arguments): ! """select: Sets the present selection ! Required argument: object to select or container of sub-objects to select ! Keyword argument data: sub-object(s) to select Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'misc' ! _subcode = 'slct' ! aetools.keysubst(_arguments, self._argmap_select) ! _arguments['----'] = _object Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Text.py 23 Mar 2003 22:07:27 -0000 1.2 --- Text.py 28 Mar 2003 22:07:19 -0000 1.3 *************** *** 17,45 **** - class text(aetools.ComponentItem): - """text - independent text view objects """ - want = 'ctxt' - class updateLevel(aetools.NProperty): - """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ - which = 'pUpL' - want = 'long' - class beginning(aetools.NProperty): - """beginning - Beginning of element """ - which = 'bgng' - want = 'obj ' - class end(aetools.NProperty): - """end - Ending of element """ - which = 'end ' - want = 'obj ' - class infront(aetools.NProperty): - """infront - Immediately before element """ - which = 'pBef' - want = 'obj ' - class justbehind(aetools.NProperty): - """justbehind - Immediately after element """ - which = 'pAft' - want = 'obj ' - # element 'stys' as ['indx', 'name'] - class styleset(aetools.ComponentItem): """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ --- 17,20 ---- *************** *** 71,85 **** stylesets = styleset ! text._superclassnames = [] ! text._privpropdict = { ! 'updateLevel' : updateLevel, ! 'beginning' : beginning, ! 'end' : end, ! 'infront' : infront, ! 'justbehind' : justbehind, ! } ! text._privelemdict = { ! 'styleset' : styleset, ! } styleset._superclassnames = [] styleset._privpropdict = { --- 46,74 ---- stylesets = styleset ! ! class text(aetools.ComponentItem): ! """text - independent text view objects """ ! want = 'ctxt' ! class updateLevel(aetools.NProperty): ! """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ ! which = 'pUpL' ! want = 'long' ! class beginning(aetools.NProperty): ! """beginning - Beginning of element """ ! which = 'bgng' ! want = 'obj ' ! class end(aetools.NProperty): ! """end - Ending of element """ ! which = 'end ' ! want = 'obj ' ! class infront(aetools.NProperty): ! """infront - Immediately before element """ ! which = 'pBef' ! want = 'obj ' ! class justbehind(aetools.NProperty): ! """justbehind - Immediately after element """ ! which = 'pAft' ! want = 'obj ' ! # element 'stys' as ['indx', 'name'] styleset._superclassnames = [] styleset._privpropdict = { *************** *** 93,96 **** --- 82,96 ---- styleset._privelemdict = { } + text._superclassnames = [] + text._privpropdict = { + 'updateLevel' : updateLevel, + 'beginning' : beginning, + 'end' : end, + 'infront' : infront, + 'justbehind' : justbehind, + } + text._privelemdict = { + 'styleset' : styleset, + } # *************** *** 98,107 **** # _classdeclarations = { - 'ctxt' : text, 'stys' : styleset, } _propdeclarations = { ! 'pBef' : infront, 'bgng' : beginning, 'colr' : color, --- 98,107 ---- # _classdeclarations = { 'stys' : styleset, + 'ctxt' : text, } _propdeclarations = { ! 'ptsz' : size, 'bgng' : beginning, 'colr' : color, *************** *** 109,117 **** 'psct' : writing_code, 'pAft' : justbehind, 'end ' : end, - 'ptsz' : size, 'pUpL' : updateLevel, 'pnam' : name, ! 'font' : font, } --- 109,117 ---- 'psct' : writing_code, 'pAft' : justbehind, + 'font' : font, 'end ' : end, 'pUpL' : updateLevel, 'pnam' : name, ! 'pBef' : infront, } Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- WorldWideWeb_suite.py 28 Mar 2003 22:07:20 -0000 1.3 *************** *** 79,108 **** return _arguments['----'] - _argmap_parse_anchor = { - 'relative_to' : 'RELA', - } - - def parse_anchor(self, _object, _attributes={}, **_arguments): - """parse anchor: Resolves the relative URL - Required argument: Main URL - Keyword argument relative_to: Relative URL - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: Parsed URL - """ - _code = 'WWW!' - _subcode = 'PRSA' - - aetools.keysubst(_arguments, self._argmap_parse_anchor) - _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_cancel_progress = { 'in_window' : 'WIND', --- 79,82 ---- *************** *** 151,161 **** return _arguments['----'] ! def webActivate(self, _object=None, _attributes={}, **_arguments): ! """webActivate: Makes Netscape the frontmost application, and selects a given window. This event is here for suite completeness/ cross-platform compatibility only, you should use standard AppleEvents instead. ! Required argument: window to bring to front Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' ! _subcode = 'ACTV' if _arguments: raise TypeError, 'No optional args expected' --- 125,136 ---- return _arguments['----'] ! def get_window_info(self, _object=None, _attributes={}, **_arguments): ! """get window info: Returns the information about the window as a list. Currently the list contains the window title and the URL. You can get the same information using standard Apple Event GetProperty. ! Required argument: window ID Keyword argument _attributes: AppleEvent attribute dictionary + Returns: undocumented, typecode 'list' """ _code = 'WWW!' ! _subcode = 'WNFO' if _arguments: raise TypeError, 'No optional args expected' *************** *** 191,204 **** return _arguments['----'] ! def get_window_info(self, _object=None, _attributes={}, **_arguments): ! """get window info: Returns the information about the window as a list. Currently the list contains the window title and the URL. You can get the same information using standard Apple Event GetProperty. ! Required argument: window ID Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: undocumented, typecode 'list' """ _code = 'WWW!' ! _subcode = 'WNFO' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object --- 166,184 ---- return _arguments['----'] ! _argmap_parse_anchor = { ! 'relative_to' : 'RELA', ! } ! ! def parse_anchor(self, _object, _attributes={}, **_arguments): ! """parse anchor: Resolves the relative URL ! Required argument: Main URL ! Keyword argument relative_to: Relative URL Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Parsed URL """ _code = 'WWW!' ! _subcode = 'PRSA' ! aetools.keysubst(_arguments, self._argmap_parse_anchor) _arguments['----'] = _object *************** *** 232,244 **** return _arguments['----'] ! def unregister_URL_echo(self, _object, _attributes={}, **_arguments): ! """unregister URL echo: cancels URL echo ! Required argument: application signature Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' ! _subcode = 'UNRU' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object --- 212,230 ---- return _arguments['----'] ! _argmap_register_protocol = { ! 'for_protocol' : 'PROT', ! } ! ! def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event. ! Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3, Keyword argument _attributes: AppleEvent attribute dictionary + Returns: TRUE if registration has been successful """ _code = 'WWW!' ! _subcode = 'RGPR' ! aetools.keysubst(_arguments, self._argmap_register_protocol) _arguments['----'] = _object *************** *** 280,298 **** return _arguments['----'] ! _argmap_unregister_viewer = { ! 'MIME_type' : 'MIME', } ! def unregister_viewer(self, _object, _attributes={}, **_arguments): ! """unregister viewer: Revert to the old way of handling this MIME type ! Required argument: Application sig ! Keyword argument MIME_type: MIME type to be unregistered Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if the event was successful """ _code = 'WWW!' ! _subcode = 'UNRV' ! aetools.keysubst(_arguments, self._argmap_unregister_viewer) _arguments['----'] = _object --- 266,284 ---- return _arguments['----'] ! _argmap_register_window_close = { ! 'for_window' : 'WIND', } ! def register_window_close(self, _object=None, _attributes={}, **_arguments): ! """register window close: Netscape will notify registered application when this window closes ! Required argument: Application signature ! Keyword argument for_window: window ID Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if successful """ _code = 'WWW!' ! _subcode = 'RGWC' ! aetools.keysubst(_arguments, self._argmap_register_window_close) _arguments['----'] = _object *************** *** 306,324 **** return _arguments['----'] ! _argmap_register_protocol = { ! 'for_protocol' : 'PROT', ! } ! ! def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event. ! Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3, Keyword argument _attributes: AppleEvent attribute dictionary - Returns: TRUE if registration has been successful """ _code = 'WWW!' ! _subcode = 'RGPR' ! aetools.keysubst(_arguments, self._argmap_register_protocol) _arguments['----'] = _object --- 292,304 ---- return _arguments['----'] ! def unregister_URL_echo(self, _object, _attributes={}, **_arguments): ! """unregister URL echo: cancels URL echo ! Required argument: application signature Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' ! _subcode = 'UNRU' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object *************** *** 358,376 **** return _arguments['----'] ! _argmap_register_window_close = { ! 'for_window' : 'WIND', } ! def register_window_close(self, _object=None, _attributes={}, **_arguments): ! """register window close: Netscape will notify registered application when this window closes ! Required argument: Application signature ! Keyword argument for_window: window ID Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: true if successful """ _code = 'WWW!' ! _subcode = 'RGWC' ! aetools.keysubst(_arguments, self._argmap_register_window_close) _arguments['----'] = _object --- 338,356 ---- return _arguments['----'] ! _argmap_unregister_viewer = { ! 'MIME_type' : 'MIME', } ! def unregister_viewer(self, _object, _attributes={}, **_arguments): ! """unregister viewer: Revert to the old way of handling this MIME type ! Required argument: Application sig ! Keyword argument MIME_type: MIME type to be unregistered Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: TRUE if the event was successful """ _code = 'WWW!' ! _subcode = 'UNRV' ! aetools.keysubst(_arguments, self._argmap_unregister_viewer) _arguments['----'] = _object *************** *** 399,402 **** --- 379,402 ---- aetools.keysubst(_arguments, self._argmap_unregister_window_close) + _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 webActivate(self, _object=None, _attributes={}, **_arguments): + """webActivate: Makes Netscape the frontmost application, and selects a given window. This event is here for suite completeness/ cross-platform compatibility only, you should use standard AppleEvents instead. + Required argument: window to bring to front + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'WWW!' + _subcode = 'ACTV' + + if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Mar 2003 22:07:27 -0000 1.2 --- __init__.py 28 Mar 2003 22:07:20 -0000 1.3 *************** *** 5,25 **** import aetools Error = aetools.Error - import Required_suite import Standard_Suite import Standard_URL_suite - import WorldWideWeb_suite import Mozilla_suite - import PowerPlant import Text _code_to_module = { - 'reqd' : Required_suite, 'CoRe' : Standard_Suite, 'GURL' : Standard_URL_suite, - 'WWW!' : WorldWideWeb_suite, 'MOSS' : Mozilla_suite, - 'ppnt' : PowerPlant, 'TEXT' : Text, } --- 5,25 ---- import aetools Error = aetools.Error import Standard_Suite import Standard_URL_suite import Mozilla_suite import Text + import WorldWideWeb_suite + import PowerPlant + import Required_suite _code_to_module = { 'CoRe' : Standard_Suite, 'GURL' : Standard_URL_suite, 'MOSS' : Mozilla_suite, 'TEXT' : Text, + 'WWW!' : WorldWideWeb_suite, + 'ppnt' : PowerPlant, + 'reqd' : Required_suite, } *************** *** 27,46 **** _code_to_fullname = { - 'reqd' : ('Netscape.Required_suite', 'Required_suite'), 'CoRe' : ('Netscape.Standard_Suite', 'Standard_Suite'), 'GURL' : ('Netscape.Standard_URL_suite', 'Standard_URL_suite'), - 'WWW!' : ('Netscape.WorldWideWeb_suite', 'WorldWideWeb_suite'), 'MOSS' : ('Netscape.Mozilla_suite', 'Mozilla_suite'), - 'ppnt' : ('Netscape.PowerPlant', 'PowerPlant'), 'TEXT' : ('Netscape.Text', 'Text'), } - from Required_suite import * from Standard_Suite import * from Standard_URL_suite import * - from WorldWideWeb_suite import * from Mozilla_suite import * - from PowerPlant import * from Text import * def getbaseclasses(v): --- 27,46 ---- _code_to_fullname = { 'CoRe' : ('Netscape.Standard_Suite', 'Standard_Suite'), 'GURL' : ('Netscape.Standard_URL_suite', 'Standard_URL_suite'), 'MOSS' : ('Netscape.Mozilla_suite', 'Mozilla_suite'), 'TEXT' : ('Netscape.Text', 'Text'), + 'WWW!' : ('Netscape.WorldWideWeb_suite', 'WorldWideWeb_suite'), + 'ppnt' : ('Netscape.PowerPlant', 'PowerPlant'), + 'reqd' : ('Netscape.Required_suite', 'Required_suite'), } from Standard_Suite import * from Standard_URL_suite import * from Mozilla_suite import * from Text import * + from WorldWideWeb_suite import * + from PowerPlant import * + from Required_suite import * def getbaseclasses(v): *************** *** 63,68 **** getbaseclasses(window) getbaseclasses(application) - getbaseclasses(text) - getbaseclasses(styleset) getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.character) --- 63,66 ---- *************** *** 72,75 **** --- 70,75 ---- getbaseclasses(StdSuites.Text_Suite.line) getbaseclasses(StdSuites.Text_Suite.text) + getbaseclasses(text) + getbaseclasses(styleset) # *************** *** 79,84 **** 'cwin' : window, 'capp' : application, - 'ctxt' : text, - 'stys' : styleset, 'cpar' : StdSuites.Text_Suite.paragraph, 'cha ' : StdSuites.Text_Suite.character, --- 79,82 ---- *************** *** 88,101 **** 'clin' : StdSuites.Text_Suite.line, 'ctxt' : StdSuites.Text_Suite.text, } ! class Netscape(Required_suite_Events, ! Standard_Suite_Events, Standard_URL_suite_Events, - WorldWideWeb_suite_Events, Mozilla_suite_Events, - PowerPlant_Events, Text_Events, aetools.TalkTo): _signature = 'MOSS' --- 86,101 ---- 'clin' : StdSuites.Text_Suite.line, 'ctxt' : StdSuites.Text_Suite.text, + 'ctxt' : text, + 'stys' : styleset, } ! class Netscape(Standard_Suite_Events, Standard_URL_suite_Events, Mozilla_suite_Events, Text_Events, + WorldWideWeb_suite_Events, + PowerPlant_Events, + Required_suite_Events, aetools.TalkTo): _signature = 'MOSS' From jackjansen@users.sourceforge.net Fri Mar 28 22:07:24 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:07:24 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.2,1.3 Macintosh_Connectivity_Clas.py,1.2,1.3 QuickDraw_Graphics_Suite.py,1.2,1.3 Standard_Suite.py,1.2,1.3 Type_Names_Suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv21742/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py Standard_Suite.py Type_Names_Suite.py __init__.py Log Message: Regenerated (from resource files) with sorting version of gensuitemodule. This is a first step towards regenerating the modules with newer, MacOSX, versions of these programs, and using the programmatic interface to get at the terminology in stead of poking in resource files. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AppleScript_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- AppleScript_Suite.py 28 Mar 2003 22:07:20 -0000 1.3 *************** *** 13,42 **** class AppleScript_Suite_Events: ! def activate(self, _no_object=None, _attributes={}, **_arguments): ! """activate: Bring the targeted application program to the front ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'actv' ! ! if _arguments: raise TypeError, 'No optional args expected' [...3617 lines suppressed...] 'wkdy' : weekday, *************** *** 2155,2162 **** 'tab ' : tab, 'tstr' : time_string, - 'pi ' : pi, - 'ret ' : return_, 'plcd' : language_code, 'kMsg' : key, 'spac' : space, 'days' : days, --- 2155,2162 ---- 'tab ' : tab, 'tstr' : time_string, 'plcd' : language_code, + 'ret ' : return_, 'kMsg' : key, + 'hour' : hours, 'spac' : space, 'days' : days, Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Macintosh_Connectivity_Clas.py 23 Mar 2003 22:07:28 -0000 1.2 --- Macintosh_Connectivity_Clas.py 28 Mar 2003 22:07:21 -0000 1.3 *************** *** 16,51 **** - class device_specification(aetools.ComponentItem): - """device specification - A device connected to a computer """ - want = 'cdev' - class properties(aetools.NProperty): - """properties - property that allows getting and setting of multiple properties """ - which = 'pALL' - want = 'reco' - class device_type(aetools.NProperty): - """device type - the kind of device """ - which = 'pdvt' - want = 'edvt' - class device_address(aetools.NProperty): - """device address - the address of the device """ - which = 'pdva' - want = 'cadr' - - device_specifications = device_specification - - class address_specification(aetools.ComponentItem): - """address specification - Unique designation of a device or service connected to this computer """ - want = 'cadr' - class conduit(aetools.NProperty): - """conduit - How the addressee is physically connected """ - which = 'pcon' - want = 'econ' - class protocol(aetools.NProperty): - """protocol - How to talk to this addressee """ - which = 'pprt' - want = 'epro' - - address_specifications = address_specification - class ADB_address(aetools.ComponentItem): """ADB address - Addresses a device connected via Apple Desktop Bus """ --- 16,19 ---- *************** *** 80,89 **** AppleTalk_addresses = AppleTalk_address - class bus_slot(aetools.ComponentItem): - """bus slot - Addresses a PC, PCI, or NuBus card """ - want = 'cbus' - - bus_slots = bus_slot - class Ethernet_address(aetools.ComponentItem): """Ethernet address - Addresses a device by its Ethernet address """ --- 48,51 ---- *************** *** 150,156 **** Token_Ring_addresses = Token_Ring_address ! class USB_address(aetools.ComponentItem): ! """USB address - Addresses a device on the Universal Serial Bus """ want = 'cusb' class name(aetools.NProperty): """name - the USB device name """ --- 112,120 ---- Token_Ring_addresses = Token_Ring_address ! class USB_Addresses(aetools.ComponentItem): ! """USB Addresses - """ want = 'cusb' + + USB_address = USB_Addresses class name(aetools.NProperty): """name - the USB device name """ *************** *** 158,178 **** want = 'TEXT' ! USB_Addresses = USB_address ! device_specification._superclassnames = [] ! device_specification._privpropdict = { ! 'properties' : properties, ! 'device_type' : device_type, ! 'device_address' : device_address, ! } ! device_specification._privelemdict = { ! } ! address_specification._superclassnames = [] ! address_specification._privpropdict = { ! 'properties' : properties, ! 'conduit' : conduit, ! 'protocol' : protocol, ! } ! address_specification._privelemdict = { ! } ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { --- 122,162 ---- want = 'TEXT' ! class address_specification(aetools.ComponentItem): ! """address specification - Unique designation of a device or service connected to this computer """ ! want = 'cadr' ! class properties(aetools.NProperty): ! """properties - property that allows getting and setting of multiple properties """ ! which = 'pALL' ! want = 'reco' ! class conduit(aetools.NProperty): ! """conduit - How the addressee is physically connected """ ! which = 'pcon' ! want = 'econ' ! class protocol(aetools.NProperty): ! """protocol - How to talk to this addressee """ ! which = 'pprt' ! want = 'epro' ! ! address_specifications = address_specification ! ! class bus_slot(aetools.ComponentItem): ! """bus slot - Addresses a PC, PCI, or NuBus card """ ! want = 'cbus' ! ! bus_slots = bus_slot ! ! class device_specification(aetools.ComponentItem): ! """device specification - A device connected to a computer """ ! want = 'cdev' ! class device_type(aetools.NProperty): ! """device type - the kind of device """ ! which = 'pdvt' ! want = 'edvt' ! class device_address(aetools.NProperty): ! """device address - the address of the device """ ! which = 'pdva' ! want = 'cadr' ! ! device_specifications = device_specification ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { *************** *** 191,201 **** AppleTalk_address._privelemdict = { } - bus_slot._superclassnames = ['address_specification'] - bus_slot._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, - 'ID' : ID, - } - bus_slot._privelemdict = { - } Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { --- 175,178 ---- *************** *** 246,279 **** Token_Ring_address._privelemdict = { } ! USB_address._superclassnames = ['address_specification'] ! USB_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'name' : name, } ! USB_address._privelemdict = { } ! _Enum_edvt = { ! 'hard_disk_drive' : 'ehd ', # ! 'floppy_disk_drive' : 'efd ', # ! 'CD_ROM_drive' : 'ecd ', # ! 'DVD_drive' : 'edvd', # ! 'storage_device' : 'edst', # ! 'keyboard' : 'ekbd', # ! 'mouse' : 'emou', # ! 'trackball' : 'etrk', # ! 'trackpad' : 'edtp', # ! 'pointing_device' : 'edpd', # ! 'video_monitor' : 'edvm', # ! 'LCD_display' : 'edlc', # ! 'display' : 'edds', # ! 'modem' : 'edmm', # ! 'PC_card' : 'ecpc', # ! 'PCI_card' : 'edpi', # ! 'NuBus_card' : 'ednb', # ! 'printer' : 'edpr', # ! 'speakers' : 'edsp', # ! 'microphone' : 'ecmi', # } - _Enum_econ = { 'ADB' : 'eadb', # --- 223,254 ---- Token_Ring_address._privelemdict = { } ! USB_Addresses._superclassnames = [] ! USB_Addresses._privpropdict = { ! } ! USB_Addresses._privelemdict = { ! } ! address_specification._superclassnames = [] ! address_specification._privpropdict = { ! 'properties' : properties, ! 'conduit' : conduit, ! 'protocol' : protocol, ! } ! address_specification._privelemdict = { ! } ! bus_slot._superclassnames = ['address_specification'] ! bus_slot._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, ! 'ID' : ID, } ! bus_slot._privelemdict = { } ! device_specification._superclassnames = [] ! device_specification._privpropdict = { ! 'properties' : properties, ! 'device_type' : device_type, ! 'device_address' : device_address, ! } ! device_specification._privelemdict = { } _Enum_econ = { 'ADB' : 'eadb', # *************** *** 302,305 **** --- 277,303 ---- } + _Enum_edvt = { + 'hard_disk_drive' : 'ehd ', # + 'floppy_disk_drive' : 'efd ', # + 'CD_ROM_drive' : 'ecd ', # + 'DVD_drive' : 'edvd', # + 'storage_device' : 'edst', # + 'keyboard' : 'ekbd', # + 'mouse' : 'emou', # + 'trackball' : 'etrk', # + 'trackpad' : 'edtp', # + 'pointing_device' : 'edpd', # + 'video_monitor' : 'edvm', # + 'LCD_display' : 'edlc', # + 'display' : 'edds', # + 'modem' : 'edmm', # + 'PC_card' : 'ecpc', # + 'PCI_card' : 'edpi', # + 'NuBus_card' : 'ednb', # + 'printer' : 'edpr', # + 'speakers' : 'edsp', # + 'microphone' : 'ecmi', # + } + _Enum_epro = { 'serial' : 'epsr', # *************** *** 336,343 **** 'cscs' : SCSI_address, 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, 'cip ' : IP_address, 'cen ' : Ethernet_address, } --- 334,341 ---- 'cscs' : SCSI_address, 'cadb' : ADB_address, ! 'cusb' : USB_Addresses, 'cip ' : IP_address, + 'clt ' : LocalTalk_address, + 'cdev' : device_specification, 'cen ' : Ethernet_address, } *************** *** 345,349 **** _propdeclarations = { 'pdns' : DNS_form, ! 'ppor' : port, 'patt' : AppleTalk_type, 'pprt' : protocol, --- 343,347 ---- _propdeclarations = { 'pdns' : DNS_form, ! 'pdva' : device_address, 'patt' : AppleTalk_type, 'pprt' : protocol, *************** *** 356,363 **** 'ID ' : ID, 'pALL' : properties, 'pscb' : SCSI_bus, ! 'pdva' : device_address, 'patm' : AppleTalk_machine, - 'psoc' : socket, 'pslu' : LUN, 'pnod' : node, --- 354,361 ---- 'ID ' : ID, 'pALL' : properties, + 'psoc' : socket, 'pscb' : SCSI_bus, ! 'ppor' : port, 'patm' : AppleTalk_machine, 'pslu' : LUN, 'pnod' : node, Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuickDraw_Graphics_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- QuickDraw_Graphics_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 *************** *** 120,123 **** --- 120,129 ---- drawing_areas = drawing_area + class graphic_group(aetools.ComponentItem): + """graphic group - Group of graphics """ + want = 'cpic' + + graphic_groups = graphic_group + class graphic_line(aetools.ComponentItem): """graphic line - A graphic line """ *************** *** 174,183 **** want = 'tsty' - class graphic_group(aetools.ComponentItem): - """graphic group - Group of graphics """ - want = 'cpic' - - graphic_groups = graphic_group - class oval(aetools.ComponentItem): """oval - An oval """ --- 180,183 ---- *************** *** 190,195 **** want = 'cpxl' - pixels = pixel - class pixel_map(aetools.ComponentItem): """pixel map - A pixel map """ --- 190,193 ---- *************** *** 198,201 **** --- 196,201 ---- pixel_maps = pixel_map + pixels = pixel + class polygon(aetools.ComponentItem): """polygon - A polygon """ *************** *** 260,263 **** --- 260,268 ---- drawing_area._privelemdict = { } + graphic_group._superclassnames = [] + graphic_group._privpropdict = { + } + graphic_group._privelemdict = { + } graphic_line._superclassnames = [] graphic_line._privpropdict = { *************** *** 288,296 **** graphic_text._privelemdict = { } - graphic_group._superclassnames = [] - graphic_group._privpropdict = { - } - graphic_group._privelemdict = { - } oval._superclassnames = [] oval._privpropdict = { --- 293,296 ---- *************** *** 327,330 **** --- 327,337 ---- rounded_rectangle._privelemdict = { } + _Enum_arro = { + 'no_arrow' : 'arno', # No arrow on line + 'arrow_at_start' : 'arst', # Arrow at start of line + 'arrow_at_end' : 'aren', # Arrow at end of line + 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line + } + _Enum_tran = { 'copy_pixels' : 'cpy ', # *************** *** 343,353 **** 'ad_min_pixels' : 'admn', # 'blend_pixels' : 'blnd', # - } - - _Enum_arro = { - 'no_arrow' : 'arno', # No arrow on line - 'arrow_at_start' : 'arst', # Arrow at start of line - 'arrow_at_end' : 'aren', # Arrow at end of line - 'arrow_at_both_ends' : 'arbo', # Arrow at both the start and the end of the line } --- 350,353 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Standard_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 *************** *** 14,111 **** class Standard_Suite_Events(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, --- 14,34 ---- class Standard_Suite_Events(builtin_Suite_Events): ! _argmap_class_info = { ! 'in_' : 'wrcd', } ! def class_info(self, _object=None, _attributes={}, **_arguments): ! """class info: (optional) Get information about an object class ! Required argument: the object class about which information is requested ! Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary + Returns: a record containing the object\xd5s properties and elements """ ! _code = 'core' ! _subcode = 'qobj' ! aetools.keysubst(_arguments, self._argmap_class_info) ! _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, *************** *** 171,174 **** --- 94,123 ---- return _arguments['----'] + _argmap_data_size = { + 'as' : 'rtyp', + } + + def data_size(self, _object, _attributes={}, **_arguments): + """data size: (optional) Return the size in bytes of an object + Required argument: the object whose data size is to be returned + Keyword argument as: the data type for which the size is calculated + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the size of the object in bytes + """ + _code = 'core' + _subcode = 'dsiz' + + aetools.keysubst(_arguments, self._argmap_data_size) + _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 delete(self, _object, _attributes={}, **_arguments): """delete: Delete an object from its container. Note this does not work on script variables, only on elements of application classes. *************** *** 219,222 **** --- 168,197 ---- return _arguments['----'] + _argmap_event_info = { + 'in_' : 'wrcd', + } + + def event_info(self, _object, _attributes={}, **_arguments): + """event info: (optional) Get information about the Apple events in a suite + Required argument: the event class of the Apple events for which to return information + Keyword argument in_: the human language and script system in which to return information + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: a record containing the events and their parameters + """ + _code = 'core' + _subcode = 'gtei' + + aetools.keysubst(_arguments, self._argmap_event_info) + _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 exists(self, _object, _attributes={}, **_arguments): """exists: Verify if an object exists *************** *** 297,316 **** return _arguments['----'] ! _argmap_save = { ! 'in_' : 'kfil', ! 'as' : 'fltp', ! } ! ! def save(self, _object, _attributes={}, **_arguments): ! """save: Save an object ! Required argument: the object to save, usually a document or window ! Keyword argument in_: the file or alias in which to save the object ! Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'core' ! _subcode = 'save' ! aetools.keysubst(_arguments, self._argmap_save) _arguments['----'] = _object --- 272,284 ---- return _arguments['----'] ! 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 *************** *** 324,334 **** return _arguments['----'] ! def select(self, _object, _attributes={}, **_arguments): ! """select: Make a selection ! Required argument: the object to select Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'misc' ! _subcode = 'slct' if _arguments: raise TypeError, 'No optional args expected' --- 292,302 ---- 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' *************** *** 344,364 **** return _arguments['----'] ! _argmap_data_size = { ! 'as' : 'rtyp', } ! def data_size(self, _object, _attributes={}, **_arguments): ! """data size: (optional) Return the size in bytes of an object ! Required argument: the object whose data size is to be returned ! Keyword argument as: the data type for which the size is calculated Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the size of the object in bytes """ ! _code = 'core' ! _subcode = 'dsiz' ! aetools.keysubst(_arguments, self._argmap_data_size) ! _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, --- 312,331 ---- 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, *************** *** 370,389 **** return _arguments['----'] ! _argmap_suite_info = { ! 'in_' : 'wrcd', ! } ! def suite_info(self, _object, _attributes={}, **_arguments): ! """suite info: (optional) Get information about event suite(s) ! Required argument: the suite for which to return information ! Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary - Returns: a record containing the suites and their versions """ ! _code = 'core' ! _subcode = 'gtsi' ! aetools.keysubst(_arguments, self._argmap_suite_info) ! _arguments['----'] = _object --- 337,368 ---- 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 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' *************** *** 396,414 **** return _arguments['----'] ! _argmap_event_info = { ! 'in_' : 'wrcd', } ! def event_info(self, _object, _attributes={}, **_arguments): ! """event info: (optional) Get information about the Apple events in a suite ! Required argument: the event class of the Apple events for which to return information ! Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary - Returns: a record containing the events and their parameters """ _code = 'core' ! _subcode = 'gtei' ! aetools.keysubst(_arguments, self._argmap_event_info) _arguments['----'] = _object --- 375,394 ---- return _arguments['----'] ! _argmap_save = { ! 'in_' : 'kfil', ! 'as' : 'fltp', } ! def save(self, _object, _attributes={}, **_arguments): ! """save: Save an object ! Required argument: the object to save, usually a document or window ! Keyword argument in_: the file or alias in which to save the object ! Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' ! _subcode = 'save' ! aetools.keysubst(_arguments, self._argmap_save) _arguments['----'] = _object *************** *** 422,440 **** return _arguments['----'] ! _argmap_class_info = { 'in_' : 'wrcd', } ! def class_info(self, _object=None, _attributes={}, **_arguments): ! """class info: (optional) Get information about an object class ! Required argument: the object class about which information is requested Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the object\xd5s properties and elements """ _code = 'core' ! _subcode = 'qobj' ! aetools.keysubst(_arguments, self._argmap_class_info) _arguments['----'] = _object --- 402,440 ---- return _arguments['----'] ! def select(self, _object, _attributes={}, **_arguments): ! """select: Make a selection ! Required argument: the object to select ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'slct' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] ! ! _argmap_suite_info = { 'in_' : 'wrcd', } ! def suite_info(self, _object, _attributes={}, **_arguments): ! """suite info: (optional) Get information about event suite(s) ! Required argument: the suite for which to return information Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the suites and their versions """ _code = 'core' ! _subcode = 'gtsi' ! aetools.keysubst(_arguments, self._argmap_suite_info) _arguments['----'] = _object *************** *** 449,452 **** --- 449,458 ---- + class alias(aetools.ComponentItem): + """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """ + want = 'alis' + + aliases = alias + class application(aetools.ComponentItem): """application - An application program """ *************** *** 495,503 **** files = file ! class alias(aetools.ComponentItem): ! """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """ ! want = 'alis' ! aliases = alias class selection_2d_object(aetools.ComponentItem): --- 501,509 ---- files = file ! class insertion_point(aetools.ComponentItem): ! """insertion point - An insertion location between two objects """ ! want = 'cins' ! insertion_points = insertion_point class selection_2d_object(aetools.ComponentItem): *************** *** 554,563 **** windows = window ! ! class insertion_point(aetools.ComponentItem): ! """insertion point - An insertion location between two objects """ ! want = 'cins' ! ! insertion_points = insertion_point application._superclassnames = [] application._privpropdict = { --- 560,568 ---- windows = window ! alias._superclassnames = [] ! alias._privpropdict = { ! } ! alias._privelemdict = { ! } application._superclassnames = [] application._privpropdict = { *************** *** 582,589 **** file._privelemdict = { } ! alias._superclassnames = [] ! alias._privpropdict = { } ! alias._privelemdict = { } selection_2d_object._superclassnames = [] --- 587,594 ---- file._privelemdict = { } ! insertion_point._superclassnames = [] ! insertion_point._privpropdict = { } ! insertion_point._privelemdict = { } selection_2d_object._superclassnames = [] *************** *** 608,642 **** window._privelemdict = { } ! insertion_point._superclassnames = [] ! insertion_point._privpropdict = { ! } ! insertion_point._privelemdict = { ! } ! class starts_with(aetools.NComparison): ! """starts with - Starts with """ ! class contains(aetools.NComparison): ! """contains - Contains """ ! class ends_with(aetools.NComparison): ! """ends with - Ends with """ class _3d_(aetools.NComparison): """= - Equal """ class _3e_(aetools.NComparison): """> - Greater than """ ! class _b3_(aetools.NComparison): ! """\xb3 - Greater than or equal to """ ! class _3c_(aetools.NComparison): ! """< - Less than """ class _b2_(aetools.NComparison): """\xb2 - Less than or equal to """ ! _Enum_savo = { ! 'yes' : 'yes ', # Save objects now ! 'no' : 'no ', # Do not save objects ! 'ask' : 'ask ', # Ask the user whether to save ! } ! _Enum_kfrm = { 'index' : 'indx', # keyform designating indexed access 'named' : 'name', # keyform designating named access 'id' : 'ID ', # keyform designating access by unique identifier } --- 613,642 ---- window._privelemdict = { } ! class _3c_(aetools.NComparison): ! """< - Less than """ class _3d_(aetools.NComparison): """= - Equal """ class _3e_(aetools.NComparison): """> - Greater than """ ! class contains(aetools.NComparison): ! """contains - Contains """ ! class ends_with(aetools.NComparison): ! """ends with - Ends with """ ! class starts_with(aetools.NComparison): ! """starts with - Starts with """ class _b2_(aetools.NComparison): """\xb2 - Less than or equal to """ ! class _b3_(aetools.NComparison): ! """\xb3 - Greater than or equal to """ _Enum_kfrm = { 'index' : 'indx', # keyform designating indexed access 'named' : 'name', # keyform designating named access 'id' : 'ID ', # keyform designating access by unique identifier + } + + _Enum_savo = { + 'yes' : 'yes ', # Save objects now + 'no' : 'no ', # Do not save objects + 'ask' : 'ask ', # Ask the user whether to save } Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Type_Names_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Type_Names_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 *************** *** 16,34 **** ! class type_class_info(aetools.ComponentItem): ! """type class info - information about properties and elements of a class """ ! want = 'gcli' ! class type_event_info(aetools.ComponentItem): ! """type event info - information about an event """ ! want = 'evin' ! class plain_text(aetools.ComponentItem): ! """plain text - """ ! want = 'TEXT' ! plain_text = plain_text ! string = plain_text class bounding_rectangle(aetools.ComponentItem): --- 16,38 ---- ! class PostScript_picture(aetools.ComponentItem): ! """PostScript picture - """ ! want = 'EPS ' ! class RGB16_color(aetools.ComponentItem): ! """RGB16 color - """ ! want = 'tr16' ! class RGB96_color(aetools.ComponentItem): ! """RGB96 color - """ ! want = 'tr96' ! class TIFF_picture(aetools.ComponentItem): ! """TIFF picture - """ ! want = 'TIFF' ! class application_dictionary(aetools.ComponentItem): ! """application dictionary - """ ! want = 'aete' class bounding_rectangle(aetools.ComponentItem): *************** *** 36,55 **** want = 'qdrt' - class point(aetools.ComponentItem): - """point - point coordinates """ - want = 'QDpt' - - class fixed(aetools.ComponentItem): - """fixed - a real number """ - want = 'fixd' - - class location_reference(aetools.ComponentItem): - """location reference - """ - want = 'insl' - - class application_dictionary(aetools.ComponentItem): - """application dictionary - """ - want = 'aete' - class color_table(aetools.ComponentItem): """color table - """ --- 40,43 ---- *************** *** 68,71 **** --- 56,63 ---- want = 'exte' + class fixed(aetools.ComponentItem): + """fixed - a real number """ + want = 'fixd' + class fixed_point(aetools.ComponentItem): """fixed point - """ *************** *** 76,79 **** --- 68,75 ---- want = 'frct' + class location_reference(aetools.ComponentItem): + """location reference - """ + want = 'insl' + class long_fixed(aetools.ComponentItem): """long fixed - """ *************** *** 116,130 **** want = 'tpmm' ! class PostScript_picture(aetools.ComponentItem): ! """PostScript picture - """ ! want = 'EPS ' ! class RGB16_color(aetools.ComponentItem): ! """RGB16 color - """ ! want = 'tr16' ! class RGB96_color(aetools.ComponentItem): ! """RGB96 color - """ ! want = 'tr96' class small_integer(aetools.ComponentItem): --- 112,132 ---- want = 'tpmm' ! class plain_text(aetools.ComponentItem): ! """plain text - """ ! want = 'TEXT' ! plain_text = plain_text ! class point(aetools.ComponentItem): ! """point - point coordinates """ ! want = 'QDpt' ! ! class rotation(aetools.ComponentItem): ! """rotation - """ ! want = 'trot' ! ! class scrap_styles(aetools.ComponentItem): ! """scrap styles - """ ! want = 'styl' class small_integer(aetools.ComponentItem): *************** *** 136,166 **** want = 'sing' class system_dictionary(aetools.ComponentItem): """system dictionary - """ want = 'aeut' ! class rotation(aetools.ComponentItem): ! """rotation - """ ! want = 'trot' ! ! class scrap_styles(aetools.ComponentItem): ! """scrap styles - """ ! want = 'styl' ! ! class TIFF_picture(aetools.ComponentItem): ! """TIFF picture - """ ! want = 'TIFF' ! ! class version(aetools.ComponentItem): ! """version - """ ! want = 'vers' ! ! class unsigned_integer(aetools.ComponentItem): ! """unsigned integer - """ ! want = 'magn' ! class type_property_info(aetools.ComponentItem): ! """type property info - """ ! want = 'pinf' class type_element_info(aetools.ComponentItem): --- 138,154 ---- want = 'sing' + string = plain_text + class system_dictionary(aetools.ComponentItem): """system dictionary - """ want = 'aeut' ! class target_id(aetools.ComponentItem): ! """target id - """ ! want = 'targ' ! class type_class_info(aetools.ComponentItem): ! """type class info - information about properties and elements of a class """ ! want = 'gcli' class type_element_info(aetools.ComponentItem): *************** *** 168,221 **** want = 'elin' class type_parameter_info(aetools.ComponentItem): """type parameter info - """ want = 'pmin' class type_suite_info(aetools.ComponentItem): """type suite info - """ want = 'suin' ! class target_id(aetools.ComponentItem): ! """target id - """ ! want = 'targ' ! type_class_info._superclassnames = [] ! type_class_info._privpropdict = { ! } ! type_class_info._privelemdict = { ! } ! type_event_info._superclassnames = [] ! type_event_info._privpropdict = { ! } ! type_event_info._privelemdict = { ! } ! plain_text._superclassnames = [] ! plain_text._privpropdict = { ! } ! plain_text._privelemdict = { ! } ! plain_text._superclassnames = [] ! plain_text._privpropdict = { ! } ! plain_text._privelemdict = { ! } ! bounding_rectangle._superclassnames = [] ! bounding_rectangle._privpropdict = { } ! bounding_rectangle._privelemdict = { } ! point._superclassnames = [] ! point._privpropdict = { } ! point._privelemdict = { } ! fixed._superclassnames = [] ! fixed._privpropdict = { } ! fixed._privelemdict = { } ! location_reference._superclassnames = [] ! location_reference._privpropdict = { } ! location_reference._privelemdict = { } application_dictionary._superclassnames = [] --- 156,201 ---- want = 'elin' + class type_event_info(aetools.ComponentItem): + """type event info - information about an event """ + want = 'evin' + class type_parameter_info(aetools.ComponentItem): """type parameter info - """ want = 'pmin' + class type_property_info(aetools.ComponentItem): + """type property info - """ + want = 'pinf' + class type_suite_info(aetools.ComponentItem): """type suite info - """ want = 'suin' ! class unsigned_integer(aetools.ComponentItem): ! """unsigned integer - """ ! want = 'magn' ! ! class version(aetools.ComponentItem): ! """version - """ ! want = 'vers' ! PostScript_picture._superclassnames = [] ! PostScript_picture._privpropdict = { } ! PostScript_picture._privelemdict = { } ! RGB16_color._superclassnames = [] ! RGB16_color._privpropdict = { } ! RGB16_color._privelemdict = { } ! RGB96_color._superclassnames = [] ! RGB96_color._privpropdict = { } ! RGB96_color._privelemdict = { } ! TIFF_picture._superclassnames = [] ! TIFF_picture._privpropdict = { } ! TIFF_picture._privelemdict = { } application_dictionary._superclassnames = [] *************** *** 224,227 **** --- 204,212 ---- application_dictionary._privelemdict = { } + bounding_rectangle._superclassnames = [] + bounding_rectangle._privpropdict = { + } + bounding_rectangle._privelemdict = { + } color_table._superclassnames = [] color_table._privpropdict = { *************** *** 244,247 **** --- 229,237 ---- extended_real._privelemdict = { } + fixed._superclassnames = [] + fixed._privpropdict = { + } + fixed._privelemdict = { + } fixed_point._superclassnames = [] fixed_point._privpropdict = { *************** *** 254,257 **** --- 244,252 ---- fixed_rectangle._privelemdict = { } + location_reference._superclassnames = [] + location_reference._privpropdict = { + } + location_reference._privelemdict = { + } long_fixed._superclassnames = [] long_fixed._privpropdict = { *************** *** 304,321 **** pixel_map_record._privelemdict = { } ! PostScript_picture._superclassnames = [] ! PostScript_picture._privpropdict = { } ! PostScript_picture._privelemdict = { } ! RGB16_color._superclassnames = [] ! RGB16_color._privpropdict = { } ! RGB16_color._privelemdict = { } ! RGB96_color._superclassnames = [] ! RGB96_color._privpropdict = { } ! RGB96_color._privelemdict = { } small_integer._superclassnames = [] --- 299,326 ---- pixel_map_record._privelemdict = { } ! plain_text._superclassnames = [] ! plain_text._privpropdict = { } ! plain_text._privelemdict = { } ! plain_text._superclassnames = [] ! plain_text._privpropdict = { } ! plain_text._privelemdict = { } ! point._superclassnames = [] ! point._privpropdict = { } ! point._privelemdict = { ! } ! rotation._superclassnames = [] ! rotation._privpropdict = { ! } ! rotation._privelemdict = { ! } ! scrap_styles._superclassnames = [] ! scrap_styles._privpropdict = { ! } ! scrap_styles._privelemdict = { } small_integer._superclassnames = [] *************** *** 334,361 **** system_dictionary._privelemdict = { } ! rotation._superclassnames = [] ! rotation._privpropdict = { } ! rotation._privelemdict = { } ! scrap_styles._superclassnames = [] ! scrap_styles._privpropdict = { } ! scrap_styles._privelemdict = { } ! TIFF_picture._superclassnames = [] ! TIFF_picture._privpropdict = { } ! TIFF_picture._privelemdict = { } ! version._superclassnames = [] ! version._privpropdict = { } ! version._privelemdict = { } ! unsigned_integer._superclassnames = [] ! unsigned_integer._privpropdict = { } ! unsigned_integer._privelemdict = { } type_property_info._superclassnames = [] --- 339,366 ---- system_dictionary._privelemdict = { } ! target_id._superclassnames = [] ! target_id._privpropdict = { } ! target_id._privelemdict = { } ! type_class_info._superclassnames = [] ! type_class_info._privpropdict = { } ! type_class_info._privelemdict = { } ! type_element_info._superclassnames = [] ! type_element_info._privpropdict = { } ! type_element_info._privelemdict = { } ! type_event_info._superclassnames = [] ! type_event_info._privpropdict = { } ! type_event_info._privelemdict = { } ! type_parameter_info._superclassnames = [] ! type_parameter_info._privpropdict = { } ! type_parameter_info._privelemdict = { } type_property_info._superclassnames = [] *************** *** 364,377 **** type_property_info._privelemdict = { } - type_element_info._superclassnames = [] - type_element_info._privpropdict = { - } - type_element_info._privelemdict = { - } - type_parameter_info._superclassnames = [] - type_parameter_info._privpropdict = { - } - type_parameter_info._privelemdict = { - } type_suite_info._superclassnames = [] type_suite_info._privpropdict = { --- 369,372 ---- *************** *** 379,386 **** type_suite_info._privelemdict = { } ! target_id._superclassnames = [] ! target_id._privpropdict = { } ! target_id._privelemdict = { } --- 374,386 ---- type_suite_info._privelemdict = { } ! unsigned_integer._superclassnames = [] ! unsigned_integer._privpropdict = { } ! unsigned_integer._privelemdict = { ! } ! version._superclassnames = [] ! version._privpropdict = { ! } ! version._privelemdict = { } *************** *** 395,399 **** 'clrt' : color_table, 'fpnt' : fixed_point, ! 'TEXT' : plain_text, 'elin' : type_element_info, 'insl' : location_reference, --- 395,399 ---- 'clrt' : color_table, 'fpnt' : fixed_point, ! 'TIFF' : TIFF_picture, 'elin' : type_element_info, 'insl' : location_reference, *************** *** 404,410 **** --- 404,412 ---- 'tpmm' : pixel_map_record, 'aete' : application_dictionary, + 'TEXT' : plain_text, 'magn' : unsigned_integer, 'cmnu' : menu, 'frct' : fixed_rectangle, + 'pinf' : type_property_info, 'lfrc' : long_fixed_rectangle, 'evin' : type_event_info, *************** *** 412,425 **** '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, --- 414,425 ---- 'suin' : type_suite_info, 'trot' : rotation, 'fixd' : fixed, 'styl' : scrap_styles, 'lpnt' : long_point, 'gcli' : type_class_info, 'tr96' : RGB96_color, 'tdas' : dash_style, 'exte' : extended_real, ! 'pmin' : type_parameter_info, 'lfpt' : long_fixed_point, 'lrct' : long_rectangle, Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Mar 2003 22:07:28 -0000 1.2 --- __init__.py 28 Mar 2003 22:07:21 -0000 1.3 *************** *** 5,28 **** import aetools Error = aetools.Error import AppleScript_Suite - import Required_Suite import Standard_Suite ! import Text_Suite import QuickDraw_Graphics_Suite import QuickDraw_Graphics_Suppleme import Table_Suite - import Macintosh_Connectivity_Clas import Type_Names_Suite _code_to_module = { 'ascr' : AppleScript_Suite, - 'reqd' : Required_Suite, 'core' : Standard_Suite, ! 'TEXT' : Text_Suite, 'qdrw' : QuickDraw_Graphics_Suite, 'qdsp' : QuickDraw_Graphics_Suppleme, 'tbls' : Table_Suite, - 'macc' : Macintosh_Connectivity_Clas, 'tpnm' : Type_Names_Suite, } --- 5,28 ---- import aetools Error = aetools.Error + import Text_Suite import AppleScript_Suite import Standard_Suite ! import Macintosh_Connectivity_Clas import QuickDraw_Graphics_Suite import QuickDraw_Graphics_Suppleme + import Required_Suite import Table_Suite import Type_Names_Suite _code_to_module = { + 'TEXT' : Text_Suite, 'ascr' : AppleScript_Suite, 'core' : Standard_Suite, ! 'macc' : Macintosh_Connectivity_Clas, 'qdrw' : QuickDraw_Graphics_Suite, 'qdsp' : QuickDraw_Graphics_Suppleme, + 'reqd' : Required_Suite, 'tbls' : Table_Suite, 'tpnm' : Type_Names_Suite, } *************** *** 31,53 **** _code_to_fullname = { 'ascr' : ('StdSuites.AppleScript_Suite', 'AppleScript_Suite'), - 'reqd' : ('StdSuites.Required_Suite', 'Required_Suite'), 'core' : ('StdSuites.Standard_Suite', 'Standard_Suite'), ! 'TEXT' : ('StdSuites.Text_Suite', 'Text_Suite'), 'qdrw' : ('StdSuites.QuickDraw_Graphics_Suite', 'QuickDraw_Graphics_Suite'), 'qdsp' : ('StdSuites.QuickDraw_Graphics_Suppleme', 'QuickDraw_Graphics_Suppleme'), 'tbls' : ('StdSuites.Table_Suite', 'Table_Suite'), - 'macc' : ('StdSuites.Macintosh_Connectivity_Clas', 'Macintosh_Connectivity_Clas'), 'tpnm' : ('StdSuites.Type_Names_Suite', 'Type_Names_Suite'), } from AppleScript_Suite import * - from Required_Suite import * from Standard_Suite import * ! from Text_Suite import * from QuickDraw_Graphics_Suite import * from QuickDraw_Graphics_Suppleme import * from Table_Suite import * - from Macintosh_Connectivity_Clas import * from Type_Names_Suite import * --- 31,53 ---- _code_to_fullname = { + 'TEXT' : ('StdSuites.Text_Suite', 'Text_Suite'), 'ascr' : ('StdSuites.AppleScript_Suite', 'AppleScript_Suite'), 'core' : ('StdSuites.Standard_Suite', 'Standard_Suite'), ! 'macc' : ('StdSuites.Macintosh_Connectivity_Clas', 'Macintosh_Connectivity_Clas'), 'qdrw' : ('StdSuites.QuickDraw_Graphics_Suite', 'QuickDraw_Graphics_Suite'), 'qdsp' : ('StdSuites.QuickDraw_Graphics_Suppleme', 'QuickDraw_Graphics_Suppleme'), + 'reqd' : ('StdSuites.Required_Suite', 'Required_Suite'), 'tbls' : ('StdSuites.Table_Suite', 'Table_Suite'), 'tpnm' : ('StdSuites.Type_Names_Suite', 'Type_Names_Suite'), } + from Text_Suite import * from AppleScript_Suite import * from Standard_Suite import * ! from Macintosh_Connectivity_Clas import * from QuickDraw_Graphics_Suite import * from QuickDraw_Graphics_Suppleme import * + from Required_Suite import * from Table_Suite import * from Type_Names_Suite import * *************** *** 69,72 **** --- 69,157 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(selection_2d_object) + getbaseclasses(alias) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(small_integer) + getbaseclasses(RGB16_color) + getbaseclasses(version) + getbaseclasses(system_dictionary) + getbaseclasses(color_table) + getbaseclasses(fixed_point) + getbaseclasses(plain_text) + getbaseclasses(type_element_info) + getbaseclasses(location_reference) + getbaseclasses(machine_location) + getbaseclasses(PostScript_picture) + getbaseclasses(point) + getbaseclasses(menu_item) + getbaseclasses(pixel_map_record) + getbaseclasses(application_dictionary) + getbaseclasses(unsigned_integer) + getbaseclasses(menu) + getbaseclasses(fixed_rectangle) + getbaseclasses(long_fixed_rectangle) + getbaseclasses(type_event_info) + getbaseclasses(small_real) + getbaseclasses(type_suite_info) + getbaseclasses(rotation) + getbaseclasses(type_parameter_info) + getbaseclasses(fixed) + getbaseclasses(scrap_styles) + getbaseclasses(long_point) + getbaseclasses(type_class_info) + getbaseclasses(TIFF_picture) + getbaseclasses(RGB96_color) + getbaseclasses(dash_style) + getbaseclasses(extended_real) + getbaseclasses(type_property_info) + getbaseclasses(long_fixed_point) + getbaseclasses(long_rectangle) + getbaseclasses(bounding_rectangle) + getbaseclasses(double_integer) + getbaseclasses(long_fixed) + getbaseclasses(null) + getbaseclasses(target_id) + getbaseclasses(paragraph) + getbaseclasses(character) + getbaseclasses(text_flow) + getbaseclasses(text_style_info) + getbaseclasses(line) + getbaseclasses(word) + getbaseclasses(text) + getbaseclasses(graphic_group) + getbaseclasses(oval) + getbaseclasses(graphic_text) + getbaseclasses(graphic_shape) + getbaseclasses(graphic_line) + getbaseclasses(graphic_object) + getbaseclasses(drawing_area) + getbaseclasses(polygon) + getbaseclasses(pixel) + getbaseclasses(rounded_rectangle) + getbaseclasses(arc) + getbaseclasses(pixel_map) + getbaseclasses(rectangle) + getbaseclasses(graphic_group) + getbaseclasses(drawing_area) + getbaseclasses(cell) + getbaseclasses(column) + getbaseclasses(table) + getbaseclasses(row) + getbaseclasses(AppleTalk_address) + getbaseclasses(address_specification) + getbaseclasses(Token_Ring_address) + getbaseclasses(FireWire_address) + getbaseclasses(bus_slot) + getbaseclasses(SCSI_address) + getbaseclasses(ADB_address) + getbaseclasses(USB_address) + getbaseclasses(device_specification) + getbaseclasses(LocalTalk_address) + getbaseclasses(IP_address) + getbaseclasses(Ethernet_address) getbaseclasses(July) getbaseclasses(May) *************** *** 174,262 **** getbaseclasses(file_specification) getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(selection_2d_object) - getbaseclasses(alias) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) - getbaseclasses(paragraph) - getbaseclasses(character) - getbaseclasses(text_flow) - getbaseclasses(text_style_info) - getbaseclasses(line) - getbaseclasses(word) - getbaseclasses(text) - getbaseclasses(graphic_group) - getbaseclasses(oval) - getbaseclasses(graphic_text) - getbaseclasses(graphic_shape) - getbaseclasses(graphic_line) - getbaseclasses(graphic_object) - getbaseclasses(drawing_area) - getbaseclasses(polygon) - getbaseclasses(pixel) - getbaseclasses(rounded_rectangle) - getbaseclasses(arc) - getbaseclasses(pixel_map) - getbaseclasses(rectangle) - getbaseclasses(graphic_group) - getbaseclasses(drawing_area) - getbaseclasses(cell) - getbaseclasses(column) - getbaseclasses(table) - getbaseclasses(row) - getbaseclasses(AppleTalk_address) - getbaseclasses(address_specification) - getbaseclasses(Token_Ring_address) - getbaseclasses(FireWire_address) - getbaseclasses(bus_slot) - getbaseclasses(SCSI_address) - getbaseclasses(ADB_address) - getbaseclasses(USB_address) - getbaseclasses(device_specification) - getbaseclasses(LocalTalk_address) - getbaseclasses(IP_address) - getbaseclasses(Ethernet_address) - getbaseclasses(small_integer) - getbaseclasses(RGB16_color) - getbaseclasses(version) - getbaseclasses(system_dictionary) - getbaseclasses(color_table) - getbaseclasses(fixed_point) - getbaseclasses(plain_text) - getbaseclasses(type_element_info) - getbaseclasses(location_reference) - getbaseclasses(machine_location) - getbaseclasses(PostScript_picture) - getbaseclasses(point) - getbaseclasses(menu_item) - getbaseclasses(pixel_map_record) - getbaseclasses(application_dictionary) - getbaseclasses(unsigned_integer) - getbaseclasses(menu) - getbaseclasses(fixed_rectangle) - getbaseclasses(long_fixed_rectangle) - getbaseclasses(type_event_info) - getbaseclasses(small_real) - getbaseclasses(type_suite_info) - getbaseclasses(rotation) - getbaseclasses(type_parameter_info) - getbaseclasses(fixed) - getbaseclasses(scrap_styles) - getbaseclasses(long_point) - getbaseclasses(type_class_info) - getbaseclasses(TIFF_picture) - getbaseclasses(RGB96_color) - getbaseclasses(dash_style) - getbaseclasses(extended_real) - getbaseclasses(type_property_info) - getbaseclasses(long_fixed_point) - getbaseclasses(long_rectangle) - getbaseclasses(bounding_rectangle) - getbaseclasses(double_integer) - getbaseclasses(long_fixed) - getbaseclasses(null) - getbaseclasses(target_id) # --- 259,262 ---- *************** *** 264,267 **** --- 264,352 ---- # _classdeclarations = { + 'cwin' : window, + 'file' : file, + 'csel' : selection_2d_object, + 'alis' : alias, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + '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, + 'cpar' : paragraph, + 'cha ' : character, + 'cflo' : text_flow, + 'tsty' : text_style_info, + 'clin' : line, + 'cwor' : word, + 'ctxt' : text, + '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, + 'cpic' : graphic_group, + 'cdrw' : drawing_area, + 'ccel' : cell, + 'ccol' : column, + 'ctbl' : table, + 'crow' : row, + '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, 'jul ' : July, 'may ' : May, *************** *** 369,468 **** 'fss ' : file_specification, 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'csel' : selection_2d_object, - 'alis' : alias, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, - 'cpar' : paragraph, - 'cha ' : character, - 'cflo' : text_flow, - 'tsty' : text_style_info, - 'clin' : line, - 'cwor' : word, - 'ctxt' : text, - '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, - 'cpic' : graphic_group, - 'cdrw' : drawing_area, - 'ccel' : cell, - 'ccol' : column, - 'ctbl' : table, - 'crow' : row, - '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, - '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, } ! class StdSuites(AppleScript_Suite_Events, ! Required_Suite_Events, Standard_Suite_Events, ! Text_Suite_Events, QuickDraw_Graphics_Suite_Events, QuickDraw_Graphics_Suppleme_Events, Table_Suite_Events, - Macintosh_Connectivity_Clas_Events, Type_Names_Suite_Events, aetools.TalkTo): --- 454,468 ---- 'fss ' : file_specification, 'ctxt' : text, } ! class StdSuites(Text_Suite_Events, ! AppleScript_Suite_Events, Standard_Suite_Events, ! Macintosh_Connectivity_Clas_Events, QuickDraw_Graphics_Suite_Events, QuickDraw_Graphics_Suppleme_Events, + Required_Suite_Events, Table_Suite_Events, Type_Names_Suite_Events, aetools.TalkTo): From jackjansen@users.sourceforge.net Fri Mar 28 22:07:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:07:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.2,1.3 Required_Suite.py,1.2,1.3 Web_Browser_Suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv21742/Explorer Modified Files: Microsoft_Internet_Explorer.py Required_Suite.py Web_Browser_Suite.py __init__.py Log Message: Regenerated (from resource files) with sorting version of gensuitemodule. This is a first step towards regenerating the modules with newer, MacOSX, versions of these programs, and using the programmatic interface to get at the terminology in stead of poking in resource files. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Microsoft_Internet_Explorer.py 23 Mar 2003 22:07:27 -0000 1.2 --- Microsoft_Internet_Explorer.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 34,52 **** return _arguments['----'] ! _argmap_do_script = { ! 'window' : 'WIND', ! } ! ! def do_script(self, _object, _attributes={}, **_arguments): ! """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 """ _code = 'misc' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) _arguments['----'] = _object --- 34,46 ---- 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 *************** *** 60,72 **** 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 --- 54,72 ---- return _arguments['----'] ! _argmap_do_script = { ! 'window' : 'WIND', ! } ! ! def do_script(self, _object, _attributes={}, **_arguments): ! """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 """ _code = 'misc' ! _subcode = 'dosc' ! aetools.keysubst(_arguments, self._argmap_do_script) _arguments['----'] = _object Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Required_Suite.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 14,26 **** class Required_Suite_Events(Required_Suite_Events): ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: 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' --- 14,27 ---- class Required_Suite_Events(Required_Suite_Events): ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open documents ! Required argument: undocumented, typecode 'alis' Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'odoc' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object *************** *** 33,43 **** return _arguments['----'] ! def open(self, _object, _attributes={}, **_arguments): ! """open: Open documents Required argument: undocumented, typecode 'alis' Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'odoc' if _arguments: raise TypeError, 'No optional args expected' --- 34,44 ---- return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print documents Required argument: undocumented, typecode 'alis' Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'pdoc' if _arguments: raise TypeError, 'No optional args expected' *************** *** 53,66 **** return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): ! """print: Print documents ! Required argument: undocumented, typecode 'alis' Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'pdoc' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object --- 54,66 ---- return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit application Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'quit' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 73,82 **** return _arguments['----'] ! def quit(self, _no_object=None, _attributes={}, **_arguments): ! """quit: Quit application Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'quit' if _arguments: raise TypeError, 'No optional args expected' --- 73,82 ---- return _arguments['----'] ! def run(self, _no_object=None, _attributes={}, **_arguments): ! """run: Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' ! _subcode = 'oapp' if _arguments: raise TypeError, 'No optional args expected' Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Web_Browser_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Web_Browser_Suite.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 13,67 **** class Web_Browser_Suite_Events: ! _argmap_OpenURL = { ! 'to' : 'INTO', ! 'toWindow' : 'WIND', ! '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!' ! _subcode = 'OURL' ! ! aetools.keysubst(_arguments, self._argmap_OpenURL) ! _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_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!' ! _subcode = 'SHWF' ! aetools.keysubst(_arguments, self._argmap_ShowFile) _arguments['----'] = _object --- 13,26 ---- class Web_Browser_Suite_Events: ! 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 *************** *** 122,133 **** 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' --- 81,92 ---- return _arguments['----'] ! 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: """ _code = 'WWW!' ! _subcode = 'WNFO' if _arguments: raise TypeError, 'No optional args expected' *************** *** 163,176 **** return _arguments['----'] ! 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: """ _code = 'WWW!' ! _subcode = 'WNFO' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object --- 122,147 ---- return _arguments['----'] ! _argmap_OpenURL = { ! 'to' : 'INTO', ! 'toWindow' : 'WIND', ! '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!' ! _subcode = 'OURL' ! aetools.keysubst(_arguments, self._argmap_OpenURL) _arguments['----'] = _object *************** *** 199,202 **** --- 170,202 ---- aetools.keysubst(_arguments, self._argmap_ParseAnchor) + _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_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!' + _subcode = 'SHWF' + + aetools.keysubst(_arguments, self._argmap_ShowFile) _arguments['----'] = _object Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Mar 2003 22:07:27 -0000 1.2 --- __init__.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 5,23 **** 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, } --- 5,23 ---- import aetools Error = aetools.Error import Standard_Suite import URL_Suite import Netscape_Suite + import Microsoft_Internet_Explorer + import Web_Browser_Suite + import Required_Suite _code_to_module = { '****' : Standard_Suite, 'GURL' : URL_Suite, 'MOSS' : Netscape_Suite, + 'MSIE' : Microsoft_Internet_Explorer, + 'WWW!' : Web_Browser_Suite, + 'reqd' : Required_Suite, } *************** *** 25,42 **** _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 * def getbaseclasses(v): --- 25,42 ---- _code_to_fullname = { '****' : ('Explorer.Standard_Suite', 'Standard_Suite'), 'GURL' : ('Explorer.URL_Suite', 'URL_Suite'), 'MOSS' : ('Explorer.Netscape_Suite', 'Netscape_Suite'), + 'MSIE' : ('Explorer.Microsoft_Internet_Explorer', 'Microsoft_Internet_Explorer'), + 'WWW!' : ('Explorer.Web_Browser_Suite', 'Web_Browser_Suite'), + 'reqd' : ('Explorer.Required_Suite', 'Required_Suite'), } from Standard_Suite import * from URL_Suite import * from Netscape_Suite import * + from Microsoft_Internet_Explorer import * + from Web_Browser_Suite import * + from Required_Suite import * def getbaseclasses(v): *************** *** 67,76 **** ! 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' --- 67,76 ---- ! class Explorer(Standard_Suite_Events, URL_Suite_Events, Netscape_Suite_Events, + Microsoft_Internet_Explorer_Events, + Web_Browser_Suite_Events, + Required_Suite_Events, aetools.TalkTo): _signature = 'MSIE' From jackjansen@users.sourceforge.net Fri Mar 28 22:07:50 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:07:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.2,1.3 Metrowerks_Shell_Suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv21742/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py __init__.py Log Message: Regenerated (from resource files) with sorting version of gensuitemodule. This is a first step towards regenerating the modules with newer, MacOSX, versions of these programs, and using the programmatic interface to get at the terminology in stead of poking in resource files. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CodeWarrior_suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- CodeWarrior_suite.py 28 Mar 2003 22:07:15 -0000 1.3 *************** *** 44,77 **** return _arguments['----'] ! _argmap_export = { ! 'in_' : 'kfil', ! } ! ! def export(self, _no_object=None, _attributes={}, **_arguments): ! """export: Export the project file as an XML file ! Keyword argument in_: the XML file in which to export the project ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'CWIE' ! _subcode = 'EXPT' ! ! aetools.keysubst(_arguments, self._argmap_export) ! 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 update(self, _no_object=None, _attributes={}, **_arguments): ! """update: bring a project or target up to date Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'UP2D' if _arguments: raise TypeError, 'No optional args expected' --- 44,53 ---- return _arguments['----'] ! def build(self, _no_object=None, _attributes={}, **_arguments): ! """build: build a project or target (equivalent of the Make menu command) Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'MAKE' if _arguments: raise TypeError, 'No optional args expected' *************** *** 147,158 **** return _arguments['----'] ! def build(self, _no_object=None, _attributes={}, **_arguments): ! """build: build a project or target (equivalent of the Make menu command) Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'MAKE' ! if _arguments: raise TypeError, 'No optional args expected' if _no_object != None: raise TypeError, 'No direct arg expected' --- 123,139 ---- return _arguments['----'] ! _argmap_export = { ! 'in_' : 'kfil', ! } ! ! def export(self, _no_object=None, _attributes={}, **_arguments): ! """export: Export the project file as an XML file ! Keyword argument in_: the XML file in which to export the project Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'EXPT' ! aetools.keysubst(_arguments, self._argmap_export) if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 166,179 **** return _arguments['----'] ! def remove_target_files(self, _object, _attributes={}, **_arguments): ! """remove target files: remove files from a target ! Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'RMFL' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object --- 147,159 ---- return _arguments['----'] ! def remove_object_code(self, _no_object=None, _attributes={}, **_arguments): ! """remove object code: remove object code from a project or target Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'RMOB' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' *************** *** 186,198 **** return _arguments['----'] ! def remove_object_code(self, _no_object=None, _attributes={}, **_arguments): ! """remove object code: remove object code from a project or target Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'RMOB' if _arguments: raise TypeError, 'No optional args expected' ! if _no_object != None: raise TypeError, 'No direct arg expected' --- 166,179 ---- return _arguments['----'] ! def remove_target_files(self, _object, _attributes={}, **_arguments): ! """remove target files: remove files from a target ! Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' ! _subcode = 'RMFL' if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object *************** *** 244,255 **** return _arguments['----'] ! class build_progress_document(aetools.ComponentItem): ! """build progress document - a build progress document """ ! want = 'PRGS' class inherits(aetools.NProperty): """inherits - all properties and elements of the given class are inherited by this class. """ which = 'c@#^' ! want = 'docu' build_progress_documents = build_progress_document --- 225,261 ---- return _arguments['----'] + def update(self, _no_object=None, _attributes={}, **_arguments): + """update: bring a project or target up to date + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'CWIE' + _subcode = 'UP2D' ! 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['----'] ! ! ! class ToolServer_worksheet(aetools.ComponentItem): ! """ToolServer worksheet - a ToolServer worksheet """ ! want = 'TOOL' class inherits(aetools.NProperty): """inherits - all properties and elements of the given class are inherited by this class. """ which = 'c@#^' ! want = 'TXTD' ! ! ToolServer_worksheets = ToolServer_worksheet ! ! class build_progress_document(aetools.ComponentItem): ! """build progress document - a build progress document """ ! want = 'PRGS' build_progress_documents = build_progress_document *************** *** 267,275 **** class_browsers = class_browser ! class class_hierarchy(aetools.ComponentItem): ! """class hierarchy - a class hierarchy document """ want = 'HIER' ! class_hierarchies = class_hierarchy class editor_document(aetools.ComponentItem): --- 273,281 ---- class_browsers = class_browser ! class class_hierarchies(aetools.ComponentItem): ! """class hierarchies - more than one class hierarchy document """ want = 'HIER' ! class_hierarchy = class_hierarchies class editor_document(aetools.ComponentItem): *************** *** 314,322 **** single_class_browsers = single_class_browser ! class single_class_hierarchy(aetools.ComponentItem): ! """single class hierarchy - a single class hierarchy document """ want = '1HIR' ! single_class_hierarchies = single_class_hierarchy class subtarget(aetools.ComponentItem): --- 320,328 ---- single_class_browsers = single_class_browser ! class single_class_hierarchies(aetools.ComponentItem): ! """single class hierarchies - more than one single class hierarchy document """ want = '1HIR' ! single_class_hierarchy = single_class_hierarchies class subtarget(aetools.ComponentItem): *************** *** 354,359 **** # element 'SBTG' as ['indx', 'test', 'rang'] - targets = target - class target_file(aetools.ComponentItem): """target file - a source or header file in a target """ --- 360,363 ---- *************** *** 426,429 **** --- 430,435 ---- target_files = target_file + targets = target + class text_document(aetools.ComponentItem): """text document - a document that contains text """ *************** *** 443,452 **** text_documents = text_document ! ! class ToolServer_worksheet(aetools.ComponentItem): ! """ToolServer worksheet - a ToolServer worksheet """ ! want = 'TOOL' ! ! ToolServer_worksheets = ToolServer_worksheet import Standard_Suite build_progress_document._superclassnames = ['document'] --- 449,458 ---- text_documents = text_document ! ToolServer_worksheet._superclassnames = ['text_document'] ! ToolServer_worksheet._privpropdict = { ! 'inherits' : inherits, ! } ! ToolServer_worksheet._privelemdict = { ! } import Standard_Suite build_progress_document._superclassnames = ['document'] *************** *** 468,476 **** class_browser._privelemdict = { } ! class_hierarchy._superclassnames = ['document'] ! class_hierarchy._privpropdict = { ! 'inherits' : inherits, } ! class_hierarchy._privelemdict = { } editor_document._superclassnames = ['text_document'] --- 474,481 ---- class_browser._privelemdict = { } ! class_hierarchies._superclassnames = [] ! class_hierarchies._privpropdict = { } ! class_hierarchies._privelemdict = { } editor_document._superclassnames = ['text_document'] *************** *** 512,520 **** single_class_browser._privelemdict = { } ! single_class_hierarchy._superclassnames = ['document'] ! single_class_hierarchy._privpropdict = { ! 'inherits' : inherits, } ! single_class_hierarchy._privelemdict = { } subtarget._superclassnames = ['target'] --- 517,524 ---- single_class_browser._privelemdict = { } ! single_class_hierarchies._superclassnames = [] ! single_class_hierarchies._privpropdict = { } ! single_class_hierarchies._privelemdict = { } subtarget._superclassnames = ['target'] *************** *** 574,590 **** 'text' : Standard_Suite.text, } - ToolServer_worksheet._superclassnames = ['text_document'] - ToolServer_worksheet._privpropdict = { - 'inherits' : inherits, - } - ToolServer_worksheet._privelemdict = { - } - _Enum_Inte = { - 'never_interact' : 'eNvr', # never allow user interactions - 'interact_with_self' : 'eInS', # allow user interaction only when an AppleEvent is sent from within CodeWarrior - 'interact_with_local' : 'eInL', # allow user interaction when AppleEvents are sent from applications on the same machine (default) - 'interact_with_all' : 'eInA', # allow user interaction from both local and remote AppleEvents - } - _Enum_DKND = { 'project' : 'PRJD', # a project document --- 578,581 ---- *************** *** 611,614 **** --- 602,612 ---- } + _Enum_Inte = { + 'never_interact' : 'eNvr', # never allow user interactions + 'interact_with_self' : 'eInS', # allow user interaction only when an AppleEvent is sent from within CodeWarrior + 'interact_with_local' : 'eInL', # allow user interaction when AppleEvents are sent from applications on the same machine (default) + 'interact_with_all' : 'eInA', # allow user interaction from both local and remote AppleEvents + } + _Enum_PERM = { 'read_write' : 'RdWr', # the file is open with read/write permission *************** *** 631,635 **** 'EDIT' : editor_document, 'COMP' : file_compare_document, ! 'BROW' : class_browser, 'SBTG' : subtarget, 'MSSG' : message_document, --- 629,633 ---- 'EDIT' : editor_document, 'COMP' : file_compare_document, ! 'TOOL' : ToolServer_worksheet, 'SBTG' : subtarget, 'MSSG' : message_document, *************** *** 637,646 **** '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, } --- 635,644 ---- 'TXTD' : text_document, 'CTLG' : catalog_document, ! 'HIER' : class_hierarchies, 'TRGT' : target, 'PRGS' : build_progress_document, 'SRCF' : target_file, ! 'BROW' : class_browser, ! '1HIR' : single_class_hierarchies, } Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Metrowerks_Shell_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Metrowerks_Shell_Suite.py 28 Mar 2003 22:07:16 -0000 1.3 *************** *** 295,298 **** --- 295,339 ---- return _arguments['----'] + def Get_member_function_names(self, _object, _attributes={}, **_arguments): + """Get member function names: Returns a list containing the names of all the member functions of a class object + Required argument: must be a class object + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: undocumented, typecode 'list' + """ + _code = 'MMPR' + _subcode = 'MbFN' + + if _arguments: raise TypeError, 'No optional args expected' + _arguments['----'] = _object + + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + + def Get_nonsimple_classes(self, _no_object=None, _attributes={}, **_arguments): + """Get nonsimple classes: Returns an alphabetical list of classes with member functions, bases classes, or subclasses + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: undocumented, typecode 'list' + """ + _code = 'MMPR' + _subcode = 'NsCl' + + 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 Goto_Function(self, _object, _attributes={}, **_arguments): """Goto Function: Goto Specified Function Name *************** *** 381,384 **** --- 422,445 ---- return _arguments['----'] + def Open_browser(self, _object, _attributes={}, **_arguments): + """Open browser: Display a class, member function, or data member object in a single class browser window + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'MMPR' + _subcode = 'Brow' + + 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_Precompile = { 'Saving_As' : 'Targ', *************** *** 729,793 **** return _arguments['----'] - def Open_browser(self, _object, _attributes={}, **_arguments): - """Open browser: Display a class, member function, or data member object in a single class browser window - Required argument: an AE object reference - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'MMPR' - _subcode = 'Brow' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - - def Get_nonsimple_classes(self, _no_object=None, _attributes={}, **_arguments): - """Get nonsimple classes: Returns an alphabetical list of classes with member functions, bases classes, or subclasses - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'list' - """ - _code = 'MMPR' - _subcode = 'NsCl' - - 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 Get_member_function_names(self, _object, _attributes={}, **_arguments): - """Get member function names: Returns a list containing the names of all the member functions of a class object - Required argument: must be a class object - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: undocumented, typecode 'list' - """ - _code = 'MMPR' - _subcode = 'MbFN' - - if _arguments: raise TypeError, 'No optional args expected' - _arguments['----'] = _object - - - _reply, _arguments, _attributes = self.send(_code, _subcode, - _arguments, _attributes) - if _arguments.get('errn', 0): - raise aetools.Error, aetools.decodeerror(_arguments) - # XXXX Optionally decode result - if _arguments.has_key('----'): - return _arguments['----'] - class Access_Paths(aetools.ComponentItem): --- 790,793 ---- *************** *** 1555,1558 **** --- 1555,1581 ---- want = 'RlPt' + class base_class(aetools.ComponentItem): + """base class - A base class or super class of a class """ + want = 'BsCl' + class class_(aetools.NProperty): + """class - The class object corresponding to this base class """ + which = 'Clas' + want = 'obj ' + class access(aetools.NProperty): + """access - """ + which = 'Acce' + want = 'Acce' + class virtual(aetools.NProperty): + """virtual - """ + which = 'Virt' + want = 'bool' + + base_classes = base_class + + class browser_catalog(aetools.ComponentItem): + """browser catalog - The browser symbol catalog for the current project """ + want = 'Cata' + # element 'Clas' as ['indx', 'name'] + class class_(aetools.ComponentItem): """class - A class, struct, or record type in the current project. """ *************** *** 1588,1606 **** classes = class_ ! class member_function(aetools.ComponentItem): ! """member function - A class member function or method. """ ! want = 'MbFn' ! class access(aetools.NProperty): ! """access - """ ! which = 'Acce' ! want = 'Acce' ! class virtual(aetools.NProperty): ! """virtual - """ ! which = 'Virt' ! want = 'bool' class static(aetools.NProperty): """static - """ which = 'Stat' want = 'bool' class implementation_file(aetools.NProperty): """implementation file - Source file containing the member function definition """ --- 1611,1627 ---- classes = class_ ! class data_member(aetools.ComponentItem): ! """data member - A class data member or field """ ! want = 'DtMb' class static(aetools.NProperty): """static - """ which = 'Stat' want = 'bool' + + data_members = data_member + + class member_function(aetools.ComponentItem): + """member function - A class member function or method. """ + want = 'MbFn' class implementation_file(aetools.NProperty): """implementation file - Source file containing the member function definition """ *************** *** 1617,1641 **** member_functions = member_function - - class data_member(aetools.ComponentItem): - """data member - A class data member or field """ - want = 'DtMb' - - data_members = data_member - - class base_class(aetools.ComponentItem): - """base class - A base class or super class of a class """ - want = 'BsCl' - class class_(aetools.NProperty): - """class - The class object corresponding to this base class """ - which = 'Clas' - want = 'obj ' - - base_classes = base_class - - class browser_catalog(aetools.ComponentItem): - """browser catalog - The browser symbol catalog for the current project """ - want = 'Cata' - # element 'Clas' as ['indx', 'name'] Access_Paths._superclassnames = [] Access_Paths._privpropdict = { --- 1638,1641 ---- *************** *** 1971,1974 **** --- 1971,1988 ---- VCS_Setup._privelemdict = { } + base_class._superclassnames = [] + base_class._privpropdict = { + 'class_' : class_, + 'access' : access, + 'virtual' : virtual, + } + base_class._privelemdict = { + } + browser_catalog._superclassnames = [] + browser_catalog._privpropdict = { + } + browser_catalog._privelemdict = { + 'class_' : class_, + } class_._superclassnames = [] class_._privpropdict = { *************** *** 1986,1989 **** --- 2000,2013 ---- 'data_member' : data_member, } + data_member._superclassnames = [] + data_member._privpropdict = { + 'name' : name, + 'access' : access, + 'static' : static, + 'declaration_start_offset' : declaration_start_offset, + 'declaration_end_offset' : declaration_end_offset, + } + data_member._privelemdict = { + } member_function._superclassnames = [] member_function._privpropdict = { *************** *** 2001,2043 **** member_function._privelemdict = { } ! data_member._superclassnames = [] ! data_member._privpropdict = { ! 'name' : name, ! 'access' : access, ! 'static' : static, ! 'declaration_start_offset' : declaration_start_offset, ! 'declaration_end_offset' : declaration_end_offset, ! } ! data_member._privelemdict = { ! } ! base_class._superclassnames = [] ! base_class._privpropdict = { ! 'class_' : class_, ! 'access' : access, ! 'virtual' : virtual, ! } ! base_class._privelemdict = { ! } ! browser_catalog._superclassnames = [] ! browser_catalog._privpropdict = { ! } ! browser_catalog._privelemdict = { ! 'class_' : class_, } ! _Enum_TmpB = { ! 'User_Specified' : 'Usrs', # Use user specified symbols when setting temporary breakpoints on program launch. ! 'Default' : 'Dflt', # Use system default symbols when setting temporary breakpoints on program launch. } ! _Enum_TxtF = { ! 'MacOS' : 'TxF0', # MacOS text format ! 'DOS' : 'TxF1', # DOS text format ! 'Unix' : 'TxF2', # Unix text format } ! _Enum_savo = { ! 'yes' : 'yes ', # Save changes ! 'no' : 'no ', # Do not save changes ! 'ask' : 'ask ', # Ask the user whether to save } --- 2025,2051 ---- member_function._privelemdict = { } ! _Enum_Acce = { ! 'public' : 'Publ', # ! 'protected' : 'Prot', # ! 'private' : 'Priv', # } ! ! _Enum_BXbr = { ! 'Always_Build' : 'BXb1', # Always build the target before running. ! 'Ask_Build' : 'BXb2', # Ask before building the target when running. ! 'Never_Build' : 'BXb3', # Never before building the target before running. } ! _Enum_DbSA = { ! 'No_Action' : 'DSA1', # Don\xd5t do anything to non-debug windows ! 'Hide_Windows' : 'DSA2', # Hide non-debugging windows ! 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows ! 'Close_Windows' : 'DSA4', # Close non-debugging windows } ! _Enum_DgBL = { ! 'Always' : 'DgB0', # Always build before debugging. ! 'Never' : 'DgB1', # Never build before debugging. ! 'Ask' : 'DgB2', # Ask about building before debugging. } *************** *** 2053,2074 **** } ! _Enum_SrcT = { ! 'source' : 'FTxt', # A source file (.c, .cp, .p, etc). ! 'unknown' : 'FUnk', # An unknown file type. ! } ! ! _Enum_PPrm = { ! 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current project\xd5s folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarrior\xaa folder. ! 'system_relative' : 'YRel', # A path relative to the system folder ! 'root_relative' : 'RRel', # ! } ! ! _Enum_DbSA = { ! 'No_Action' : 'DSA1', # Don\xd5t do anything to non-debug windows ! 'Hide_Windows' : 'DSA2', # Hide non-debugging windows ! 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows ! 'Close_Windows' : 'DSA4', # Close non-debugging windows } --- 2061,2069 ---- } ! _Enum_Inte = { ! 'never_interact' : 'eNvr', # Never allow user interactions ! 'interact_with_self' : 'eInS', # Allow user interaction only when an AppleEvent is sent from within CodeWarrior ! 'interact_with_local' : 'eInL', # Allow user interaction when AppleEvents are sent from applications on the same machine (default) ! 'interact_with_all' : 'eInA', # Allow user interaction from both local and remote AppleEvents } *************** *** 2083,2103 **** } ! _Enum_Acce = { ! 'public' : 'Publ', # ! 'protected' : 'Prot', # ! 'private' : 'Priv', # } ! _Enum_Inte = { ! 'never_interact' : 'eNvr', # Never allow user interactions ! 'interact_with_self' : 'eInS', # Allow user interaction only when an AppleEvent is sent from within CodeWarrior ! 'interact_with_local' : 'eInL', # Allow user interaction when AppleEvents are sent from applications on the same machine (default) ! 'interact_with_all' : 'eInA', # Allow user interaction from both local and remote AppleEvents } ! _Enum_DgBL = { ! 'Always' : 'DgB0', # Always build before debugging. ! 'Never' : 'DgB1', # Never build before debugging. ! 'Ask' : 'DgB2', # Ask about building before debugging. } --- 2078,2100 ---- } ! _Enum_PPrm = { ! 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current project\xd5s folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarrior\xaa folder. ! 'system_relative' : 'YRel', # A path relative to the system folder ! 'root_relative' : 'RRel', # } ! _Enum_PXdg = { ! 'Diagnose_None' : 'PXd1', # No Plugin Diagnostics. ! 'Diagnose_Errors' : 'PXd2', # Plugin Diagnostics for errors only. ! 'Diagnose_All' : 'PXd3', # Plugin Diagnostics for everything. } ! _Enum_PthF = { ! 'Generic_Path' : 'PFGn', # ! 'MacOS_Path' : 'PFMc', # MacOS path using colon as separator ! 'Windows_Path' : 'PFWn', # Windows path using backslash as separator ! 'Unix_Path' : 'PFUx', # Unix path using slash as separator } *************** *** 2107,2122 **** } - _Enum_PXdg = { - 'Diagnose_None' : 'PXd1', # No Plugin Diagnostics. - 'Diagnose_Errors' : 'PXd2', # Plugin Diagnostics for errors only. - 'Diagnose_All' : 'PXd3', # Plugin Diagnostics for everything. - } - - _Enum_BXbr = { - 'Always_Build' : 'BXb1', # Always build the target before running. - 'Ask_Build' : 'BXb2', # Ask before building the target when running. - 'Never_Build' : 'BXb3', # Never before building the target before running. - } - _Enum_STKd = { 'Absolute_Path' : 'STK0', # The \xd2path\xd3 property is an absolute path to the location of the source tree. --- 2104,2107 ---- *************** *** 2125,2133 **** } ! _Enum_PthF = { ! 'Generic_Path' : 'PFGn', # ! 'MacOS_Path' : 'PFMc', # MacOS path using colon as separator ! 'Windows_Path' : 'PFWn', # Windows path using backslash as separator ! 'Unix_Path' : 'PFUx', # Unix path using slash as separator } --- 2110,2133 ---- } ! _Enum_SrcT = { ! 'source' : 'FTxt', # A source file (.c, .cp, .p, etc). ! 'unknown' : 'FUnk', # An unknown file type. ! } ! ! _Enum_TmpB = { ! 'User_Specified' : 'Usrs', # Use user specified symbols when setting temporary breakpoints on program launch. ! 'Default' : 'Dflt', # Use system default symbols when setting temporary breakpoints on program launch. ! } ! ! _Enum_TxtF = { ! 'MacOS' : 'TxF0', # MacOS text format ! 'DOS' : 'TxF1', # DOS text format ! 'Unix' : 'TxF2', # Unix text format ! } ! ! _Enum_savo = { ! 'yes' : 'yes ', # Save changes ! 'no' : 'no ', # Do not save changes ! 'ask' : 'ask ', # Ask the user whether to save } *************** *** 2355,2369 **** _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, --- 2355,2369 ---- _enumdeclarations = { 'Inte' : _Enum_Inte, 'DgBL' : _Enum_DgBL, + 'STKd' : _Enum_STKd, 'Acce' : _Enum_Acce, 'RefP' : _Enum_RefP, 'TxtF' : _Enum_TxtF, ! 'PthF' : _Enum_PthF, 'TmpB' : _Enum_TmpB, + 'Lang' : _Enum_Lang, 'savo' : _Enum_savo, ! 'DbSA' : _Enum_DbSA, 'SrcT' : _Enum_SrcT, 'PXdg' : _Enum_PXdg, Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Mar 2003 22:07:27 -0000 1.2 --- __init__.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 5,19 **** import aetools Error = aetools.Error - import Required - import Standard_Suite import CodeWarrior_suite import Metrowerks_Shell_Suite _code_to_module = { - 'reqd' : Required, - 'CoRe' : Standard_Suite, 'CWIE' : CodeWarrior_suite, 'MMPR' : Metrowerks_Shell_Suite, } --- 5,19 ---- import aetools Error = aetools.Error import CodeWarrior_suite + import Standard_Suite import Metrowerks_Shell_Suite + import Required _code_to_module = { 'CWIE' : CodeWarrior_suite, + 'CoRe' : Standard_Suite, 'MMPR' : Metrowerks_Shell_Suite, + 'reqd' : Required, } *************** *** 21,34 **** _code_to_fullname = { - 'reqd' : ('CodeWarrior.Required', 'Required'), - 'CoRe' : ('CodeWarrior.Standard_Suite', 'Standard_Suite'), 'CWIE' : ('CodeWarrior.CodeWarrior_suite', 'CodeWarrior_suite'), 'MMPR' : ('CodeWarrior.Metrowerks_Shell_Suite', 'Metrowerks_Shell_Suite'), } - from Required import * - from Standard_Suite import * from CodeWarrior_suite import * from Metrowerks_Shell_Suite import * def getbaseclasses(v): --- 21,34 ---- _code_to_fullname = { 'CWIE' : ('CodeWarrior.CodeWarrior_suite', 'CodeWarrior_suite'), + 'CoRe' : ('CodeWarrior.Standard_Suite', 'Standard_Suite'), 'MMPR' : ('CodeWarrior.Metrowerks_Shell_Suite', 'Metrowerks_Shell_Suite'), + 'reqd' : ('CodeWarrior.Required', 'Required'), } from CodeWarrior_suite import * + from Standard_Suite import * from Metrowerks_Shell_Suite import * + from Required import * def getbaseclasses(v): *************** *** 49,78 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(character) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) - getbaseclasses(single_class_browser) - getbaseclasses(project_document) - getbaseclasses(symbol_browser) - getbaseclasses(editor_document) - getbaseclasses(file_compare_document) - getbaseclasses(class_browser) - getbaseclasses(subtarget) - getbaseclasses(message_document) - getbaseclasses(project_inspector) - getbaseclasses(text_document) - getbaseclasses(catalog_document) - getbaseclasses(class_hierarchy) - getbaseclasses(target) - getbaseclasses(build_progress_document) - getbaseclasses(target_file) - getbaseclasses(ToolServer_worksheet) - getbaseclasses(single_class_hierarchy) getbaseclasses(File_Mapping) getbaseclasses(browser_catalog) --- 49,52 ---- *************** *** 111,114 **** --- 85,114 ---- getbaseclasses(Debugger_Display) getbaseclasses(class_) + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(single_class_browser) + getbaseclasses(project_document) + getbaseclasses(symbol_browser) + getbaseclasses(editor_document) + getbaseclasses(file_compare_document) + getbaseclasses(class_browser) + getbaseclasses(subtarget) + getbaseclasses(message_document) + getbaseclasses(project_inspector) + getbaseclasses(text_document) + getbaseclasses(catalog_document) + getbaseclasses(class_hierarchy) + getbaseclasses(target) + getbaseclasses(build_progress_document) + getbaseclasses(target_file) + getbaseclasses(ToolServer_worksheet) + getbaseclasses(single_class_hierarchy) # *************** *** 116,145 **** # _classdeclarations = { - 'cha ' : character, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'clin' : line, - 'csel' : selection_2d_object, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, - '1BRW' : single_class_browser, - 'PRJD' : project_document, - '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, 'FMap' : File_Mapping, 'Cata' : browser_catalog, --- 116,119 ---- *************** *** 178,188 **** 'DbDS' : Debugger_Display, 'Clas' : class_, } ! class CodeWarrior(Required_Events, Standard_Suite_Events, - CodeWarrior_suite_Events, Metrowerks_Shell_Suite_Events, aetools.TalkTo): _signature = 'CWIE' --- 152,188 ---- 'DbDS' : Debugger_Display, 'Clas' : class_, + 'cha ' : character, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'clin' : line, + 'csel' : selection_2d_object, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + '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, } ! class CodeWarrior(CodeWarrior_suite_Events, Standard_Suite_Events, Metrowerks_Shell_Suite_Events, + Required_Events, aetools.TalkTo): _signature = 'CWIE' From jackjansen@users.sourceforge.net Fri Mar 28 22:07:57 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:07:57 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Containers_and_folders.py,1.2,1.3 Earlier_terms.py,1.2,1.3 Enumerations.py,1.2,1.3 Files_and_suitcases.py,1.2,1.3 Process_classes.py,1.2,1.3 Standard_Suite.py,1.2,1.3 Type_Definitions.py,1.2,1.3 Window_classes.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv21742/Finder Modified Files: Containers_and_folders.py Earlier_terms.py Enumerations.py Files_and_suitcases.py Process_classes.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Log Message: Regenerated (from resource files) with sorting version of gensuitemodule. This is a first step towards regenerating the modules with newer, MacOSX, versions of these programs, and using the programmatic interface to get at the terminology in stead of poking in resource files. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Containers_and_folders.py 23 Mar 2003 22:07:27 -0000 1.2 --- Containers_and_folders.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 71,120 **** containers = container ! class sharable_container(aetools.ComponentItem): ! """sharable container - A container that may be shared (disks and folders) """ ! want = 'sctr' ! class owner(aetools.NProperty): ! """owner - the user that owns the container (file sharing must be on to use this property) """ ! which = 'sown' ! want = 'itxt' ! class group(aetools.NProperty): ! """group - the user or group that has special access to the container (file sharing must be on to use this property) """ ! which = 'sgrp' ! want = 'itxt' ! class owner_privileges(aetools.NProperty): ! """owner privileges - the see folders/see files/make changes privileges for the owner (file sharing must be on to use this property) """ ! which = 'ownr' ! want = 'priv' ! class group_privileges(aetools.NProperty): ! """group privileges - the see folders/see files/make changes privileges for the group (file sharing must be on to use this property) """ ! which = 'gppr' ! want = 'priv' ! class guest_privileges(aetools.NProperty): ! """guest privileges - the see folders/see files/make changes privileges for everyone (file sharing must be on to use this property) """ ! which = 'gstp' ! want = 'priv' ! class privileges_inherited(aetools.NProperty): ! """privileges inherited - Are the privileges of the container always the same as the container in which it is stored? (file sharing must be on to use this property) """ ! which = 'iprv' ! want = 'bool' ! class mounted(aetools.NProperty): ! """mounted - Is the container mounted on another machine's desktop? (file sharing must be on to use this property) """ ! which = 'smou' ! want = 'bool' ! class exported(aetools.NProperty): ! """exported - Is the container a share point or inside a share point, i.e., can the container be shared? (file sharing must be on to use this property) """ ! which = 'sexp' ! want = 'bool' ! class shared(aetools.NProperty): ! """shared - Is the container a share point, i.e., is the container currently being shared? (file sharing must be on to use this property) """ ! which = 'shar' ! want = 'bool' ! class protected(aetools.NProperty): ! """protected - Is the container protected from being moved, renamed and deleted? (file sharing must be on to use this property) """ ! which = 'spro' ! want = 'bool' # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] # element 'sctr' as ['indx', 'name'] # element 'cfol' as ['indx', 'name', 'ID '] # element 'file' as ['indx', 'name'] --- 71,89 ---- containers = container ! class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ ! want = 'cdsk' ! class startup_disk(aetools.NProperty): ! """startup disk - the startup disk """ ! which = 'sdsk' ! want = 'cdis' ! class trash(aetools.NProperty): ! """trash - the trash """ ! which = 'trsh' ! want = 'ctrs' # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] # element 'sctr' as ['indx', 'name'] + # element 'cdis' as ['indx', 'name'] # element 'cfol' as ['indx', 'name', 'ID '] # element 'file' as ['indx', 'name'] *************** *** 132,153 **** # element 'dsut' as ['indx', 'name'] - sharable_containers = sharable_container - - class sharing_privileges(aetools.ComponentItem): - """sharing privileges - A set of sharing properties (used in sharable containers) """ - want = 'priv' - class see_folders(aetools.NProperty): - """see folders - Can folders be seen? """ - which = 'prvs' - want = 'bool' - class see_files(aetools.NProperty): - """see files - Can files be seen? """ - which = 'prvr' - want = 'bool' - class make_changes(aetools.NProperty): - """make changes - Can changes be made? """ - which = 'prvw' - want = 'bool' - class disk(aetools.ComponentItem): """disk - A disk """ --- 101,104 ---- *************** *** 216,234 **** folders = folder ! class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ ! want = 'cdsk' ! class startup_disk(aetools.NProperty): ! """startup disk - the startup disk """ ! which = 'sdsk' ! want = 'cdis' ! class trash(aetools.NProperty): ! """trash - the trash """ ! which = 'trsh' ! want = 'ctrs' # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] # element 'sctr' as ['indx', 'name'] - # element 'cdis' as ['indx', 'name'] # element 'cfol' as ['indx', 'name', 'ID '] # element 'file' as ['indx', 'name'] --- 167,216 ---- folders = folder ! class sharable_container(aetools.ComponentItem): ! """sharable container - A container that may be shared (disks and folders) """ ! want = 'sctr' ! class owner(aetools.NProperty): ! """owner - the user that owns the container (file sharing must be on to use this property) """ ! which = 'sown' ! want = 'itxt' ! class group(aetools.NProperty): ! """group - the user or group that has special access to the container (file sharing must be on to use this property) """ ! which = 'sgrp' ! want = 'itxt' ! class owner_privileges(aetools.NProperty): ! """owner privileges - the see folders/see files/make changes privileges for the owner (file sharing must be on to use this property) """ ! which = 'ownr' ! want = 'priv' ! class group_privileges(aetools.NProperty): ! """group privileges - the see folders/see files/make changes privileges for the group (file sharing must be on to use this property) """ ! which = 'gppr' ! want = 'priv' ! class guest_privileges(aetools.NProperty): ! """guest privileges - the see folders/see files/make changes privileges for everyone (file sharing must be on to use this property) """ ! which = 'gstp' ! want = 'priv' ! class privileges_inherited(aetools.NProperty): ! """privileges inherited - Are the privileges of the container always the same as the container in which it is stored? (file sharing must be on to use this property) """ ! which = 'iprv' ! want = 'bool' ! class mounted(aetools.NProperty): ! """mounted - Is the container mounted on another machine's desktop? (file sharing must be on to use this property) """ ! which = 'smou' ! want = 'bool' ! class exported(aetools.NProperty): ! """exported - Is the container a share point or inside a share point, i.e., can the container be shared? (file sharing must be on to use this property) """ ! which = 'sexp' ! want = 'bool' ! class shared(aetools.NProperty): ! """shared - Is the container a share point, i.e., is the container currently being shared? (file sharing must be on to use this property) """ ! which = 'shar' ! want = 'bool' ! class protected(aetools.NProperty): ! """protected - Is the container protected from being moved, renamed and deleted? (file sharing must be on to use this property) """ ! which = 'spro' ! want = 'bool' # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] # element 'sctr' as ['indx', 'name'] # element 'cfol' as ['indx', 'name', 'ID '] # element 'file' as ['indx', 'name'] *************** *** 246,249 **** --- 228,249 ---- # element 'dsut' as ['indx', 'name'] + sharable_containers = sharable_container + + class sharing_privileges(aetools.ComponentItem): + """sharing privileges - A set of sharing properties (used in sharable containers) """ + want = 'priv' + class see_folders(aetools.NProperty): + """see folders - Can folders be seen? """ + which = 'prvs' + want = 'bool' + class see_files(aetools.NProperty): + """see files - Can files be seen? """ + which = 'prvr' + want = 'bool' + class make_changes(aetools.NProperty): + """make changes - Can changes be made? """ + which = 'prvw' + want = 'bool' + class trash_2d_object(aetools.ComponentItem): """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ *************** *** 303,324 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! sharable_container._superclassnames = ['container'] ! sharable_container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'owner' : owner, ! 'group' : group, ! 'owner_privileges' : owner_privileges, ! 'group_privileges' : group_privileges, ! 'guest_privileges' : guest_privileges, ! 'privileges_inherited' : privileges_inherited, ! 'mounted' : mounted, ! 'exported' : exported, ! 'shared' : shared, ! 'protected' : protected, } ! sharable_container._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, 'sharable_container' : sharable_container, 'folder' : folder, 'file' : Files_and_suitcases.file, --- 303,317 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! desktop_2d_object._superclassnames = ['container'] ! desktop_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'startup_disk' : startup_disk, ! 'trash' : trash, } ! desktop_2d_object._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, 'sharable_container' : sharable_container, + 'disk' : disk, 'folder' : folder, 'file' : Files_and_suitcases.file, *************** *** 336,347 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } - sharing_privileges._superclassnames = [] - sharing_privileges._privpropdict = { - 'see_folders' : see_folders, - 'see_files' : see_files, - 'make_changes' : make_changes, - } - sharing_privileges._privelemdict = { - } disk._superclassnames = ['sharable_container'] disk._privpropdict = { --- 329,332 ---- *************** *** 395,409 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! desktop_2d_object._superclassnames = ['container'] ! desktop_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'startup_disk' : startup_disk, ! 'trash' : trash, } ! desktop_2d_object._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, 'sharable_container' : sharable_container, - 'disk' : disk, 'folder' : folder, 'file' : Files_and_suitcases.file, --- 380,401 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! sharable_container._superclassnames = ['container'] ! sharable_container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'owner' : owner, ! 'group' : group, ! 'owner_privileges' : owner_privileges, ! 'group_privileges' : group_privileges, ! 'guest_privileges' : guest_privileges, ! 'privileges_inherited' : privileges_inherited, ! 'mounted' : mounted, ! 'exported' : exported, ! 'shared' : shared, ! 'protected' : protected, } ! sharable_container._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, 'sharable_container' : sharable_container, 'folder' : folder, 'file' : Files_and_suitcases.file, *************** *** 421,424 **** --- 413,424 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } + sharing_privileges._superclassnames = [] + sharing_privileges._privpropdict = { + 'see_folders' : see_folders, + 'see_files' : see_files, + 'make_changes' : make_changes, + } + sharing_privileges._privelemdict = { + } trash_2d_object._superclassnames = ['container'] trash_2d_object._privpropdict = { *************** *** 453,471 **** '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, --- 453,471 ---- 'cdsk' : desktop_2d_object, 'sctr' : sharable_container, 'cdis' : disk, 'ctnr' : container, + 'cfol' : folder, + 'priv' : sharing_privileges, } _propdeclarations = { 'pexp' : expanded, ! 'iprv' : privileges_inherited, ! 'gstp' : guest_privileges, 'ects' : entire_contents, 'lvis' : icon_size, ! 'gppr' : group_privileges, 'isrv' : local_volume, ! 'prvs' : see_folders, 'pexa' : expandable, 'pexc' : completely_expanded, *************** *** 480,490 **** '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, --- 480,490 ---- 'sdsk' : startup_disk, 'istd' : startup, ! 'prvr' : see_files, ! 'c@#^' : _3c_Inheritance_3e_, 'smou' : mounted, 'sele' : selection, ! 'trsh' : trash, 'sgrp' : group, ! 'frsp' : free_space, 'spro' : protected, 'ownr' : owner_privileges, Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Earlier_terms.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Earlier_terms.py 23 Mar 2003 22:07:27 -0000 1.2 --- Earlier_terms.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 17,20 **** --- 17,32 ---- + class accessory_process(aetools.ComponentItem): + """accessory process - A process launched from a desk accessory file """ + want = 'pcda' + + accessory_processes = accessory_process + + class accessory_suitcase(aetools.ComponentItem): + """accessory suitcase - A desk accessory suitcase """ + want = 'dsut' + + accessory_suitcases = accessory_suitcase + class application(aetools.ComponentItem): """application - The Finder """ *************** *** 177,198 **** want = 'bool' - class accessory_process(aetools.ComponentItem): - """accessory process - A process launched from a desk accessory file """ - want = 'pcda' - - accessory_processes = accessory_process - - class accessory_suitcase(aetools.ComponentItem): - """accessory suitcase - A desk accessory suitcase """ - want = 'dsut' - - accessory_suitcases = accessory_suitcase - - class internet_location(aetools.ComponentItem): - """internet location - An file containing an internet location """ - want = 'inlf' - - internet_locations = internet_location - class information_window(aetools.ComponentItem): """information window - An information window (opened by \xd2Get Info\xd3) """ --- 189,192 ---- *************** *** 235,238 **** --- 229,238 ---- want = 'bool' + class internet_location(aetools.ComponentItem): + """internet location - An file containing an internet location """ + want = 'inlf' + + internet_locations = internet_location + class item(aetools.ComponentItem): """item - An item """ *************** *** 291,294 **** --- 291,314 ---- want = 'obj ' + class preferences(aetools.ComponentItem): + """preferences - The Finder Preferences """ + want = 'cprf' + class delay_before_springing(aetools.NProperty): + """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ + which = 'dela' + want = 'shor' + class spring_open_folders(aetools.NProperty): + """spring open folders - Spring open folders after the specified delay? """ + which = 'sprg' + want = 'bool' + class use_simple_menus(aetools.NProperty): + """use simple menus - Use simplified Finder menus? """ + which = 'usme' + want = 'bool' + class use_wide_grid(aetools.NProperty): + """use wide grid - Space icons on a wide grid? """ + which = 'uswg' + want = 'bool' + class process(aetools.ComponentItem): """process - A process running on this computer """ *************** *** 363,386 **** want = 'ctrs' - class preferences(aetools.ComponentItem): - """preferences - The Finder Preferences """ - want = 'cprf' - class delay_before_springing(aetools.NProperty): - """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ - which = 'dela' - want = 'shor' - class spring_open_folders(aetools.NProperty): - """spring open folders - Spring open folders after the specified delay? """ - which = 'sprg' - want = 'bool' - class use_simple_menus(aetools.NProperty): - """use simple menus - Use simplified Finder menus? """ - which = 'usme' - want = 'bool' - class use_wide_grid(aetools.NProperty): - """use wide grid - Space icons on a wide grid? """ - which = 'uswg' - want = 'bool' - class window(aetools.ComponentItem): """window - A window """ --- 383,386 ---- *************** *** 430,433 **** --- 430,443 ---- which = 'wshd' want = 'bool' + accessory_process._superclassnames = [] + accessory_process._privpropdict = { + } + accessory_process._privelemdict = { + } + accessory_suitcase._superclassnames = [] + accessory_suitcase._privpropdict = { + } + accessory_suitcase._privelemdict = { + } application._superclassnames = [] application._privpropdict = { *************** *** 484,502 **** container_window._privelemdict = { } - accessory_process._superclassnames = [] - accessory_process._privpropdict = { - } - accessory_process._privelemdict = { - } - accessory_suitcase._superclassnames = [] - accessory_suitcase._privpropdict = { - } - accessory_suitcase._privelemdict = { - } - internet_location._superclassnames = [] - internet_location._privpropdict = { - } - internet_location._privelemdict = { - } information_window._superclassnames = ['window'] information_window._privpropdict = { --- 494,497 ---- *************** *** 520,523 **** --- 515,523 ---- information_window._privelemdict = { } + internet_location._superclassnames = [] + internet_location._privpropdict = { + } + internet_location._privelemdict = { + } item._superclassnames = [] item._privpropdict = { *************** *** 547,550 **** --- 547,569 ---- item._privelemdict = { } + preferences._superclassnames = [] + preferences._privpropdict = { + 'window' : window, + 'calculate_folder_sizes' : calculate_folder_sizes, + 'delay_before_springing' : delay_before_springing, + 'show_comments' : show_comments, + 'show_creation_date' : show_creation_date, + 'show_kind' : show_kind, + 'show_label' : show_label, + 'show_modification_date' : show_modification_date, + 'show_size' : show_size, + 'show_version' : show_version, + 'spring_open_folders' : spring_open_folders, + 'use_relative_dates' : use_relative_dates, + 'use_simple_menus' : use_simple_menus, + 'use_wide_grid' : use_wide_grid, + } + preferences._privelemdict = { + } process._superclassnames = [] process._privpropdict = { *************** *** 587,609 **** trash_2d_object._privelemdict = { } - preferences._superclassnames = [] - preferences._privpropdict = { - 'window' : window, - 'calculate_folder_sizes' : calculate_folder_sizes, - 'delay_before_springing' : delay_before_springing, - 'show_comments' : show_comments, - 'show_creation_date' : show_creation_date, - 'show_kind' : show_kind, - 'show_label' : show_label, - 'show_modification_date' : show_modification_date, - 'show_size' : show_size, - 'show_version' : show_version, - 'spring_open_folders' : spring_open_folders, - 'use_relative_dates' : use_relative_dates, - 'use_simple_menus' : use_simple_menus, - 'use_wide_grid' : use_wide_grid, - } - preferences._privelemdict = { - } window._superclassnames = [] window._privpropdict = { --- 606,609 ---- *************** *** 633,641 **** # _classdeclarations = { 'dsut' : accessory_suitcase, 'cprf' : preferences, - 'sctr' : sharable_container, 'capp' : application, ! 'ctrs' : trash_2d_object, 'pcda' : accessory_process, 'cwin' : window, --- 633,641 ---- # _classdeclarations = { + 'ctrs' : trash_2d_object, 'dsut' : accessory_suitcase, 'cprf' : preferences, 'capp' : application, ! 'sctr' : sharable_container, 'pcda' : accessory_process, 'cwin' : window, Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Enumerations.py 23 Mar 2003 22:07:27 -0000 1.2 --- Enumerations.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 16,19 **** --- 16,50 ---- pass + _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', # + } + + _Enum_ese0 = { + 'starting_up' : 'ese2', # + 'running' : 'ese3', # + 'rebuilding_desktop' : 'ese5', # + 'copying' : 'ese4', # + 'restarting' : 'ese6', # + 'quitting' : 'ese7', # + } + + _Enum_gsen = { + 'CPU' : 'proc', # + 'FPU' : 'fpu ', # + 'MMU' : 'mmu ', # + 'hardware' : 'hdwr', # + 'operating_system' : 'os ', # + 'sound_system' : 'snd ', # + 'memory_available' : 'lram', # + 'memory_installed' : 'ram ', # + } + _Enum_ipnl = { 'General_Information_panel' : 'gpnl', # *************** *** 24,27 **** --- 55,64 ---- } + _Enum_isiz = { + 'mini' : 'miic', # + 'small' : 'smic', # + 'large' : 'lgic', # + } + _Enum_pple = { 'General_Preferences_panel' : 'pgnp', # *************** *** 32,46 **** } - _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', # - } - _Enum_sodr = { 'normal' : 'snrm', # --- 69,72 ---- *************** *** 48,57 **** } - _Enum_isiz = { - 'mini' : 'miic', # - 'small' : 'smic', # - 'large' : 'lgic', # - } - _Enum_vwby = { 'conflicts' : 'cflc', # --- 74,77 ---- *************** *** 73,96 **** } - _Enum_gsen = { - 'CPU' : 'proc', # - 'FPU' : 'fpu ', # - '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', # - } - # --- 93,96 ---- *************** *** 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, } --- 107,117 ---- _enumdeclarations = { 'ipnl' : _Enum_ipnl, + 'sodr' : _Enum_sodr, + 'pple' : _Enum_pple, 'ese0' : _Enum_ese0, 'vwby' : _Enum_vwby, 'isiz' : _Enum_isiz, 'earr' : _Enum_earr, ! 'gsen' : _Enum_gsen, } Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Files_and_suitcases.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Files_and_suitcases.py 23 Mar 2003 22:07:27 -0000 1.2 --- Files_and_suitcases.py 28 Mar 2003 22:07:17 -0000 1.3 *************** *** 16,56 **** - class file(aetools.ComponentItem): - """file - A file """ - want = 'file' - class _3c_Inheritance_3e_(aetools.NProperty): - """ - inherits some of its properties from the item class """ - which = 'c@#^' - want = 'cobj' - class file_type(aetools.NProperty): - """file type - the OSType identifying the type of data contained in the item """ - which = 'asty' - want = 'type' - class creator_type(aetools.NProperty): - """creator type - the OSType identifying the application that created the item """ - which = 'fcrt' - want = 'type' - class locked(aetools.NProperty): - """locked - Is the file locked? """ - which = 'aslk' - want = 'bool' - class stationery(aetools.NProperty): - """stationery - Is the file a stationery pad? """ - which = 'pspd' - want = 'bool' - class product_version(aetools.NProperty): - """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ - which = 'ver2' - want = 'itxt' - class version(aetools.NProperty): - """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ - which = 'vers' - want = 'itxt' - - files = file - class alias_file(aetools.ComponentItem): """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' class original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ --- 16,26 ---- class alias_file(aetools.ComponentItem): """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' + class _3c_Inheritance_3e_(aetools.NProperty): + """ - inherits some of its properties from the file class """ + which = 'c@#^' + want = 'file' class original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ *************** *** 86,89 **** --- 56,78 ---- application_files = application_file + class clipping(aetools.ComponentItem): + """clipping - A clipping """ + want = 'clpf' + + clippings = clipping + + class desk_accessory_file(aetools.ComponentItem): + """desk accessory file - A desk accessory file """ + want = 'dafi' + + desk_accessory_files = desk_accessory_file + + class desk_accessory_suitcase(aetools.ComponentItem): + """desk accessory suitcase - A desk accessory suitcase """ + want = 'dsut' + # element 'cobj' as ['indx', 'name'] + + desk_accessory_suitcases = desk_accessory_suitcase + class document_file(aetools.ComponentItem): """document file - A document file """ *************** *** 92,95 **** --- 81,114 ---- document_files = document_file + class file(aetools.ComponentItem): + """file - A file """ + want = 'file' + class file_type(aetools.NProperty): + """file type - the OSType identifying the type of data contained in the item """ + which = 'asty' + want = 'type' + class creator_type(aetools.NProperty): + """creator type - the OSType identifying the application that created the item """ + which = 'fcrt' + want = 'type' + class locked(aetools.NProperty): + """locked - Is the file locked? """ + which = 'aslk' + want = 'bool' + class stationery(aetools.NProperty): + """stationery - Is the file a stationery pad? """ + which = 'pspd' + want = 'bool' + class product_version(aetools.NProperty): + """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ + which = 'ver2' + want = 'itxt' + class version(aetools.NProperty): + """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ + which = 'vers' + want = 'itxt' + + files = file + class font_file(aetools.ComponentItem): """font file - A font file """ *************** *** 98,106 **** font_files = font_file ! class desk_accessory_file(aetools.ComponentItem): ! """desk accessory file - A desk accessory file """ ! want = 'dafi' ! desk_accessory_files = desk_accessory_file class internet_location_file(aetools.ComponentItem): --- 117,126 ---- font_files = font_file ! class font_suitcase(aetools.ComponentItem): ! """font suitcase - A font suitcase """ ! want = 'fsut' ! # element 'cobj' as ['indx', 'name'] ! font_suitcases = font_suitcase class internet_location_file(aetools.ComponentItem): *************** *** 114,117 **** --- 134,143 ---- internet_location_files = internet_location_file + class package(aetools.ComponentItem): + """package - A package """ + want = 'pack' + + packages = package + class sound_file(aetools.ComponentItem): """sound file - A sound file """ *************** *** 124,139 **** sound_files = sound_file - class clipping(aetools.ComponentItem): - """clipping - A clipping """ - want = 'clpf' - - clippings = clipping - - class package(aetools.ComponentItem): - """package - A package """ - want = 'pack' - - packages = package - class suitcase(aetools.ComponentItem): """suitcase - A font or desk accessory suitcase """ --- 150,153 ---- *************** *** 142,172 **** suitcases = suitcase - - class font_suitcase(aetools.ComponentItem): - """font suitcase - A font suitcase """ - want = 'fsut' - # element 'cobj' as ['indx', 'name'] - - font_suitcases = font_suitcase - - class desk_accessory_suitcase(aetools.ComponentItem): - """desk accessory suitcase - A desk accessory suitcase """ - want = 'dsut' - # element 'cobj' as ['indx', 'name'] - - desk_accessory_suitcases = desk_accessory_suitcase - import Earlier_terms - file._superclassnames = ['item'] - file._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'file_type' : file_type, - 'creator_type' : creator_type, - 'locked' : locked, - 'stationery' : stationery, - 'product_version' : product_version, - 'version' : version, - } - file._privelemdict = { - } alias_file._superclassnames = ['file'] alias_file._privpropdict = { --- 156,159 ---- *************** *** 187,190 **** --- 174,197 ---- application_file._privelemdict = { } + clipping._superclassnames = ['file'] + clipping._privpropdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + } + clipping._privelemdict = { + } + desk_accessory_file._superclassnames = ['file'] + desk_accessory_file._privpropdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + } + desk_accessory_file._privelemdict = { + } + desk_accessory_suitcase._superclassnames = ['suitcase'] + import Earlier_terms + desk_accessory_suitcase._privpropdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + } + desk_accessory_suitcase._privelemdict = { + 'item' : Earlier_terms.item, + } document_file._superclassnames = ['file'] document_file._privpropdict = { *************** *** 193,196 **** --- 200,215 ---- document_file._privelemdict = { } + file._superclassnames = ['item'] + file._privpropdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + 'file_type' : file_type, + 'creator_type' : creator_type, + 'locked' : locked, + 'stationery' : stationery, + 'product_version' : product_version, + 'version' : version, + } + file._privelemdict = { + } font_file._superclassnames = ['file'] font_file._privpropdict = { *************** *** 199,207 **** font_file._privelemdict = { } ! desk_accessory_file._superclassnames = ['file'] ! desk_accessory_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! desk_accessory_file._privelemdict = { } internet_location_file._superclassnames = ['file'] --- 218,227 ---- font_file._privelemdict = { } ! font_suitcase._superclassnames = ['suitcase'] ! font_suitcase._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! font_suitcase._privelemdict = { ! 'item' : Earlier_terms.item, } internet_location_file._superclassnames = ['file'] *************** *** 212,215 **** --- 232,241 ---- internet_location_file._privelemdict = { } + package._superclassnames = ['item'] + package._privpropdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + } + package._privelemdict = { + } sound_file._superclassnames = ['file'] sound_file._privpropdict = { *************** *** 219,234 **** sound_file._privelemdict = { } - clipping._superclassnames = ['file'] - clipping._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - } - clipping._privelemdict = { - } - package._superclassnames = ['item'] - package._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - } - package._privelemdict = { - } suitcase._superclassnames = ['file'] suitcase._privpropdict = { --- 245,248 ---- *************** *** 238,255 **** 'item' : Earlier_terms.item, } - font_suitcase._superclassnames = ['suitcase'] - font_suitcase._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - } - font_suitcase._privelemdict = { - 'item' : Earlier_terms.item, - } - desk_accessory_suitcase._superclassnames = ['suitcase'] - desk_accessory_suitcase._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - } - desk_accessory_suitcase._privelemdict = { - 'item' : Earlier_terms.item, - } # --- 252,255 ---- *************** *** 259,271 **** '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, --- 259,271 ---- 'sndf' : sound_file, 'fntf' : font_file, ! 'stcs' : suitcase, 'clpf' : clipping, + 'dsut' : desk_accessory_suitcase, 'alia' : alias_file, 'dafi' : desk_accessory_file, 'fsut' : font_suitcase, 'file' : file, 'appf' : application_file, ! 'inlf' : internet_location_file, 'docf' : document_file, 'pack' : package, *************** *** 273,280 **** _propdeclarations = { - 'vers' : version, 'ver2' : product_version, ! 'snd ' : sound, 'appt' : preferred_size, 'sprt' : suggested_size, 'isab' : accepts_high_level_events, --- 273,281 ---- _propdeclarations = { 'ver2' : product_version, ! 'vers' : version, 'appt' : preferred_size, + 'snd ' : sound, + 'pspd' : stationery, 'sprt' : suggested_size, 'isab' : accepts_high_level_events, *************** *** 284,288 **** 'fcrt' : creator_type, 'mprt' : minimum_size, - 'pspd' : stationery, 'iloc' : location, 'aslk' : locked, --- 285,288 ---- Index: Process_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- Process_classes.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 16,19 **** --- 16,43 ---- + class application_process(aetools.ComponentItem): + """application process - A process launched from an application file """ + want = 'pcap' + class _3c_Inheritance_3e_(aetools.NProperty): + """ - inherits some of its properties from the process class """ + which = 'c@#^' + want = 'prcs' + class application_file(aetools.NProperty): + """application file - the application file from which this process was launched """ + which = 'appf' + want = 'appf' + + application_processes = application_process + + class desk_accessory_process(aetools.ComponentItem): + """desk accessory process - A process launched from a desk accessory file """ + want = 'pcda' + class desk_accessory_file(aetools.NProperty): + """desk accessory file - the desk accessory file from which this process was launched """ + which = 'dafi' + want = 'obj ' + + desk_accessory_processes = desk_accessory_process + class process(aetools.ComponentItem): """process - A process running on this computer """ *************** *** 65,92 **** processes = process ! ! class application_process(aetools.ComponentItem): ! """application process - A process launched from an application file """ ! want = 'pcap' ! class _3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the process class """ ! which = 'c@#^' ! want = 'prcs' ! class application_file(aetools.NProperty): ! """application file - the application file from which this process was launched """ ! which = 'appf' ! want = 'appf' ! ! application_processes = application_process ! ! class desk_accessory_process(aetools.ComponentItem): ! """desk accessory process - A process launched from a desk accessory file """ ! want = 'pcda' ! class desk_accessory_file(aetools.NProperty): ! """desk accessory file - the desk accessory file from which this process was launched """ ! which = 'dafi' ! want = 'obj ' ! ! desk_accessory_processes = desk_accessory_process process._superclassnames = [] process._privpropdict = { --- 89,106 ---- processes = process ! application_process._superclassnames = ['process'] ! application_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'application_file' : application_file, ! } ! application_process._privelemdict = { ! } ! desk_accessory_process._superclassnames = ['process'] ! desk_accessory_process._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'desk_accessory_file' : desk_accessory_file, ! } ! desk_accessory_process._privelemdict = { ! } process._superclassnames = [] process._privpropdict = { *************** *** 104,121 **** } process._privelemdict = { - } - application_process._superclassnames = ['process'] - application_process._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'application_file' : application_file, - } - application_process._privelemdict = { - } - desk_accessory_process._superclassnames = ['process'] - desk_accessory_process._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'desk_accessory_file' : desk_accessory_file, - } - desk_accessory_process._privelemdict = { } --- 118,121 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- Standard_Suite.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 14,88 **** class Standard_Suite_Events(Standard_Suite_Events): - _argmap_open = { - 'using' : 'usin', - 'with_properties' : 'prdt', - } - - def open(self, _object, _attributes={}, **_arguments): - """open: Open the specified object(s) - Required argument: list of objects to open - Keyword argument using: the application file to open the object with - Keyword argument with_properties: the initial values for the properties, to be included with the open command sent to the application that opens the direct object - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'odoc' - - aetools.keysubst(_arguments, self._argmap_open) - _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_print_ = { - 'with_properties' : 'prdt', - } - - def print_(self, _object, _attributes={}, **_arguments): - """print: Print the specified object(s) - Required argument: list of objects to print - Keyword argument with_properties: optional properties to be included with the print command sent to the application that prints the direct object - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'pdoc' - - aetools.keysubst(_arguments, self._argmap_print_) - _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 quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit the Finder - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - 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 close(self, _object, _attributes={}, **_arguments): """close: Close an object --- 14,17 ---- *************** *** 288,291 **** --- 217,291 ---- aetools.enumsubst(_arguments, 'mvpl', _Enum_list) aetools.enumsubst(_arguments, 'rout', _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 + if _arguments.has_key('----'): + return _arguments['----'] + + _argmap_open = { + 'using' : 'usin', + 'with_properties' : 'prdt', + } + + def open(self, _object, _attributes={}, **_arguments): + """open: Open the specified object(s) + Required argument: list of objects to open + Keyword argument using: the application file to open the object with + Keyword argument with_properties: the initial values for the properties, to be included with the open command sent to the application that opens the direct object + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'odoc' + + aetools.keysubst(_arguments, self._argmap_open) + _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_print_ = { + 'with_properties' : 'prdt', + } + + def print_(self, _object, _attributes={}, **_arguments): + """print: Print the specified object(s) + Required argument: list of objects to print + Keyword argument with_properties: optional properties to be included with the print command sent to the application that prints the direct object + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'pdoc' + + aetools.keysubst(_arguments, self._argmap_print_) + _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 quit(self, _no_object=None, _attributes={}, **_arguments): + """quit: Quit the Finder + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'quit' + + 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, Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Type_Definitions.py 23 Mar 2003 22:07:27 -0000 1.2 --- Type_Definitions.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 16,19 **** --- 16,81 ---- + class alias_list(aetools.ComponentItem): + """alias list - A list of aliases. Use \xd4as alias list\xd5 when a list of aliases is needed (instead of a list of file system item references). """ + want = 'alst' + + class icon_family(aetools.ComponentItem): + """icon family - A family of icons """ + want = 'ifam' + class large_monochrome_icon_and_mask(aetools.NProperty): + """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ + which = 'ICN#' + want = 'ICN#' + class large_8_bit_mask(aetools.NProperty): + """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ + which = 'l8mk' + want = 'l8mk' + class large_32_bit_icon(aetools.NProperty): + """large 32 bit icon - the large 32-bit color icon """ + which = 'il32' + want = 'il32' + class large_8_bit_icon(aetools.NProperty): + """large 8 bit icon - the large 8-bit color icon """ + which = 'icl8' + want = 'icl8' + class large_4_bit_icon(aetools.NProperty): + """large 4 bit icon - the large 4-bit color icon """ + which = 'icl4' + want = 'icl4' + class small_monochrome_icon_and_mask(aetools.NProperty): + """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ + which = 'ics#' + want = 'ics#' + class small_8_bit_mask(aetools.NProperty): + """small 8 bit mask - the small 8-bit mask for small 32-bit icons """ + which = 'ics8' + want = 's8mk' + class small_32_bit_icon(aetools.NProperty): + """small 32 bit icon - the small 32-bit color icon """ + which = 'is32' + want = 'is32' + + small_8_bit_icon = small_8_bit_mask + class small_4_bit_icon(aetools.NProperty): + """small 4 bit icon - the small 4-bit color icon """ + which = 'ics4' + want = 'ics4' + + class label(aetools.ComponentItem): + """label - A Finder label (name and color) """ + want = 'clbl' + class name(aetools.NProperty): + """name - the name associated with the label """ + which = 'pnam' + want = 'itxt' + class index(aetools.NProperty): + """index - the index in the front-to-back ordering within its container """ + which = 'pidx' + want = 'long' + class color(aetools.NProperty): + """color - the color associated with the label """ + which = 'colr' + want = 'cRGB' + class preferences(aetools.ComponentItem): """preferences - The Finder Preferences """ *************** *** 104,169 **** want = 'long' # element 'clbl' as ['indx', 'name'] ! ! class label(aetools.ComponentItem): ! """label - A Finder label (name and color) """ ! want = 'clbl' ! class name(aetools.NProperty): ! """name - the name associated with the label """ ! which = 'pnam' ! want = 'itxt' ! class index(aetools.NProperty): ! """index - the index in the front-to-back ordering within its container """ ! which = 'pidx' ! want = 'long' ! class color(aetools.NProperty): ! """color - the color associated with the label """ ! which = 'colr' ! want = 'cRGB' ! ! class icon_family(aetools.ComponentItem): ! """icon family - A family of icons """ ! want = 'ifam' ! class large_monochrome_icon_and_mask(aetools.NProperty): ! """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ ! which = 'ICN#' ! want = 'ICN#' ! class large_8_bit_mask(aetools.NProperty): ! """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ ! which = 'l8mk' ! want = 'l8mk' ! class large_32_bit_icon(aetools.NProperty): ! """large 32 bit icon - the large 32-bit color icon """ ! which = 'il32' ! want = 'il32' ! class large_8_bit_icon(aetools.NProperty): ! """large 8 bit icon - the large 8-bit color icon """ ! which = 'icl8' ! want = 'icl8' ! class large_4_bit_icon(aetools.NProperty): ! """large 4 bit icon - the large 4-bit color icon """ ! which = 'icl4' ! want = 'icl4' ! class small_monochrome_icon_and_mask(aetools.NProperty): ! """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ ! which = 'ics#' ! want = 'ics#' ! class small_8_bit_mask(aetools.NProperty): ! """small 8 bit mask - the small 8-bit mask for small 32-bit icons """ ! which = 'ics8' ! want = 's8mk' ! class small_32_bit_icon(aetools.NProperty): ! """small 32 bit icon - the small 32-bit color icon """ ! which = 'is32' ! want = 'is32' ! ! small_8_bit_icon = small_8_bit_mask ! class small_4_bit_icon(aetools.NProperty): ! """small 4 bit icon - the small 4-bit color icon """ ! which = 'ics4' ! want = 'ics4' ! ! class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use \xd4as alias list\xd5 when a list of aliases is needed (instead of a list of file system item references). """ ! want = 'alst' preferences._superclassnames = [] preferences._privpropdict = { --- 166,197 ---- want = 'long' # element 'clbl' as ['indx', 'name'] ! alias_list._superclassnames = [] ! alias_list._privpropdict = { ! } ! alias_list._privelemdict = { ! } ! icon_family._superclassnames = [] ! icon_family._privpropdict = { ! 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, ! 'large_8_bit_mask' : large_8_bit_mask, ! 'large_32_bit_icon' : large_32_bit_icon, ! 'large_8_bit_icon' : large_8_bit_icon, ! 'large_4_bit_icon' : large_4_bit_icon, ! 'small_monochrome_icon_and_mask' : small_monochrome_icon_and_mask, ! 'small_8_bit_mask' : small_8_bit_mask, ! 'small_32_bit_icon' : small_32_bit_icon, ! 'small_8_bit_icon' : small_8_bit_icon, ! 'small_4_bit_icon' : small_4_bit_icon, ! } ! icon_family._privelemdict = { ! } ! label._superclassnames = [] ! label._privpropdict = { ! 'name' : name, ! 'index' : index, ! 'color' : color, ! } ! label._privelemdict = { ! } preferences._superclassnames = [] preferences._privpropdict = { *************** *** 193,224 **** 'label' : label, } - label._superclassnames = [] - label._privpropdict = { - 'name' : name, - 'index' : index, - 'color' : color, - } - label._privelemdict = { - } - icon_family._superclassnames = [] - icon_family._privpropdict = { - 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, - 'large_8_bit_mask' : large_8_bit_mask, - 'large_32_bit_icon' : large_32_bit_icon, - 'large_8_bit_icon' : large_8_bit_icon, - 'large_4_bit_icon' : large_4_bit_icon, - 'small_monochrome_icon_and_mask' : small_monochrome_icon_and_mask, - 'small_8_bit_mask' : small_8_bit_mask, - 'small_32_bit_icon' : small_32_bit_icon, - 'small_8_bit_icon' : small_8_bit_icon, - 'small_4_bit_icon' : small_4_bit_icon, - } - icon_family._privelemdict = { - } - alias_list._superclassnames = [] - alias_list._privpropdict = { - } - alias_list._privelemdict = { - } # --- 221,224 ---- *************** *** 237,241 **** 'iarr' : spatial_view_arrangement, 'barr' : button_view_arrangement, ! 'ics#' : small_monochrome_icon_and_mask, 'sknd' : shows_kind, 'svrs' : shows_version, --- 237,241 ---- 'iarr' : spatial_view_arrangement, 'barr' : button_view_arrangement, ! 'vfnt' : view_font, 'sknd' : shows_kind, 'svrs' : shows_version, *************** *** 243,259 **** '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, --- 243,259 ---- 'ics8' : small_8_bit_mask, 'icl8' : large_8_bit_icon, ! 'pidx' : index, 'vfsz' : view_font_size, 'sfsz' : calculates_folder_sizes, ! 'ics#' : small_monochrome_icon_and_mask, 'urdt' : uses_relative_dates, + 'bisz' : button_view_icon_size, 'usme' : uses_simple_menus, + 'sprg' : spring_open_folders, 'icl4' : large_4_bit_icon, 'slbl' : shows_label, 'lisz' : list_view_icon_size, ! 'ssiz' : shows_size, ! 'l8mk' : large_8_bit_mask, 'scom' : shows_comments, 'iisz' : spatial_view_icon_size, *************** *** 265,269 **** 'il32' : large_32_bit_icon, 'uswg' : uses_wide_grid, ! 'ssiz' : shows_size, } --- 265,269 ---- 'il32' : large_32_bit_icon, 'uswg' : uses_wide_grid, ! 'scda' : shows_creation_date, } Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Window_classes.py 23 Mar 2003 22:07:27 -0000 1.2 --- Window_classes.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 16,96 **** ! class window(aetools.ComponentItem): ! """window - A window """ want = 'cwin' - class position(aetools.NProperty): - """position - the upper left position of the window """ - which = 'posn' - want = 'QDpt' - class bounds(aetools.NProperty): - """bounds - the boundary rectangle for the window """ - which = 'pbnd' - want = 'qdrt' - class titled(aetools.NProperty): - """titled - Does the window have a title bar? """ - which = 'ptit' - want = 'bool' - class name(aetools.NProperty): - """name - the name of the window """ - which = 'pnam' - want = 'itxt' - class index(aetools.NProperty): - """index - the number of the window in the front-to-back layer ordering """ - which = 'pidx' - want = 'long' - class closeable(aetools.NProperty): - """closeable - Does the window have a close box? """ - which = 'hclb' - want = 'bool' - class floating(aetools.NProperty): - """floating - Does the window have a title bar? """ - which = 'isfl' - want = 'bool' - class modal(aetools.NProperty): - """modal - Is the window modal? """ - 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? """ - which = 'iszm' - want = 'bool' - class zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' - class zoomed_full_size(aetools.NProperty): - """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read, and only applies to open non-pop-up windows) """ - which = 'zumf' - want = 'bool' - class visible(aetools.NProperty): - """visible - Is the window visible (always true for open Finder windows)? """ - which = 'pvis' - want = 'bool' - class popup(aetools.NProperty): - """popup - Is the window is a pop-up window? (only applies to open container windows in the Finder and can only be set when the Finder is the front application) """ - which = 'drwr' - want = 'bool' - class pulled_open(aetools.NProperty): - """pulled open - Is the window pulled open (only applies to pop-up windows and can only be set when the Finder is the front application)? """ - which = 'pull' - want = 'bool' - class collapsed(aetools.NProperty): - """collapsed - Is the window collapsed (only applies to open non-pop-up windows)? """ - which = 'wshd' - want = 'bool' ! windows = window class container_window(aetools.ComponentItem): """container window - A window that contains items """ want = 'cwnd' - class _3c_Inheritance_3e_(aetools.NProperty): - """ - inherits some of its properties from the window class """ - which = 'c@#^' - want = 'cwin' class container(aetools.NProperty): """container - the container from which the window was opened """ --- 16,32 ---- ! class clipping_window(aetools.ComponentItem): ! """clipping window - The window containing a clipping """ ! want = 'lwnd' ! class _3c_Inheritance_3e_(aetools.NProperty): ! """ - inherits some of its properties from the window class """ ! which = 'c@#^' want = 'cwin' ! clipping_windows = clipping_window class container_window(aetools.ComponentItem): """container window - A window that contains items """ want = 'cwnd' class container(aetools.NProperty): """container - the container from which the window was opened """ *************** *** 164,167 **** --- 100,109 ---- container_windows = container_window + class content_space(aetools.ComponentItem): + """content space - All windows, including the desktop window (\xd2Window\xd3 does not include the desktop window) """ + want = 'dwnd' + + content_spaces = content_space + class information_window(aetools.ComponentItem): """information window - An information window (opened by \xd2Get Info\xd3) """ *************** *** 230,274 **** 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 """ want = 'pwnd' ! class clipping_window(aetools.ComponentItem): ! """clipping window - The window containing a clipping """ ! want = 'lwnd' ! clipping_windows = clipping_window ! class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (\xd2Window\xd3 does not include the desktop window) """ ! want = 'dwnd' ! content_spaces = content_space ! window._superclassnames = [] ! window._privpropdict = { ! 'position' : position, ! 'bounds' : bounds, ! 'titled' : titled, ! 'name' : name, ! 'index' : index, ! 'closeable' : closeable, ! 'floating' : floating, ! 'modal' : modal, ! 'resizable' : resizable, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, ! 'zoomed_full_size' : zoomed_full_size, ! 'visible' : visible, ! 'popup' : popup, ! 'pulled_open' : pulled_open, ! 'collapsed' : collapsed, } ! window._privelemdict = { } container_window._superclassnames = ['window'] --- 172,259 ---- information_windows = information_window class preferences_window(aetools.ComponentItem): """preferences window - The Finder Preferences window """ want = 'pwnd' ! class view_options_window(aetools.ComponentItem): ! """view options window - A View Options window """ ! want = 'vwnd' ! view_options_windows = view_options_window ! class window(aetools.ComponentItem): ! """window - A window """ ! want = 'cwin' ! class position(aetools.NProperty): ! """position - the upper left position of the window """ ! which = 'posn' ! want = 'QDpt' ! class bounds(aetools.NProperty): ! """bounds - the boundary rectangle for the window """ ! which = 'pbnd' ! want = 'qdrt' ! class titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' ! want = 'bool' ! class name(aetools.NProperty): ! """name - the name of the window """ ! which = 'pnam' ! want = 'itxt' ! class index(aetools.NProperty): ! """index - the number of the window in the front-to-back layer ordering """ ! which = 'pidx' ! want = 'long' ! class closeable(aetools.NProperty): ! """closeable - Does the window have a close box? """ ! which = 'hclb' ! want = 'bool' ! class floating(aetools.NProperty): ! """floating - Does the window have a title bar? """ ! which = 'isfl' ! want = 'bool' ! class modal(aetools.NProperty): ! """modal - Is the window modal? """ ! 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? """ ! which = 'iszm' ! want = 'bool' ! class zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' ! class zoomed_full_size(aetools.NProperty): ! """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read, and only applies to open non-pop-up windows) """ ! which = 'zumf' ! want = 'bool' ! class visible(aetools.NProperty): ! """visible - Is the window visible (always true for open Finder windows)? """ ! which = 'pvis' ! want = 'bool' ! class popup(aetools.NProperty): ! """popup - Is the window is a pop-up window? (only applies to open container windows in the Finder and can only be set when the Finder is the front application) """ ! which = 'drwr' ! want = 'bool' ! class pulled_open(aetools.NProperty): ! """pulled open - Is the window pulled open (only applies to pop-up windows and can only be set when the Finder is the front application)? """ ! which = 'pull' ! want = 'bool' ! class collapsed(aetools.NProperty): ! """collapsed - Is the window collapsed (only applies to open non-pop-up windows)? """ ! which = 'wshd' ! want = 'bool' ! windows = window ! clipping_window._superclassnames = ['window'] ! clipping_window._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping_window._privelemdict = { } container_window._superclassnames = ['window'] *************** *** 295,298 **** --- 280,288 ---- container_window._privelemdict = { } + content_space._superclassnames = [] + content_space._privpropdict = { + } + content_space._privelemdict = { + } information_window._superclassnames = ['window'] information_window._privpropdict = { *************** *** 317,327 **** information_window._privelemdict = { } - view_options_window._superclassnames = ['window'] - view_options_window._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'item' : item, - } - view_options_window._privelemdict = { - } preferences_window._superclassnames = ['window'] preferences_window._privpropdict = { --- 307,310 ---- *************** *** 331,344 **** preferences_window._privelemdict = { } ! clipping_window._superclassnames = ['window'] ! clipping_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping_window._privelemdict = { } ! content_space._superclassnames = [] ! content_space._privpropdict = { } ! content_space._privelemdict = { } --- 314,344 ---- preferences_window._privelemdict = { } ! view_options_window._superclassnames = ['window'] ! view_options_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + 'item' : item, } ! view_options_window._privelemdict = { } ! window._superclassnames = [] ! window._privpropdict = { ! 'position' : position, ! 'bounds' : bounds, ! 'titled' : titled, ! 'name' : name, ! 'index' : index, ! 'closeable' : closeable, ! 'floating' : floating, ! 'modal' : modal, ! 'resizable' : resizable, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, ! 'zoomed_full_size' : zoomed_full_size, ! 'visible' : visible, ! 'popup' : popup, ! 'pulled_open' : pulled_open, ! 'collapsed' : collapsed, } ! window._privelemdict = { } *************** *** 348,357 **** _classdeclarations = { 'pwnd' : preferences_window, - 'vwnd' : view_options_window, 'cwin' : window, 'cwnd' : container_window, 'dwnd' : content_space, 'iwnd' : information_window, - 'lwnd' : clipping_window, } --- 348,357 ---- _classdeclarations = { 'pwnd' : preferences_window, 'cwin' : window, + 'vwnd' : view_options_window, + 'lwnd' : clipping_window, 'cwnd' : container_window, 'dwnd' : content_space, 'iwnd' : information_window, } *************** *** 359,368 **** '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, --- 359,369 ---- 'prsz' : resizable, 'barr' : button_view_arrangement, ! 'pbnd' : bounds, ! 'appt' : preferred_size, 'iarr' : spatial_view_arrangement, 'hclb' : closeable, 'c@#^' : _3c_Inheritance_3e_, 'ver2' : product_version, ! 'cuss' : has_custom_view_settings, 'sprt' : suggested_size, 'zumf' : zoomed_full_size, *************** *** 370,378 **** 'panl' : current_panel, 'pmod' : modal, - 'pspd' : stationery, 'scom' : shows_comments, ! 'appt' : preferred_size, 'aslk' : locked, ! 'pbnd' : bounds, 'iimg' : icon, 'mprt' : minimum_size, --- 371,378 ---- 'panl' : current_panel, 'pmod' : modal, 'scom' : shows_comments, ! 'pspd' : stationery, 'aslk' : locked, ! 'pzum' : zoomed, 'iimg' : icon, 'mprt' : minimum_size, *************** *** 383,388 **** 'ptit' : titled, 'posn' : position, ! 'cuss' : has_custom_view_settings, 'phys' : physical_size, 'sknd' : shows_kind, 'svrs' : shows_version, --- 383,389 ---- 'ptit' : titled, 'posn' : position, ! 'vers' : version, 'phys' : physical_size, + 'pull' : pulled_open, 'sknd' : shows_kind, 'svrs' : shows_version, *************** *** 395,409 **** '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, } --- 396,409 ---- 'wshd' : collapsed, 'slbl' : shows_label, ! 'warn' : warns_before_emptying, 'ptsz' : size, 'pvis' : visible, 'pidx' : index, 'isfl' : floating, 'drwr' : popup, 'sdat' : shows_modification_date, 'pvew' : view, + 'sfsz' : calculates_folder_sizes, 'scda' : shows_creation_date, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Mar 2003 22:07:27 -0000 1.2 --- __init__.py 28 Mar 2003 22:07:18 -0000 1.3 *************** *** 6,17 **** Error = aetools.Error import Standard_Suite - import Earlier_terms - import Finder_Basics - import Finder_items import Containers_and_folders import Files_and_suitcases ! import Window_classes import Process_classes import Type_Definitions import Enumerations import Obsolete_terms --- 6,17 ---- Error = aetools.Error import Standard_Suite import Containers_and_folders import Files_and_suitcases ! import Finder_Basics ! import Finder_items import Process_classes + import Window_classes import Type_Definitions + import Earlier_terms import Enumerations import Obsolete_terms *************** *** 20,31 **** _code_to_module = { 'CoRe' : Standard_Suite, - 'tpnm' : Earlier_terms, - 'fndr' : Finder_Basics, - 'fndr' : Finder_items, 'fndr' : Containers_and_folders, 'fndr' : Files_and_suitcases, ! 'fndr' : Window_classes, 'fndr' : Process_classes, 'tpdf' : Type_Definitions, 'tpnm' : Enumerations, 'tpnm' : Obsolete_terms, --- 20,31 ---- _code_to_module = { 'CoRe' : Standard_Suite, 'fndr' : Containers_and_folders, 'fndr' : Files_and_suitcases, ! 'fndr' : Finder_Basics, ! 'fndr' : Finder_items, 'fndr' : Process_classes, + 'fndr' : Window_classes, 'tpdf' : Type_Definitions, + 'tpnm' : Earlier_terms, 'tpnm' : Enumerations, 'tpnm' : Obsolete_terms, *************** *** 36,47 **** _code_to_fullname = { 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), - 'tpnm' : ('Finder.Earlier_terms', 'Earlier_terms'), - 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), - 'fndr' : ('Finder.Finder_items', 'Finder_items'), 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), 'fndr' : ('Finder.Files_and_suitcases', 'Files_and_suitcases'), ! 'fndr' : ('Finder.Window_classes', 'Window_classes'), 'fndr' : ('Finder.Process_classes', 'Process_classes'), 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), 'tpnm' : ('Finder.Enumerations', 'Enumerations'), 'tpnm' : ('Finder.Obsolete_terms', 'Obsolete_terms'), --- 36,47 ---- _code_to_fullname = { 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), 'fndr' : ('Finder.Files_and_suitcases', 'Files_and_suitcases'), ! 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), ! 'fndr' : ('Finder.Finder_items', 'Finder_items'), 'fndr' : ('Finder.Process_classes', 'Process_classes'), + 'fndr' : ('Finder.Window_classes', 'Window_classes'), 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), + 'tpnm' : ('Finder.Earlier_terms', 'Earlier_terms'), 'tpnm' : ('Finder.Enumerations', 'Enumerations'), 'tpnm' : ('Finder.Obsolete_terms', 'Obsolete_terms'), *************** *** 49,60 **** from Standard_Suite import * - from Earlier_terms import * - from Finder_Basics import * - from Finder_items import * from Containers_and_folders import * from Files_and_suitcases import * ! from Window_classes import * from Process_classes import * from Type_Definitions import * from Enumerations import * from Obsolete_terms import * --- 49,60 ---- from Standard_Suite import * from Containers_and_folders import * from Files_and_suitcases import * ! from Finder_Basics import * ! from Finder_items import * from Process_classes import * + from Window_classes import * from Type_Definitions import * + from Earlier_terms import * from Enumerations import * from Obsolete_terms import * *************** *** 130,136 **** getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) - getbaseclasses(application) - getbaseclasses(special_folders) - getbaseclasses(item) getbaseclasses(trash_2d_object) getbaseclasses(desktop_2d_object) --- 130,133 ---- *************** *** 140,143 **** --- 137,143 ---- getbaseclasses(folder) getbaseclasses(container) + getbaseclasses(application) + getbaseclasses(special_folders) + getbaseclasses(item) getbaseclasses(sound_file) getbaseclasses(font_file) *************** *** 207,221 **** getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) - getbaseclasses(status_window) - getbaseclasses(application) - getbaseclasses(sharing_window) - getbaseclasses(control_panel) - getbaseclasses(process) - getbaseclasses(item) - getbaseclasses(file) - getbaseclasses(sharable_container) - getbaseclasses(container_window) - getbaseclasses(container) - getbaseclasses(information_window) getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) --- 207,210 ---- *************** *** 258,261 **** --- 247,261 ---- getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + getbaseclasses(status_window) + getbaseclasses(application) + getbaseclasses(sharing_window) + getbaseclasses(control_panel) + getbaseclasses(process) + getbaseclasses(item) + getbaseclasses(file) + getbaseclasses(sharable_container) + getbaseclasses(container_window) + getbaseclasses(container) + getbaseclasses(information_window) # *************** *** 316,322 **** 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - 'capp' : application, - 'spfl' : special_folders, - 'cobj' : item, 'ctrs' : trash_2d_object, 'cdsk' : desktop_2d_object, --- 316,319 ---- *************** *** 326,329 **** --- 323,329 ---- 'cfol' : folder, 'ctnr' : container, + 'capp' : application, + 'spfl' : special_folders, + 'cobj' : item, 'sndf' : sound_file, 'fntf' : font_file, *************** *** 393,407 **** 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - '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, 'shor' : StdSuites.Type_Names_Suite.small_integer, 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, --- 393,396 ---- *************** *** 444,459 **** 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } class Finder(Standard_Suite_Events, - Earlier_terms_Events, - Finder_Basics_Events, - Finder_items_Events, Containers_and_folders_Events, Files_and_suitcases_Events, ! Window_classes_Events, Process_classes_Events, Type_Definitions_Events, Enumerations_Events, Obsolete_terms_Events, --- 433,459 ---- 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + '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, } class Finder(Standard_Suite_Events, Containers_and_folders_Events, Files_and_suitcases_Events, ! Finder_Basics_Events, ! Finder_items_Events, Process_classes_Events, + Window_classes_Events, Type_Definitions_Events, + Earlier_terms_Events, Enumerations_Events, Obsolete_terms_Events, From montanaro@users.sourceforge.net Fri Mar 28 22:31:47 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:31:47 -0800 Subject: [Python-checkins] python/dist/src/Lib os.py,1.50.8.6,1.50.8.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31940 Modified Files: Tag: release22-maint os.py Log Message: backport fix for missing altsep in nt (bug 709428) Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.50.8.6 retrieving revision 1.50.8.7 diff -C2 -d -r1.50.8.6 -r1.50.8.7 *** os.py 7 Sep 2002 04:49:09 -0000 1.50.8.6 --- os.py 28 Mar 2003 22:31:41 -0000 1.50.8.7 *************** *** 61,64 **** --- 61,65 ---- curdir = '.'; pardir = '..'; sep = '\\'; pathsep = ';' defpath = '.;C:\\bin' + altsep = '/' from nt import * for i in ['_exit']: From montanaro@users.sourceforge.net Fri Mar 28 22:23:29 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 28 Mar 2003 14:23:29 -0800 Subject: [Python-checkins] python/dist/src/Lib ntpath.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28921 Modified Files: ntpath.py Log Message: make nt altsep forward slash - closes bug 709428 backport candidate Index: ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** ntpath.py 17 Feb 2003 09:17:50 -0000 1.56 --- ntpath.py 28 Mar 2003 22:23:24 -0000 1.57 *************** *** 23,27 **** sep = '\\' pathsep = ';' ! altsep = None defpath = '.;C:\\bin' if 'ce' in sys.builtin_module_names: --- 23,27 ---- sep = '\\' pathsep = ';' ! altsep = '/' defpath = '.;C:\\bin' if 'ce' in sys.builtin_module_names: From jackjansen@users.sourceforge.net Fri Mar 28 23:37:09 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:37:09 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv26071 Modified Files: gensuitemodule.py Log Message: Sigh: didn't catch all lists that needed to be sorted. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** gensuitemodule.py 28 Mar 2003 22:04:22 -0000 1.35 --- gensuitemodule.py 28 Mar 2003 23:37:05 -0000 1.36 *************** *** 128,131 **** --- 128,132 ---- edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" + print "\nASKING FOR aete DICTIONARY IN", `fullname` try: aedescobj, launched = OSATerminology.GetAppTerminology(fullname) *************** *** 857,862 **** --- 858,865 ---- self.fp.write('\twant = %s\n' % `code`) self.namemappers[0].addnamecode('class', pname, code) + properties.sort() for prop in properties: self.compileproperty(prop) + elements.sort() for elem in elements: self.compileelement(elem) *************** *** 926,929 **** --- 929,935 ---- else: elist.append((name, ename)) + + plist.sort() + elist.sort() if self.fp: *************** *** 975,992 **** return self.fp.write("\n#\n# Indices of types declared in this module\n#\n") self.fp.write("_classdeclarations = {\n") ! for k, v in self.namemappers[0].getall('class'): self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") ! for k, v in self.namemappers[0].getall('property'): self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") ! for k, v in self.namemappers[0].getall('comparison'): self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") ! for k, v in self.namemappers[0].getall('enum'): self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") --- 981,1010 ---- return self.fp.write("\n#\n# Indices of types declared in this module\n#\n") + self.fp.write("_classdeclarations = {\n") ! classlist = self.namemappers[0].getall('class') ! classlist.sort() ! for k, v in classlist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") + self.fp.write("\n_propdeclarations = {\n") ! proplist = self.namemappers[0].getall('property') ! proplist.sort() ! for k, v in proplist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") + self.fp.write("\n_compdeclarations = {\n") ! complist = self.namemappers[0].getall('comparison') ! complist.sort() ! for k, v in complist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") + self.fp.write("\n_enumdeclarations = {\n") ! enumlist = self.namemappers[0].getall('enum') ! enumlist.sort() ! for k, v in enumlist: self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") From jackjansen@users.sourceforge.net Fri Mar 28 23:38:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:38:06 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.3,1.4 Macintosh_Connectivity_Clas.py,1.3,1.4 QuickDraw_Graphics_Suite.py,1.3,1.4 QuickDraw_Graphics_Suppleme.py,1.2,1.3 Standard_Suite.py,1.3,1.4 Table_Suite.py,1.2,1.3 Text_Suite.py,1.2,1.3 Type_Names_Suite.py,1.3,1.4 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv26251/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Sigh: didn't catch all lists that needed to be sorted. Regenerated again. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:20 -0000 1.3 --- AppleScript_Suite.py 28 Mar 2003 23:37:57 -0000 1.4 *************** *** 864,886 **** application = app ! class result(aetools.NProperty): ! """result - the last result of evaluation """ ! which = 'rslt' ! want = '****' ! class space(aetools.NProperty): ! """space - a space character """ ! which = 'spac' ! want = 'cha ' ! class return_(aetools.NProperty): ! """return - a return character """ ! which = 'ret ' ! want = 'cha ' ! class tab(aetools.NProperty): ! """tab - a tab character """ ! which = 'tab ' ! want = 'cha ' ! class minutes(aetools.NProperty): ! """minutes - the number of seconds in a minute """ ! which = 'min ' want = 'long' class hours(aetools.NProperty): --- 864,874 ---- application = app ! class AppleScript(aetools.NProperty): ! """AppleScript - the top-level script object """ ! which = 'ascr' ! want = 'scpt' ! class days(aetools.NProperty): ! """days - the number of seconds in a day """ ! which = 'days' want = 'long' class hours(aetools.NProperty): *************** *** 888,898 **** which = 'hour' want = 'long' ! class days(aetools.NProperty): ! """days - the number of seconds in a day """ ! which = 'days' ! want = 'long' ! class weeks(aetools.NProperty): ! """weeks - the number of seconds in a week """ ! which = 'week' want = 'long' class pi(aetools.NProperty): --- 876,882 ---- which = 'hour' want = 'long' ! class minutes(aetools.NProperty): ! """minutes - the number of seconds in a minute """ ! which = 'min ' want = 'long' class pi(aetools.NProperty): *************** *** 900,919 **** which = 'pi ' want = 'doub' - class print_length(aetools.NProperty): - """print length - the maximum length to print """ - which = 'prln' - want = 'long' class print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' class text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' ! class AppleScript(aetools.NProperty): ! """AppleScript - the top-level script object """ ! which = 'ascr' ! want = 'scpt' applications = app --- 884,919 ---- which = 'pi ' want = 'doub' class print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' + class print_length(aetools.NProperty): + """print length - the maximum length to print """ + which = 'prln' + want = 'long' + class result(aetools.NProperty): + """result - the last result of evaluation """ + which = 'rslt' + want = '****' + class return_(aetools.NProperty): + """return - a return character """ + which = 'ret ' + want = 'cha ' + class space(aetools.NProperty): + """space - a space character """ + which = 'spac' + want = 'cha ' + class tab(aetools.NProperty): + """tab - a tab character """ + which = 'tab ' + want = 'cha ' class text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' ! class weeks(aetools.NProperty): ! """weeks - the number of seconds in a week """ ! which = 'week' ! want = 'long' applications = app *************** *** 984,1015 **** """date - Absolute date and time values """ want = 'ldt ' ! class weekday(aetools.NProperty): ! """weekday - the day of a week of a date """ ! which = 'wkdy' ! want = 'wkdy' ! class month(aetools.NProperty): ! """month - the month of a date """ ! which = 'mnth' ! want = 'mnth' class day(aetools.NProperty): """day - the day of the month of a date """ which = 'day ' want = 'long' ! class year(aetools.NProperty): ! """year - the year of a date """ ! which = 'year' ! want = 'long' class time(aetools.NProperty): """time - the time since midnight of a date """ which = 'time' want = 'long' - class date_string(aetools.NProperty): - """date string - the date portion of a date-time value as text """ - which = 'dstr' - want = 'TEXT' class time_string(aetools.NProperty): """time string - the time portion of a date-time value as text """ which = 'tstr' want = 'TEXT' dates = date --- 984,1015 ---- """date - Absolute date and time values """ want = 'ldt ' ! class date_string(aetools.NProperty): ! """date string - the date portion of a date-time value as text """ ! which = 'dstr' ! want = 'TEXT' class day(aetools.NProperty): """day - the day of the month of a date """ which = 'day ' want = 'long' ! class month(aetools.NProperty): ! """month - the month of a date """ ! which = 'mnth' ! want = 'mnth' class time(aetools.NProperty): """time - the time since midnight of a date """ which = 'time' want = 'long' class time_string(aetools.NProperty): """time string - the time portion of a date-time value as text """ which = 'tstr' want = 'TEXT' + class weekday(aetools.NProperty): + """weekday - the day of a week of a date """ + which = 'wkdy' + want = 'wkdy' + class year(aetools.NProperty): + """year - the year of a date """ + which = 'year' + want = 'long' dates = date *************** *** 1096,1107 **** which = 'kMsg' want = 'cha ' - class modifiers(aetools.NProperty): - """modifiers - the modifier keys pressed in combination """ - which = 'kMod' - want = 'eMds' class key_kind(aetools.NProperty): """key kind - the kind of key that was pressed """ which = 'kknd' want = 'ekst' keystrokes = keystroke --- 1096,1107 ---- which = 'kMsg' want = 'cha ' class key_kind(aetools.NProperty): """key kind - the kind of key that was pressed """ which = 'kknd' want = 'ekst' + class modifiers(aetools.NProperty): + """modifiers - the modifier keys pressed in combination """ + which = 'kMod' + want = 'eMds' keystrokes = keystroke *************** *** 1130,1141 **** """list - An ordered collection of items """ want = 'list' - class reverse(aetools.NProperty): - """reverse - the items of the list in reverse order """ - which = 'rvse' - want = 'list' class rest(aetools.NProperty): """rest - all items of the list excluding first """ which = 'rest' want = 'list' class list_or_record(aetools.ComponentItem): --- 1130,1141 ---- """list - An ordered collection of items """ want = 'list' class rest(aetools.NProperty): """rest - all items of the list excluding first """ which = 'rest' want = 'list' + class reverse(aetools.NProperty): + """reverse - the items of the list in reverse order """ + which = 'rvse' + want = 'list' class list_or_record(aetools.ComponentItem): *************** *** 1372,1383 **** """writing code info - script code and language code of text run """ want = 'citl' - class script_code(aetools.NProperty): - """script code - the script code for the text """ - which = 'pscd' - want = 'shor' class language_code(aetools.NProperty): """language code - the language code for the text """ which = 'plcd' want = 'shor' writing_code_infos = writing_code_info --- 1372,1383 ---- """writing code info - script code and language code of text run """ want = 'citl' class language_code(aetools.NProperty): """language code - the language code for the text """ which = 'plcd' want = 'shor' + class script_code(aetools.NProperty): + """script code - the script code for the text """ + which = 'pscd' + want = 'shor' writing_code_infos = writing_code_info *************** *** 1595,1605 **** date._superclassnames = [] date._privpropdict = { ! 'weekday' : weekday, ! 'month' : month, 'day' : day, ! 'year' : year, 'time' : time, - 'date_string' : date_string, 'time_string' : time_string, } date._privelemdict = { --- 1595,1605 ---- date._superclassnames = [] date._privpropdict = { ! 'date_string' : date_string, 'day' : day, ! 'month' : month, 'time' : time, 'time_string' : time_string, + 'weekday' : weekday, + 'year' : year, } date._privelemdict = { *************** *** 1684,1689 **** keystroke._privpropdict = { 'key' : key, - 'modifiers' : modifiers, 'key_kind' : key_kind, } keystroke._privelemdict = { --- 1684,1689 ---- keystroke._privpropdict = { 'key' : key, 'key_kind' : key_kind, + 'modifiers' : modifiers, } keystroke._privelemdict = { *************** *** 1708,1713 **** list._privpropdict = { 'length' : length, - 'reverse' : reverse, 'rest' : rest, } list._privelemdict = { --- 1708,1713 ---- list._privpropdict = { 'length' : length, 'rest' : rest, + 'reverse' : reverse, } list._privelemdict = { *************** *** 1948,1953 **** writing_code_info._superclassnames = [] writing_code_info._privpropdict = { - 'script_code' : script_code, 'language_code' : language_code, } writing_code_info._privelemdict = { --- 1948,1953 ---- writing_code_info._superclassnames = [] writing_code_info._privpropdict = { 'language_code' : language_code, + 'script_code' : script_code, } writing_code_info._privelemdict = { *************** *** 2029,2172 **** # _classdeclarations = { ! 'jul ' : July, ! 'may ' : May, 'TEXT' : string, 'cmet' : cubic_meters, ! 'STXT' : styled_text, ! 'nds ' : number_2c__date_or_text, ! 'feet' : feet, ! 'feb ' : February, 'degc' : degrees_Celsius, - 'kprs' : keystroke, - 'psct' : writing_code, 'degf' : degrees_Fahrenheit, - 'lrs ' : list_2c__record_or_text, - 'ldt ' : date, 'degk' : degrees_Kelvin, ! 'sun ' : Sunday, ! 'oct ' : October, 'evnt' : event, ! 'pstr' : Pascal_string, ! 'cyrd' : cubic_yards, ! 'PICT' : picture, ! 'ls ' : list_or_string, ! 'long' : integer, ! 'prop' : properties, ! 'nmbr' : number, ! 'citl' : writing_code_info, ! 'citm' : text_item, ! 'apr ' : April, ! 'thu ' : Thursday, ! 'type' : type_class, ! 'prep' : preposition, ! 'tue ' : Tuesday, ! 'case' : upper_case, ! 'vers' : version, ! 'wed ' : Wednesday, ! 'capp' : app, ! 'sqkm' : square_kilometers, ! 'obj ' : reference, ! 'vect' : vector, ! 'wkdy' : weekday, ! 'cRGB' : RGB_color, ! 'nd ' : number_or_date, 'itxt' : international_text, ! 'scnd' : seconds, ! 'mar ' : March, 'kmtr' : kilometers, ! 'sqft' : square_feet, 'list' : list, ! 'styl' : styled_Clipboard_text, ! 'nov ' : November, ! 'qrts' : quarts, ! 'mile' : miles, ! 'msng' : missing_value, ! 'alis' : alias, ! 'jan ' : January, 'metr' : meters, 'mnth' : month, 'ns ' : number_or_string, ! 'jun ' : June, ! 'aug ' : August, ! 'llst' : linked_list, ! 'doub' : real, ! 'encs' : encoded_string, ! 'galn' : gallons, ! 'cuin' : cubic_inches, ! 'fri ' : Friday, 'sf ' : alias_or_string, - 'lr ' : list_or_record, - 'mon ' : Monday, 'snd ' : sound, ! 'sep ' : September, ! 'kgrm' : kilograms, ! 'scpt' : script, ! '****' : anything, ! 'litr' : liters, ! 'bool' : boolean, ! 'cmtr' : centimeters, 'sqrm' : square_meters, ! 'inch' : inches, ! 'zone' : zone, ! 'kfrm' : reference_form, ! 'cobj' : item, ! 'gram' : grams, ! 'cha ' : character, ! 'reco' : record, 'undf' : empty_ae_name_, - 'dec ' : December, - 'enum' : constant, - 'hand' : handler, - 'sqmi' : square_miles, - 'rdat' : data, - 'cstr' : C_string, 'utxt' : Unicode_text, ! 'sutx' : styled_Unicode_text, ! 'mach' : machine, ! 'sqyd' : square_yards, 'yard' : yards, ! 'ozs ' : ounces, ! 'lbs ' : pounds, ! 'cfet' : cubic_feet, ! 'ccmt' : cubic_centimeters, ! 'sat ' : Saturday, ! 'pcls' : class_, ! 'fss ' : file_specification, ! 'ctxt' : text, } _propdeclarations = { ! 'week' : weeks, 'mnth' : month, 'pare' : parent, - 'leng' : length, 'pi ' : pi, - 'kMod' : modifiers, - '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, 'plcd' : language_code, ! 'ret ' : return_, ! 'kMsg' : key, ! 'hour' : hours, ! '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, } --- 2029,2172 ---- # _classdeclarations = { ! '****' : anything, ! 'PICT' : picture, ! 'STXT' : styled_text, 'TEXT' : string, + 'alis' : alias, + 'apr ' : April, + 'aug ' : August, + 'bool' : boolean, + 'cRGB' : RGB_color, + 'capp' : app, + 'case' : upper_case, + 'ccmt' : cubic_centimeters, + 'cfet' : cubic_feet, + 'cha ' : character, + 'citl' : writing_code_info, + 'citm' : text_item, 'cmet' : cubic_meters, ! 'cmtr' : centimeters, ! 'cobj' : item, ! 'cstr' : C_string, ! 'ctxt' : text, ! 'cuin' : cubic_inches, ! 'cyrd' : cubic_yards, ! 'dec ' : December, 'degc' : degrees_Celsius, 'degf' : degrees_Fahrenheit, 'degk' : degrees_Kelvin, ! 'doub' : real, ! 'encs' : encoded_string, ! 'enum' : constant, 'evnt' : event, ! 'feb ' : February, ! 'feet' : feet, ! 'fri ' : Friday, ! 'fss ' : file_specification, ! 'galn' : gallons, ! 'gram' : grams, ! 'hand' : handler, ! 'inch' : inches, 'itxt' : international_text, ! 'jan ' : January, ! 'jul ' : July, ! 'jun ' : June, ! 'kfrm' : reference_form, ! 'kgrm' : kilograms, 'kmtr' : kilometers, ! 'kprs' : keystroke, ! 'lbs ' : pounds, ! 'ldt ' : date, 'list' : list, ! 'litr' : liters, ! 'llst' : linked_list, ! 'long' : integer, ! 'lr ' : list_or_record, ! 'lrs ' : list_2c__record_or_text, ! 'ls ' : list_or_string, ! 'mach' : machine, ! 'mar ' : March, ! 'may ' : May, 'metr' : meters, + 'mile' : miles, 'mnth' : month, + 'mon ' : Monday, + 'msng' : missing_value, + 'nd ' : number_or_date, + 'nds ' : number_2c__date_or_text, + 'nmbr' : number, + 'nov ' : November, 'ns ' : number_or_string, ! 'obj ' : reference, ! 'oct ' : October, ! 'ozs ' : ounces, ! 'pcls' : class_, ! 'prep' : preposition, ! 'prop' : properties, ! 'psct' : writing_code, ! 'pstr' : Pascal_string, ! 'qrts' : quarts, ! 'rdat' : data, ! 'reco' : record, ! 'sat ' : Saturday, ! 'scnd' : seconds, ! 'scpt' : script, ! 'sep ' : September, 'sf ' : alias_or_string, 'snd ' : sound, ! 'sqft' : square_feet, ! 'sqkm' : square_kilometers, ! 'sqmi' : square_miles, 'sqrm' : square_meters, ! 'sqyd' : square_yards, ! 'styl' : styled_Clipboard_text, ! 'sun ' : Sunday, ! 'sutx' : styled_Unicode_text, ! 'thu ' : Thursday, ! 'tue ' : Tuesday, ! 'type' : type_class, 'undf' : empty_ae_name_, 'utxt' : Unicode_text, ! 'vect' : vector, ! 'vers' : version, ! 'wed ' : Wednesday, ! 'wkdy' : weekday, 'yard' : yards, ! 'zone' : zone, } _propdeclarations = { ! 'ID ' : id, ! 'ascr' : AppleScript, ! 'c@#^' : _3c_Inheritance_3e_, ! 'day ' : day, ! 'days' : days, ! 'dstr' : date_string, ! 'hour' : hours, ! 'kMod' : modifiers, ! 'kMsg' : key, ! 'kknd' : key_kind, ! 'leng' : length, ! 'min ' : minutes, 'mnth' : month, 'pare' : parent, 'pi ' : pi, 'plcd' : language_code, ! 'pnam' : name, 'prdp' : print_depth, 'prln' : print_length, 'pscd' : script_code, ! 'rest' : rest, ! 'ret ' : return_, 'rslt' : result, ! 'rvse' : reverse, ! 'spac' : space, ! 'tab ' : tab, ! 'time' : time, ! 'tstr' : time_string, ! 'txdl' : text_item_delimiters, ! 'week' : weeks, ! 'wkdy' : weekday, ! 'year' : year, } *************** *** 2175,2182 **** _enumdeclarations = { ! 'eMds' : _Enum_eMds, 'cons' : _Enum_cons, ! 'misc' : _Enum_misc, 'ekst' : _Enum_ekst, ! 'boov' : _Enum_boov, } --- 2175,2182 ---- _enumdeclarations = { ! 'boov' : _Enum_boov, 'cons' : _Enum_cons, ! 'eMds' : _Enum_eMds, 'ekst' : _Enum_ekst, ! 'misc' : _Enum_misc, } Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Macintosh_Connectivity_Clas.py 28 Mar 2003 22:07:21 -0000 1.3 --- Macintosh_Connectivity_Clas.py 28 Mar 2003 23:37:57 -0000 1.4 *************** *** 37,48 **** which = 'patm' want = 'TEXT' - class AppleTalk_zone(aetools.NProperty): - """AppleTalk zone - the zone part of the address """ - which = 'patz' - want = 'TEXT' class AppleTalk_type(aetools.NProperty): """AppleTalk type - the type part of the AppleTalk address """ which = 'patt' want = 'TEXT' AppleTalk_addresses = AppleTalk_address --- 37,48 ---- which = 'patm' want = 'TEXT' class AppleTalk_type(aetools.NProperty): """AppleTalk type - the type part of the AppleTalk address """ which = 'patt' want = 'TEXT' + class AppleTalk_zone(aetools.NProperty): + """AppleTalk zone - the zone part of the address """ + which = 'patz' + want = 'TEXT' AppleTalk_addresses = AppleTalk_address *************** *** 95,106 **** """SCSI address - Addresses a SCSI device """ want = 'cscs' - class SCSI_bus(aetools.NProperty): - """SCSI bus - the SCSI bus number """ - which = 'pscb' - want = 'shor' class LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ which = 'pslu' want = 'shor' SCSI_addresses = SCSI_address --- 95,106 ---- """SCSI address - Addresses a SCSI device """ want = 'cscs' class LUN(aetools.NProperty): """LUN - the SCSI logical unit number """ which = 'pslu' want = 'shor' + class SCSI_bus(aetools.NProperty): + """SCSI bus - the SCSI bus number """ + which = 'pscb' + want = 'shor' SCSI_addresses = SCSI_address *************** *** 125,136 **** """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' - class properties(aetools.NProperty): - """properties - property that allows getting and setting of multiple properties """ - which = 'pALL' - want = 'reco' class conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ which = 'pcon' want = 'econ' class protocol(aetools.NProperty): """protocol - How to talk to this addressee """ --- 125,136 ---- """address specification - Unique designation of a device or service connected to this computer """ want = 'cadr' class conduit(aetools.NProperty): """conduit - How the addressee is physically connected """ which = 'pcon' want = 'econ' + class properties(aetools.NProperty): + """properties - property that allows getting and setting of multiple properties """ + which = 'pALL' + want = 'reco' class protocol(aetools.NProperty): """protocol - How to talk to this addressee """ *************** *** 149,166 **** """device specification - A device connected to a computer """ want = 'cdev' - class device_type(aetools.NProperty): - """device type - the kind of device """ - which = 'pdvt' - want = 'edvt' class device_address(aetools.NProperty): """device address - the address of the device """ which = 'pdva' want = 'cadr' device_specifications = device_specification ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ADB_address._privelemdict = { --- 149,166 ---- """device specification - A device connected to a computer """ want = 'cdev' class device_address(aetools.NProperty): """device address - the address of the device """ which = 'pdva' want = 'cadr' + class device_type(aetools.NProperty): + """device type - the kind of device """ + which = 'pdvt' + want = 'edvt' device_specifications = device_specification ADB_address._superclassnames = ['address_specification'] ADB_address._privpropdict = { 'ID' : ID, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ADB_address._privelemdict = { *************** *** 168,175 **** AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'AppleTalk_machine' : AppleTalk_machine, - 'AppleTalk_zone' : AppleTalk_zone, 'AppleTalk_type' : AppleTalk_type, } AppleTalk_address._privelemdict = { --- 168,175 ---- AppleTalk_address._superclassnames = ['address_specification'] AppleTalk_address._privpropdict = { 'AppleTalk_machine' : AppleTalk_machine, 'AppleTalk_type' : AppleTalk_type, + 'AppleTalk_zone' : AppleTalk_zone, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } AppleTalk_address._privelemdict = { *************** *** 177,182 **** Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } Ethernet_address._privelemdict = { --- 177,182 ---- Ethernet_address._superclassnames = ['address_specification'] Ethernet_address._privpropdict = { 'ID' : ID, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } Ethernet_address._privelemdict = { *************** *** 184,189 **** FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } FireWire_address._privelemdict = { --- 184,189 ---- FireWire_address._superclassnames = ['address_specification'] FireWire_address._privpropdict = { 'ID' : ID, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } FireWire_address._privelemdict = { *************** *** 191,197 **** IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, - 'ID' : ID, 'DNS_form' : DNS_form, 'port' : port, } --- 191,197 ---- IP_address._superclassnames = ['address_specification'] IP_address._privpropdict = { 'DNS_form' : DNS_form, + 'ID' : ID, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'port' : port, } *************** *** 209,216 **** SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, - 'SCSI_bus' : SCSI_bus, 'ID' : ID, 'LUN' : LUN, } SCSI_address._privelemdict = { --- 209,216 ---- SCSI_address._superclassnames = ['address_specification'] SCSI_address._privpropdict = { 'ID' : ID, 'LUN' : LUN, + 'SCSI_bus' : SCSI_bus, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } SCSI_address._privelemdict = { *************** *** 218,223 **** Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } Token_Ring_address._privelemdict = { --- 218,223 ---- Token_Ring_address._superclassnames = ['address_specification'] Token_Ring_address._privpropdict = { 'ID' : ID, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } Token_Ring_address._privelemdict = { *************** *** 230,235 **** address_specification._superclassnames = [] address_specification._privpropdict = { - 'properties' : properties, 'conduit' : conduit, 'protocol' : protocol, } --- 230,235 ---- address_specification._superclassnames = [] address_specification._privpropdict = { 'conduit' : conduit, + 'properties' : properties, 'protocol' : protocol, } *************** *** 238,243 **** bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { - '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } bus_slot._privelemdict = { --- 238,243 ---- bus_slot._superclassnames = ['address_specification'] bus_slot._privpropdict = { 'ID' : ID, + '_3c_inheritance_3e_' : _3c_inheritance_3e_, } bus_slot._privelemdict = { *************** *** 245,251 **** device_specification._superclassnames = [] device_specification._privpropdict = { - 'properties' : properties, - 'device_type' : device_type, 'device_address' : device_address, } device_specification._privelemdict = { --- 245,251 ---- device_specification._superclassnames = [] device_specification._privpropdict = { 'device_address' : device_address, + 'device_type' : device_type, + 'properties' : properties, } device_specification._privelemdict = { *************** *** 327,363 **** # _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_Addresses, - 'cip ' : IP_address, - 'clt ' : LocalTalk_address, 'cdev' : device_specification, 'cen ' : Ethernet_address, } _propdeclarations = { ! 'pdns' : DNS_form, ! 'pdva' : device_address, '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, ! 'psoc' : socket, ! 'pscb' : SCSI_bus, 'ppor' : port, ! 'patm' : AppleTalk_machine, 'pslu' : LUN, ! 'pnod' : node, } --- 327,363 ---- # _classdeclarations = { ! 'cadb' : ADB_address, 'cadr' : address_specification, ! 'cat ' : AppleTalk_address, 'cbus' : bus_slot, 'cdev' : device_specification, 'cen ' : Ethernet_address, + 'cfw ' : FireWire_address, + 'cip ' : IP_address, + 'clt ' : LocalTalk_address, + 'cscs' : SCSI_address, + 'ctok' : Token_Ring_address, + 'cusb' : USB_Addresses, } _propdeclarations = { ! 'ID ' : ID, ! 'c@#^' : _3c_inheritance_3e_, ! 'pALL' : properties, ! 'patm' : AppleTalk_machine, 'patt' : AppleTalk_type, 'patz' : AppleTalk_zone, ! 'pcon' : conduit, ! 'pdns' : DNS_form, ! 'pdva' : device_address, 'pdvt' : device_type, 'pnam' : name, ! 'pnet' : network, ! 'pnod' : node, 'ppor' : port, ! 'pprt' : protocol, ! 'pscb' : SCSI_bus, 'pslu' : LUN, ! 'psoc' : socket, } Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QuickDraw_Graphics_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 --- QuickDraw_Graphics_Suite.py 28 Mar 2003 23:37:58 -0000 1.4 *************** *** 77,87 **** which = 'cltb' want = 'clrt' ! class ordering(aetools.NProperty): ! """ordering - the ordered list of graphic objects in the drawing area """ ! which = 'gobs' ! want = 'obj ' ! class name(aetools.NProperty): ! """name - the name """ ! which = 'pnam' want = 'itxt' class default_location(aetools.NProperty): --- 77,83 ---- which = 'cltb' want = 'clrt' ! class default_font(aetools.NProperty): ! """default font - the name of the default font for text objects """ ! which = 'ptxf' want = 'itxt' class default_location(aetools.NProperty): *************** *** 89,120 **** which = 'pnel' want = 'QDpt' - class pixel_depth(aetools.NProperty): - """pixel depth - the number of bits per pixel """ - which = 'pdpt' - want = 'shor' - class writing_code(aetools.NProperty): - """writing code - the script system and language of text objects in the drawing area """ - which = 'psct' - want = 'intl' - class text_color(aetools.NProperty): - """text color - the default color for text objects """ - which = 'ptxc' - want = 'cRGB' - class default_font(aetools.NProperty): - """default font - the name of the default font for text objects """ - which = 'ptxf' - want = 'itxt' class default_size(aetools.NProperty): """default size - the default size for text objects """ which = 'ptps' want = 'fixd' class style(aetools.NProperty): """style - the default text style for text objects """ which = 'txst' want = 'tsty' class update_on_change(aetools.NProperty): """update on change - Redraw after each change? """ which = 'pupd' want = 'bool' drawing_areas = drawing_area --- 85,120 ---- which = 'pnel' want = 'QDpt' class default_size(aetools.NProperty): """default size - the default size for text objects """ which = 'ptps' want = 'fixd' + class name(aetools.NProperty): + """name - the name """ + which = 'pnam' + want = 'itxt' + class ordering(aetools.NProperty): + """ordering - the ordered list of graphic objects in the drawing area """ + which = 'gobs' + want = 'obj ' + class pixel_depth(aetools.NProperty): + """pixel depth - the number of bits per pixel """ + which = 'pdpt' + want = 'shor' class style(aetools.NProperty): """style - the default text style for text objects """ which = 'txst' want = 'tsty' + class text_color(aetools.NProperty): + """text color - the default color for text objects """ + which = 'ptxc' + want = 'cRGB' class update_on_change(aetools.NProperty): """update on change - Redraw after each change? """ which = 'pupd' want = 'bool' + class writing_code(aetools.NProperty): + """writing code - the script system and language of text objects in the drawing area """ + which = 'psct' + want = 'intl' drawing_areas = drawing_area *************** *** 129,148 **** """graphic line - A graphic line """ want = 'glin' - class start_point(aetools.NProperty): - """start point - the starting point of the line """ - which = 'pstp' - want = 'QDpt' - class end_point(aetools.NProperty): - """end point - the ending point of the line """ - which = 'pend' - want = 'QDpt' - class dash_style(aetools.NProperty): - """dash style - the dash style """ - which = 'pdst' - want = 'tdas' class arrow_style(aetools.NProperty): """arrow style - the arrow style """ which = 'arro' want = 'arro' graphic_lines = graphic_line --- 129,148 ---- """graphic line - A graphic line """ want = 'glin' class arrow_style(aetools.NProperty): """arrow style - the arrow style """ which = 'arro' want = 'arro' + class dash_style(aetools.NProperty): + """dash style - the dash style """ + which = 'pdst' + want = 'tdas' + class end_point(aetools.NProperty): + """end point - the ending point of the line """ + which = 'pend' + want = 'QDpt' + class start_point(aetools.NProperty): + """start point - the starting point of the line """ + which = 'pstp' + want = 'QDpt' graphic_lines = graphic_line *************** *** 247,260 **** 'background_pattern' : background_pattern, 'color_table' : color_table, - 'ordering' : ordering, - 'name' : name, - 'default_location' : default_location, - 'pixel_depth' : pixel_depth, - 'writing_code' : writing_code, - 'text_color' : text_color, 'default_font' : default_font, 'default_size' : default_size, 'style' : style, 'update_on_change' : update_on_change, } drawing_area._privelemdict = { --- 247,260 ---- 'background_pattern' : background_pattern, 'color_table' : color_table, 'default_font' : default_font, + 'default_location' : default_location, 'default_size' : default_size, + 'name' : name, + 'ordering' : ordering, + 'pixel_depth' : pixel_depth, 'style' : style, + 'text_color' : text_color, 'update_on_change' : update_on_change, + 'writing_code' : writing_code, } drawing_area._privelemdict = { *************** *** 267,274 **** graphic_line._superclassnames = [] graphic_line._privpropdict = { - 'start_point' : start_point, - 'end_point' : end_point, - 'dash_style' : dash_style, 'arrow_style' : arrow_style, } graphic_line._privelemdict = { --- 267,274 ---- graphic_line._superclassnames = [] graphic_line._privpropdict = { 'arrow_style' : arrow_style, + 'dash_style' : dash_style, + 'end_point' : end_point, + 'start_point' : start_point, } graphic_line._privelemdict = { *************** *** 357,410 **** # _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, } --- 357,410 ---- # _classdeclarations = { ! 'carc' : arc, 'cdrw' : drawing_area, + 'cgob' : graphic_object, + 'cgsh' : graphic_shape, + 'cgtx' : graphic_text, + 'covl' : oval, 'cpgn' : polygon, ! 'cpic' : graphic_group, 'cpix' : pixel_map, + 'cpxl' : pixel, 'crec' : rectangle, + 'crrc' : rounded_rectangle, + 'glin' : graphic_line, } _propdeclarations = { ! 'arro' : arrow_style, ! 'cltb' : color_table, 'colr' : color, + 'flcl' : fill_color, 'flpt' : fill_pattern, 'font' : font, ! 'gobs' : ordering, 'pang' : start_angle, ! 'parc' : arc_angle, ! 'pbcl' : background_color, ! 'pbnd' : bounds, ! 'pbpt' : background_pattern, ! 'pchd' : corner_curve_height, ! 'pcwd' : corner_curve_width, ! 'pdpt' : pixel_depth, ! 'pdrt' : definition_rect, ! 'pdst' : dash_style, ! 'pend' : end_point, ! 'pnam' : name, ! 'pnel' : default_location, 'ppcl' : pen_color, ! 'pppa' : pen_pattern, ! 'pptm' : transfer_mode, 'ppwd' : pen_width, 'psct' : writing_code, ! 'pstp' : start_point, 'ptlt' : point_list, ! 'ptps' : default_size, 'ptsz' : size, + 'ptxc' : text_color, + 'ptxf' : default_font, 'pupd' : update_on_change, ! 'txst' : style, ! 'ustl' : uniform_styles, } Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuickDraw_Graphics_Suppleme.py 23 Mar 2003 22:07:28 -0000 1.2 --- QuickDraw_Graphics_Suppleme.py 28 Mar 2003 23:37:59 -0000 1.3 *************** *** 57,68 **** # _classdeclarations = { - 'cpic' : graphic_group, 'cdrw' : drawing_area, } _propdeclarations = { 'prot' : rotation, - 'ptrs' : translation, 'pscl' : scale, } --- 57,68 ---- # _classdeclarations = { 'cdrw' : drawing_area, + 'cpic' : graphic_group, } _propdeclarations = { 'prot' : rotation, 'pscl' : scale, + 'ptrs' : translation, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:21 -0000 1.3 --- Standard_Suite.py 28 Mar 2003 23:37:59 -0000 1.4 *************** *** 458,477 **** """application - An application program """ want = 'capp' ! class name(aetools.NProperty): ! """name - the name of the application """ ! which = 'pnam' ! want = 'itxt' class frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' class selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' - class clipboard(aetools.NProperty): - """clipboard - the contents of the clipboard for this application """ - which = 'pcli' - want = '****' class version(aetools.NProperty): """version - the version of the application """ --- 458,477 ---- """application - An application program """ want = 'capp' ! class clipboard(aetools.NProperty): ! """clipboard - the contents of the clipboard for this application """ ! which = 'pcli' ! want = '****' class frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' + class name(aetools.NProperty): + """name - the name of the application """ + which = 'pnam' + want = 'itxt' class selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' class version(aetools.NProperty): """version - the version of the application """ *************** *** 526,532 **** which = 'hclb' want = 'bool' ! class titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' want = 'bool' class index(aetools.NProperty): --- 526,532 ---- which = 'hclb' want = 'bool' ! class floating(aetools.NProperty): ! """floating - Does the window float? """ ! which = 'isfl' want = 'bool' class index(aetools.NProperty): *************** *** 534,541 **** which = 'pidx' want = 'long' - class floating(aetools.NProperty): - """floating - Does the window float? """ - which = 'isfl' - want = 'bool' class modal(aetools.NProperty): """modal - Is the window modal? """ --- 534,537 ---- *************** *** 546,549 **** --- 542,553 ---- which = 'prsz' want = 'bool' + class titled(aetools.NProperty): + """titled - Does the window have a title bar? """ + which = 'ptit' + want = 'bool' + class visible(aetools.NProperty): + """visible - Is the window visible? """ + which = 'pvis' + want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 554,561 **** which = 'pzum' want = 'bool' - class visible(aetools.NProperty): - """visible - Is the window visible? """ - which = 'pvis' - want = 'bool' windows = window --- 558,561 ---- *************** *** 567,574 **** application._superclassnames = [] application._privpropdict = { ! 'name' : name, 'frontmost' : frontmost, 'selection' : selection, - 'clipboard' : clipboard, 'version' : version, } --- 567,574 ---- application._superclassnames = [] application._privpropdict = { ! 'clipboard' : clipboard, 'frontmost' : frontmost, + 'name' : name, 'selection' : selection, 'version' : version, } *************** *** 602,613 **** 'bounds' : bounds, 'closeable' : closeable, - 'titled' : titled, - 'index' : index, 'floating' : floating, 'modal' : modal, 'resizable' : resizable, 'zoomable' : zoomable, 'zoomed' : zoomed, - 'visible' : visible, } window._privelemdict = { --- 602,613 ---- 'bounds' : bounds, 'closeable' : closeable, 'floating' : floating, + 'index' : index, 'modal' : modal, 'resizable' : resizable, + 'titled' : titled, + 'visible' : visible, 'zoomable' : zoomable, 'zoomed' : zoomed, } window._privelemdict = { *************** *** 664,711 **** # _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, } --- 664,711 ---- # _classdeclarations = { 'alis' : alias, 'capp' : application, 'cins' : insertion_point, + 'csel' : selection_2d_object, + 'cwin' : window, 'docu' : document, + 'file' : file, } _propdeclarations = { ! 'hclb' : closeable, 'imod' : modified, 'isfl' : floating, 'iszm' : zoomable, ! 'pbnd' : bounds, 'pcli' : clipboard, 'pcnt' : contents, + 'pidx' : index, + 'pisf' : frontmost, + 'pmod' : modal, 'pnam' : name, ! 'prsz' : resizable, ! 'pspd' : stationery, 'ptit' : titled, + 'pvis' : visible, + 'pzum' : zoomed, + 'sele' : selection, + 'vers' : version, } _compdeclarations = { '< ' : _3c_, '<= ' : _b2_, '= ' : _3d_, '> ' : _3e_, + '>= ' : _b3_, + 'bgwt' : starts_with, + 'cont' : contains, + 'ends' : ends_with, } _enumdeclarations = { + 'kfrm' : _Enum_kfrm, 'savo' : _Enum_savo, 'styl' : _Enum_styl, } Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Table_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Table_Suite.py 28 Mar 2003 23:38:00 -0000 1.3 *************** *** 87,97 **** 'ccel' : cell, 'ccol' : column, - 'ctbl' : table, 'crow' : row, } _propdeclarations = { - 'pnam' : name, 'pfor' : formula, 'ppro' : protection, } --- 87,97 ---- 'ccel' : cell, 'ccol' : column, 'crow' : row, + 'ctbl' : table, } _propdeclarations = { 'pfor' : formula, + 'pnam' : name, 'ppro' : protection, } Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Text_Suite.py 23 Mar 2003 22:07:28 -0000 1.2 --- Text_Suite.py 28 Mar 2003 23:38:00 -0000 1.3 *************** *** 55,62 **** which = 'ptsz' want = 'fixd' - class writing_code(aetools.NProperty): - """writing code - the script system and language """ - which = 'psct' - want = 'intl' class style(aetools.NProperty): """style - the text style of the first character of the first character """ --- 55,58 ---- *************** *** 67,70 **** --- 63,70 ---- which = 'ustl' want = 'tsty' + class writing_code(aetools.NProperty): + """writing code - the script system and language """ + which = 'psct' + want = 'intl' # element 'cha ' as ['indx'] # element 'clin' as ['indx'] *************** *** 86,97 **** """text style info - On and Off styles of text run """ want = 'tsty' - class on_styles(aetools.NProperty): - """on styles - the styles that are on for the text """ - which = 'onst' - want = 'styl' class off_styles(aetools.NProperty): """off styles - the styles that are off for the text """ which = 'ofst' want = 'styl' text_style_infos = text_style_info --- 86,97 ---- """text style info - On and Off styles of text run """ want = 'tsty' class off_styles(aetools.NProperty): """off styles - the styles that are off for the text """ which = 'ofst' want = 'styl' + class on_styles(aetools.NProperty): + """on styles - the styles that are on for the text """ + which = 'onst' + want = 'styl' text_style_infos = text_style_info *************** *** 126,132 **** 'font' : font, 'size' : size, - 'writing_code' : writing_code, 'style' : style, 'uniform_styles' : uniform_styles, } text._privelemdict = { --- 126,132 ---- 'font' : font, 'size' : size, 'style' : style, 'uniform_styles' : uniform_styles, + 'writing_code' : writing_code, } text._privelemdict = { *************** *** 146,151 **** text_style_info._superclassnames = [] text_style_info._privpropdict = { - 'on_styles' : on_styles, 'off_styles' : off_styles, } text_style_info._privelemdict = { --- 146,151 ---- text_style_info._superclassnames = [] text_style_info._privpropdict = { 'off_styles' : off_styles, + 'on_styles' : on_styles, } text_style_info._privelemdict = { *************** *** 187,211 **** # _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, } --- 187,211 ---- # _classdeclarations = { 'cflo' : text_flow, ! 'cha ' : character, 'clin' : line, ! 'cpar' : paragraph, 'ctxt' : text, + 'cwor' : word, + 'tsty' : text_style_info, } _propdeclarations = { ! 'c@#^' : _3c_inheritance_3e_, ! 'colr' : color, ! 'font' : font, 'ofst' : off_styles, + 'onst' : on_styles, 'pjst' : justification, ! 'pnam' : name, 'psct' : writing_code, + 'ptsz' : size, + 'txst' : style, 'ustl' : uniform_styles, } *************** *** 214,218 **** _enumdeclarations = { - 'styl' : _Enum_styl, 'just' : _Enum_just, } --- 214,218 ---- _enumdeclarations = { 'just' : _Enum_just, + 'styl' : _Enum_styl, } Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Type_Names_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 --- Type_Names_Suite.py 28 Mar 2003 23:38:00 -0000 1.4 *************** *** 389,432 **** # _classdeclarations = { - 'shor' : small_integer, - 'tr16' : RGB16_color, - 'vers' : version, - 'aeut' : system_dictionary, - 'clrt' : color_table, - 'fpnt' : fixed_point, - 'TIFF' : TIFF_picture, - '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, 'TEXT' : plain_text, ! 'magn' : unsigned_integer, 'cmnu' : menu, ! 'frct' : fixed_rectangle, ! 'pinf' : type_property_info, ! 'lfrc' : long_fixed_rectangle, 'evin' : type_event_info, ! 'sing' : small_real, ! 'suin' : type_suite_info, ! 'trot' : rotation, 'fixd' : fixed, ! 'styl' : scrap_styles, ! 'lpnt' : long_point, 'gcli' : type_class_info, ! 'tr96' : RGB96_color, ! 'tdas' : dash_style, ! 'exte' : extended_real, ! 'pmin' : type_parameter_info, 'lfpt' : long_fixed_point, ! 'lrct' : long_rectangle, ! 'qdrt' : bounding_rectangle, ! 'comp' : double_integer, 'lfxd' : long_fixed, 'null' : null, 'targ' : target_id, } --- 389,432 ---- # _classdeclarations = { 'EPS ' : PostScript_picture, 'QDpt' : point, 'TEXT' : plain_text, ! 'TIFF' : TIFF_picture, ! 'aete' : application_dictionary, ! 'aeut' : system_dictionary, ! 'clrt' : color_table, ! 'cmen' : menu_item, 'cmnu' : menu, ! 'comp' : double_integer, ! 'elin' : type_element_info, 'evin' : type_event_info, ! 'exte' : extended_real, 'fixd' : fixed, ! 'fpnt' : fixed_point, ! 'frct' : fixed_rectangle, 'gcli' : type_class_info, ! 'insl' : location_reference, 'lfpt' : long_fixed_point, ! 'lfrc' : long_fixed_rectangle, 'lfxd' : long_fixed, + 'lpnt' : long_point, + 'lrct' : long_rectangle, + 'mLoc' : machine_location, + 'magn' : unsigned_integer, 'null' : null, + 'pinf' : type_property_info, + 'pmin' : type_parameter_info, + 'qdrt' : bounding_rectangle, + 'shor' : small_integer, + 'sing' : small_real, + 'styl' : scrap_styles, + 'suin' : type_suite_info, 'targ' : target_id, + 'tdas' : dash_style, + 'tpmm' : pixel_map_record, + 'tr16' : RGB16_color, + 'tr96' : RGB96_color, + 'trot' : rotation, + 'vers' : version, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 28 Mar 2003 22:07:21 -0000 1.3 --- __init__.py 28 Mar 2003 23:38:00 -0000 1.4 *************** *** 69,119 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(selection_2d_object) - getbaseclasses(alias) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) - getbaseclasses(small_integer) - getbaseclasses(RGB16_color) - getbaseclasses(version) - getbaseclasses(system_dictionary) - getbaseclasses(color_table) - getbaseclasses(fixed_point) - getbaseclasses(plain_text) - getbaseclasses(type_element_info) - getbaseclasses(location_reference) - getbaseclasses(machine_location) - getbaseclasses(PostScript_picture) - getbaseclasses(point) - getbaseclasses(menu_item) - getbaseclasses(pixel_map_record) - getbaseclasses(application_dictionary) - getbaseclasses(unsigned_integer) - getbaseclasses(menu) - getbaseclasses(fixed_rectangle) - getbaseclasses(long_fixed_rectangle) - getbaseclasses(type_event_info) - getbaseclasses(small_real) - getbaseclasses(type_suite_info) - getbaseclasses(rotation) - getbaseclasses(type_parameter_info) - getbaseclasses(fixed) - getbaseclasses(scrap_styles) - getbaseclasses(long_point) - getbaseclasses(type_class_info) - getbaseclasses(TIFF_picture) - getbaseclasses(RGB96_color) - getbaseclasses(dash_style) - getbaseclasses(extended_real) - getbaseclasses(type_property_info) - getbaseclasses(long_fixed_point) - getbaseclasses(long_rectangle) - getbaseclasses(bounding_rectangle) - getbaseclasses(double_integer) - getbaseclasses(long_fixed) - getbaseclasses(null) - getbaseclasses(target_id) getbaseclasses(paragraph) getbaseclasses(character) --- 69,72 ---- *************** *** 259,262 **** --- 212,262 ---- getbaseclasses(file_specification) getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(selection_2d_object) + getbaseclasses(alias) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(small_integer) + getbaseclasses(RGB16_color) + getbaseclasses(version) + getbaseclasses(system_dictionary) + getbaseclasses(color_table) + getbaseclasses(fixed_point) + getbaseclasses(plain_text) + getbaseclasses(type_element_info) + getbaseclasses(location_reference) + getbaseclasses(machine_location) + getbaseclasses(PostScript_picture) + getbaseclasses(point) + getbaseclasses(menu_item) + getbaseclasses(pixel_map_record) + getbaseclasses(application_dictionary) + getbaseclasses(unsigned_integer) + getbaseclasses(menu) + getbaseclasses(fixed_rectangle) + getbaseclasses(long_fixed_rectangle) + getbaseclasses(type_event_info) + getbaseclasses(small_real) + getbaseclasses(type_suite_info) + getbaseclasses(rotation) + getbaseclasses(type_parameter_info) + getbaseclasses(fixed) + getbaseclasses(scrap_styles) + getbaseclasses(long_point) + getbaseclasses(type_class_info) + getbaseclasses(TIFF_picture) + getbaseclasses(RGB96_color) + getbaseclasses(dash_style) + getbaseclasses(extended_real) + getbaseclasses(type_property_info) + getbaseclasses(long_fixed_point) + getbaseclasses(long_rectangle) + getbaseclasses(bounding_rectangle) + getbaseclasses(double_integer) + getbaseclasses(long_fixed) + getbaseclasses(null) + getbaseclasses(target_id) # *************** *** 264,314 **** # _classdeclarations = { - 'cwin' : window, - 'file' : file, - 'csel' : selection_2d_object, - 'alis' : alias, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, - '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, 'cpar' : paragraph, 'cha ' : character, --- 264,267 ---- *************** *** 454,457 **** --- 407,457 ---- 'fss ' : file_specification, 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'csel' : selection_2d_object, + 'alis' : alias, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + '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, } From jackjansen@users.sourceforge.net Fri Mar 28 23:38:28 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:38:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.3,1.4 Metrowerks_Shell_Suite.py,1.3,1.4 Standard_Suite.py,1.2,1.3 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv26251/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Standard_Suite.py __init__.py Log Message: Sigh: didn't catch all lists that needed to be sorted. Regenerated again. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CodeWarrior_suite.py 28 Mar 2003 22:07:15 -0000 1.3 --- CodeWarrior_suite.py 28 Mar 2003 23:37:55 -0000 1.4 *************** *** 329,340 **** """subtarget - a target that is prerequisite for another target """ want = 'SBTG' - class target(aetools.NProperty): - """target - the target that is dependent on this subtarget """ - which = 'TrgT' - want = 'TRGT' class link_against_output(aetools.NProperty): """link against output - is the output of this subtarget linked into its dependent target? """ which = 'LNKO' want = 'bool' subtargets = subtarget --- 329,340 ---- """subtarget - a target that is prerequisite for another target """ want = 'SBTG' class link_against_output(aetools.NProperty): """link against output - is the output of this subtarget linked into its dependent target? """ which = 'LNKO' want = 'bool' + class target(aetools.NProperty): + """target - the target that is dependent on this subtarget """ + which = 'TrgT' + want = 'TRGT' subtargets = subtarget *************** *** 357,402 **** which = 'PrjD' want = 'PRJD' - # element 'SRCF' as ['indx', 'test', 'rang'] # element 'SBTG' as ['indx', 'test', 'rang'] class target_file(aetools.ComponentItem): """target file - a source or header file in a target """ want = 'SRCF' ! class id(aetools.NProperty): ! """id - the unique ID number of the target file """ ! which = 'ID ' ! want = 'long' ! class type(aetools.NProperty): ! """type - the type of source file """ ! which = 'FTYP' ! want = 'FTYP' ! class location(aetools.NProperty): ! """location - the location of the target file on disk """ ! which = 'FILE' ! want = 'fss ' ! class path(aetools.NProperty): ! """path - the path of the source file on disk """ ! which = 'Path' ! want = 'itxt' ! class linked(aetools.NProperty): ! """linked - is the source file in the link order of its target? """ ! which = 'LINK' ! want = 'bool' ! class link_index(aetools.NProperty): ! """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ ! which = 'LIDX' want = 'long' - class modified_date(aetools.NProperty): - """modified date - the date and time this source file was last modified """ - which = 'MODD' - want = 'ldt ' class compiled_date(aetools.NProperty): """compiled date - the date and this source file was last compiled """ which = 'CMPD' want = 'ldt ' - class code_size(aetools.NProperty): - """code size - the size of the code (in bytes) produced by compiling this source file """ - which = 'CSZE' - want = 'long' class data_size(aetools.NProperty): """data size - the size of the date (in bytes) produced by compiling this source file """ --- 357,374 ---- which = 'PrjD' want = 'PRJD' # element 'SBTG' as ['indx', 'test', 'rang'] + # element 'SRCF' as ['indx', 'test', 'rang'] class target_file(aetools.ComponentItem): """target file - a source or header file in a target """ want = 'SRCF' ! class code_size(aetools.NProperty): ! """code size - the size of the code (in bytes) produced by compiling this source file """ ! which = 'CSZE' want = 'long' class compiled_date(aetools.NProperty): """compiled date - the date and this source file was last compiled """ which = 'CMPD' want = 'ldt ' class data_size(aetools.NProperty): """data size - the size of the date (in bytes) produced by compiling this source file """ *************** *** 407,430 **** which = 'DBUG' want = 'bool' ! class weak_link(aetools.NProperty): ! """weak link - is this shared library linked weakly? """ ! which = 'WEAK' ! want = 'bool' class init_before(aetools.NProperty): """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' class merge_output(aetools.NProperty): """merge output - is this shared library merged into another code fragment? """ which = 'MRGE' want = 'bool' class prerequisites(aetools.NProperty): """prerequisites - the source files needed to build this source file """ which = 'PRER' want = 'list' ! class dependents(aetools.NProperty): ! """dependents - the source files that need this source file in order to build """ ! which = 'DPND' ! want = 'list' target_files = target_file --- 379,430 ---- which = 'DBUG' want = 'bool' ! class dependents(aetools.NProperty): ! """dependents - the source files that need this source file in order to build """ ! which = 'DPND' ! want = 'list' ! class id(aetools.NProperty): ! """id - the unique ID number of the target file """ ! which = 'ID ' ! want = 'long' class init_before(aetools.NProperty): """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' + class link_index(aetools.NProperty): + """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ + which = 'LIDX' + want = 'long' + class linked(aetools.NProperty): + """linked - is the source file in the link order of its target? """ + which = 'LINK' + want = 'bool' + class location(aetools.NProperty): + """location - the location of the target file on disk """ + which = 'FILE' + want = 'fss ' class merge_output(aetools.NProperty): """merge output - is this shared library merged into another code fragment? """ which = 'MRGE' want = 'bool' + class modified_date(aetools.NProperty): + """modified date - the date and time this source file was last modified """ + which = 'MODD' + want = 'ldt ' + class path(aetools.NProperty): + """path - the path of the source file on disk """ + which = 'Path' + want = 'itxt' class prerequisites(aetools.NProperty): """prerequisites - the source files needed to build this source file """ which = 'PRER' want = 'list' ! class type(aetools.NProperty): ! """type - the type of source file """ ! which = 'FTYP' ! want = 'FTYP' ! class weak_link(aetools.NProperty): ! """weak link - is this shared library linked weakly? """ ! which = 'WEAK' ! want = 'bool' target_files = target_file *************** *** 499,504 **** project_document._superclassnames = ['document'] project_document._privpropdict = { - 'inherits' : inherits, 'current_target' : current_target, } project_document._privelemdict = { --- 499,504 ---- project_document._superclassnames = ['document'] project_document._privpropdict = { 'current_target' : current_target, + 'inherits' : inherits, } project_document._privelemdict = { *************** *** 525,530 **** subtarget._privpropdict = { 'inherits' : inherits, - 'target' : target, 'link_against_output' : link_against_output, } subtarget._privelemdict = { --- 525,530 ---- subtarget._privpropdict = { 'inherits' : inherits, 'link_against_output' : link_against_output, + 'target' : target, } subtarget._privelemdict = { *************** *** 542,566 **** } target._privelemdict = { - 'target_file' : target_file, 'subtarget' : subtarget, } target_file._superclassnames = [] target_file._privpropdict = { - 'id' : id, - 'type' : type, - 'location' : location, - 'path' : path, - 'linked' : linked, - 'link_index' : link_index, - 'modified_date' : modified_date, - 'compiled_date' : compiled_date, 'code_size' : code_size, 'data_size' : data_size, 'debug' : debug, ! 'weak_link' : weak_link, 'init_before' : init_before, 'merge_output' : merge_output, 'prerequisites' : prerequisites, ! 'dependents' : dependents, } target_file._privelemdict = { --- 542,566 ---- } target._privelemdict = { 'subtarget' : subtarget, + 'target_file' : target_file, } target_file._superclassnames = [] target_file._privpropdict = { 'code_size' : code_size, + 'compiled_date' : compiled_date, 'data_size' : data_size, 'debug' : debug, ! 'dependents' : dependents, ! 'id' : id, 'init_before' : init_before, + 'link_index' : link_index, + 'linked' : linked, + 'location' : location, 'merge_output' : merge_output, + 'modified_date' : modified_date, + 'path' : path, 'prerequisites' : prerequisites, ! 'type' : type, ! 'weak_link' : weak_link, } target_file._privelemdict = { *************** *** 625,671 **** _classdeclarations = { '1BRW' : single_class_browser, ! 'PRJD' : project_document, ! 'SYMB' : symbol_browser, ! 'EDIT' : editor_document, 'COMP' : file_compare_document, - 'TOOL' : ToolServer_worksheet, - 'SBTG' : subtarget, - 'MSSG' : message_document, - 'INSP' : project_inspector, - 'TXTD' : text_document, 'CTLG' : catalog_document, 'HIER' : class_hierarchies, ! 'TRGT' : target, 'PRGS' : build_progress_document, 'SRCF' : target_file, ! 'BROW' : class_browser, ! '1HIR' : single_class_hierarchies, } _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, } --- 625,671 ---- _classdeclarations = { '1BRW' : single_class_browser, ! '1HIR' : single_class_hierarchies, ! 'BROW' : class_browser, 'COMP' : file_compare_document, 'CTLG' : catalog_document, + 'EDIT' : editor_document, 'HIER' : class_hierarchies, ! 'INSP' : project_inspector, ! 'MSSG' : message_document, 'PRGS' : build_progress_document, + 'PRJD' : project_document, + 'SBTG' : subtarget, 'SRCF' : target_file, ! 'SYMB' : symbol_browser, ! 'TOOL' : ToolServer_worksheet, ! 'TRGT' : target, ! 'TXTD' : text_document, } _propdeclarations = { + 'CMPD' : compiled_date, + 'CSZE' : code_size, 'CURT' : current_target, ! 'DBUG' : debug, 'DPND' : dependents, ! 'DSZE' : data_size, ! 'FILE' : location, ! 'FTYP' : type, 'ID ' : id, ! 'INIT' : init_before, 'LIDX' : link_index, ! 'LINK' : linked, 'LNKO' : link_against_output, 'MODD' : modified_date, ! 'MRGE' : merge_output, ! 'PRER' : prerequisites, ! 'Path' : path, ! 'PrjD' : project_document, 'TrgT' : target, + 'WEAK' : weak_link, + 'c@#^' : inherits, + 'imod' : modified, 'pnam' : name, ! 'sele' : selection, } *************** *** 674,680 **** _enumdeclarations = { - 'Inte' : _Enum_Inte, 'DKND' : _Enum_DKND, 'FTYP' : _Enum_FTYP, 'PERM' : _Enum_PERM, } --- 674,680 ---- _enumdeclarations = { 'DKND' : _Enum_DKND, 'FTYP' : _Enum_FTYP, + 'Inte' : _Enum_Inte, 'PERM' : _Enum_PERM, } Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Metrowerks_Shell_Suite.py 28 Mar 2003 22:07:16 -0000 1.3 --- Metrowerks_Shell_Suite.py 28 Mar 2003 23:37:55 -0000 1.4 *************** *** 794,805 **** """Access Paths - Contains the definitions of a project\xd5s access (search) paths. """ want = 'PATH' - class User_Paths(aetools.NProperty): - """User Paths - To add an access path for the source files. """ - which = 'PA01' - want = 'PInf' - class System_Paths(aetools.NProperty): - """System Paths - To add an access path for the include files. (Not supported in Pascal) """ - which = 'PA03' - want = 'PInf' [...2186 lines suppressed...] --- 2355,2373 ---- _enumdeclarations = { 'Acce' : _Enum_Acce, ! 'BXbr' : _Enum_BXbr, 'DbSA' : _Enum_DbSA, ! 'DgBL' : _Enum_DgBL, 'ErrT' : _Enum_ErrT, ! 'Inte' : _Enum_Inte, ! 'Lang' : _Enum_Lang, 'PPrm' : _Enum_PPrm, + 'PXdg' : _Enum_PXdg, + 'PthF' : _Enum_PthF, + 'RefP' : _Enum_RefP, + 'STKd' : _Enum_STKd, + 'SrcT' : _Enum_SrcT, + 'TmpB' : _Enum_TmpB, + 'TxtF' : _Enum_TxtF, + 'savo' : _Enum_savo, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Standard_Suite.py 28 Mar 2003 23:37:55 -0000 1.3 *************** *** 180,221 **** which = 'inte' want = 'Inte' - # element 'docu' as ['indx', 'name', 'rang'] # element 'cwin' as ['indx', 'name', 'rang'] class character(aetools.ComponentItem): """character - a character """ want = 'cha ' - class offset(aetools.NProperty): - """offset - offset of a text object from the beginning of the document (first char has offset 1) """ - which = 'pOff' - want = 'long' class length(aetools.NProperty): """length - length in characters of this object """ which = 'pLen' want = 'long' class document(aetools.ComponentItem): """document - a document """ want = 'docu' ! class name(aetools.NProperty): ! """name - the title of the document """ ! which = 'pnam' ! want = 'itxt' ! class kind(aetools.NProperty): ! """kind - the kind of document """ ! which = 'DKND' ! want = 'DKND' class index(aetools.NProperty): """index - the number of the document """ which = 'pidx' want = 'long' class location(aetools.NProperty): """location - the file of the document """ which = 'FILE' want = 'fss ' ! class file_permissions(aetools.NProperty): ! """file permissions - the file permissions for the document """ ! which = 'PERM' ! want = 'PERM' class window(aetools.NProperty): """window - the window of the document. """ --- 180,221 ---- which = 'inte' want = 'Inte' # element 'cwin' as ['indx', 'name', 'rang'] + # element 'docu' as ['indx', 'name', 'rang'] class character(aetools.ComponentItem): """character - a character """ want = 'cha ' class length(aetools.NProperty): """length - length in characters of this object """ which = 'pLen' want = 'long' + class offset(aetools.NProperty): + """offset - offset of a text object from the beginning of the document (first char has offset 1) """ + which = 'pOff' + want = 'long' class document(aetools.ComponentItem): """document - a document """ want = 'docu' ! class file_permissions(aetools.NProperty): ! """file permissions - the file permissions for the document """ ! which = 'PERM' ! want = 'PERM' class index(aetools.NProperty): """index - the number of the document """ which = 'pidx' want = 'long' + class kind(aetools.NProperty): + """kind - the kind of document """ + which = 'DKND' + want = 'DKND' class location(aetools.NProperty): """location - the file of the document """ which = 'FILE' want = 'fss ' ! class name(aetools.NProperty): ! """name - the title of the document """ ! which = 'pnam' ! want = 'itxt' class window(aetools.NProperty): """window - the window of the document. """ *************** *** 296,301 **** character._superclassnames = [] character._privpropdict = { - 'offset' : offset, 'length' : length, } character._privelemdict = { --- 296,301 ---- character._superclassnames = [] character._privpropdict = { 'length' : length, + 'offset' : offset, } character._privelemdict = { *************** *** 303,311 **** document._superclassnames = [] document._privpropdict = { ! 'name' : name, ! 'kind' : kind, 'index' : index, 'location' : location, ! 'file_permissions' : file_permissions, 'window' : window, } --- 303,311 ---- document._superclassnames = [] document._privpropdict = { ! 'file_permissions' : file_permissions, 'index' : index, + 'kind' : kind, 'location' : location, ! 'name' : name, 'window' : window, } *************** *** 327,332 **** line._privpropdict = { 'index' : index, - 'offset' : offset, 'length' : length, } line._privelemdict = { --- 327,332 ---- line._privpropdict = { 'index' : index, 'length' : length, + 'offset' : offset, } line._privelemdict = { *************** *** 357,364 **** window._superclassnames = [] window._privpropdict = { - 'name' : name, - 'index' : index, 'bounds' : bounds, 'document' : document, 'position' : position, 'visible' : visible, --- 357,364 ---- window._superclassnames = [] window._privpropdict = { 'bounds' : bounds, 'document' : document, + 'index' : index, + 'name' : name, 'position' : position, 'visible' : visible, *************** *** 372,402 **** # _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, } --- 372,402 ---- # _classdeclarations = { + 'capp' : application, 'cha ' : character, ! 'cins' : insertion_point, 'clin' : line, 'csel' : selection_2d_object, ! 'ctxt' : text, ! 'cwin' : window, 'docu' : document, + 'file' : file, } _propdeclarations = { 'DKND' : kind, ! 'FILE' : location, 'PERM' : file_permissions, + 'cwin' : window, 'docu' : document, ! 'inte' : user_interaction, ! 'pLen' : length, 'pOff' : offset, ! 'pbnd' : bounds, ! 'pcnt' : contents, ! 'pidx' : index, 'pnam' : name, 'ppos' : position, + 'pvis' : visible, 'pzum' : zoomed, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 28 Mar 2003 22:07:17 -0000 1.3 --- __init__.py 28 Mar 2003 23:37:55 -0000 1.4 *************** *** 49,52 **** --- 49,78 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(single_class_browser) + getbaseclasses(project_document) + getbaseclasses(symbol_browser) + getbaseclasses(editor_document) + getbaseclasses(file_compare_document) + getbaseclasses(class_browser) + getbaseclasses(subtarget) + getbaseclasses(message_document) + getbaseclasses(project_inspector) + getbaseclasses(text_document) + getbaseclasses(catalog_document) + getbaseclasses(class_hierarchy) + getbaseclasses(target) + getbaseclasses(build_progress_document) + getbaseclasses(target_file) + getbaseclasses(ToolServer_worksheet) + getbaseclasses(single_class_hierarchy) getbaseclasses(File_Mapping) getbaseclasses(browser_catalog) *************** *** 85,114 **** getbaseclasses(Debugger_Display) getbaseclasses(class_) - getbaseclasses(character) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) - getbaseclasses(single_class_browser) - getbaseclasses(project_document) - getbaseclasses(symbol_browser) - getbaseclasses(editor_document) - getbaseclasses(file_compare_document) - getbaseclasses(class_browser) - getbaseclasses(subtarget) - getbaseclasses(message_document) - getbaseclasses(project_inspector) - getbaseclasses(text_document) - getbaseclasses(catalog_document) - getbaseclasses(class_hierarchy) - getbaseclasses(target) - getbaseclasses(build_progress_document) - getbaseclasses(target_file) - getbaseclasses(ToolServer_worksheet) - getbaseclasses(single_class_hierarchy) # --- 111,114 ---- *************** *** 116,119 **** --- 116,145 ---- # _classdeclarations = { + 'cha ' : character, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'clin' : line, + 'csel' : selection_2d_object, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + '1BRW' : single_class_browser, + 'PRJD' : project_document, + '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, 'FMap' : File_Mapping, 'Cata' : browser_catalog, *************** *** 152,181 **** 'DbDS' : Debugger_Display, 'Clas' : class_, - 'cha ' : character, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'clin' : line, - 'csel' : selection_2d_object, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, - '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, } --- 178,181 ---- From jackjansen@users.sourceforge.net Fri Mar 28 23:38:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:38:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.3,1.4 Standard_Suite.py,1.2,1.3 Text.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv26251/Netscape Modified Files: Mozilla_suite.py Standard_Suite.py Text.py Log Message: Sigh: didn't catch all lists that needed to be sorted. Regenerated again. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mozilla_suite.py 28 Mar 2003 22:07:18 -0000 1.3 --- Mozilla_suite.py 28 Mar 2003 23:37:57 -0000 1.4 *************** *** 265,269 **** _enumdeclarations = { 'comp' : _Enum_comp, - 'ncmd' : _Enum_ncmd, 'dire' : _Enum_dire, } --- 265,269 ---- _enumdeclarations = { 'comp' : _Enum_comp, 'dire' : _Enum_dire, + 'ncmd' : _Enum_ncmd, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- Standard_Suite.py 28 Mar 2003 23:37:57 -0000 1.3 *************** *** 118,132 **** """window - A Window """ want = 'cwin' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' want = 'bool' class index(aetools.NProperty): --- 118,140 ---- """window - A Window """ want = 'cwin' + class URL(aetools.NProperty): + """URL - Current URL """ + which = 'curl' + want = 'TEXT' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' + class busy(aetools.NProperty): + """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ + which = 'busy' + want = 'long' class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' ! class floating(aetools.NProperty): ! """floating - Does the window float? """ ! which = 'isfl' want = 'bool' class index(aetools.NProperty): *************** *** 134,181 **** which = 'pidx' want = 'long' - class floating(aetools.NProperty): - """floating - Does the window float? """ - which = 'isfl' - want = 'bool' class modal(aetools.NProperty): """modal - Is the window modal? """ 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? """ - which = 'iszm' - want = 'bool' - class zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' class name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' - class visible(aetools.NProperty): - """visible - is the window visible? """ - which = 'pvis' - want = 'bool' class position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class URL(aetools.NProperty): ! """URL - Current URL """ ! which = 'curl' ! want = 'TEXT' class unique_ID(aetools.NProperty): """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' ! class busy(aetools.NProperty): ! """busy - Is window loading something right now. 2, window is busy and will reject load requests. 1, window is busy, but will interrupt outstanding loads """ ! which = 'busy' ! want = 'long' application._superclassnames = [] application._privpropdict = { --- 142,181 ---- which = 'pidx' want = 'long' class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' class name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' class position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' ! class titled(aetools.NProperty): ! """titled - Does the window have a title bar? """ ! which = 'ptit' ! want = 'bool' class unique_ID(aetools.NProperty): """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' ! class visible(aetools.NProperty): ! """visible - is the window visible? """ ! which = 'pvis' ! want = 'bool' ! class zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' ! want = 'bool' ! class zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' application._superclassnames = [] application._privpropdict = { *************** *** 188,206 **** window._superclassnames = [] window._privpropdict = { 'bounds' : bounds, 'closeable' : closeable, - 'titled' : titled, - 'index' : index, 'floating' : floating, 'modal' : modal, - 'resizable' : resizable, - 'zoomable' : zoomable, - 'zoomed' : zoomed, 'name' : name, - 'visible' : visible, 'position' : position, ! 'URL' : URL, 'unique_ID' : unique_ID, ! 'busy' : busy, } window._privelemdict = { --- 188,206 ---- window._superclassnames = [] window._privpropdict = { + 'URL' : URL, 'bounds' : bounds, + 'busy' : busy, 'closeable' : closeable, 'floating' : floating, + 'index' : index, 'modal' : modal, 'name' : name, 'position' : position, ! 'resizable' : resizable, ! 'titled' : titled, 'unique_ID' : unique_ID, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { *************** *** 211,236 **** # _classdeclarations = { - 'cwin' : window, 'capp' : application, } _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, } --- 211,236 ---- # _classdeclarations = { 'capp' : application, + 'cwin' : window, } _propdeclarations = { ! 'ALAP' : alert_application, 'KOSK' : kiosk_mode, ! 'busy' : busy, ! 'curl' : URL, 'hclb' : closeable, ! 'isfl' : floating, 'iszm' : zoomable, ! 'pbnd' : bounds, 'pidx' : index, ! 'pmod' : modal, 'pnam' : name, 'ppos' : position, ! 'prsz' : resizable, 'ptit' : titled, + 'pvis' : visible, + 'pzum' : zoomed, + 'wiid' : unique_ID, } Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Text.py 28 Mar 2003 22:07:19 -0000 1.3 --- Text.py 28 Mar 2003 23:37:57 -0000 1.4 *************** *** 20,27 **** """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ want = 'stys' - class name(aetools.NProperty): - """name - style name """ - which = 'pnam' - want = 'TEXT' class color(aetools.NProperty): """color - the color """ --- 20,23 ---- *************** *** 32,47 **** which = 'font' want = 'TEXT' class size(aetools.NProperty): """size - the size in points """ which = 'ptsz' want = 'long' - class writing_code(aetools.NProperty): - """writing code - the script system and language """ - which = 'psct' - want = 'tsty' class style(aetools.NProperty): """style - the text styles or face attributes """ which = 'txst' want = 'tsty' stylesets = styleset --- 28,47 ---- which = 'font' want = 'TEXT' + class name(aetools.NProperty): + """name - style name """ + which = 'pnam' + want = 'TEXT' class size(aetools.NProperty): """size - the size in points """ which = 'ptsz' want = 'long' class style(aetools.NProperty): """style - the text styles or face attributes """ which = 'txst' want = 'tsty' + class writing_code(aetools.NProperty): + """writing code - the script system and language """ + which = 'psct' + want = 'tsty' stylesets = styleset *************** *** 50,57 **** """text - independent text view objects """ want = 'ctxt' - class updateLevel(aetools.NProperty): - """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ - which = 'pUpL' - want = 'long' class beginning(aetools.NProperty): """beginning - Beginning of element """ --- 50,53 ---- *************** *** 70,82 **** which = 'pAft' want = 'obj ' # element 'stys' as ['indx', 'name'] styleset._superclassnames = [] styleset._privpropdict = { - 'name' : name, 'color' : color, 'font' : font, 'size' : size, - 'writing_code' : writing_code, 'style' : style, } styleset._privelemdict = { --- 66,82 ---- which = 'pAft' want = 'obj ' + class updateLevel(aetools.NProperty): + """updateLevel - updating level. Can only be incremented or decremented. Do so only in a try block -- if the level is greater than zero, visual text updating will cease. """ + which = 'pUpL' + want = 'long' # element 'stys' as ['indx', 'name'] styleset._superclassnames = [] styleset._privpropdict = { 'color' : color, 'font' : font, + 'name' : name, 'size' : size, 'style' : style, + 'writing_code' : writing_code, } styleset._privelemdict = { *************** *** 84,92 **** text._superclassnames = [] text._privpropdict = { - 'updateLevel' : updateLevel, 'beginning' : beginning, 'end' : end, 'infront' : infront, 'justbehind' : justbehind, } text._privelemdict = { --- 84,92 ---- text._superclassnames = [] text._privpropdict = { 'beginning' : beginning, 'end' : end, 'infront' : infront, 'justbehind' : justbehind, + 'updateLevel' : updateLevel, } text._privelemdict = { *************** *** 98,117 **** # _classdeclarations = { - 'stys' : styleset, 'ctxt' : text, } _propdeclarations = { - 'ptsz' : size, 'bgng' : beginning, 'colr' : color, - 'txst' : style, - 'psct' : writing_code, - 'pAft' : justbehind, - 'font' : font, 'end ' : end, 'pUpL' : updateLevel, 'pnam' : name, ! 'pBef' : infront, } --- 98,117 ---- # _classdeclarations = { 'ctxt' : text, + 'stys' : styleset, } _propdeclarations = { 'bgng' : beginning, 'colr' : color, 'end ' : end, + 'font' : font, + 'pAft' : justbehind, + 'pBef' : infront, 'pUpL' : updateLevel, 'pnam' : name, ! 'psct' : writing_code, ! 'ptsz' : size, ! 'txst' : style, } From jackjansen@users.sourceforge.net Fri Mar 28 23:38:30 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:38:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Containers_and_folders.py,1.3,1.4 Earlier_terms.py,1.3,1.4 Enumerations.py,1.3,1.4 Files_and_suitcases.py,1.3,1.4 Finder_Basics.py,1.2,1.3 Finder_items.py,1.2,1.3 Obsolete_terms.py,1.2,1.3 Process_classes.py,1.3,1.4 Type_Definitions.py,1.3,1.4 Window_classes.py,1.3,1.4 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv26251/Finder Modified Files: 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 Type_Definitions.py Window_classes.py __init__.py Log Message: Sigh: didn't catch all lists that needed to be sorted. Regenerated again. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:17 -0000 1.3 --- Containers_and_folders.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 23,30 **** which = 'c@#^' want = 'cobj' ! class selection(aetools.NProperty): ! """selection - the selection visible to the user """ ! which = 'sele' ! want = 'obj ' class entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ --- 23,30 ---- which = 'c@#^' want = 'cobj' ! class completely_expanded(aetools.NProperty): ! """completely expanded - Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ ! which = 'pexc' ! want = 'bool' class entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ *************** *** 39,71 **** which = 'pexp' want = 'bool' - class completely_expanded(aetools.NProperty): - """completely expanded - Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ - which = 'pexc' - want = 'bool' class icon_size(aetools.NProperty): ! """icon size - the size of icons displayed in the window. Can be specified as a number, or ... """ 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'] - # element 'sctr' as ['indx', 'name'] - # element 'cfol' as ['indx', 'name', 'ID '] - # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] containers = container --- 39,71 ---- which = 'pexp' want = 'bool' class icon_size(aetools.NProperty): ! """icon size - ... alternatively, you can specify the icons size as a constant """ which = 'lvis' ! want = 'isiz' ! class selection(aetools.NProperty): ! """selection - the selection visible to the user """ ! which = 'sele' ! want = 'obj ' 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 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] + # element 'sctr' as ['indx', 'name'] + # element 'sndf' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] containers = container *************** *** 82,103 **** which = 'trsh' want = 'ctrs' - # element 'cobj' as ['indx', 'name'] - # element 'ctnr' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'cdis' as ['indx', 'name'] - # element 'cfol' as ['indx', 'name', 'ID '] - # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] class disk(aetools.ComponentItem): --- 82,103 ---- which = 'trsh' want = 'ctrs' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cdis' as ['indx', 'name'] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] + # element 'sctr' as ['indx', 'name'] + # element 'sndf' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] class disk(aetools.ComponentItem): *************** *** 108,119 **** which = 'capa' want = 'long' - class free_space(aetools.NProperty): - """free space - the number of free bytes left on the disk """ - which = 'frsp' - want = 'long' class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ --- 108,119 ---- which = 'capa' want = 'long' class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' + class free_space(aetools.NProperty): + """free space - the number of free bytes left on the disk """ + which = 'frsp' + want = 'long' class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ *************** *** 124,144 **** which = 'istd' want = 'bool' - # element 'cobj' as ['indx', 'name'] - # element 'ctnr' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'cfol' as ['indx', 'name', 'ID '] - # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] disks = disk --- 124,144 ---- which = 'istd' want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] + # element 'sctr' as ['indx', 'name'] + # element 'sndf' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] disks = disk *************** *** 147,167 **** """folder - A folder """ want = 'cfol' - # element 'cobj' as ['indx', 'name'] - # element 'ctnr' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'cfol' as ['indx', 'name', 'ID '] - # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] folders = folder --- 147,167 ---- """folder - A folder """ want = 'cfol' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] + # element 'sctr' as ['indx', 'name'] + # element 'sndf' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] folders = folder *************** *** 170,185 **** """sharable container - A container that may be shared (disks and folders) """ want = 'sctr' ! class owner(aetools.NProperty): ! """owner - the user that owns the container (file sharing must be on to use this property) """ ! which = 'sown' ! want = 'itxt' class group(aetools.NProperty): """group - the user or group that has special access to the container (file sharing must be on to use this property) """ which = 'sgrp' want = 'itxt' - class owner_privileges(aetools.NProperty): - """owner privileges - the see folders/see files/make changes privileges for the owner (file sharing must be on to use this property) """ - which = 'ownr' - want = 'priv' class group_privileges(aetools.NProperty): """group privileges - the see folders/see files/make changes privileges for the group (file sharing must be on to use this property) """ --- 170,181 ---- """sharable container - A container that may be shared (disks and folders) """ want = 'sctr' ! class exported(aetools.NProperty): ! """exported - Is the container a share point or inside a share point, i.e., can the container be shared? (file sharing must be on to use this property) """ ! which = 'sexp' ! want = 'bool' class group(aetools.NProperty): """group - the user or group that has special access to the container (file sharing must be on to use this property) """ which = 'sgrp' want = 'itxt' class group_privileges(aetools.NProperty): """group privileges - the see folders/see files/make changes privileges for the group (file sharing must be on to use this property) """ *************** *** 190,208 **** which = 'gstp' want = 'priv' - class privileges_inherited(aetools.NProperty): - """privileges inherited - Are the privileges of the container always the same as the container in which it is stored? (file sharing must be on to use this property) """ - which = 'iprv' - want = 'bool' class mounted(aetools.NProperty): """mounted - Is the container mounted on another machine's desktop? (file sharing must be on to use this property) """ which = 'smou' want = 'bool' ! class exported(aetools.NProperty): ! """exported - Is the container a share point or inside a share point, i.e., can the container be shared? (file sharing must be on to use this property) """ ! which = 'sexp' ! want = 'bool' ! class shared(aetools.NProperty): ! """shared - Is the container a share point, i.e., is the container currently being shared? (file sharing must be on to use this property) """ ! which = 'shar' want = 'bool' class protected(aetools.NProperty): --- 186,204 ---- which = 'gstp' want = 'priv' class mounted(aetools.NProperty): """mounted - Is the container mounted on another machine's desktop? (file sharing must be on to use this property) """ which = 'smou' want = 'bool' ! class owner(aetools.NProperty): ! """owner - the user that owns the container (file sharing must be on to use this property) """ ! which = 'sown' ! want = 'itxt' ! class owner_privileges(aetools.NProperty): ! """owner privileges - the see folders/see files/make changes privileges for the owner (file sharing must be on to use this property) """ ! which = 'ownr' ! want = 'priv' ! class privileges_inherited(aetools.NProperty): ! """privileges inherited - Are the privileges of the container always the same as the container in which it is stored? (file sharing must be on to use this property) """ ! which = 'iprv' want = 'bool' class protected(aetools.NProperty): *************** *** 210,230 **** which = 'spro' want = 'bool' ! # element 'cobj' as ['indx', 'name'] ! # element 'ctnr' as ['indx', 'name'] ! # element 'sctr' as ['indx', 'name'] ! # element 'cfol' as ['indx', 'name', 'ID '] ! # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] sharable_containers = sharable_container --- 206,230 ---- which = 'spro' want = 'bool' ! class shared(aetools.NProperty): ! """shared - Is the container a share point, i.e., is the container currently being shared? (file sharing must be on to use this property) """ ! which = 'shar' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] + # element 'sctr' as ['indx', 'name'] + # element 'sndf' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] sharable_containers = sharable_container *************** *** 233,239 **** """sharing privileges - A set of sharing properties (used in sharable containers) """ want = 'priv' ! class see_folders(aetools.NProperty): ! """see folders - Can folders be seen? """ ! which = 'prvs' want = 'bool' class see_files(aetools.NProperty): --- 233,239 ---- """sharing privileges - A set of sharing properties (used in sharable containers) """ want = 'priv' ! class make_changes(aetools.NProperty): ! """make changes - Can changes be made? """ ! which = 'prvw' want = 'bool' class see_files(aetools.NProperty): *************** *** 241,247 **** which = 'prvr' want = 'bool' ! class make_changes(aetools.NProperty): ! """make changes - Can changes be made? """ ! which = 'prvw' want = 'bool' --- 241,247 ---- which = 'prvr' want = 'bool' ! class see_folders(aetools.NProperty): ! """see folders - Can folders be seen? """ ! which = 'prvs' want = 'bool' *************** *** 253,273 **** which = 'warn' want = 'bool' - # element 'cobj' as ['indx', 'name'] - # element 'ctnr' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'cfol' as ['indx', 'name', 'ID '] - # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] import Earlier_terms container._superclassnames = ['item'] --- 253,273 ---- which = 'warn' want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] + # element 'sctr' as ['indx', 'name'] + # element 'sndf' as ['indx', 'name'] # element 'stcs' as ['indx', 'name'] import Earlier_terms container._superclassnames = ['item'] *************** *** 275,305 **** container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'selection' : selection, 'entire_contents' : entire_contents, 'expandable' : expandable, 'expanded' : expanded, - 'completely_expanded' : completely_expanded, 'icon_size' : icon_size, 'icon_size' : icon_size, 'view_options_window' : view_options_window, } container._privelemdict = { ! 'item' : Earlier_terms.item, ! 'container' : container, ! 'sharable_container' : sharable_container, ! 'folder' : folder, ! 'file' : Files_and_suitcases.file, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'internet_location' : Earlier_terms.internet_location, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'clipping' : Files_and_suitcases.clipping, 'package' : Files_and_suitcases.package, 'suitcase' : Files_and_suitcases.suitcase, - 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } desktop_2d_object._superclassnames = ['container'] --- 275,305 ---- container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'completely_expanded' : completely_expanded, 'entire_contents' : entire_contents, 'expandable' : expandable, 'expanded' : expanded, 'icon_size' : icon_size, 'icon_size' : icon_size, + 'selection' : selection, 'view_options_window' : view_options_window, } container._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, + 'clipping' : Files_and_suitcases.clipping, + 'container' : container, + 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : folder, 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, 'package' : Files_and_suitcases.package, + 'sharable_container' : sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, 'suitcase' : Files_and_suitcases.suitcase, } desktop_2d_object._superclassnames = ['container'] *************** *** 310,331 **** } desktop_2d_object._privelemdict = { ! 'item' : Earlier_terms.item, ! 'container' : container, ! 'sharable_container' : sharable_container, ! 'disk' : disk, ! 'folder' : folder, ! 'file' : Files_and_suitcases.file, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'internet_location' : Earlier_terms.internet_location, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'clipping' : Files_and_suitcases.clipping, 'package' : Files_and_suitcases.package, 'suitcase' : Files_and_suitcases.suitcase, - 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } disk._superclassnames = ['sharable_container'] --- 310,331 ---- } desktop_2d_object._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, + 'clipping' : Files_and_suitcases.clipping, + 'container' : container, + 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, + 'disk' : disk, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : folder, 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, 'package' : Files_and_suitcases.package, + 'sharable_container' : sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, 'suitcase' : Files_and_suitcases.suitcase, } disk._superclassnames = ['sharable_container'] *************** *** 333,359 **** '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'capacity' : capacity, - 'free_space' : free_space, 'ejectable' : ejectable, 'local_volume' : local_volume, 'startup' : startup, } disk._privelemdict = { ! 'item' : Earlier_terms.item, ! 'container' : container, ! 'sharable_container' : sharable_container, ! 'folder' : folder, ! 'file' : Files_and_suitcases.file, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'internet_location' : Earlier_terms.internet_location, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'clipping' : Files_and_suitcases.clipping, 'package' : Files_and_suitcases.package, 'suitcase' : Files_and_suitcases.suitcase, - 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } folder._superclassnames = ['sharable_container'] --- 333,359 ---- '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'capacity' : capacity, 'ejectable' : ejectable, + 'free_space' : free_space, 'local_volume' : local_volume, 'startup' : startup, } disk._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, + 'clipping' : Files_and_suitcases.clipping, + 'container' : container, + 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : folder, 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, 'package' : Files_and_suitcases.package, + 'sharable_container' : sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, 'suitcase' : Files_and_suitcases.suitcase, } folder._superclassnames = ['sharable_container'] *************** *** 362,421 **** } folder._privelemdict = { ! 'item' : Earlier_terms.item, ! 'container' : container, ! 'sharable_container' : sharable_container, ! 'folder' : folder, ! 'file' : Files_and_suitcases.file, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'internet_location' : Earlier_terms.internet_location, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'clipping' : Files_and_suitcases.clipping, 'package' : Files_and_suitcases.package, 'suitcase' : Files_and_suitcases.suitcase, - 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } sharable_container._superclassnames = ['container'] sharable_container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'owner' : owner, 'group' : group, - 'owner_privileges' : owner_privileges, 'group_privileges' : group_privileges, 'guest_privileges' : guest_privileges, - 'privileges_inherited' : privileges_inherited, 'mounted' : mounted, ! 'exported' : exported, ! 'shared' : shared, 'protected' : protected, } sharable_container._privelemdict = { ! 'item' : Earlier_terms.item, ! 'container' : container, ! 'sharable_container' : sharable_container, ! 'folder' : folder, ! 'file' : Files_and_suitcases.file, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'internet_location' : Earlier_terms.internet_location, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'clipping' : Files_and_suitcases.clipping, 'package' : Files_and_suitcases.package, 'suitcase' : Files_and_suitcases.suitcase, - 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } sharing_privileges._superclassnames = [] sharing_privileges._privpropdict = { - 'see_folders' : see_folders, - 'see_files' : see_files, 'make_changes' : make_changes, } sharing_privileges._privelemdict = { --- 362,421 ---- } folder._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, + 'clipping' : Files_and_suitcases.clipping, + 'container' : container, + 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : folder, 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, 'package' : Files_and_suitcases.package, + 'sharable_container' : sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, 'suitcase' : Files_and_suitcases.suitcase, } sharable_container._superclassnames = ['container'] sharable_container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'exported' : exported, 'group' : group, 'group_privileges' : group_privileges, 'guest_privileges' : guest_privileges, 'mounted' : mounted, ! 'owner' : owner, ! 'owner_privileges' : owner_privileges, ! 'privileges_inherited' : privileges_inherited, 'protected' : protected, + 'shared' : shared, } sharable_container._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, + 'clipping' : Files_and_suitcases.clipping, + 'container' : container, + 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : folder, 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, 'package' : Files_and_suitcases.package, + 'sharable_container' : sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, 'suitcase' : Files_and_suitcases.suitcase, } sharing_privileges._superclassnames = [] sharing_privileges._privpropdict = { 'make_changes' : make_changes, + 'see_files' : see_files, + 'see_folders' : see_folders, } sharing_privileges._privelemdict = { *************** *** 427,447 **** } trash_2d_object._privelemdict = { ! 'item' : Earlier_terms.item, ! 'container' : container, ! 'sharable_container' : sharable_container, ! 'folder' : folder, ! 'file' : Files_and_suitcases.file, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'internet_location' : Earlier_terms.internet_location, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'clipping' : Files_and_suitcases.clipping, 'package' : Files_and_suitcases.package, 'suitcase' : Files_and_suitcases.suitcase, - 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } --- 427,447 ---- } trash_2d_object._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, 'alias_file' : Files_and_suitcases.alias_file, 'application_file' : Earlier_terms.application_file, + 'clipping' : Files_and_suitcases.clipping, + 'container' : container, + 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : folder, 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, 'package' : Files_and_suitcases.package, + 'sharable_container' : sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, 'suitcase' : Files_and_suitcases.suitcase, } *************** *** 450,492 **** # _classdeclarations = { - 'ctrs' : trash_2d_object, - 'cdsk' : desktop_2d_object, - 'sctr' : sharable_container, 'cdis' : disk, ! 'ctnr' : container, 'cfol' : folder, 'priv' : sharing_privileges, } _propdeclarations = { ! 'pexp' : expanded, ! 'iprv' : privileges_inherited, ! 'gstp' : guest_privileges, 'ects' : entire_contents, ! 'lvis' : icon_size, 'gppr' : group_privileges, 'isrv' : local_volume, ! 'prvs' : see_folders, '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, - 'prvr' : see_files, - 'c@#^' : _3c_Inheritance_3e_, - 'smou' : mounted, 'sele' : selection, ! 'trsh' : trash, 'sgrp' : group, ! 'frsp' : free_space, 'spro' : protected, ! 'ownr' : owner_privileges, } --- 450,492 ---- # _classdeclarations = { 'cdis' : disk, ! 'cdsk' : desktop_2d_object, 'cfol' : folder, + 'ctnr' : container, + 'ctrs' : trash_2d_object, 'priv' : sharing_privileges, + 'sctr' : sharable_container, } _propdeclarations = { ! 'c@#^' : _3c_Inheritance_3e_, ! 'capa' : capacity, 'ects' : entire_contents, ! 'frsp' : free_space, 'gppr' : group_privileges, + 'gstp' : guest_privileges, + 'iprv' : privileges_inherited, + 'isej' : ejectable, 'isrv' : local_volume, ! 'istd' : startup, ! 'lvis' : icon_size, ! 'ownr' : owner_privileges, 'pexa' : expandable, 'pexc' : completely_expanded, ! 'pexp' : expanded, ! 'prvr' : see_files, ! 'prvs' : see_folders, 'prvw' : make_changes, 'sdsk' : startup_disk, 'sele' : selection, ! 'sexp' : exported, 'sgrp' : group, ! 'shar' : shared, ! 'smou' : mounted, ! 'sown' : owner, 'spro' : protected, ! 'trsh' : trash, ! 'vwnd' : view_options_window, ! 'warn' : warns_before_emptying, } Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:17 -0000 1.3 --- Earlier_terms.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 32,43 **** """application - The Finder """ want = 'capp' ! class properties(aetools.NProperty): ! """properties - property that allows getting and setting of multiple properties """ ! which = 'qpro' ! want = 'reco' class clipboard(aetools.NProperty): """clipboard - the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' [...1074 lines suppressed...] ! 'slbl' : show_label, ! 'smou' : mounted, ! 'sord' : sort_direction, ! 'sown' : owner, 'sprg' : spring_open_folders, + 'spro' : protected, + 'sprt' : suggested_partition_size, 'ssiz' : show_size, 'svew' : previous_list_view, ! 'svrs' : show_version, ! 'urdt' : use_relative_dates, 'usme' : use_simple_menus, ! 'uswg' : use_wide_grid, ! 'ver2' : product_version, ! 'vers' : version, 'warn' : warn_before_emptying, ! 'wshd' : collapsed, ! 'zumf' : zoomed_full_size, } Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Enumerations.py 28 Mar 2003 22:07:17 -0000 1.3 --- Enumerations.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 107,117 **** _enumdeclarations = { 'ipnl' : _Enum_ipnl, ! 'sodr' : _Enum_sodr, 'pple' : _Enum_pple, ! 'ese0' : _Enum_ese0, 'vwby' : _Enum_vwby, - 'isiz' : _Enum_isiz, - 'earr' : _Enum_earr, - 'gsen' : _Enum_gsen, } --- 107,117 ---- _enumdeclarations = { + 'earr' : _Enum_earr, + 'ese0' : _Enum_ese0, + 'gsen' : _Enum_gsen, 'ipnl' : _Enum_ipnl, ! 'isiz' : _Enum_isiz, 'pple' : _Enum_pple, ! 'sodr' : _Enum_sodr, 'vwby' : _Enum_vwby, } Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:17 -0000 1.3 --- Files_and_suitcases.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 33,48 **** """application file - An application's file on disk """ want = 'appf' - class suggested_size(aetools.NProperty): - """suggested size - the memory size with which the developer recommends the application be launched """ - which = 'sprt' - want = 'long' - class minimum_size(aetools.NProperty): - """minimum size - the smallest memory size with which the application can be launched """ - which = 'mprt' - want = 'long' - class preferred_size(aetools.NProperty): - """preferred size - the memory size with which the application will be launched """ - which = 'appt' - want = 'long' class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the application high-level event aware? """ --- 33,36 ---- *************** *** 53,56 **** --- 41,56 ---- which = 'hscr' want = 'bool' + class minimum_size(aetools.NProperty): + """minimum size - the smallest memory size with which the application can be launched """ + which = 'mprt' + want = 'long' + class preferred_size(aetools.NProperty): + """preferred size - the memory size with which the application will be launched """ + which = 'appt' + want = 'long' + class suggested_size(aetools.NProperty): + """suggested size - the memory size with which the developer recommends the application be launched """ + which = 'sprt' + want = 'long' application_files = application_file *************** *** 84,107 **** """file - A file """ want = 'file' - class file_type(aetools.NProperty): - """file type - the OSType identifying the type of data contained in the item """ - which = 'asty' - want = 'type' class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' class locked(aetools.NProperty): """locked - Is the file locked? """ which = 'aslk' want = 'bool' - class stationery(aetools.NProperty): - """stationery - Is the file a stationery pad? """ - which = 'pspd' - want = 'bool' class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ --- 84,107 ---- """file - A file """ want = 'file' class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' + class file_type(aetools.NProperty): + """file type - the OSType identifying the type of data contained in the item """ + which = 'asty' + want = 'type' class locked(aetools.NProperty): """locked - Is the file locked? """ which = 'aslk' want = 'bool' class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'itxt' + class stationery(aetools.NProperty): + """stationery - Is the file a stationery pad? """ + which = 'pspd' + want = 'bool' class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ *************** *** 166,174 **** application_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'suggested_size' : suggested_size, - 'minimum_size' : minimum_size, - 'preferred_size' : preferred_size, 'accepts_high_level_events' : accepts_high_level_events, 'has_scripting_terminology' : has_scripting_terminology, } application_file._privelemdict = { --- 166,174 ---- application_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'accepts_high_level_events' : accepts_high_level_events, 'has_scripting_terminology' : has_scripting_terminology, + 'minimum_size' : minimum_size, + 'preferred_size' : preferred_size, + 'suggested_size' : suggested_size, } application_file._privelemdict = { *************** *** 203,211 **** file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'file_type' : file_type, 'creator_type' : creator_type, 'locked' : locked, - 'stationery' : stationery, 'product_version' : product_version, 'version' : version, } --- 203,211 ---- file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'creator_type' : creator_type, + 'file_type' : file_type, 'locked' : locked, 'product_version' : product_version, + 'stationery' : stationery, 'version' : version, } *************** *** 257,291 **** # _classdeclarations = { - 'sndf' : sound_file, - 'fntf' : font_file, - 'stcs' : suitcase, - 'clpf' : clipping, - 'dsut' : desk_accessory_suitcase, 'alia' : alias_file, 'dafi' : desk_accessory_file, ! 'fsut' : font_suitcase, 'file' : file, ! 'appf' : application_file, 'inlf' : internet_location_file, - 'docf' : document_file, 'pack' : package, } _propdeclarations = { - 'ver2' : product_version, - 'vers' : version, 'appt' : preferred_size, ! 'snd ' : sound, ! 'pspd' : stationery, ! '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, 'iloc' : location, ! 'aslk' : locked, 'orig' : original_item, } --- 257,291 ---- # _classdeclarations = { 'alia' : alias_file, + 'appf' : application_file, + 'clpf' : clipping, 'dafi' : desk_accessory_file, ! 'docf' : document_file, ! 'dsut' : desk_accessory_suitcase, 'file' : file, ! 'fntf' : font_file, ! 'fsut' : font_suitcase, 'inlf' : internet_location_file, 'pack' : package, + 'sndf' : sound_file, + 'stcs' : suitcase, } _propdeclarations = { 'appt' : preferred_size, ! 'aslk' : locked, 'asty' : file_type, 'c@#^' : _3c_Inheritance_3e_, 'fcrt' : creator_type, ! 'hscr' : has_scripting_terminology, 'iloc' : location, ! 'isab' : accepts_high_level_events, ! 'mprt' : minimum_size, 'orig' : original_item, + 'pspd' : stationery, + 'snd ' : sound, + 'sprt' : suggested_size, + 'ver2' : product_version, + 'vers' : version, } Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- Finder_Basics.py 28 Mar 2003 23:37:56 -0000 1.3 *************** *** 145,152 **** --- 145,180 ---- """application - The Finder """ want = 'capp' + class Finder_preferences(aetools.NProperty): + """Finder preferences - Various preferences that apply to the Finder as a whole """ + which = 'pfrp' + want = 'cprf' + class about_this_computer(aetools.NProperty): + """about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """ + which = 'abbx' + want = 'obj ' class clipboard(aetools.NProperty): """clipboard - the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' + class desktop(aetools.NProperty): + """desktop - the desktop """ + which = 'desk' + want = 'cdsk' + class execution_state(aetools.NProperty): + """execution state - the current execution state of the Finder """ + which = 'exec' + want = 'ese0' + class file_sharing(aetools.NProperty): + """file sharing - Is file sharing on? """ + which = 'fshr' + want = 'bool' + class frontmost(aetools.NProperty): + """frontmost - Is the Finder the frontmost process? """ + which = 'pisf' + want = 'bool' + class insertion_location(aetools.NProperty): + """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ + which = 'pins' + want = 'obj ' class largest_free_block(aetools.NProperty): """largest free block - the largest free block of process memory available to launch an application """ *************** *** 157,243 **** which = 'pnam' want = 'itxt' ! class visible(aetools.NProperty): ! """visible - Is the Finder\xd5s layer visible? """ ! which = 'pvis' ! want = 'bool' ! class frontmost(aetools.NProperty): ! """frontmost - Is the Finder the frontmost process? """ ! which = 'pisf' ! want = 'bool' class selection(aetools.NProperty): """selection - the selection visible to the user """ which = 'sele' want = 'obj ' - class insertion_location(aetools.NProperty): - """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ - which = 'pins' - want = 'obj ' - class file_sharing(aetools.NProperty): - """file sharing - Is file sharing on? """ - which = 'fshr' - want = 'bool' class sharing_starting_up(aetools.NProperty): """sharing starting up - Is file sharing in the process of starting up? """ which = 'fsup' want = 'bool' - class product_version(aetools.NProperty): - """product version - the version of the System software running on this computer """ - which = 'ver2' - want = 'itxt' class version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'itxt' ! class about_this_computer(aetools.NProperty): ! """about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """ ! which = 'abbx' ! want = 'obj ' ! class desktop(aetools.NProperty): ! """desktop - the desktop """ ! 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 """ ! which = 'pfrp' ! want = 'cprf' ! # element 'cobj' as ['indx', 'name'] ! # element 'ctnr' as ['indx', 'name'] ! # element 'sctr' as ['indx', 'name'] ! # element 'cdis' as ['indx', 'name', 'ID '] ! # element 'cfol' as ['indx', 'name', 'ID '] ! # element 'file' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'docf' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'dafi' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] ! # element 'sndf' as ['indx', 'name'] ! # element 'clpf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] - # element 'prcs' as ['indx', 'name'] # element 'pcap' as ['indx', 'name'] # element 'pcda' as ['indx', 'name'] ! # element 'cwin' as ['indx', 'name'] ! # 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'] class special_folders(aetools.ComponentItem): """special folders - The special folders used by the Mac OS """ want = 'spfl' - class system_folder(aetools.NProperty): - """system folder - the System folder """ - which = 'macs' - want = 'obj ' class apple_menu_items_folder(aetools.NProperty): """apple menu items folder - the special folder named \xd2Apple Menu Items,\xd3 the contents of which appear in the Apple menu """ --- 185,239 ---- which = 'pnam' want = 'itxt' ! class product_version(aetools.NProperty): ! """product version - the version of the System software running on this computer """ ! which = 'ver2' ! want = 'itxt' class selection(aetools.NProperty): """selection - the selection visible to the user """ which = 'sele' want = 'obj ' class sharing_starting_up(aetools.NProperty): """sharing starting up - Is file sharing in the process of starting up? """ which = 'fsup' want = 'bool' class version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'itxt' ! class visible(aetools.NProperty): ! """visible - Is the Finder\xd5s layer visible? """ ! which = 'pvis' ! want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'cdis' as ['indx', 'name', 'ID '] + # element 'cfol' as ['indx', 'name', 'ID '] + # element 'clpf' as ['indx', 'name'] + # element 'cobj' as ['indx', 'name'] + # element 'ctnr' as ['indx', 'name'] + # element 'cwin' as ['indx', 'name'] + # element 'cwnd' as ['indx', 'name'] + # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] + # element 'dsut' as ['indx', 'name'] + # element 'dwnd' as ['indx', 'name'] + # element 'file' as ['indx', 'name'] # element 'fntf' as ['indx', 'name'] ! # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] ! # element 'iwnd' as ['indx', 'name'] ! # element 'lwnd' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] # element 'pcap' as ['indx', 'name'] # element 'pcda' as ['indx', 'name'] ! # element 'prcs' as ['indx', 'name'] ! # element 'sctr' as ['indx', 'name'] ! # element 'sndf' as ['indx', 'name'] ! # element 'stcs' as ['indx', 'name'] # element 'vwnd' as ['indx', 'name'] class special_folders(aetools.ComponentItem): """special folders - The special folders used by the Mac OS """ want = 'spfl' class apple_menu_items_folder(aetools.NProperty): """apple menu items folder - the special folder named \xd2Apple Menu Items,\xd3 the contents of which appear in the Apple menu """ *************** *** 268,271 **** --- 264,271 ---- which = 'strt' want = 'obj ' + class system_folder(aetools.NProperty): + """system folder - the System folder """ + which = 'macs' + want = 'obj ' class temporary_items_folder(aetools.NProperty): """temporary items folder - the special folder named \xd2Temporary Items\xd3 (invisible) """ *************** *** 273,330 **** want = 'obj ' application._superclassnames = [] - import Earlier_terms - import Containers_and_folders import Files_and_suitcases ! import Process_classes import Window_classes application._privpropdict = { 'clipboard' : clipboard, 'largest_free_block' : largest_free_block, 'name' : name, ! 'visible' : visible, ! 'frontmost' : frontmost, 'selection' : selection, - 'insertion_location' : insertion_location, - 'file_sharing' : file_sharing, 'sharing_starting_up' : sharing_starting_up, - 'product_version' : product_version, 'version' : version, ! 'about_this_computer' : about_this_computer, ! 'desktop' : desktop, ! 'execution_state' : execution_state, ! 'Finder_preferences' : Finder_preferences, } application._privelemdict = { ! 'item' : Earlier_terms.item, 'container' : Containers_and_folders.container, ! 'sharable_container' : Earlier_terms.sharable_container, 'disk' : Containers_and_folders.disk, - 'folder' : Containers_and_folders.folder, - 'file' : Files_and_suitcases.file, - 'alias_file' : Files_and_suitcases.alias_file, - 'application_file' : Earlier_terms.application_file, 'document_file' : Files_and_suitcases.document_file, 'font_file' : Files_and_suitcases.font_file, - 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, - 'internet_location' : Earlier_terms.internet_location, - 'sound_file' : Files_and_suitcases.sound_file, - 'clipping' : Files_and_suitcases.clipping, - 'package' : Files_and_suitcases.package, - 'suitcase' : Files_and_suitcases.suitcase, 'font_suitcase' : Files_and_suitcases.font_suitcase, - 'accessory_suitcase' : Earlier_terms.accessory_suitcase, - 'process' : Earlier_terms.process, - 'application_process' : Process_classes.application_process, - 'accessory_process' : Earlier_terms.accessory_process, - 'window' : Earlier_terms.window, - '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, } special_folders._superclassnames = [] special_folders._privpropdict = { - 'system_folder' : system_folder, 'apple_menu_items_folder' : apple_menu_items_folder, 'control_panels_folder' : control_panels_folder, --- 273,329 ---- want = 'obj ' application._superclassnames = [] import Files_and_suitcases ! import Containers_and_folders ! import Earlier_terms import Window_classes + import Process_classes application._privpropdict = { + 'Finder_preferences' : Finder_preferences, + 'about_this_computer' : about_this_computer, 'clipboard' : clipboard, + 'desktop' : desktop, + 'execution_state' : execution_state, + 'file_sharing' : file_sharing, + 'frontmost' : frontmost, + 'insertion_location' : insertion_location, 'largest_free_block' : largest_free_block, 'name' : name, ! 'product_version' : product_version, 'selection' : selection, 'sharing_starting_up' : sharing_starting_up, 'version' : version, ! 'visible' : visible, } application._privelemdict = { ! 'accessory_process' : Earlier_terms.accessory_process, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Files_and_suitcases.application_file, ! 'application_process' : Process_classes.application_process, ! 'clipping' : Files_and_suitcases.clipping, ! 'clipping_window' : Window_classes.clipping_window, 'container' : Containers_and_folders.container, ! 'container_window' : Earlier_terms.container_window, ! 'content_space' : Window_classes.content_space, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, ! 'desk_accessory_suitcase' : Files_and_suitcases.desk_accessory_suitcase, 'disk' : Containers_and_folders.disk, 'document_file' : Files_and_suitcases.document_file, + 'file' : Files_and_suitcases.file, + 'folder' : Containers_and_folders.folder, 'font_file' : Files_and_suitcases.font_file, 'font_suitcase' : Files_and_suitcases.font_suitcase, 'information_window' : Earlier_terms.information_window, + 'internet_location_file' : Files_and_suitcases.internet_location_file, + 'item' : Earlier_terms.item, + 'package' : Files_and_suitcases.package, + 'process' : Earlier_terms.process, + 'sharable_container' : Containers_and_folders.sharable_container, + 'sound_file' : Files_and_suitcases.sound_file, + 'suitcase' : Files_and_suitcases.suitcase, 'view_options_window' : Window_classes.view_options_window, ! 'window' : Earlier_terms.window, } special_folders._superclassnames = [] special_folders._privpropdict = { 'apple_menu_items_folder' : apple_menu_items_folder, 'control_panels_folder' : control_panels_folder, *************** *** 334,337 **** --- 333,337 ---- 'shutdown_items_folder' : shutdown_items_folder, 'startup_items_folder' : startup_items_folder, + 'system_folder' : system_folder, 'temporary_items_folder' : temporary_items_folder, } *************** *** 348,375 **** _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, } --- 348,375 ---- _propdeclarations = { ! 'abbx' : about_this_computer, ! 'amnu' : apple_menu_items_folder, ! 'ctrl' : control_panels_folder, ! 'desk' : desktop, 'exec' : execution_state, ! 'extn' : extensions_folder, ! 'font' : fonts_folder, ! 'fshr' : file_sharing, 'fsup' : sharing_starting_up, 'macs' : system_folder, ! 'mfre' : largest_free_block, ! 'pcli' : clipboard, ! 'pfrp' : Finder_preferences, ! 'pins' : insertion_location, 'pisf' : frontmost, + 'pnam' : name, 'pref' : preferences_folder, + 'pvis' : visible, + 'sele' : selection, + 'shdf' : shutdown_items_folder, 'strt' : startup_items_folder, ! 'temp' : temporary_items_folder, ! 'ver2' : product_version, ! 'vers' : version, } Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 23 Mar 2003 22:07:27 -0000 1.2 --- Finder_items.py 28 Mar 2003 23:37:56 -0000 1.3 *************** *** 189,208 **** """item - An item """ want = 'cobj' ! class name(aetools.NProperty): ! """name - the name of the item """ ! which = 'pnam' want = 'itxt' - class index(aetools.NProperty): - """index - the index in the front-to-back ordering within its container """ - which = 'pidx' - want = 'long' - class id(aetools.NProperty): - """id - an id that identifies the item """ - which = 'ID ' - want = 'long' class container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' class disk(aetools.NProperty): """disk - the disk on which the item is stored """ --- 189,216 ---- """item - An item """ want = 'cobj' ! class bounds(aetools.NProperty): ! """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'pbnd' ! want = 'qdrt' ! class comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ ! which = 'comt' want = 'itxt' class container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' + class content_space(aetools.NProperty): + """content space - the window that would open if the item was opened """ + which = 'dwnd' + want = 'obj ' + class creation_date(aetools.NProperty): + """creation date - the date on which the item was created """ + which = 'ascd' + want = 'ldt ' + class description(aetools.NProperty): + """description - a description of the item """ + which = 'dscr' + want = 'itxt' class disk(aetools.NProperty): """disk - the disk on which the item is stored """ *************** *** 213,301 **** which = 'asdr' want = 'obj ' ! class position(aetools.NProperty): ! """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'posn' ! want = 'QDpt' ! class bounds(aetools.NProperty): ! """bounds - the bounding rectangle of the item (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'pbnd' ! want = 'qdrt' ! class label_index(aetools.NProperty): ! """label index - the label of the item """ ! which = 'labi' want = 'long' class kind(aetools.NProperty): """kind - the kind of the item """ which = 'kind' want = 'itxt' ! class description(aetools.NProperty): ! """description - a description of the item """ ! which = 'dscr' ! want = 'itxt' ! class comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ ! which = 'comt' ! want = 'itxt' ! class size(aetools.NProperty): ! """size - the logical size of the item """ ! which = 'ptsz' ! want = 'long' ! class physical_size(aetools.NProperty): ! """physical size - the actual space used by the item on disk """ ! which = 'phys' want = 'long' - class creation_date(aetools.NProperty): - """creation date - the date on which the item was created """ - which = 'ascd' - want = 'ldt ' class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class icon(aetools.NProperty): ! """icon - the icon bitmap of the item """ ! which = 'iimg' ! want = 'ifam' class selected(aetools.NProperty): """selected - Is the item selected? """ which = 'issl' want = 'bool' ! class content_space(aetools.NProperty): ! """content space - the window that would open if the item was opened """ ! which = 'dwnd' ! want = 'obj ' class window(aetools.NProperty): """window - the window that would open if the item was opened """ which = 'cwin' want = 'obj ' - class information_window(aetools.NProperty): - """information window - the information window for the item """ - which = 'iwnd' - want = 'obj ' items = item item._superclassnames = [] item._privpropdict = { ! 'name' : name, ! 'index' : index, ! 'id' : id, 'container' : container, 'disk' : disk, 'folder' : folder, ! 'position' : position, ! 'bounds' : bounds, ! 'label_index' : label_index, 'kind' : kind, ! 'description' : description, ! 'comment' : comment, ! 'size' : size, ! 'physical_size' : physical_size, ! 'creation_date' : creation_date, 'modification_date' : modification_date, ! 'icon' : icon, 'selected' : selected, ! 'content_space' : content_space, 'window' : window, - 'information_window' : information_window, } item._privelemdict = { --- 221,301 ---- which = 'asdr' want = 'obj ' ! class icon(aetools.NProperty): ! """icon - the icon bitmap of the item """ ! which = 'iimg' ! want = 'ifam' ! class id(aetools.NProperty): ! """id - an id that identifies the item """ ! which = 'ID ' want = 'long' + class index(aetools.NProperty): + """index - the index in the front-to-back ordering within its container """ + which = 'pidx' + want = 'long' + class information_window(aetools.NProperty): + """information window - the information window for the item """ + which = 'iwnd' + want = 'obj ' class kind(aetools.NProperty): """kind - the kind of the item """ which = 'kind' want = 'itxt' ! class label_index(aetools.NProperty): ! """label index - the label of the item """ ! which = 'labi' want = 'long' class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class name(aetools.NProperty): ! """name - the name of the item """ ! which = 'pnam' ! want = 'itxt' ! class physical_size(aetools.NProperty): ! """physical size - the actual space used by the item on disk """ ! which = 'phys' ! want = 'long' ! class position(aetools.NProperty): ! """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ ! which = 'posn' ! want = 'QDpt' class selected(aetools.NProperty): """selected - Is the item selected? """ which = 'issl' want = 'bool' ! class size(aetools.NProperty): ! """size - the logical size of the item """ ! which = 'ptsz' ! want = 'long' class window(aetools.NProperty): """window - the window that would open if the item was opened """ which = 'cwin' want = 'obj ' items = item item._superclassnames = [] item._privpropdict = { ! 'bounds' : bounds, ! 'comment' : comment, 'container' : container, + 'content_space' : content_space, + 'creation_date' : creation_date, + 'description' : description, 'disk' : disk, 'folder' : folder, ! 'icon' : icon, ! 'id' : id, ! 'index' : index, ! 'information_window' : information_window, 'kind' : kind, ! 'label_index' : label_index, 'modification_date' : modification_date, ! 'name' : name, ! 'physical_size' : physical_size, ! 'position' : position, 'selected' : selected, ! 'size' : size, 'window' : window, } item._privelemdict = { *************** *** 311,335 **** _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, } --- 311,335 ---- _propdeclarations = { ! 'ID ' : id, ! 'ascd' : creation_date, ! 'asdr' : folder, ! 'asmo' : modification_date, ! 'cdis' : disk, ! 'comt' : comment, ! 'ctnr' : container, ! 'cwin' : window, ! 'dscr' : description, 'dwnd' : content_space, ! 'iimg' : icon, 'issl' : selected, + 'iwnd' : information_window, + 'kind' : kind, 'labi' : label_index, ! 'pbnd' : bounds, ! 'phys' : physical_size, 'pidx' : index, 'pnam' : name, ! 'posn' : position, ! 'ptsz' : size, } Index: Obsolete_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Obsolete_terms.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Obsolete_terms.py 23 Mar 2003 22:07:27 -0000 1.2 --- Obsolete_terms.py 28 Mar 2003 23:37:56 -0000 1.3 *************** *** 90,96 **** """sharing window - A sharing window (opened by \xd2Sharing\xc9\xd3) """ want = 'swnd' ! class sharable_container(aetools.NProperty): ! """sharable container - the sharable container from which the window was opened """ ! which = 'sctr' want = 'obj ' class item(aetools.NProperty): --- 90,96 ---- """sharing window - A sharing window (opened by \xd2Sharing\xc9\xd3) """ want = 'swnd' ! class container(aetools.NProperty): ! """container - the container from which this window was opened """ ! which = 'ctnr' want = 'obj ' class item(aetools.NProperty): *************** *** 98,104 **** which = 'cobj' want = 'obj ' ! class container(aetools.NProperty): ! """container - the container from which this window was opened """ ! which = 'ctnr' want = 'obj ' --- 98,104 ---- which = 'cobj' want = 'obj ' ! class sharable_container(aetools.NProperty): ! """sharable container - the sharable container from which the window was opened """ ! which = 'sctr' want = 'obj ' *************** *** 170,177 **** sharing_window._superclassnames = [] sharing_window._privpropdict = { - 'sharable_container' : sharable_container, - 'item' : item, 'container' : container, 'folder_obsolete' : folder_obsolete, } sharing_window._privelemdict = { --- 170,177 ---- sharing_window._superclassnames = [] sharing_window._privpropdict = { 'container' : container, 'folder_obsolete' : folder_obsolete, + 'item' : item, + 'sharable_container' : sharable_container, } sharing_window._privelemdict = { *************** *** 187,215 **** # _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, } --- 187,215 ---- # _classdeclarations = { 'capp' : application, 'ccdv' : control_panel, 'cobj' : item, 'ctnr' : container, + 'cwnd' : container_window, + 'file' : file, 'iwnd' : information_window, + 'prcs' : process, + 'qwnd' : status_window, + 'sctr' : sharable_container, + 'swnd' : sharing_window, } _propdeclarations = { 'cfol' : folder_obsolete, + 'cobj' : item, 'crtd' : creation_date_obsolete, + 'ctnr' : container, + 'cwnd' : container_window, + 'fitp' : file_type_obsolete, 'islk' : locked_obsolete, 'modd' : modification_date_obsolete, 'pvwp' : view_preferences, ! 'sctr' : sharable_container, ! 'swnd' : sharing_window, } Index: Process_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Process_classes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Process_classes.py 28 Mar 2003 22:07:18 -0000 1.3 --- Process_classes.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 43,58 **** """process - A process running on this computer """ want = 'prcs' ! class name(aetools.NProperty): ! """name - the name of the process """ ! which = 'pnam' ! want = 'itxt' ! class visible(aetools.NProperty): ! """visible - Is the process' layer visible? """ ! which = 'pvis' want = 'bool' ! class frontmost(aetools.NProperty): ! """frontmost - Is the process the frontmost process? """ ! which = 'pisf' want = 'bool' class file(aetools.NProperty): """file - the file from which the process was launched """ --- 43,58 ---- """process - A process running on this computer """ want = 'prcs' ! class accepts_high_level_events(aetools.NProperty): ! """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ ! which = 'isab' want = 'bool' ! class accepts_remote_events(aetools.NProperty): ! """accepts remote events - Does the process accept remote events? """ ! which = 'revt' want = 'bool' + class creator_type(aetools.NProperty): + """creator type - the OSType of the creator of the process (the signature) """ + which = 'fcrt' + want = 'type' class file(aetools.NProperty): """file - the file from which the process was launched """ *************** *** 63,77 **** which = 'asty' want = 'type' ! class creator_type(aetools.NProperty): ! """creator type - the OSType of the creator of the process (the signature) """ ! which = 'fcrt' ! want = 'type' ! class accepts_high_level_events(aetools.NProperty): ! """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ ! which = 'isab' ! want = 'bool' ! class accepts_remote_events(aetools.NProperty): ! """accepts remote events - Does the process accept remote events? """ ! which = 'revt' want = 'bool' class has_scripting_terminology(aetools.NProperty): --- 63,69 ---- which = 'asty' want = 'type' ! class frontmost(aetools.NProperty): ! """frontmost - Is the process the frontmost process? """ ! which = 'pisf' want = 'bool' class has_scripting_terminology(aetools.NProperty): *************** *** 79,90 **** which = 'hscr' want = 'bool' ! class total_partition_size(aetools.NProperty): ! """total partition size - the size of the partition with which the process was launched """ ! which = 'appt' ! want = 'long' class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' processes = process --- 71,90 ---- which = 'hscr' want = 'bool' ! class name(aetools.NProperty): ! """name - the name of the process """ ! which = 'pnam' ! want = 'itxt' class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' + class total_partition_size(aetools.NProperty): + """total partition size - the size of the partition with which the process was launched """ + which = 'appt' + want = 'long' + class visible(aetools.NProperty): + """visible - Is the process' layer visible? """ + which = 'pvis' + want = 'bool' processes = process *************** *** 105,119 **** process._superclassnames = [] process._privpropdict = { - 'name' : name, - 'visible' : visible, - 'frontmost' : frontmost, - 'file' : file, - 'file_type' : file_type, - 'creator_type' : creator_type, 'accepts_high_level_events' : accepts_high_level_events, 'accepts_remote_events' : accepts_remote_events, 'has_scripting_terminology' : has_scripting_terminology, ! 'total_partition_size' : total_partition_size, 'partition_space_used' : partition_space_used, } process._privelemdict = { --- 105,119 ---- process._superclassnames = [] process._privpropdict = { 'accepts_high_level_events' : accepts_high_level_events, 'accepts_remote_events' : accepts_remote_events, + 'creator_type' : creator_type, + 'file' : file, + 'file_type' : file_type, + 'frontmost' : frontmost, 'has_scripting_terminology' : has_scripting_terminology, ! 'name' : name, 'partition_space_used' : partition_space_used, + 'total_partition_size' : total_partition_size, + 'visible' : visible, } process._privelemdict = { *************** *** 124,146 **** # _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, } --- 124,146 ---- # _classdeclarations = { 'pcap' : application_process, + 'pcda' : desk_accessory_process, + 'prcs' : process, } _propdeclarations = { ! 'appf' : application_file, 'appt' : total_partition_size, 'asty' : file_type, 'c@#^' : _3c_Inheritance_3e_, + 'dafi' : desk_accessory_file, 'fcrt' : creator_type, 'file' : file, + 'hscr' : has_scripting_terminology, + 'isab' : accepts_high_level_events, + 'pisf' : frontmost, 'pnam' : name, ! 'pusd' : partition_space_used, ! 'pvis' : visible, 'revt' : accepts_remote_events, } Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:18 -0000 1.3 --- Type_Definitions.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 23,88 **** """icon family - A family of icons """ want = 'ifam' - class large_monochrome_icon_and_mask(aetools.NProperty): - """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ - which = 'ICN#' - want = 'ICN#' - class large_8_bit_mask(aetools.NProperty): - """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ - which = 'l8mk' - want = 'l8mk' class large_32_bit_icon(aetools.NProperty): """large 32 bit icon - the large 32-bit color icon """ which = 'il32' want = 'il32' - class large_8_bit_icon(aetools.NProperty): - """large 8 bit icon - the large 8-bit color icon """ - which = 'icl8' - want = 'icl8' class large_4_bit_icon(aetools.NProperty): """large 4 bit icon - the large 4-bit color icon """ which = 'icl4' want = 'icl4' ! class small_monochrome_icon_and_mask(aetools.NProperty): ! """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ ! which = 'ics#' ! want = 'ics#' ! class small_8_bit_mask(aetools.NProperty): ! """small 8 bit mask - the small 8-bit mask for small 32-bit icons """ ! which = 'ics8' ! want = 's8mk' class small_32_bit_icon(aetools.NProperty): """small 32 bit icon - the small 32-bit color icon """ which = 'is32' want = 'is32' - - small_8_bit_icon = small_8_bit_mask class small_4_bit_icon(aetools.NProperty): """small 4 bit icon - the small 4-bit color icon """ which = 'ics4' want = 'ics4' class label(aetools.ComponentItem): """label - A Finder label (name and color) """ want = 'clbl' - class name(aetools.NProperty): - """name - the name associated with the label """ - which = 'pnam' - want = 'itxt' - class index(aetools.NProperty): - """index - the index in the front-to-back ordering within its container """ - which = 'pidx' - want = 'long' class color(aetools.NProperty): """color - the color associated with the label """ which = 'colr' want = 'cRGB' class preferences(aetools.ComponentItem): """preferences - The Finder Preferences """ want = 'cprf' - class window(aetools.NProperty): - """window - the window that would open if Finder preferences was opened """ - which = 'cwin' - want = 'pwnd' class button_view_arrangement(aetools.NProperty): """button view arrangement - the method of arrangement of icons in default Finder button view windows """ --- 23,84 ---- """icon family - A family of icons """ want = 'ifam' class large_32_bit_icon(aetools.NProperty): """large 32 bit icon - the large 32-bit color icon """ which = 'il32' want = 'il32' class large_4_bit_icon(aetools.NProperty): """large 4 bit icon - the large 4-bit color icon """ which = 'icl4' want = 'icl4' ! class large_8_bit_icon(aetools.NProperty): ! """large 8 bit icon - the large 8-bit color icon """ ! which = 'icl8' ! want = 'icl8' ! class large_8_bit_mask(aetools.NProperty): ! """large 8 bit mask - the large 8-bit mask for large 32-bit icons """ ! which = 'l8mk' ! want = 'l8mk' ! class large_monochrome_icon_and_mask(aetools.NProperty): ! """large monochrome icon and mask - the large black-and-white icon and the mask for large icons """ ! which = 'ICN#' ! want = 'ICN#' class small_32_bit_icon(aetools.NProperty): """small 32 bit icon - the small 32-bit color icon """ which = 'is32' want = 'is32' class small_4_bit_icon(aetools.NProperty): """small 4 bit icon - the small 4-bit color icon """ which = 'ics4' want = 'ics4' + class small_8_bit_icon(aetools.NProperty): + """small 8 bit icon - the small 8-bit color icon """ + which = 'ics8' + want = 'ics8' + + small_8_bit_mask = small_8_bit_icon + class small_monochrome_icon_and_mask(aetools.NProperty): + """small monochrome icon and mask - the small black-and-white icon and the mask for small icons """ + which = 'ics#' + want = 'ics#' class label(aetools.ComponentItem): """label - A Finder label (name and color) """ want = 'clbl' class color(aetools.NProperty): """color - the color associated with the label """ which = 'colr' want = 'cRGB' + class index(aetools.NProperty): + """index - the index in the front-to-back ordering within its container """ + which = 'pidx' + want = 'long' + class name(aetools.NProperty): + """name - the name associated with the label """ + which = 'pnam' + want = 'itxt' class preferences(aetools.ComponentItem): """preferences - The Finder Preferences """ want = 'cprf' class button_view_arrangement(aetools.NProperty): """button view arrangement - the method of arrangement of icons in default Finder button view windows """ *************** *** 93,108 **** which = 'bisz' want = 'long' - class spatial_view_arrangement(aetools.NProperty): - """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ - which = 'iarr' - want = 'earr' - class spatial_view_icon_size(aetools.NProperty): - """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ - which = 'iisz' - want = 'long' class calculates_folder_sizes(aetools.NProperty): """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ which = 'sfsz' want = 'bool' class list_view_icon_size(aetools.NProperty): """list view icon size - the size of icons displayed in Finder list view windows. """ --- 89,100 ---- which = 'bisz' want = 'long' class calculates_folder_sizes(aetools.NProperty): """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ which = 'sfsz' want = 'bool' + class delay_before_springing(aetools.NProperty): + """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ + which = 'dela' + want = 'shor' class list_view_icon_size(aetools.NProperty): """list view icon size - the size of icons displayed in Finder list view windows. """ *************** *** 137,140 **** --- 129,144 ---- which = 'svrs' want = 'bool' + class spatial_view_arrangement(aetools.NProperty): + """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ + which = 'iarr' + want = 'earr' + class spatial_view_icon_size(aetools.NProperty): + """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ + which = 'iisz' + want = 'long' + class spring_open_folders(aetools.NProperty): + """spring open folders - Spring open folders after the specified delay? """ + which = 'sprg' + want = 'bool' class uses_relative_dates(aetools.NProperty): """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ *************** *** 149,160 **** which = 'uswg' want = 'bool' - class spring_open_folders(aetools.NProperty): - """spring open folders - Spring open folders after the specified delay? """ - which = 'sprg' - want = 'bool' - class delay_before_springing(aetools.NProperty): - """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ - which = 'dela' - want = 'shor' class view_font(aetools.NProperty): """view font - the id of the font used in Finder views. """ --- 153,156 ---- *************** *** 165,168 **** --- 161,168 ---- which = 'vfsz' want = 'long' + class window(aetools.NProperty): + """window - the window that would open if Finder preferences was opened """ + which = 'cwin' + want = 'pwnd' # element 'clbl' as ['indx', 'name'] alias_list._superclassnames = [] *************** *** 173,186 **** icon_family._superclassnames = [] icon_family._privpropdict = { - 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, - 'large_8_bit_mask' : large_8_bit_mask, 'large_32_bit_icon' : large_32_bit_icon, - 'large_8_bit_icon' : large_8_bit_icon, 'large_4_bit_icon' : large_4_bit_icon, ! 'small_monochrome_icon_and_mask' : small_monochrome_icon_and_mask, ! 'small_8_bit_mask' : small_8_bit_mask, 'small_32_bit_icon' : small_32_bit_icon, - 'small_8_bit_icon' : small_8_bit_icon, 'small_4_bit_icon' : small_4_bit_icon, } icon_family._privelemdict = { --- 173,186 ---- icon_family._superclassnames = [] icon_family._privpropdict = { 'large_32_bit_icon' : large_32_bit_icon, 'large_4_bit_icon' : large_4_bit_icon, ! 'large_8_bit_icon' : large_8_bit_icon, ! 'large_8_bit_mask' : large_8_bit_mask, ! 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, 'small_32_bit_icon' : small_32_bit_icon, 'small_4_bit_icon' : small_4_bit_icon, + 'small_8_bit_icon' : small_8_bit_icon, + 'small_8_bit_mask' : small_8_bit_mask, + 'small_monochrome_icon_and_mask' : small_monochrome_icon_and_mask, } icon_family._privelemdict = { *************** *** 188,194 **** label._superclassnames = [] label._privpropdict = { - 'name' : name, - 'index' : index, 'color' : color, } label._privelemdict = { --- 188,194 ---- label._superclassnames = [] label._privpropdict = { 'color' : color, + 'index' : index, + 'name' : name, } label._privelemdict = { *************** *** 196,205 **** preferences._superclassnames = [] preferences._privpropdict = { - 'window' : window, 'button_view_arrangement' : button_view_arrangement, 'button_view_icon_size' : button_view_icon_size, - 'spatial_view_arrangement' : spatial_view_arrangement, - 'spatial_view_icon_size' : spatial_view_icon_size, 'calculates_folder_sizes' : calculates_folder_sizes, 'list_view_icon_size' : list_view_icon_size, 'shows_comments' : shows_comments, --- 196,203 ---- preferences._superclassnames = [] preferences._privpropdict = { 'button_view_arrangement' : button_view_arrangement, 'button_view_icon_size' : button_view_icon_size, 'calculates_folder_sizes' : calculates_folder_sizes, + 'delay_before_springing' : delay_before_springing, 'list_view_icon_size' : list_view_icon_size, 'shows_comments' : shows_comments, *************** *** 210,220 **** 'shows_size' : shows_size, 'shows_version' : shows_version, 'uses_relative_dates' : uses_relative_dates, 'uses_simple_menus' : uses_simple_menus, 'uses_wide_grid' : uses_wide_grid, - 'spring_open_folders' : spring_open_folders, - 'delay_before_springing' : delay_before_springing, 'view_font' : view_font, 'view_font_size' : view_font_size, } preferences._privelemdict = { --- 208,220 ---- 'shows_size' : shows_size, 'shows_version' : shows_version, + 'spatial_view_arrangement' : spatial_view_arrangement, + 'spatial_view_icon_size' : spatial_view_icon_size, + 'spring_open_folders' : spring_open_folders, 'uses_relative_dates' : uses_relative_dates, 'uses_simple_menus' : uses_simple_menus, 'uses_wide_grid' : uses_wide_grid, 'view_font' : view_font, 'view_font_size' : view_font_size, + 'window' : window, } preferences._privelemdict = { *************** *** 226,269 **** # _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, ! 'vfnt' : view_font, ! 'sknd' : shows_kind, ! 'svrs' : shows_version, 'colr' : color, ! 'ics8' : small_8_bit_mask, 'icl8' : large_8_bit_icon, - 'pidx' : index, - 'vfsz' : view_font_size, - 'sfsz' : calculates_folder_sizes, 'ics#' : small_monochrome_icon_and_mask, ! 'urdt' : uses_relative_dates, ! 'bisz' : button_view_icon_size, ! 'usme' : uses_simple_menus, ! 'sprg' : spring_open_folders, ! 'icl4' : large_4_bit_icon, ! 'slbl' : shows_label, ! 'lisz' : list_view_icon_size, ! 'ssiz' : shows_size, ! 'l8mk' : large_8_bit_mask, ! '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, 'scda' : shows_creation_date, } --- 226,269 ---- # _classdeclarations = { 'alst' : alias_list, 'clbl' : label, + 'cprf' : preferences, + 'ifam' : icon_family, } _propdeclarations = { ! 'ICN#' : large_monochrome_icon_and_mask, 'barr' : button_view_arrangement, ! 'bisz' : button_view_icon_size, 'colr' : color, ! 'cwin' : window, ! 'dela' : delay_before_springing, ! 'iarr' : spatial_view_arrangement, ! 'icl4' : large_4_bit_icon, 'icl8' : large_8_bit_icon, 'ics#' : small_monochrome_icon_and_mask, ! 'ics4' : small_4_bit_icon, ! 'ics8' : small_8_bit_icon, 'iisz' : spatial_view_icon_size, ! 'il32' : large_32_bit_icon, 'is32' : small_32_bit_icon, + 'l8mk' : large_8_bit_mask, + 'lisz' : list_view_icon_size, + 'pidx' : index, 'pnam' : name, 'scda' : shows_creation_date, + 'scom' : shows_comments, + 'sdat' : shows_modification_date, + 'sfsz' : calculates_folder_sizes, + 'sknd' : shows_kind, + 'slbl' : shows_label, + 'sprg' : spring_open_folders, + 'ssiz' : shows_size, + 'svrs' : shows_version, + 'urdt' : uses_relative_dates, + 'usme' : uses_simple_menus, + 'uswg' : uses_wide_grid, + 'vfnt' : view_font, + 'vfsz' : view_font_size, } Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/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 28 Mar 2003 22:07:18 -0000 1.3 --- Window_classes.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 29,68 **** """container window - A window that contains items """ want = 'cwnd' class container(aetools.NProperty): """container - the container from which the window was opened """ which = 'ctnr' want = 'obj ' - class item(aetools.NProperty): - """item - the item from which the window was opened (always returns something) """ - which = 'cobj' - want = 'obj ' class has_custom_view_settings(aetools.NProperty): """has custom view settings - Does the folder have custom view settings or is it using the default global settings? """ which = 'cuss' want = 'bool' ! class view(aetools.NProperty): ! """view - the current view for the window (icon, name, date, etc.) """ ! which = 'pvew' ! want = 'long' class previous_list_view(aetools.NProperty): """previous list view - the last non-icon view (by name, by date, etc.) selected for the container (forgotten as soon as the window is closed and only available when the window is open) """ which = 'svew' want = 'enum' - class button_view_arrangement(aetools.NProperty): - """button view arrangement - the property by which to keep icons arranged within a button view window """ - which = 'barr' - want = 'earr' - class spatial_view_arrangement(aetools.NProperty): - """spatial view arrangement - the property by which to keep icons arranged within a spatial view window """ - which = 'iarr' - want = 'earr' - class sort_direction(aetools.NProperty): - """sort direction - The direction in which the window is sorted """ - which = 'sord' - want = 'sodr' - class calculates_folder_sizes(aetools.NProperty): - """calculates folder sizes - Are folder sizes calculated and displayed in the window? (does not apply to suitcase windows) """ - which = 'sfsz' - want = 'bool' class shows_comments(aetools.NProperty): """shows comments - Are comments displayed in the window? (does not apply to suitcases) """ --- 29,56 ---- """container window - A window that contains items """ want = 'cwnd' + class button_view_arrangement(aetools.NProperty): + """button view arrangement - the property by which to keep icons arranged within a button view window """ + which = 'barr' + want = 'earr' + class calculates_folder_sizes(aetools.NProperty): + """calculates folder sizes - Are folder sizes calculated and displayed in the window? (does not apply to suitcase windows) """ + which = 'sfsz' + want = 'bool' class container(aetools.NProperty): """container - the container from which the window was opened """ which = 'ctnr' want = 'obj ' class has_custom_view_settings(aetools.NProperty): """has custom view settings - Does the folder have custom view settings or is it using the default global settings? """ which = 'cuss' want = 'bool' ! class item(aetools.NProperty): ! """item - the item from which the window was opened (always returns something) """ ! which = 'cobj' ! want = 'obj ' class previous_list_view(aetools.NProperty): """previous list view - the last non-icon view (by name, by date, etc.) selected for the container (forgotten as soon as the window is closed and only available when the window is open) """ which = 'svew' want = 'enum' class shows_comments(aetools.NProperty): """shows comments - Are comments displayed in the window? (does not apply to suitcases) """ *************** *** 93,100 **** --- 81,100 ---- which = 'svrs' want = 'bool' + class sort_direction(aetools.NProperty): + """sort direction - The direction in which the window is sorted """ + which = 'sord' + want = 'sodr' + class spatial_view_arrangement(aetools.NProperty): + """spatial view arrangement - the property by which to keep icons arranged within a spatial view window """ + which = 'iarr' + want = 'earr' class uses_relative_dates(aetools.NProperty): """uses relative dates - Are relative dates (e.g., today, yesterday) shown in the window? """ which = 'urdt' want = 'bool' + class view(aetools.NProperty): + """view - the current view for the window (icon, name, date, etc.) """ + which = 'pvew' + want = 'long' container_windows = container_window *************** *** 109,143 **** """information window - An information window (opened by \xd2Get Info\xd3) """ want = 'iwnd' - class current_panel(aetools.NProperty): - """current panel - the current panel in the information window """ - which = 'panl' - want = 'ipnl' class comment(aetools.NProperty): """comment - the comment """ which = 'comt' want = 'itxt' - class size(aetools.NProperty): - """size - the logical size of the item """ - which = 'ptsz' - want = 'long' - class physical_size(aetools.NProperty): - """physical size - the actual space used by the item on disk """ - which = 'phys' - want = 'long' class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = 'ldt ' class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class suggested_size(aetools.NProperty): ! """suggested size - the memory size with which the developer recommends the application be launched """ ! which = 'sprt' ! want = 'long' ! class minimum_size(aetools.NProperty): ! """minimum size - the smallest memory size with which the application can be launched (only applies to information windows for applications) """ ! which = 'mprt' want = 'long' class preferred_size(aetools.NProperty): --- 109,143 ---- """information window - An information window (opened by \xd2Get Info\xd3) """ want = 'iwnd' class comment(aetools.NProperty): """comment - the comment """ which = 'comt' want = 'itxt' class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = 'ldt ' + class current_panel(aetools.NProperty): + """current panel - the current panel in the information window """ + which = 'panl' + want = 'ipnl' + class icon(aetools.NProperty): + """icon - the icon bitmap of the item """ + which = 'iimg' + want = 'ifam' + class locked(aetools.NProperty): + """locked - Is the item locked (applies only to file and application information windows)? """ + which = 'aslk' + want = 'bool' + class minimum_size(aetools.NProperty): + """minimum size - the smallest memory size with which the application can be launched (only applies to information windows for applications) """ + which = 'mprt' + want = 'long' class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = 'ldt ' ! class physical_size(aetools.NProperty): ! """physical size - the actual space used by the item on disk """ ! which = 'phys' want = 'long' class preferred_size(aetools.NProperty): *************** *** 145,172 **** which = 'appt' want = 'long' - class icon(aetools.NProperty): - """icon - the icon bitmap of the item """ - which = 'iimg' - want = 'ifam' - class locked(aetools.NProperty): - """locked - Is the item locked (applies only to file and application information windows)? """ - which = 'aslk' - want = 'bool' - class stationery(aetools.NProperty): - """stationery - Is the item a stationery pad? """ - which = 'pspd' - want = 'bool' - class warns_before_emptying(aetools.NProperty): - """warns before emptying - Display a dialog when emptying the trash (only valid for trash info window)? """ - which = 'warn' - want = 'bool' class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' want = 'itxt' information_windows = information_window --- 145,172 ---- which = 'appt' want = 'long' class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'itxt' + class size(aetools.NProperty): + """size - the logical size of the item """ + which = 'ptsz' + want = 'long' + class stationery(aetools.NProperty): + """stationery - Is the item a stationery pad? """ + which = 'pspd' + want = 'bool' + class suggested_size(aetools.NProperty): + """suggested size - the memory size with which the developer recommends the application be launched """ + which = 'sprt' + want = 'long' class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' want = 'itxt' + class warns_before_emptying(aetools.NProperty): + """warns before emptying - Display a dialog when emptying the trash (only valid for trash info window)? """ + which = 'warn' + want = 'bool' information_windows = information_window *************** *** 185,224 **** """window - A window """ want = 'cwin' - class position(aetools.NProperty): - """position - the upper left position of the window """ - which = 'posn' - want = 'QDpt' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' - class titled(aetools.NProperty): - """titled - Does the window have a title bar? """ - which = 'ptit' - want = 'bool' - class name(aetools.NProperty): - """name - the name of the window """ - which = 'pnam' - want = 'itxt' - class index(aetools.NProperty): - """index - the number of the window in the front-to-back layer ordering """ - which = 'pidx' - want = 'long' class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' class floating(aetools.NProperty): """floating - Does the window have a title bar? """ which = 'isfl' want = 'bool' class modal(aetools.NProperty): """modal - Is the window modal? """ 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? """ --- 185,240 ---- """window - A window """ want = 'cwin' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' class closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' + class collapsed(aetools.NProperty): + """collapsed - Is the window collapsed (only applies to open non-pop-up windows)? """ + which = 'wshd' + want = 'bool' class floating(aetools.NProperty): """floating - Does the window have a title bar? """ which = 'isfl' want = 'bool' + class index(aetools.NProperty): + """index - the number of the window in the front-to-back layer ordering """ + which = 'pidx' + want = 'long' class modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' + class name(aetools.NProperty): + """name - the name of the window """ + which = 'pnam' + want = 'itxt' + class popup(aetools.NProperty): + """popup - Is the window is a pop-up window? (only applies to open container windows in the Finder and can only be set when the Finder is the front application) """ + which = 'drwr' + want = 'bool' + class position(aetools.NProperty): + """position - the upper left position of the window """ + which = 'posn' + want = 'QDpt' + class pulled_open(aetools.NProperty): + """pulled open - Is the window pulled open (only applies to pop-up windows and can only be set when the Finder is the front application)? """ + which = 'pull' + want = 'bool' class resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' + class titled(aetools.NProperty): + """titled - Does the window have a title bar? """ + which = 'ptit' + want = 'bool' + class visible(aetools.NProperty): + """visible - Is the window visible (always true for open Finder windows)? """ + which = 'pvis' + want = 'bool' class zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ *************** *** 233,252 **** which = 'zumf' want = 'bool' - class visible(aetools.NProperty): - """visible - Is the window visible (always true for open Finder windows)? """ - which = 'pvis' - want = 'bool' - class popup(aetools.NProperty): - """popup - Is the window is a pop-up window? (only applies to open container windows in the Finder and can only be set when the Finder is the front application) """ - which = 'drwr' - want = 'bool' - class pulled_open(aetools.NProperty): - """pulled open - Is the window pulled open (only applies to pop-up windows and can only be set when the Finder is the front application)? """ - which = 'pull' - want = 'bool' - class collapsed(aetools.NProperty): - """collapsed - Is the window collapsed (only applies to open non-pop-up windows)? """ - which = 'wshd' - want = 'bool' windows = window --- 249,252 ---- *************** *** 260,272 **** container_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'container' : container, - 'item' : item, 'has_custom_view_settings' : has_custom_view_settings, ! 'view' : view, 'previous_list_view' : previous_list_view, - 'button_view_arrangement' : button_view_arrangement, - 'spatial_view_arrangement' : spatial_view_arrangement, - 'sort_direction' : sort_direction, - 'calculates_folder_sizes' : calculates_folder_sizes, 'shows_comments' : shows_comments, 'shows_creation_date' : shows_creation_date, --- 260,269 ---- container_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + 'button_view_arrangement' : button_view_arrangement, + 'calculates_folder_sizes' : calculates_folder_sizes, 'container' : container, 'has_custom_view_settings' : has_custom_view_settings, ! 'item' : item, 'previous_list_view' : previous_list_view, 'shows_comments' : shows_comments, 'shows_creation_date' : shows_creation_date, *************** *** 276,280 **** --- 273,280 ---- 'shows_size' : shows_size, 'shows_version' : shows_version, + 'sort_direction' : sort_direction, + 'spatial_view_arrangement' : spatial_view_arrangement, 'uses_relative_dates' : uses_relative_dates, + 'view' : view, } container_window._privelemdict = { *************** *** 288,307 **** information_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'item' : item, - 'current_panel' : current_panel, 'comment' : comment, - 'size' : size, - 'physical_size' : physical_size, 'creation_date' : creation_date, ! 'modification_date' : modification_date, ! 'suggested_size' : suggested_size, ! 'minimum_size' : minimum_size, ! 'preferred_size' : preferred_size, 'icon' : icon, 'locked' : locked, ! 'stationery' : stationery, ! 'warns_before_emptying' : warns_before_emptying, 'product_version' : product_version, 'version' : version, } information_window._privelemdict = { --- 288,307 ---- information_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'comment' : comment, 'creation_date' : creation_date, ! 'current_panel' : current_panel, 'icon' : icon, + 'item' : item, 'locked' : locked, ! 'minimum_size' : minimum_size, ! 'modification_date' : modification_date, ! 'physical_size' : physical_size, ! 'preferred_size' : preferred_size, 'product_version' : product_version, + 'size' : size, + 'stationery' : stationery, + 'suggested_size' : suggested_size, 'version' : version, + 'warns_before_emptying' : warns_before_emptying, } information_window._privelemdict = { *************** *** 323,342 **** window._superclassnames = [] window._privpropdict = { - 'position' : position, 'bounds' : bounds, - 'titled' : titled, - 'name' : name, - 'index' : index, 'closeable' : closeable, 'floating' : floating, 'modal' : modal, 'resizable' : resizable, 'zoomable' : zoomable, 'zoomed' : zoomed, 'zoomed_full_size' : zoomed_full_size, - 'visible' : visible, - 'popup' : popup, - 'pulled_open' : pulled_open, - 'collapsed' : collapsed, } window._privelemdict = { --- 323,342 ---- window._superclassnames = [] window._privpropdict = { 'bounds' : bounds, 'closeable' : closeable, + 'collapsed' : collapsed, 'floating' : floating, + 'index' : index, 'modal' : modal, + 'name' : name, + 'popup' : popup, + 'position' : position, + 'pulled_open' : pulled_open, 'resizable' : resizable, + 'titled' : titled, + 'visible' : visible, 'zoomable' : zoomable, 'zoomed' : zoomed, 'zoomed_full_size' : zoomed_full_size, } window._privelemdict = { *************** *** 347,409 **** # _classdeclarations = { - 'pwnd' : preferences_window, 'cwin' : window, - 'vwnd' : view_options_window, - 'lwnd' : clipping_window, 'cwnd' : container_window, 'dwnd' : content_space, 'iwnd' : information_window, } _propdeclarations = { - 'prsz' : resizable, - 'barr' : button_view_arrangement, - 'pbnd' : bounds, 'appt' : preferred_size, ! 'iarr' : spatial_view_arrangement, ! 'hclb' : closeable, 'c@#^' : _3c_Inheritance_3e_, ! 'ver2' : product_version, 'cuss' : has_custom_view_settings, ! 'sprt' : suggested_size, ! 'zumf' : zoomed_full_size, ! 'urdt' : uses_relative_dates, ! 'panl' : current_panel, ! 'pmod' : modal, ! 'scom' : shows_comments, ! 'pspd' : stationery, ! 'aslk' : locked, ! 'pzum' : zoomed, 'iimg' : icon, 'mprt' : minimum_size, 'pnam' : name, - 'ssiz' : shows_size, - 'asmo' : modification_date, - 'cobj' : item, - 'ptit' : titled, 'posn' : position, ! 'vers' : version, ! 'phys' : physical_size, ! 'pull' : pulled_open, ! '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, ! 'warn' : warns_before_emptying, 'ptsz' : size, 'pvis' : visible, ! 'pidx' : index, ! 'isfl' : floating, ! 'drwr' : popup, 'sdat' : shows_modification_date, - 'pvew' : view, 'sfsz' : calculates_folder_sizes, ! 'scda' : shows_creation_date, } --- 347,409 ---- # _classdeclarations = { 'cwin' : window, 'cwnd' : container_window, 'dwnd' : content_space, 'iwnd' : information_window, + 'lwnd' : clipping_window, + 'pwnd' : preferences_window, + 'vwnd' : view_options_window, } _propdeclarations = { 'appt' : preferred_size, ! 'ascd' : creation_date, ! 'aslk' : locked, ! 'asmo' : modification_date, ! 'barr' : button_view_arrangement, 'c@#^' : _3c_Inheritance_3e_, ! 'cobj' : item, ! 'comt' : comment, ! 'ctnr' : container, 'cuss' : has_custom_view_settings, ! 'drwr' : popup, ! 'hclb' : closeable, ! 'iarr' : spatial_view_arrangement, 'iimg' : icon, + 'isfl' : floating, + 'iszm' : zoomable, 'mprt' : minimum_size, + 'panl' : current_panel, + 'pbnd' : bounds, + 'phys' : physical_size, + 'pidx' : index, + 'pmod' : modal, 'pnam' : name, 'posn' : position, ! 'prsz' : resizable, ! 'pspd' : stationery, ! 'ptit' : titled, 'ptsz' : size, + 'pull' : pulled_open, + 'pvew' : view, 'pvis' : visible, ! 'pzum' : zoomed, ! 'scda' : shows_creation_date, ! 'scom' : shows_comments, 'sdat' : shows_modification_date, 'sfsz' : calculates_folder_sizes, ! 'sknd' : shows_kind, ! 'slbl' : shows_label, ! 'sord' : sort_direction, ! 'sprt' : suggested_size, ! 'ssiz' : shows_size, ! 'svew' : previous_list_view, ! 'svrs' : shows_version, ! 'urdt' : uses_relative_dates, ! 'ver2' : product_version, ! 'vers' : version, ! 'warn' : warns_before_emptying, ! 'wshd' : collapsed, ! 'zumf' : zoomed_full_size, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 28 Mar 2003 22:07:18 -0000 1.3 --- __init__.py 28 Mar 2003 23:37:56 -0000 1.4 *************** *** 77,93 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(accessory_suitcase) - getbaseclasses(preferences) - getbaseclasses(sharable_container) - getbaseclasses(application) - getbaseclasses(trash_2d_object) - getbaseclasses(accessory_process) - getbaseclasses(window) - getbaseclasses(information_window) - getbaseclasses(process) - getbaseclasses(application_file) - getbaseclasses(internet_location) - getbaseclasses(container_window) - getbaseclasses(item) getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) --- 77,80 ---- *************** *** 130,133 **** --- 117,134 ---- getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + getbaseclasses(accessory_suitcase) + getbaseclasses(preferences) + getbaseclasses(sharable_container) + getbaseclasses(application) + getbaseclasses(trash_2d_object) + getbaseclasses(accessory_process) + getbaseclasses(window) + getbaseclasses(information_window) + getbaseclasses(process) + getbaseclasses(application_file) + getbaseclasses(internet_location) + getbaseclasses(container_window) + getbaseclasses(item) + getbaseclasses(item) getbaseclasses(trash_2d_object) getbaseclasses(desktop_2d_object) *************** *** 137,143 **** getbaseclasses(folder) getbaseclasses(container) - getbaseclasses(application) - getbaseclasses(special_folders) - getbaseclasses(item) getbaseclasses(sound_file) getbaseclasses(font_file) --- 138,141 ---- *************** *** 153,156 **** --- 151,156 ---- getbaseclasses(document_file) getbaseclasses(package) + getbaseclasses(application) + getbaseclasses(special_folders) getbaseclasses(preferences_window) getbaseclasses(view_options_window) *************** *** 160,163 **** --- 160,174 ---- getbaseclasses(information_window) getbaseclasses(clipping_window) + getbaseclasses(status_window) + getbaseclasses(application) + getbaseclasses(sharing_window) + getbaseclasses(control_panel) + getbaseclasses(process) + getbaseclasses(item) + getbaseclasses(file) + getbaseclasses(sharable_container) + getbaseclasses(container_window) + getbaseclasses(container) + getbaseclasses(information_window) getbaseclasses(process) getbaseclasses(desk_accessory_process) *************** *** 247,261 **** getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) - getbaseclasses(status_window) - getbaseclasses(application) - getbaseclasses(sharing_window) - getbaseclasses(control_panel) - getbaseclasses(process) - getbaseclasses(item) - getbaseclasses(file) - getbaseclasses(sharable_container) - getbaseclasses(container_window) - getbaseclasses(container) - getbaseclasses(information_window) # --- 258,261 ---- *************** *** 263,279 **** # _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, 'shor' : StdSuites.Type_Names_Suite.small_integer, 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, --- 263,266 ---- *************** *** 316,319 **** --- 303,320 ---- 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + '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, + 'cobj' : item, 'ctrs' : trash_2d_object, 'cdsk' : desktop_2d_object, *************** *** 323,329 **** 'cfol' : folder, 'ctnr' : container, - 'capp' : application, - 'spfl' : special_folders, - 'cobj' : item, 'sndf' : sound_file, 'fntf' : font_file, --- 324,327 ---- *************** *** 339,342 **** --- 337,342 ---- 'docf' : document_file, 'pack' : package, + 'capp' : application, + 'spfl' : special_folders, 'pwnd' : preferences_window, 'vwnd' : view_options_window, *************** *** 346,349 **** --- 346,360 ---- 'iwnd' : information_window, 'lwnd' : clipping_window, + '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, 'prcs' : process, 'pcda' : desk_accessory_process, *************** *** 433,447 **** 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - '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, } --- 444,447 ---- From jackjansen@users.sourceforge.net Fri Mar 28 23:38:04 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:38:04 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Terminal_Suite.py,1.3,1.4 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv26251/Terminal Modified Files: Terminal_Suite.py __init__.py Log Message: Sigh: didn't catch all lists that needed to be sorted. Regenerated again. Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Terminal_Suite.py 28 Mar 2003 22:07:21 -0000 1.3 --- Terminal_Suite.py 28 Mar 2003 23:38:00 -0000 1.4 *************** *** 103,106 **** --- 103,110 ---- """application - The Terminal program """ want = 'capp' + class frontmost(aetools.NProperty): + """frontmost - Is this the active application? """ + which = 'pisf' + want = 'bool' class name(aetools.NProperty): """name - the name of the application """ *************** *** 111,118 **** which = 'vers' want = 'vers' - class frontmost(aetools.NProperty): - """frontmost - Is this the active application? """ - which = 'pisf' - want = 'bool' # element 'cwin' as ['name', 'indx'] --- 115,118 ---- *************** *** 122,133 **** """window - A Terminal window """ want = 'cwin' ! class index(aetools.NProperty): ! """index - the number of the window """ ! which = 'pidx' ! want = 'long' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' want = 'qdrt' class has_close_box(aetools.NProperty): """has close box - Does the window have a close box? """ --- 122,161 ---- """window - A Terminal window """ want = 'cwin' ! class background_color(aetools.NProperty): ! """background color - the background color for the window """ ! which = 'pbcl' ! want = 'TEXT' ! class bold_text_color(aetools.NProperty): ! """bold text color - the bold text color for the window """ ! which = 'pbtc' ! want = 'TEXT' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' want = 'qdrt' + class busy(aetools.NProperty): + """busy - Is the window busy running a process? """ + which = 'busy' + want = 'bool' + class contents(aetools.NProperty): + """contents - the currently visible contents of the window """ + which = 'pcnt' + want = 'TEXT' + class cursor_color(aetools.NProperty): + """cursor color - the cursor color for the window """ + which = 'pcuc' + want = 'TEXT' + class custom_title(aetools.NProperty): + """custom title - the custom title for the window """ + which = 'titl' + want = 'TEXT' + class floating(aetools.NProperty): + """floating - Does the window float? """ + which = 'isfl' + want = 'bool' + class frame(aetools.NProperty): + """frame - the origin and size of the window """ + which = 'pfra' + want = 'list' class has_close_box(aetools.NProperty): """has close box - Does the window have a close box? """ *************** *** 138,145 **** which = 'ptit' want = 'bool' ! class floating(aetools.NProperty): ! """floating - Does the window float? """ ! which = 'isfl' ! want = 'bool' class miniaturizable(aetools.NProperty): """miniaturizable - Is the window miniaturizable? """ --- 166,177 ---- which = 'ptit' want = 'bool' ! class history(aetools.NProperty): ! """history - the contents of the entire scrolling buffer of the window """ ! which = 'hist' ! want = 'TEXT' ! class index(aetools.NProperty): ! """index - the number of the window """ ! which = 'pidx' ! want = 'long' class miniaturizable(aetools.NProperty): """miniaturizable - Is the window miniaturizable? """ *************** *** 154,193 **** which = 'pmod' want = 'bool' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' ! class visible(aetools.NProperty): ! """visible - Is the window visible? """ ! which = 'pvis' ! want = 'bool' ! class zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' ! want = 'bool' ! class zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' ! want = 'bool' class position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = 'QDpt' ! class origin(aetools.NProperty): ! """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ ! which = 'pori' want = 'list' class size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' want = 'list' ! class frame(aetools.NProperty): ! """frame - the origin and size of the window """ ! which = 'pfra' ! want = 'list' class title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ which = 'tddn' want = 'bool' class title_displays_shell_path(aetools.NProperty): """title displays shell path - Does the title for the window contain the shell path? """ --- 186,233 ---- which = 'pmod' want = 'bool' ! class normal_text_color(aetools.NProperty): ! """normal text color - the normal text color for the window """ ! which = 'ptxc' ! want = 'TEXT' ! class number_of_columns(aetools.NProperty): ! """number of columns - the number of columns in the window """ ! which = 'ccol' ! want = 'long' ! class number_of_rows(aetools.NProperty): ! """number of rows - the number of rows in the window """ ! which = 'crow' ! want = 'long' ! class origin(aetools.NProperty): ! """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ ! which = 'pori' ! want = 'list' class position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' want = 'QDpt' ! class processes(aetools.NProperty): ! """processes - a list of the currently running processes """ ! which = 'prcs' want = 'list' + class resizable(aetools.NProperty): + """resizable - Is the window resizable? """ + which = 'prsz' + want = 'bool' class size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' want = 'list' ! class title_displays_custom_title(aetools.NProperty): ! """title displays custom title - Does the title for the window contain a custom title? """ ! which = 'tdct' ! want = 'bool' class title_displays_device_name(aetools.NProperty): """title displays device name - Does the title for the window contain the device name? """ which = 'tddn' want = 'bool' + class title_displays_file_name(aetools.NProperty): + """title displays file name - Does the title for the window contain the file name? """ + which = 'tdfn' + want = 'bool' class title_displays_shell_path(aetools.NProperty): """title displays shell path - Does the title for the window contain the shell path? """ *************** *** 198,260 **** which = 'tdws' want = 'bool' ! class title_displays_file_name(aetools.NProperty): ! """title displays file name - Does the title for the window contain the file name? """ ! which = 'tdfn' want = 'bool' ! class title_displays_custom_title(aetools.NProperty): ! """title displays custom title - Does the title for the window contain a custom title? """ ! which = 'tdct' want = 'bool' ! class custom_title(aetools.NProperty): ! """custom title - the custom title for the window """ ! which = 'titl' ! want = 'TEXT' ! class contents(aetools.NProperty): ! """contents - the currently visible contents of the window """ ! which = 'pcnt' ! want = 'TEXT' ! class history(aetools.NProperty): ! """history - the contents of the entire scrolling buffer of the window """ ! which = 'hist' ! want = 'TEXT' ! class number_of_rows(aetools.NProperty): ! """number of rows - the number of rows in the window """ ! which = 'crow' ! want = 'long' ! class number_of_columns(aetools.NProperty): ! """number of columns - the number of columns in the window """ ! which = 'ccol' ! want = 'long' ! class cursor_color(aetools.NProperty): ! """cursor color - the cursor color for the window """ ! which = 'pcuc' ! want = 'TEXT' ! class background_color(aetools.NProperty): ! """background color - the background color for the window """ ! which = 'pbcl' ! want = 'TEXT' ! class normal_text_color(aetools.NProperty): ! """normal text color - the normal text color for the window """ ! which = 'ptxc' ! want = 'TEXT' ! class bold_text_color(aetools.NProperty): ! """bold text color - the bold text color for the window """ ! which = 'pbtc' ! want = 'TEXT' ! class busy(aetools.NProperty): ! """busy - Is the window busy running a process? """ ! which = 'busy' want = 'bool' - class processes(aetools.NProperty): - """processes - a list of the currently running processes """ - which = 'prcs' - want = 'list' windows = window application._superclassnames = [] application._privpropdict = { 'name' : name, 'version' : version, - 'frontmost' : frontmost, } application._privelemdict = { --- 238,260 ---- which = 'tdws' want = 'bool' ! class visible(aetools.NProperty): ! """visible - Is the window visible? """ ! which = 'pvis' want = 'bool' ! class zoomable(aetools.NProperty): ! """zoomable - Is the window zoomable? """ ! which = 'iszm' want = 'bool' ! class zoomed(aetools.NProperty): ! """zoomed - Is the window zoomed? """ ! which = 'pzum' want = 'bool' windows = window application._superclassnames = [] application._privpropdict = { + 'frontmost' : frontmost, 'name' : name, 'version' : version, } application._privelemdict = { *************** *** 263,300 **** window._superclassnames = [] window._privpropdict = { ! 'name' : name, ! 'index' : index, 'bounds' : bounds, 'has_close_box' : has_close_box, 'has_title_bar' : has_title_bar, ! 'floating' : floating, 'miniaturizable' : miniaturizable, 'miniaturized' : miniaturized, 'modal' : modal, ! 'resizable' : resizable, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, ! 'position' : position, 'origin' : origin, 'size' : size, ! 'frame' : frame, 'title_displays_device_name' : title_displays_device_name, 'title_displays_shell_path' : title_displays_shell_path, 'title_displays_window_size' : title_displays_window_size, ! 'title_displays_file_name' : title_displays_file_name, ! 'title_displays_custom_title' : title_displays_custom_title, ! 'custom_title' : custom_title, ! 'contents' : contents, ! 'history' : history, ! 'number_of_rows' : number_of_rows, ! 'number_of_columns' : number_of_columns, ! 'cursor_color' : cursor_color, ! 'background_color' : background_color, ! 'normal_text_color' : normal_text_color, ! 'bold_text_color' : bold_text_color, ! 'busy' : busy, ! 'processes' : processes, ! 'frontmost' : frontmost, } window._privelemdict = { --- 263,300 ---- window._superclassnames = [] window._privpropdict = { ! 'background_color' : background_color, ! 'bold_text_color' : bold_text_color, 'bounds' : bounds, + 'busy' : busy, + 'contents' : contents, + 'cursor_color' : cursor_color, + 'custom_title' : custom_title, + 'floating' : floating, + 'frame' : frame, + 'frontmost' : frontmost, 'has_close_box' : has_close_box, 'has_title_bar' : has_title_bar, ! 'history' : history, ! 'index' : index, 'miniaturizable' : miniaturizable, 'miniaturized' : miniaturized, 'modal' : modal, ! 'name' : name, ! 'normal_text_color' : normal_text_color, ! 'number_of_columns' : number_of_columns, ! 'number_of_rows' : number_of_rows, 'origin' : origin, + 'position' : position, + 'processes' : processes, + 'resizable' : resizable, 'size' : size, ! 'title_displays_custom_title' : title_displays_custom_title, 'title_displays_device_name' : title_displays_device_name, + 'title_displays_file_name' : title_displays_file_name, 'title_displays_shell_path' : title_displays_shell_path, 'title_displays_window_size' : title_displays_window_size, ! 'visible' : visible, ! 'zoomable' : zoomable, ! 'zoomed' : zoomed, } window._privelemdict = { *************** *** 305,348 **** # _classdeclarations = { - 'cwin' : window, 'capp' : application, } _propdeclarations = { ! 'pori' : origin, ! 'prsz' : resizable, ! 'vers' : version, ! 'prcs' : processes, ! 'pbtc' : bold_text_color, ! 'pbnd' : bounds, 'crow' : number_of_rows, - 'pcnt' : contents, - 'tddn' : title_displays_device_name, - 'iszm' : zoomable, 'hclb' : has_close_box, 'isfl' : floating, ! 'busy' : busy, ! 'pfra' : frame, ! 'ppos' : position, ! 'ptxc' : normal_text_color, ! 'tdfn' : title_displays_file_name, 'pcuc' : cursor_color, ! 'tdsp' : title_displays_shell_path, ! 'pvis' : visible, 'pidx' : index, - 'pmod' : modal, - 'titl' : custom_title, 'pisf' : frontmost, 'pmnd' : miniaturized, ! 'tdct' : title_displays_custom_title, ! 'hist' : history, ! 'pzum' : zoomed, ! 'ismn' : miniaturizable, ! 'pbcl' : background_color, 'pnam' : name, ! 'ccol' : number_of_columns, ! 'tdws' : title_displays_window_size, 'psiz' : size, 'ptit' : has_title_bar, } --- 305,348 ---- # _classdeclarations = { 'capp' : application, + 'cwin' : window, } _propdeclarations = { ! 'busy' : busy, ! 'ccol' : number_of_columns, 'crow' : number_of_rows, 'hclb' : has_close_box, + 'hist' : history, 'isfl' : floating, ! 'ismn' : miniaturizable, ! 'iszm' : zoomable, ! 'pbcl' : background_color, ! 'pbnd' : bounds, ! 'pbtc' : bold_text_color, ! 'pcnt' : contents, 'pcuc' : cursor_color, ! 'pfra' : frame, 'pidx' : index, 'pisf' : frontmost, 'pmnd' : miniaturized, ! 'pmod' : modal, 'pnam' : name, ! 'pori' : origin, ! 'ppos' : position, ! 'prcs' : processes, ! 'prsz' : resizable, 'psiz' : size, 'ptit' : has_title_bar, + 'ptxc' : normal_text_color, + 'pvis' : visible, + 'pzum' : zoomed, + 'tdct' : title_displays_custom_title, + 'tddn' : title_displays_device_name, + 'tdfn' : title_displays_file_name, + 'tdsp' : title_displays_shell_path, + 'tdws' : title_displays_window_size, + 'titl' : custom_title, + 'vers' : version, } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 28 Mar 2003 22:07:22 -0000 1.3 --- __init__.py 28 Mar 2003 23:38:00 -0000 1.4 *************** *** 43,46 **** --- 43,47 ---- getbaseclasses(window) getbaseclasses(application) + getbaseclasses(application) getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) *************** *** 83,87 **** getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) - getbaseclasses(application) # --- 84,87 ---- *************** *** 91,94 **** --- 91,95 ---- 'cwin' : window, 'capp' : application, + 'capp' : application, 'shor' : StdSuites.Type_Names_Suite.small_integer, 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, *************** *** 131,135 **** 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - 'capp' : application, } --- 132,135 ---- From jackjansen@users.sourceforge.net Fri Mar 28 23:42:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 15:42:39 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv27943 Modified Files: aetools.py Log Message: On OSX the finder will return from an open() event before the application has actually entered its event loop. As a stopgap, allow for a 10 second grace period. Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** aetools.py 5 Mar 2003 21:16:06 -0000 1.3 --- aetools.py 28 Mar 2003 23:42:37 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- import MacOS import sys + import time from aetypes import * *************** *** 33,36 **** --- 34,40 ---- Error = 'aetools.Error' + # Amount of time to wait for program to be launched + LAUNCH_MAX_WAIT_TIME=10 + # Special code to unpack an AppleEvent (which is *not* a disguised record!) # Note by Jack: No??!? If I read the docs correctly it *is*.... *************** *** 175,178 **** --- 179,190 ---- except AE.Error: _launch(self.target_signature) + for i in range(LAUNCH_MAX_WAIT_TIME): + try: + self.send('ascr', 'noop') + except AE.Error: + pass + else: + break + time.sleep(1) def start(self): From jackjansen@users.sourceforge.net Sat Mar 29 00:08:27 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:08:27 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv5624 Modified Files: gensuitemodule.py Log Message: Sometimes a class is used as a base class of itself. Obviously there's something I don't understand, but for now ignore this. Output the file name such that it cannot contain non-ascii characters. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** gensuitemodule.py 28 Mar 2003 23:37:05 -0000 1.36 --- gensuitemodule.py 29 Mar 2003 00:08:24 -0000 1.37 *************** *** 410,414 **** MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT') fp.write('"""\n') ! fp.write("Package generated from %s\n"%fname) if resinfo: fp.write("Resource %s resid %d %s\n"%(ascii(resinfo[1]), resinfo[0], ascii(resinfo[2]))) --- 410,414 ---- MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT') fp.write('"""\n') ! fp.write("Package generated from %s\n"%ascii(fname)) if resinfo: fp.write("Resource %s resid %d %s\n"%(ascii(resinfo[1]), resinfo[0], ascii(resinfo[2]))) *************** *** 914,918 **** superId, superDesc, dummy = superclass superclassname, fullyqualifiedname, module = self.findcodename("class", superId) ! superclassnames.append(superclassname) if self.fp: --- 914,922 ---- superId, superDesc, dummy = superclass superclassname, fullyqualifiedname, module = self.findcodename("class", superId) ! # I don't think this is correct: ! if superclassname == cname: ! pass # superclassnames.append(fullyqualifiedname) ! else: ! superclassnames.append(superclassname) if self.fp: From jackjansen@users.sourceforge.net Sat Mar 29 00:11:37 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:11:37 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts genallsuites.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv6855 Modified Files: genallsuites.py Log Message: - Prefer using events (in stead of poking around in resource files) to get terminology resources. Unfortunately there doesn't seem to be any application I can ask for the basic StdSuites terminology (?). - Prefer OSX-native versions of applications over OS9 versions. Index: genallsuites.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genallsuites.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** genallsuites.py 21 Mar 2003 16:30:53 -0000 1.1 --- genallsuites.py 29 Mar 2003 00:11:32 -0000 1.2 *************** *** 9,19 **** DSTDIR="/Users/jack/src/python/Lib/plat-mac/lib-scriptpackages" ! APPLESCRIPT="/Volumes/Sap/System Folder/Extensions/AppleScript" ! CODEWARRIOR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5" ! EXPLORER="/Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer" ! FINDER="/Volumes/Sap/System Folder/Finder" ! NETSCAPE="/Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2" ! TERMINAL="/Applications/Utilities/Terminal.app/Contents/Resources/Terminal.rsrc" gensuitemodule.processfile_fromresource(APPLESCRIPT, --- 9,22 ---- DSTDIR="/Users/jack/src/python/Lib/plat-mac/lib-scriptpackages" + OS9DISK="/Volumes/Moes" ! APPLESCRIPT=OS9DISK + "/Systeemmap/Extensies/AppleScript" ! SYSTEMEVENTS="/System/Library/CoreServices/System Events.app" ! ! CODEWARRIOR=OS9DISK + "/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6" ! EXPLORER="/Applications/Internet Explorer.app" ! FINDER="/System/Library/CoreServices/Finder.app" ! NETSCAPE=OS9DISK + "/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2" ! TERMINAL="/Applications/Utilities/Terminal.app" gensuitemodule.processfile_fromresource(APPLESCRIPT, *************** *** 21,44 **** basepkgname='_builtinSuites', edit_modnames=[]) ! gensuitemodule.processfile_fromresource(CODEWARRIOR, output=os.path.join(DSTDIR, 'CodeWarrior'), basepkgname='StdSuites', edit_modnames=[]) ! gensuitemodule.processfile_fromresource(EXPLORER, output=os.path.join(DSTDIR, 'Explorer'), basepkgname='StdSuites', edit_modnames=[]) ! gensuitemodule.processfile_fromresource(FINDER, output=os.path.join(DSTDIR, 'Finder'), basepkgname='StdSuites', edit_modnames=[]) ! gensuitemodule.processfile_fromresource(NETSCAPE, output=os.path.join(DSTDIR, 'Netscape'), basepkgname='StdSuites', edit_modnames=[('WorldWideWeb_suite_2c__as_d', 'WorldWideWeb_suite')]) ! gensuitemodule.processfile_fromresource(TERMINAL, output=os.path.join(DSTDIR, 'Terminal'), basepkgname='StdSuites', ! edit_modnames=[], ! creatorsignature='trmx') --- 24,50 ---- basepkgname='_builtinSuites', edit_modnames=[]) ! gensuitemodule.processfile(SYSTEMEVENTS, ! output=os.path.join(DSTDIR, 'SystemEvents'), ! basepkgname='StdSuites', ! edit_modnames=[]) ! gensuitemodule.processfile(CODEWARRIOR, output=os.path.join(DSTDIR, 'CodeWarrior'), basepkgname='StdSuites', edit_modnames=[]) ! gensuitemodule.processfile(EXPLORER, output=os.path.join(DSTDIR, 'Explorer'), basepkgname='StdSuites', edit_modnames=[]) ! gensuitemodule.processfile(FINDER, output=os.path.join(DSTDIR, 'Finder'), basepkgname='StdSuites', edit_modnames=[]) ! gensuitemodule.processfile(NETSCAPE, output=os.path.join(DSTDIR, 'Netscape'), basepkgname='StdSuites', edit_modnames=[('WorldWideWeb_suite_2c__as_d', 'WorldWideWeb_suite')]) ! gensuitemodule.processfile(TERMINAL, output=os.path.join(DSTDIR, 'Terminal'), basepkgname='StdSuites', ! edit_modnames=[]) From jackjansen@users.sourceforge.net Sat Mar 29 00:13:18 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:13:18 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites __init__.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv7382/StdSuites Modified Files: __init__.py Log Message: Regenerated with the new way to get terminology (through AppleEvents), which sometimes seems to result in different terminology. It does seem to be mostly compatible, though. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 28 Mar 2003 23:38:00 -0000 1.4 --- __init__.py 29 Mar 2003 00:13:15 -0000 1.5 *************** *** 69,110 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(paragraph) - getbaseclasses(character) - getbaseclasses(text_flow) - getbaseclasses(text_style_info) - getbaseclasses(line) - getbaseclasses(word) - getbaseclasses(text) - getbaseclasses(graphic_group) - getbaseclasses(oval) - getbaseclasses(graphic_text) - getbaseclasses(graphic_shape) - getbaseclasses(graphic_line) - getbaseclasses(graphic_object) - getbaseclasses(drawing_area) - getbaseclasses(polygon) - getbaseclasses(pixel) - getbaseclasses(rounded_rectangle) - getbaseclasses(arc) - getbaseclasses(pixel_map) - getbaseclasses(rectangle) - getbaseclasses(graphic_group) - getbaseclasses(drawing_area) - getbaseclasses(cell) - getbaseclasses(column) - getbaseclasses(table) - getbaseclasses(row) - getbaseclasses(AppleTalk_address) - getbaseclasses(address_specification) - getbaseclasses(Token_Ring_address) - getbaseclasses(FireWire_address) - getbaseclasses(bus_slot) - getbaseclasses(SCSI_address) - getbaseclasses(ADB_address) - getbaseclasses(USB_address) - getbaseclasses(device_specification) - getbaseclasses(LocalTalk_address) - getbaseclasses(IP_address) - getbaseclasses(Ethernet_address) getbaseclasses(July) getbaseclasses(May) --- 69,72 ---- *************** *** 212,222 **** getbaseclasses(file_specification) getbaseclasses(text) ! getbaseclasses(window) ! getbaseclasses(file) ! getbaseclasses(selection_2d_object) ! getbaseclasses(alias) ! getbaseclasses(application) ! getbaseclasses(insertion_point) ! getbaseclasses(document) getbaseclasses(small_integer) getbaseclasses(RGB16_color) --- 174,195 ---- getbaseclasses(file_specification) getbaseclasses(text) ! getbaseclasses(graphic_group) ! getbaseclasses(drawing_area) ! getbaseclasses(cell) ! getbaseclasses(column) ! getbaseclasses(table) ! getbaseclasses(row) ! getbaseclasses(AppleTalk_address) ! getbaseclasses(address_specification) ! getbaseclasses(Token_Ring_address) ! getbaseclasses(FireWire_address) ! getbaseclasses(bus_slot) ! getbaseclasses(SCSI_address) ! getbaseclasses(ADB_address) ! getbaseclasses(USB_address) ! getbaseclasses(device_specification) ! getbaseclasses(LocalTalk_address) ! getbaseclasses(IP_address) ! getbaseclasses(Ethernet_address) getbaseclasses(small_integer) getbaseclasses(RGB16_color) *************** *** 259,262 **** --- 232,262 ---- getbaseclasses(null) getbaseclasses(target_id) + getbaseclasses(paragraph) + getbaseclasses(character) + getbaseclasses(text_flow) + getbaseclasses(text_style_info) + getbaseclasses(line) + getbaseclasses(word) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(selection_2d_object) + getbaseclasses(alias) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(graphic_group) + getbaseclasses(oval) + getbaseclasses(graphic_text) + getbaseclasses(graphic_shape) + getbaseclasses(graphic_line) + getbaseclasses(graphic_object) + getbaseclasses(drawing_area) + getbaseclasses(polygon) + getbaseclasses(pixel) + getbaseclasses(rounded_rectangle) + getbaseclasses(arc) + getbaseclasses(pixel_map) + getbaseclasses(rectangle) # *************** *** 264,305 **** # _classdeclarations = { - 'cpar' : paragraph, - 'cha ' : character, - 'cflo' : text_flow, - 'tsty' : text_style_info, - 'clin' : line, - 'cwor' : word, - 'ctxt' : text, - '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, - 'cpic' : graphic_group, - 'cdrw' : drawing_area, - 'ccel' : cell, - 'ccol' : column, - 'ctbl' : table, - 'crow' : row, - '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, 'jul ' : July, 'may ' : May, --- 264,267 ---- *************** *** 407,417 **** 'fss ' : file_specification, 'ctxt' : text, ! 'cwin' : window, ! 'file' : file, ! 'csel' : selection_2d_object, ! 'alis' : alias, ! 'capp' : application, ! 'cins' : insertion_point, ! 'docu' : document, 'shor' : small_integer, 'tr16' : RGB16_color, --- 369,390 ---- 'fss ' : file_specification, 'ctxt' : text, ! 'cpic' : graphic_group, ! 'cdrw' : drawing_area, ! 'ccel' : cell, ! 'ccol' : column, ! 'ctbl' : table, ! 'crow' : row, ! '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, 'shor' : small_integer, 'tr16' : RGB16_color, *************** *** 454,457 **** --- 427,457 ---- 'null' : null, 'targ' : target_id, + 'cpar' : paragraph, + 'cha ' : character, + 'cflo' : text_flow, + 'tsty' : text_style_info, + 'clin' : line, + 'cwor' : word, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'csel' : selection_2d_object, + 'alis' : alias, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + '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, } From jackjansen@users.sourceforge.net Sat Mar 29 00:13:19 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:13:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Standard_Suite.py,NONE,1.1 Text_Suite.py,NONE,1.1 Terminal_Suite.py,1.4,1.5 __init__.py,1.4,1.5 Invisible_Suite.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv7382/Terminal Modified Files: Terminal_Suite.py __init__.py Added Files: Standard_Suite.py Text_Suite.py Removed Files: Invisible_Suite.py Log Message: Regenerated with the new way to get terminology (through AppleEvents), which sometimes seems to result in different terminology. It does seem to be mostly compatible, though. --- NEW FILE: Standard_Suite.py --- """Suite Standard Suite: Common classes and commands for most applications. Level 1, version 1 Generated from /Applications/Utilities/Terminal.app AETE/AEUT resource version 1/0, language 0, script 0 """ import aetools import MacOS _code = '????' class Standard_Suite_Events: _argmap_close = { 'saving_in' : 'kfil', 'saving' : 'savo', } def close(self, _object, _attributes={}, **_arguments): """close: Close an object. Required argument: the object for the command Keyword argument saving_in: The file in which to save the object. Keyword argument saving: Specifies whether changes should be saved before closing. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'clos' aetools.keysubst(_arguments, self._argmap_close) _arguments['----'] = _object aetools.enumsubst(_arguments, 'savo', _Enum_savo) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_count = { 'each' : 'kocl', } def count(self, _object, _attributes={}, **_arguments): """count: Return the number of elements of a particular class within an object. Required argument: the object for the command Keyword argument each: The class of objects to be counted. Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'core' _subcode = 'cnte' aetools.keysubst(_arguments, self._argmap_count) _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 delete(self, _object, _attributes={}, **_arguments): """delete: Delete an object. Required argument: the object for the command Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'delo' 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_duplicate = { 'to' : 'insh', 'with_properties' : 'prdt', } def duplicate(self, _object, _attributes={}, **_arguments): """duplicate: Copy object(s) and put the copies at a new location. Required argument: the object for the command Keyword argument to: The location for the new object(s). Keyword argument with_properties: Properties to be set in the new duplicated object(s). Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'clon' aetools.keysubst(_arguments, self._argmap_duplicate) _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 exists(self, _object, _attributes={}, **_arguments): """exists: Verify if an object exists. Required argument: the object for the command Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'core' _subcode = 'doex' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def get(self, _object, _attributes={}, **_arguments): """get: Get the data for an object. Required argument: the object for the command Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'core' _subcode = 'getd' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_make = { 'at' : 'insh', 'new' : 'kocl', 'with_data' : 'data', 'with_properties' : 'prdt', } def make(self, _no_object=None, _attributes={}, **_arguments): """make: Make a new object. Keyword argument at: The location at which to insert the object. Keyword argument new: The class of the new object. Keyword argument with_data: The initial data for the object. Keyword argument with_properties: The initial values for properties of the object. Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'core' _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) if _no_object != None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_move = { 'to' : 'insh', } def move(self, _object, _attributes={}, **_arguments): """move: Move object(s) to a new location. Required argument: the object for the command Keyword argument to: The new location for the object(s). Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'move' aetools.keysubst(_arguments, self._argmap_move) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def open(self, _object=None, _attributes={}, **_arguments): """open: Open an object. Required argument: list of objects Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'odoc' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def print_(self, _object=None, _attributes={}, **_arguments): """print: Print an object. Required argument: list of objects 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, _object, _attributes={}, **_arguments): """quit: Quit an application. Required argument: the object for the command Keyword argument saving: Specifies whether changes should be saved before quitting. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'quit' aetools.keysubst(_arguments, self._argmap_quit) _arguments['----'] = _object aetools.enumsubst(_arguments, 'savo', _Enum_savo) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_save = { 'in_' : 'kfil', 'as' : 'fltp', } def save(self, _object, _attributes={}, **_arguments): """save: Save an object. Required argument: the object for the command Keyword argument in_: The file in which to save the object. Keyword argument as: The file type in which to save the data. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'save' aetools.keysubst(_arguments, self._argmap_save) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_set = { 'to' : 'data', } def set(self, _object, _attributes={}, **_arguments): """set: Set an object's data. Required argument: the object for the command Keyword argument to: The new value. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'setd' aetools.keysubst(_arguments, self._argmap_set) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] class application(aetools.ComponentItem): """application - An application's top level scripting object. """ want = 'capp' class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' class frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' class name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' class version(aetools.NProperty): """version - The version of the application. """ which = 'vers' want = 'utxt' # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] applications = application class color(aetools.ComponentItem): """color - A color. """ want = 'colr' colors = color class document(aetools.ComponentItem): """document - A document. """ want = 'docu' class modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' class path(aetools.NProperty): """path - The document's path. """ which = 'ppth' want = 'utxt' documents = document class item(aetools.ComponentItem): """item - A scriptable object. """ want = 'cobj' class class_(aetools.NProperty): """class - The class of the object. """ which = 'pcls' want = 'type' class properties(aetools.NProperty): """properties - All of the object's properties. """ which = 'pALL' want = 'reco' items = item class window(aetools.ComponentItem): """window - A window. """ want = 'cwin' class bounds(aetools.NProperty): """bounds - The bounding rectangle of the window. """ which = 'pbnd' want = 'qdrt' class closeable(aetools.NProperty): """closeable - Whether the window has a close box. """ which = 'hclb' want = 'bool' class document(aetools.NProperty): """document - The document whose contents are being displayed in the window. """ which = 'docu' want = 'docu' class floating(aetools.NProperty): """floating - Whether the window floats. """ which = 'isfl' want = 'bool' class id(aetools.NProperty): """id - The unique identifier of the window. """ which = 'ID ' want = 'long' class index(aetools.NProperty): """index - The index of the window in the back-to-front window ordering. """ which = 'pidx' want = 'long' class miniaturizable(aetools.NProperty): """miniaturizable - Whether the window can be miniaturized. """ which = 'ismn' want = 'bool' class miniaturized(aetools.NProperty): """miniaturized - Whether the window is currently miniaturized. """ which = 'pmnd' want = 'bool' class modal(aetools.NProperty): """modal - Whether the window is the application's current modal window. """ which = 'pmod' want = 'bool' class resizable(aetools.NProperty): """resizable - Whether the window can be resized. """ which = 'prsz' want = 'bool' class titled(aetools.NProperty): """titled - Whether the window has a title bar. """ which = 'ptit' want = 'bool' class visible(aetools.NProperty): """visible - Whether the window is currently visible. """ which = 'pvis' want = 'bool' class zoomable(aetools.NProperty): """zoomable - Whether the window can be zoomed. """ which = 'iszm' want = 'bool' class zoomed(aetools.NProperty): """zoomed - Whether the window is currently zoomed. """ which = 'pzum' want = 'bool' windows = window application._superclassnames = ['item'] application._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'frontmost' : frontmost, 'name' : name, 'version' : version, } application._privelemdict = { 'document' : document, 'window' : window, } color._superclassnames = ['item'] color._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } color._privelemdict = { } document._superclassnames = ['item'] document._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'modified' : modified, 'name' : name, 'path' : path, } document._privelemdict = { } item._superclassnames = [] item._privpropdict = { 'class_' : class_, 'properties' : properties, } item._privelemdict = { } window._superclassnames = ['item'] window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'bounds' : bounds, 'closeable' : closeable, 'document' : document, 'floating' : floating, 'id' : id, 'index' : index, 'miniaturizable' : miniaturizable, 'miniaturized' : miniaturized, 'modal' : modal, 'name' : name, 'resizable' : resizable, 'titled' : titled, 'visible' : visible, 'zoomable' : zoomable, 'zoomed' : zoomed, } window._privelemdict = { } class _3c_(aetools.NComparison): """< - Less than """ class _3d_(aetools.NComparison): """= - Equal """ class _3e_(aetools.NComparison): """> - Greater than """ class contains(aetools.NComparison): """contains - Contains """ class ends_with(aetools.NComparison): """ends with - Ends with """ class starts_with(aetools.NComparison): """starts with - Starts with """ class _b2_(aetools.NComparison): """\xb2 - Less than or equal to """ class _b3_(aetools.NComparison): """\xb3 - Greater than or equal to """ _Enum_savo = { 'ask' : 'ask ', # Ask the user whether or not to save the file. 'yes' : 'yes ', # Save the file. 'no' : 'no ', # Do not save the file. } # # Indices of types declared in this module # _classdeclarations = { 'capp' : application, 'cobj' : item, 'colr' : color, 'cwin' : window, 'docu' : document, } _propdeclarations = { 'ID ' : id, 'c@#^' : _3c_Inheritance_3e_, 'docu' : document, 'hclb' : closeable, 'imod' : modified, 'isfl' : floating, 'ismn' : miniaturizable, 'iszm' : zoomable, 'pALL' : properties, 'pbnd' : bounds, 'pcls' : class_, 'pidx' : index, 'pisf' : frontmost, 'pmnd' : miniaturized, 'pmod' : modal, 'pnam' : name, 'ppth' : path, 'prsz' : resizable, 'ptit' : titled, 'pvis' : visible, 'pzum' : zoomed, 'vers' : version, } _compdeclarations = { '< ' : _3c_, '<= ' : _b2_, '= ' : _3d_, '> ' : _3e_, '>= ' : _b3_, 'bgwt' : starts_with, 'cont' : contains, 'ends' : ends_with, } _enumdeclarations = { 'savo' : _Enum_savo, } --- NEW FILE: Text_Suite.py --- """Suite Text Suite: A set of basic classes for text processing. Level 1, version 1 Generated from /Applications/Utilities/Terminal.app AETE/AEUT resource version 1/0, language 0, script 0 """ import aetools import MacOS _code = '????' class Text_Suite_Events: pass class attachment(aetools.ComponentItem): """attachment - Represents an inline text attachment. This class is used mainly for make commands. """ want = 'atts' class _3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'ctxt' class file_name(aetools.NProperty): """file name - The path to the file for the attachment """ which = 'atfn' want = 'utxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'cpar' as ['indx', 'rele', 'rang', 'test'] # element 'cwor' as ['indx', 'rele', 'rang', 'test'] class attribute_run(aetools.ComponentItem): """attribute run - This subdivides the text into chunks that all have the same attributes. """ want = 'catr' class color(aetools.NProperty): """color - The color of the first character. """ which = 'colr' want = 'colr' class font(aetools.NProperty): """font - The name of the font of the first character. """ which = 'font' want = 'utxt' class size(aetools.NProperty): """size - The size in points of the first character. """ which = 'ptsz' want = 'long' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'cpar' as ['indx', 'rele', 'rang', 'test'] # element 'cwor' as ['indx', 'rele', 'rang', 'test'] attribute_runs = attribute_run class character(aetools.ComponentItem): """character - This subdivides the text into characters. """ want = 'cha ' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'cpar' as ['indx', 'rele', 'rang', 'test'] # element 'cwor' as ['indx', 'rele', 'rang', 'test'] characters = character class paragraph(aetools.ComponentItem): """paragraph - This subdivides the text into paragraphs. """ want = 'cpar' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'cpar' as ['indx', 'rele', 'rang', 'test'] # element 'cwor' as ['indx', 'rele', 'rang', 'test'] paragraphs = paragraph class text(aetools.ComponentItem): """text - Rich (styled) text """ want = 'ctxt' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'cpar' as ['indx', 'rele', 'rang', 'test'] # element 'cwor' as ['indx', 'rele', 'rang', 'test'] class word(aetools.ComponentItem): """word - This subdivides the text into words. """ want = 'cwor' # element 'catr' as ['indx', 'rele', 'rang', 'test'] # element 'cha ' as ['indx', 'rele', 'rang', 'test'] # element 'cpar' as ['indx', 'rele', 'rang', 'test'] # element 'cwor' as ['indx', 'rele', 'rang', 'test'] words = word attachment._superclassnames = ['text'] attachment._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'file_name' : file_name, } attachment._privelemdict = { 'attribute_run' : attribute_run, 'character' : character, 'paragraph' : paragraph, 'word' : word, } import Standard_Suite attribute_run._superclassnames = ['item'] attribute_run._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'color' : color, 'font' : font, 'size' : size, } attribute_run._privelemdict = { 'attribute_run' : attribute_run, 'character' : character, 'paragraph' : paragraph, 'word' : word, } character._superclassnames = ['item'] character._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'color' : color, 'font' : font, 'size' : size, } character._privelemdict = { 'attribute_run' : attribute_run, 'character' : character, 'paragraph' : paragraph, 'word' : word, } paragraph._superclassnames = ['item'] paragraph._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'color' : color, 'font' : font, 'size' : size, } paragraph._privelemdict = { 'attribute_run' : attribute_run, 'character' : character, 'paragraph' : paragraph, 'word' : word, } text._superclassnames = ['item'] text._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'color' : color, 'font' : font, 'size' : size, } text._privelemdict = { 'attribute_run' : attribute_run, 'character' : character, 'paragraph' : paragraph, 'word' : word, } word._superclassnames = ['item'] word._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'color' : color, 'font' : font, 'size' : size, } word._privelemdict = { 'attribute_run' : attribute_run, 'character' : character, 'paragraph' : paragraph, 'word' : word, } # # Indices of types declared in this module # _classdeclarations = { 'atts' : attachment, 'catr' : attribute_run, 'cha ' : character, 'cpar' : paragraph, 'ctxt' : text, 'cwor' : word, } _propdeclarations = { 'atfn' : file_name, 'c@#^' : _3c_Inheritance_3e_, 'colr' : color, 'font' : font, 'ptsz' : size, } _compdeclarations = { } _enumdeclarations = { } Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Terminal_Suite.py 28 Mar 2003 23:38:00 -0000 1.4 --- Terminal_Suite.py 29 Mar 2003 00:13:17 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Applications/Utilities/Terminal.app/Contents/Resources/Terminal.rsrc AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Utilities/Terminal.app AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 13,24 **** class Terminal_Suite_Events: ! def count(self, _object=None, _attributes={}, **_arguments): ! """count: Return the number of elements of a particular class within an object ! Required argument: a reference to the objects to be counted Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the number of objects counted """ ! _code = 'core' ! _subcode = 'cnte' if _arguments: raise TypeError, 'No optional args expected' --- 13,23 ---- class Terminal_Suite_Events: ! def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Opens a telnet: URL ! Required argument: the object for the command Keyword argument _attributes: AppleEvent attribute dictionary """ ! _code = 'GURL' ! _subcode = 'GURL' if _arguments: raise TypeError, 'No optional args expected' *************** *** 35,48 **** _argmap_do_script = { - 'with_command' : 'cmnd', 'in_' : 'kfil', } def do_script(self, _object, _attributes={}, **_arguments): """do script: Run a UNIX shell script or command ! Required argument: data to be passed to the Terminal application as the command line ! Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter Keyword argument in_: the window in which to execute the command Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' --- 34,48 ---- _argmap_do_script = { 'in_' : 'kfil', + 'with_command' : 'cmnd', } def do_script(self, _object, _attributes={}, **_arguments): """do script: Run a UNIX shell script or command ! Required argument: the object for the command Keyword argument in_: the window in which to execute the command + Keyword argument with_command: data to be passed to the Terminal application as the command line, deprecated, use direct parameter Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the reply for the command """ _code = 'core' *************** *** 61,119 **** return _arguments['----'] - def quit(self, _no_object=None, _attributes={}, **_arguments): - """quit: Quit the Terminal application - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'aevt' - _subcode = 'quit' - - 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 run(self, _no_object=None, _attributes={}, **_arguments): - """run: Run the Terminal application - 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['----'] - class application(aetools.ComponentItem): """application - The Terminal program """ want = 'capp' ! class frontmost(aetools.NProperty): ! """frontmost - Is this the active application? """ ! which = 'pisf' ! want = 'bool' ! class name(aetools.NProperty): ! """name - the name of the application """ ! which = 'pnam' ! want = 'TEXT' ! class version(aetools.NProperty): ! """version - the version of the application """ ! which = 'vers' ! want = 'vers' ! # element 'cwin' as ['name', 'indx'] applications = application --- 61,78 ---- return _arguments['----'] class application(aetools.ComponentItem): """application - The Terminal program """ want = 'capp' ! class _3c_Inheritance_3e_(aetools.NProperty): ! """ - All of the properties of the superclass. """ ! which = 'c@#^' ! want = 'capp' ! class properties(aetools.NProperty): ! """properties - every property of the Terminal program """ ! which = 'pALL' ! want = '****' ! # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] ! # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] applications = application *************** *** 125,137 **** """background color - the background color for the window """ which = 'pbcl' ! want = 'TEXT' class bold_text_color(aetools.NProperty): """bold text color - the bold text color for the window """ which = 'pbtc' ! want = 'TEXT' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' ! want = 'qdrt' class busy(aetools.NProperty): """busy - Is the window busy running a process? """ --- 84,96 ---- """background color - the background color for the window """ which = 'pbcl' ! want = '****' class bold_text_color(aetools.NProperty): """bold text color - the bold text color for the window """ which = 'pbtc' ! want = '****' class bounds(aetools.NProperty): """bounds - the boundary rectangle for the window, relative to the upper left corner of the screen """ which = 'pbnd' ! want = '****' class busy(aetools.NProperty): """busy - Is the window busy running a process? """ *************** *** 141,193 **** """contents - the currently visible contents of the window """ which = 'pcnt' ! want = 'TEXT' class cursor_color(aetools.NProperty): """cursor color - the cursor color for the window """ which = 'pcuc' ! want = 'TEXT' class custom_title(aetools.NProperty): """custom title - the custom title for the window """ which = 'titl' ! want = 'TEXT' ! class floating(aetools.NProperty): ! """floating - Does the window float? """ ! which = 'isfl' ! want = 'bool' class frame(aetools.NProperty): """frame - the origin and size of the window """ which = 'pfra' ! want = 'list' ! class has_close_box(aetools.NProperty): ! """has close box - Does the window have a close box? """ ! which = 'hclb' ! want = 'bool' ! class has_title_bar(aetools.NProperty): ! """has title bar - Does the window have a title bar? """ ! which = 'ptit' want = 'bool' class history(aetools.NProperty): """history - the contents of the entire scrolling buffer of the window """ which = 'hist' ! want = 'TEXT' ! class index(aetools.NProperty): ! """index - the number of the window """ ! which = 'pidx' ! want = 'long' ! class miniaturizable(aetools.NProperty): ! """miniaturizable - Is the window miniaturizable? """ ! which = 'ismn' ! want = 'bool' ! class miniaturized(aetools.NProperty): ! """miniaturized - Is the window miniaturized? """ ! which = 'pmnd' ! want = 'bool' ! class modal(aetools.NProperty): ! """modal - Is the window modal? """ ! which = 'pmod' ! want = 'bool' class normal_text_color(aetools.NProperty): """normal text color - the normal text color for the window """ which = 'ptxc' ! want = 'TEXT' class number_of_columns(aetools.NProperty): """number of columns - the number of columns in the window """ --- 100,128 ---- """contents - the currently visible contents of the window """ which = 'pcnt' ! want = 'utxt' class cursor_color(aetools.NProperty): """cursor color - the cursor color for the window """ which = 'pcuc' ! want = '****' class custom_title(aetools.NProperty): """custom title - the custom title for the window """ which = 'titl' ! want = 'utxt' class frame(aetools.NProperty): """frame - the origin and size of the window """ which = 'pfra' ! want = '****' ! class frontmost(aetools.NProperty): ! """frontmost - Is the window in front of the other Terminal windows? """ ! which = 'pisf' want = 'bool' class history(aetools.NProperty): """history - the contents of the entire scrolling buffer of the window """ which = 'hist' ! want = 'utxt' class normal_text_color(aetools.NProperty): """normal text color - the normal text color for the window """ which = 'ptxc' ! want = '****' class number_of_columns(aetools.NProperty): """number of columns - the number of columns in the window """ *************** *** 201,221 **** """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ which = 'pori' ! want = 'list' class position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' ! want = 'QDpt' class processes(aetools.NProperty): """processes - a list of the currently running processes """ which = 'prcs' ! want = 'list' ! class resizable(aetools.NProperty): ! """resizable - Is the window resizable? """ ! which = 'prsz' ! want = 'bool' class size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' ! want = 'list' class title_displays_custom_title(aetools.NProperty): """title displays custom title - Does the title for the window contain a custom title? """ --- 136,152 ---- """origin - the lower left coordinates of the window, relative to the lower left corner of the screen """ which = 'pori' ! want = '****' class position(aetools.NProperty): """position - the upper left coordinates of the window, relative to the upper left corner of the screen """ which = 'ppos' ! want = '****' class processes(aetools.NProperty): """processes - a list of the currently running processes """ which = 'prcs' ! want = 'utxt' class size(aetools.NProperty): """size - the width and height of the window """ which = 'psiz' ! want = '****' class title_displays_custom_title(aetools.NProperty): """title displays custom title - Does the title for the window contain a custom title? """ *************** *** 238,266 **** which = 'tdws' want = 'bool' - class visible(aetools.NProperty): - """visible - Is the window visible? """ - which = 'pvis' - want = 'bool' - class zoomable(aetools.NProperty): - """zoomable - Is the window zoomable? """ - which = 'iszm' - want = 'bool' - class zoomed(aetools.NProperty): - """zoomed - Is the window zoomed? """ - which = 'pzum' - want = 'bool' windows = window application._superclassnames = [] application._privpropdict = { ! 'frontmost' : frontmost, ! 'name' : name, ! 'version' : version, } application._privelemdict = { 'window' : window, } window._superclassnames = [] window._privpropdict = { 'background_color' : background_color, 'bold_text_color' : bold_text_color, --- 169,187 ---- which = 'tdws' want = 'bool' windows = window application._superclassnames = [] + import Standard_Suite application._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'properties' : properties, } application._privelemdict = { + 'document' : Standard_Suite.document, 'window' : window, } window._superclassnames = [] window._privpropdict = { + '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'background_color' : background_color, 'bold_text_color' : bold_text_color, *************** *** 270,284 **** 'cursor_color' : cursor_color, 'custom_title' : custom_title, - 'floating' : floating, 'frame' : frame, 'frontmost' : frontmost, - 'has_close_box' : has_close_box, - 'has_title_bar' : has_title_bar, 'history' : history, - 'index' : index, - 'miniaturizable' : miniaturizable, - 'miniaturized' : miniaturized, - 'modal' : modal, - 'name' : name, 'normal_text_color' : normal_text_color, 'number_of_columns' : number_of_columns, --- 191,197 ---- *************** *** 287,291 **** 'position' : position, 'processes' : processes, ! 'resizable' : resizable, 'size' : size, 'title_displays_custom_title' : title_displays_custom_title, --- 200,204 ---- 'position' : position, 'processes' : processes, ! 'properties' : properties, 'size' : size, 'title_displays_custom_title' : title_displays_custom_title, *************** *** 294,300 **** 'title_displays_shell_path' : title_displays_shell_path, 'title_displays_window_size' : title_displays_window_size, - 'visible' : visible, - 'zoomable' : zoomable, - 'zoomed' : zoomed, } window._privelemdict = { --- 207,210 ---- *************** *** 311,321 **** _propdeclarations = { 'busy' : busy, 'ccol' : number_of_columns, 'crow' : number_of_rows, - 'hclb' : has_close_box, 'hist' : history, ! 'isfl' : floating, ! 'ismn' : miniaturizable, ! 'iszm' : zoomable, 'pbcl' : background_color, 'pbnd' : bounds, --- 221,229 ---- _propdeclarations = { 'busy' : busy, + 'c@#^' : _3c_Inheritance_3e_, 'ccol' : number_of_columns, 'crow' : number_of_rows, 'hist' : history, ! 'pALL' : properties, 'pbcl' : background_color, 'pbnd' : bounds, *************** *** 324,341 **** 'pcuc' : cursor_color, 'pfra' : frame, - 'pidx' : index, 'pisf' : frontmost, - 'pmnd' : miniaturized, - 'pmod' : modal, - 'pnam' : name, 'pori' : origin, 'ppos' : position, 'prcs' : processes, - 'prsz' : resizable, 'psiz' : size, - 'ptit' : has_title_bar, 'ptxc' : normal_text_color, - 'pvis' : visible, - 'pzum' : zoomed, 'tdct' : title_displays_custom_title, 'tddn' : title_displays_device_name, --- 232,241 ---- *************** *** 344,348 **** 'tdws' : title_displays_window_size, 'titl' : custom_title, - 'vers' : version, } --- 244,247 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 28 Mar 2003 23:38:00 -0000 1.4 --- __init__.py 29 Mar 2003 00:13:17 -0000 1.5 *************** *** 1,14 **** """ ! Package generated from /Applications/Utilities/Terminal.app/Contents/Resources/Terminal.rsrc ! Resource aete resid 0 Terminal Terminology """ import aetools Error = aetools.Error ! import Invisible_Suite import Terminal_Suite _code_to_module = { ! 'tpnm' : Invisible_Suite, 'trmx' : Terminal_Suite, } --- 1,15 ---- """ ! Package generated from /Applications/Utilities/Terminal.app """ import aetools Error = aetools.Error ! import Standard_Suite ! import Text_Suite import Terminal_Suite _code_to_module = { ! '????' : Standard_Suite, ! '????' : Text_Suite, 'trmx' : Terminal_Suite, } *************** *** 17,25 **** _code_to_fullname = { ! 'tpnm' : ('Terminal.Invisible_Suite', 'Invisible_Suite'), 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), } ! from Invisible_Suite import * from Terminal_Suite import * --- 18,28 ---- _code_to_fullname = { ! '????' : ('Terminal.Standard_Suite', 'Standard_Suite'), ! '????' : ('Terminal.Text_Suite', 'Text_Suite'), 'trmx' : ('Terminal.Terminal_Suite', 'Terminal_Suite'), } ! from Standard_Suite import * ! from Text_Suite import * from Terminal_Suite import * *************** *** 43,87 **** getbaseclasses(window) getbaseclasses(application) getbaseclasses(application) ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) ! getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.color_table) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) ! getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.machine_location) ! getbaseclasses(StdSuites.Type_Names_Suite.menu_item) ! getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) ! getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.menu) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) ! getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) ! getbaseclasses(StdSuites.Type_Names_Suite.rotation) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) ! getbaseclasses(StdSuites.Type_Names_Suite.long_point) ! getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) ! getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.extended_real) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) ! getbaseclasses(StdSuites.Type_Names_Suite.point) ! getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) # --- 46,60 ---- getbaseclasses(window) getbaseclasses(application) + getbaseclasses(character) + getbaseclasses(attachment) + getbaseclasses(paragraph) + getbaseclasses(word) + getbaseclasses(attribute_run) + getbaseclasses(text) + getbaseclasses(color) + getbaseclasses(window) getbaseclasses(application) ! getbaseclasses(item) ! getbaseclasses(document) # *************** *** 91,139 **** 'cwin' : window, 'capp' : application, 'capp' : application, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } ! class Terminal(Invisible_Suite_Events, Terminal_Suite_Events, aetools.TalkTo): --- 64,83 ---- 'cwin' : window, 'capp' : application, + 'cha ' : character, + 'atts' : attachment, + 'cpar' : paragraph, + 'cwor' : word, + 'catr' : attribute_run, + 'ctxt' : text, + 'colr' : color, + 'cwin' : window, 'capp' : application, ! 'cobj' : item, ! 'docu' : document, } ! class Terminal(Standard_Suite_Events, ! Text_Suite_Events, Terminal_Suite_Events, aetools.TalkTo): --- Invisible_Suite.py DELETED --- From jackjansen@users.sourceforge.net Sat Mar 29 00:13:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:13:43 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior __init__.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv7382/CodeWarrior Modified Files: __init__.py Log Message: Regenerated with the new way to get terminology (through AppleEvents), which sometimes seems to result in different terminology. It does seem to be mostly compatible, though. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 28 Mar 2003 23:37:55 -0000 1.4 --- __init__.py 29 Mar 2003 00:13:10 -0000 1.5 *************** *** 1,5 **** """ Package generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 - Resource aete resid 0 AppleEvent Suites """ import aetools --- 1,4 ---- *************** *** 58,78 **** getbaseclasses(insertion_point) getbaseclasses(document) - getbaseclasses(single_class_browser) - getbaseclasses(project_document) - getbaseclasses(symbol_browser) - getbaseclasses(editor_document) - getbaseclasses(file_compare_document) - getbaseclasses(class_browser) - getbaseclasses(subtarget) - getbaseclasses(message_document) - getbaseclasses(project_inspector) - getbaseclasses(text_document) - getbaseclasses(catalog_document) - getbaseclasses(class_hierarchy) - getbaseclasses(target) - getbaseclasses(build_progress_document) - getbaseclasses(target_file) - getbaseclasses(ToolServer_worksheet) - getbaseclasses(single_class_hierarchy) getbaseclasses(File_Mapping) getbaseclasses(browser_catalog) --- 57,60 ---- *************** *** 111,114 **** --- 93,113 ---- getbaseclasses(Debugger_Display) getbaseclasses(class_) + getbaseclasses(single_class_browser) + getbaseclasses(project_document) + getbaseclasses(symbol_browser) + getbaseclasses(editor_document) + getbaseclasses(file_compare_document) + getbaseclasses(class_browser) + getbaseclasses(subtarget) + getbaseclasses(message_document) + getbaseclasses(project_inspector) + getbaseclasses(text_document) + getbaseclasses(catalog_document) + getbaseclasses(class_hierarchy) + getbaseclasses(target) + getbaseclasses(build_progress_document) + getbaseclasses(target_file) + getbaseclasses(ToolServer_worksheet) + getbaseclasses(single_class_hierarchy) # *************** *** 125,145 **** 'cins' : insertion_point, 'docu' : document, - '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, 'FMap' : File_Mapping, 'Cata' : browser_catalog, --- 124,127 ---- *************** *** 178,181 **** --- 160,180 ---- 'DbDS' : Debugger_Display, 'Clas' : class_, + '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, } From jackjansen@users.sourceforge.net Sat Mar 29 00:13:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:13:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Microsoft_Internet_Explorer.py,1.3,1.4 Netscape_Suite.py,1.2,1.3 Required_Suite.py,1.3,1.4 Standard_Suite.py,1.2,1.3 URL_Suite.py,1.2,1.3 Web_Browser_Suite.py,1.3,1.4 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv7382/Explorer Modified Files: Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py Standard_Suite.py URL_Suite.py Web_Browser_Suite.py __init__.py Log Message: Regenerated with the new way to get terminology (through AppleEvents), which sometimes seems to result in different terminology. It does seem to be mostly compatible, though. Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Microsoft_Internet_Explorer.py 28 Mar 2003 22:07:17 -0000 1.3 --- Microsoft_Internet_Explorer.py 29 Mar 2003 00:13:11 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Internet Explorer.app AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Netscape_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Netscape_Suite.py 29 Mar 2003 00:13:11 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Internet Explorer.app AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Required_Suite.py 28 Mar 2003 22:07:17 -0000 1.3 --- Required_Suite.py 29 Mar 2003 00:13:11 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Internet Explorer.app AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Standard_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- Standard_Suite.py 29 Mar 2003 00:13:11 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Internet Explorer.app AETE/AEUT resource version 1/0, language 0, script 0 """ Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** URL_Suite.py 23 Mar 2003 22:07:27 -0000 1.2 --- URL_Suite.py 29 Mar 2003 00:13:12 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Internet Explorer.app AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Web_Browser_Suite.py 28 Mar 2003 22:07:17 -0000 1.3 --- Web_Browser_Suite.py 29 Mar 2003 00:13:12 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Applications/Internet Explorer.app AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 28 Mar 2003 22:07:17 -0000 1.3 --- __init__.py 29 Mar 2003 00:13:12 -0000 1.4 *************** *** 1,5 **** """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer ! Resource aete resid 0 """ import aetools --- 1,4 ---- """ ! Package generated from /Applications/Internet Explorer.app """ import aetools From jackjansen@users.sourceforge.net Sat Mar 29 00:13:47 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:13:47 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv7382/Netscape Modified Files: __init__.py Log Message: Regenerated with the new way to get terminology (through AppleEvents), which sometimes seems to result in different terminology. It does seem to be mostly compatible, though. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 28 Mar 2003 22:07:20 -0000 1.3 --- __init__.py 29 Mar 2003 00:13:15 -0000 1.4 *************** *** 1,5 **** """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicatorâ„¢ Folder/Netscape Communicatorâ„¢ ! Resource aete resid 0 """ import aetools --- 1,4 ---- """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 """ import aetools *************** *** 63,72 **** getbaseclasses(window) getbaseclasses(application) ! getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.character) getbaseclasses(StdSuites.Text_Suite.text_style_info) - getbaseclasses(StdSuites.Text_Suite.word) - getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.line) getbaseclasses(StdSuites.Text_Suite.text) getbaseclasses(text) --- 62,71 ---- getbaseclasses(window) getbaseclasses(application) ! getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.character) getbaseclasses(StdSuites.Text_Suite.text_style_info) getbaseclasses(StdSuites.Text_Suite.line) + getbaseclasses(StdSuites.Text_Suite.word) + getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.text) getbaseclasses(text) *************** *** 79,88 **** 'cwin' : window, 'capp' : application, ! 'cpar' : StdSuites.Text_Suite.paragraph, 'cha ' : StdSuites.Text_Suite.character, 'tsty' : StdSuites.Text_Suite.text_style_info, - 'cwor' : StdSuites.Text_Suite.word, - 'cflo' : StdSuites.Text_Suite.text_flow, 'clin' : StdSuites.Text_Suite.line, 'ctxt' : StdSuites.Text_Suite.text, 'ctxt' : text, --- 78,87 ---- 'cwin' : window, 'capp' : application, ! 'cflo' : StdSuites.Text_Suite.text_flow, 'cha ' : StdSuites.Text_Suite.character, 'tsty' : StdSuites.Text_Suite.text_style_info, 'clin' : StdSuites.Text_Suite.line, + 'cwor' : StdSuites.Text_Suite.word, + 'cpar' : StdSuites.Text_Suite.paragraph, 'ctxt' : StdSuites.Text_Suite.text, 'ctxt' : text, From jackjansen@users.sourceforge.net Sat Mar 29 00:13:48 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:13:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Files.py,NONE,1.1 Legacy_suite.py,NONE,1.1 Containers_and_folders.py,1.4,1.5 Enumerations.py,1.4,1.5 Finder_Basics.py,1.3,1.4 Finder_items.py,1.3,1.4 Standard_Suite.py,1.3,1.4 Type_Definitions.py,1.4,1.5 Window_classes.py,1.4,1.5 __init__.py,1.4,1.5 Earlier_terms.py,1.4,NONE Files_and_suitcases.py,1.4,NONE Obsolete_terms.py,1.3,NONE Process_classes.py,1.4,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv7382/Finder Modified Files: Containers_and_folders.py Enumerations.py Finder_Basics.py Finder_items.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Added Files: Files.py Legacy_suite.py Removed Files: Earlier_terms.py Files_and_suitcases.py Obsolete_terms.py Process_classes.py Log Message: Regenerated with the new way to get terminology (through AppleEvents), which sometimes seems to result in different terminology. It does seem to be mostly compatible, though. --- NEW FILE: Files.py --- """Suite Files: Classes representing files Level 1, version 1 Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ import aetools import MacOS _code = 'fndr' class Files_Events: pass class alias_file(aetools.ComponentItem): """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the file class """ which = 'c@#^' want = 'file' class original_item(aetools.NProperty): """original item - the original item pointed to by the alias """ which = 'orig' want = 'obj ' alias_files = alias_file class application_file(aetools.ComponentItem): """application file - An application's file on disk """ want = 'appf' class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the application high-level event aware? (OBSOLETE: always returns true) """ which = 'isab' want = 'bool' class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' class minimum_size(aetools.NProperty): """minimum size - the smallest memory size with which the application can be launched """ which = 'mprt' want = 'long' class opens_in_Classic(aetools.NProperty): """opens in Classic - Should the application launch in the Classic environment? """ which = 'Clsc' want = 'bool' class preferred_size(aetools.NProperty): """preferred size - the memory size with which the application will be launched """ which = 'appt' want = 'long' class suggested_size(aetools.NProperty): """suggested size - the memory size with which the developer recommends the application be launched """ which = 'sprt' want = 'long' application_files = application_file class clipping(aetools.ComponentItem): """clipping - A clipping """ want = 'clpf' class clipping_window(aetools.NProperty): """clipping window - (NOT AVAILABLE YET) the clipping window for this clipping """ which = 'lwnd' want = 'obj ' clippings = clipping class document_file(aetools.ComponentItem): """document file - A document file """ want = 'docf' document_files = document_file class file(aetools.ComponentItem): """file - A file """ want = 'file' class creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'type' class file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the item """ which = 'asty' want = 'type' class product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'utxt' class stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' class version(aetools.NProperty): """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' want = 'utxt' files = file class internet_location_file(aetools.ComponentItem): """internet location file - An file containing an internet location """ want = 'inlf' class location(aetools.NProperty): """location - the internet location """ which = 'iloc' want = 'utxt' internet_location_files = internet_location_file class package(aetools.ComponentItem): """package - A package """ want = 'pack' packages = package alias_file._superclassnames = ['file'] alias_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'original_item' : original_item, } alias_file._privelemdict = { } application_file._superclassnames = ['file'] application_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'accepts_high_level_events' : accepts_high_level_events, 'has_scripting_terminology' : has_scripting_terminology, 'minimum_size' : minimum_size, 'opens_in_Classic' : opens_in_Classic, 'preferred_size' : preferred_size, 'suggested_size' : suggested_size, } application_file._privelemdict = { } clipping._superclassnames = ['file'] clipping._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'clipping_window' : clipping_window, } clipping._privelemdict = { } document_file._superclassnames = ['file'] document_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } document_file._privelemdict = { } import Finder_items file._superclassnames = ['item'] file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'creator_type' : creator_type, 'file_type' : file_type, 'product_version' : product_version, 'stationery' : stationery, 'version' : version, } file._privelemdict = { } internet_location_file._superclassnames = ['file'] internet_location_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'location' : location, } internet_location_file._privelemdict = { } package._superclassnames = ['item'] package._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } package._privelemdict = { } # # Indices of types declared in this module # _classdeclarations = { 'alia' : alias_file, 'appf' : application_file, 'clpf' : clipping, 'docf' : document_file, 'file' : file, 'inlf' : internet_location_file, 'pack' : package, } _propdeclarations = { 'Clsc' : opens_in_Classic, 'appt' : preferred_size, 'asty' : file_type, 'c@#^' : _3c_Inheritance_3e_, 'fcrt' : creator_type, 'hscr' : has_scripting_terminology, 'iloc' : location, 'isab' : accepts_high_level_events, 'lwnd' : clipping_window, 'mprt' : minimum_size, 'orig' : original_item, 'pspd' : stationery, 'sprt' : suggested_size, 'ver2' : product_version, 'vers' : version, } _compdeclarations = { } _enumdeclarations = { } --- NEW FILE: Legacy_suite.py --- """Suite Legacy suite: Operations formerly handled by the Finder, but now automatically delegated to other applications Level 1, version 1 Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ import aetools import MacOS _code = 'fleg' class Legacy_suite_Events: def restart(self, _no_object=None, _attributes={}, **_arguments): """restart: Restart the computer Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'rest' 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 shut_down(self, _no_object=None, _attributes={}, **_arguments): """shut down: Shut Down the computer Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'shut' 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 sleep(self, _no_object=None, _attributes={}, **_arguments): """sleep: Put the computer to sleep Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'slep' 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['----'] class application(aetools.ComponentItem): """application - The Finder """ want = 'capp' class desktop_picture(aetools.NProperty): """desktop picture - the desktop picture of the main monitor """ which = 'dpic' want = 'file' class application_process(aetools.ComponentItem): """application process - A process launched from an application file """ want = 'pcap' class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the process class """ which = 'c@#^' want = 'prcs' class application_file(aetools.NProperty): """application file - the application file from which this process was launched """ which = 'appf' want = 'appf' application_processes = application_process class desk_accessory_process(aetools.ComponentItem): """desk accessory process - A process launched from a desk accessory file """ want = 'pcda' class desk_accessory_file(aetools.NProperty): """desk accessory file - the desk accessory file from which this process was launched """ which = 'dafi' want = 'obj ' desk_accessory_processes = desk_accessory_process class process(aetools.ComponentItem): """process - A process running on this computer """ want = 'prcs' class accepts_high_level_events(aetools.NProperty): """accepts high level events - Is the process high-level event aware (accepts open application, open document, print document, and quit)? """ which = 'isab' want = 'bool' class accepts_remote_events(aetools.NProperty): """accepts remote events - Does the process accept remote events? """ which = 'revt' want = 'bool' class creator_type(aetools.NProperty): """creator type - the OSType of the creator of the process (the signature) """ which = 'fcrt' want = 'type' class file(aetools.NProperty): """file - the file from which the process was launched """ which = 'file' want = 'obj ' class file_type(aetools.NProperty): """file type - the OSType of the file type of the process """ which = 'asty' want = 'type' class frontmost(aetools.NProperty): """frontmost - Is the process the frontmost process? """ which = 'pisf' want = 'bool' class has_scripting_terminology(aetools.NProperty): """has scripting terminology - Does the process have a scripting terminology, i.e., can it be scripted? """ which = 'hscr' want = 'bool' class name(aetools.NProperty): """name - the name of the process """ which = 'pnam' want = 'itxt' class partition_space_used(aetools.NProperty): """partition space used - the number of bytes currently used in the process' partition """ which = 'pusd' want = 'long' class total_partition_size(aetools.NProperty): """total partition size - the size of the partition with which the process was launched """ which = 'appt' want = 'long' class visible(aetools.NProperty): """visible - Is the process' layer visible? """ which = 'pvis' want = 'bool' processes = process application._superclassnames = [] application._privpropdict = { 'desktop_picture' : desktop_picture, } application._privelemdict = { } application_process._superclassnames = ['process'] application_process._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'application_file' : application_file, } application_process._privelemdict = { } desk_accessory_process._superclassnames = ['process'] desk_accessory_process._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'desk_accessory_file' : desk_accessory_file, } desk_accessory_process._privelemdict = { } process._superclassnames = [] process._privpropdict = { 'accepts_high_level_events' : accepts_high_level_events, 'accepts_remote_events' : accepts_remote_events, 'creator_type' : creator_type, 'file' : file, 'file_type' : file_type, 'frontmost' : frontmost, 'has_scripting_terminology' : has_scripting_terminology, 'name' : name, 'partition_space_used' : partition_space_used, 'total_partition_size' : total_partition_size, 'visible' : visible, } process._privelemdict = { } # # Indices of types declared in this module # _classdeclarations = { 'capp' : application, 'pcap' : application_process, 'pcda' : desk_accessory_process, 'prcs' : process, } _propdeclarations = { 'appf' : application_file, 'appt' : total_partition_size, 'asty' : file_type, 'c@#^' : _3c_Inheritance_3e_, 'dafi' : desk_accessory_file, 'dpic' : desktop_picture, 'fcrt' : creator_type, 'file' : file, 'hscr' : has_scripting_terminology, 'isab' : accepts_high_level_events, 'pisf' : frontmost, 'pnam' : name, 'pusd' : partition_space_used, 'pvis' : visible, 'revt' : accepts_remote_events, } _compdeclarations = { } _enumdeclarations = { } Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Containers_and_folders.py 28 Mar 2003 23:37:56 -0000 1.4 --- Containers_and_folders.py 29 Mar 2003 00:13:12 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 24,30 **** want = 'cobj' class completely_expanded(aetools.NProperty): ! """completely expanded - Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ which = 'pexc' want = 'bool' class entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ --- 24,34 ---- want = 'cobj' class completely_expanded(aetools.NProperty): ! """completely expanded - (NOT AVAILABLE YET) Are the container and all of its children opened as outlines? (can only be set for containers viewed as lists) """ which = 'pexc' want = 'bool' + class container_window(aetools.NProperty): + """container window - the container window for this folder """ + which = 'cwnd' + want = 'obj ' class entire_contents(aetools.NProperty): """entire contents - the entire contents of the container, including the contents of its children """ *************** *** 32,54 **** want = 'obj ' class expandable(aetools.NProperty): ! """expandable - Is the container capable of being expanded as an outline? """ which = 'pexa' want = 'bool' class expanded(aetools.NProperty): ! """expanded - Is the container opened as an outline? (can only be set for containers viewed as lists) """ which = 'pexp' want = 'bool' - class icon_size(aetools.NProperty): - """icon size - ... alternatively, you can specify the icons size as a constant """ - which = 'lvis' - want = 'isiz' - class selection(aetools.NProperty): - """selection - the selection visible to the user """ - which = 'sele' - want = 'obj ' - 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 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 36,46 ---- want = 'obj ' class expandable(aetools.NProperty): ! """expandable - (NOT AVAILABLE YET) Is the container capable of being expanded as an outline? """ which = 'pexa' want = 'bool' class expanded(aetools.NProperty): ! """expanded - (NOT AVAILABLE YET) Is the container opened as an outline? (can only be set for containers viewed as lists) """ which = 'pexp' want = 'bool' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] *************** *** 57,71 **** # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] containers = container --- 49,56 ---- *************** *** 74,85 **** """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ want = 'cdsk' - class startup_disk(aetools.NProperty): - """startup disk - the startup disk """ - which = 'sdsk' - want = 'cdis' - class trash(aetools.NProperty): - """trash - the trash """ - which = 'trsh' - want = 'ctrs' # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] --- 59,62 ---- *************** *** 89,103 **** # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] class disk(aetools.ComponentItem): --- 66,73 ---- *************** *** 107,119 **** """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' ! want = 'long' class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' class free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' ! want = 'long' class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ --- 77,97 ---- """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' ! want = 'comp' class ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' + class format(aetools.NProperty): + """format - the filesystem format of this disk """ + which = 'dfmt' + want = 'edfm' class free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' ! want = 'comp' ! class ignore_privileges(aetools.NProperty): ! """ignore privileges - Ignore permissions on this disk? """ ! which = 'igpr' ! want = 'bool' class local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ *************** *** 130,144 **** # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] disks = disk --- 108,115 ---- *************** *** 153,249 **** # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] folders = folder - class sharable_container(aetools.ComponentItem): - """sharable container - A container that may be shared (disks and folders) """ - want = 'sctr' - class exported(aetools.NProperty): - """exported - Is the container a share point or inside a share point, i.e., can the container be shared? (file sharing must be on to use this property) """ - which = 'sexp' - want = 'bool' - class group(aetools.NProperty): - """group - the user or group that has special access to the container (file sharing must be on to use this property) """ - which = 'sgrp' - want = 'itxt' - class group_privileges(aetools.NProperty): - """group privileges - the see folders/see files/make changes privileges for the group (file sharing must be on to use this property) """ - which = 'gppr' - want = 'priv' - class guest_privileges(aetools.NProperty): - """guest privileges - the see folders/see files/make changes privileges for everyone (file sharing must be on to use this property) """ - which = 'gstp' - want = 'priv' - class mounted(aetools.NProperty): - """mounted - Is the container mounted on another machine's desktop? (file sharing must be on to use this property) """ - which = 'smou' - want = 'bool' - class owner(aetools.NProperty): - """owner - the user that owns the container (file sharing must be on to use this property) """ - which = 'sown' - want = 'itxt' - class owner_privileges(aetools.NProperty): - """owner privileges - the see folders/see files/make changes privileges for the owner (file sharing must be on to use this property) """ - which = 'ownr' - want = 'priv' - class privileges_inherited(aetools.NProperty): - """privileges inherited - Are the privileges of the container always the same as the container in which it is stored? (file sharing must be on to use this property) """ - which = 'iprv' - want = 'bool' - class protected(aetools.NProperty): - """protected - Is the container protected from being moved, renamed and deleted? (file sharing must be on to use this property) """ - which = 'spro' - want = 'bool' - class shared(aetools.NProperty): - """shared - Is the container a share point, i.e., is the container currently being shared? (file sharing must be on to use this property) """ - which = 'shar' - want = 'bool' - # element 'alia' as ['indx', 'name'] - # element 'appf' as ['indx', 'name', 'ID '] - # element 'cfol' as ['indx', 'name', 'ID '] - # element 'clpf' as ['indx', 'name'] - # element 'cobj' as ['indx', 'name'] - # element 'ctnr' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] - # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] - # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] - # element 'inlf' as ['indx', 'name'] - # element 'pack' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] - - sharable_containers = sharable_container - - class sharing_privileges(aetools.ComponentItem): - """sharing privileges - A set of sharing properties (used in sharable containers) """ - want = 'priv' - class make_changes(aetools.NProperty): - """make changes - Can changes be made? """ - which = 'prvw' - want = 'bool' - class see_files(aetools.NProperty): - """see files - Can files be seen? """ - which = 'prvr' - want = 'bool' - class see_folders(aetools.NProperty): - """see folders - Can folders be seen? """ - which = 'prvs' - want = 'bool' - class trash_2d_object(aetools.ComponentItem): """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ --- 124,134 ---- *************** *** 259,423 **** # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] ! # element 'sctr' as ['indx', 'name'] ! # element 'sndf' as ['indx', 'name'] ! # element 'stcs' as ['indx', 'name'] ! import Earlier_terms container._superclassnames = ['item'] ! import Files_and_suitcases container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'completely_expanded' : completely_expanded, 'entire_contents' : entire_contents, 'expandable' : expandable, 'expanded' : expanded, - 'icon_size' : icon_size, - 'icon_size' : icon_size, - 'selection' : selection, - 'view_options_window' : view_options_window, } container._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Earlier_terms.application_file, ! 'clipping' : Files_and_suitcases.clipping, 'container' : container, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, 'folder' : folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'sharable_container' : sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, } desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'startup_disk' : startup_disk, - 'trash' : trash, } desktop_2d_object._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Earlier_terms.application_file, ! 'clipping' : Files_and_suitcases.clipping, 'container' : container, - 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, 'disk' : disk, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, 'folder' : folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'sharable_container' : sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, } ! disk._superclassnames = ['sharable_container'] disk._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'capacity' : capacity, 'ejectable' : ejectable, 'free_space' : free_space, 'local_volume' : local_volume, 'startup' : startup, } disk._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Earlier_terms.application_file, ! 'clipping' : Files_and_suitcases.clipping, 'container' : container, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, 'folder' : folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'sharable_container' : sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, } ! folder._superclassnames = ['sharable_container'] folder._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } folder._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Earlier_terms.application_file, ! 'clipping' : Files_and_suitcases.clipping, ! 'container' : container, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, ! 'folder' : folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'sharable_container' : sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, ! } ! sharable_container._superclassnames = ['container'] ! sharable_container._privpropdict = { ! '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, ! 'exported' : exported, ! 'group' : group, ! 'group_privileges' : group_privileges, ! 'guest_privileges' : guest_privileges, ! 'mounted' : mounted, ! 'owner' : owner, ! 'owner_privileges' : owner_privileges, ! 'privileges_inherited' : privileges_inherited, ! 'protected' : protected, ! 'shared' : shared, ! } ! sharable_container._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Earlier_terms.application_file, ! 'clipping' : Files_and_suitcases.clipping, 'container' : container, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, 'folder' : folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'sharable_container' : sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, ! } ! sharing_privileges._superclassnames = [] ! sharing_privileges._privpropdict = { ! 'make_changes' : make_changes, ! 'see_files' : see_files, ! 'see_folders' : see_folders, ! } ! sharing_privileges._privelemdict = { } trash_2d_object._superclassnames = ['container'] --- 144,229 ---- # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] # element 'file' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] ! import Finder_items container._superclassnames = ['item'] ! import Files container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'completely_expanded' : completely_expanded, + 'container_window' : container_window, 'entire_contents' : entire_contents, 'expandable' : expandable, 'expanded' : expanded, } container._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } desktop_2d_object._superclassnames = ['container'] desktop_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } desktop_2d_object._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, 'container' : container, 'disk' : disk, ! 'document_file' : Files.document_file, ! 'file' : Files.file, 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } ! disk._superclassnames = ['container'] disk._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'capacity' : capacity, 'ejectable' : ejectable, + 'format' : format, 'free_space' : free_space, + 'ignore_privileges' : ignore_privileges, 'local_volume' : local_volume, 'startup' : startup, } disk._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } ! folder._superclassnames = ['container'] folder._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } folder._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } trash_2d_object._superclassnames = ['container'] *************** *** 427,447 **** } trash_2d_object._privelemdict = { ! 'accessory_suitcase' : Earlier_terms.accessory_suitcase, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Earlier_terms.application_file, ! 'clipping' : Files_and_suitcases.clipping, 'container' : container, ! 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, 'folder' : folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'internet_location' : Earlier_terms.internet_location, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'sharable_container' : sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, } --- 233,246 ---- } trash_2d_object._privelemdict = { ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, 'container' : container, ! 'document_file' : Files.document_file, ! 'file' : Files.file, 'folder' : folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, } *************** *** 455,460 **** 'ctnr' : container, 'ctrs' : trash_2d_object, - 'priv' : sharing_privileges, - 'sctr' : sharable_container, } --- 254,257 ---- *************** *** 462,491 **** 'c@#^' : _3c_Inheritance_3e_, 'capa' : capacity, 'ects' : entire_contents, 'frsp' : free_space, ! 'gppr' : group_privileges, ! 'gstp' : guest_privileges, ! 'iprv' : privileges_inherited, 'isej' : ejectable, 'isrv' : local_volume, 'istd' : startup, - 'lvis' : icon_size, - 'ownr' : owner_privileges, 'pexa' : expandable, 'pexc' : completely_expanded, 'pexp' : expanded, - 'prvr' : see_files, - 'prvs' : see_folders, - 'prvw' : make_changes, - 'sdsk' : startup_disk, - 'sele' : selection, - 'sexp' : exported, - 'sgrp' : group, - 'shar' : shared, - 'smou' : mounted, - 'sown' : owner, - 'spro' : protected, - 'trsh' : trash, - 'vwnd' : view_options_window, 'warn' : warns_before_emptying, } --- 259,273 ---- 'c@#^' : _3c_Inheritance_3e_, 'capa' : capacity, + 'cwnd' : container_window, + 'dfmt' : format, 'ects' : entire_contents, 'frsp' : free_space, ! 'igpr' : ignore_privileges, 'isej' : ejectable, 'isrv' : local_volume, 'istd' : startup, 'pexa' : expandable, 'pexc' : completely_expanded, 'pexp' : expanded, 'warn' : warns_before_emptying, } Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Enumerations.py 28 Mar 2003 23:37:56 -0000 1.4 --- Enumerations.py 29 Mar 2003 00:13:13 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 27,48 **** } ! _Enum_ese0 = { ! 'starting_up' : 'ese2', # ! 'running' : 'ese3', # ! 'rebuilding_desktop' : 'ese5', # ! 'copying' : 'ese4', # ! 'restarting' : 'ese6', # ! 'quitting' : 'ese7', # } ! _Enum_gsen = { ! 'CPU' : 'proc', # ! 'FPU' : 'fpu ', # ! 'MMU' : 'mmu ', # ! 'hardware' : 'hdwr', # ! 'operating_system' : 'os ', # ! 'sound_system' : 'snd ', # ! 'memory_available' : 'lram', # ! 'memory_installed' : 'ram ', # } --- 27,65 ---- } ! _Enum_ecvw = { ! 'icon_view' : 'icnv', # ! 'list_view' : 'lsvw', # ! 'column_view' : 'clvw', # } ! _Enum_edfm = { ! 'Mac_OS_format' : 'dfhf', # ! 'Mac_OS_Extended_format' : 'dfh+', # ! 'UFS_format' : 'dfuf', # ! 'NFS_format' : 'dfnf', # ! 'audio_format' : 'dfau', # ! 'ProDOS_format' : 'dfpr', # ! 'MS_2d_DOS_format' : 'dfms', # ! 'ISO_9660_format' : 'df96', # ! 'High_Sierra_format' : 'dfhs', # ! 'QuickTake_format' : 'dfqt', # ! 'Apple_Photo_format' : 'dfph', # ! 'AppleShare_format' : 'dfas', # ! 'UDF_format' : 'dfud', # ! 'WebDAV_format' : 'dfwd', # ! 'FTP_format' : 'dfft', # ! 'Packet_2d_written_UDF_format' : 'dfpu', # ! 'unknown_format' : 'df??', # ! } ! ! _Enum_elsv = { ! 'name_column' : 'elsn', # ! 'modification_date_column' : 'elsm', # ! 'creation_date_column' : 'elsc', # ! 'size_column' : 'elss', # ! 'kind_column' : 'elsk', # ! 'label_column' : 'elsl', # ! 'version_column' : 'elsv', # ! 'comment_column' : 'elsC', # } *************** *** 51,56 **** 'Sharing_panel' : 'spnl', # 'Memory_panel' : 'mpnl', # ! 'Status_and_Configuration_panel' : 'scnl', # ! 'Fonts_panel' : 'fpnl', # } --- 68,78 ---- 'Sharing_panel' : 'spnl', # 'Memory_panel' : 'mpnl', # ! 'Preview_panel' : 'vpnl', # ! 'Application_panel' : 'apnl', # ! 'Languages_panel' : 'pklg', # ! 'Plugins_panel' : 'pkpg', # ! 'Name__26__Extension_panel' : 'npnl', # ! 'Comments_panel' : 'cpnl', # ! 'Content_Index_panel' : 'cinl', # } *************** *** 61,70 **** } ! _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', # } --- 83,96 ---- } ! _Enum_lvic = { ! 'small_icon' : 'smic', # ! 'large_icon' : 'lgic', # ! } ! ! _Enum_priv = { ! 'read_only' : 'read', # ! 'read_write' : 'rdwr', # ! 'write_only' : 'writ', # ! 'none' : 'none', # } *************** *** 108,116 **** _enumdeclarations = { 'earr' : _Enum_earr, ! 'ese0' : _Enum_ese0, ! 'gsen' : _Enum_gsen, 'ipnl' : _Enum_ipnl, 'isiz' : _Enum_isiz, ! 'pple' : _Enum_pple, 'sodr' : _Enum_sodr, 'vwby' : _Enum_vwby, --- 134,144 ---- _enumdeclarations = { 'earr' : _Enum_earr, ! 'ecvw' : _Enum_ecvw, ! 'edfm' : _Enum_edfm, ! 'elsv' : _Enum_elsv, 'ipnl' : _Enum_ipnl, 'isiz' : _Enum_isiz, ! 'lvic' : _Enum_lvic, ! 'priv' : _Enum_priv, 'sodr' : _Enum_sodr, 'vwby' : _Enum_vwby, Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Finder_Basics.py 28 Mar 2003 23:37:56 -0000 1.3 --- Finder_Basics.py 29 Mar 2003 00:13:14 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 13,44 **** class Finder_Basics_Events: - _argmap_computer = { - 'has' : 'has ', - } - - def computer(self, _object, _attributes={}, **_arguments): - """computer: Test attributes of this computer - Required argument: the attribute to test - Keyword argument has: test specific bits of response - Keyword argument _attributes: AppleEvent attribute dictionary - Returns: the result of the query - """ - _code = 'fndr' - _subcode = 'gstl' - - aetools.keysubst(_arguments, self._argmap_computer) - _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 copy(self, _no_object=None, _attributes={}, **_arguments): ! """copy: Copy the selected items to the clipboard (the Finder must be the front application) Keyword argument _attributes: AppleEvent attribute dictionary """ --- 13,18 ---- class Finder_Basics_Events: def copy(self, _no_object=None, _attributes={}, **_arguments): ! """copy: (NOT AVAILABLE YET) Copy the selected items to the clipboard (the Finder must be the front application) Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 58,118 **** return _arguments['----'] - def restart(self, _no_object=None, _attributes={}, **_arguments): - """restart: Restart the computer - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'rest' - - 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 shut_down(self, _no_object=None, _attributes={}, **_arguments): - """shut down: Shut Down the computer - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'shut' - - 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 sleep(self, _no_object=None, _attributes={}, **_arguments): - """sleep: Put the computer to sleep - Keyword argument _attributes: AppleEvent attribute dictionary - """ - _code = 'fndr' - _subcode = 'slep' - - 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['----'] - _argmap_sort = { 'by' : 'by ', --- 32,35 ---- *************** *** 120,124 **** def sort(self, _object, _attributes={}, **_arguments): ! """sort: Return the specified object(s) in a sorted list Required argument: a list of finder objects to sort Keyword argument by: the property to sort the items by (name, index, date, etc.) --- 37,41 ---- def sort(self, _object, _attributes={}, **_arguments): ! """sort: (NOT AVAILABLE YET) Return the specified object(s) in a sorted list Required argument: a list of finder objects to sort Keyword argument by: the property to sort the items by (name, index, date, etc.) *************** *** 146,158 **** want = 'capp' class Finder_preferences(aetools.NProperty): ! """Finder preferences - Various preferences that apply to the Finder as a whole """ which = 'pfrp' want = 'cprf' - class about_this_computer(aetools.NProperty): - """about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """ - which = 'abbx' - want = 'obj ' class clipboard(aetools.NProperty): ! """clipboard - the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' --- 63,71 ---- want = 'capp' class Finder_preferences(aetools.NProperty): ! """Finder preferences - (NOT AVAILABLE YET) Various preferences that apply to the Finder as a whole """ which = 'pfrp' want = 'cprf' class clipboard(aetools.NProperty): ! """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' *************** *** 161,184 **** which = 'desk' want = 'cdsk' - class execution_state(aetools.NProperty): - """execution state - the current execution state of the Finder """ - which = 'exec' - want = 'ese0' - class file_sharing(aetools.NProperty): - """file sharing - Is file sharing on? """ - which = 'fshr' - want = 'bool' class frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' class insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' - class largest_free_block(aetools.NProperty): - """largest free block - the largest free block of process memory available to launch an application """ - which = 'mfre' - want = 'long' class name(aetools.NProperty): """name - the Finder\xd5s name """ --- 74,89 ---- which = 'desk' want = 'cdsk' class frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' + class home(aetools.NProperty): + """home - the home directory """ + which = 'home' + want = 'cfol' class insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' class name(aetools.NProperty): """name - the Finder\xd5s name """ *************** *** 188,204 **** """product version - the version of the System software running on this computer """ which = 'ver2' ! want = 'itxt' class selection(aetools.NProperty): ! """selection - the selection visible to the user """ which = 'sele' want = 'obj ' ! class sharing_starting_up(aetools.NProperty): ! """sharing starting up - Is file sharing in the process of starting up? """ ! which = 'fsup' ! want = 'bool' class version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' ! want = 'itxt' class visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ --- 93,113 ---- """product version - the version of the System software running on this computer """ which = 'ver2' ! want = 'utxt' class selection(aetools.NProperty): ! """selection - the selection in the frontmost Finder window """ which = 'sele' want = 'obj ' ! class startup_disk(aetools.NProperty): ! """startup disk - the startup disk """ ! which = 'sdsk' ! want = 'cdis' ! class trash(aetools.NProperty): ! """trash - the trash """ ! which = 'trsh' ! want = 'ctrs' class version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' ! want = 'utxt' class visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ *************** *** 207,340 **** # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] # element 'cdis' as ['indx', 'name', 'ID '] # element 'cfol' as ['indx', 'name', 'ID '] # element 'clpf' as ['indx', 'name'] ! # element 'cobj' as ['indx', 'name'] # element 'ctnr' as ['indx', 'name'] # element 'cwin' as ['indx', 'name'] - # element 'cwnd' as ['indx', 'name'] - # element 'dafi' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] - # element 'dsut' as ['indx', 'name'] - # element 'dwnd' as ['indx', 'name'] # element 'file' as ['indx', 'name'] - # element 'fntf' as ['indx', 'name'] - # element 'fsut' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] - # element 'iwnd' as ['indx', 'name'] # element 'lwnd' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] - # element 'pcap' as ['indx', 'name'] - # element 'pcda' as ['indx', 'name'] - # element 'prcs' as ['indx', 'name'] - # element 'sctr' as ['indx', 'name'] - # element 'sndf' as ['indx', 'name'] - # element 'stcs' as ['indx', 'name'] - # element 'vwnd' as ['indx', 'name'] - - class special_folders(aetools.ComponentItem): - """special folders - The special folders used by the Mac OS """ - want = 'spfl' - class apple_menu_items_folder(aetools.NProperty): - """apple menu items folder - the special folder named \xd2Apple Menu Items,\xd3 the contents of which appear in the Apple menu """ - which = 'amnu' - want = 'obj ' - class control_panels_folder(aetools.NProperty): - """control panels folder - the special folder named \xd2Control Panels\xd3 """ - which = 'ctrl' - want = 'obj ' - class extensions_folder(aetools.NProperty): - """extensions folder - the special folder named \xd2Extensions\xd3 """ - which = 'extn' - want = 'obj ' - class fonts_folder(aetools.NProperty): - """fonts folder - the special folder named \xd2Fonts\xd3 """ - which = 'font' - want = 'obj ' - class preferences_folder(aetools.NProperty): - """preferences folder - the special folder named \xd2Preferences\xd3 """ - which = 'pref' - want = 'obj ' - class shutdown_items_folder(aetools.NProperty): - """shutdown items folder - the special folder named \xd2Shutdown Items\xd3 """ - which = 'shdf' - want = 'obj ' - class startup_items_folder(aetools.NProperty): - """startup items folder - the special folder named \xd2Startup Items\xd3 """ - which = 'strt' - want = 'obj ' - class system_folder(aetools.NProperty): - """system folder - the System folder """ - which = 'macs' - want = 'obj ' - class temporary_items_folder(aetools.NProperty): - """temporary items folder - the special folder named \xd2Temporary Items\xd3 (invisible) """ - which = 'temp' - want = 'obj ' application._superclassnames = [] ! import Files_and_suitcases ! import Containers_and_folders ! import Earlier_terms import Window_classes ! import Process_classes application._privpropdict = { 'Finder_preferences' : Finder_preferences, - 'about_this_computer' : about_this_computer, 'clipboard' : clipboard, 'desktop' : desktop, - 'execution_state' : execution_state, - 'file_sharing' : file_sharing, 'frontmost' : frontmost, 'insertion_location' : insertion_location, - 'largest_free_block' : largest_free_block, 'name' : name, 'product_version' : product_version, 'selection' : selection, ! 'sharing_starting_up' : sharing_starting_up, 'version' : version, 'visible' : visible, } application._privelemdict = { ! 'accessory_process' : Earlier_terms.accessory_process, ! 'alias_file' : Files_and_suitcases.alias_file, ! 'application_file' : Files_and_suitcases.application_file, ! 'application_process' : Process_classes.application_process, ! 'clipping' : Files_and_suitcases.clipping, 'clipping_window' : Window_classes.clipping_window, 'container' : Containers_and_folders.container, - 'container_window' : Earlier_terms.container_window, - 'content_space' : Window_classes.content_space, - 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file, - 'desk_accessory_suitcase' : Files_and_suitcases.desk_accessory_suitcase, 'disk' : Containers_and_folders.disk, ! 'document_file' : Files_and_suitcases.document_file, ! 'file' : Files_and_suitcases.file, 'folder' : Containers_and_folders.folder, ! 'font_file' : Files_and_suitcases.font_file, ! 'font_suitcase' : Files_and_suitcases.font_suitcase, ! 'information_window' : Earlier_terms.information_window, ! 'internet_location_file' : Files_and_suitcases.internet_location_file, ! 'item' : Earlier_terms.item, ! 'package' : Files_and_suitcases.package, ! 'process' : Earlier_terms.process, ! 'sharable_container' : Containers_and_folders.sharable_container, ! 'sound_file' : Files_and_suitcases.sound_file, ! 'suitcase' : Files_and_suitcases.suitcase, ! 'view_options_window' : Window_classes.view_options_window, ! 'window' : Earlier_terms.window, ! } ! special_folders._superclassnames = [] ! special_folders._privpropdict = { ! 'apple_menu_items_folder' : apple_menu_items_folder, ! 'control_panels_folder' : control_panels_folder, ! 'extensions_folder' : extensions_folder, ! 'fonts_folder' : fonts_folder, ! 'preferences_folder' : preferences_folder, ! 'shutdown_items_folder' : shutdown_items_folder, ! 'startup_items_folder' : startup_items_folder, ! 'system_folder' : system_folder, ! 'temporary_items_folder' : temporary_items_folder, ! } ! special_folders._privelemdict = { } --- 116,166 ---- # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] + # element 'brow' as ['indx', 'ID '] # element 'cdis' as ['indx', 'name', 'ID '] # element 'cfol' as ['indx', 'name', 'ID '] # element 'clpf' as ['indx', 'name'] ! # element 'cobj' as ['indx', 'rele', 'name', 'rang', 'test'] # element 'ctnr' as ['indx', 'name'] # element 'cwin' as ['indx', 'name'] # element 'docf' as ['indx', 'name'] # element 'file' as ['indx', 'name'] # element 'inlf' as ['indx', 'name'] # element 'lwnd' as ['indx', 'name'] # element 'pack' as ['indx', 'name'] application._superclassnames = [] ! import Files import Window_classes ! import Containers_and_folders ! import Finder_items application._privpropdict = { 'Finder_preferences' : Finder_preferences, 'clipboard' : clipboard, 'desktop' : desktop, 'frontmost' : frontmost, + 'home' : home, 'insertion_location' : insertion_location, 'name' : name, 'product_version' : product_version, 'selection' : selection, ! 'startup_disk' : startup_disk, ! 'trash' : trash, 'version' : version, 'visible' : visible, } application._privelemdict = { ! 'Finder_window' : Window_classes.Finder_window, ! 'alias_file' : Files.alias_file, ! 'application_file' : Files.application_file, ! 'clipping' : Files.clipping, 'clipping_window' : Window_classes.clipping_window, 'container' : Containers_and_folders.container, 'disk' : Containers_and_folders.disk, ! 'document_file' : Files.document_file, ! 'file' : Files.file, 'folder' : Containers_and_folders.folder, ! 'internet_location_file' : Files.internet_location_file, ! 'item' : Finder_items.item, ! 'package' : Files.package, ! 'window' : Window_classes.window, } *************** *** 344,362 **** _classdeclarations = { 'capp' : application, - 'spfl' : special_folders, } _propdeclarations = { - 'abbx' : about_this_computer, - 'amnu' : apple_menu_items_folder, - 'ctrl' : control_panels_folder, 'desk' : desktop, ! 'exec' : execution_state, ! 'extn' : extensions_folder, ! 'font' : fonts_folder, ! 'fshr' : file_sharing, ! 'fsup' : sharing_starting_up, ! 'macs' : system_folder, ! 'mfre' : largest_free_block, 'pcli' : clipboard, 'pfrp' : Finder_preferences, --- 170,178 ---- _classdeclarations = { 'capp' : application, } _propdeclarations = { 'desk' : desktop, ! 'home' : home, 'pcli' : clipboard, 'pfrp' : Finder_preferences, *************** *** 364,373 **** 'pisf' : frontmost, 'pnam' : name, - 'pref' : preferences_folder, 'pvis' : visible, 'sele' : selection, ! 'shdf' : shutdown_items_folder, ! 'strt' : startup_items_folder, ! 'temp' : temporary_items_folder, 'ver2' : product_version, 'vers' : version, --- 180,187 ---- 'pisf' : frontmost, 'pnam' : name, 'pvis' : visible, + 'sdsk' : startup_disk, 'sele' : selection, ! 'trsh' : trash, 'ver2' : product_version, 'vers' : version, Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Finder_items.py 28 Mar 2003 23:37:56 -0000 1.3 --- Finder_items.py 29 Mar 2003 00:13:14 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 14,18 **** def add_to_favorites(self, _object, _attributes={}, **_arguments): ! """add to favorites: Add the items to the Favorites menu in the Apple Menu and in Open and Save dialogs Required argument: the items to add to the collection of Favorites Keyword argument _attributes: AppleEvent attribute dictionary --- 14,18 ---- def add_to_favorites(self, _object, _attributes={}, **_arguments): ! """add to favorites: (NOT AVAILABLE YET) Add the items to the user\xd5s Favorites Required argument: the items to add to the collection of Favorites Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 38,42 **** def clean_up(self, _object, _attributes={}, **_arguments): ! """clean up: Arrange items in window nicely (only applies to open windows in icon or button views that are not kept arranged) Required argument: the window to clean up Keyword argument by: the order in which to clean up the objects (name, index, date, etc.) --- 38,42 ---- def clean_up(self, _object, _attributes={}, **_arguments): ! """clean up: (NOT AVAILABLE YET) Arrange items in window nicely (only applies to open windows in icon view that are not kept arranged) Required argument: the window to clean up Keyword argument by: the order in which to clean up the objects (name, index, date, etc.) *************** *** 59,64 **** def eject(self, _object=None, _attributes={}, **_arguments): ! """eject: Eject the specified disk(s), or every ejectable disk if no parameter is specified ! Required argument: the items to eject Keyword argument _attributes: AppleEvent attribute dictionary """ --- 59,64 ---- def eject(self, _object=None, _attributes={}, **_arguments): ! """eject: Eject the specified disk(s) ! Required argument: the disk(s) to eject Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 99,103 **** def erase(self, _object, _attributes={}, **_arguments): ! """erase: Erase the specified disk(s) Required argument: the items to erase Keyword argument _attributes: AppleEvent attribute dictionary --- 99,103 ---- def erase(self, _object, _attributes={}, **_arguments): ! """erase: (NOT AVAILABLE) Erase the specified disk(s) Required argument: the items to erase Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 118,148 **** 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 - """ - _code = 'fndr' - _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 - if _arguments.has_key('----'): - return _arguments['----'] - def reveal(self, _object, _attributes={}, **_arguments): """reveal: Bring the specified object(s) into view --- 118,121 ---- *************** *** 165,171 **** --- 138,151 ---- return _arguments['----'] + _argmap_update = { + 'necessity' : 'nec?', + 'registering_applications' : 'reg?', + } + def update(self, _object, _attributes={}, **_arguments): """update: Update the display of the specified object(s) to match their on-disk representation Required argument: the item to update + Keyword argument necessity: only update if necessary (i.e. a finder window is open). default is false + Keyword argument registering_applications: register applications. default is true Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 173,177 **** _subcode = 'fupd' ! if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object --- 153,157 ---- _subcode = 'fupd' ! aetools.keysubst(_arguments, self._argmap_update) _arguments['----'] = _object *************** *** 196,208 **** """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' ! want = 'itxt' class container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' - class content_space(aetools.NProperty): - """content space - the window that would open if the item was opened """ - which = 'dwnd' - want = 'obj ' class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ --- 176,184 ---- """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' ! want = 'utxt' class container(aetools.NProperty): """container - the container of the item """ which = 'ctnr' want = 'obj ' class creation_date(aetools.NProperty): """creation date - the date on which the item was created """ *************** *** 212,232 **** """description - a description of the item """ which = 'dscr' ! want = 'itxt' class disk(aetools.NProperty): """disk - the disk on which the item is stored """ which = 'cdis' want = 'obj ' ! class folder(aetools.NProperty): ! """folder - the folder in which the item is stored """ ! which = 'asdr' ! want = 'obj ' class icon(aetools.NProperty): """icon - the icon bitmap of the item """ which = 'iimg' want = 'ifam' - class id(aetools.NProperty): - """id - an id that identifies the item """ - which = 'ID ' - want = 'long' class index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ --- 188,220 ---- """description - a description of the item """ which = 'dscr' ! want = 'utxt' class disk(aetools.NProperty): """disk - the disk on which the item is stored """ which = 'cdis' want = 'obj ' ! class displayed_name(aetools.NProperty): ! """displayed name - the user-visible name of the item """ ! which = 'dnam' ! want = 'utxt' ! class everyones_privileges(aetools.NProperty): ! """everyones privileges - """ ! which = 'gstp' ! want = 'priv' ! class extension_hidden(aetools.NProperty): ! """extension hidden - Is the item's extension hidden from the user? """ ! which = 'hidx' ! want = 'bool' ! class group(aetools.NProperty): ! """group - the user or group that has special access to the container """ ! which = 'sgrp' ! want = 'utxt' ! class group_privileges(aetools.NProperty): ! """group privileges - """ ! which = 'gppr' ! want = 'priv' class icon(aetools.NProperty): """icon - the icon bitmap of the item """ which = 'iimg' want = 'ifam' class index(aetools.NProperty): """index - the index in the front-to-back ordering within its container """ *************** *** 240,248 **** """kind - the kind of the item """ which = 'kind' ! want = 'itxt' class label_index(aetools.NProperty): """label index - the label of the item """ which = 'labi' want = 'long' class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ --- 228,240 ---- """kind - the kind of the item """ which = 'kind' ! want = 'utxt' class label_index(aetools.NProperty): """label index - the label of the item """ which = 'labi' want = 'long' + class locked(aetools.NProperty): + """locked - Is the file locked? """ + which = 'aslk' + want = 'bool' class modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ *************** *** 252,276 **** """name - the name of the item """ which = 'pnam' ! want = 'itxt' class physical_size(aetools.NProperty): """physical size - the actual space used by the item on disk """ which = 'phys' ! want = 'long' class position(aetools.NProperty): """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ which = 'posn' want = 'QDpt' ! class selected(aetools.NProperty): ! """selected - Is the item selected? """ ! which = 'issl' ! want = 'bool' class size(aetools.NProperty): """size - the logical size of the item """ which = 'ptsz' ! want = 'long' ! class window(aetools.NProperty): ! """window - the window that would open if the item was opened """ ! which = 'cwin' ! want = 'obj ' items = item --- 244,280 ---- """name - the name of the item """ which = 'pnam' ! want = 'utxt' ! class name_extension(aetools.NProperty): ! """name extension - the name extension of the item (such as \xd2txt\xd3) """ ! which = 'nmxt' ! want = 'utxt' ! class owner(aetools.NProperty): ! """owner - the user that owns the container """ ! which = 'sown' ! want = 'utxt' ! class owner_privileges(aetools.NProperty): ! """owner privileges - """ ! which = 'ownr' ! want = 'priv' class physical_size(aetools.NProperty): """physical size - the actual space used by the item on disk """ which = 'phys' ! want = 'comp' class position(aetools.NProperty): """position - the position of the item within its parent window (can only be set for an item in a window viewed as icons or buttons) """ which = 'posn' want = 'QDpt' ! class properties(aetools.NProperty): ! """properties - every property of an item """ ! which = 'pALL' ! want = 'reco' class size(aetools.NProperty): """size - the logical size of the item """ which = 'ptsz' ! want = 'comp' ! class url(aetools.NProperty): ! """url - the url of the item """ ! which = 'pURL' ! want = 'utxt' items = item *************** *** 280,305 **** 'comment' : comment, 'container' : container, - 'content_space' : content_space, 'creation_date' : creation_date, 'description' : description, 'disk' : disk, ! 'folder' : folder, 'icon' : icon, - 'id' : id, 'index' : index, 'information_window' : information_window, 'kind' : kind, 'label_index' : label_index, 'modification_date' : modification_date, 'name' : name, 'physical_size' : physical_size, 'position' : position, ! 'selected' : selected, 'size' : size, ! 'window' : window, } item._privelemdict = { } - _Enum_bool = None # XXXX enum bool not found!! # --- 284,314 ---- 'comment' : comment, 'container' : container, 'creation_date' : creation_date, 'description' : description, 'disk' : disk, ! 'displayed_name' : displayed_name, ! 'everyones_privileges' : everyones_privileges, ! 'extension_hidden' : extension_hidden, ! 'group' : group, ! 'group_privileges' : group_privileges, 'icon' : icon, 'index' : index, 'information_window' : information_window, 'kind' : kind, 'label_index' : label_index, + 'locked' : locked, 'modification_date' : modification_date, 'name' : name, + 'name_extension' : name_extension, + 'owner' : owner, + 'owner_privileges' : owner_privileges, 'physical_size' : physical_size, 'position' : position, ! 'properties' : properties, 'size' : size, ! 'url' : url, } item._privelemdict = { } # *************** *** 311,329 **** _propdeclarations = { - 'ID ' : id, 'ascd' : creation_date, ! 'asdr' : folder, 'asmo' : modification_date, 'cdis' : disk, 'comt' : comment, 'ctnr' : container, ! 'cwin' : window, 'dscr' : description, ! 'dwnd' : content_space, 'iimg' : icon, - 'issl' : selected, 'iwnd' : information_window, 'kind' : kind, 'labi' : label_index, 'pbnd' : bounds, 'phys' : physical_size, --- 320,342 ---- _propdeclarations = { 'ascd' : creation_date, ! 'aslk' : locked, 'asmo' : modification_date, 'cdis' : disk, 'comt' : comment, 'ctnr' : container, ! 'dnam' : displayed_name, 'dscr' : description, ! 'gppr' : group_privileges, ! 'gstp' : everyones_privileges, ! 'hidx' : extension_hidden, 'iimg' : icon, 'iwnd' : information_window, 'kind' : kind, 'labi' : label_index, + 'nmxt' : name_extension, + 'ownr' : owner_privileges, + 'pALL' : properties, + 'pURL' : url, 'pbnd' : bounds, 'phys' : physical_size, *************** *** 332,335 **** --- 345,350 ---- 'posn' : position, 'ptsz' : size, + 'sgrp' : group, + 'sown' : owner, } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 28 Mar 2003 22:07:18 -0000 1.3 --- Standard_Suite.py 29 Mar 2003 00:13:14 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 171,175 **** Keyword argument new: the class of the new element Keyword argument at: the location at which to insert the element ! Keyword argument to: when creating an alias file, the original item to create an alias to Keyword argument with_properties: the initial values for the properties of the element Keyword argument _attributes: AppleEvent attribute dictionary --- 171,175 ---- Keyword argument new: the class of the new element Keyword argument at: the location at which to insert the element ! Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window Keyword argument with_properties: the initial values for the properties of the element Keyword argument _attributes: AppleEvent attribute dictionary Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Type_Definitions.py 28 Mar 2003 23:37:56 -0000 1.4 --- Type_Definitions.py 29 Mar 2003 00:13:14 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 20,25 **** want = 'alst' class icon_family(aetools.ComponentItem): ! """icon family - A family of icons """ want = 'ifam' class large_32_bit_icon(aetools.NProperty): --- 20,51 ---- want = 'alst' + class column(aetools.ComponentItem): + """column - a column of a list view """ + want = 'lvcl' + class index(aetools.NProperty): + """index - the index in the front-to-back ordering within its container """ + which = 'pidx' + want = 'long' + class name(aetools.NProperty): + """name - the column name """ + which = 'pnam' + want = 'elsv' + class sort_direction(aetools.NProperty): + """sort direction - The direction in which the window is sorted """ + which = 'sord' + want = 'sodr' + class visible(aetools.NProperty): + """visible - is this column visible """ + which = 'pvis' + want = 'bool' + class width(aetools.NProperty): + """width - the width of this column """ + which = 'clwd' + want = 'shor' + + columns = column + class icon_family(aetools.ComponentItem): ! """icon family - (NOT AVAILABLE YET) A family of icons """ want = 'ifam' class large_32_bit_icon(aetools.NProperty): *************** *** 62,67 **** want = 'ics#' class label(aetools.ComponentItem): ! """label - A Finder label (name and color) """ want = 'clbl' class color(aetools.NProperty): --- 88,105 ---- want = 'ics#' + class icon_view_options(aetools.ComponentItem): + """icon view options - the icon view options """ + want = 'icop' + class arrangement(aetools.NProperty): + """arrangement - the property by which to keep icons arranged """ + which = 'iarr' + want = 'earr' + class icon_size(aetools.NProperty): + """icon size - the size of icons displayed in the icon view """ + which = 'lvis' + want = 'shor' + class label(aetools.ComponentItem): ! """label - (NOT AVAILABLE YET) A Finder label (name and color) """ want = 'clbl' class color(aetools.NProperty): *************** *** 69,83 **** which = 'colr' want = 'cRGB' ! class index(aetools.NProperty): ! """index - the index in the front-to-back ordering within its container """ ! which = 'pidx' ! want = 'long' ! class name(aetools.NProperty): ! """name - the name associated with the label """ ! which = 'pnam' ! want = 'itxt' class preferences(aetools.ComponentItem): ! """preferences - The Finder Preferences """ want = 'cprf' class button_view_arrangement(aetools.NProperty): --- 107,130 ---- which = 'colr' want = 'cRGB' ! ! class list_view_options(aetools.ComponentItem): ! """list view options - the list view options """ ! want = 'lvop' ! class calculates_folder_sizes(aetools.NProperty): ! """calculates folder sizes - Are folder sizes calculated and displayed in the window? """ ! which = 'sfsz' ! want = 'bool' ! class sort_column(aetools.NProperty): ! """sort column - the column that the list view is sorted on """ ! which = 'srtc' ! want = 'lvcl' ! class uses_relative_dates(aetools.NProperty): ! """uses relative dates - Are relative dates (e.g., today, yesterday) shown in the list view? """ ! which = 'urdt' ! want = 'bool' ! # element 'lvcl' as ['indx', 'rele', 'rang', 'test'] class preferences(aetools.ComponentItem): ! """preferences - (NOT AVAILABLE, SUBJECT TO CHANGE) The Finder Preferences """ want = 'cprf' class button_view_arrangement(aetools.NProperty): *************** *** 89,96 **** which = 'bisz' want = 'long' - class calculates_folder_sizes(aetools.NProperty): - """calculates folder sizes - Are folder sizes calculated and displayed in Finder list view windows? """ - which = 'sfsz' - want = 'bool' class delay_before_springing(aetools.NProperty): """delay before springing - the delay before springing open a container in ticks (1/60th of a second) (12 is shortest delay, 60 is longest delay) """ --- 136,139 ---- *************** *** 129,136 **** which = 'svrs' want = 'bool' ! class spatial_view_arrangement(aetools.NProperty): ! """spatial view arrangement - the method of arrangement of icons in default Finder spatial view windows """ ! which = 'iarr' ! want = 'earr' class spatial_view_icon_size(aetools.NProperty): """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ --- 172,177 ---- which = 'svrs' want = 'bool' ! ! spatial_view_arrangement = arrangement class spatial_view_icon_size(aetools.NProperty): """spatial view icon size - the size of icons displayed in Finder spatial view windows. """ *************** *** 141,148 **** which = 'sprg' want = 'bool' - class uses_relative_dates(aetools.NProperty): - """uses relative dates - Are relative dates (e.g., today, yesterday) shown in Finder list view windows? """ - which = 'urdt' - want = 'bool' class uses_simple_menus(aetools.NProperty): """uses simple menus - Use simplified Finder menus? """ --- 182,185 ---- *************** *** 171,174 **** --- 208,221 ---- alias_list._privelemdict = { } + column._superclassnames = [] + column._privpropdict = { + 'index' : index, + 'name' : name, + 'sort_direction' : sort_direction, + 'visible' : visible, + 'width' : width, + } + column._privelemdict = { + } icon_family._superclassnames = [] icon_family._privpropdict = { *************** *** 186,189 **** --- 233,243 ---- icon_family._privelemdict = { } + icon_view_options._superclassnames = [] + icon_view_options._privpropdict = { + 'arrangement' : arrangement, + 'icon_size' : icon_size, + } + icon_view_options._privelemdict = { + } label._superclassnames = [] label._privpropdict = { *************** *** 194,197 **** --- 248,261 ---- label._privelemdict = { } + list_view_options._superclassnames = [] + list_view_options._privpropdict = { + 'calculates_folder_sizes' : calculates_folder_sizes, + 'icon_size' : icon_size, + 'sort_column' : sort_column, + 'uses_relative_dates' : uses_relative_dates, + } + list_view_options._privelemdict = { + 'column' : column, + } preferences._superclassnames = [] preferences._privpropdict = { *************** *** 229,233 **** --- 293,300 ---- 'clbl' : label, 'cprf' : preferences, + 'icop' : icon_view_options, 'ifam' : icon_family, + 'lvcl' : column, + 'lvop' : list_view_options, } *************** *** 236,243 **** 'barr' : button_view_arrangement, 'bisz' : button_view_icon_size, 'colr' : color, 'cwin' : window, 'dela' : delay_before_springing, ! 'iarr' : spatial_view_arrangement, 'icl4' : large_4_bit_icon, 'icl8' : large_8_bit_icon, --- 303,311 ---- 'barr' : button_view_arrangement, 'bisz' : button_view_icon_size, + 'clwd' : width, 'colr' : color, 'cwin' : window, 'dela' : delay_before_springing, ! 'iarr' : arrangement, 'icl4' : large_4_bit_icon, 'icl8' : large_8_bit_icon, *************** *** 250,255 **** --- 318,325 ---- 'l8mk' : large_8_bit_mask, 'lisz' : list_view_icon_size, + 'lvis' : icon_size, 'pidx' : index, 'pnam' : name, + 'pvis' : visible, 'scda' : shows_creation_date, 'scom' : shows_comments, *************** *** 258,262 **** --- 328,334 ---- 'sknd' : shows_kind, 'slbl' : shows_label, + 'sord' : sort_direction, 'sprg' : spring_open_folders, + 'srtc' : sort_column, 'ssiz' : shows_size, 'svrs' : shows_version, Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Window_classes.py 28 Mar 2003 23:37:56 -0000 1.4 --- Window_classes.py 29 Mar 2003 00:13:15 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /System/Library/CoreServices/Finder.app AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 16,185 **** ! class clipping_window(aetools.ComponentItem): ! """clipping window - The window containing a clipping """ ! want = 'lwnd' class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the window class """ which = 'c@#^' want = 'cwin' ! ! clipping_windows = clipping_window ! ! class container_window(aetools.ComponentItem): ! """container window - A window that contains items """ ! want = 'cwnd' ! class button_view_arrangement(aetools.NProperty): ! """button view arrangement - the property by which to keep icons arranged within a button view window """ ! which = 'barr' ! want = 'earr' ! class calculates_folder_sizes(aetools.NProperty): ! """calculates folder sizes - Are folder sizes calculated and displayed in the window? (does not apply to suitcase windows) """ ! which = 'sfsz' ! want = 'bool' ! class container(aetools.NProperty): ! """container - the container from which the window was opened """ ! which = 'ctnr' ! want = 'obj ' ! class has_custom_view_settings(aetools.NProperty): ! """has custom view settings - Does the folder have custom view settings or is it using the default global settings? """ ! which = 'cuss' ! want = 'bool' ! class item(aetools.NProperty): ! """item - the item from which the window was opened (always returns something) """ ! which = 'cobj' ! want = 'obj ' ! class previous_list_view(aetools.NProperty): ! """previous list view - the last non-icon view (by name, by date, etc.) selected for the container (forgotten as soon as the window is closed and only available when the window is open) """ ! which = 'svew' ! want = 'enum' ! class shows_comments(aetools.NProperty): ! """shows comments - Are comments displayed in the window? (does not apply to suitcases) """ ! which = 'scom' ! want = 'bool' ! class shows_creation_date(aetools.NProperty): ! """shows creation date - Are creation dates displayed in the window? """ ! which = 'scda' ! want = 'bool' ! class shows_kind(aetools.NProperty): ! """shows kind - Are document kinds displayed in the window? """ ! which = 'sknd' ! want = 'bool' ! class shows_label(aetools.NProperty): ! """shows label - Are labels displayed in the window? """ ! which = 'slbl' ! want = 'bool' ! class shows_modification_date(aetools.NProperty): ! """shows modification date - Are modification dates displayed in the window? """ ! which = 'sdat' ! want = 'bool' ! class shows_size(aetools.NProperty): ! """shows size - Are file sizes displayed in the window? """ ! which = 'ssiz' ! want = 'bool' ! class shows_version(aetools.NProperty): ! """shows version - Are file versions displayed in the window? (does not apply to suitcase windows) """ ! which = 'svrs' ! want = 'bool' ! class sort_direction(aetools.NProperty): ! """sort direction - The direction in which the window is sorted """ ! which = 'sord' ! want = 'sodr' ! class spatial_view_arrangement(aetools.NProperty): ! """spatial view arrangement - the property by which to keep icons arranged within a spatial view window """ ! which = 'iarr' ! want = 'earr' ! class uses_relative_dates(aetools.NProperty): ! """uses relative dates - Are relative dates (e.g., today, yesterday) shown in the window? """ ! which = 'urdt' ! want = 'bool' ! class view(aetools.NProperty): ! """view - the current view for the window (icon, name, date, etc.) """ which = 'pvew' ! want = 'long' ! container_windows = container_window ! class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (\xd2Window\xd3 does not include the desktop window) """ ! want = 'dwnd' ! content_spaces = content_space class information_window(aetools.ComponentItem): ! """information window - An information window (opened by \xd2Get Info\xd3) """ want = 'iwnd' - class comment(aetools.NProperty): - """comment - the comment """ - which = 'comt' - want = 'itxt' - class creation_date(aetools.NProperty): - """creation date - the date on which the item was created """ - which = 'ascd' - want = 'ldt ' class current_panel(aetools.NProperty): """current panel - the current panel in the information window """ which = 'panl' want = 'ipnl' ! class icon(aetools.NProperty): ! """icon - the icon bitmap of the item """ ! which = 'iimg' ! want = 'ifam' ! class locked(aetools.NProperty): ! """locked - Is the item locked (applies only to file and application information windows)? """ ! which = 'aslk' ! want = 'bool' ! class minimum_size(aetools.NProperty): ! """minimum size - the smallest memory size with which the application can be launched (only applies to information windows for applications) """ ! which = 'mprt' ! want = 'long' ! class modification_date(aetools.NProperty): ! """modification date - the date on which the item was last modified """ ! which = 'asmo' ! want = 'ldt ' ! class physical_size(aetools.NProperty): ! """physical size - the actual space used by the item on disk """ ! which = 'phys' ! want = 'long' ! class preferred_size(aetools.NProperty): ! """preferred size - the memory size with which the application will be launched (only applies to information windows for applications) """ ! which = 'appt' ! want = 'long' ! class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ ! which = 'ver2' ! want = 'itxt' ! class size(aetools.NProperty): ! """size - the logical size of the item """ ! which = 'ptsz' ! want = 'long' ! class stationery(aetools.NProperty): ! """stationery - Is the item a stationery pad? """ ! which = 'pspd' ! want = 'bool' ! class suggested_size(aetools.NProperty): ! """suggested size - the memory size with which the developer recommends the application be launched """ ! which = 'sprt' ! want = 'long' ! class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ ! which = 'vers' ! want = 'itxt' ! class warns_before_emptying(aetools.NProperty): ! """warns before emptying - Display a dialog when emptying the trash (only valid for trash info window)? """ ! which = 'warn' ! want = 'bool' ! ! information_windows = information_window class preferences_window(aetools.ComponentItem): ! """preferences window - The Finder Preferences window """ want = 'pwnd' - class view_options_window(aetools.ComponentItem): - """view options window - A View Options window """ - want = 'vwnd' - - view_options_windows = view_options_window - class window(aetools.ComponentItem): """window - A window """ --- 16,67 ---- ! class Finder_window(aetools.ComponentItem): ! """Finder window - A file viewer window """ ! want = 'brow' class _3c_Inheritance_3e_(aetools.NProperty): """ - inherits some of its properties from the window class """ which = 'c@#^' want = 'cwin' ! class current_view(aetools.NProperty): ! """current view - the current view for the container window """ which = 'pvew' ! want = 'ecvw' ! class icon_view_options(aetools.NProperty): ! """icon view options - the icon view options for the container window """ ! which = 'icop' ! want = 'icop' ! class list_view_options(aetools.NProperty): ! """list view options - the list view options for the container window """ ! which = 'lvop' ! want = 'lvop' ! class target(aetools.NProperty): ! """target - the container at which this file viewer is targeted """ ! which = 'fvtg' ! want = 'obj ' ! Finder_windows = Finder_window ! class clipping_window(aetools.ComponentItem): ! """clipping window - The window containing a clipping """ ! want = 'lwnd' ! clipping_windows = clipping_window class information_window(aetools.ComponentItem): ! """information window - An inspector window (opened by \xd2Show Info\xd3) """ want = 'iwnd' class current_panel(aetools.NProperty): """current panel - the current panel in the information window """ which = 'panl' want = 'ipnl' ! class item(aetools.NProperty): ! """item - the item from which this window was opened """ ! which = 'cobj' ! want = 'obj ' class preferences_window(aetools.ComponentItem): ! """preferences window - (NOT AVAILABLE YET) The Finder Preferences window """ want = 'pwnd' class window(aetools.ComponentItem): """window - A window """ *************** *** 194,198 **** want = 'bool' class collapsed(aetools.NProperty): ! """collapsed - Is the window collapsed (only applies to open non-pop-up windows)? """ which = 'wshd' want = 'bool' --- 76,80 ---- want = 'bool' class collapsed(aetools.NProperty): ! """collapsed - Is the window collapsed """ which = 'wshd' want = 'bool' *************** *** 201,204 **** --- 83,90 ---- which = 'isfl' want = 'bool' + class id(aetools.NProperty): + """id - the unique id for this window """ + which = 'ID ' + want = 'magn' class index(aetools.NProperty): """index - the number of the window in the front-to-back layer ordering """ *************** *** 212,228 **** """name - the name of the window """ which = 'pnam' ! want = 'itxt' ! class popup(aetools.NProperty): ! """popup - Is the window is a pop-up window? (only applies to open container windows in the Finder and can only be set when the Finder is the front application) """ ! which = 'drwr' ! want = 'bool' class position(aetools.NProperty): """position - the upper left position of the window """ which = 'posn' want = 'QDpt' ! class pulled_open(aetools.NProperty): ! """pulled open - Is the window pulled open (only applies to pop-up windows and can only be set when the Finder is the front application)? """ ! which = 'pull' ! want = 'bool' class resizable(aetools.NProperty): """resizable - Is the window resizable? """ --- 98,110 ---- """name - the name of the window """ which = 'pnam' ! want = 'utxt' class position(aetools.NProperty): """position - the upper left position of the window """ which = 'posn' want = 'QDpt' ! class properties(aetools.NProperty): ! """properties - every property of a window """ ! which = 'pALL' ! want = 'reco' class resizable(aetools.NProperty): """resizable - Is the window resizable? """ *************** *** 246,307 **** want = 'bool' class zoomed_full_size(aetools.NProperty): ! """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read, and only applies to open non-pop-up windows) """ which = 'zumf' want = 'bool' windows = window ! clipping_window._superclassnames = ['window'] ! clipping_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping_window._privelemdict = { } ! container_window._superclassnames = ['window'] ! container_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'button_view_arrangement' : button_view_arrangement, - 'calculates_folder_sizes' : calculates_folder_sizes, - 'container' : container, - 'has_custom_view_settings' : has_custom_view_settings, - 'item' : item, - 'previous_list_view' : previous_list_view, - 'shows_comments' : shows_comments, - 'shows_creation_date' : shows_creation_date, - 'shows_kind' : shows_kind, - 'shows_label' : shows_label, - 'shows_modification_date' : shows_modification_date, - 'shows_size' : shows_size, - 'shows_version' : shows_version, - 'sort_direction' : sort_direction, - 'spatial_view_arrangement' : spatial_view_arrangement, - 'uses_relative_dates' : uses_relative_dates, - 'view' : view, - } - container_window._privelemdict = { - } - content_space._superclassnames = [] - content_space._privpropdict = { } ! content_space._privelemdict = { } information_window._superclassnames = ['window'] information_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'comment' : comment, - 'creation_date' : creation_date, 'current_panel' : current_panel, - 'icon' : icon, 'item' : item, - 'locked' : locked, - 'minimum_size' : minimum_size, - 'modification_date' : modification_date, - 'physical_size' : physical_size, - 'preferred_size' : preferred_size, - 'product_version' : product_version, - 'size' : size, - 'stationery' : stationery, - 'suggested_size' : suggested_size, - 'version' : version, - 'warns_before_emptying' : warns_before_emptying, } information_window._privelemdict = { --- 128,157 ---- want = 'bool' class zoomed_full_size(aetools.NProperty): ! """zoomed full size - Is the window zoomed to the full size of the screen? (can only be set, not read) """ which = 'zumf' want = 'bool' windows = window ! Finder_window._superclassnames = ['window'] ! Finder_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, + 'current_view' : current_view, + 'icon_view_options' : icon_view_options, + 'list_view_options' : list_view_options, + 'target' : target, } ! Finder_window._privelemdict = { } ! clipping_window._superclassnames = ['window'] ! clipping_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping_window._privelemdict = { } information_window._superclassnames = ['window'] information_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'current_panel' : current_panel, 'item' : item, } information_window._privelemdict = { *************** *** 314,324 **** preferences_window._privelemdict = { } - view_options_window._superclassnames = ['window'] - view_options_window._privpropdict = { - '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, - 'item' : item, - } - view_options_window._privelemdict = { - } window._superclassnames = [] window._privpropdict = { --- 164,167 ---- *************** *** 327,336 **** 'collapsed' : collapsed, 'floating' : floating, 'index' : index, 'modal' : modal, 'name' : name, - 'popup' : popup, 'position' : position, ! 'pulled_open' : pulled_open, 'resizable' : resizable, 'titled' : titled, --- 170,179 ---- 'collapsed' : collapsed, 'floating' : floating, + 'id' : id, 'index' : index, 'modal' : modal, 'name' : name, 'position' : position, ! 'properties' : properties, 'resizable' : resizable, 'titled' : titled, *************** *** 347,380 **** # _classdeclarations = { 'cwin' : window, - 'cwnd' : container_window, - 'dwnd' : content_space, 'iwnd' : information_window, 'lwnd' : clipping_window, 'pwnd' : preferences_window, - 'vwnd' : view_options_window, } _propdeclarations = { ! 'appt' : preferred_size, ! 'ascd' : creation_date, ! 'aslk' : locked, ! 'asmo' : modification_date, ! 'barr' : button_view_arrangement, 'c@#^' : _3c_Inheritance_3e_, 'cobj' : item, ! 'comt' : comment, ! 'ctnr' : container, ! 'cuss' : has_custom_view_settings, ! 'drwr' : popup, 'hclb' : closeable, ! 'iarr' : spatial_view_arrangement, ! 'iimg' : icon, 'isfl' : floating, 'iszm' : zoomable, ! 'mprt' : minimum_size, 'panl' : current_panel, 'pbnd' : bounds, - 'phys' : physical_size, 'pidx' : index, 'pmod' : modal, --- 190,213 ---- # _classdeclarations = { + 'brow' : Finder_window, 'cwin' : window, 'iwnd' : information_window, 'lwnd' : clipping_window, 'pwnd' : preferences_window, } _propdeclarations = { ! 'ID ' : id, 'c@#^' : _3c_Inheritance_3e_, 'cobj' : item, ! 'fvtg' : target, 'hclb' : closeable, ! 'icop' : icon_view_options, 'isfl' : floating, 'iszm' : zoomable, ! 'lvop' : list_view_options, ! 'pALL' : properties, 'panl' : current_panel, 'pbnd' : bounds, 'pidx' : index, 'pmod' : modal, *************** *** 382,407 **** 'posn' : position, 'prsz' : resizable, - 'pspd' : stationery, 'ptit' : titled, ! 'ptsz' : size, ! 'pull' : pulled_open, ! 'pvew' : view, 'pvis' : visible, 'pzum' : zoomed, - 'scda' : shows_creation_date, - 'scom' : shows_comments, - 'sdat' : shows_modification_date, - 'sfsz' : calculates_folder_sizes, - 'sknd' : shows_kind, - 'slbl' : shows_label, - 'sord' : sort_direction, - 'sprt' : suggested_size, - 'ssiz' : shows_size, - 'svew' : previous_list_view, - 'svrs' : shows_version, - 'urdt' : uses_relative_dates, - 'ver2' : product_version, - 'vers' : version, - 'warn' : warns_before_emptying, 'wshd' : collapsed, 'zumf' : zoomed_full_size, --- 215,222 ---- 'posn' : position, 'prsz' : resizable, 'ptit' : titled, ! 'pvew' : current_view, 'pvis' : visible, 'pzum' : zoomed, 'wshd' : collapsed, 'zumf' : zoomed_full_size, Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 28 Mar 2003 23:37:56 -0000 1.4 --- __init__.py 29 Mar 2003 00:13:15 -0000 1.5 *************** *** 1,33 **** """ ! Package generated from /Volumes/Moes/Systeemmap/Finder ! Resource aete resid 0 """ import aetools Error = aetools.Error import Standard_Suite import Containers_and_folders ! import Files_and_suitcases import Finder_Basics import Finder_items - import Process_classes import Window_classes import Type_Definitions - import Earlier_terms import Enumerations - import Obsolete_terms _code_to_module = { 'CoRe' : Standard_Suite, 'fndr' : Containers_and_folders, ! 'fndr' : Files_and_suitcases, 'fndr' : Finder_Basics, 'fndr' : Finder_items, - 'fndr' : Process_classes, 'fndr' : Window_classes, 'tpdf' : Type_Definitions, - 'tpnm' : Earlier_terms, 'tpnm' : Enumerations, - 'tpnm' : Obsolete_terms, } --- 1,28 ---- """ ! Package generated from /System/Library/CoreServices/Finder.app """ import aetools Error = aetools.Error import Standard_Suite + import Legacy_suite import Containers_and_folders ! import Files import Finder_Basics import Finder_items import Window_classes import Type_Definitions import Enumerations _code_to_module = { 'CoRe' : Standard_Suite, + 'fleg' : Legacy_suite, 'fndr' : Containers_and_folders, ! 'fndr' : Files, 'fndr' : Finder_Basics, 'fndr' : Finder_items, 'fndr' : Window_classes, 'tpdf' : Type_Definitions, 'tpnm' : Enumerations, } *************** *** 36,62 **** _code_to_fullname = { 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), ! 'fndr' : ('Finder.Files_and_suitcases', 'Files_and_suitcases'), 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), 'fndr' : ('Finder.Finder_items', 'Finder_items'), - 'fndr' : ('Finder.Process_classes', 'Process_classes'), 'fndr' : ('Finder.Window_classes', 'Window_classes'), 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), - 'tpnm' : ('Finder.Earlier_terms', 'Earlier_terms'), 'tpnm' : ('Finder.Enumerations', 'Enumerations'), - 'tpnm' : ('Finder.Obsolete_terms', 'Obsolete_terms'), } from Standard_Suite import * from Containers_and_folders import * ! from Files_and_suitcases import * from Finder_Basics import * from Finder_items import * - from Process_classes import * from Window_classes import * from Type_Definitions import * - from Earlier_terms import * from Enumerations import * - from Obsolete_terms import * def getbaseclasses(v): --- 31,53 ---- _code_to_fullname = { 'CoRe' : ('Finder.Standard_Suite', 'Standard_Suite'), + 'fleg' : ('Finder.Legacy_suite', 'Legacy_suite'), 'fndr' : ('Finder.Containers_and_folders', 'Containers_and_folders'), ! 'fndr' : ('Finder.Files', 'Files'), 'fndr' : ('Finder.Finder_Basics', 'Finder_Basics'), 'fndr' : ('Finder.Finder_items', 'Finder_items'), 'fndr' : ('Finder.Window_classes', 'Window_classes'), 'tpdf' : ('Finder.Type_Definitions', 'Type_Definitions'), 'tpnm' : ('Finder.Enumerations', 'Enumerations'), } from Standard_Suite import * + from Legacy_suite import * from Containers_and_folders import * ! from Files import * from Finder_Basics import * from Finder_items import * from Window_classes import * from Type_Definitions import * from Enumerations import * def getbaseclasses(v): *************** *** 77,260 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(StdSuites.Type_Names_Suite.small_integer) - getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) - getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.color_table) - getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.plain_text) - getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) - getbaseclasses(StdSuites.Type_Names_Suite.location_reference) - getbaseclasses(StdSuites.Type_Names_Suite.version) - getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) - getbaseclasses(StdSuites.Type_Names_Suite.machine_location) - getbaseclasses(StdSuites.Type_Names_Suite.menu_item) - getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) - getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) - getbaseclasses(StdSuites.Type_Names_Suite.menu) - getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) - getbaseclasses(StdSuites.Type_Names_Suite.small_real) - getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) - getbaseclasses(StdSuites.Type_Names_Suite.rotation) - getbaseclasses(StdSuites.Type_Names_Suite.fixed) - getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) - getbaseclasses(StdSuites.Type_Names_Suite.long_point) - getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) - getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) - getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) - getbaseclasses(StdSuites.Type_Names_Suite.dash_style) - getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) - getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.extended_real) - getbaseclasses(StdSuites.Type_Names_Suite.double_integer) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) - getbaseclasses(StdSuites.Type_Names_Suite.null) - getbaseclasses(StdSuites.Type_Names_Suite.target_id) - getbaseclasses(StdSuites.Type_Names_Suite.point) - getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) - getbaseclasses(accessory_suitcase) - getbaseclasses(preferences) - getbaseclasses(sharable_container) - getbaseclasses(application) - getbaseclasses(trash_2d_object) - getbaseclasses(accessory_process) - getbaseclasses(window) - getbaseclasses(information_window) - getbaseclasses(process) - getbaseclasses(application_file) - getbaseclasses(internet_location) - getbaseclasses(container_window) - getbaseclasses(item) getbaseclasses(item) ! getbaseclasses(trash_2d_object) ! getbaseclasses(desktop_2d_object) ! getbaseclasses(sharable_container) ! getbaseclasses(sharing_privileges) ! getbaseclasses(disk) ! getbaseclasses(folder) ! getbaseclasses(container) ! getbaseclasses(sound_file) ! getbaseclasses(font_file) ! getbaseclasses(internet_location_file) ! getbaseclasses(clipping) ! getbaseclasses(alias_file) ! getbaseclasses(desk_accessory_file) ! getbaseclasses(desk_accessory_suitcase) ! getbaseclasses(font_suitcase) getbaseclasses(file) getbaseclasses(application_file) ! getbaseclasses(suitcase) getbaseclasses(document_file) ! getbaseclasses(package) getbaseclasses(application) - getbaseclasses(special_folders) getbaseclasses(preferences_window) ! getbaseclasses(view_options_window) getbaseclasses(window) - getbaseclasses(container_window) - getbaseclasses(content_space) - getbaseclasses(information_window) getbaseclasses(clipping_window) - getbaseclasses(status_window) - getbaseclasses(application) - getbaseclasses(sharing_window) - getbaseclasses(control_panel) - getbaseclasses(process) - getbaseclasses(item) - getbaseclasses(file) - getbaseclasses(sharable_container) - getbaseclasses(container_window) - getbaseclasses(container) getbaseclasses(information_window) ! getbaseclasses(process) ! getbaseclasses(desk_accessory_process) ! getbaseclasses(application_process) getbaseclasses(preferences) getbaseclasses(alias_list) getbaseclasses(icon_family) ! getbaseclasses(label) ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) getbaseclasses(StdSuites.Type_Names_Suite.color_table) getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) getbaseclasses(StdSuites.Type_Names_Suite.machine_location) getbaseclasses(StdSuites.Type_Names_Suite.menu_item) ! getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) getbaseclasses(StdSuites.Type_Names_Suite.menu) getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) getbaseclasses(StdSuites.Type_Names_Suite.rotation) getbaseclasses(StdSuites.Type_Names_Suite.fixed) - getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) getbaseclasses(StdSuites.Type_Names_Suite.long_point) getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) - getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) - getbaseclasses(StdSuites.Type_Names_Suite.dash_style) - getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) - getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.extended_real) - getbaseclasses(StdSuites.Type_Names_Suite.double_integer) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) - getbaseclasses(StdSuites.Type_Names_Suite.null) getbaseclasses(StdSuites.Type_Names_Suite.target_id) - getbaseclasses(StdSuites.Type_Names_Suite.point) - getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.small_integer) - getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) - getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.color_table) - getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.plain_text) - getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) - getbaseclasses(StdSuites.Type_Names_Suite.location_reference) - getbaseclasses(StdSuites.Type_Names_Suite.version) - getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) - getbaseclasses(StdSuites.Type_Names_Suite.machine_location) - getbaseclasses(StdSuites.Type_Names_Suite.menu_item) getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) - getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) - getbaseclasses(StdSuites.Type_Names_Suite.menu) - getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) - getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) - getbaseclasses(StdSuites.Type_Names_Suite.small_real) - getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) - getbaseclasses(StdSuites.Type_Names_Suite.rotation) - getbaseclasses(StdSuites.Type_Names_Suite.fixed) - getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) - getbaseclasses(StdSuites.Type_Names_Suite.long_point) - getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) - getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) - getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) - getbaseclasses(StdSuites.Type_Names_Suite.dash_style) - getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) - getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) - getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) getbaseclasses(StdSuites.Type_Names_Suite.extended_real) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) ! getbaseclasses(StdSuites.Type_Names_Suite.point) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) --- 68,140 ---- # Set property and element dictionaries now that all classes have been defined # getbaseclasses(item) ! getbaseclasses(application) ! getbaseclasses(package) getbaseclasses(file) getbaseclasses(application_file) ! getbaseclasses(alias_file) ! getbaseclasses(internet_location_file) getbaseclasses(document_file) ! getbaseclasses(clipping) ! getbaseclasses(process) ! getbaseclasses(application_process) ! getbaseclasses(desk_accessory_process) getbaseclasses(application) getbaseclasses(preferences_window) ! getbaseclasses(Finder_window) getbaseclasses(window) getbaseclasses(clipping_window) getbaseclasses(information_window) ! getbaseclasses(trash_2d_object) ! getbaseclasses(desktop_2d_object) ! getbaseclasses(container) ! getbaseclasses(folder) ! getbaseclasses(disk) ! getbaseclasses(icon_view_options) ! getbaseclasses(label) ! getbaseclasses(column) getbaseclasses(preferences) getbaseclasses(alias_list) getbaseclasses(icon_family) ! getbaseclasses(list_view_options) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.version) getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) getbaseclasses(StdSuites.Type_Names_Suite.color_table) getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) getbaseclasses(StdSuites.Type_Names_Suite.menu_item) ! getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) getbaseclasses(StdSuites.Type_Names_Suite.menu) getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.fixed) getbaseclasses(StdSuites.Type_Names_Suite.long_point) getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) getbaseclasses(StdSuites.Type_Names_Suite.target_id) getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) getbaseclasses(StdSuites.Type_Names_Suite.extended_real) ! getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.plain_text) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) *************** *** 263,446 **** # _classdeclarations = { - 'shor' : StdSuites.Type_Names_Suite.small_integer, - 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, - 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, - 'clrt' : StdSuites.Type_Names_Suite.color_table, - 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, - 'TEXT' : StdSuites.Type_Names_Suite.plain_text, - 'elin' : StdSuites.Type_Names_Suite.type_element_info, - 'insl' : StdSuites.Type_Names_Suite.location_reference, - 'vers' : StdSuites.Type_Names_Suite.version, - 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, - 'mLoc' : StdSuites.Type_Names_Suite.machine_location, - 'cmen' : StdSuites.Type_Names_Suite.menu_item, - 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, - 'aete' : StdSuites.Type_Names_Suite.application_dictionary, - 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, - 'cmnu' : StdSuites.Type_Names_Suite.menu, - 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, - 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, - 'evin' : StdSuites.Type_Names_Suite.type_event_info, - 'sing' : StdSuites.Type_Names_Suite.small_real, - 'suin' : StdSuites.Type_Names_Suite.type_suite_info, - 'trot' : StdSuites.Type_Names_Suite.rotation, - 'fixd' : StdSuites.Type_Names_Suite.fixed, - 'styl' : StdSuites.Type_Names_Suite.scrap_styles, - 'lpnt' : StdSuites.Type_Names_Suite.long_point, - 'gcli' : StdSuites.Type_Names_Suite.type_class_info, - 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, - 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, - 'tdas' : StdSuites.Type_Names_Suite.dash_style, - 'pinf' : StdSuites.Type_Names_Suite.type_property_info, - 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, - 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, - 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, - 'exte' : StdSuites.Type_Names_Suite.extended_real, - 'comp' : StdSuites.Type_Names_Suite.double_integer, - 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, - 'null' : StdSuites.Type_Names_Suite.null, - 'targ' : StdSuites.Type_Names_Suite.target_id, - 'QDpt' : StdSuites.Type_Names_Suite.point, - 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - '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, ! 'cobj' : item, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'sctr' : sharable_container, ! 'priv' : sharing_privileges, ! 'cdis' : disk, ! 'cfol' : folder, ! 'ctnr' : container, ! '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, 'capp' : application, - 'spfl' : special_folders, 'pwnd' : preferences_window, ! 'vwnd' : view_options_window, 'cwin' : window, - 'cwnd' : container_window, - 'dwnd' : content_space, - 'iwnd' : information_window, 'lwnd' : clipping_window, - '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, ! 'prcs' : process, ! 'pcda' : desk_accessory_process, ! 'pcap' : application_process, 'cprf' : preferences, 'alst' : alias_list, 'ifam' : icon_family, ! 'clbl' : label, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, 'clrt' : StdSuites.Type_Names_Suite.color_table, 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, 'mLoc' : StdSuites.Type_Names_Suite.machine_location, 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, 'aete' : StdSuites.Type_Names_Suite.application_dictionary, 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, 'cmnu' : StdSuites.Type_Names_Suite.menu, 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'sing' : StdSuites.Type_Names_Suite.small_real, 'suin' : StdSuites.Type_Names_Suite.type_suite_info, 'trot' : StdSuites.Type_Names_Suite.rotation, 'fixd' : StdSuites.Type_Names_Suite.fixed, - 'styl' : StdSuites.Type_Names_Suite.scrap_styles, 'lpnt' : StdSuites.Type_Names_Suite.long_point, 'gcli' : StdSuites.Type_Names_Suite.type_class_info, - 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, - 'tdas' : StdSuites.Type_Names_Suite.dash_style, - 'pinf' : StdSuites.Type_Names_Suite.type_property_info, - 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, - 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, - 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, - 'exte' : StdSuites.Type_Names_Suite.extended_real, - 'comp' : StdSuites.Type_Names_Suite.double_integer, - 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, - 'null' : StdSuites.Type_Names_Suite.null, 'targ' : StdSuites.Type_Names_Suite.target_id, - 'QDpt' : StdSuites.Type_Names_Suite.point, - 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, - 'shor' : StdSuites.Type_Names_Suite.small_integer, - 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, - 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, - 'clrt' : StdSuites.Type_Names_Suite.color_table, - 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, - 'TEXT' : StdSuites.Type_Names_Suite.plain_text, - 'elin' : StdSuites.Type_Names_Suite.type_element_info, - 'insl' : StdSuites.Type_Names_Suite.location_reference, - 'vers' : StdSuites.Type_Names_Suite.version, - 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, - 'mLoc' : StdSuites.Type_Names_Suite.machine_location, - 'cmen' : StdSuites.Type_Names_Suite.menu_item, 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, - 'aete' : StdSuites.Type_Names_Suite.application_dictionary, - 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, - 'cmnu' : StdSuites.Type_Names_Suite.menu, - 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, - 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, - 'evin' : StdSuites.Type_Names_Suite.type_event_info, - 'sing' : StdSuites.Type_Names_Suite.small_real, - 'suin' : StdSuites.Type_Names_Suite.type_suite_info, - 'trot' : StdSuites.Type_Names_Suite.rotation, - 'fixd' : StdSuites.Type_Names_Suite.fixed, - 'styl' : StdSuites.Type_Names_Suite.scrap_styles, - 'lpnt' : StdSuites.Type_Names_Suite.long_point, - 'gcli' : StdSuites.Type_Names_Suite.type_class_info, - 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, - 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, - 'tdas' : StdSuites.Type_Names_Suite.dash_style, - 'pinf' : StdSuites.Type_Names_Suite.type_property_info, 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, - 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, - 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, 'null' : StdSuites.Type_Names_Suite.null, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'QDpt' : StdSuites.Type_Names_Suite.point, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } --- 143,215 ---- # _classdeclarations = { 'cobj' : item, ! 'capp' : application, ! 'pack' : package, 'file' : file, 'appf' : application_file, ! 'alia' : alias_file, ! 'inlf' : internet_location_file, 'docf' : document_file, ! 'clpf' : clipping, ! 'prcs' : process, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, 'capp' : application, 'pwnd' : preferences_window, ! 'brow' : Finder_window, 'cwin' : window, 'lwnd' : clipping_window, 'iwnd' : information_window, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'ctnr' : container, ! 'cfol' : folder, ! 'cdis' : disk, ! 'icop' : icon_view_options, ! 'clbl' : label, ! 'lvcl' : column, 'cprf' : preferences, 'alst' : alias_list, 'ifam' : icon_family, ! 'lvop' : list_view_options, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, 'clrt' : StdSuites.Type_Names_Suite.color_table, 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, 'aete' : StdSuites.Type_Names_Suite.application_dictionary, 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, 'cmnu' : StdSuites.Type_Names_Suite.menu, 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, 'suin' : StdSuites.Type_Names_Suite.type_suite_info, 'trot' : StdSuites.Type_Names_Suite.rotation, + 'shor' : StdSuites.Type_Names_Suite.small_integer, 'fixd' : StdSuites.Type_Names_Suite.fixed, 'lpnt' : StdSuites.Type_Names_Suite.long_point, 'gcli' : StdSuites.Type_Names_Suite.type_class_info, 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, 'targ' : StdSuites.Type_Names_Suite.target_id, 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.plain_text, ! 'sing' : StdSuites.Type_Names_Suite.small_real, 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } *************** *** 448,461 **** class Finder(Standard_Suite_Events, Containers_and_folders_Events, ! Files_and_suitcases_Events, Finder_Basics_Events, Finder_items_Events, - Process_classes_Events, Window_classes_Events, Type_Definitions_Events, - Earlier_terms_Events, Enumerations_Events, - Obsolete_terms_Events, aetools.TalkTo): _signature = 'MACS' --- 217,228 ---- class Finder(Standard_Suite_Events, + Legacy_suite_Events, Containers_and_folders_Events, ! Files_Events, Finder_Basics_Events, Finder_items_Events, Window_classes_Events, Type_Definitions_Events, Enumerations_Events, aetools.TalkTo): _signature = 'MACS' --- Earlier_terms.py DELETED --- --- Files_and_suitcases.py DELETED --- --- Obsolete_terms.py DELETED --- --- Process_classes.py DELETED --- From jackjansen@users.sourceforge.net Sat Mar 29 00:14:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 28 Mar 2003 16:14:06 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents In directory sc8-pr-cvs1:/tmp/cvs-serv8492/SystemEvents Log Message: Directory /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents added to the repository From loewis@users.sourceforge.net Sat Mar 29 09:47:24 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 01:47:24 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.169,1.170 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv20706 Modified Files: Tkinter.py Log Message: Patch #707701: Expect '??' in event fields. Fixes #698517. Will backport to 2.2. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** Tkinter.py 22 Jan 2003 09:17:36 -0000 1.169 --- Tkinter.py 29 Mar 2003 09:47:21 -0000 1.170 *************** *** 1036,1064 **** if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean getint = int nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() e.serial = getint(nsign) ! e.num = getint(b) try: e.focus = getboolean(f) except TclError: pass ! e.height = getint(h) ! e.keycode = getint(k) ! # For Visibility events, event state is a string and ! # not an integer: ! try: ! e.state = getint(s) ! except ValueError: ! e.state = s ! e.time = getint(t) ! e.width = getint(w) ! e.x = getint(x) ! e.y = getint(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K ! e.keysym_num = getint(N) e.type = T try: --- 1036,1080 ---- if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean + getint = int + def getint_event(s): + """Tk changed behavior in 8.4.2, returning "??" rather more often.""" + try: + return int(s) + except ValueError: + return s + nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() + # serial field: valid vor all events + # number of button: ButtonPress and ButtonRelease events only + # height field: Configure, ConfigureRequest, Create, + # ResizeRequest, and Expose events only + # keycode field: KeyPress and KeyRelease events only + # time field: "valid for events that contain a time field" + # width field: Configure, ConfigureRequest, Create, ResizeRequest, + # and Expose events only + # x field: "valid for events that contain a x field" + # y field: "valid for events that contain a y field" + # keysym as decimal: KeyPress and KeyRelease events only + # x_root, y_root fields: ButtonPress, ButtonRelease, KeyPress, + # KeyRelease,and Motion events e.serial = getint(nsign) ! e.num = getint_event(b) try: e.focus = getboolean(f) except TclError: pass ! e.height = getint_event(h) ! e.keycode = getint_event(k) ! e.state = getint_event(s) ! e.time = getint_event(t) ! e.width = getint_event(w) ! e.x = getint_event(x) ! e.y = getint_event(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K ! e.keysym_num = getint_event(N) e.type = T try: *************** *** 1066,1071 **** except KeyError: e.widget = W ! e.x_root = getint(X) ! e.y_root = getint(Y) try: e.delta = getint(D) --- 1082,1087 ---- except KeyError: e.widget = W ! e.x_root = getint_event(X) ! e.y_root = getint_event(Y) try: e.delta = getint(D) From loewis@users.sourceforge.net Sat Mar 29 09:48:16 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 01:48:16 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.160.10.2,1.160.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv21105 Modified Files: Tag: release22-maint Tkinter.py Log Message: Patch #707701: Expect '??' in events. Fixes #698517. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.160.10.2 retrieving revision 1.160.10.3 diff -C2 -d -r1.160.10.2 -r1.160.10.3 *** Tkinter.py 23 Aug 2002 15:27:52 -0000 1.160.10.2 --- Tkinter.py 29 Mar 2003 09:48:12 -0000 1.160.10.3 *************** *** 1025,1053 **** if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean getint = int nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() e.serial = getint(nsign) ! e.num = getint(b) try: e.focus = getboolean(f) except TclError: pass ! e.height = getint(h) ! e.keycode = getint(k) ! # For Visibility events, event state is a string and ! # not an integer: ! try: ! e.state = getint(s) ! except ValueError: ! e.state = s ! e.time = getint(t) ! e.width = getint(w) ! e.x = getint(x) ! e.y = getint(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K ! e.keysym_num = getint(N) e.type = T try: --- 1025,1069 ---- if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean + getint = int + def getint_event(s): + """Tk changed behavior in 8.4.2, returning "??" rather more often.""" + try: + return int(s) + except ValueError: + return s + nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() + # serial field: valid vor all events + # number of button: ButtonPress and ButtonRelease events only + # height field: Configure, ConfigureRequest, Create, + # ResizeRequest, and Expose events only + # keycode field: KeyPress and KeyRelease events only + # time field: "valid for events that contain a time field" + # width field: Configure, ConfigureRequest, Create, ResizeRequest, + # and Expose events only + # x field: "valid for events that contain a x field" + # y field: "valid for events that contain a y field" + # keysym as decimal: KeyPress and KeyRelease events only + # x_root, y_root fields: ButtonPress, ButtonRelease, KeyPress, + # KeyRelease,and Motion events e.serial = getint(nsign) ! e.num = getint_event(b) try: e.focus = getboolean(f) except TclError: pass ! e.height = getint_event(h) ! e.keycode = getint_event(k) ! e.state = getint_event(s) ! e.time = getint_event(t) ! e.width = getint_event(w) ! e.x = getint_event(x) ! e.y = getint_event(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K ! e.keysym_num = getint_event(N) e.type = T try: *************** *** 1055,1060 **** except KeyError: e.widget = W ! e.x_root = getint(X) ! e.y_root = getint(Y) try: e.delta = getint(D) --- 1071,1076 ---- except KeyError: e.widget = W ! e.x_root = getint_event(X) ! e.y_root = getint_event(Y) try: e.delta = getint(D) From loewis@users.sourceforge.net Sat Mar 29 10:04:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:04:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv28047/Doc/api Modified Files: utilities.tex Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** utilities.tex 6 Mar 2003 22:04:24 -0000 1.8 --- utilities.tex 29 Mar 2003 10:04:54 -0000 1.9 *************** *** 497,501 **** 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 --- 497,501 ---- Convert a Python integer to a C \ctype{long int}. ! \item[\samp{L} (integer) {[PY_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 From loewis@users.sourceforge.net Sat Mar 29 10:04:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:04:58 -0800 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.96,2.97 modsupport.c,2.65,2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28047/Python Modified Files: getargs.c modsupport.c Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.96 retrieving revision 2.97 diff -C2 -d -r2.96 -r2.97 *** getargs.c 4 Feb 2003 20:55:40 -0000 2.96 --- getargs.c 29 Mar 2003 10:04:55 -0000 2.97 *************** *** 551,558 **** #ifdef HAVE_LONG_LONG ! case 'L': {/* LONG_LONG */ ! LONG_LONG *p = va_arg( *p_va, LONG_LONG * ); ! LONG_LONG ival = PyLong_AsLongLong( arg ); ! if( ival == (LONG_LONG)-1 && PyErr_Occurred() ) { return converterr("long", arg, msgbuf, bufsize); } else { --- 551,558 ---- #ifdef HAVE_LONG_LONG ! case 'L': {/* PY_LONG_LONG */ ! PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * ); ! PY_LONG_LONG ival = PyLong_AsLongLong( arg ); ! if( ival == (PY_LONG_LONG)-1 && PyErr_Occurred() ) { return converterr("long", arg, msgbuf, bufsize); } else { *************** *** 1321,1327 **** #ifdef HAVE_LONG_LONG ! case 'L': /* LONG_LONG int */ { ! (void) va_arg(*p_va, LONG_LONG *); break; } --- 1321,1327 ---- #ifdef HAVE_LONG_LONG ! case 'L': /* PY_LONG_LONG int */ { ! (void) va_arg(*p_va, PY_LONG_LONG *); break; } Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** modsupport.c 31 Jan 2003 18:33:18 -0000 2.65 --- modsupport.c 29 Mar 2003 10:04:55 -0000 2.66 *************** *** 292,296 **** #ifdef HAVE_LONG_LONG case 'L': ! return PyLong_FromLongLong((LONG_LONG)va_arg(*p_va, LONG_LONG)); #endif #ifdef Py_USING_UNICODE --- 292,296 ---- #ifdef HAVE_LONG_LONG case 'L': ! return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG)); #endif #ifdef Py_USING_UNICODE From loewis@users.sourceforge.net Sat Mar 29 10:04:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:04:56 -0800 Subject: [Python-checkins] python/dist/src/Include longobject.h,2.28,2.29 pyport.h,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28047/Include Modified Files: longobject.h pyport.h Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: longobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/longobject.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** longobject.h 31 Jan 2003 15:52:03 -0000 2.28 --- longobject.h 29 Mar 2003 10:04:54 -0000 2.29 *************** *** 34,41 **** #ifdef HAVE_LONG_LONG ! PyAPI_FUNC(PyObject *) PyLong_FromLongLong(LONG_LONG); ! PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); ! PyAPI_FUNC(LONG_LONG) PyLong_AsLongLong(PyObject *); ! PyAPI_FUNC(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); #endif /* HAVE_LONG_LONG */ --- 34,41 ---- #ifdef HAVE_LONG_LONG ! PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); ! PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); ! PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); ! PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); #endif /* HAVE_LONG_LONG */ Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** pyport.h 10 Feb 2003 19:36:46 -0000 2.59 --- pyport.h 29 Mar 2003 10:04:54 -0000 2.60 *************** *** 28,32 **** HAVE_LONG_LONG Meaning: The compiler supports the C type "long long" ! Used in: LONG_LONG **************************************************************************/ --- 28,32 ---- HAVE_LONG_LONG Meaning: The compiler supports the C type "long long" ! Used in: PY_LONG_LONG **************************************************************************/ *************** *** 56,61 **** #ifdef HAVE_LONG_LONG ! #ifndef LONG_LONG ! #define LONG_LONG long long #endif #endif /* HAVE_LONG_LONG */ --- 56,61 ---- #ifdef HAVE_LONG_LONG ! #ifndef PY_LONG_LONG ! #define PY_LONG_LONG long long #endif #endif /* HAVE_LONG_LONG */ *************** *** 79,84 **** #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) ! typedef unsigned LONG_LONG Py_uintptr_t; ! typedef LONG_LONG Py_intptr_t; #else --- 79,84 ---- #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) ! typedef unsigned PY_LONG_LONG Py_uintptr_t; ! typedef PY_LONG_LONG Py_intptr_t; #else From loewis@users.sourceforge.net Sat Mar 29 10:04:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:04:57 -0800 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.156,1.157 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv28047/Objects Modified Files: longobject.c Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** longobject.c 23 Feb 2003 23:11:40 -0000 1.156 --- longobject.c 29 Mar 2003 10:04:55 -0000 1.157 *************** *** 642,651 **** #endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P ! # error "PyLong_FromVoidPtr: sizeof(LONG_LONG) < sizeof(void*)" #endif /* optimize null pointers */ if (p == NULL) return PyInt_FromLong(0); ! return PyLong_FromLongLong((LONG_LONG)p); #endif /* SIZEOF_VOID_P <= SIZEOF_LONG */ --- 642,651 ---- #endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P ! # error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif /* optimize null pointers */ if (p == NULL) return PyInt_FromLong(0); ! return PyLong_FromLongLong((PY_LONG_LONG)p); #endif /* SIZEOF_VOID_P <= SIZEOF_LONG */ *************** *** 674,680 **** #endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P ! # error "PyLong_AsVoidPtr: sizeof(LONG_LONG) < sizeof(void*)" #endif ! LONG_LONG x; if (PyInt_Check(vv)) --- 674,680 ---- #endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P ! # error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif ! PY_LONG_LONG x; if (PyInt_Check(vv)) *************** *** 692,696 **** #ifdef HAVE_LONG_LONG ! /* Initial LONG_LONG support by Chris Herborth (chrish@qnx.com), later * rewritten to use the newer PyLong_{As,From}ByteArray API. */ --- 692,696 ---- #ifdef HAVE_LONG_LONG ! /* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later * rewritten to use the newer PyLong_{As,From}ByteArray API. */ *************** *** 698,707 **** #define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one ! /* Create a new long int object from a C LONG_LONG int. */ PyObject * ! PyLong_FromLongLong(LONG_LONG ival) { ! LONG_LONG bytes = ival; int one = 1; return _PyLong_FromByteArray( --- 698,707 ---- #define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one ! /* Create a new long int object from a C PY_LONG_LONG int. */ PyObject * ! PyLong_FromLongLong(PY_LONG_LONG ival) { ! PY_LONG_LONG bytes = ival; int one = 1; return _PyLong_FromByteArray( *************** *** 710,719 **** } ! /* Create a new long int object from a C unsigned LONG_LONG int. */ PyObject * ! PyLong_FromUnsignedLongLong(unsigned LONG_LONG ival) { ! unsigned LONG_LONG bytes = ival; int one = 1; return _PyLong_FromByteArray( --- 710,719 ---- } ! /* Create a new long int object from a C unsigned PY_LONG_LONG int. */ PyObject * ! PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG ival) { ! unsigned PY_LONG_LONG bytes = ival; int one = 1; return _PyLong_FromByteArray( *************** *** 722,732 **** } ! /* Get a C LONG_LONG int from a long int object. Return -1 and set an error if overflow occurs. */ ! LONG_LONG PyLong_AsLongLong(PyObject *vv) { ! LONG_LONG bytes; int one = 1; int res; --- 722,732 ---- } ! /* Get a C PY_LONG_LONG int from a long int object. Return -1 and set an error if overflow occurs. */ ! PY_LONG_LONG PyLong_AsLongLong(PyObject *vv) { ! PY_LONG_LONG bytes; int one = 1; int res; *************** *** 738,742 **** if (!PyLong_Check(vv)) { if (PyInt_Check(vv)) ! return (LONG_LONG)PyInt_AsLong(vv); PyErr_BadInternalCall(); return -1; --- 738,742 ---- if (!PyLong_Check(vv)) { if (PyInt_Check(vv)) ! return (PY_LONG_LONG)PyInt_AsLong(vv); PyErr_BadInternalCall(); return -1; *************** *** 747,764 **** SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1); ! /* Plan 9 can't handle LONG_LONG in ? : expressions */ if (res < 0) ! return (LONG_LONG)-1; else return bytes; } ! /* Get a C unsigned LONG_LONG int from a long int object. Return -1 and set an error if overflow occurs. */ ! unsigned LONG_LONG PyLong_AsUnsignedLongLong(PyObject *vv) { ! unsigned LONG_LONG bytes; int one = 1; int res; --- 747,764 ---- SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1); ! /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ if (res < 0) ! return (PY_LONG_LONG)-1; else return bytes; } ! /* Get a C unsigned PY_LONG_LONG int from a long int object. Return -1 and set an error if overflow occurs. */ ! unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *vv) { ! unsigned PY_LONG_LONG bytes; int one = 1; int res; *************** *** 773,779 **** SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0); ! /* Plan 9 can't handle LONG_LONG in ? : expressions */ if (res < 0) ! return (unsigned LONG_LONG)res; else return bytes; --- 773,779 ---- SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0); ! /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ if (res < 0) ! return (unsigned PY_LONG_LONG)res; else return bytes; From loewis@users.sourceforge.net Sat Mar 29 10:04:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:04:57 -0800 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv28047/PC Modified Files: pyconfig.h Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pyconfig.h 21 Dec 2002 18:34:06 -0000 1.18 --- pyconfig.h 29 Mar 2003 10:04:55 -0000 1.19 *************** *** 168,172 **** #define COMPILER "[gcc]" #define hypot _hypot ! #define LONG_LONG long long #endif /* GNUC */ --- 168,172 ---- #define COMPILER "[gcc]" #define hypot _hypot ! #define PY_LONG_LONG long long #endif /* GNUC */ *************** *** 192,197 **** /* 64 bit ints are usually spelt __int64 unless compiler has overridden */ #define HAVE_LONG_LONG 1 ! #ifndef LONG_LONG ! # define LONG_LONG __int64 #endif --- 192,197 ---- /* 64 bit ints are usually spelt __int64 unless compiler has overridden */ #define HAVE_LONG_LONG 1 ! #ifndef PY_LONG_LONG ! # define PY_LONG_LONG __int64 #endif *************** *** 238,242 **** # define SIZEOF_HKEY 8 /* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG, ! sizeof(off_t) > sizeof(long), and sizeof(LONG_LONG) >= sizeof(off_t). On Win64 the second condition is not true, but if fpos_t replaces off_t then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64 --- 238,242 ---- # define SIZEOF_HKEY 8 /* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG, ! sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t). On Win64 the second condition is not true, but if fpos_t replaces off_t then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64 From loewis@users.sourceforge.net Sat Mar 29 10:04:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:04:57 -0800 Subject: [Python-checkins] python/dist/src/Modules _testcapimodule.c,1.19,1.20 addrinfo.h,1.4,1.5 bz2module.c,1.15,1.16 posixmodule.c,2.293,2.294 resource.c,2.28,2.29 socketmodule.c,1.257,1.258 structmodule.c,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28047/Modules Modified Files: _testcapimodule.c addrinfo.h bz2module.c posixmodule.c resource.c socketmodule.c structmodule.c Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _testcapimodule.c 31 Jan 2003 15:52:04 -0000 1.19 --- _testcapimodule.c 29 Mar 2003 10:04:54 -0000 1.20 *************** *** 57,61 **** CHECK_SIZEOF(SIZEOF_TIME_T, time_t); #ifdef HAVE_LONG_LONG ! CHECK_SIZEOF(SIZEOF_LONG_LONG, LONG_LONG); #endif --- 57,61 ---- CHECK_SIZEOF(SIZEOF_TIME_T, time_t); #ifdef HAVE_LONG_LONG ! CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG); #endif *************** *** 173,177 **** Note that the meat of the test is contained in testcapi_long.h. This is revolting, but delicate code duplication is worse: "almost ! exactly the same" code is needed to test LONG_LONG, but the ubiquitous dependence on type names makes it impossible to use a parameterized function. A giant macro would be even worse than this. A C++ template --- 173,177 ---- Note that the meat of the test is contained in testcapi_long.h. This is revolting, but delicate code duplication is worse: "almost ! exactly the same" code is needed to test PY_LONG_LONG, but the ubiquitous dependence on type names makes it impossible to use a parameterized function. A giant macro would be even worse than this. A C++ template *************** *** 222,226 **** #define TESTNAME test_longlong_api_inner ! #define TYPENAME LONG_LONG #define F_S_TO_PY PyLong_FromLongLong #define F_PY_TO_S PyLong_AsLongLong --- 222,226 ---- #define TESTNAME test_longlong_api_inner ! #define TYPENAME PY_LONG_LONG #define F_S_TO_PY PyLong_FromLongLong #define F_PY_TO_S PyLong_AsLongLong *************** *** 243,247 **** #undef F_PY_TO_U ! /* Test the L code for PyArg_ParseTuple. This should deliver a LONG_LONG for both long and int arguments. The test may leak a little memory if it fails. --- 243,247 ---- #undef F_PY_TO_U ! /* Test the L code for PyArg_ParseTuple. This should deliver a PY_LONG_LONG for both long and int arguments. The test may leak a little memory if it fails. *************** *** 251,255 **** { PyObject *tuple, *num; ! LONG_LONG value; tuple = PyTuple_New(1); --- 251,255 ---- { PyObject *tuple, *num; ! PY_LONG_LONG value; tuple = PyTuple_New(1); Index: addrinfo.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/addrinfo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** addrinfo.h 6 Dec 2001 19:04:35 -0000 1.4 --- addrinfo.h 29 Mar 2003 10:04:54 -0000 1.5 *************** *** 143,147 **** #define _SS_MAXSIZE 128 #ifdef HAVE_LONG_LONG ! #define _SS_ALIGNSIZE (sizeof(LONG_LONG)) #else #define _SS_ALIGNSIZE (sizeof(double)) --- 143,147 ---- #define _SS_MAXSIZE 128 #ifdef HAVE_LONG_LONG ! #define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG)) #else #define _SS_ALIGNSIZE (sizeof(double)) *************** *** 160,164 **** char __ss_pad1[_SS_PAD1SIZE]; #ifdef HAVE_LONG_LONG ! LONG_LONG __ss_align; /* force desired structure storage alignment */ #else double __ss_align; /* force desired structure storage alignment */ --- 160,164 ---- char __ss_pad1[_SS_PAD1SIZE]; #ifdef HAVE_LONG_LONG ! PY_LONG_LONG __ss_align; /* force desired structure storage alignment */ #else double __ss_align; /* force desired structure storage alignment */ Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** bz2module.c 11 Feb 2003 18:46:19 -0000 1.15 --- bz2module.c 29 Mar 2003 10:04:54 -0000 1.16 *************** *** 37,41 **** #elif SIZEOF_LONG_LONG >= 8 #define BZS_TOTAL_OUT(bzs) \ ! (((LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) #else #define BZS_TOTAL_OUT(bzs) \ --- 37,41 ---- #elif SIZEOF_LONG_LONG >= 8 #define BZS_TOTAL_OUT(bzs) \ ! (((PY_LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) #else #define BZS_TOTAL_OUT(bzs) \ *************** *** 1491,1495 **** int datasize; int bufsize = SMALLCHUNK; ! LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; --- 1491,1495 ---- int datasize; int bufsize = SMALLCHUNK; ! PY_LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; *************** *** 1563,1567 **** PyObject *ret = NULL; bz_stream *bzs = &self->bzs; ! LONG_LONG totalout; int bzerror; --- 1563,1567 ---- PyObject *ret = NULL; bz_stream *bzs = &self->bzs; ! PY_LONG_LONG totalout; int bzerror; *************** *** 1769,1773 **** int datasize; int bufsize = SMALLCHUNK; ! LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; --- 1769,1773 ---- int datasize; int bufsize = SMALLCHUNK; ! PY_LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.293 retrieving revision 2.294 diff -C2 -d -r2.293 -r2.294 *** posixmodule.c 21 Mar 2003 03:08:31 -0000 2.293 --- posixmodule.c 29 Mar 2003 10:04:54 -0000 2.294 *************** *** 892,896 **** PyObject *fval,*ival; #if SIZEOF_TIME_T > SIZEOF_LONG ! ival = PyLong_FromLongLong((LONG_LONG)sec); #else ival = PyInt_FromLong((long)sec); --- 892,896 ---- PyObject *fval,*ival; #if SIZEOF_TIME_T > SIZEOF_LONG ! ival = PyLong_FromLongLong((PY_LONG_LONG)sec); #else ival = PyInt_FromLong((long)sec); *************** *** 919,923 **** #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 1, ! PyLong_FromLongLong((LONG_LONG)st.st_ino)); #else PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino)); --- 919,923 ---- #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 1, ! PyLong_FromLongLong((PY_LONG_LONG)st.st_ino)); #else PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino)); *************** *** 925,929 **** #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) PyStructSequence_SET_ITEM(v, 2, ! PyLong_FromLongLong((LONG_LONG)st.st_dev)); #else PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev)); --- 925,929 ---- #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) PyStructSequence_SET_ITEM(v, 2, ! PyLong_FromLongLong((PY_LONG_LONG)st.st_dev)); #else PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev)); *************** *** 934,938 **** #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 6, ! PyLong_FromLongLong((LONG_LONG)st.st_size)); #else PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size)); --- 934,938 ---- #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 6, ! PyLong_FromLongLong((PY_LONG_LONG)st.st_size)); #else PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size)); *************** *** 2377,2381 **** return Py_BuildValue("l", (long) spawnval); #else ! return Py_BuildValue("L", (LONG_LONG) spawnval); #endif } --- 2377,2381 ---- return Py_BuildValue("l", (long) spawnval); #else ! return Py_BuildValue("L", (PY_LONG_LONG) spawnval); #endif } *************** *** 2518,2522 **** res = Py_BuildValue("l", (long) spawnval); #else ! res = Py_BuildValue("L", (LONG_LONG) spawnval); #endif --- 2518,2522 ---- res = Py_BuildValue("l", (long) spawnval); #else ! res = Py_BuildValue("L", (PY_LONG_LONG) spawnval); #endif *************** *** 5085,5089 **** int fd, how; #if defined(MS_WIN64) || defined(MS_WINDOWS) ! LONG_LONG pos, res; #else off_t pos, res; --- 5085,5089 ---- int fd, how; #if defined(MS_WIN64) || defined(MS_WINDOWS) ! PY_LONG_LONG pos, res; #else off_t pos, res; *************** *** 5817,5831 **** PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, ! PyLong_FromLongLong((LONG_LONG) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, ! PyLong_FromLongLong((LONG_LONG) st.f_bfree)); PyStructSequence_SET_ITEM(v, 4, ! PyLong_FromLongLong((LONG_LONG) st.f_bavail)); PyStructSequence_SET_ITEM(v, 5, ! PyLong_FromLongLong((LONG_LONG) st.f_files)); PyStructSequence_SET_ITEM(v, 6, ! PyLong_FromLongLong((LONG_LONG) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, ! PyLong_FromLongLong((LONG_LONG) st.f_favail)); PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); --- 5817,5831 ---- PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, ! PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, ! PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree)); PyStructSequence_SET_ITEM(v, 4, ! PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail)); PyStructSequence_SET_ITEM(v, 5, ! PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); PyStructSequence_SET_ITEM(v, 6, ! PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, ! PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); Index: resource.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** resource.c 2 Nov 2002 17:46:24 -0000 2.28 --- resource.c 29 Mar 2003 10:04:54 -0000 2.29 *************** *** 129,134 **** if (sizeof(rl.rlim_cur) > sizeof(long)) { return Py_BuildValue("LL", ! (LONG_LONG) rl.rlim_cur, ! (LONG_LONG) rl.rlim_max); } #endif --- 129,134 ---- if (sizeof(rl.rlim_cur) > sizeof(long)) { return Py_BuildValue("LL", ! (PY_LONG_LONG) rl.rlim_cur, ! (PY_LONG_LONG) rl.rlim_max); } #endif *************** *** 293,297 **** #if defined(HAVE_LONG_LONG) if (sizeof(RLIM_INFINITY) > sizeof(long)) { ! v = PyLong_FromLongLong((LONG_LONG) RLIM_INFINITY); } else #endif --- 293,297 ---- #if defined(HAVE_LONG_LONG) if (sizeof(RLIM_INFINITY) > sizeof(long)) { ! v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY); } else #endif Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -d -r1.257 -r1.258 *** socketmodule.c 19 Feb 2003 17:50:16 -0000 1.257 --- socketmodule.c 29 Mar 2003 10:04:54 -0000 1.258 *************** *** 1438,1442 **** return PyInt_FromLong((long) s->sock_fd); #else ! return PyLong_FromLongLong((LONG_LONG)s->sock_fd); #endif } --- 1438,1442 ---- return PyInt_FromLong((long) s->sock_fd); #else ! return PyLong_FromLongLong((PY_LONG_LONG)s->sock_fd); #endif } Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** structmodule.c 20 Mar 2003 20:53:31 -0000 2.59 --- structmodule.c 29 Mar 2003 10:04:55 -0000 2.60 *************** *** 69,74 **** in std mode, they're 8 bytes on all platforms. */ #ifdef HAVE_LONG_LONG ! typedef struct { char c; LONG_LONG x; } s_long_long; ! #define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(LONG_LONG)) #endif --- 69,74 ---- in std mode, they're 8 bytes on all platforms. */ #ifdef HAVE_LONG_LONG ! typedef struct { char c; PY_LONG_LONG x; } s_long_long; ! #define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG)) #endif *************** *** 147,153 **** static int ! get_longlong(PyObject *v, LONG_LONG *p) { ! LONG_LONG x; v = get_pylong(v); --- 147,153 ---- static int ! get_longlong(PyObject *v, PY_LONG_LONG *p) { ! PY_LONG_LONG x; v = get_pylong(v); *************** *** 157,161 **** x = PyLong_AsLongLong(v); Py_DECREF(v); ! if (x == (LONG_LONG)-1 && PyErr_Occurred()) return -1; *p = x; --- 157,161 ---- x = PyLong_AsLongLong(v); Py_DECREF(v); ! if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) return -1; *p = x; *************** *** 166,172 **** static int ! get_ulonglong(PyObject *v, unsigned LONG_LONG *p) { ! unsigned LONG_LONG x; v = get_pylong(v); --- 166,172 ---- static int ! get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) { ! unsigned PY_LONG_LONG x; v = get_pylong(v); *************** *** 176,180 **** x = PyLong_AsUnsignedLongLong(v); Py_DECREF(v); ! if (x == (unsigned LONG_LONG)-1 && PyErr_Occurred()) return -1; *p = x; --- 176,180 ---- x = PyLong_AsUnsignedLongLong(v); Py_DECREF(v); ! if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) return -1; *p = x; *************** *** 316,320 **** nu_longlong(const char *p, const formatdef *f) { ! LONG_LONG x; memcpy((char *)&x, p, sizeof x); return PyLong_FromLongLong(x); --- 316,320 ---- nu_longlong(const char *p, const formatdef *f) { ! PY_LONG_LONG x; memcpy((char *)&x, p, sizeof x); return PyLong_FromLongLong(x); *************** *** 324,328 **** nu_ulonglong(const char *p, const formatdef *f) { ! unsigned LONG_LONG x; memcpy((char *)&x, p, sizeof x); return PyLong_FromUnsignedLongLong(x); --- 324,328 ---- nu_ulonglong(const char *p, const formatdef *f) { ! unsigned PY_LONG_LONG x; memcpy((char *)&x, p, sizeof x); return PyLong_FromUnsignedLongLong(x); *************** *** 481,485 **** np_longlong(char *p, PyObject *v, const formatdef *f) { ! LONG_LONG x; if (get_longlong(v, &x) < 0) return -1; --- 481,485 ---- np_longlong(char *p, PyObject *v, const formatdef *f) { ! PY_LONG_LONG x; if (get_longlong(v, &x) < 0) return -1; *************** *** 491,495 **** np_ulonglong(char *p, PyObject *v, const formatdef *f) { ! unsigned LONG_LONG x; if (get_ulonglong(v, &x) < 0) return -1; --- 491,495 ---- np_ulonglong(char *p, PyObject *v, const formatdef *f) { ! unsigned PY_LONG_LONG x; if (get_ulonglong(v, &x) < 0) return -1; *************** *** 557,562 **** {'P', sizeof(void *), VOID_P_ALIGN, nu_void_p, np_void_p}, #ifdef HAVE_LONG_LONG ! {'q', sizeof(LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong}, ! {'Q', sizeof(LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, #endif {0} --- 557,562 ---- {'P', sizeof(void *), VOID_P_ALIGN, nu_void_p, np_void_p}, #ifdef HAVE_LONG_LONG ! {'q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong}, ! {'Q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, #endif {0} From loewis@users.sourceforge.net Sat Mar 29 10:06:22 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 29 Mar 2003 02:06:22 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.703,1.704 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28757/Misc Modified Files: NEWS Log Message: Rename LONG_LONG to PY_LONG_LONG. Fixes #710285. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.703 retrieving revision 1.704 diff -C2 -d -r1.703 -r1.704 *** NEWS 26 Mar 2003 16:03:16 -0000 1.703 --- NEWS 29 Mar 2003 10:06:18 -0000 1.704 *************** *** 102,105 **** --- 102,107 ---- ----- + - LONG_LONG was renamed to PY_LONG_LONG. + - Added PyObject_SelfIter() to fill the tp_iter slot for the typical case where the method returns its self argument. From nascheme@users.sourceforge.net Sat Mar 29 15:47:57 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat, 29 Mar 2003 07:47:57 -0800 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.45,1.1.2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv7212/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Implement code generation for class definitions. Set code flags from compiler context when building code objects. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.45 retrieving revision 1.1.2.46 diff -C2 -d -r1.1.2.45 -r1.1.2.46 *** newcompile.c 28 Mar 2003 19:19:40 -0000 1.1.2.45 --- newcompile.c 29 Mar 2003 15:47:55 -0000 1.1.2.46 *************** *** 692,695 **** --- 692,727 ---- static int + compiler_class(struct compiler *c, stmt_ty s) + { + int n; + PyCodeObject *co; + /* push class name on stack, needed by BUILD_CLASS */ + ADDOP_O(c, LOAD_CONST, s->v.ClassDef.name, consts); + /* push the tuple of base classes on the stack */ + n = asdl_seq_LEN(s->v.ClassDef.bases); + if (n > 0) + VISIT_SEQ(c, expr, s->v.ClassDef.bases); + ADDOP_I(c, BUILD_TUPLE, n); + if (!compiler_enter_scope(c, s->v.ClassDef.name, (void *)s)) + return 0; + VISIT_SEQ(c, stmt, s->v.ClassDef.body); + ADDOP(c, LOAD_LOCALS); + ADDOP(c, RETURN_VALUE); + co = assemble(c); + if (co == NULL) + return 0; + compiler_exit_scope(c); + + /* XXX closure */ + ADDOP_O(c, LOAD_CONST, (PyObject *)co, consts); + ADDOP_I(c, MAKE_FUNCTION, 0); + ADDOP_I(c, CALL_FUNCTION, 0); + ADDOP(c, BUILD_CLASS); + if (!compiler_nameop(c, s->v.ClassDef.name, Store)) + return 0; + return 1; + } + + static int compiler_lambda(struct compiler *c, expr_ty e) { *************** *** 1005,1011 **** case FunctionDef_kind: return compiler_function(c, s); - break; case ClassDef_kind: ! break; case Return_kind: if (s->v.Return.value) --- 1037,1042 ---- case FunctionDef_kind: return compiler_function(c, s); case ClassDef_kind: ! return compiler_class(c, s); case Return_kind: if (s->v.Return.value) *************** *** 1983,1986 **** --- 2014,2035 ---- } + static int + compute_code_flags(struct compiler *c) + { + PySTEntryObject *ste = c->u->u_ste; + int flags = 0; + if (ste->ste_type != ModuleBlock) + flags |= CO_NEWLOCALS; + if (ste->ste_type == FunctionBlock) { + if (ste->ste_optimized) + flags |= CO_OPTIMIZED; + if (ste->ste_nested) + flags |= CO_NESTED; + if (ste->ste_generator) + flags |= CO_GENERATOR; + } + return flags; + } + static PyCodeObject * makecode(struct compiler *c, struct assembler *a) *************** *** 2009,2013 **** nlocals = PyList_GET_SIZE(c->u->u_varnames); ! co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), 0, a->a_bytecode, consts, names, varnames, nil, nil, --- 2058,2063 ---- nlocals = PyList_GET_SIZE(c->u->u_varnames); ! co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), ! compute_code_flags(c), a->a_bytecode, consts, names, varnames, nil, nil, From nnorwitz@users.sourceforge.net Sat Mar 29 22:01:19 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 29 Mar 2003 14:01:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14076/Lib/test Modified Files: regrtest.py Log Message: Move Mac/Windows specific expected skips from each platform list to the ExpectedSkips class. Add test_scriptpackages to Mac only list. Add test_unicode_file to Windows only list. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** regrtest.py 11 Mar 2003 14:46:48 -0000 1.135 --- regrtest.py 29 Mar 2003 22:01:17 -0000 1.136 *************** *** 575,580 **** test_largefile test_linuxaudiodev - test_macfs - test_macostools test_mhlib test_mpz --- 575,578 ---- *************** *** 582,586 **** test_openpty test_ossaudiodev - test_plistlib test_poll test_posix --- 580,583 ---- *************** *** 605,617 **** test_largefile test_linuxaudiodev - test_macfs - test_macostools test_nis test_ntpath test_ossaudiodev - test_plistlib test_socketserver test_sunaudiodev - test_unicode_file """, 'mac': --- 602,610 ---- *************** *** 659,663 **** test_tarfile test_timing - test_unicode_file """, 'unixware7': --- 652,655 ---- *************** *** 672,682 **** test_largefile test_linuxaudiodev - test_macfs - test_macostools test_minidom test_nis test_ntpath test_openpty - test_plistlib test_pyexpat test_sax --- 664,671 ---- *************** *** 684,688 **** test_sunaudiodev test_sundry - test_unicode_file """, 'openunix8': --- 673,676 ---- *************** *** 697,707 **** test_largefile test_linuxaudiodev - test_macfs - test_macostools test_minidom test_nis test_ntpath test_openpty - test_plistlib test_pyexpat test_sax --- 685,692 ---- *************** *** 709,713 **** test_sunaudiodev test_sundry - test_unicode_file """, 'sco_sv3': --- 694,697 ---- *************** *** 726,736 **** test_linuxaudiodev test_locale - test_macfs - test_macostools test_minidom test_nis test_ntpath test_openpty - test_plistlib test_pyexpat test_queue --- 710,717 ---- *************** *** 743,747 **** test_threadedtempfile test_threading - test_unicode_file """, 'riscos': --- 724,727 ---- *************** *** 765,775 **** test_linuxaudiodev test_locale - test_macfs - test_macostools test_mmap test_nis test_ntpath test_openpty - test_plistlib test_poll test_popen2 --- 745,752 ---- *************** *** 785,789 **** test_threading test_timing - test_unicode_file """, 'darwin': --- 762,765 ---- *************** *** 812,816 **** test_socketserver test_sunaudiodev - test_unicode_file """, 'sunos5': --- 788,791 ---- *************** *** 828,836 **** test_imgfile test_linuxaudiodev - test_macfs - test_macostools test_mpz test_openpty - test_plistlib test_socketserver test_zipfile --- 803,808 ---- *************** *** 852,867 **** test_linuxaudiodev test_locale - test_macfs - test_macostools test_minidom test_nis test_ntpath test_openpty - test_plistlib test_pyexpat test_sax test_socketserver test_sunaudiodev - test_unicode_file test_zipfile test_zlib --- 824,835 ---- *************** *** 881,891 **** test_linuxaudiodev test_locale - test_macfs - test_macostools test_mhlib test_mmap test_mpz test_nis - test_plistlib test_poll test_popen2 --- 849,856 ---- *************** *** 893,897 **** test_socketserver test_sunaudiodev - test_unicode_file """, 'cygwin': --- 858,861 ---- *************** *** 909,921 **** test_linuxaudiodev test_locale - test_macfs - test_macostools test_mpz test_nis test_ossaudiodev - test_plistlib test_socketserver test_sunaudiodev - test_unicode_file """, 'os2emx': --- 873,881 ---- *************** *** 935,940 **** test_largefile test_linuxaudiodev - test_macfs - test_macostools test_mhlib test_mmap --- 895,898 ---- *************** *** 942,951 **** test_openpty test_ossaudiodev - test_plistlib test_pty test_resource test_signal test_sunaudiodev - test_unicode_file """, } --- 900,907 ---- *************** *** 976,986 **** if not sys.platform in ("mac", "darwin"): ! self.expected.add("test_macostools") ! self.expected.add("test_macfs") ! self.expected.add("test_aepack") if sys.platform != "win32": ! self.expected.add("test_winreg") ! self.expected.add("test_winsound") self.valid = True --- 932,945 ---- if not sys.platform in ("mac", "darwin"): ! MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack", ! "test_plistlib", "test_scriptpackages"] ! for skip in MAC_ONLY: ! self.expected.add(skip) if sys.platform != "win32": ! WIN_ONLY = ["test_unicode_file", "test_winreg", ! "test_winsound"] ! for skip in WIN_ONLY: ! self.expected.add(skip) self.valid = True From jackjansen@users.sourceforge.net Sat Mar 29 22:07:51 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 29 Mar 2003 14:07:51 -0800 Subject: [Python-checkins] python/dist/src configure.in,1.397,1.398 configure,1.386,1.387 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv17203 Modified Files: configure.in configure Log Message: The test for setpgrp having two arguments didn't actually test anything. For reasons unknown this suddenly started to matter (since Martin's 1.396 checkin? But why?), at least on MacOSX. Added a real test similar to the getpgrp argument test. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.397 retrieving revision 1.398 diff -C2 -d -r1.397 -r1.398 *** configure.in 28 Mar 2003 18:43:31 -0000 1.397 --- configure.in 29 Mar 2003 22:07:47 -0000 1.398 *************** *** 1926,1931 **** ) ) ! AC_FUNC_SETPGRP(AC_DEFINE(SETPGRP_HAVE_ARG, 1, ! [Define if setpgrp() must be called as setpgrp(0, 0).]) ) AC_CHECK_FUNCS(gettimeofday, --- 1926,1935 ---- ) ) ! 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, Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.386 retrieving revision 1.387 diff -C2 -d -r1.386 -r1.387 *** configure 28 Mar 2003 18:43:13 -0000 1.386 --- configure 29 Mar 2003 22:07:47 -0000 1.387 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.396 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.397 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 13012,13031 **** done ! echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5 ! echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6 ! if test "${ac_cv_func_setpgrp_void+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5 - echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;} - { (exit 1); exit 1; }; } - else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" ! #if HAVE_UNISTD_H ! # include #endif #ifdef F77_DUMMY_MAIN --- 13012,13038 ---- done ! ! for ac_func in setpgrp ! do ! as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` ! echo "$as_me:$LINENO: checking for $ac_func" >&5 ! echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 ! if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" ! /* System header to define __stub macros and hopefully few prototypes, ! which can conflict with char $ac_func (); below. */ ! #include ! /* Override any gcc2 internal prototype to avoid an error. */ ! #ifdef __cplusplus ! extern "C" #endif + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func (); + char (*f) (); #ifdef F77_DUMMY_MAIN *************** *** 13038,13055 **** main () { ! /* If this system has a BSD-style setpgrp which takes arguments, ! setpgrp(1, 1) will fail with ESRCH and return -1, in that case ! exit successfully. */ ! exit (setpgrp (1,1) == -1 ? 0 : 1); ; return 0; } _ACEOF ! rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 --- 13045,13068 ---- main () { ! /* The GNU C library defines this for functions which it implements ! to always fail with ENOSYS. Some functions are actually named ! something starting with __ and the normal name is an alias. */ ! #if defined (__stub_$ac_func) || defined (__stub___$ac_func) ! choke me ! #else ! f = $ac_func; ! #endif ! ; return 0; } _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 *************** *** 13057,13080 **** echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ! ac_cv_func_setpgrp_void=no else ! echo "$as_me: program exited with status $ac_status" >&5 ! echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! ( exit $ac_status ) ! ac_cv_func_setpgrp_void=yes ! fi ! rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi ! echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5 ! echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6 ! if test $ac_cv_func_setpgrp_void = yes; then cat >>confdefs.h <<\_ACEOF ! #define SETPGRP_VOID 1 _ACEOF fi --- 13070,13131 ---- echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ! eval "$as_ac_var=yes" else ! echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ! eval "$as_ac_var=no" fi + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi ! echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 ! echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 ! if test `eval echo '${'$as_ac_var'}'` = yes; then ! cat >>confdefs.h <<_ACEOF ! #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 ! _ACEOF ! cat >conftest.$ac_ext <<_ACEOF ! #line $LINENO "configure" ! #include "confdefs.h" ! #include ! #ifdef F77_DUMMY_MAIN ! # ifdef __cplusplus ! extern "C" ! # endif ! int F77_DUMMY_MAIN() { return 1; } ! #endif ! int ! main () ! { ! setpgrp(0,0); ! ; ! return 0; ! } ! _ACEOF ! rm -f conftest.$ac_objext ! if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ! (eval $ac_compile) 2>&5 ! ac_status=$? ! echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest.$ac_objext' ! { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ! (eval $ac_try) 2>&5 ! ac_status=$? ! echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF ! #define SETPGRP_HAVE_ARG 1 _ACEOF + + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi + rm -f conftest.$ac_objext conftest.$ac_ext + + fi + done *************** *** 17672,17676 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 17723,17727 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` From nnorwitz@users.sourceforge.net Sat Mar 29 22:25:23 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 29 Mar 2003 14:25:23 -0800 Subject: [Python-checkins] python/dist/src/Modules readline.c,2.41.6.6,2.41.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25959/Modules Modified Files: Tag: release22-maint readline.c Log Message: Backport Patch 659834 checked in by GvR on 2002/12/30 16:25:38 Check for readline 2.2 features. This should make it possible to compile readline.c again with GNU readline versions 2.0 or 2.1; this ability was removed in readline.c rev. 2.49. Apparently the older versions are still in widespread deployment on older Solaris installations. With an older readline, completion behavior is subtly different (a space is always added). Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.41.6.6 retrieving revision 2.41.6.7 diff -C2 -d -r2.41.6.6 -r2.41.6.7 *** readline.c 1 Mar 2003 15:19:49 -0000 2.41.6.6 --- readline.c 29 Mar 2003 22:25:18 -0000 2.41.6.7 *************** *** 533,537 **** --- 533,539 ---- strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?"); /* All nonalphanums except '.' */ + #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER rl_completion_append_character ='\0'; + #endif begidx = PyInt_FromLong(0L); From nnorwitz@users.sourceforge.net Sat Mar 29 22:25:25 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 29 Mar 2003 14:25:25 -0800 Subject: [Python-checkins] python/dist/src configure,1.279.6.18,1.279.6.19 configure.in,1.288.6.18,1.288.6.19 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv25959 Modified Files: Tag: release22-maint configure configure.in Log Message: Backport Patch 659834 checked in by GvR on 2002/12/30 16:25:38 Check for readline 2.2 features. This should make it possible to compile readline.c again with GNU readline versions 2.0 or 2.1; this ability was removed in readline.c rev. 2.49. Apparently the older versions are still in widespread deployment on older Solaris installations. With an older readline, completion behavior is subtly different (a space is always added). Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279.6.18 retrieving revision 1.279.6.19 diff -C2 -d -r1.279.6.18 -r1.279.6.19 *** configure 23 Feb 2003 23:34:32 -0000 1.279.6.18 --- configure 29 Mar 2003 22:25:14 -0000 1.279.6.19 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.288.6.17 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.288.6.18 # Guess values for system-dependent variables and create Makefiles. *************** *** 7308,7314 **** fi # check for readline 4.0 echo $ac_n "checking for rl_pre_input_hook in -lreadline""... $ac_c" 1>&6 ! echo "configure:7313: checking for rl_pre_input_hook in -lreadline" >&5 ac_lib_var=`echo readline'_'rl_pre_input_hook | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then --- 7308,7353 ---- fi + # check for readline 2.2 + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:7318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + have_readline=yes + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + have_readline=no + fi + rm -f conftest* + if test $have_readline = yes + then + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "extern int rl_completion_append_character;" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF + #define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 + EOF + + fi + rm -f conftest* + + fi + # check for readline 4.0 echo $ac_n "checking for rl_pre_input_hook in -lreadline""... $ac_c" 1>&6 ! echo "configure:7352: checking for rl_pre_input_hook in -lreadline" >&5 ac_lib_var=`echo readline'_'rl_pre_input_hook | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then *************** *** 7318,7322 **** LIBS="-lreadline -ltermcap $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" --- 7368,7372 ---- ; return 0; } EOF ! if { (eval echo configure:7371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" *************** *** 7355,7359 **** # check for readline 4.2 echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6 ! echo "configure:7358: checking for rl_completion_matches in -lreadline" >&5 ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then --- 7394,7398 ---- # check for readline 4.2 echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6 ! echo "configure:7397: checking for rl_completion_matches in -lreadline" >&5 ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then *************** *** 7363,7367 **** LIBS="-lreadline -ltermcap $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" --- 7413,7417 ---- ; return 0; } EOF ! if { (eval echo configure:7416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" *************** *** 7399,7403 **** echo $ac_n "checking for broken nice()""... $ac_c" 1>&6 ! echo "configure:7402: checking for broken nice()" >&5 if eval "test \"`echo '$''{'ac_cv_broken_nice'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 --- 7438,7442 ---- echo $ac_n "checking for broken nice()""... $ac_c" 1>&6 ! echo "configure:7441: checking for broken nice()" >&5 if eval "test \"`echo '$''{'ac_cv_broken_nice'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 7408,7412 **** else cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_broken_nice=yes --- 7459,7463 ---- EOF ! if { (eval echo configure:7462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_broken_nice=yes *************** *** 7445,7454 **** # On HP/UX 11.0, mvwdelch is a block with a return statement echo $ac_n "checking whether mvwdelch is an expression""... $ac_c" 1>&6 ! echo "configure:7448: checking whether mvwdelch is an expression" >&5 if eval "test \"`echo '$''{'ac_cv_mvwdelch_is_expression'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < --- 7484,7493 ---- # On HP/UX 11.0, mvwdelch is a block with a return statement echo $ac_n "checking whether mvwdelch is an expression""... $ac_c" 1>&6 ! echo "configure:7487: checking whether mvwdelch is an expression" >&5 if eval "test \"`echo '$''{'ac_cv_mvwdelch_is_expression'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < *************** *** 7460,7464 **** ; return 0; } EOF ! if { (eval echo configure:7463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mvwdelch_is_expression=yes --- 7499,7503 ---- ; return 0; } EOF ! if { (eval echo configure:7502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mvwdelch_is_expression=yes *************** *** 7483,7492 **** echo $ac_n "checking whether WINDOW has _flags""... $ac_c" 1>&6 ! echo "configure:7486: checking whether WINDOW has _flags" >&5 if eval "test \"`echo '$''{'ac_cv_window_has_flags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < --- 7522,7531 ---- echo $ac_n "checking whether WINDOW has _flags""... $ac_c" 1>&6 ! echo "configure:7525: checking whether WINDOW has _flags" >&5 if eval "test \"`echo '$''{'ac_cv_window_has_flags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < *************** *** 7498,7502 **** ; return 0; } EOF ! if { (eval echo configure:7501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_window_has_flags=yes --- 7537,7541 ---- ; return 0; } EOF ! if { (eval echo configure:7540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_window_has_flags=yes *************** *** 7529,7538 **** EOF echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 ! echo "configure:7532: checking for socklen_t" >&5 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 < --- 7568,7577 ---- EOF echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 ! echo "configure:7571: checking for socklen_t" >&5 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 < *************** *** 7590,7594 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7593: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 7629,7633 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:7632: 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.288.6.18 retrieving revision 1.288.6.19 diff -C2 -d -r1.288.6.18 -r1.288.6.19 *** configure.in 23 Feb 2003 23:34:37 -0000 1.288.6.18 --- configure.in 29 Mar 2003 22:25:17 -0000 1.288.6.19 *************** *** 2013,2016 **** --- 2013,2027 ---- fi + # check for readline 2.2 + AC_TRY_CPP([#include ], + have_readline=yes, have_readline=no) + if test $have_readline = yes + then + AC_EGREP_HEADER([extern int rl_completion_append_character;], + [readline/readline.h], + AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, + [Define if you have readline 2.2]), ) + fi + # check for readline 4.0 AC_CHECK_LIB(readline, rl_pre_input_hook, From jackjansen@users.sourceforge.net Sat Mar 29 22:54:03 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 29 Mar 2003 14:54:03 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv5854 Modified Files: gensuitemodule.py Log Message: - Added an is_scriptable method to test applications for having a scripting dictionary. Made up by me, not guaranteed to be correct (and, indeed, Internet Explorer does not seem to play by the book). - Added the interactive main program as a separate routine, so it can be called from the IDE later. Also made it less interactive by default: only the input app and output package folder are asked for. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** gensuitemodule.py 29 Mar 2003 00:08:24 -0000 1.37 --- gensuitemodule.py 29 Mar 2003 22:54:00 -0000 1.38 *************** *** 20,25 **** --- 20,27 ---- import OSATerminology from Carbon.Res import * + import Carbon.Folder import MacOS import getopt + import plistlib _MAC_LIB_FOLDER=os.path.dirname(aetools.__file__) *************** *** 80,99 **** edit_modnames=edit_modnames, creatorsignature=creatorsignature) else: ! # The dialogOptionFlags below allows selection of .app bundles. ! filename = EasyDialogs.AskFileForOpen( ! message='Select scriptable application', ! dialogOptionFlags=0x1056) ! if not filename: ! sys.exit(0) ! try: ! processfile(filename) ! except MacOS.Error, arg: ! print "Error getting terminology:", arg ! print "Retry, manually parsing resources" ! processfile_fromresource(filename) def processfile_fromresource(fullname, output=None, basepkgname=None, edit_modnames=None, creatorsignature=None): """Process all resources in a single file""" cur = CurResFile() print "Processing", fullname --- 82,140 ---- edit_modnames=edit_modnames, creatorsignature=creatorsignature) else: ! main_interactive() ! ! def main_interactive(interact=0, basepkgname='StdSuites'): ! if interact: ! # Ask for save-filename for each module ! edit_modnames = None ! else: ! # Use default filenames for each module ! edit_modnames = [] ! appsfolder = Carbon.Folder.FSFindFolder(-32765, 'apps', 0) ! filename = EasyDialogs.AskFileForOpen( ! message='Select scriptable application', ! dialogOptionFlags=0x1056, # allow selection of .app bundles ! defaultLocation=appsfolder) ! if not filename: ! return ! if not is_scriptable(filename): ! if EasyDialogs.AskYesNoCancel( ! "Warning: application does not seem scriptable", ! yes="Continue", default=2, no="") <= 0: ! return ! try: ! processfile(filename, edit_modnames=edit_modnames, basepkgname=basepkgname) ! except MacOS.Error, arg: ! print "Error getting terminology:", arg ! print "Retry, manually parsing resources" ! processfile_fromresource(filename, edit_modnames=edit_modnames, ! basepkgname=basepkgname) ! ! def is_scriptable(application): ! """Return true if the application is scriptable""" ! if os.path.isdir(application): ! plistfile = os.path.join(application, 'Contents', 'Info.plist') ! if not os.path.exists(plistfile): ! return False ! plist = plistlib.Plist.fromFile(plistfile) ! return plist.get('NSAppleScriptEnabled', False) ! # If it is a file test for an aete/aeut resource. ! currf = CurResFile() ! try: ! refno = macresource.open_pathname(application) ! except MacOS.Error: ! return False ! UseResFile(refno) ! n_terminology = Count1Resources('aete') + Count1Resources('aeut') + \ ! Count1Resources('scsz') + Count1Resources('osiz') ! CloseResFile(refno) ! UseResFile(currf) ! return n_terminology > 0 def processfile_fromresource(fullname, output=None, basepkgname=None, edit_modnames=None, creatorsignature=None): """Process all resources in a single file""" + if not is_scriptable(fullname): + print "Warning: app does not seem scriptable: %s" % fullname cur = CurResFile() print "Processing", fullname *************** *** 128,131 **** --- 169,174 ---- edit_modnames=None, creatorsignature=None): """Ask an application for its terminology and process that""" + if not is_scriptable(fullname): + print "Warning: app does not seem scriptable: %s" % fullname print "\nASKING FOR aete DICTIONARY IN", `fullname` try: From jackjansen@users.sourceforge.net Sat Mar 29 23:04:02 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 29 Mar 2003 15:04:02 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv11296/Lib/plat-mac Added Files: gensuitemodule.py Log Message: Moved gensuitemodule from Mac/scripts to Lib/plat-mac. Documentation remains to be done. --- NEW FILE: gensuitemodule.py --- """ gensuitemodule - Generate an AE suite module from an aete/aeut resource Based on aete.py. Reading and understanding this code is left as an exercise to the reader. """ import MacOS import EasyDialogs import os import string import sys import types import StringIO import keyword import macresource import aetools import distutils.sysconfig [...1093 lines suppressed...] rv = '' ok = string.ascii_letters + '_' ok2 = ok + string.digits for c in str: if c in ok: rv = rv + c elif c == ' ': rv = rv + '_' else: rv = rv + '_%02.2x_'%ord(c) ok = ok2 if keyword.iskeyword(rv): rv = rv + '_' return rv # Call the main program if __name__ == '__main__': main() sys.exit(1) From jackjansen@users.sourceforge.net Sat Mar 29 23:04:04 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 29 Mar 2003 15:04:04 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.38,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv11296/Mac/scripts Removed Files: gensuitemodule.py Log Message: Moved gensuitemodule from Mac/scripts to Lib/plat-mac. Documentation remains to be done. --- gensuitemodule.py DELETED --- From montanaro@users.sourceforge.net Sun Mar 30 04:54:26 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 29 Mar 2003 20:54:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_urllibnet.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14763/Lib/test Added Files: test_urllibnet.py Log Message: The socket module now always uses the _socketobject wrapper class, even on platforms which have dup(2). The makefile() method is built directly on top of the socket without duplicating the file descriptor, allowing timeouts to work properly. Includes a new test case (urllibnet) which requires the network resource. Closes bug 707074. --- NEW FILE: test_urllibnet.py --- #!/usr/bin/env python import unittest from test import test_support import socket import urllib2 import sys class URLTimeoutTest(unittest.TestCase): TIMEOUT = 10.0 def setUp(self): socket.setdefaulttimeout(self.TIMEOUT) def tearDown(self): socket.setdefaulttimeout(None) def testURLread(self): f = urllib2.urlopen("http://www.python.org/") x = f.read() def test_main(): test_support.requires('network') suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(URLTimeoutTest)) test_support.run_suite(suite) if __name__ == "__main__": test_main() From montanaro@users.sourceforge.net Sun Mar 30 04:54:26 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 29 Mar 2003 20:54:26 -0800 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14763/Lib Modified Files: socket.py Log Message: The socket module now always uses the _socketobject wrapper class, even on platforms which have dup(2). The makefile() method is built directly on top of the socket without duplicating the file descriptor, allowing timeouts to work properly. Includes a new test case (urllibnet) which requires the network resource. Closes bug 707074. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** socket.py 22 Aug 2002 17:31:16 -0000 1.35 --- socket.py 30 Mar 2003 04:54:23 -0000 1.36 *************** *** 60,70 **** _realsocket = socket - _needwrapper = False if (sys.platform.lower().startswith("win") or (hasattr(os, 'uname') and os.uname()[0] == "BeOS") or sys.platform=="riscos"): - _needwrapper = True - if _have_ssl: _realssl = ssl --- 60,67 ---- *************** *** 181,186 **** del _m, _s ! if _needwrapper: ! socket = SocketType = _socketobject class _fileobject(object): --- 178,182 ---- del _m, _s ! socket = SocketType = _socketobject class _fileobject(object): From montanaro@users.sourceforge.net Sun Mar 30 04:54:26 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 29 Mar 2003 20:54:26 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.704,1.705 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14763/Misc Modified Files: NEWS Log Message: The socket module now always uses the _socketobject wrapper class, even on platforms which have dup(2). The makefile() method is built directly on top of the socket without duplicating the file descriptor, allowing timeouts to work properly. Includes a new test case (urllibnet) which requires the network resource. Closes bug 707074. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.704 retrieving revision 1.705 diff -C2 -d -r1.704 -r1.705 *** NEWS 29 Mar 2003 10:06:18 -0000 1.704 --- NEWS 30 Mar 2003 04:54:24 -0000 1.705 *************** *** 60,63 **** --- 60,68 ---- Added chain() and cycle(). + - The socket module now always uses the _socketobject wrapper class, even on + platforms which have dup(2). The makefile() method is built directly + on top of the socket without duplicating the file descriptor, allowing + timeouts to work properly. + Library ------- From loewis@users.sourceforge.net Sun Mar 30 08:26:06 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 30 Mar 2003 00:26:06 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.151,1.152 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21305/Modules Modified Files: _tkinter.c Log Message: Fake bool API for Python 2.2. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** _tkinter.c 3 Mar 2003 21:16:39 -0000 1.151 --- _tkinter.c 30 Mar 2003 08:26:04 -0000 1.152 *************** *** 47,50 **** --- 47,55 ---- #endif + #ifndef PyBool_Check + #define PyBool_Check(o) 0 + #define PyBool_FromLong PyInt_FromLong + #endif + /* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately, making _tkinter correct for this API means to break earlier From loewis@users.sourceforge.net Sun Mar 30 08:45:00 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 30 Mar 2003 00:45:00 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.152,1.153 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28329/Modules Modified Files: _tkinter.c Log Message: Wrap thread stuff in WITH_THREAD. Fixes #704641. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** _tkinter.c 30 Mar 2003 08:26:04 -0000 1.152 --- _tkinter.c 30 Mar 2003 08:44:58 -0000 1.153 *************** *** 330,334 **** } #endif /* MS_WINDOWS */ - #endif /* WITH_THREAD */ /* Wait up to 1s for the mainloop to come up. */ --- 330,333 ---- *************** *** 350,353 **** --- 349,353 ---- return 0; } + #endif /* WITH_THREAD */ *************** *** 625,628 **** --- 625,629 ---- } #endif + #ifdef WITH_THREAD if (v->threaded && tcl_lock) { /* If Tcl is threaded, we don't need the lock. */ *************** *** 630,633 **** --- 631,635 ---- tcl_lock = NULL; } + #endif v->BooleanType = Tcl_GetObjType("boolean"); *************** *** 1247,1250 **** --- 1249,1253 ---- int flags = TCL_EVAL_DIRECT; + #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { /* We cannot call the command directly. Instead, we must *************** *** 1273,1277 **** } } ! else { objv = Tkapp_CallArgs(args, objStore, &objc); --- 1276,1282 ---- } } ! else ! #endif ! { objv = Tkapp_CallArgs(args, objStore, &objc); *************** *** 1533,1536 **** --- 1538,1542 ---- ev->res = &res; ev->exc = &exc; + #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { /* The current thread is not the interpreter thread. Marshal *************** *** 1544,1548 **** Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->cond, &var_mutex); } ! else { /* Tcl is not threaded, or this is the interpreter thread. To perform the call, we must hold the TCL lock. To receive the --- 1550,1556 ---- Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->cond, &var_mutex); } ! else ! #endif ! { /* Tcl is not threaded, or this is the interpreter thread. To perform the call, we must hold the TCL lock. To receive the *************** *** 2050,2056 **** --- 2058,2066 ---- } + #ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread() && !WaitForMainloop(self)) return NULL; + #endif data = PyMem_NEW(PythonCmd_ClientData, 1); *************** *** 2209,2212 **** --- 2219,2223 ---- return NULL; + #ifdef WITH_THREAD if (!self && !tcl_lock) { /* We don't have the Tcl lock since Tcl is threaded. */ *************** *** 2216,2219 **** --- 2227,2231 ---- return NULL; } + #endif if (self) { *************** *** 2250,2253 **** --- 2262,2266 ---- return NULL; + #ifdef WITH_THREAD if (!self && !tcl_lock) { /* We don't have the Tcl lock since Tcl is threaded. */ *************** *** 2257,2260 **** --- 2270,2274 ---- return NULL; } + #endif if (self) { *************** *** 2427,2430 **** --- 2441,2445 ---- } + #ifdef WITH_THREAD if (!self && !tcl_lock) { /* We don't have the Tcl lock since Tcl is threaded. */ *************** *** 2434,2437 **** --- 2449,2453 ---- return NULL; } + #endif if (self) { *************** *** 2461,2464 **** --- 2477,2481 ---- return NULL; + #ifdef WITH_THREAD if (!self && !tcl_lock) { /* We don't have the Tcl lock since Tcl is threaded. */ *************** *** 2468,2471 **** --- 2485,2489 ---- return NULL; } + #endif if (self) { *************** *** 2835,2839 **** --- 2853,2859 ---- #endif + #ifdef WITH_THREAD static PyThreadState *event_tstate = NULL; + #endif static int From loewis@users.sourceforge.net Sun Mar 30 14:25:42 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 30 Mar 2003 06:25:42 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.705,1.706 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1474/Misc Modified Files: NEWS Log Message: Patch #545300: Support marked sections. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.705 retrieving revision 1.706 diff -C2 -d -r1.705 -r1.706 *** NEWS 30 Mar 2003 04:54:24 -0000 1.705 --- NEWS 30 Mar 2003 14:25:40 -0000 1.706 *************** *** 68,71 **** --- 68,74 ---- ------- + - sgmllib now supports SGML marked sections, in particular the + MS Office extensions. + - The urllib module now offers support for the iterator protocol. SF patch 698520 contributed by Brett Cannon. From loewis@users.sourceforge.net Sun Mar 30 14:25:41 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 30 Mar 2003 06:25:41 -0800 Subject: [Python-checkins] python/dist/src/Lib markupbase.py,1.6,1.7 sgmllib.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1474/Lib Modified Files: markupbase.py sgmllib.py Log Message: Patch #545300: Support marked sections. Index: markupbase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/markupbase.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** markupbase.py 3 Jun 2002 15:58:31 -0000 1.6 --- markupbase.py 30 Mar 2003 14:25:39 -0000 1.7 *************** *** 5,8 **** --- 5,15 ---- _declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match _declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match + _commentclose = re.compile(r'--\s*>') + _markedsectionclose = re.compile(r']\s*]\s*>') + + # An analysis of the MS-Word extensions is available at + # http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf + + _msmarkedsectionclose = re.compile(r']\s*>') del re *************** *** 54,57 **** --- 61,71 ---- # deployed," this should only be the document type # declaration (""). + # ISO 8879:1986, however, has more complex + # declaration syntax for elements in , including: + # --comment-- + # [marked section] + # name in the following list: ENTITY, DOCTYPE, ELEMENT, + # ATTLIST, NOTATION, SHORTREF, USEMAP, + # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM rawdata = self.rawdata j = i + 2 *************** *** 61,67 **** # or just a buffer boundary. return -1 ! # in practice, this should look like: ((name|stringlit) S*)+ '>' n = len(rawdata) ! decltype, j = self._scan_name(j, i) if j < 0: return j --- 75,91 ---- # or just a buffer boundary. return -1 ! # A simple, practical version could look like: ((name|stringlit) S*) + '>' n = len(rawdata) ! if rawdata[j:j+1] == '--': #comment ! # Locate --.*-- as the body of the comment ! return self.parse_comment(i) ! elif rawdata[j] == '[': #marked section ! # Locate [statusWord [...arbitrary SGML...]] as the body of the marked section ! # Where statusWord is one of TEMP, CDATA, IGNORE, INCLUDE, RCDATA ! # Note that this is extended by Microsoft Office "Save as Web" function ! # to include [if...] and [endif]. ! return self.parse_marked_section(i) ! else: #all other declaration elements ! decltype, j = self._scan_name(j, i) if j < 0: return j *************** *** 88,93 **** --- 112,124 ---- j = j + 1 elif c == "[": + # this could be handled in a separate doctype parser if decltype == "doctype": j = self._parse_doctype_subset(j + 1, i) + elif decltype in ("attlist", "linktype", "link", "element"): + # must tolerate []'d groups in a content model in an element declaration + # also in data attribute specifications of attlist declaration + # also link type declaration subsets in linktype declarations + # also link attribute specification lists in link declarations + self.error("unsupported '[' char in %s declaration" % decltype) else: self.error("unexpected '[' char in declaration") *************** *** 98,101 **** --- 129,168 ---- return j return -1 # incomplete + + # Internal -- parse a marked section + # Override this to handle MS-word extension syntax content + def parse_marked_section( self, i, report=1 ): + rawdata= self.rawdata + assert rawdata[i:i+3] == ' ending + match= _markedsectionclose.search(rawdata, i+3) + elif sectName in ("if", "else", "endif"): + # look for MS Office ]> ending + match= _msmarkedsectionclose.search(rawdata, i+3) + else: + self.error('unknown status keyword %s in marked section' % `rawdata[i+3:j]`) + if not match: + return -1 + if report: + j = match.start(0) + self.unknown_decl(rawdata[i+3: j]) + return match.end(0) + + # Internal -- parse comment, return length or -1 if not terminated + def parse_comment(self, i, report=1): + rawdata = self.rawdata + if rawdata[i:i+4] != '