From rhettinger@users.sourceforge.net Mon Jul 1 00:02:25 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 30 Jun 2002 16:02:25 -0700 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5793 Modified Files: pep-0290.txt Log Message: Version correction spotted by Zoltan Felleg Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0290.txt 17 Jun 2002 12:00:22 -0000 1.1 --- pep-0290.txt 30 Jun 2002 23:02:23 -0000 1.2 *************** *** 123,127 **** type(s, types.StringTypes --> isinstance(s, basestring) Idea: The types module will likely to be deprecated in the future. ! Version: 2.2 or greater Benefits: May be slightly faster, avoid a deprecated feature. Locating: grep types *.py | grep import --- 123,127 ---- type(s, types.StringTypes --> isinstance(s, basestring) Idea: The types module will likely to be deprecated in the future. ! Version: 2.3 or greater (basestring introduced in Py2.3) Benefits: May be slightly faster, avoid a deprecated feature. Locating: grep types *.py | grep import *************** *** 145,148 **** --- 145,149 ---- allows an "except Exception" clause to catch all exceptions. Locating: Use PyChecker + Pattern: "foobar"[:3] == "foo" -> "foobar".startswith("foo") From tim_one@users.sourceforge.net Mon Jul 1 04:52:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 30 Jun 2002 20:52:21 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31850/python/Modules Modified Files: gcmodule.c Log Message: OK, I couldn't stand it <0.5 wink>: removed all uncertainty about what's in gc_refs, even at the cost of putting back a test+branch in visit_decref. The good news: since gc_refs became utterly tame then, it became clear that another special value could be useful. The move_roots() and move_root_reachable() passes have now been replaced by a single move_unreachable() pass. Besides saving a pass over the generation, this has a better effect: most of the time everything turns out to be reachable, so we were breaking the generation list apart and moving it into into the reachable list, one element at a time. Now the reachable stuff stays in the generation list, and the unreachable stuff is moved instead. This isn't quite as good as it sounds, since sometimes we guess wrongly that a thing is unreachable, and have to move it back again. Still, overall, it yields a significant (but not dramatic) boost in collection speed. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** gcmodule.c 30 Jun 2002 21:31:03 -0000 2.47 --- gcmodule.c 1 Jul 2002 03:52:19 -0000 2.48 *************** *** 75,89 **** /* When a collection begins, gc_refs is set to ob_refcnt for, and only for, * the objects in the generation being collected, called the "young" ! * generation at that point. As collection proceeds, when it's determined ! * that one of these can't be collected (e.g., because it's reachable from ! * outside, or has a __del__ method), the object is moved out of young, and ! * gc_refs is set to a negative value. The latter is so we can distinguish ! * collection candidates from non-candidates just by looking at the object. */ - /* Special gc_refs value, although any negative value means "moved". */ - #define GC_MOVED -123 ! /* True iff an object is still a candidate for collection. */ ! #define STILL_A_CANDIDATE(o) ((AS_GC(o))->gc.gc_refs >= 0) /* list of uncollectable objects */ --- 75,92 ---- /* When a collection begins, gc_refs is set to ob_refcnt for, and only for, * the objects in the generation being collected, called the "young" ! * generation at that point. As collection proceeds, the gc_refs members ! * of young objects are set to GC_REACHABLE when it becomes known that they're ! * uncollectable, and to GC_TENTATIVELY_UNREACHABLE when the evidence ! * suggests they are collectable (this can't be known for certain until all ! * of the young generation is scanned). */ ! /* Special gc_refs values. */ ! #define GC_REACHABLE -123 ! #define GC_TENTATIVELY_UNREACHABLE -42 ! ! #define IS_REACHABLE(o) ((AS_GC(o))->gc.gc_refs == GC_REACHABLE) ! #define IS_TENTATIVELY_UNREACHABLE(o) ( \ ! (AS_GC(o))->gc.gc_refs == GC_TENTATIVELY_UNREACHABLE) /* list of uncollectable objects */ *************** *** 169,176 **** ! ! /* Set all gc_refs = ob_refcnt. After this, STILL_A_CANDIDATE(o) is true ! * for all objects in containers, and false for all tracked gc objects not ! * in containers (although see the comment in visit_decref). */ static void --- 172,178 ---- ! /* Set all gc_refs = ob_refcnt. After this, gc_refs is > 0 for all objects ! * in containers, and is GC_REACHABLE for all tracked gc objects not in ! * containers. */ static void *************** *** 178,207 **** { PyGC_Head *gc = containers->gc.gc_next; ! for (; gc != containers; gc=gc->gc.gc_next) { gc->gc.gc_refs = FROM_GC(gc)->ob_refcnt; - } } static int visit_decref(PyObject *op, void *data) { - /* There's no point to decrementing gc_refs unless - * STILL_A_CANDIDATE(op) is true. It would take extra cycles to - * check that, though. If STILL_A_CANDIDATE(op) is false, - * decrementing gc_refs almost always makes it "even more negative", - * so doesn't change that STILL_A_CANDIDATE is false, and no harm is - * done. However, it's possible that, after many collections, this - * could underflow gc_refs in a long-lived old object. In that case, - * visit_move() may move the old object back to the generation - * getting collected. That would be a waste of time, but wouldn't - * cause an error. - */ assert(op != NULL); ! if (PyObject_IS_GC(op)) ! AS_GC(op)->gc.gc_refs--; return 0; } ! /* Subtract internal references from gc_refs */ static void subtract_refs(PyGC_Head *containers) --- 180,209 ---- { PyGC_Head *gc = containers->gc.gc_next; ! for (; gc != containers; gc = gc->gc.gc_next) gc->gc.gc_refs = FROM_GC(gc)->ob_refcnt; } + /* A traversal callback for subtract_refs. */ static int visit_decref(PyObject *op, void *data) { assert(op != NULL); ! if (PyObject_IS_GC(op)) { ! PyGC_Head *gc = AS_GC(op); ! /* We're only interested in gc_refs for objects in the ! * generation being collected, which can be recognized ! * because only they have positive gc_refs. ! */ ! if (gc->gc.gc_refs > 0) ! gc->gc.gc_refs--; ! } return 0; } ! /* Subtract internal references from gc_refs. After this, gc_refs is >= 0 ! * for all objects in containers, and is GC_REACHABLE for all tracked gc ! * objects not in containers. The ones with gc_refs > 0 are directly ! * reachable from outside containers, and so can't be collected. ! */ static void subtract_refs(PyGC_Head *containers) *************** *** 217,266 **** } ! /* Move objects with gc_refs > 0 to roots list. They can't be collected. */ ! static void ! move_roots(PyGC_Head *containers, PyGC_Head *roots) ! { ! PyGC_Head *next; ! PyGC_Head *gc = containers->gc.gc_next; ! while (gc != containers) { ! next = gc->gc.gc_next; ! if (gc->gc.gc_refs > 0) { ! gc_list_remove(gc); ! gc_list_append(gc, roots); ! gc->gc.gc_refs = GC_MOVED; ! } ! gc = next; ! } ! } ! static int ! visit_move(PyObject *op, PyGC_Head *tolist) { ! if (PyObject_IS_GC(op)) { ! if (IS_TRACKED(op) && STILL_A_CANDIDATE(op)) { ! PyGC_Head *gc = AS_GC(op); gc_list_remove(gc); ! gc_list_append(gc, tolist); ! gc->gc.gc_refs = GC_MOVED; } } return 0; } ! /* Move candidates referenced from reachable to reachable set (they're no ! * longer candidates). */ static void ! move_root_reachable(PyGC_Head *reachable) { ! traverseproc traverse; ! PyGC_Head *gc = reachable->gc.gc_next; ! for (; gc != reachable; gc=gc->gc.gc_next) { ! /* careful, reachable list is growing here */ ! PyObject *op = FROM_GC(gc); ! traverse = op->ob_type->tp_traverse; ! (void) traverse(op, ! (visitproc)visit_move, ! (void *)reachable); } } --- 219,316 ---- } ! /* A traversal callback for move_unreachable. */ static int ! visit_reachable(PyObject *op, PyGC_Head *reachable) { ! if (PyObject_IS_GC(op) && IS_TRACKED(op)) { ! PyGC_Head *gc = AS_GC(op); ! const int gc_refs = gc->gc.gc_refs; ! ! if (gc_refs == 0) { ! /* This is in move_unreachable's 'young' list, but ! * the traversal hasn't yet gotten to it. All ! * we need to do is tell move_unreachable that it's ! * reachable. ! */ ! gc->gc.gc_refs = 1; ! } ! else if (gc_refs == GC_TENTATIVELY_UNREACHABLE) { ! /* This had gc_refs = 0 when move_unreachable got ! * to it, but turns out it's reachable after all. ! * Move it back to move_unreachable's 'young' list, ! * and move_unreachable will eventually get to it ! * again. ! */ gc_list_remove(gc); ! gc_list_append(gc, reachable); ! gc->gc.gc_refs = 1; } + /* Else there's nothing to do. + * If gc_refs > 0, it must be in move_unreachable's 'young' + * list, and move_unreachable will eventually get to it. + * If gc_refs == GC_REACHABLE, it's either in some other + * generation so we don't care about it, or move_unreachable + * already dealt with it. + */ } return 0; } ! /* Move the unreachable objects from young to unreachable. After this, ! * all objects in young have gc_refs = GC_REACHABLE, and all objects in ! * unreachable have gc_refs = GC_TENTATIVELY_UNREACHABLE. All tracked ! * gc objects not in young or unreachable still have gc_refs = GC_REACHABLE. ! * All objects in young after this are directly or indirectly reachable ! * from outside the original young; and all objects in unreachable are ! * not. */ static void ! move_unreachable(PyGC_Head *young, PyGC_Head *unreachable) { ! PyGC_Head *gc = young->gc.gc_next; ! ! /* Invariants: all objects "to the left" of us in young have gc_refs ! * = GC_REACHABLE, and are indeed reachable (directly or indirectly) ! * from outside the young list as it was at entry. All other objects ! * from the original young "to the left" of us are in unreachable now, ! * and have gc_refs = GC_TENTATIVELY_UNREACHABLE. All objects to the ! * left of us in 'young' now have been scanned, and no objects here ! * or to the right have been scanned yet. ! */ ! ! while (gc != young) { ! PyGC_Head *next; ! ! if (gc->gc.gc_refs == 0) { ! /* This *may* be unreachable. To make progress, ! * assume it is. gc isn't directly reachable from ! * any object we've already traversed, but may be ! * reachable from an object we haven't gotten to yet. ! * visit_reachable will eventually move gc back into ! * young if that's so, and we'll see it again. ! */ ! next = gc->gc.gc_next; ! gc_list_remove(gc); ! gc_list_append(gc, unreachable); ! gc->gc.gc_refs = GC_TENTATIVELY_UNREACHABLE; ! } ! else { ! /* gc is definitely reachable from outside the ! * original 'young'. Mark it as such, and traverse ! * its pointers to find any other objects that may ! * be directly reachable from it. Note that the ! * call to tp_traverse may append objects to young, ! * so we have to wait until it returns to determine ! * the next object to visit. ! */ ! PyObject *op = FROM_GC(gc); ! traverseproc traverse = op->ob_type->tp_traverse; ! gc->gc.gc_refs = GC_REACHABLE; ! (void) traverse(op, ! (visitproc)visit_reachable, ! (void *)young); ! next = gc->gc.gc_next; ! } ! gc = next; } } *************** *** 293,302 **** gc_list_remove(gc); gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_MOVED; } } } ! /* Move objects referenced from roots to roots */ static void move_finalizer_reachable(PyGC_Head *finalizers) --- 343,369 ---- gc_list_remove(gc); gc_list_append(gc, finalizers); ! gc->gc.gc_refs = GC_REACHABLE; } } } ! /* A traversal callback for move_finalizer_reachable. */ ! static int ! visit_move(PyObject *op, PyGC_Head *tolist) ! { ! if (PyObject_IS_GC(op)) { ! if (IS_TRACKED(op) && IS_TENTATIVELY_UNREACHABLE(op)) { ! PyGC_Head *gc = AS_GC(op); ! gc_list_remove(gc); ! gc_list_append(gc, tolist); ! gc->gc.gc_refs = GC_REACHABLE; ! } ! } ! return 0; ! } ! ! /* Move objects that are reachable from finalizers, from the unreachable set ! * into the finalizers set. ! */ static void move_finalizer_reachable(PyGC_Head *finalizers) *************** *** 354,362 **** * finalizers to the list of garbage. All objects in * the finalizers list are reachable from those ! * objects. */ PyList_Append(garbage, op); } /* object is now reachable again */ ! assert(!STILL_A_CANDIDATE(op)); gc_list_remove(gc); gc_list_append(gc, old); --- 421,430 ---- * finalizers to the list of garbage. All objects in * the finalizers list are reachable from those ! * objects. ! */ PyList_Append(garbage, op); } /* object is now reachable again */ ! assert(IS_REACHABLE(op)); gc_list_remove(gc); gc_list_append(gc, old); *************** *** 366,370 **** /* Break reference cycles by clearing the containers involved. This is * tricky business as the lists can be changing and we don't know which ! * objects may be freed. It is possible I screwed something up here. */ static void delete_garbage(PyGC_Head *unreachable, PyGC_Head *old) --- 434,439 ---- /* Break reference cycles by clearing the containers involved. This is * tricky business as the lists can be changing and we don't know which ! * objects may be freed. It is possible I screwed something up here. ! */ static void delete_garbage(PyGC_Head *unreachable, PyGC_Head *old) *************** *** 376,380 **** PyObject *op = FROM_GC(gc); ! assert(STILL_A_CANDIDATE(op)); if (debug & DEBUG_SAVEALL) { PyList_Append(garbage, op); --- 445,449 ---- PyObject *op = FROM_GC(gc); ! assert(IS_TENTATIVELY_UNREACHABLE(op)); if (debug & DEBUG_SAVEALL) { PyList_Append(garbage, op); *************** *** 391,395 **** gc_list_remove(gc); gc_list_append(gc, old); ! gc->gc.gc_refs = GC_MOVED; } } --- 460,464 ---- gc_list_remove(gc); gc_list_append(gc, old); ! gc->gc.gc_refs = GC_REACHABLE; } } *************** *** 402,410 **** { int i; ! long n = 0; ! long m = 0; PyGC_Head *young; /* the generation we are examining */ PyGC_Head *old; /* next older generation */ - PyGC_Head reachable; PyGC_Head unreachable; PyGC_Head finalizers; --- 471,478 ---- { int i; ! long m = 0; /* # objects collected */ ! long n = 0; /* # unreachable objects that couldn't be collected */ PyGC_Head *young; /* the generation we are examining */ PyGC_Head *old; /* next older generation */ PyGC_Head unreachable; PyGC_Head finalizers; *************** *** 434,469 **** /* handy references */ young = GEN_HEAD(generation); ! if (generation < NUM_GENERATIONS-1) { old = GEN_HEAD(generation+1); ! } else { ! old = GEN_HEAD(NUM_GENERATIONS-1); ! } /* Using ob_refcnt and gc_refs, calculate which objects in the * container set are reachable from outside the set (ie. have a * refcount greater than 0 when all the references within the ! * set are taken into account */ update_refs(young); subtract_refs(young); ! /* Move everything reachable from outside the set into the ! * reachable set (ie. gc_refs > 0). Next, move everything ! * reachable from objects in the reachable set. */ ! gc_list_init(&reachable); ! move_roots(young, &reachable); ! move_root_reachable(&reachable); ! ! /* move unreachable objects to a temporary list, new objects can be ! * allocated after this point */ gc_list_init(&unreachable); ! gc_list_move(young, &unreachable); ! /* move reachable objects to next generation */ ! gc_list_merge(&reachable, old); ! /* Move objects reachable from finalizers, we can't safely delete ! * them. Python programmers should take care not to create such ! * things. For Python finalizers means instance objects with ! * __del__ methods. */ gc_list_init(&finalizers); move_finalizers(&unreachable, &finalizers); --- 502,536 ---- /* handy references */ young = GEN_HEAD(generation); ! if (generation < NUM_GENERATIONS-1) old = GEN_HEAD(generation+1); ! else ! old = young; /* Using ob_refcnt and gc_refs, calculate which objects in the * container set are reachable from outside the set (ie. have a * refcount greater than 0 when all the references within the ! * set are taken into account ! */ update_refs(young); subtract_refs(young); ! /* Leave everything reachable from outside young in young, and move ! * everything else (in young) to unreachable. ! * NOTE: This used to move the reachable objects into a reachable ! * set instead. But most things usually turn out to be reachable, ! * so it's more efficient to move the unreachable things. ! */ gc_list_init(&unreachable); ! move_unreachable(young, &unreachable); ! /* Move reachable objects to next generation. */ ! if (young != old) ! gc_list_merge(young, old); ! /* All objects in unreachable are trash, but objects reachable from ! * finalizers can't safely be deleted. Python programmers should take ! * care not to create such things. For Python, finalizers means ! * instance objects with __del__ methods. ! */ gc_list_init(&finalizers); move_finalizers(&unreachable, &finalizers); *************** *** 479,483 **** } } ! /* call tp_clear on objects in the collectable set. This will cause * the reference cycles to be broken. It may also cause some objects in * finalizers to be freed */ --- 546,550 ---- } } ! /* Call tp_clear on objects in the collectable set. This will cause * the reference cycles to be broken. It may also cause some objects in * finalizers to be freed */ From fdrake@users.sourceforge.net Mon Jul 1 15:02:33 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 01 Jul 2002 07:02:33 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.65,2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10196 Modified Files: pyexpat.c Log Message: Bring this back into sync with PyXML revision 1.58. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** pyexpat.c 30 Jun 2002 06:40:55 -0000 2.65 --- pyexpat.c 1 Jul 2002 14:02:31 -0000 2.66 *************** *** 2,5 **** --- 2,9 ---- #include + #ifdef HAVE_PYMEMCOMPAT_H + #include "pymemcompat.h" + #endif + #include "compile.h" #include "frameobject.h" *************** *** 7,10 **** --- 11,16 ---- #ifndef PyDoc_STRVAR + #define PyDoc_STR(str) (str) + #define PyDoc_VAR(name) static char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #endif *************** *** 1161,1165 **** XML_SetUserData(self->itself, (void *)self); #ifdef Py_USING_UNICODE ! XML_SetUnknownEncodingHandler(self->itself, (XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL); #endif --- 1167,1172 ---- XML_SetUserData(self->itself, (void *)self); #ifdef Py_USING_UNICODE ! XML_SetUnknownEncodingHandler(self->itself, ! (XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL); #endif *************** *** 1167,1172 **** /* do nothing */; ! self->handlers = malloc(sizeof(PyObject *)*i); ! if (!self->handlers){ Py_DECREF(self); return PyErr_NoMemory(); --- 1174,1179 ---- /* do nothing */; ! self->handlers = malloc(sizeof(PyObject *) * i); ! if (!self->handlers) { Py_DECREF(self); return PyErr_NoMemory(); From tim_one@users.sourceforge.net Tue Jul 2 01:52:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 01 Jul 2002 17:52:32 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.53,2.54 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv8407/python/Include Modified Files: objimpl.h Log Message: Reserved another gc_refs value for untracked objects. Every live gc object should now have a well-defined gc_refs value, with clear transitions among gc_refs states. As a result, none of the visit_XYZ traversal callbacks need to check IS_TRACKED() anymore, and those tests were removed. (They were already looking for objects with specific gc_refs states, and the gc_refs state of an untracked object can no longer match any other gc_refs state by accident.) Added more asserts. I expect that the gc_next == NULL indicator for an untracked object is now redundant and can also be removed, but I ran out of time for this. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** objimpl.h 4 May 2002 05:36:06 -0000 2.53 --- objimpl.h 2 Jul 2002 00:52:30 -0000 2.54 *************** *** 263,272 **** #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) /* Tell the GC to track this object. NB: While the object is tracked the * collector it must be safe to call the ob_traverse method. */ #define _PyObject_GC_TRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ ! if (g->gc.gc_next != NULL) \ ! Py_FatalError("GC object already in linked list"); \ g->gc.gc_next = _PyGC_generation0; \ g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ --- 263,278 ---- #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) + #define _PyGC_REFS_UNTRACKED (-2) + #define _PyGC_REFS_REACHABLE (-3) + #define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) + /* Tell the GC to track this object. NB: While the object is tracked the * collector it must be safe to call the ob_traverse method. */ #define _PyObject_GC_TRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ ! if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \ ! Py_FatalError("GC object already tracked"); \ ! assert(g->gc.gc_refs == _PyGC_REFS_UNTRACKED); \ ! g->gc.gc_refs = _PyGC_REFS_REACHABLE; \ g->gc.gc_next = _PyGC_generation0; \ g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ *************** *** 278,281 **** --- 284,289 ---- #define _PyObject_GC_UNTRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ + assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \ + g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \ g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ From tim_one@users.sourceforge.net Tue Jul 2 01:52:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 01 Jul 2002 17:52:32 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8407/python/Modules Modified Files: gcmodule.c Log Message: Reserved another gc_refs value for untracked objects. Every live gc object should now have a well-defined gc_refs value, with clear transitions among gc_refs states. As a result, none of the visit_XYZ traversal callbacks need to check IS_TRACKED() anymore, and those tests were removed. (They were already looking for objects with specific gc_refs states, and the gc_refs state of an untracked object can no longer match any other gc_refs state by accident.) Added more asserts. I expect that the gc_next == NULL indicator for an untracked object is now redundant and can also be removed, but I ran out of time for this. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -d -r2.48 -r2.49 *** gcmodule.c 1 Jul 2002 03:52:19 -0000 2.48 --- gcmodule.c 2 Jul 2002 00:52:30 -0000 2.49 *************** *** 83,88 **** /* Special gc_refs values. */ ! #define GC_REACHABLE -123 ! #define GC_TENTATIVELY_UNREACHABLE -42 #define IS_REACHABLE(o) ((AS_GC(o))->gc.gc_refs == GC_REACHABLE) --- 83,89 ---- /* Special gc_refs values. */ ! #define GC_UNTRACKED _PyGC_REFS_UNTRACKED ! #define GC_REACHABLE _PyGC_REFS_REACHABLE ! #define GC_TENTATIVELY_UNREACHABLE _PyGC_REFS_TENTATIVELY_UNREACHABLE #define IS_REACHABLE(o) ((AS_GC(o))->gc.gc_refs == GC_REACHABLE) *************** *** 180,185 **** { PyGC_Head *gc = containers->gc.gc_next; ! for (; gc != containers; gc = gc->gc.gc_next) gc->gc.gc_refs = FROM_GC(gc)->ob_refcnt; } --- 181,188 ---- { PyGC_Head *gc = containers->gc.gc_next; ! for (; gc != containers; gc = gc->gc.gc_next) { ! assert(gc->gc.gc_refs == GC_REACHABLE); gc->gc.gc_refs = FROM_GC(gc)->ob_refcnt; + } } *************** *** 223,227 **** visit_reachable(PyObject *op, PyGC_Head *reachable) { ! if (PyObject_IS_GC(op) && IS_TRACKED(op)) { PyGC_Head *gc = AS_GC(op); const int gc_refs = gc->gc.gc_refs; --- 226,230 ---- visit_reachable(PyObject *op, PyGC_Head *reachable) { ! if (PyObject_IS_GC(op)) { PyGC_Head *gc = AS_GC(op); const int gc_refs = gc->gc.gc_refs; *************** *** 251,256 **** * If gc_refs == GC_REACHABLE, it's either in some other * generation so we don't care about it, or move_unreachable ! * already dealt with it. */ } return 0; --- 254,265 ---- * If gc_refs == GC_REACHABLE, it's either in some other * generation so we don't care about it, or move_unreachable ! * already deat with it. ! * If gc_refs == GC_UNTRACKED, it must be ignored. */ + else { + assert(gc_refs > 0 + || gc_refs == GC_REACHABLE + || gc_refs == GC_UNTRACKED); + } } return 0; *************** *** 353,357 **** { if (PyObject_IS_GC(op)) { ! if (IS_TRACKED(op) && IS_TENTATIVELY_UNREACHABLE(op)) { PyGC_Head *gc = AS_GC(op); gc_list_remove(gc); --- 362,366 ---- { if (PyObject_IS_GC(op)) { ! if (IS_TENTATIVELY_UNREACHABLE(op)) { PyGC_Head *gc = AS_GC(op); gc_list_remove(gc); *************** *** 967,970 **** --- 976,980 ---- return PyErr_NoMemory(); g->gc.gc_next = NULL; + g->gc.gc_refs = GC_UNTRACKED; generations[0].count++; /* number of allocated GC objects */ if (generations[0].count > generations[0].threshold && From jackjansen@users.sourceforge.net Tue Jul 2 15:40:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 02 Jul 2002 07:40:46 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.228,1.229 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25381/Modules Modified Files: socketmodule.c Log Message: Mac OS X Jaguar (developer preview) seems to have a working getaddrinfo(). Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.228 retrieving revision 1.229 diff -C2 -d -r1.228 -r1.229 *** socketmodule.c 13 Jun 2002 20:32:52 -0000 1.228 --- socketmodule.c 2 Jul 2002 14:40:42 -0000 1.229 *************** *** 220,226 **** --- 220,231 ---- gets ever fixed, perhaps checking for sys/version.h would be appropriate, which is 10/0 on the system with the bug. */ + #ifndef HAVE_GETNAMEINFO + /* This bug seems to be fixed in Jaguar. Ths easiest way I could + Find to check for Jaguar is that it has getnameinfo(), which + older releases don't have */ #undef HAVE_GETADDRINFO /* avoid clashes with the C library definition of the symbol. */ #define getaddrinfo fake_getaddrinfo + #endif #endif From fdrake@users.sourceforge.net Tue Jul 2 16:44:38 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 08:44:38 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13501 Modified Files: pyexpat.c Log Message: Do not depend on pymemcompat.h (was only used for PyXML); Martin likes it all inline. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** pyexpat.c 1 Jul 2002 14:02:31 -0000 2.66 --- pyexpat.c 2 Jul 2002 15:44:36 -0000 2.67 *************** *** 2,9 **** #include - #ifdef HAVE_PYMEMCOMPAT_H - #include "pymemcompat.h" - #endif - #include "compile.h" #include "frameobject.h" --- 2,5 ---- *************** *** 974,978 **** --- 970,980 ---- new_parser->buffer = malloc(new_parser->buffer_size); if (new_parser->buffer == NULL) { + #ifndef Py_TPFLAGS_HAVE_GC + /* Code for versions 2.0 and 2.1 */ + PyObject_Del(new_parser); + #else + /* Code for versions 2.2 and later. */ PyObject_GC_Del(new_parser); + #endif return PyErr_NoMemory(); } From theller@users.sourceforge.net Tue Jul 2 16:47:05 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 02 Jul 2002 08:47:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv14616 Modified Files: exceptions.tex Log Message: Docs for PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(). Fixes SF# 576016, with additional markup. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** exceptions.tex 27 Mar 2002 13:42:50 -0000 1.5 --- exceptions.tex 2 Jul 2002 15:47:03 -0000 1.6 *************** *** 194,197 **** --- 194,220 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErr}{int ierr} + This is a convenience function to raise + \exception{PyExc_WindowsError}. If called with \var{ierr} of + \cdata{0}, the error code returned by a call to + \cfunction{GetLastError()} is used instead. It calls the win32 + function \cfunction{FormatMessage()} to retrieve the Windows + description of error code \var{ierr}, then it constructs a tuple object + whose first item is the integer \cdata{ierr} value and whose second + item is the corresponding error message (gotten from + \cfunction{FormatMessage()}), and then calls + \samp{PyErr_SetObject(\var{PyExc_WindowsError}, \var{object})}. + This function always returns \NULL. This function is only available + on Windows. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErrWithFilename}{int ierr, + char *filename} + Similar to \cfunction{PyErr_SetFromWindowsErr()}, with the + additional behavior that if \var{filename} is not \NULL, it is + passed to the constructor of \exception{WindowsError} as a third + parameter. This function is only available on Windows. + \end{cfuncdesc} + \begin{cfuncdesc}{void}{PyErr_BadInternalCall}{} This is a shorthand for \samp{PyErr_SetString(PyExc_TypeError, From fdrake@users.sourceforge.net Tue Jul 2 17:16:21 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 09:16:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/api refcounts.dat,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv24417 Modified Files: refcounts.dat Log Message: Add refcount info for PyErr_SetFromWindowsErr() and PyErr_SetFromWindowsErrWithFilename(). Index: refcounts.dat =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/refcounts.dat,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** refcounts.dat 20 Jun 2002 22:07:04 -0000 1.42 --- refcounts.dat 2 Jul 2002 16:16:18 -0000 1.43 *************** *** 234,237 **** --- 234,244 ---- PyErr_SetFromErrnoWithFilename:char*:filename:: + PyErr_SetFromWindowsErr:PyObject*::null: + PyErr_SetFromWindowsErr:int:ierr:: + + PyErr_SetFromWindowsErrWithFilename:PyObject*::null: + PyErr_SetFromWindowsErrWithFilename:int:ierr:: + PyErr_SetFromWindowsErrWithFilename:char*:filename:: + PyErr_SetInterrupt:void::: From fdrake@users.sourceforge.net Tue Jul 2 17:18:00 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 09:18:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv24961 Modified Files: exceptions.tex Log Message: Minor markup adjustments, consistency changes, and shorten a long line. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** exceptions.tex 2 Jul 2002 15:47:03 -0000 1.6 --- exceptions.tex 2 Jul 2002 16:17:58 -0000 1.7 *************** *** 195,218 **** \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErr}{int ierr} ! This is a convenience function to raise ! \exception{PyExc_WindowsError}. If called with \var{ierr} of ! \cdata{0}, the error code returned by a call to ! \cfunction{GetLastError()} is used instead. It calls the win32 ! function \cfunction{FormatMessage()} to retrieve the Windows ! description of error code \var{ierr}, then it constructs a tuple object ! whose first item is the integer \cdata{ierr} value and whose second ! item is the corresponding error message (gotten from \cfunction{FormatMessage()}), and then calls \samp{PyErr_SetObject(\var{PyExc_WindowsError}, \var{object})}. ! This function always returns \NULL. This function is only available ! on Windows. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErrWithFilename}{int ierr, ! char *filename} Similar to \cfunction{PyErr_SetFromWindowsErr()}, with the additional behavior that if \var{filename} is not \NULL, it is passed to the constructor of \exception{WindowsError} as a third ! parameter. This function is only available on Windows. \end{cfuncdesc} --- 195,219 ---- \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErr}{int ierr} ! This is a convenience function to raise \exception{WindowsError}. ! If called with \var{ierr} of \cdata{0}, the error code returned by a ! call to \cfunction{GetLastError()} is used instead. It calls the ! Win32 function \cfunction{FormatMessage()} to retrieve the Windows ! description of error code given by \var{ierr} or ! \cfunction{GetLastError()}, then it constructs a tuple object whose ! first item is the \var{ierr} value and whose second item is the ! corresponding error message (gotten from \cfunction{FormatMessage()}), and then calls \samp{PyErr_SetObject(\var{PyExc_WindowsError}, \var{object})}. ! This function always returns \NULL. ! Availability: Windows. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErrWithFilename}{int ierr, ! char *filename} Similar to \cfunction{PyErr_SetFromWindowsErr()}, with the additional behavior that if \var{filename} is not \NULL, it is passed to the constructor of \exception{WindowsError} as a third ! parameter. ! Availability: Windows. \end{cfuncdesc} From jhylton@users.sourceforge.net Tue Jul 2 18:19:50 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 10:19:50 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.42.10.5,1.42.10.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10911/Lib Modified Files: Tag: release22-maint httplib.py Log Message: Backport various bug fixes from trunk. The 2.2 maintenace branch is now identical to the trunk through rev 1.53. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.42.10.5 retrieving revision 1.42.10.6 diff -C2 -d -r1.42.10.5 -r1.42.10.6 *** httplib.py 20 Apr 2002 07:45:24 -0000 1.42.10.5 --- httplib.py 2 Jul 2002 17:19:47 -0000 1.42.10.6 *************** *** 79,86 **** __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection", "HTTPException", "NotConnected", "UnknownProtocol", ! "UnknownTransferEncoding", "IllegalKeywordArgument", ! "UnimplementedFileMode", "IncompleteRead", ! "ImproperConnectionState", "CannotSendRequest", "CannotSendHeader", ! "ResponseNotReady", "BadStatusLine", "error"] HTTP_PORT = 80 --- 79,86 ---- __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection", "HTTPException", "NotConnected", "UnknownProtocol", ! "UnknownTransferEncoding", "UnimplementedFileMode", ! "IncompleteRead", "InvalidURL", "ImproperConnectionState", ! "CannotSendRequest", "CannotSendHeader", "ResponseNotReady", ! "BadStatusLine", "error"] HTTP_PORT = 80 *************** *** 112,120 **** self.will_close = _UNKNOWN # conn will close at end of response ! def begin(self): ! if self.msg is not None: ! # we've already started reading the response ! return ! line = self.fp.readline() if self.debuglevel > 0: --- 112,116 ---- self.will_close = _UNKNOWN # conn will close at end of response ! def _read_status(self): line = self.fp.readline() if self.debuglevel > 0: *************** *** 136,146 **** # The status code is a three-digit number try: ! self.status = status = int(status) if status < 100 or status > 999: raise BadStatusLine(line) except ValueError: raise BadStatusLine(line) ! self.reason = reason.strip() if version == 'HTTP/1.0': self.version = 10 --- 132,162 ---- # The status code is a three-digit number try: ! status = int(status) if status < 100 or status > 999: raise BadStatusLine(line) except ValueError: raise BadStatusLine(line) ! return version, status, reason ! ! def _begin(self): ! if self.msg is not None: ! # we've already started reading the response ! return + # read until we get a non-100 response + while 1: + version, status, reason = self._read_status() + if status != 100: + break + # skip the header from the 100 response + while 1: + skip = self.fp.readline().strip() + if not skip: + break + if self.debuglevel > 0: + print "header:", skip + + self.status = status + self.reason = reason.strip() if version == 'HTTP/1.0': self.version = 10 *************** *** 153,156 **** --- 169,173 ---- if self.version == 9: + self.chunked = 0 self.msg = mimetools.Message(StringIO()) return *************** *** 234,237 **** --- 251,255 ---- if self.chunked: + assert self.chunked != _UNKNOWN chunk_left = self.chunk_left value = '' *************** *** 348,352 **** i = host.find(':') if i >= 0: ! port = int(host[i+1:]) host = host[:i] else: --- 366,373 ---- i = host.find(':') if i >= 0: ! try: ! port = int(host[i+1:]) ! except ValueError: ! raise InvalidURL, "nonnumeric port: '%s'"%host[i+1:] host = host[:i] else: *************** *** 361,365 **** """Connect to the host and port specified in __init__.""" msg = "getaddrinfo returns an empty list" ! for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res try: --- 382,387 ---- """Connect to the host and port specified in __init__.""" msg = "getaddrinfo returns an empty list" ! for res in socket.getaddrinfo(self.host, self.port, 0, ! socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res try: *************** *** 547,551 **** # optional skip_host argument to putrequest(). The check is # harder because field names are case insensitive. ! if (headers.has_key('Host') or [k for k in headers.iterkeys() if k.lower() == "host"]): self.putrequest(method, url, skip_host=1) --- 569,573 ---- # optional skip_host argument to putrequest(). The check is # harder because field names are case insensitive. ! if 'Host' in (headers or [k for k in headers.iterkeys() if k.lower() == "host"]): self.putrequest(method, url, skip_host=1) *************** *** 593,597 **** response = self.response_class(self.sock) ! response.begin() self.__state = _CS_IDLE --- 615,620 ---- response = self.response_class(self.sock) ! response._begin() ! assert response.will_close != _UNKNOWN self.__state = _CS_IDLE *************** *** 605,637 **** return response ! class FakeSocket: ! def __init__(self, sock, ssl): ! self.__sock = sock ! self.__ssl = ssl ! ! def makefile(self, mode, bufsize=None): ! """Return a readable file-like object with data from socket. ! ! This method offers only partial support for the makefile ! interface of a real socket. It only supports modes 'r' and ! 'rb' and the bufsize argument is ignored. ! ! The returned object contains *all* of the file data ! """ ! if mode != 'r' and mode != 'rb': ! raise UnimplementedFileMode() ! msgbuf = [] while 1: try: ! buf = self.__ssl.read() except socket.sslerror, err: if (err[0] == socket.SSL_ERROR_WANT_READ ! or err[0] == socket.SSL_ERROR_WANT_WRITE ! or 0): continue ! if (err[0] == socket.SSL_ERROR_ZERO_RETURN ! or err[0] == socket.SSL_ERROR_EOF): break raise --- 628,654 ---- return response + class SSLFile: + """File-like object wrapping an SSL socket.""" ! BUFSIZE = 8192 ! ! def __init__(self, sock, ssl, bufsize=None): ! self._sock = sock ! self._ssl = ssl ! self._buf = '' ! self._bufsize = bufsize or self.__class__.BUFSIZE ! def _read(self): ! buf = '' ! # put in a loop so that we retry on transient errors while 1: try: ! buf = self._ssl.read(self._bufsize) except socket.sslerror, err: if (err[0] == socket.SSL_ERROR_WANT_READ ! or err[0] == socket.SSL_ERROR_WANT_WRITE): continue ! if (err[0] == socket.SSL_ERROR_ZERO_RETURN ! or err[0] == socket.SSL_ERROR_EOF): break raise *************** *** 639,647 **** if err[0] == errno.EINTR: continue raise ! if buf == '': break ! msgbuf.append(buf) ! return StringIO("".join(msgbuf)) def send(self, stuff, flags = 0): --- 656,718 ---- if err[0] == errno.EINTR: continue + if err[0] == errno.EBADF: + # XXX socket was closed? + break raise ! else: break ! return buf ! ! 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 ! ! def close(self): ! self._sock.close() ! ! class FakeSocket: ! def __init__(self, sock, ssl): ! self.__sock = sock ! self.__ssl = ssl ! ! def makefile(self, mode, bufsize=None): ! if mode != 'r' and mode != 'rb': ! raise UnimplementedFileMode() ! return SSLFile(self.__sock, self.__ssl, bufsize) def send(self, stuff, flags = 0): *************** *** 663,681 **** default_port = HTTPS_PORT ! def __init__(self, host, port=None, **x509): ! keys = x509.keys() ! try: ! keys.remove('key_file') ! except ValueError: ! pass ! try: ! keys.remove('cert_file') ! except ValueError: ! pass ! if keys: ! raise IllegalKeywordArgument() HTTPConnection.__init__(self, host, port) ! self.key_file = x509.get('key_file') ! self.cert_file = x509.get('cert_file') def connect(self): --- 734,741 ---- default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None): HTTPConnection.__init__(self, host, port) ! self.key_file = key_file ! self.cert_file = cert_file def connect(self): *************** *** 811,814 **** --- 871,877 ---- pass + class InvalidURL(HTTPException): + pass + class UnknownProtocol(HTTPException): def __init__(self, version): *************** *** 818,824 **** pass - class IllegalKeywordArgument(HTTPException): - pass - class UnimplementedFileMode(HTTPException): pass --- 881,884 ---- *************** *** 881,885 **** for header in headers.headers: print header.strip() print ! print h.getfile().read() # minimal test that code to extract host from url works --- 941,945 ---- for header in headers.headers: print header.strip() print ! print "read", len(h.getfile().read()) # minimal test that code to extract host from url works *************** *** 902,905 **** --- 962,966 ---- hs.endheaders() status, reason, headers = hs.getreply() + # XXX why does this give a 302 response? print 'status =', status print 'reason =', reason *************** *** 908,912 **** for header in headers.headers: print header.strip() print ! print hs.getfile().read() --- 969,973 ---- for header in headers.headers: print header.strip() print ! print "read", len(hs.getfile().read()) From fdrake@users.sourceforge.net Tue Jul 2 18:27:09 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 10:27:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/dom minidom.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv13148 Modified Files: minidom.py Log Message: Remove bogus assignment to self.length in NamedNodeMap.__delitem__(). Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** minidom.py 30 Jun 2002 15:05:00 -0000 1.47 --- minidom.py 2 Jul 2002 17:27:06 -0000 1.48 *************** *** 460,464 **** del self._attrs[node.name] del self._attrsNS[(node.namespaceURI, node.localName)] - self.length = len(self._attrs) AttributeList = NamedNodeMap --- 460,463 ---- From tim_one@users.sourceforge.net Tue Jul 2 19:12:38 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 11:12:38 -0700 Subject: [Python-checkins] python/dist/src/Include objimpl.h,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv26626/python/Include Modified Files: objimpl.h Log Message: Finished transitioning to using gc_refs to track gc objects' states. This was mostly a matter of adding comments and light code rearrangement. Upon untracking, gc_next is still set to NULL. It's a cheap way to provoke memory faults if calling code is insane. It's also used in some way by the trashcan mechanism. Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -d -r2.54 -r2.55 *** objimpl.h 2 Jul 2002 00:52:30 -0000 2.54 --- objimpl.h 2 Jul 2002 18:12:34 -0000 2.55 *************** *** 252,256 **** typedef union _gc_head { struct { ! union _gc_head *gc_next; /* not NULL if object is tracked */ union _gc_head *gc_prev; int gc_refs; --- 252,256 ---- typedef union _gc_head { struct { ! union _gc_head *gc_next; union _gc_head *gc_prev; int gc_refs; *************** *** 273,277 **** if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \ Py_FatalError("GC object already tracked"); \ - assert(g->gc.gc_refs == _PyGC_REFS_UNTRACKED); \ g->gc.gc_refs = _PyGC_REFS_REACHABLE; \ g->gc.gc_next = _PyGC_generation0; \ --- 273,276 ---- *************** *** 281,285 **** } while (0); ! /* Tell the GC to stop tracking this object. */ #define _PyObject_GC_UNTRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ --- 280,287 ---- } while (0); ! /* Tell the GC to stop tracking this object. ! * gc_next doesn't need to be set to NULL, but doing so is a good ! * way to provoke memory errors if calling code is confused. ! */ #define _PyObject_GC_UNTRACK(o) do { \ PyGC_Head *g = _Py_AS_GC(o); \ From tim_one@users.sourceforge.net Tue Jul 2 19:12:38 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 11:12:38 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv26626/python/Modules Modified Files: gcmodule.c Log Message: Finished transitioning to using gc_refs to track gc objects' states. This was mostly a matter of adding comments and light code rearrangement. Upon untracking, gc_next is still set to NULL. It's a cheap way to provoke memory faults if calling code is insane. It's also used in some way by the trashcan mechanism. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** gcmodule.c 2 Jul 2002 00:52:30 -0000 2.49 --- gcmodule.c 2 Jul 2002 18:12:35 -0000 2.50 *************** *** 29,35 **** #define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1)) - /* True if an object is tracked by the GC */ - #define IS_TRACKED(o) ((AS_GC(o))->gc.gc_next != NULL) - /*** Global GC state ***/ --- 29,32 ---- *************** *** 59,62 **** --- 56,65 ---- static int collecting; + /* list of uncollectable objects */ + static PyObject *garbage; + + /* Python string to use if unhandled exception occurs */ + static PyObject *gc_str; + /* set for debugging information */ #define DEBUG_STATS (1<<0) /* print collection statistics */ *************** *** 73,100 **** static int debug; ! /* When a collection begins, gc_refs is set to ob_refcnt for, and only for, ! * the objects in the generation being collected, called the "young" ! * generation at that point. As collection proceeds, the gc_refs members ! * of young objects are set to GC_REACHABLE when it becomes known that they're ! * uncollectable, and to GC_TENTATIVELY_UNREACHABLE when the evidence ! * suggests they are collectable (this can't be known for certain until all ! * of the young generation is scanned). ! */ ! /* Special gc_refs values. */ #define GC_UNTRACKED _PyGC_REFS_UNTRACKED #define GC_REACHABLE _PyGC_REFS_REACHABLE #define GC_TENTATIVELY_UNREACHABLE _PyGC_REFS_TENTATIVELY_UNREACHABLE #define IS_REACHABLE(o) ((AS_GC(o))->gc.gc_refs == GC_REACHABLE) #define IS_TENTATIVELY_UNREACHABLE(o) ( \ (AS_GC(o))->gc.gc_refs == GC_TENTATIVELY_UNREACHABLE) - /* list of uncollectable objects */ - static PyObject *garbage; - - /* Python string to use if unhandled exception occurs */ - static PyObject *gc_str; - /*** list functions ***/ --- 76,127 ---- static int debug; ! /*-------------------------------------------------------------------------- ! gc_refs values. ! Between collections, every gc'ed object has one of two gc_refs values: ! ! GC_UNTRACKED ! The initial state; objects returned by PyObject_GC_Malloc are in this ! state. The object doesn't live in any generation list, and its ! tp_traverse slot must not be called. ! ! GC_REACHABLE ! The object lives in some generation list, and its tp_traverse is safe to ! call. An object transitions to GC_REACHABLE when PyObject_GC_Track ! is called. ! ! During a collection, gc_refs can temporarily take on other states: ! ! >= 0 ! At the start of a collection, update_refs() copies the true refcount ! to gc_refs, for each object in the generation being collected. ! subtract_refs() then adjusts gc_refs so that it equals the number of ! times an object is referenced directly from outside the generation ! being collected. ! gc_refs reamins >= 0 throughout these steps. ! ! GC_TENTATIVELY_UNREACHABLE ! move_unreachable() then moves objects not reachable (whether directly or ! indirectly) from outside the generation into an "unreachable" set. ! Objects that are found to be reachable have gc_refs set to GC_REACHABLE ! again. Objects that are found to be unreachable have gc_refs set to ! GC_TENTATIVELY_UNREACHABLE. It's "tentatively" because the pass doing ! this can't be sure until it ends, and GC_TENTATIVELY_UNREACHABLE may ! transition back to GC_REACHABLE. ! ! Only objects with GC_TENTATIVELY_UNREACHABLE still set are candidates ! for collection. If it's decided not to collect such an object (e.g., ! it has a __del__ method), its gc_refs is restored to GC_REACHABLE again. ! ---------------------------------------------------------------------------- ! */ #define GC_UNTRACKED _PyGC_REFS_UNTRACKED #define GC_REACHABLE _PyGC_REFS_REACHABLE #define GC_TENTATIVELY_UNREACHABLE _PyGC_REFS_TENTATIVELY_UNREACHABLE + #define IS_TRACKED(o) ((AS_GC(o))->gc.gc_refs != GC_UNTRACKED) #define IS_REACHABLE(o) ((AS_GC(o))->gc.gc_refs == GC_REACHABLE) #define IS_TENTATIVELY_UNREACHABLE(o) ( \ (AS_GC(o))->gc.gc_refs == GC_TENTATIVELY_UNREACHABLE) /*** list functions ***/ *************** *** 254,258 **** * If gc_refs == GC_REACHABLE, it's either in some other * generation so we don't care about it, or move_unreachable ! * already deat with it. * If gc_refs == GC_UNTRACKED, it must be ignored. */ --- 281,285 ---- * If gc_refs == GC_REACHABLE, it's either in some other * generation so we don't care about it, or move_unreachable ! * already dealt with it. * If gc_refs == GC_UNTRACKED, it must be ignored. */ *************** *** 291,295 **** PyGC_Head *next; ! if (gc->gc.gc_refs == 0) { /* This *may* be unreachable. To make progress, * assume it is. gc isn't directly reachable from --- 318,340 ---- PyGC_Head *next; ! if (gc->gc.gc_refs) { ! /* gc is definitely reachable from outside the ! * original 'young'. Mark it as such, and traverse ! * its pointers to find any other objects that may ! * be directly reachable from it. Note that the ! * call to tp_traverse may append objects to young, ! * so we have to wait until it returns to determine ! * the next object to visit. ! */ ! PyObject *op = FROM_GC(gc); ! traverseproc traverse = op->ob_type->tp_traverse; ! assert(gc->gc.gc_refs > 0); ! gc->gc.gc_refs = GC_REACHABLE; ! (void) traverse(op, ! (visitproc)visit_reachable, ! (void *)young); ! next = gc->gc.gc_next; ! } ! else { /* This *may* be unreachable. To make progress, * assume it is. gc isn't directly reachable from *************** *** 304,324 **** gc->gc.gc_refs = GC_TENTATIVELY_UNREACHABLE; } - else { - /* gc is definitely reachable from outside the - * original 'young'. Mark it as such, and traverse - * its pointers to find any other objects that may - * be directly reachable from it. Note that the - * call to tp_traverse may append objects to young, - * so we have to wait until it returns to determine - * the next object to visit. - */ - PyObject *op = FROM_GC(gc); - traverseproc traverse = op->ob_type->tp_traverse; - gc->gc.gc_refs = GC_REACHABLE; - (void) traverse(op, - (visitproc)visit_reachable, - (void *)young); - next = gc->gc.gc_next; - } gc = next; } --- 349,352 ---- *************** *** 975,979 **** if (g == NULL) return PyErr_NoMemory(); - g->gc.gc_next = NULL; g->gc.gc_refs = GC_UNTRACKED; generations[0].count++; /* number of allocated GC objects */ --- 1003,1006 ---- From jhylton@users.sourceforge.net Tue Jul 2 19:25:03 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 11:25:03 -0700 Subject: [Python-checkins] python/dist/src/Modules _ssl.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31765 Modified Files: _ssl.c Log Message: Repair badly formatted code. Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _ssl.c 13 Jun 2002 20:32:47 -0000 1.4 --- _ssl.c 2 Jul 2002 18:25:00 -0000 1.5 *************** *** 88,107 **** case SSL_ERROR_ZERO_RETURN: errstr = "TLS/SSL connection has been closed"; ! p=PY_SSL_ERROR_ZERO_RETURN; break; case SSL_ERROR_WANT_READ: errstr = "The operation did not complete (read)"; ! p=PY_SSL_ERROR_WANT_READ; break; case SSL_ERROR_WANT_WRITE: ! p=PY_SSL_ERROR_WANT_WRITE; errstr = "The operation did not complete (write)"; break; case SSL_ERROR_WANT_X509_LOOKUP: ! p=PY_SSL_ERROR_WANT_X509_LOOKUP; errstr = "The operation did not complete (X509 lookup)"; break; case SSL_ERROR_WANT_CONNECT: ! p=PY_SSL_ERROR_WANT_CONNECT; errstr = "The operation did not complete (connect)"; break; --- 88,107 ---- case SSL_ERROR_ZERO_RETURN: errstr = "TLS/SSL connection has been closed"; ! p = PY_SSL_ERROR_ZERO_RETURN; break; case SSL_ERROR_WANT_READ: errstr = "The operation did not complete (read)"; ! p = PY_SSL_ERROR_WANT_READ; break; case SSL_ERROR_WANT_WRITE: ! p = PY_SSL_ERROR_WANT_WRITE; errstr = "The operation did not complete (write)"; break; case SSL_ERROR_WANT_X509_LOOKUP: ! p = PY_SSL_ERROR_WANT_X509_LOOKUP; errstr = "The operation did not complete (X509 lookup)"; break; case SSL_ERROR_WANT_CONNECT: ! p = PY_SSL_ERROR_WANT_CONNECT; errstr = "The operation did not complete (connect)"; break; *************** *** 109,125 **** { unsigned long e = ERR_get_error(); ! if(e==0){ ! if(ret==0){ ! p=PY_SSL_ERROR_EOF; errstr = "EOF occurred in violation of protocol"; ! }else if(ret==-1){ /* the underlying BIO reported an I/O error */ return obj->Socket->errorhandler(); ! }else{ /* possible? */ ! p=PY_SSL_ERROR_SYSCALL; errstr = "Some I/O error occurred"; } } else { ! p=PY_SSL_ERROR_SYSCALL; /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); --- 109,125 ---- { unsigned long e = ERR_get_error(); ! if (e == 0) { ! if (ret == 0) { ! p = PY_SSL_ERROR_EOF; errstr = "EOF occurred in violation of protocol"; ! } else if (ret == -1) { /* the underlying BIO reported an I/O error */ return obj->Socket->errorhandler(); ! } else { /* possible? */ ! p = PY_SSL_ERROR_SYSCALL; errstr = "Some I/O error occurred"; } } else { ! p = PY_SSL_ERROR_SYSCALL; /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); *************** *** 130,144 **** { unsigned long e = ERR_get_error(); ! p=PY_SSL_ERROR_SSL; ! if (e !=0) { /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); ! } else { /* possible? */ ! errstr="A failure in the SSL library occurred"; } break; } default: ! p=PY_SSL_ERROR_INVALID_ERROR_CODE; errstr = "Invalid error code"; } --- 130,144 ---- { unsigned long e = ERR_get_error(); ! p = PY_SSL_ERROR_SSL; ! if (e != 0) /* XXX Protected by global interpreter lock */ errstr = ERR_error_string(e, NULL); ! else { /* possible? */ ! errstr = "A failure in the SSL library occurred"; } break; } default: ! p = PY_SSL_ERROR_INVALID_ERROR_CODE; errstr = "Invalid error code"; } *************** *** 163,167 **** } - /* This is a C function to be called for new object initialization */ static PySSLObject * newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file) --- 163,166 ---- *************** *** 239,243 **** } - /* This is the Python function called for new object initialization */ static PyObject * PySocket_ssl(PyObject *self, PyObject *args) --- 238,241 ---- From jhylton@users.sourceforge.net Tue Jul 2 20:05:36 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 12:05:36 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.141.2.8,1.141.2.9 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12298 Modified Files: Tag: release21-maint socketmodule.c Log Message: Backport variety of SSL fixes accumulated on the trunk. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.141.2.8 retrieving revision 1.141.2.9 diff -C2 -d -r1.141.2.8 -r1.141.2.9 *** socketmodule.c 23 Dec 2001 01:44:49 -0000 1.141.2.8 --- socketmodule.c 2 Jul 2002 19:05:33 -0000 1.141.2.9 *************** *** 190,193 **** --- 190,208 ---- #ifdef USE_SSL + enum py_ssl_error { + /* these mirror ssl.h */ + PY_SSL_ERROR_NONE, + PY_SSL_ERROR_SSL, + PY_SSL_ERROR_WANT_READ, + PY_SSL_ERROR_WANT_WRITE, + PY_SSL_ERROR_WANT_X509_LOOKUP, + PY_SSL_ERROR_SYSCALL, /* look at error stack/return value/errno */ + PY_SSL_ERROR_ZERO_RETURN, + PY_SSL_ERROR_WANT_CONNECT, + /* start of non ssl.h errorcodes */ + PY_SSL_ERROR_EOF, /* special case of SSL_ERROR_SYSCALL */ + PY_SSL_ERROR_INVALID_ERROR_CODE + }; + #include "openssl/rsa.h" #include "openssl/crypto.h" *************** *** 196,199 **** --- 211,225 ---- #include "openssl/ssl.h" #include "openssl/err.h" + + #define X509_NAME_MAXLEN 256 + + /* RAND_* APIs got added to OpenSSL in 0.9.5 */ + #if OPENSSL_VERSION_NUMBER >= 0x0090500fL + # define HAVE_OPENSSL_RAND 1 + #include "openssl/rand.h" + #else + # undef HAVE_OPENSSL_RAND + #endif + #endif /* USE_SSL */ *************** *** 234,238 **** #ifdef USE_SSL ! static PyObject *SSLErrorObject; #endif /* USE_SSL */ --- 260,264 ---- #ifdef USE_SSL ! static PyObject *PySSLErrorObject; #endif /* USE_SSL */ *************** *** 398,416 **** PyObject_HEAD PySocketSockObject *Socket; /* Socket on which we're layered */ - PyObject *x_attr; /* Attributes dictionary */ SSL_CTX* ctx; SSL* ssl; X509* server_cert; BIO* sbio; ! char server[256]; ! char issuer[256]; ! } SSLObject; ! staticforward PyTypeObject SSL_Type; ! staticforward PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args); ! staticforward PyObject *SSL_SSLread(SSLObject *self, PyObject *args); ! #define SSLObject_Check(v) ((v)->ob_type == &SSL_Type) #endif /* USE_SSL */ --- 424,441 ---- PyObject_HEAD PySocketSockObject *Socket; /* Socket on which we're layered */ SSL_CTX* ctx; SSL* ssl; X509* server_cert; BIO* sbio; ! char server[X509_NAME_MAXLEN]; ! char issuer[X509_NAME_MAXLEN]; ! } PySSLObject; ! staticforward PyTypeObject PySSL_Type; ! staticforward PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args); ! staticforward PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args); ! #define PySSLObject_Check(v) ((v)->ob_type == &PySSL_Type) #endif /* USE_SSL */ *************** *** 2163,2219 **** #ifdef USE_SSL ! /* This is a C function to be called for new object initialization */ ! static SSLObject * ! newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file) { ! SSLObject *self; ! self = PyObject_New(SSLObject, &SSL_Type); /* Create new object */ ! if (self == NULL){ ! PyErr_SetObject(SSLErrorObject, ! PyString_FromString("newSSLObject error")); return NULL; } - memset(self->server, '\0', sizeof(char) * 256); - memset(self->issuer, '\0', sizeof(char) * 256); ! self->x_attr = PyDict_New(); ! self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ ! if (self->ctx == NULL) { ! PyErr_SetObject(SSLErrorObject, ! PyString_FromString("SSL_CTX_new error")); ! PyObject_Del(self); ! return NULL; } ! if ( (key_file && !cert_file) || (!key_file && cert_file) ) ! { ! PyErr_SetObject(SSLErrorObject, ! PyString_FromString( ! "Both the key & certificate files must be specified")); ! PyObject_Del(self); ! return NULL; } ! if (key_file && cert_file) ! { if (SSL_CTX_use_PrivateKey_file(self->ctx, key_file, ! SSL_FILETYPE_PEM) < 1) ! { ! PyErr_SetObject(SSLErrorObject, ! PyString_FromString( ! "SSL_CTX_use_PrivateKey_file error")); ! PyObject_Del(self); ! return NULL; } if (SSL_CTX_use_certificate_chain_file(self->ctx, ! cert_file) < 1) ! { ! PyErr_SetObject(SSLErrorObject, ! PyString_FromString( ! "SSL_CTX_use_certificate_chain_file error")); ! PyObject_Del(self); ! return NULL; } } --- 2188,2327 ---- #ifdef USE_SSL ! /* XXX It might be helpful to augment the error message generated ! below with the name of the SSL function that generated the error. ! I expect it's obvious most of the time. ! */ ! ! static PyObject * ! PySSL_SetError(PySSLObject *obj, int ret) { ! PyObject *v, *n, *s; ! char *errstr; ! int err; ! enum py_ssl_error p; ! assert(ret <= 0); ! ! err = SSL_get_error(obj->ssl, ret); ! ! switch (err) { ! case SSL_ERROR_ZERO_RETURN: ! errstr = "TLS/SSL connection has been closed"; ! p = PY_SSL_ERROR_ZERO_RETURN; ! break; ! case SSL_ERROR_WANT_READ: ! errstr = "The operation did not complete (read)"; ! p = PY_SSL_ERROR_WANT_READ; ! break; ! case SSL_ERROR_WANT_WRITE: ! p = PY_SSL_ERROR_WANT_WRITE; ! errstr = "The operation did not complete (write)"; ! break; ! case SSL_ERROR_WANT_X509_LOOKUP: ! p = PY_SSL_ERROR_WANT_X509_LOOKUP; ! errstr = "The operation did not complete (X509 lookup)"; ! break; ! case SSL_ERROR_WANT_CONNECT: ! p = PY_SSL_ERROR_WANT_CONNECT; ! errstr = "The operation did not complete (connect)"; ! break; ! case SSL_ERROR_SYSCALL: ! { ! unsigned long e = ERR_get_error(); ! if (e == 0) { ! if (ret == 0) { ! p = PY_SSL_ERROR_EOF; ! errstr = "EOF occurred in violation of protocol"; ! } else if (ret == -1) { ! /* the underlying BIO reported an I/O error */ ! return PySocket_Err(); ! } else { /* possible? */ ! p = PY_SSL_ERROR_SYSCALL; ! errstr = "Some I/O error occurred"; ! } ! } else { ! p = PY_SSL_ERROR_SYSCALL; ! /* XXX Protected by global interpreter lock */ ! errstr = ERR_error_string(e, NULL); ! } ! break; ! } ! case SSL_ERROR_SSL: ! { ! unsigned long e = ERR_get_error(); ! p = PY_SSL_ERROR_SSL; ! if (e != 0) ! /* XXX Protected by global interpreter lock */ ! errstr = ERR_error_string(e, NULL); ! else { /* possible? */ ! errstr = "A failure in the SSL library occurred"; ! } ! break; ! } ! default: ! p = PY_SSL_ERROR_INVALID_ERROR_CODE; ! errstr = "Invalid error code"; ! } ! n = PyInt_FromLong((long) p); ! if (n == NULL) ! return NULL; ! v = PyTuple_New(2); ! if (v == NULL) { ! Py_DECREF(n); return NULL; } ! s = PyString_FromString(errstr); ! if (s == NULL) { ! Py_DECREF(v); ! Py_DECREF(n); } + PyTuple_SET_ITEM(v, 0, n); + PyTuple_SET_ITEM(v, 1, s); + PyErr_SetObject(PySSLErrorObject, v); + return NULL; + } ! static PySSLObject * ! newPySSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file) ! { ! PySSLObject *self; ! char *errstr = NULL; ! int ret; ! ! self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */ ! if (self == NULL){ ! errstr = "newPySSLObject error"; ! goto fail; ! } ! memset(self->server, '\0', sizeof(char) * X509_NAME_MAXLEN); ! memset(self->issuer, '\0', sizeof(char) * X509_NAME_MAXLEN); ! self->server_cert = NULL; ! self->ssl = NULL; ! self->ctx = NULL; ! self->Socket = NULL; ! ! if ((key_file && !cert_file) || (!key_file && cert_file)) { ! errstr = "Both the key & certificate files must be specified"; ! goto fail; } ! self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ ! if (self->ctx == NULL) { ! errstr = "SSL_CTX_new error"; ! goto fail; ! } ! ! if (key_file) { if (SSL_CTX_use_PrivateKey_file(self->ctx, key_file, ! SSL_FILETYPE_PEM) < 1) { ! errstr = "SSL_CTX_use_PrivateKey_file error"; ! goto fail; } if (SSL_CTX_use_certificate_chain_file(self->ctx, ! cert_file) < 1) { ! errstr = "SSL_CTX_use_certificate_chain_file error"; ! goto fail; } } *************** *** 2225,2234 **** SSL_set_connect_state(self->ssl); ! if ((SSL_connect(self->ssl)) == -1) { ! /* Actually negotiate SSL connection */ ! PyErr_SetObject(SSLErrorObject, ! PyString_FromString("SSL_connect error")); ! PyObject_Del(self); ! return NULL; } self->ssl->debug = 1; --- 2333,2342 ---- SSL_set_connect_state(self->ssl); ! /* Actually negotiate SSL connection */ ! /* XXX If SSL_connect() returns 0, it's also a failure. */ ! ret = SSL_connect(self->ssl); ! if (ret <= 0) { ! PySSL_SetError(self, ret); ! goto fail; } self->ssl->debug = 1; *************** *** 2236,2321 **** if ((self->server_cert = SSL_get_peer_certificate(self->ssl))) { X509_NAME_oneline(X509_get_subject_name(self->server_cert), ! self->server, 256); X509_NAME_oneline(X509_get_issuer_name(self->server_cert), ! self->issuer, 256); } - self->x_attr = NULL; self->Socket = Sock; Py_INCREF(self->Socket); return self; } ! /* This is the Python function called for new object initialization */ static PyObject * PySocket_ssl(PyObject *self, PyObject *args) { ! SSLObject *rv; PySocketSockObject *Sock; ! char *key_file; ! char *cert_file; ! if (!PyArg_ParseTuple(args, "O!zz:ssl", ! &PySocketSock_Type, (PyObject*)&Sock, ! &key_file, &cert_file) ) return NULL; ! rv = newSSLObject(Sock, key_file, cert_file); ! if ( rv == NULL ) return NULL; return (PyObject *)rv; } ! static char ssl_doc[] = ! "ssl(socket, keyfile, certfile) -> sslobject"; static PyObject * ! SSL_server(SSLObject *self, PyObject *args) { return PyString_FromString(self->server); } static PyObject * ! SSL_issuer(SSLObject *self, PyObject *args) { return PyString_FromString(self->issuer); } ! /* SSL object methods */ ! ! static PyMethodDef SSLMethods[] = { ! { "write", (PyCFunction)SSL_SSLwrite, 1 }, ! { "read", (PyCFunction)SSL_SSLread, 1 }, ! { "server", (PyCFunction)SSL_server, 1 }, ! { "issuer", (PyCFunction)SSL_issuer, 1 }, ! { NULL, NULL} ! }; ! ! static void SSL_dealloc(SSLObject *self) { if (self->server_cert) /* Possible not to have one? */ X509_free (self->server_cert); ! SSL_CTX_free(self->ctx); ! SSL_free(self->ssl); ! Py_XDECREF(self->x_attr); Py_XDECREF(self->Socket); PyObject_Del(self); } ! static PyObject *SSL_getattr(SSLObject *self, char *name) { ! return Py_FindMethod(SSLMethods, (PyObject *)self, name); } ! staticforward PyTypeObject SSL_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ ! "SSL", /*tp_name*/ ! sizeof(SSLObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ ! (destructor)SSL_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)SSL_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ --- 2344,2490 ---- if ((self->server_cert = SSL_get_peer_certificate(self->ssl))) { X509_NAME_oneline(X509_get_subject_name(self->server_cert), ! self->server, X509_NAME_MAXLEN); X509_NAME_oneline(X509_get_issuer_name(self->server_cert), ! self->issuer, X509_NAME_MAXLEN); } self->Socket = Sock; Py_INCREF(self->Socket); return self; + fail: + if (errstr) + PyErr_SetString(PySSLErrorObject, errstr); + Py_DECREF(self); + return NULL; } ! static PyObject * PySocket_ssl(PyObject *self, PyObject *args) { ! PySSLObject *rv; PySocketSockObject *Sock; ! char *key_file = NULL; ! char *cert_file = NULL; ! if (!PyArg_ParseTuple(args, "O!|zz:ssl", &PySocketSock_Type, ! (PyObject*)&Sock, &key_file, &cert_file)) return NULL; ! rv = newPySSLObject(Sock, key_file, cert_file); ! if (rv == NULL) return NULL; return (PyObject *)rv; } ! static char ssl_doc[] = "ssl(socket, [keyfile, certfile]) -> sslobject"; ! ! /* SSL object methods */ static PyObject * ! PySSL_server(PySSLObject *self, PyObject *args) { + if (!PyArg_ParseTuple(args, ":server")) + return NULL; return PyString_FromString(self->server); } static PyObject * ! PySSL_issuer(PySSLObject *self, PyObject *args) { + if (!PyArg_ParseTuple(args, ":issuer")) + return NULL; return PyString_FromString(self->issuer); } ! static void PySSL_dealloc(PySSLObject *self) { if (self->server_cert) /* Possible not to have one? */ X509_free (self->server_cert); ! if (self->ssl) ! SSL_free(self->ssl); ! if (self->ctx) ! SSL_CTX_free(self->ctx); Py_XDECREF(self->Socket); PyObject_Del(self); } ! static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args) { ! char *data; ! int len; ! ! if (!PyArg_ParseTuple(args, "s#:write", &data, &len)) ! return NULL; ! ! Py_BEGIN_ALLOW_THREADS ! len = SSL_write(self->ssl, data, len); ! Py_END_ALLOW_THREADS ! if (len > 0) ! return PyInt_FromLong(len); ! else ! return PySSL_SetError(self, len); } ! static char PySSL_SSLwrite_doc[] = \ ! "write(s) -> len\n\ ! \n\ ! Writes the string s into the SSL object. Returns the number\n\ ! of bytes written."; ! ! static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) ! { ! PyObject *buf; ! int count = 0; ! int len = 1024; ! ! if (!PyArg_ParseTuple(args, "|i:read", &len)) ! return NULL; ! ! if (!(buf = PyString_FromStringAndSize((char *) 0, len))) ! return NULL; ! ! Py_BEGIN_ALLOW_THREADS ! count = SSL_read(self->ssl, PyString_AsString(buf), len); ! Py_END_ALLOW_THREADS ! if (count <= 0) { ! Py_DECREF(buf); ! return PySSL_SetError(self, count); ! } ! if (count != len) ! _PyString_Resize(&buf, count); ! return buf; ! } ! ! static char PySSL_SSLread_doc[] = \ ! "read([len]) -> string\n\ ! \n\ ! Read up to len bytes from the SSL socket."; ! ! static PyMethodDef PySSLMethods[] = { ! {"write", (PyCFunction)PySSL_SSLwrite, METH_VARARGS, ! PySSL_SSLwrite_doc}, ! {"read", (PyCFunction)PySSL_SSLread, METH_VARARGS, ! PySSL_SSLread_doc}, ! {"server", (PyCFunction)PySSL_server, METH_VARARGS}, ! {"issuer", (PyCFunction)PySSL_issuer, METH_VARARGS}, ! {NULL, NULL} ! }; ! ! static PyObject *PySSL_getattr(PySSLObject *self, char *name) ! { ! return Py_FindMethod(PySSLMethods, (PyObject *)self, name); ! } ! ! staticforward PyTypeObject PySSL_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ ! "socket.SSL", /*tp_name*/ ! sizeof(PySSLObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ ! (destructor)PySSL_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)PySSL_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ *************** *** 2327,2386 **** }; ! ! static PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args) { ! char *data; ! size_t len; ! ! if (!PyArg_ParseTuple(args, "s#:write", &data, &len)) ! return NULL; ! Py_BEGIN_ALLOW_THREADS ! len = SSL_write(self->ssl, data, len); ! Py_END_ALLOW_THREADS ! return PyInt_FromLong((long)len); } ! static PyObject *SSL_SSLread(SSLObject *self, PyObject *args) ! { ! PyObject *buf; ! int count = 0; ! int len = 1024; ! int res; ! PyArg_ParseTuple(args, "|i:read", &len); ! if (!(buf = PyString_FromStringAndSize((char *) 0, len))) ! return NULL; /* Error object should already be set */ ! Py_BEGIN_ALLOW_THREADS ! count = SSL_read(self->ssl, PyString_AsString(buf), len); ! Py_END_ALLOW_THREADS ! res = SSL_get_error(self->ssl, count); ! switch (res) { ! case SSL_ERROR_NONE: ! assert(count > 0); ! break; ! case SSL_ERROR_ZERO_RETURN: /* normal EOF */ ! assert(count == 0); ! break; ! default: ! Py_DECREF(buf); ! return PyErr_SetFromErrno(SSLErrorObject); ! } ! fflush(stderr); ! if (count < 0) { ! Py_DECREF(buf); ! return PyErr_SetFromErrno(SSLErrorObject); ! } ! if (count != len && _PyString_Resize(&buf, count) < 0) ! return NULL; ! return buf; ! } #endif /* USE_SSL */ --- 2496,2562 ---- }; + #ifdef HAVE_OPENSSL_RAND ! /* helper routines for seeding the SSL PRNG */ ! static PyObject * ! PySSL_RAND_add(PyObject *self, PyObject *args) { ! char *buf; ! int len; ! double entropy; ! if (!PyArg_ParseTuple(args, "s#d:RAND_add", &buf, &len, &entropy)) ! return NULL; ! RAND_add(buf, len, entropy); ! Py_INCREF(Py_None); ! return Py_None; } ! static char PySSL_RAND_add_doc[] = \ ! "RAND_add(string, entropy)\n\ ! \n\ ! Mix string into the OpenSSL PRNG state. entropy (a float) is a lower\n\ ! bound on the entropy contained in string."; ! static PyObject * ! PySSL_RAND_status(PyObject *self) ! { ! return PyInt_FromLong(RAND_status()); ! } ! static char PySSL_RAND_status_doc[] = \ ! "RAND_status() -> 0 or 1\n\ ! \n\ ! Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n\ ! It is necessary to seed the PRNG with RAND_add() on some platforms before\n\ ! using the ssl() function."; ! static PyObject * ! PySSL_RAND_egd(PyObject *self, PyObject *args) ! { ! int bytes; ! char *s; ! if (!PyArg_ParseTuple(args, "s:RAND_egd", &s)) ! return NULL; ! bytes = RAND_egd(s); ! if (bytes == -1) { ! PyErr_SetString(PySSLErrorObject, ! "EGD connection failed or EGD did not return " ! "enough data to seed the PRNG"); ! return NULL; ! } ! return PyInt_FromLong(bytes); ! } ! static char PySSL_RAND_egd_doc[] = \ ! "RAND_egd(path) -> bytes\n\ ! \n\ ! Queries the entropy gather daemon (EGD) on socket path. Returns number\n\ ! of bytes read. Raises socket.sslerror if connection to EGD fails or\n\ ! if it does provide enough data to seed PRNG."; ! #endif #endif /* USE_SSL */ *************** *** 2423,2426 **** --- 2599,2610 ---- {"ssl", PySocket_ssl, METH_VARARGS, ssl_doc}, + #ifdef HAVE_OPENSSL_RAND + {"RAND_add", PySSL_RAND_add, METH_VARARGS, + PySSL_RAND_add_doc}, + {"RAND_egd", PySSL_RAND_egd, METH_VARARGS, + PySSL_RAND_egd_doc}, + {"RAND_status", (PyCFunction)PySSL_RAND_status, METH_VARARGS, + PySSL_RAND_status_doc}, + #endif #endif /* USE_SSL */ {NULL, NULL} /* Sentinel */ *************** *** 2583,2587 **** #endif /* RISCOS */ #ifdef USE_SSL ! SSL_Type.ob_type = &PyType_Type; #endif m = Py_InitModule3("_socket", PySocket_methods, module_doc); --- 2767,2771 ---- #endif /* RISCOS */ #ifdef USE_SSL ! PySSL_Type.ob_type = &PyType_Type; #endif m = Py_InitModule3("_socket", PySocket_methods, module_doc); *************** *** 2593,2603 **** SSL_load_error_strings(); SSLeay_add_ssl_algorithms(); ! SSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); ! if (SSLErrorObject == NULL) return; ! PyDict_SetItemString(d, "sslerror", SSLErrorObject); ! Py_INCREF(&SSL_Type); if (PyDict_SetItemString(d, "SSLType", ! (PyObject *)&SSL_Type) != 0) return; #endif /* USE_SSL */ --- 2777,2787 ---- SSL_load_error_strings(); SSLeay_add_ssl_algorithms(); ! PySSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); ! if (PySSLErrorObject == NULL) return; ! PyDict_SetItemString(d, "sslerror", PySSLErrorObject); ! Py_INCREF(&PySSL_Type); if (PyDict_SetItemString(d, "SSLType", ! (PyObject *)&PySSL_Type) != 0) return; #endif /* USE_SSL */ *************** *** 2968,2971 **** --- 3152,3177 ---- #ifdef IPX_TYPE insint(d, "IPX_TYPE", IPX_TYPE); + #endif + + #ifdef USE_SSL + PyModule_AddIntConstant(m, "SSL_ERROR_ZERO_RETURN", + PY_SSL_ERROR_ZERO_RETURN); + PyModule_AddIntConstant(m, "SSL_ERROR_WANT_READ", + PY_SSL_ERROR_WANT_READ); + PyModule_AddIntConstant(m, "SSL_ERROR_WANT_WRITE", + PY_SSL_ERROR_WANT_WRITE); + PyModule_AddIntConstant(m, "SSL_ERROR_WANT_X509_LOOKUP", + PY_SSL_ERROR_WANT_X509_LOOKUP); + PyModule_AddIntConstant(m, "SSL_ERROR_SYSCALL", + PY_SSL_ERROR_SYSCALL); + PyModule_AddIntConstant(m, "SSL_ERROR_SSL", + PY_SSL_ERROR_SSL); + PyModule_AddIntConstant(m, "SSL_ERROR_WANT_CONNECT", + PY_SSL_ERROR_WANT_CONNECT); + /* non ssl.h errorcodes */ + PyModule_AddIntConstant(m, "SSL_ERROR_EOF", + PY_SSL_ERROR_EOF); + PyModule_AddIntConstant(m, "SSL_ERROR_INVALID_ERROR_CODE", + PY_SSL_ERROR_INVALID_ERROR_CODE); #endif From jhylton@users.sourceforge.net Tue Jul 2 21:19:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:19:11 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6288 Modified Files: httplib.py Log Message: Convert raise to call exception class. Add whitespace. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** httplib.py 28 Jun 2002 23:38:14 -0000 1.53 --- httplib.py 2 Jul 2002 20:19:08 -0000 1.54 *************** *** 369,373 **** port = int(host[i+1:]) except ValueError: ! raise InvalidURL, "nonnumeric port: '%s'"%host[i+1:] host = host[:i] else: --- 369,373 ---- port = int(host[i+1:]) except ValueError: ! raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) host = host[:i] else: From tim_one@users.sourceforge.net Tue Jul 2 21:20:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:20:10 -0700 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5769/python/Modules Modified Files: binascii.c Log Message: Fix for SF bug #576327: zipfile when sizeof(long) == 8 binascii_crc32(): Make this return a signed 4-byte result across platforms. The other way to make this platform-independent would be to make it return an unsigned unbounded int, but the evidence suggests other code out there treats it like a signed 4-byte int (e.g., existing code writing the result with struct.pack "l" format). Bugfix candidate. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** binascii.c 13 Jun 2002 20:32:48 -0000 2.34 --- binascii.c 2 Jul 2002 20:20:08 -0000 2.35 *************** *** 865,868 **** --- 865,869 ---- unsigned long crc = 0UL; /* initial value of CRC */ int len; + long result; if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) *************** *** 873,877 **** crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ ! return Py_BuildValue("l", crc ^ 0xFFFFFFFFUL); } --- 874,887 ---- crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ ! ! result = (long)(crc ^ 0xFFFFFFFFUL); ! /* If long is > 32 bits, extend the sign bit. This is one way to ! * ensure the result is the same across platforms. The other way ! * would be to return an unbounded long, but the evidence suggests ! * that lots of code outside this treats the result as if it were ! * a signed 4-byte integer. ! */ ! result |= -(result & (1L << 31)); ! return PyInt_FromLong(result); } From fdrake@users.sourceforge.net Tue Jul 2 21:32:53 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:32:53 -0700 Subject: [Python-checkins] python/dist/src/Doc ACKS,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv10448 Modified Files: ACKS Log Message: Abstract the creation of signature lines for callable things; the new \py@sigline macro will wrap the argument list so it will not extend into the right margin. Substantially based on a contribution from Dave Cole. This addresses one of the comments in SF bug #574742. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ACKS,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ACKS 19 Apr 2002 15:59:00 -0000 1.36 --- ACKS 2 Jul 2002 20:32:50 -0000 1.37 *************** *** 41,44 **** --- 41,45 ---- Mike Clarkson Steve Clift + Dave Cole Matthew Cowles Jeremy Craven From fdrake@users.sourceforge.net Tue Jul 2 21:32:52 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:32:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv10448/texinputs Modified Files: python.sty Log Message: Abstract the creation of signature lines for callable things; the new \py@sigline macro will wrap the argument list so it will not extend into the right margin. Substantially based on a contribution from Dave Cole. This addresses one of the comments in SF bug #574742. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** python.sty 15 Apr 2002 20:48:40 -0000 1.95 --- python.sty 2 Jul 2002 20:32:50 -0000 1.96 *************** *** 582,585 **** --- 582,595 ---- \newcommand{\py@unspecified}{...} + + \newlength{\py@argswidth} + \newcommand{\py@sigparams}[1]{% + \parbox[t]{\py@argswidth}{\py@varvars{#1}\code{)}}} + \newcommand{\py@sigline}[2]{% + \settowidth{\py@argswidth}{#1\code{(}}% + \addtolength{\py@argswidth}{-2\py@argswidth}% + \addtolength{\py@argswidth}{\textwidth}% + \item[#1\code{(}\py@sigparams{#2}]} + % C functions ------------------------------------------------------------ % \begin{cfuncdesc}[refcount]{type}{name}{arglist} *************** *** 587,591 **** % tools/anno-api.py; it pulls the value from the refcounts database. \newcommand{\cfuncline}[3]{ ! \item[\code{#1 \bfcode{#2}(\py@varvars{#3})}\index{#2@{\py@idxcode{#2()}}}] } \newenvironment{cfuncdesc}[4][\py@badkey]{ --- 597,602 ---- % tools/anno-api.py; it pulls the value from the refcounts database. \newcommand{\cfuncline}[3]{ ! \py@sigline{\code{#1 \bfcode{#2}}}{#3}% ! \index{#2@{\py@idxcode{#2()}}} } \newenvironment{cfuncdesc}[4][\py@badkey]{ *************** *** 646,650 **** % similar to {funcdesc}, but doesn't add to the index ! \newcommand{\funclineni}[2]{\item[\code{\bfcode{#1}(\py@varvars{#2})}]} \newenvironment{funcdescni}[2]{ \begin{fulllineitems} --- 657,662 ---- % similar to {funcdesc}, but doesn't add to the index ! \newcommand{\funclineni}[2]{% ! \py@sigline{\bfcode{#1}}{#2}} \newenvironment{funcdescni}[2]{ \begin{fulllineitems} *************** *** 658,663 **** \global\def\py@thisclass{#1} \begin{fulllineitems} ! \item[\strong{class }\code{\bfcode{#1}(\py@varvars{#2})}% ! \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}] }{\end{fulllineitems}} --- 670,675 ---- \global\def\py@thisclass{#1} \begin{fulllineitems} ! \py@sigline{\strong{class }\bfcode{#1}}{#2}% ! \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)} }{\end{fulllineitems}} *************** *** 677,682 **** \global\def\py@thisclass{#1} \begin{fulllineitems} ! \item[\strong{exception }\code{\bfcode{#1}(\py@varvars{#2})}% ! \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] }{\end{fulllineitems}} --- 689,694 ---- \global\def\py@thisclass{#1} \begin{fulllineitems} ! \py@sigline{\strong{exception }\bfcode{#1}}{#2}% ! \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)} }{\end{fulllineitems}} *************** *** 710,714 **** % (never actually uses the optional argument) \newcommand{\methodlineni}[3][\py@classbadkey]{% ! \item[\code{\bfcode{#2}(\py@varvars{#3})}]} \newenvironment{methoddescni}[3][\py@classbadkey]{ \begin{fulllineitems} --- 722,726 ---- % (never actually uses the optional argument) \newcommand{\methodlineni}[3][\py@classbadkey]{% ! \py@sigline{\bfcode{#2}}{#3}} \newenvironment{methoddescni}[3][\py@classbadkey]{ \begin{fulllineitems} From fdrake@users.sourceforge.net Tue Jul 2 21:37:14 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:37:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12034 Modified Files: libtextwrap.tex Log Message: Deal with & remove the XXX comments. Change the markup to be more like the rest of the documentation. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libtextwrap.tex 29 Jun 2002 02:38:50 -0000 1.1 --- libtextwrap.tex 2 Jul 2002 20:37:12 -0000 1.2 *************** *** 16,20 **** \class{TextWrapper} for efficiency. ! \begin{funcdesc}{wrap}{text, width=70, **kwargs} Wraps the single paragraph in \var{text} (a string) so every line is at most \var{width} characters long. Returns a list of output lines, --- 16,20 ---- \class{TextWrapper} for efficiency. ! \begin{funcdesc}{wrap}{text\optional{, width\optional{, \moreargs}}} Wraps the single paragraph in \var{text} (a string) so every line is at most \var{width} characters long. Returns a list of output lines, *************** *** 22,29 **** Optional keyword arguments correspond to the instance attributes of ! \class{TextWrapper}, documented below. \end{funcdesc} ! \begin{funcdesc}{fill}{text, width=70, **kwargs} Wraps the single paragraph in \var{text}, and returns a single string containing the wrapped paragraph. \function{fill()} is shorthand for --- 22,30 ---- Optional keyword arguments correspond to the instance attributes of ! \class{TextWrapper}, documented below. \var{width} defaults to ! \code{70}. \end{funcdesc} ! \begin{funcdesc}{fill}{text\optional{, width\optional{, \moreargs}}} Wraps the single paragraph in \var{text}, and returns a single string containing the wrapped paragraph. \function{fill()} is shorthand for *************** *** 42,55 **** \class{TextWrapper} object. ! % XXX how to typeset long argument lists? this just spills off ! % the edge of the page, with or without \\ delimiters ! \begin{classdesc}{TextWrapper}{width=70, \\ ! initial_indent="", \\ ! subsequent_indent="", \\ ! expand_tabs=True, \\ ! replace_whitespace=True, \\ ! fix_sentence_endings=False, \\ ! break_long_words=True} ! Each keyword argument to the constructor corresponds to an instance attribute, so for example --- 43,49 ---- \class{TextWrapper} object. ! \begin{classdesc}{TextWrapper}{width, initial_indent, subsequent_indent, ! expand_tabs, replace_whitespace, ! fix_sentence_endings, break_long_words} Each keyword argument to the constructor corresponds to an instance attribute, so for example *************** *** 65,72 **** You can re-use the same \class{TextWrapper} object many times, and you can change any of its options through direct assignment to instance ! attributes between uses. The effects of the instance attributes are as ! follows: ! \begin{memberdesc}[bool]{expand_tabs} If true (the default), then all tab characters in \var{text} will be expanded to spaces using the \method{expand_tabs()} method of --- 59,69 ---- You can re-use the same \class{TextWrapper} object many times, and you can change any of its options through direct assignment to instance ! attributes between uses. ! \end{classdesc} ! ! The effects of the instance attributes are as follows: ! ! \begin{memberdesc}{expand_tabs} If true (the default), then all tab characters in \var{text} will be expanded to spaces using the \method{expand_tabs()} method of *************** *** 74,78 **** \end{memberdesc} ! \begin{memberdesc}[bool]{replace_whitespace} If true (the default), each whitespace character (as defined by \var{string.whitespace}) remaining after tab expansion will be replaced --- 71,75 ---- \end{memberdesc} ! \begin{memberdesc}{replace_whitespace} If true (the default), each whitespace character (as defined by \var{string.whitespace}) remaining after tab expansion will be replaced *************** *** 82,99 **** \end{memberdesc} ! % XXX how to typeset the empty string? this looks awful, and "" is worse. ! \begin{memberdesc}[string]{initial_indent} ! (default: '') String that will be prepended to the first line of wrapped ! output. Counts towards the length of the first line. \end{memberdesc} ! \begin{memberdesc}[string]{subsequent_indent} ! (default: '') String that will be prepended to all lines of wrapped ! output except the first. Counts towards the length of each line except ! the first. \end{memberdesc} ! \begin{memberdesc}[bool]{fix_sentence_endings} ! (default: false) If true, \class{TextWrapper} attempts to detect sentence endings and ensure that sentences are always separated by exactly two spaces. This is generally desired for text in a monospaced --- 79,95 ---- \end{memberdesc} ! \begin{memberdesc}{initial_indent} ! (default: \code{''}) String that will be prepended to the first line ! of wrapped output. Counts towards the length of the first line. \end{memberdesc} ! \begin{memberdesc}{subsequent_indent} ! (default: \code{''}) String that will be prepended to all lines of ! wrapped output except the first. Counts towards the length of each ! line except the first. \end{memberdesc} ! \begin{memberdesc}{fix_sentence_endings} ! (default: \code{False}) If true, \class{TextWrapper} attempts to detect sentence endings and ensure that sentences are always separated by exactly two spaces. This is generally desired for text in a monospaced *************** *** 116,120 **** \end{memberdesc} ! \begin{memberdesc}[bool]{break_long_words} If true (the default), then words longer than \var{width} will be broken in order to ensure that no lines are longer than \var{width}. If it is --- 112,116 ---- \end{memberdesc} ! \begin{memberdesc}{break_long_words} If true (the default), then words longer than \var{width} will be broken in order to ensure that no lines are longer than \var{width}. If it is *************** *** 138,141 **** containing the wrapped paragraph. \end{methoddesc} - - \end{classdesc} --- 134,135 ---- From jhylton@users.sourceforge.net Tue Jul 2 21:39:39 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:39:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.2,1.2.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12871 Modified Files: Tag: release22-maint test_httplib.py Log Message: Track change of begin() to _begin(). Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.2 retrieving revision 1.2.12.1 diff -C2 -d -r1.2 -r1.2.12.1 *** test_httplib.py 25 Sep 2001 19:29:35 -0000 1.2 --- test_httplib.py 2 Jul 2002 20:39:37 -0000 1.2.12.1 *************** *** 17,21 **** sock = FakeSocket(body) resp = httplib.HTTPResponse(sock,1) ! resp.begin() print resp.read() resp.close() --- 17,21 ---- sock = FakeSocket(body) resp = httplib.HTTPResponse(sock,1) ! resp._begin() print resp.read() resp.close() *************** *** 25,29 **** resp = httplib.HTTPResponse(sock,1) try: ! resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" --- 25,29 ---- resp = httplib.HTTPResponse(sock,1) try: ! resp._begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" From jhylton@users.sourceforge.net Tue Jul 2 21:42:52 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:42:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.1,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14132/Lib/test Modified Files: Tag: release21-maint test_httplib.py Log Message: Backport various bug fixes from trunk. The 2.1 maintenance branch is now identical to the trunk through rev 1.54 of httplib.py. Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** test_httplib.py 13 Apr 2001 14:57:44 -0000 1.1 --- test_httplib.py 2 Jul 2002 20:42:50 -0000 1.1.2.1 *************** *** 17,21 **** sock = FakeSocket(body) resp = httplib.HTTPResponse(sock,1) ! resp.begin() print resp.read() resp.close() --- 17,21 ---- sock = FakeSocket(body) resp = httplib.HTTPResponse(sock,1) ! resp._begin() print resp.read() resp.close() *************** *** 25,29 **** resp = httplib.HTTPResponse(sock,1) try: ! resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" --- 25,29 ---- resp = httplib.HTTPResponse(sock,1) try: ! resp._begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" From jhylton@users.sourceforge.net Tue Jul 2 21:42:52 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 02 Jul 2002 13:42:52 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.34.2.3,1.34.2.4 urlparse.py,1.29,1.29.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14132/Lib Modified Files: Tag: release21-maint httplib.py urlparse.py Log Message: Backport various bug fixes from trunk. The 2.1 maintenance branch is now identical to the trunk through rev 1.54 of httplib.py. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.34.2.3 retrieving revision 1.34.2.4 diff -C2 -d -r1.34.2.3 -r1.34.2.4 *** httplib.py 9 Apr 2002 00:39:10 -0000 1.34.2.3 --- httplib.py 2 Jul 2002 20:42:50 -0000 1.34.2.4 *************** *** 67,72 **** """ ! import socket import mimetools try: --- 67,74 ---- """ ! import errno import mimetools + import socket + from urlparse import urlsplit try: *************** *** 77,84 **** __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection", "HTTPException", "NotConnected", "UnknownProtocol", ! "UnknownTransferEncoding", "IllegalKeywordArgument", ! "UnimplementedFileMode", "IncompleteRead", ! "ImproperConnectionState", "CannotSendRequest", "CannotSendHeader", ! "ResponseNotReady", "BadStatusLine", "error"] HTTP_PORT = 80 --- 79,86 ---- __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection", "HTTPException", "NotConnected", "UnknownProtocol", ! "UnknownTransferEncoding", "UnimplementedFileMode", ! "IncompleteRead", "InvalidURL", "ImproperConnectionState", ! "CannotSendRequest", "CannotSendHeader", "ResponseNotReady", ! "BadStatusLine", "error"] HTTP_PORT = 80 *************** *** 110,118 **** self.will_close = _UNKNOWN # conn will close at end of response ! def begin(self): ! if self.msg is not None: ! # we've already started reading the response ! return ! line = self.fp.readline() if self.debuglevel > 0: --- 112,116 ---- self.will_close = _UNKNOWN # conn will close at end of response ! def _read_status(self): line = self.fp.readline() if self.debuglevel > 0: *************** *** 134,144 **** # The status code is a three-digit number try: ! self.status = status = int(status) if status < 100 or status > 999: raise BadStatusLine(line) except ValueError: raise BadStatusLine(line) ! self.reason = reason.strip() if version == 'HTTP/1.0': self.version = 10 --- 132,162 ---- # The status code is a three-digit number try: ! status = int(status) if status < 100 or status > 999: raise BadStatusLine(line) except ValueError: raise BadStatusLine(line) ! return version, status, reason ! ! def _begin(self): ! if self.msg is not None: ! # we've already started reading the response ! return + # read until we get a non-100 response + while 1: + version, status, reason = self._read_status() + if status != 100: + break + # skip the header from the 100 response + while 1: + skip = self.fp.readline().strip() + if not skip: + break + if self.debuglevel > 0: + print "header:", skip + + self.status = status + self.reason = reason.strip() if version == 'HTTP/1.0': self.version = 10 *************** *** 151,154 **** --- 169,173 ---- if self.version == 9: + self.chunked = 0 self.msg = mimetools.Message(StringIO()) return *************** *** 232,235 **** --- 251,255 ---- if self.chunked: + assert self.chunked != _UNKNOWN chunk_left = self.chunk_left value = '' *************** *** 346,350 **** i = host.find(':') if i >= 0: ! port = int(host[i+1:]) host = host[:i] else: --- 366,373 ---- i = host.find(':') if i >= 0: ! try: ! port = int(host[i+1:]) ! except ValueError: ! raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) host = host[:i] else: *************** *** 395,399 **** raise ! def putrequest(self, method, url): """Send a request to the server. --- 418,422 ---- raise ! def putrequest(self, method, url, skip_host=0): """Send a request to the server. *************** *** 446,461 **** # Issue some standard headers for better HTTP/1.1 compliance ! # this header is issued *only* for HTTP/1.1 connections. more ! # specifically, this means it is only issued when the client uses ! # the new HTTPConnection() class. backwards-compat clients will ! # be using HTTP/1.0 and those clients may be issuing this header ! # themselves. we should NOT issue it twice; some web servers (such ! # as Apache) barf when they see two Host: headers ! # if we need a non-standard port,include it in the header ! if self.port == HTTP_PORT: ! self.putheader('Host', self.host) ! else: ! self.putheader('Host', "%s:%s" % (self.host, self.port)) # note: we are assuming that clients will not attempt to set these --- 469,497 ---- # Issue some standard headers for better HTTP/1.1 compliance ! if not skip_host: ! # this header is issued *only* for HTTP/1.1 ! # connections. more specifically, this means it is ! # only issued when the client uses the new ! # HTTPConnection() class. backwards-compat clients ! # will be using HTTP/1.0 and those clients may be ! # issuing this header themselves. we should NOT issue ! # it twice; some web servers (such as Apache) barf ! # when they see two Host: headers ! # If we need a non-standard port,include it in the ! # header. If the request is going through a proxy, ! # but the host of the actual URL, not the host of the ! # proxy. ! ! netloc = '' ! if url.startswith('http'): ! nil, netloc, nil, nil, nil = urlsplit(url) ! ! if netloc: ! self.putheader('Host', netloc) ! elif self.port == HTTP_PORT: ! self.putheader('Host', self.host) ! else: ! self.putheader('Host', "%s:%s" % (self.host, self.port)) # note: we are assuming that clients will not attempt to set these *************** *** 515,519 **** def _send_request(self, method, url, body, headers): ! self.putrequest(method, url) if body: --- 551,562 ---- def _send_request(self, method, url, body, headers): ! # If headers already contains a host header, then define the ! # optional skip_host argument to putrequest(). The check is ! # harder because field names are case insensitive. ! if 'Host' in (headers ! or [k for k in headers.iterkeys() if k.lower() == "host"]): ! self.putrequest(method, url, skip_host=1) ! else: ! self.putrequest(method, url) if body: *************** *** 557,561 **** response = self.response_class(self.sock) ! response.begin() self.__state = _CS_IDLE --- 600,605 ---- response = self.response_class(self.sock) ! response._begin() ! assert response.will_close != _UNKNOWN self.__state = _CS_IDLE *************** *** 569,572 **** --- 613,693 ---- return response + class SSLFile: + """File-like object wrapping an SSL socket.""" + + BUFSIZE = 8192 + + def __init__(self, sock, ssl, bufsize=None): + self._sock = sock + self._ssl = ssl + self._buf = '' + self._bufsize = bufsize or self.__class__.BUFSIZE + + def _read(self): + buf = '' + # put in a loop so that we retry on transient errors + while 1: + try: + buf = self._ssl.read(self._bufsize) + except socket.sslerror, err: + if (err[0] == socket.SSL_ERROR_WANT_READ + or err[0] == socket.SSL_ERROR_WANT_WRITE): + continue + if (err[0] == socket.SSL_ERROR_ZERO_RETURN + or err[0] == socket.SSL_ERROR_EOF): + break + raise + except socket.error, err: + if err[0] == errno.EINTR: + continue + if err[0] == errno.EBADF: + # XXX socket was closed? + break + raise + else: + break + return buf + + 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 + + def close(self): + self._sock.close() class FakeSocket: *************** *** 576,600 **** def makefile(self, mode, bufsize=None): - """Return a readable file-like object with data from socket. - - This method offers only partial support for the makefile - interface of a real socket. It only supports modes 'r' and - 'rb' and the bufsize argument is ignored. - - The returned object contains *all* of the file data - """ if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! ! msgbuf = [] ! while 1: ! try: ! buf = self.__ssl.read() ! except socket.sslerror, msg: ! break ! if buf == '': ! break ! msgbuf.append(buf) ! return StringIO("".join(msgbuf)) def send(self, stuff, flags = 0): --- 697,703 ---- def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self.__sock, self.__ssl, bufsize) def send(self, stuff, flags = 0): *************** *** 616,634 **** default_port = HTTPS_PORT ! def __init__(self, host, port=None, **x509): ! keys = x509.keys() ! try: ! keys.remove('key_file') ! except ValueError: ! pass ! try: ! keys.remove('cert_file') ! except ValueError: ! pass ! if keys: ! raise IllegalKeywordArgument() HTTPConnection.__init__(self, host, port) ! self.key_file = x509.get('key_file') ! self.cert_file = x509.get('cert_file') def connect(self): --- 719,726 ---- default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None): HTTPConnection.__init__(self, host, port) ! self.key_file = key_file ! self.cert_file = cert_file def connect(self): *************** *** 654,658 **** _connection_class = HTTPConnection ! def __init__(self, host='', port=None, **x509): "Provide a default host, since the superclass requires one." --- 746,750 ---- _connection_class = HTTPConnection ! def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one." *************** *** 664,679 **** # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._conn = self._connection_class(host, port) # set up delegation to flesh out interface ! self.send = self._conn.send ! self.putrequest = self._conn.putrequest ! self.endheaders = self._conn.endheaders ! self._conn._http_vsn = self._http_vsn ! self._conn._http_vsn_str = self._http_vsn_str ! # we never actually use these for anything, but we keep them here for ! # compatibility with post-1.5.2 CVS. ! self.key_file = x509.get('key_file') ! self.cert_file = x509.get('cert_file') self.file = None --- 756,772 ---- # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port)) ! ! def _setup(self, conn): ! self._conn = conn ! # set up delegation to flesh out interface ! self.send = conn.send ! self.putrequest = conn.putrequest ! self.endheaders = conn.endheaders ! self.set_debuglevel = conn.set_debuglevel ! conn._http_vsn = self._http_vsn ! conn._http_vsn_str = self._http_vsn_str self.file = None *************** *** 686,692 **** self._conn.connect() - def set_debuglevel(self, debuglevel): - self._conn.set_debuglevel(debuglevel) - def getfile(self): "Provide a getfile, since the superclass' does not use this concept." --- 779,782 ---- *************** *** 746,749 **** --- 836,852 ---- _connection_class = HTTPSConnection + def __init__(self, host='', port=None, **x509): + # provide a default host, pass the X509 cert info + + # urf. compensate for bad input. + if port == 0: + port = None + self._setup(self._connection_class(host, port, **x509)) + + # we never actually use these for anything, but we keep them + # here for compatibility with post-1.5.2 CVS. + self.key_file = x509.get('key_file') + self.cert_file = x509.get('cert_file') + class HTTPException(Exception): *************** *** 753,756 **** --- 856,862 ---- pass + class InvalidURL(HTTPException): + pass + class UnknownProtocol(HTTPException): def __init__(self, version): *************** *** 760,766 **** pass - class IllegalKeywordArgument(HTTPException): - pass - class UnimplementedFileMode(HTTPException): pass --- 866,869 ---- *************** *** 823,827 **** for header in headers.headers: print header.strip() print ! print h.getfile().read() if hasattr(socket, 'ssl'): --- 926,941 ---- for header in headers.headers: print header.strip() print ! print "read", len(h.getfile().read()) ! ! # minimal test that code to extract host from url works ! class HTTP11(HTTP): ! _http_vsn = 11 ! _http_vsn_str = 'HTTP/1.1' ! ! h = HTTP11('www.python.org') ! h.putrequest('GET', 'http://www.python.org/~jeremy/') ! h.endheaders() ! h.getreply() ! h.close() if hasattr(socket, 'ssl'): *************** *** 833,836 **** --- 947,951 ---- hs.endheaders() status, reason, headers = hs.getreply() + # XXX why does this give a 302 response? print 'status =', status print 'reason =', reason *************** *** 839,843 **** for header in headers.headers: print header.strip() print ! print hs.getfile().read() --- 954,958 ---- for header in headers.headers: print header.strip() print ! print "read", len(hs.getfile().read()) Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.29 retrieving revision 1.29.4.1 diff -C2 -d -r1.29 -r1.29.4.1 *** urlparse.py 1 Mar 2001 04:27:19 -0000 1.29 --- urlparse.py 2 Jul 2002 20:42:50 -0000 1.29.4.1 *************** *** 44,48 **** ! def urlparse(url, scheme = '', allow_fragments = 1): """Parse a URL into 6 components: :///;?# --- 44,48 ---- ! def urlparse(url, scheme='', allow_fragments=1): """Parse a URL into 6 components: :///;?# *************** *** 50,53 **** --- 50,76 ---- Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.""" + tuple = urlsplit(url, scheme, allow_fragments) + scheme, netloc, url, query, fragment = tuple + if scheme in uses_params and ';' in url: + url, params = _splitparams(url) + else: + params = '' + return scheme, netloc, url, params, query, fragment + + def _splitparams(url): + if '/' in url: + i = url.find(';', url.rfind('/')) + if i < 0: + return url, '' + else: + i = url.find(';') + return url[:i], url[i+1:] + + def urlsplit(url, scheme='', allow_fragments=1): + """Parse a URL into 5 components: + :///?# + Return a 5-tuple: (scheme, netloc, path, query, fragment). + Note that we don't break the components up in smaller bits + (e.g. netloc is a single string) and we don't expand % escapes.""" key = url, scheme, allow_fragments cached = _parse_cache.get(key, None) *************** *** 56,60 **** if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() ! netloc = path = params = query = fragment = '' i = url.find(':') if i > 0: --- 79,83 ---- if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() ! netloc = query = fragment = '' i = url.find(':') if i > 0: *************** *** 65,85 **** i = url.find('/', 2) if i < 0: ! i = len(url) netloc = url[2:i] url = url[i:] ! if allow_fragments: ! i = url.rfind('#') ! if i >= 0: ! fragment = url[i+1:] ! url = url[:i] ! i = url.find('?') ! if i >= 0: ! query = url[i+1:] ! url = url[:i] ! i = url.find(';') ! if i >= 0: ! params = url[i+1:] ! url = url[:i] ! tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple --- 88,101 ---- i = url.find('/', 2) if i < 0: ! i = url.find('#') ! if i < 0: ! i = len(url) netloc = url[2:i] url = url[i:] ! if allow_fragments and '#' in url: ! url, fragment = url.split('#', 1) ! if '?' in url: ! url, query = url.split('?', 1) ! tuple = scheme, netloc, url, query, fragment _parse_cache[key] = tuple return tuple *************** *** 95,111 **** i = len(url) netloc, url = url[2:i], url[i:] ! if allow_fragments and scheme in uses_fragment: ! i = url.rfind('#') ! if i >= 0: ! url, fragment = url[:i], url[i+1:] ! if scheme in uses_query: ! i = url.find('?') ! if i >= 0: ! url, query = url[:i], url[i+1:] ! if scheme in uses_params: ! i = url.find(';') ! if i >= 0: ! url, params = url[:i], url[i+1:] ! tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple --- 111,119 ---- i = len(url) netloc, url = url[2:i], url[i:] ! if allow_fragments and scheme in uses_fragment and '#' in url: ! url, fragment = url.split('#', 1) ! if scheme in uses_query and '?' in url: ! url, query = url.split('?', 1) ! tuple = scheme, netloc, url, query, fragment _parse_cache[key] = tuple return tuple *************** *** 116,119 **** --- 124,132 ---- originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).""" + if params: + url = "%s;%s" % (url, params) + return urlunsplit((scheme, netloc, url, query, fragment)) + + def urlunsplit((scheme, netloc, url, query, fragment)): if netloc or (scheme in uses_netloc and url[:2] == '//'): if url and url[:1] != '/': url = '/' + url *************** *** 121,126 **** if scheme: url = scheme + ':' + url - if params: - url = url + ';' + params if query: url = url + '?' + query --- 134,137 ---- *************** *** 188,194 **** empty string. """ ! s, n, p, a, q, frag = urlparse(url) ! defrag = urlunparse((s, n, p, a, q, '')) ! return defrag, frag --- 199,208 ---- empty string. """ ! if '#' in url: ! s, n, p, a, q, frag = urlparse(url) ! defrag = urlunparse((s, n, p, a, q, '')) ! return defrag, frag ! else: ! return url, '' From fdrake@users.sourceforge.net Tue Jul 2 22:03:51 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 14:03:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21588 Modified Files: libos.tex Log Message: Attempt to clarify removedirs(). Based on SF bug #574773. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** libos.tex 18 Jun 2002 20:30:37 -0000 1.90 --- libos.tex 2 Jul 2002 21:03:49 -0000 1.91 *************** *** 751,755 **** \begin{funcdesc}{removedirs}{path} \index{directory!deleting} ! Recursive directory removal function. Works like \function{rmdir()} except that, if the leaf directory is successfully removed, directories corresponding to rightmost path --- 751,755 ---- \begin{funcdesc}{removedirs}{path} \index{directory!deleting} ! Removes directories recursively. Works like \function{rmdir()} except that, if the leaf directory is successfully removed, directories corresponding to rightmost path From fdrake@users.sourceforge.net Tue Jul 2 22:28:06 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 14:28:06 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30451 Modified Files: os.py Log Message: Be consistent with the functions in the posix/nt module: docstrings don't include a " -> None" for functions that have no return value. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** os.py 1 Jun 2002 14:18:46 -0000 1.57 --- os.py 2 Jul 2002 21:28:04 -0000 1.58 *************** *** 199,203 **** def makedirs(name, mode=0777): ! """makedirs(path [, mode=0777]) -> None Super-mkdir; create a leaf directory and all intermediate ones. --- 199,203 ---- def makedirs(name, mode=0777): ! """makedirs(path [, mode=0777]) Super-mkdir; create a leaf directory and all intermediate ones. *************** *** 215,219 **** def removedirs(name): ! """removedirs(path) -> None Super-rmdir; remove a leaf directory and empty all intermediate --- 215,219 ---- def removedirs(name): ! """removedirs(path) Super-rmdir; remove a leaf directory and empty all intermediate *************** *** 237,241 **** def renames(old, new): ! """renames(old, new) -> None Super-rename; create directories as necessary and delete any left --- 237,241 ---- def renames(old, new): ! """renames(old, new) Super-rename; create directories as necessary and delete any left From gward@users.sourceforge.net Tue Jul 2 22:48:14 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 02 Jul 2002 14:48:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6283/lib Modified Files: libtextwrap.tex Log Message: Don't list all the keyword args to the TextWrapper constructor in the classdesc -- just use "..." with prose explaining the correspondence between keyword args and instance attributes. Document 'width' along with the other instance attributes. Describe default values consistently. Typo fixes. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libtextwrap.tex 2 Jul 2002 20:37:12 -0000 1.2 --- libtextwrap.tex 2 Jul 2002 21:48:12 -0000 1.3 *************** *** 43,51 **** \class{TextWrapper} object. ! \begin{classdesc}{TextWrapper}{width, initial_indent, subsequent_indent, ! expand_tabs, replace_whitespace, ! fix_sentence_endings, break_long_words} ! Each keyword argument to the constructor corresponds to an instance ! attribute, so for example \begin{verbatim} wrapper = TextWrapper(initial_indent="* ") --- 43,50 ---- \class{TextWrapper} object. ! \begin{classdesc}{TextWrapper}{...} ! The \class{TextWrapper} constructor accepts a number of optional ! keyword arguments. Each argument corresponds to one instance attribute, ! so for example \begin{verbatim} wrapper = TextWrapper(initial_indent="* ") *************** *** 62,76 **** \end{classdesc} ! The effects of the instance attributes are as follows: \begin{memberdesc}{expand_tabs} ! If true (the default), then all tab characters in \var{text} will be ! expanded to spaces using the \method{expand_tabs()} method of \var{text}. \end{memberdesc} \begin{memberdesc}{replace_whitespace} ! If true (the default), each whitespace character (as defined by \var{string.whitespace}) remaining after tab expansion will be replaced by a single space. \note{If \var{expand_tabs} is false and --- 61,82 ---- \end{classdesc} + The \class{TextWrapper} instance attributes (and keyword arguments to + the constructor) are as follows: ! \begin{memberdesc}{width} ! (default: 70) The maximum length of wrapped lines. As long as there are ! no individual words in the input text longer than \var{width}, ! \class{TextWrapper} guarantees that no output line will be longer than ! \var{width} characters. ! \end{memberdesc} \begin{memberdesc}{expand_tabs} ! (default: \code{True}) If true, then all tab characters in \var{text} ! will be expanded to spaces using the \method{expand_tabs()} method of \var{text}. \end{memberdesc} \begin{memberdesc}{replace_whitespace} ! (default: \code{True}) If true, each whitespace character (as defined by \var{string.whitespace}) remaining after tab expansion will be replaced by a single space. \note{If \var{expand_tabs} is false and *************** *** 98,103 **** by one of \character{.}, \character{!}, or \character{?}, possibly followed by one of ! \character{"} or \character{'}. One problem with this is algoritm is ! that it is unable to detect the difference between ``Dr.'' in \begin{verbatim} [...] Dr. Frankenstein's monster [...] --- 104,110 ---- by one of \character{.}, \character{!}, or \character{?}, possibly followed by one of ! \character{"} or \character{'}, followed by a space. One problem ! with this is algorithm is that it is unable to detect the difference ! between ``Dr.'' in \begin{verbatim} [...] Dr. Frankenstein's monster [...] *************** *** 105,109 **** and ``Spot.'' in \begin{verbatim} ! [...] See Spot. See Spot run [...] \end{verbatim} Furthermore, since it relies on \var{string.lowercase} for the --- 112,116 ---- and ``Spot.'' in \begin{verbatim} ! [...] See Spot. See Spot run [...] \end{verbatim} Furthermore, since it relies on \var{string.lowercase} for the *************** *** 113,119 **** \begin{memberdesc}{break_long_words} ! If true (the default), then words longer than \var{width} will be broken ! in order to ensure that no lines are longer than \var{width}. If it is ! false, long words will not be broken, and some lines may be longer than \var{width}. (Long words will be put on a line by themselves, in order to minimize the amount by which \var{width} is exceeded.) --- 120,127 ---- \begin{memberdesc}{break_long_words} ! (default: \code{True}) If true, then words longer than ! \var{width} will be broken in order to ensure that no lines are longer ! than \var{width}. If it is false, long words will not be broken, and ! some lines may be longer than \var{width}. (Long words will be put on a line by themselves, in order to minimize the amount by which \var{width} is exceeded.) From tim_one@users.sourceforge.net Tue Jul 2 23:15:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 15:15:30 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv16319/python/Modules Modified Files: gcmodule.c Log Message: visit_decref(): Added another assert. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** gcmodule.c 2 Jul 2002 18:12:35 -0000 2.50 --- gcmodule.c 2 Jul 2002 22:15:28 -0000 2.51 *************** *** 225,228 **** --- 225,229 ---- * because only they have positive gc_refs. */ + assert(gc->gc.gc_refs != 0); /* else refcount was too small */ if (gc->gc.gc_refs > 0) gc->gc.gc_refs--; From tim_one@users.sourceforge.net Tue Jul 2 23:24:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 15:24:52 -0700 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.35,2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19094/python/Modules Modified Files: binascii.c Log Message: Another stab at SF 576327: zipfile when sizeof(long) == 8 binascii_crc32(): The previous patch forced this to return the same result across platforms. This patch deals with that, on a 64-bit box, the *entry* value may have "unexpected" bits in the high four bytes. Bugfix candidate. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** binascii.c 2 Jul 2002 20:20:08 -0000 2.35 --- binascii.c 2 Jul 2002 22:24:50 -0000 2.36 *************** *** 43,53 **** ** ** Jack Jansen, CWI, July 1995. ! ** ** Added support for quoted-printable encoding, based on rfc 1521 et al ! ** quoted-printable encoding specifies that non printable characters (anything ** below 32 and above 126) be encoded as =XX where XX is the hexadecimal value ** of the character. It also specifies some other behavior to enable 8bit data ! ** in a mail message with little difficulty (maximum line sizes, protecting ! ** some cases of whitespace, etc). ** ** Brandon Long, September 2001. --- 43,53 ---- ** ** Jack Jansen, CWI, July 1995. ! ** ** Added support for quoted-printable encoding, based on rfc 1521 et al ! ** quoted-printable encoding specifies that non printable characters (anything ** below 32 and above 126) be encoded as =XX where XX is the hexadecimal value ** of the character. It also specifies some other behavior to enable 8bit data ! ** in a mail message with little difficulty (maximum line sizes, protecting ! ** some cases of whitespace, etc). ** ** Brandon Long, September 2001. *************** *** 191,195 **** PyObject *rv; int ascii_len, bin_len; ! if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; --- 191,195 ---- PyObject *rv; int ascii_len, bin_len; ! if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; *************** *** 203,207 **** return NULL; bin_data = (unsigned char *)PyString_AsString(rv); ! for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { this_ch = *ascii_data; --- 203,207 ---- return NULL; bin_data = (unsigned char *)PyString_AsString(rv); ! for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { this_ch = *ascii_data; *************** *** 256,260 **** PyDoc_STRVAR(doc_b2a_uu, "(bin) -> ascii. Uuencode line of data"); ! static PyObject * binascii_b2a_uu(PyObject *self, PyObject *args) --- 256,260 ---- PyDoc_STRVAR(doc_b2a_uu, "(bin) -> ascii. Uuencode line of data"); ! static PyObject * binascii_b2a_uu(PyObject *self, PyObject *args) *************** *** 266,270 **** PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) ) return NULL; --- 266,270 ---- PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) ) return NULL; *************** *** 282,286 **** /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); ! for( ; bin_len > 0 || leftbits != 0 ; bin_len--, bin_data++ ) { /* Shift the data (or padding) into our buffer */ --- 282,286 ---- /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); ! for( ; bin_len > 0 || leftbits != 0 ; bin_len--, bin_data++ ) { /* Shift the data (or padding) into our buffer */ *************** *** 299,303 **** } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); --- 299,303 ---- } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); *************** *** 309,313 **** binascii_find_valid(unsigned char *s, int slen, int num) { ! /* Finds & returns the (num+1)th ** valid character for base64, or -1 if none. */ --- 309,313 ---- binascii_find_valid(unsigned char *s, int slen, int num) { ! /* Finds & returns the (num+1)th ** valid character for base64, or -1 if none. */ *************** *** 343,347 **** int ascii_len, bin_len; int quad_pos = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; --- 343,347 ---- int ascii_len, bin_len; int quad_pos = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; *************** *** 419,423 **** PyDoc_STRVAR(doc_b2a_base64, "(bin) -> ascii. Base64-code line of data"); ! static PyObject * binascii_b2a_base64(PyObject *self, PyObject *args) --- 419,423 ---- PyDoc_STRVAR(doc_b2a_base64, "(bin) -> ascii. Base64-code line of data"); ! static PyObject * binascii_b2a_base64(PyObject *self, PyObject *args) *************** *** 429,433 **** PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; --- 429,433 ---- PyObject *rv; int bin_len; ! if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; *************** *** 436,440 **** return NULL; } ! /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing --- 436,440 ---- return NULL; } ! /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing *************** *** 463,469 **** *ascii_data++ = table_b2a_base64[(leftchar&0xf) << 2]; *ascii_data++ = BASE64_PAD; ! } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); --- 463,469 ---- *ascii_data++ = table_b2a_base64[(leftchar&0xf) << 2]; *ascii_data++ = BASE64_PAD; ! } *ascii_data++ = '\n'; /* Append a courtesy newline */ ! _PyString_Resize(&rv, (ascii_data - (unsigned char *)PyString_AsString(rv))); *************** *** 483,487 **** int len; int done = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; --- 483,487 ---- int len; int done = 0; ! if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; *************** *** 517,521 **** } } ! if ( leftbits && !done ) { PyErr_SetString(Incomplete, --- 517,521 ---- } } ! if ( leftbits && !done ) { PyErr_SetString(Incomplete, *************** *** 544,548 **** unsigned char ch; int in, inend, len; ! if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; --- 544,548 ---- unsigned char ch; int in, inend, len; ! if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; *************** *** 552,556 **** return NULL; out_data = (unsigned char *)PyString_AsString(rv); ! for( in=0; in 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ --- 601,605 ---- return NULL; ascii_data = (unsigned char *)PyString_AsString(rv); ! for( ; len > 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ *************** *** 623,627 **** PyDoc_STRVAR(doc_rledecode_hqx, "Decode hexbin RLE-coded string"); ! static PyObject * binascii_rledecode_hqx(PyObject *self, PyObject *args) --- 623,627 ---- PyDoc_STRVAR(doc_rledecode_hqx, "Decode hexbin RLE-coded string"); ! static PyObject * binascii_rledecode_hqx(PyObject *self, PyObject *args) *************** *** 659,663 **** b = *in_data++; \ } while(0) ! #define OUTBYTE(b) \ do { \ --- 659,663 ---- b = *in_data++; \ } while(0) ! #define OUTBYTE(b) \ do { \ *************** *** 693,697 **** OUTBYTE(in_byte); } ! while( in_len > 0 ) { INBYTE(in_byte); --- 693,697 ---- OUTBYTE(in_byte); } ! while( in_len > 0 ) { INBYTE(in_byte); *************** *** 727,731 **** unsigned int crc; int len; ! if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; --- 727,731 ---- unsigned int crc; int len; ! if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; *************** *** 759,805 **** Copyright (C) 1986 Gary S. Brown. You may use this program, or code or tables extracted from it, as desired without restriction. - - First, the polynomial itself and its table of feedback terms. The - polynomial is - X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 - Note that we take it "backwards" and put the highest-order term in - the lowest-order bit. The X^32 term is "implied"; the LSB is the - X^31 term, etc. The X^0 term (usually shown as "+1") results in - the MSB being 1. ! Note that the usual hardware shift register implementation, which ! is what we're using (we're merely optimizing it by doing eight-bit ! chunks at a time) shifts bits into the lowest-order term. In our ! implementation, that means shifting towards the right. Why do we ! do it this way? Because the calculated CRC must be transmitted in ! order from highest-order term to lowest-order term. UARTs transmit ! characters in order from LSB to MSB. By storing the CRC this way, ! we hand it to the UART in the order low-byte to high-byte; the UART ! sends each low-bit to hight-bit; and the result is transmission bit ! by bit from highest- to lowest-order term without requiring any bit ! shuffling on our part. Reception works similarly. ! The feedback terms table consists of 256, 32-bit entries. Notes: ! ! 1. The table can be generated at runtime if desired; code to do so ! is shown later. It might not be obvious, but the feedback ! terms simply represent the results of eight shift/xor opera- ! tions for all combinations of data and CRC register values. ! ! 2. The CRC accumulation logic is the same for all CRC polynomials, ! be they sixteen or thirty-two bits wide. You simply choose the ! appropriate table. Alternatively, because the table can be ! generated at runtime, you can start by generating the table for ! the polynomial in question and use exactly the same "updcrc", ! if your application needn't simultaneously handle two CRC ! polynomials. (Note, however, that XMODEM is strange.) ! ! 3. For 16-bit CRCs, the table entries need be only 16 bits wide; ! of course, 32-bit entries work OK if the high 16 bits are zero. ! ! 4. The values must be right-shifted by eight bits by the "updcrc" ! logic; the shift must be unsigned (bring in zeroes). On some ! hardware you could probably optimize the shift in assembler by ! using byte-swap instructions. ********************************************************************/ --- 759,805 ---- Copyright (C) 1986 Gary S. Brown. You may use this program, or code or tables extracted from it, as desired without restriction. ! First, the polynomial itself and its table of feedback terms. The ! polynomial is ! X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 ! Note that we take it "backwards" and put the highest-order term in ! the lowest-order bit. The X^32 term is "implied"; the LSB is the ! X^31 term, etc. The X^0 term (usually shown as "+1") results in ! the MSB being 1. ! Note that the usual hardware shift register implementation, which ! is what we're using (we're merely optimizing it by doing eight-bit ! chunks at a time) shifts bits into the lowest-order term. In our ! implementation, that means shifting towards the right. Why do we ! do it this way? Because the calculated CRC must be transmitted in ! order from highest-order term to lowest-order term. UARTs transmit ! characters in order from LSB to MSB. By storing the CRC this way, ! we hand it to the UART in the order low-byte to high-byte; the UART ! sends each low-bit to hight-bit; and the result is transmission bit ! by bit from highest- to lowest-order term without requiring any bit ! shuffling on our part. Reception works similarly. ! ! The feedback terms table consists of 256, 32-bit entries. Notes: ! ! 1. The table can be generated at runtime if desired; code to do so ! is shown later. It might not be obvious, but the feedback ! terms simply represent the results of eight shift/xor opera- ! tions for all combinations of data and CRC register values. ! ! 2. The CRC accumulation logic is the same for all CRC polynomials, ! be they sixteen or thirty-two bits wide. You simply choose the ! appropriate table. Alternatively, because the table can be ! generated at runtime, you can start by generating the table for ! the polynomial in question and use exactly the same "updcrc", ! if your application needn't simultaneously handle two CRC ! polynomials. (Note, however, that XMODEM is strange.) ! ! 3. For 16-bit CRCs, the table entries need be only 16 bits wide; ! of course, 32-bit entries work OK if the high 16 bits are zero. ! ! 4. The values must be right-shifted by eight bits by the "updcrc" ! logic; the shift must be unsigned (bring in zeroes). On some ! hardware you could probably optimize the shift in assembler by ! using byte-swap instructions. ********************************************************************/ *************** *** 866,886 **** int len; long result; ! if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) return NULL; ! crc = crc ^ 0xFFFFFFFFUL; ! while(len--) crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ result = (long)(crc ^ 0xFFFFFFFFUL); ! /* If long is > 32 bits, extend the sign bit. This is one way to ! * ensure the result is the same across platforms. The other way ! * would be to return an unbounded long, but the evidence suggests ! * that lots of code outside this treats the result as if it were ! * a signed 4-byte integer. */ result |= -(result & (1L << 31)); return PyInt_FromLong(result); } --- 866,892 ---- int len; long result; ! if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) return NULL; ! crc = ~ crc; ! #if SIZEOF_LONG > 4 ! /* only want the trailing 32 bits */ ! crc &= 0xFFFFFFFFUL; ! #endif ! while (len--) crc = crc_32_tab[(crc ^ *bin_data++) & 0xffUL] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ result = (long)(crc ^ 0xFFFFFFFFUL); ! #if SIZEOF_LONG > 4 ! /* Extend the sign bit. This is one way to ensure the result is the ! * same across platforms. The other way would be to return an ! * unbounded unsigned long, but the evidence suggests that lots of ! * code outside this treats the result as if it were a signed 4-byte ! * integer. */ result |= -(result & (1L << 31)); + #endif return PyInt_FromLong(result); } *************** *** 930,934 **** static int ! to_int(int c) { if (isdigit(c)) --- 936,940 ---- static int ! to_int(int c) { if (isdigit(c)) *************** *** 1012,1016 **** PyDoc_STRVAR(doc_a2b_qp, "Decode a string of qp-encoded data"); ! static PyObject* binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) { --- 1018,1022 ---- PyDoc_STRVAR(doc_a2b_qp, "Decode a string of qp-encoded data"); ! static PyObject* binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) { *************** *** 1023,1027 **** int header = 0; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data, &datalen, &header)) return NULL; --- 1029,1033 ---- int header = 0; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", kwlist, &data, &datalen, &header)) return NULL; *************** *** 1041,1045 **** if (in >= datalen) break; /* Soft line breaks */ ! if ((data[in] == '\n') || (data[in] == '\r') || (data[in] == ' ') || (data[in] == '\t')) { if (data[in] != '\n') { --- 1047,1051 ---- if (in >= datalen) break; /* Soft line breaks */ ! if ((data[in] == '\n') || (data[in] == '\r') || (data[in] == ' ') || (data[in] == '\t')) { if (data[in] != '\n') { *************** *** 1053,1057 **** in++; } ! else if (((data[in] >= 'A' && data[in] <= 'F') || (data[in] >= 'a' && data[in] <= 'f') || (data[in] >= '0' && data[in] <= '9')) && --- 1059,1063 ---- in++; } ! else if (((data[in] >= 'A' && data[in] <= 'F') || (data[in] >= 'a' && data[in] <= 'f') || (data[in] >= '0' && data[in] <= '9')) && *************** *** 1088,1092 **** } ! static int to_hex (unsigned char ch, unsigned char *s) { --- 1094,1098 ---- } ! static int to_hex (unsigned char ch, unsigned char *s) { *************** *** 1110,1114 **** * (mostly) with the quopri module. It doesn't re-create the quopri * module bug where text ending in CRLF has the CR encoded */ ! static PyObject* binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs) { --- 1116,1120 ---- * (mostly) with the quopri module. It doesn't re-create the quopri * module bug where text ending in CRLF has the CR encoded */ ! static PyObject* binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs) { *************** *** 1126,1130 **** unsigned char *p; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|iii", kwlist, &data, &datalen, "etabs, &istext, &header)) return NULL; --- 1132,1136 ---- unsigned char *p; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|iii", kwlist, &data, &datalen, "etabs, &istext, &header)) return NULL; *************** *** 1141,1145 **** in = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || --- 1147,1151 ---- in = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || *************** *** 1147,1152 **** (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { --- 1153,1158 ---- (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { *************** *** 1163,1167 **** } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && --- 1169,1173 ---- } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && *************** *** 1182,1186 **** } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { --- 1188,1192 ---- } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { *************** *** 1207,1211 **** in = out = linelen = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || --- 1213,1217 ---- in = out = linelen = 0; while (in < datalen) { ! if ((data[in] > 126) || (data[in] == '=') || (header && data[in] == '_') || *************** *** 1213,1218 **** (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { --- 1219,1224 ---- (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || ! ((data[in] < 33) && ! (data[in] != '\r') && (data[in] != '\n') && (quotetabs && ((data[in] != '\t') || (data[in] != ' '))))) { *************** *** 1230,1234 **** } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && --- 1236,1240 ---- } else { ! if (istext && ((data[in] == '\n') || ((in+1 < datalen) && (data[in] == '\r') && *************** *** 1243,1247 **** out += 2; } ! if (crlf) odata[out++] = '\r'; odata[out++] = '\n'; --- 1249,1253 ---- out += 2; } ! if (crlf) odata[out++] = '\r'; odata[out++] = '\n'; *************** *** 1252,1256 **** } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { --- 1258,1262 ---- } else { ! if ((in + 1 != datalen) && (data[in+1] != '\n') && (linelen + 1) >= MAXLINESIZE) { *************** *** 1297,1303 **** {"crc_hqx", binascii_crc_hqx, METH_VARARGS, doc_crc_hqx}, {"crc32", binascii_crc32, METH_VARARGS, doc_crc32}, ! {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_VARARGS | METH_KEYWORDS, doc_a2b_qp}, ! {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS | METH_KEYWORDS, doc_b2a_qp}, {NULL, NULL} /* sentinel */ --- 1303,1309 ---- {"crc_hqx", binascii_crc_hqx, METH_VARARGS, doc_crc_hqx}, {"crc32", binascii_crc32, METH_VARARGS, doc_crc32}, ! {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_VARARGS | METH_KEYWORDS, doc_a2b_qp}, ! {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS | METH_KEYWORDS, doc_b2a_qp}, {NULL, NULL} /* sentinel */ From fdrake@users.sourceforge.net Tue Jul 2 23:34:47 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 15:34:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23159/lib Modified Files: libunittest.tex Log Message: Update the documentation of the errors and failures attributes of the TestResult object. Add an example of how to get even more information for apps that can use it. Closes SF bug #558278. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libunittest.tex 20 Oct 2001 04:24:09 -0000 1.7 --- libunittest.tex 2 Jul 2002 22:34:44 -0000 1.8 *************** *** 610,615 **** failures and errors that occurred among those test runs. The collections contain tuples of \code{(\var{testcase}, ! \var{exceptioninfo})}, where \var{exceptioninfo} is a tuple as ! returned by \function{sys.exc_info()}. \class{TestResult} instances have the following attributes that will --- 610,615 ---- failures and errors that occurred among those test runs. The collections contain tuples of \code{(\var{testcase}, ! \var{traceback})}, where \var{traceback} is a string containing a ! formatted version of the traceback for the exception. \class{TestResult} instances have the following attributes that will *************** *** 618,629 **** \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised an ! exception but did not signal a test failure. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which signalled a ! failure in the code under test. \end{memberdesc} --- 618,629 ---- \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the ! formatted tracebacks for tests which raised an exception but did not ! signal a test failure. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! formatted tracebacks for tests which signalled a failure in the code ! under test. \end{memberdesc} *************** *** 770,771 **** --- 770,813 ---- the \class{TestSuite} class. \end{memberdesc} + + + \subsection{Getting Extended Error Information + \label{unittest-error-info}} + + Some applications can make use of more error information (for example, + an integrated development environment, or IDE). Such an application + can retrieve supplemental information about errors and failures by + using an alternate \class{TestResult} implementation, and extending + the \method{defaultTestResult()} method of the \class{TestCase} class + to provide it. + + Here is a brief example of a \class{TestResult} subclass which stores + the actual exception and traceback objects. (Be aware that storing + traceback objects can cause a great deal of memory not to be reclaimed + when it otherwise would be, which can have effects that affect the + behavior of the tests.) + + \begin{verbatim} + import unittest + + class MyTestCase(unittest.TestCase): + def defaultTestResult(self): + return MyTestResult() + + class MyTestResult(unittest.TestResult): + def __init__(self): + self.errors_tb = [] + self.failures_tb = [] + + def addError(self, test, err): + self.errors_tb.append((test, err)) + unittest.TestResult.addError(self, test, err) + + def addFailure(self, test, err): + self.failures_tb.append((test, err)) + unittest.TestResult.addFailure(self, test, err) + \end{verbatim} + + Tests written using \class{MyTestCase} as the base class, instead of + \class{TestCase}, will allow tools to extract additional information + from the results object. From fdrake@users.sourceforge.net Tue Jul 2 23:35:04 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 15:35:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex,1.7,1.7.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23422/lib Modified Files: Tag: release22-maint libunittest.tex Log Message: Update the documentation of the errors and failures attributes of the TestResult object. Add an example of how to get even more information for apps that can use it. Closes SF bug #558278. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** libunittest.tex 20 Oct 2001 04:24:09 -0000 1.7 --- libunittest.tex 2 Jul 2002 22:35:02 -0000 1.7.8.1 *************** *** 610,615 **** failures and errors that occurred among those test runs. The collections contain tuples of \code{(\var{testcase}, ! \var{exceptioninfo})}, where \var{exceptioninfo} is a tuple as ! returned by \function{sys.exc_info()}. \class{TestResult} instances have the following attributes that will --- 610,615 ---- failures and errors that occurred among those test runs. The collections contain tuples of \code{(\var{testcase}, ! \var{traceback})}, where \var{traceback} is a string containing a ! formatted version of the traceback for the exception. \class{TestResult} instances have the following attributes that will *************** *** 618,629 **** \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which raised an ! exception but did not signal a test failure. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! \function{sys.exc_info()} results for tests which signalled a ! failure in the code under test. \end{memberdesc} --- 618,629 ---- \begin{memberdesc}[TestResult]{errors} A list containing pairs of \class{TestCase} instances and the ! formatted tracebacks for tests which raised an exception but did not ! signal a test failure. \end{memberdesc} \begin{memberdesc}[TestResult]{failures} A list containing pairs of \class{TestCase} instances and the ! formatted tracebacks for tests which signalled a failure in the code ! under test. \end{memberdesc} *************** *** 770,771 **** --- 770,813 ---- the \class{TestSuite} class. \end{memberdesc} + + + \subsection{Getting Extended Error Information + \label{unittest-error-info}} + + Some applications can make use of more error information (for example, + an integrated development environment, or IDE). Such an application + can retrieve supplemental information about errors and failures by + using an alternate \class{TestResult} implementation, and extending + the \method{defaultTestResult()} method of the \class{TestCase} class + to provide it. + + Here is a brief example of a \class{TestResult} subclass which stores + the actual exception and traceback objects. (Be aware that storing + traceback objects can cause a great deal of memory not to be reclaimed + when it otherwise would be, which can have effects that affect the + behavior of the tests.) + + \begin{verbatim} + import unittest + + class MyTestCase(unittest.TestCase): + def defaultTestResult(self): + return MyTestResult() + + class MyTestResult(unittest.TestResult): + def __init__(self): + self.errors_tb = [] + self.failures_tb = [] + + def addError(self, test, err): + self.errors_tb.append((test, err)) + unittest.TestResult.addError(self, test, err) + + def addFailure(self, test, err): + self.failures_tb.append((test, err)) + unittest.TestResult.addFailure(self, test, err) + \end{verbatim} + + Tests written using \class{MyTestCase} as the base class, instead of + \class{TestCase}, will allow tools to extract additional information + from the results object. From fdrake@users.sourceforge.net Tue Jul 2 23:46:44 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 15:46:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31295/lib Modified Files: libunittest.tex Log Message: Add annotations that describe the change in the "errors" and "failures" attributes of the TestResult. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libunittest.tex 2 Jul 2002 22:34:44 -0000 1.8 --- libunittest.tex 2 Jul 2002 22:46:42 -0000 1.9 *************** *** 620,623 **** --- 620,625 ---- formatted tracebacks for tests which raised an exception but did not signal a test failure. + \versionchanged[Contains formatted tracebacks instead of + \function{sys.exc_info()} results]{2.2} \end{memberdesc} *************** *** 626,629 **** --- 628,633 ---- formatted tracebacks for tests which signalled a failure in the code under test. + \versionchanged[Contains formatted tracebacks instead of + \function{sys.exc_info()} results]{2.2} \end{memberdesc} From fdrake@users.sourceforge.net Tue Jul 2 23:46:55 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 15:46:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex,1.7.8.1,1.7.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31407/lib Modified Files: Tag: release22-maint libunittest.tex Log Message: Add annotations that describe the change in the "errors" and "failures" attributes of the TestResult. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.7.8.1 retrieving revision 1.7.8.2 diff -C2 -d -r1.7.8.1 -r1.7.8.2 *** libunittest.tex 2 Jul 2002 22:35:02 -0000 1.7.8.1 --- libunittest.tex 2 Jul 2002 22:46:53 -0000 1.7.8.2 *************** *** 620,623 **** --- 620,625 ---- formatted tracebacks for tests which raised an exception but did not signal a test failure. + \versionchanged[Contains formatted tracebacks instead of + \function{sys.exc_info()} results]{2.2} \end{memberdesc} *************** *** 626,629 **** --- 628,633 ---- formatted tracebacks for tests which signalled a failure in the code under test. + \versionchanged[Contains formatted tracebacks instead of + \function{sys.exc_info()} results]{2.2} \end{memberdesc} From mhammond@users.sourceforge.net Wed Jul 3 03:40:27 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue, 02 Jul 2002 19:40:27 -0700 Subject: [Python-checkins] python/dist/src/Tools/freeze extensions_win32.ini,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory usw-pr-cvs1:/tmp/cvs-serv28170 Modified Files: extensions_win32.ini Log Message: Update freeze to use zlib 1.1.4. >From patch: [ 574532 ] Update freeze to use zlib 1.1.4 Index: extensions_win32.ini =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/extensions_win32.ini,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** extensions_win32.ini 28 Jun 2002 01:13:02 -0000 1.6 --- extensions_win32.ini 3 Jul 2002 02:40:25 -0000 1.7 *************** *** 50,55 **** [zlib] dsp=%PYTHONPREFIX%\PCBuild\zlib.dsp ! cl=/I %PYTHONPREFIX%\..\zlib-1.1.3 /D _WINDOWS /D WIN32 ! libs=%PYTHONPREFIX%\..\zlib-1.1.3\zlib.lib /nodefaultlib:libc [_winreg] --- 50,55 ---- [zlib] dsp=%PYTHONPREFIX%\PCBuild\zlib.dsp ! cl=/I %PYTHONPREFIX%\..\zlib-1.1.4 /D _WINDOWS /D WIN32 ! libs=%PYTHONPREFIX%\..\zlib-1.1.4\zlib.lib /nodefaultlib:libc [_winreg] From tim_one@users.sourceforge.net Wed Jul 3 04:31:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 20:31:22 -0700 Subject: [Python-checkins] python/dist/src/Include pyport.h,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv19023/python/Include Modified Files: pyport.h Log Message: Stop trying to cater to platforms with a broken HUGE_VAL definition. It breaks other platforms (in this case, the hack for broken Cray systems in turn caused failure on a Mac system broken in a different way). Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** pyport.h 4 Jun 2002 15:07:08 -0000 2.50 --- pyport.h 3 Jul 2002 03:31:20 -0000 2.51 *************** *** 230,246 **** #define Py_IS_INFINITY(X) ((X) && (X)*0.5 == (X)) ! /* According to ! * http://www.cray.com/swpubs/manuals/SN-2194_2.0/html-SN-2194_2.0/x3138.htm ! * on some Cray systems HUGE_VAL is incorrectly (according to the C std) ! * defined to be the largest positive finite rather than infinity. We need ! * the std-conforming infinity meaning (provided the platform has one!). ! * ! * Then, according to a bug report on SourceForge, defining Py_HUGE_VAL as ! * INFINITY caused internal compiler errors under BeOS using some version ! * of gcc. Explicitly casting INFINITY to double made that problem go away. */ ! #ifdef INFINITY ! #define Py_HUGE_VAL ((double)INFINITY) ! #else #define Py_HUGE_VAL HUGE_VAL #endif --- 230,241 ---- #define Py_IS_INFINITY(X) ((X) && (X)*0.5 == (X)) ! /* HUGE_VAL is supposed to expand to a positive double infinity. Python ! * uses Py_HUGE_VAL instead because some platforms are broken in this ! * respect. We used to embed code in pyport.h to try to worm around that, ! * but different platforms are broken in conflicting ways. If you're on ! * a platform where HUGE_VAL is defined incorrectly, fiddle your Python ! * config to #define Py_HUGE_VAL to something that works on your platform. */ ! #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif From tim_one@users.sourceforge.net Wed Jul 3 04:31:23 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 02 Jul 2002 20:31:23 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.435,1.436 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19023/python/Misc Modified Files: NEWS Log Message: Stop trying to cater to platforms with a broken HUGE_VAL definition. It breaks other platforms (in this case, the hack for broken Cray systems in turn caused failure on a Mac system broken in a different way). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.435 retrieving revision 1.436 diff -C2 -d -r1.435 -r1.436 *** NEWS 30 Jun 2002 15:05:00 -0000 1.435 --- NEWS 3 Jul 2002 03:31:20 -0000 1.436 *************** *** 290,293 **** --- 290,311 ---- Build + - Accoring to Annex F of the current C standard, + + The Standard C macro HUGE_VAL and its float and long double analogs, + HUGE_VALF and HUGE_VALL, expand to expressions whose values are + positive infinities. + + Python only uses the double HUGE_VAL, and only to #define its own symbol + Py_HUGE_VAL. Some platforms have incorrect definitions for HUGE_VAL. + pyport.h used to try to worm around that, but the workarounds triggered + other bugs on other platforms, so we gave up. If your platform defines + HUGE_VAL incorrectly, you'll need to #define Py_HUGE_VAL to something + that works on your platform. The only instance of this I'm sure about + is on an unknown subset of Cray systems, described here: + + http://www.cray.com/swpubs/manuals/SN-2194_2.0/html-SN-2194_2.0/x3138.htm + + Presumably 2.3a1 breaks such systems. If anyone uses such a system, help! + - The configure option --without-doc-strings can be used to remove the doc strings from the builtin functions and modules; this reduces the From bwarsaw@users.sourceforge.net Wed Jul 3 06:04:06 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 02 Jul 2002 22:04:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv29400 Modified Files: Header.py Log Message: append(): Clarify the expected type of charset. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Header.py 29 Jun 2002 03:26:58 -0000 1.6 --- Header.py 3 Jul 2002 05:04:04 -0000 1.7 *************** *** 152,156 **** """Append string s with Charset charset to the MIME header. ! charset defaults to the one given in the class constructor. """ if charset is None: --- 152,157 ---- """Append string s with Charset charset to the MIME header. ! charset defaults to the one given in the class constructor. If ! charset is given, it should be an instance of email.Charset.Charset. """ if charset is None: From fdrake@users.sourceforge.net Wed Jul 3 06:08:50 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 02 Jul 2002 22:08:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31856 Modified Files: libtextwrap.tex Log Message: Fix up a few more consistency nits and incorrectly applied markup. Further clarify the English-centricity of fix_sentence_endings. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libtextwrap.tex 2 Jul 2002 21:48:12 -0000 1.3 --- libtextwrap.tex 3 Jul 2002 05:08:48 -0000 1.4 *************** *** 65,72 **** \begin{memberdesc}{width} ! (default: 70) The maximum length of wrapped lines. As long as there are ! no individual words in the input text longer than \var{width}, ! \class{TextWrapper} guarantees that no output line will be longer than ! \var{width} characters. \end{memberdesc} --- 65,72 ---- \begin{memberdesc}{width} ! (default: \code{70}) The maximum length of wrapped lines. As long as ! there are no individual words in the input text longer than ! \member{width}, \class{TextWrapper} guarantees that no output line ! will be longer than \member{width} characters. \end{memberdesc} *************** *** 78,86 **** \begin{memberdesc}{replace_whitespace} ! (default: \code{True}) If true, each whitespace character (as defined by ! \var{string.whitespace}) remaining after tab expansion will be replaced ! by a single space. \note{If \var{expand_tabs} is false and ! \var{replace_whitespace} is true, each tab character will be replaced by ! a single space, which is \emph{not} the same as tab expansion.} \end{memberdesc} --- 78,87 ---- \begin{memberdesc}{replace_whitespace} ! (default: \code{True}) If true, each whitespace character (as defined ! by \code{string.whitespace}) remaining after tab expansion will be ! replaced by a single space. \note{If \member{expand_tabs} is false ! and \member{replace_whitespace} is true, each tab character will be ! replaced by a single space, which is \emph{not} the same as tab ! expansion.} \end{memberdesc} *************** *** 107,129 **** with this is algorithm is that it is unable to detect the difference between ``Dr.'' in \begin{verbatim} [...] Dr. Frankenstein's monster [...] \end{verbatim} and ``Spot.'' in \begin{verbatim} [...] See Spot. See Spot run [...] \end{verbatim} ! Furthermore, since it relies on \var{string.lowercase} for the ! definition of ``lowercase letter'', it is specific to English-language ! texts. Thus, \var{fix_sentence_endings} is false by default. \end{memberdesc} \begin{memberdesc}{break_long_words} (default: \code{True}) If true, then words longer than ! \var{width} will be broken in order to ensure that no lines are longer ! than \var{width}. If it is false, long words will not be broken, and ! some lines may be longer than ! \var{width}. (Long words will be put on a line by themselves, in order ! to minimize the amount by which \var{width} is exceeded.) \end{memberdesc} --- 108,137 ---- with this is algorithm is that it is unable to detect the difference between ``Dr.'' in + \begin{verbatim} [...] Dr. Frankenstein's monster [...] \end{verbatim} + and ``Spot.'' in + \begin{verbatim} [...] See Spot. See Spot run [...] \end{verbatim} ! ! \member{fix_sentence_endings} is false by default. ! ! Since the sentence detection algorithm relies on ! \code{string.lowercase} for the definition of ``lowercase letter,'' ! and a convention of using two spaces after a period to separate ! sentences on the same line, it is specific to English-language texts. \end{memberdesc} \begin{memberdesc}{break_long_words} (default: \code{True}) If true, then words longer than ! \member{width} will be broken in order to ensure that no lines are ! longer than \member{width}. If it is false, long words will not be ! broken, and some lines may be longer than \member{width}. (Long words ! will be put on a line by themselves, in order to minimize the amount ! by which \member{width} is exceeded.) \end{memberdesc} *************** *** 132,139 **** \begin{methoddesc}{wrap}{text} ! Wraps the single paragraph in \var{text} (a string) so every line is at ! most \var{width} characters long. All wrapping options are taken from ! instance attributes of the \class{TextWrapper} instance. Returns a list ! of output lines, without final newlines. \end{methoddesc} --- 140,147 ---- \begin{methoddesc}{wrap}{text} ! Wraps the single paragraph in \var{text} (a string) so every line is ! at most \member{width} characters long. All wrapping options are ! taken from instance attributes of the \class{TextWrapper} instance. ! Returns a list of output lines, without final newlines. \end{methoddesc} From fdrake@users.sourceforge.net Wed Jul 3 13:02:04 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 03 Jul 2002 05:02:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv18861 Modified Files: whatsnew23.tex Log Message: No need to be ambiguous about *how* extended slices and built-in types have changed. Uncomment a heading so that PendingDeprecationWarning doesn't seem so out of place. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** whatsnew23.tex 26 Jun 2002 13:28:19 -0000 1.30 --- whatsnew23.tex 3 Jul 2002 12:02:01 -0000 1.31 *************** *** 344,356 **** Ever since Python 1.4 the slice syntax has supported a third ! ``stride'' argument, but the builtin sequence types have not supported ! this feature (it was initially included at the behest of the ! developers of the Numerical Python package). This changes with Python ! 2.3. ! % XXX examples, etc. %====================================================================== ! %\section{Other Language Changes} %Here are the changes that Python 2.3 makes to the core language. --- 344,369 ---- Ever since Python 1.4 the slice syntax has supported a third ! ``stride'' argument, but the built-in sequence types have not ! supported this feature (it was initially included at the behest of the ! developers of the Numerical Python package). Starting with Python ! 2.3, the built-in sequence types do support the stride. ! For example, to extract the elements of a list with even indexes: ! ! \begin{verbatim} ! >>> L = range(10) ! >>> L[::2] ! [0, 2, 4, 6, 8] ! \end{verbatim} ! ! To make a copy of the same list in reverse order: ! ! \begin{verbatim} ! >>> L[::-1] ! [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] ! \end{verbatim} %====================================================================== ! \section{Other Language Changes} %Here are the changes that Python 2.3 makes to the core language. *************** *** 369,377 **** %\begin{PendingDeprecationWarning} ! A new warning PendingDeprecationWarning was added to provide ! direction on features which are in the process of being deprecated. ! The warning will not be printed by default. To see the pending ! deprecations, use -Walways::PendingDeprecationWarning:: on the command line ! or warnings.filterwarnings(). %\end{PendingDeprecationWarning} --- 382,391 ---- %\begin{PendingDeprecationWarning} ! A new warning, \exception{PendingDeprecationWarning} was added to ! provide direction on features which are in the process of being ! deprecated. The warning will not be printed by default. To see the ! pending deprecations, use ! \programopt{-Walways::PendingDeprecationWarning::} on the command line ! or use \function{warnings.filterwarnings()}. %\end{PendingDeprecationWarning} From holdenweb@users.sourceforge.net Wed Jul 3 19:36:40 2002 From: holdenweb@users.sourceforge.net (holdenweb@users.sourceforge.net) Date: Wed, 03 Jul 2002 11:36:40 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv19344 Modified Files: Makefile.deps Log Message: Revise asyncore documentation and document asynchat for the first time. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Makefile.deps 29 Jun 2002 02:38:50 -0000 1.86 --- Makefile.deps 3 Jul 2002 18:36:38 -0000 1.87 *************** *** 316,319 **** --- 316,320 ---- lib/libtty.tex \ lib/libasyncore.tex \ + lib/libasynchat.tex \ lib/libatexit.tex \ lib/libmmap.tex \ From holdenweb@users.sourceforge.net Wed Jul 3 19:36:41 2002 From: holdenweb@users.sourceforge.net (holdenweb@users.sourceforge.net) Date: Wed, 03 Jul 2002 11:36:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libasynchat.tex,NONE,1.1 lib.tex,1.201,1.202 libasyncore.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19344/lib Modified Files: lib.tex libasyncore.tex Added Files: libasynchat.tex Log Message: Revise asyncore documentation and document asynchat for the first time. --- NEW FILE: libasynchat.tex --- \section{\module{asynchat} --- Asynchronous socket command/response handler} \declaremodule{standard}{asynchat} \modulesynopsis{Support for asynchronous command/response protocols.} \moduleauthor{Sam Rushing}{rushing@nightmare.com} \sectionauthor{Steve Holden}{sholden@holdenweb.com} This module builds on the \refmodule{asyncore} infrastructure, simplifying asynchronous clients and servers and making it easier to handle protocols whose elements are terminated by arbitrary strings, or are of variable length. \refmodule{asynchat} defines the abstract class \class{async_chat} that you subclass, providing implementations of the \method{collect_incoming_data()} and \method{found_terminator()} methods. It uses the same asynchronous loop as \refmodule{asyncore}, and the two types of channel, \class{asyncore.despatcher} and \class{asynchat.async_chat}, can freely be mixed in the channel map. Typically an \class{asyncore.despatcher} server channel generates new \class{asynchat.async_chat} channel objects as it receives incoming connection requests. \begin{classdesc}{async_chat}{} This class is an abstract subclass of \class{asyncore.despatcher}. To make practical use of the code you must subclass \class{async_chat}, providing meaningful \method{collect_incoming_data()} and \method{found_terminator()} methods. The \class{asyncore.despatcher} methods can be used, although not all make sense in a message/response context. Like \class{asyncore.despatcher}, \class{async_chat} defines a set of events that are generated by an analysis of socket conditions after a \cfunction{select()} call. Once the polling loop has been started the \class{async_chat} object's methods are called by the event-processing framework with no action on the part of the programmer. Unlike \class{asyncore.despatcher}, \class{async_chat} allows you to define a first-in-first-out queue (fifo) of \emph{producers}. A producer need have only one method, \method{more()}, which should return data to be transmitted on the channel. The producer indicates exhaustion (\emph{i.e.} that it contains no more data) by having its \method{more()} method return the empty string. At this point the \class{async_chat} object removes the producer from the fifo and starts using the next producer, if any. When the producer fifo is empty the \method{handle_write()} method does nothing. You use the channel object's \method{set_terminator()} method to describe how to recognize the end of, or an important breakpoint in, an incoming transmission from the remote endpoint. To build a functioning \class{async_chat} subclass your input methods \method{collect_incoming_data()} and \method{found_terminator()} must handle the data that the channel receives asynchronously. The methods are described below. \end{classdesc} \begin{methoddesc}{close_when_done}{} Pushes a \code{None} on to the producer fifo. When this producer is popped off the fifo it causes the channel to be closed. \end{methoddesc} \begin{methoddesc}{collect_incoming_data}{data} Called with \var{data} holding an arbitrary amount of received data. The default method, which must be overridden, raises a \exception{NotImplementedError} exception. \end{methoddesc} \begin{methoddesc}{discard_buffers}{} In emergencies this method will discard any data held in the input and/or output buffers and the producer fifo. \end{methoddesc} \begin{methoddesc}{found_terminator}{} Called when the incoming data stream matches the termination condition set by \method{set_terminator}. The default method, which must be overridden, raises a \exception{NotImplementedError} exception. The buffered input data should be available via an instance attribute. \end{methoddesc} \begin{methoddesc}{get_terminator}{} Returns the current terminator for the channel. \end{methoddesc} \begin{methoddesc}{handle_close}{} Called when the channel is closed. The default method silently closes the channel's socket. \end{methoddesc} \begin{methoddesc}{handle_read}{} Called when a read event fires on the channel's socket in the asynchronous loop. The default method checks for the termination condition established by \method{set_terminator()}, which can be either the appearance of a particular string in the input stream or the receipt of a particular number of characters. When the terminator is found, \method{handle_read} calls the \method{found_terminator()} method after calling \method{collect_incoming_data()} with any data preceding the terminating condition. \end{methoddesc} \begin{methoddesc}{handle_write}{} Called when the application may write data to the channel. The default method calls the \method{initiate_send()} method, which in turn will call \method{refill_buffer()} to collect data from the producer fifo associated with the channel. \end{methoddesc} \begin{methoddesc}{push}{data} Creates a \class{simple_producer} object (\emph{see below}) containing the data and pushes it on to the channel's \code{producer_fifo} to ensure its transmission. This is all you need to do to have the channel write the data out to the network, although it is possible to use your own producers in more complex schemes to implement encryption and chunking, for example. \end{methoddesc} \begin{methoddesc}{push_with_producer}{producer} Takes a producer object and adds it to the producer fifo associated with the channel. When all currently-pushed producers have been exhausted the channel will consume this producer's data by calling its \method{more()} method and send the data to the remote endpoint. \end{methoddesc} \begin{methoddesc}{readable}{} Should return \code{True} for the channel to be included in the set of channels tested by the \cfunction{select()} loop for readability. \end{methoddesc} \begin{methoddesc}{refill_buffer}{} Refills the output buffer by calling the \method{more()} method of the producer at the head of the fifo. If it is exhausted then the producer is popped off the fifo and the next producer is activated. If the current producer is, or becomes, \code{None} then the channel is closed. \end{methoddesc} \begin{methoddesc}{set_terminator}{term} Sets the terminating condition to be recognised on the channel. \code{term} may be any of three types of value, corresponding to three different ways to handle incoming protocol data. \begin{tableii}{l|l}{}{term}{Description} \lineii{\emph{string}}{Will call \method{found_terminator()} when the string is found in the input stream} \lineii{\emph{integer}}{Will call \method{found_terminator()} when the indicated number of characters have been received} \lineii{\code{None}}{The channel continues to collect data forever} \end{tableii} Note that any data following the terminator will be available for reading by the channel after \method{found_terminator()} is called. \end{methoddesc} \begin{methoddesc}{writable}{} Should return \code{True} as long as items remain on the producer fifo, or the channel is connected and the channel's output buffer is non-empty. \end{methoddesc} \subsection{asynchat - Auxiliary Classes and Functions} \begin{classdesc}{simple_producer}{data\optional{, buffer_size=512}} A \class{simple_producer} takes a chunk of data and an optional buffer size. Repeated calls to its \method{more()} method yield successive chunks of the data no larger than \var{buffer_size}. \end{classdesc} \begin{methoddesc}{more}{} Produces the next chunk of information from the producer, or returns the empty string. \end{methoddesc} \begin{classdesc}{fifo}{\optional{list=None}} Each channel maintains a \class{fifo} holding data which has been pushed by the application but not yet popped for writing to the channel. A \class{fifo} is a list used to hold data and/or producers until they are required. If the \var{list} argument is provided then it should contain producers or data items to be written to the channel. \end{classdesc} \begin{methoddesc}{is_empty}{} Returns \code{True} iff the fifo is empty. \end{methoddesc} \begin{methoddesc}{first}{} Returns the least-recently \method{push()}ed item from the fifo. \end{methoddesc} \begin{methoddesc}{push}{data} Adds the given data (which may be a string or a producer object) to the producer fifo. \end{methoddesc} \begin{methoddesc}{pop}{} If the fifo is not empty, returns \code{True, first()}, deleting the popped item. Returns \code{False, None} for an empty fifo. \end{methoddesc} The \module{asynchat} module also defines one utility function, which may be of use in network and textual analysis operations. \begin{funcdesc}{find_prefix_at_end}{haystack, needle} Returns \code{True} if string \var{haystack} ends with any non-empty prefix of string \var{needle}. \end{funcdesc} \subsection{asynchat Example \label{asynchat-example}} The following partial example shows how HTTP requests can be read with \class{async_chat}. A web server might create an \class{http_request_handler} object for each incoming client connection. Notice that initially the channel terminator is set to match the blank line at the end of the HTTP headers, and a flag indicates that the headers are being read. Once the headers have been read, if the request is of type POST (indicating that further data are present in the input stream) then the \code{Content-Length:} header is used to set a numeric terminator to read the right amount of data from the channel. The \method{handle_request()} method is called once all relevant input has been marshalled, after setting the channel terminator to \code{None} to ensure that any extraneous data sent by the web client are ignored. \begin{verbatim} class http_request_handler(asynchat.async_chat): def __init__(self, conn, addr, sessions, log): asynchat.async_chat.__init__(self, conn=conn) self.addr = addr self.sessions = sessions self.ibuffer = [] self.obuffer = "" self.set_terminator("\r\n\r\n") self.reading_headers = True self.handling = False self.cgi_data = None self.log = log def collect_incoming_data(self, data): """Buffer the data""" self.ibuffer.append(data) def found_terminator(self): if self.reading_headers: self.reading_headers = False self.parse_headers("".join(self.ibuffer) self.ibuffer = [] if self.op.upper() == "POST": clen = self.headers.getheader("content-length") self.set_terminator(int(clen)) else: self.handling = True self.set_terminator(None) self.handle_request() elif not self.handling: self.set_terminator(None) # browsers sometimes over-send self.cgi_data = parse(self.headers, "".join(self.ibuffer)) self.handling = True self.ibuffer = [] self.handle_request() \end{verbatim} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.201 retrieving revision 1.202 diff -C2 -d -r1.201 -r1.202 *** lib.tex 29 Jun 2002 02:38:50 -0000 1.201 --- lib.tex 3 Jul 2002 18:36:38 -0000 1.202 *************** *** 218,221 **** --- 218,222 ---- \input{libsimplexmlrpc} \input{libasyncore} + \input{libasynchat} \input{netdata} % Internet Data Handling Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libasyncore.tex 5 Apr 2002 02:21:09 -0000 1.12 --- libasyncore.tex 3 Jul 2002 18:36:39 -0000 1.13 *************** *** 7,10 **** --- 7,11 ---- \moduleauthor{Sam Rushing}{rushing@nightmare.com} \sectionauthor{Christopher Petrilli}{petrilli@amber.org} + \sectionauthor{Steve Holden}{sholden@holdenweb.com} % Heavily adapted from original documentation by Sam Rushing. *************** *** 27,59 **** seem strange and complex, especially at first, it is in many ways easier to understand and control than multi-threaded programming. ! The module documented here solves many of the difficult problems for you, making the task of building sophisticated high-performance ! network servers and clients a snap. ! ! \begin{classdesc}{dispatcher}{} ! The first class we will introduce is the \class{dispatcher} class. ! This is a thin wrapper around a low-level socket object. To make ! it more useful, it has a few methods for event-handling on it. ! Otherwise, it can be treated as a normal non-blocking socket object. ! ! The direct interface between the select loop and the socket object ! are the \method{handle_read_event()} and ! \method{handle_write_event()} methods. These are called whenever an ! object `fires' that event. ! The firing of these low-level events can tell us whether certain ! higher-level events have taken place, depending on the timing and ! the state of the connection. For example, if we have asked for a ! socket to connect to another host, we know that the connection has ! been made when the socket fires a write event (at this point you ! know that you may write to it with the expectation of success). ! The implied higher-level events are: ! \begin{tableii}{l|l}{code}{Event}{Description} ! \lineii{handle_connect()}{Implied by a write event} ! \lineii{handle_close()}{Implied by a read event with no data available} ! \lineii{handle_accept()}{Implied by a read event on a listening socket} ! \end{tableii} ! \end{classdesc} \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, --- 28,46 ---- seem strange and complex, especially at first, it is in many ways easier to understand and control than multi-threaded programming. ! The \module{asyncore} module solves many of the difficult problems for you, making the task of building sophisticated high-performance ! network servers and clients a snap. For ``conversational'' applications ! and protocols the companion \refmodule{asynchat} module is invaluable. ! The basic idea behind both modules is to create one or more network ! \emph{channels}, instances of class \class{asyncore.dispatcher} and ! \class{asynchat.async_chat}. Creating the channels adds them to a global ! map, used by the \function{loop()} function if you do not provide it ! with your own \var{map}. ! Once the initial channel(s) is(are) created, calling the \function{loop()} ! function activates channel service, which continues until the last ! channel (including any that have been added to the map during asynchronous ! service) is closed. \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, *************** *** 65,83 **** the default is 30 seconds. The \var{use_poll} parameter, if true, indicates that \function{poll()} should be used in preference to ! \function{select()} (the default is false). The \var{map} parameter ! is a dictionary that gives a list of channels to watch. As channels are closed they are deleted from their map. If \var{map} is ! omitted, a global map is used. \end{funcdesc} ! This set of user-level events is larger than the basics. The ! full set of methods that can be overridden in your subclass are: \begin{methoddesc}{handle_read}{} ! Called when there is new data to be read from a socket. \end{methoddesc} \begin{methoddesc}{handle_write}{} ! Called when there is an attempt to write data to the object. Often this method will implement the necessary buffering for performance. For example: --- 52,116 ---- the default is 30 seconds. The \var{use_poll} parameter, if true, indicates that \function{poll()} should be used in preference to ! \function{select()} (the default is \code{False}). The \var{map} parameter ! is a dictionary whose items are the channels to watch. As channels are closed they are deleted from their map. If \var{map} is ! omitted, a global map is used (this map is updated by the default ! class \method{__init__()} ! -- make sure you extend, rather than override, \method{__init__()} ! if you want to retain this behavior). ! ! Channels (instances of \class{asyncore.despatcher}, \class{asynchat.async_chat} ! and subclasses thereof) can freely be mixed in the map. \end{funcdesc} ! \begin{classdesc}{dispatcher}{} ! The \class{dispatcher} class is a thin wrapper around a low-level socket object. ! To make it more useful, it has a few methods for event-handling which are called ! from the asynchronous loop. ! Otherwise, it can be treated as a normal non-blocking socket object. ! ! Two class attributes can be modified, to improve performance, ! or possibly even to conserve memory. ! ! \begin{datadesc}{ac_in_buffer_size} ! The asynchronous input buffer size (default \code{4096}). ! \end{datadesc} ! ! \begin{datadesc}{ac_out_buffer_size} ! The asynchronous output buffer size (default \code{4096}). ! \end{datadesc} ! ! The firing of low-level events at certain times or in certain connection ! states tells the asynchronous loop that certain higher-level events have ! taken place. For example, if we have asked for a socket to connect to ! another host, we know that the connection has been made when the socket ! becomes writable for the first time (at this point you know that you may ! write to it with the expectation of success). The implied higher-level ! events are: ! ! \begin{tableii}{l|l}{code}{Event}{Description} ! \lineii{handle_connect()}{Implied by the first write event} ! \lineii{handle_close()}{Implied by a read event with no data available} ! \lineii{handle_accept()}{Implied by a read event on a listening socket} ! \end{tableii} ! ! During asynchronous processing, each mapped channel's \method{readable()} ! and \method{writable()} methods are used to determine whether the channel's ! socket should be added to the list of channels \cfunction{select()}ed or ! \cfunction{poll()}ed for read and write events. ! ! \end{classdesc} ! ! Thus, the set of channel events is larger than the basic socket events. ! The full set of methods that can be overridden in your subclass follows: \begin{methoddesc}{handle_read}{} ! Called when the asynchronous loop detects that a \method{read()} ! call on the channel's socket will succeed. \end{methoddesc} \begin{methoddesc}{handle_write}{} ! Called when the asynchronous loop detects that a writable socket ! can be written. Often this method will implement the necessary buffering for performance. For example: *************** *** 97,103 **** \begin{methoddesc}{handle_connect}{} ! Called when the socket actually makes a connection. This ! might be used to send a ``welcome'' banner, or something ! similar. \end{methoddesc} --- 130,136 ---- \begin{methoddesc}{handle_connect}{} ! Called when the active opener's socket actually makes a connection. ! Might send a ``welcome'' banner, or initiate a protocol ! negotiation with the remote endpoint, for example. \end{methoddesc} *************** *** 112,137 **** \begin{methoddesc}{handle_accept}{} ! Called on listening sockets when they actually accept a new ! connection. \end{methoddesc} \begin{methoddesc}{readable}{} ! Each time through the \method{select()} loop, the set of sockets ! is scanned, and this method is called to see if there is any ! interest in reading. The default method simply returns \code{True}, ! indicating that by default, all channels will be interested. \end{methoddesc} \begin{methoddesc}{writable}{} ! Each time through the \method{select()} loop, the set of sockets ! is scanned, and this method is called to see if there is any ! interest in writing. The default method simply returns \code{True}, ! indicating that by default, all channels will be interested. \end{methoddesc} ! In addition, there are the basic methods needed to construct and ! manipulate ``channels,'' which are what we will call the socket ! connections in this context. Note that most of these are nearly ! identical to their socket partners. \begin{methoddesc}{create_socket}{family, type} --- 145,171 ---- \begin{methoddesc}{handle_accept}{} ! Called on listening channels (passive openers) when a ! connection can be established with a new remote endpoint that ! has issued a \method{connect()} call for the local endpoint. \end{methoddesc} \begin{methoddesc}{readable}{} ! Called each time around the asynchronous loop to determine whether a ! channel's socket should be added to the list on which read events can ! occur. The default method simply returns \code{True}, ! indicating that by default, all channels will be interested in ! read events. \end{methoddesc} \begin{methoddesc}{writable}{} ! Called each time around the asynchronous loop to determine whether a ! channel's socket should be added to the list on which write events can ! occur. The default method simply returns \code{True}, ! indicating that by default, all channels will be interested in ! write events. \end{methoddesc} ! In addition, each channel delegates or extends many of the socket methods. ! Most of these are nearly identical to their socket partners. \begin{methoddesc}{create_socket}{family, type} *************** *** 145,157 **** As with the normal socket object, \var{address} is a tuple with the first element the host to connect to, and the ! second the port. \end{methoddesc} \begin{methoddesc}{send}{data} ! Send \var{data} out the socket. \end{methoddesc} \begin{methoddesc}{recv}{buffer_size} ! Read at most \var{buffer_size} bytes from the socket. \end{methoddesc} --- 179,193 ---- As with the normal socket object, \var{address} is a tuple with the first element the host to connect to, and the ! second the port number. \end{methoddesc} \begin{methoddesc}{send}{data} ! Send \var{data} to the remote end-point of the socket. \end{methoddesc} \begin{methoddesc}{recv}{buffer_size} ! Read at most \var{buffer_size} bytes from the socket's remote end-point. ! An empty string implies that the channel has been closed from the other ! end. \end{methoddesc} *************** *** 180,184 **** \begin{methoddesc}{close}{} Close the socket. All future operations on the socket object ! will fail. The remote end will receive no more data (after queued data is flushed). Sockets are automatically closed when they are garbage-collected. --- 216,220 ---- \begin{methoddesc}{close}{} Close the socket. All future operations on the socket object ! will fail. The remote end-point will receive no more data (after queued data is flushed). Sockets are automatically closed when they are garbage-collected. *************** *** 186,190 **** ! \subsection{Example basic HTTP client \label{asyncore-example}} As a basic example, below is a very basic HTTP client that uses the --- 222,226 ---- ! \subsection{asyncore Example basic HTTP client \label{asyncore-example}} As a basic example, below is a very basic HTTP client that uses the From theller@users.sourceforge.net Thu Jul 4 09:36:56 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 04 Jul 2002 01:36:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext windows.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv8028 Modified Files: windows.tex Log Message: Fix a typo. Index: windows.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/windows.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** windows.tex 19 Apr 2002 04:04:57 -0000 1.6 --- windows.tex 4 Jul 2002 08:36:53 -0000 1.7 *************** *** 111,115 **** \item ! \strong{Cretating your own project}\\ Choose a name and create a directory for it. Copy your C sources into it. Note that the module source file name does not --- 111,115 ---- \item ! \strong{Creating your own project}\\ Choose a name and create a directory for it. Copy your C sources into it. Note that the module source file name does not From gward@users.sourceforge.net Thu Jul 4 15:51:52 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 04 Jul 2002 07:51:52 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28697 Modified Files: textwrap.py Log Message: Docstring improvements. In particular, added docstrings for the standalone wrap() and fill() functions. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** textwrap.py 10 Jun 2002 21:37:12 -0000 1.11 --- textwrap.py 4 Jul 2002 14:51:49 -0000 1.12 *************** *** 1,4 **** ! """ ! Utilities for wrapping text strings and filling text paragraphs. """ --- 1,3 ---- ! """Text wrapping and filling. """ *************** *** 232,240 **** """wrap(text : string) -> [string] ! Split 'text' into multiple lines of no more than 'self.width' ! characters each, and return the list of strings that results. ! Tabs in 'text' are expanded with string.expandtabs(), and all ! other whitespace characters (including newline) are converted to ! space. """ text = self._munge_whitespace(text) --- 231,239 ---- """wrap(text : string) -> [string] ! Reformat the single paragraph in 'text' so it fits in lines of ! no more than 'self.width' columns, and return a list of wrapped ! lines. Tabs in 'text' are expanded with string.expandtabs(), ! and all other whitespace characters (including newline) are ! converted to space. """ text = self._munge_whitespace(text) *************** *** 249,265 **** """fill(text : string) -> string ! Reformat the paragraph in 'text' to fit in lines of no more than ! 'width' columns. """ return "\n".join(self.wrap(text)) ! # Convenience interface def wrap(text, width=70, **kwargs): w = TextWrapper(width=width, **kwargs) return w.wrap(text) def fill(text, width=70, **kwargs): w = TextWrapper(width=width, **kwargs) return w.fill(text) --- 248,282 ---- """fill(text : string) -> string ! Reformat the single paragraph in 'text' to fit in lines of no ! more than 'self.width' columns, and return a new string ! containing the entire wrapped paragraph. """ return "\n".join(self.wrap(text)) ! # -- Convenience interface --------------------------------------------- def wrap(text, width=70, **kwargs): + """Wrap a single paragraph of text, returning a list of wrapped lines. + + Reformat the single paragraph in 'text' so it fits in lines of no + more than 'width' columns, and return a list of wrapped lines. By + default, tabs in 'text' are expanded with string.expandtabs(), and + all other whitespace characters (including newline) are converted to + space. See TextWrapper class for available keyword args to customize + wrapping behaviour. + """ w = TextWrapper(width=width, **kwargs) return w.wrap(text) def fill(text, width=70, **kwargs): + """Fill a single paragraph of text, returning a new string. + + Reformat the single paragraph in 'text' to fit in lines of no more + than 'width' columns, and return a new string containing the entire + wrapped paragraph. As with wrap(), tabs are expanded and other + whitespace characters converted to space. See TextWrapper class for + available keyword args to customize wrapping behaviour. + """ w = TextWrapper(width=width, **kwargs) return w.fill(text) From mwh@users.sourceforge.net Thu Jul 4 18:11:38 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 04 Jul 2002 10:11:38 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.51,2.52 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17659 Modified Files: gcmodule.c Log Message: gc_list_move defined but not used. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** gcmodule.c 2 Jul 2002 22:15:28 -0000 2.51 --- gcmodule.c 4 Jul 2002 17:11:36 -0000 2.52 *************** *** 156,174 **** } - static void - gc_list_move(PyGC_Head *from, PyGC_Head *to) - { - if (gc_list_is_empty(from)) { - gc_list_init(to); - } - else { - to->gc.gc_next = from->gc.gc_next; - to->gc.gc_next->gc.gc_prev = to; - to->gc.gc_prev = from->gc.gc_prev; - to->gc.gc_prev->gc.gc_next = to; - } - gc_list_init(from); - } - /* append a list onto another list, from becomes an empty list */ static void --- 156,159 ---- From jhylton@users.sourceforge.net Fri Jul 5 20:57:02 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 05 Jul 2002 12:57:02 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast astmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv29652 Modified Files: astmodule.c Log Message: experiment: add attribute to stmt type. also: call set_context recursively for list & tuple assignments. Lambda requires an arguments() arg. ad ast_for_sliceop() XXX. Index: astmodule.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/astmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** astmodule.c 30 May 2002 20:09:13 -0000 1.8 --- astmodule.c 5 Jul 2002 19:57:00 -0000 1.9 *************** *** 12,15 **** --- 12,19 ---- #include "graminit.h" + #ifndef LINENO + #define LINENO(n) ((n)->n_lineno) + #endif + #define NEW_IDENTIFIER(n) PyString_InternFromString(STR(n)) *************** *** 57,60 **** --- 61,65 ---- set_context(expr_ty e, expr_context_ty ctx) { + asdl_seq *s = NULL; switch (e->kind) { case Attribute_kind: *************** *** 69,80 **** --- 74,95 ---- case List_kind: e->v.List.ctx = ctx; + s = e->v.List.elts; break; case Tuple_kind: e->v.Tuple.ctx = ctx; + s = e->v.Tuple.elts; break; default: + /* This should trigger syntax error */ fprintf(stderr, "can't set context for %d\n", e->kind); return -1; } + if (s) { + int i; + for (i = 0; i < asdl_seq_LEN(s); i++) { + if (set_context(asdl_seq_get(s, i), ctx) < 0) + return -1; + } + } return 0; } *************** *** 174,177 **** --- 189,202 ---- } + static expr_ty + ast_for_sliceop(node *n) + { + REQ(n, sliceop); + if (NCH(n) == 1) + return NULL; + else + return ast_for_expr(CHILD(n, 1)); + } + static arguments_ty ast_for_arguments(node *n) *************** *** 254,258 **** REQ(n, funcdef); return FunctionDef(name, ast_for_arguments(CHILD(n, 2)), ! ast_for_suite(CHILD(n, 4))); } --- 279,283 ---- REQ(n, funcdef); return FunctionDef(name, ast_for_arguments(CHILD(n, 2)), ! ast_for_suite(CHILD(n, 4)), LINENO(n)); } *************** *** 262,266 **** /* lambdef: 'lambda' [varargslist] ':' test */ if (NCH(n) == 3) ! return Lambda(NULL, ast_for_expr(CHILD(n, 2))); else return Lambda(ast_for_arguments(CHILD(n, 1)), --- 287,292 ---- /* lambdef: 'lambda' [varargslist] ':' test */ if (NCH(n) == 3) ! return Lambda(arguments(NULL, NULL, NULL, NULL), ! ast_for_expr(CHILD(n, 2))); else return Lambda(ast_for_arguments(CHILD(n, 1)), *************** *** 392,395 **** --- 418,422 ---- return Num(PyString_FromString(STR(ch))); break; + } /* XXX other cases... */ case LPAR: /* tuple */ *************** *** 659,667 **** fprintf(stderr, "ast_for_expr_stmt(%d, %d)\n", TYPE(n), NCH(n)); if (NCH(n) == 1) { ! return Expr(ast_for_testlist(CHILD(n, 0))); } else if (TYPE(CHILD(n, 1)) == augassign) { return AugAssign(ast_for_testlist(CHILD(n, 0)), ast_for_augassign(CHILD(n, 1)), ! ast_for_testlist(CHILD(n, 2))); } else { int i; --- 686,695 ---- fprintf(stderr, "ast_for_expr_stmt(%d, %d)\n", TYPE(n), NCH(n)); if (NCH(n) == 1) { ! return Expr(ast_for_testlist(CHILD(n, 0)), LINENO(n)); } else if (TYPE(CHILD(n, 1)) == augassign) { return AugAssign(ast_for_testlist(CHILD(n, 0)), ast_for_augassign(CHILD(n, 1)), ! ast_for_testlist(CHILD(n, 2)), ! LINENO(n)); } else { int i; *************** *** 677,681 **** asdl_seq_append(targets, e); } ! return Assign(targets, ast_for_testlist(CHILD(n, NCH(n) - 1))); } return NULL; --- 705,710 ---- asdl_seq_append(targets, e); } ! return Assign(targets, ast_for_testlist(CHILD(n, NCH(n) - 1)), ! LINENO(n)); } return NULL; *************** *** 703,707 **** } nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true; ! return Print(dest, seq, nl); } --- 732,736 ---- } nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true; ! return Print(dest, seq, nl, LINENO(n)); } *************** *** 731,735 **** /* del_stmt: 'del' exprlist */ REQ(n, del_stmt); ! return Delete(ast_for_exprlist(CHILD(n, 1), Del)); } --- 760,764 ---- /* del_stmt: 'del' exprlist */ REQ(n, del_stmt); ! return Delete(ast_for_exprlist(CHILD(n, 1), Del), LINENO(n)); } *************** *** 752,778 **** switch (TYPE(ch)) { case break_stmt: ! return Break(); case continue_stmt: ! return Continue(); case yield_stmt: ! return Yield(ast_for_testlist(CHILD(ch, 1))); case return_stmt: if (NCH(ch) == 1) ! return Return(NULL); else ! return Return(ast_for_testlist(CHILD(ch, 1))); case raise_stmt: if (NCH(ch) == 1) ! return Raise(NULL, NULL, NULL); else if (NCH(ch) == 2) ! return Raise(ast_for_expr(CHILD(n, 1)), NULL, NULL); else if (NCH(ch) == 4) return Raise(ast_for_expr(CHILD(n, 1)), ast_for_expr(CHILD(n, 3)), ! NULL); else if (NCH(ch) == 6) return Raise(ast_for_expr(CHILD(n, 1)), ast_for_expr(CHILD(n, 3)), ! ast_for_expr(CHILD(n, 5))); default: fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); --- 781,807 ---- switch (TYPE(ch)) { case break_stmt: ! return Break(LINENO(n)); case continue_stmt: ! return Continue(LINENO(n)); case yield_stmt: ! return Yield(ast_for_testlist(CHILD(ch, 1)), LINENO(n)); case return_stmt: if (NCH(ch) == 1) ! return Return(NULL, LINENO(n)); else ! return Return(ast_for_testlist(CHILD(ch, 1)), LINENO(n)); case raise_stmt: if (NCH(ch) == 1) ! return Raise(NULL, NULL, NULL, LINENO(n)); else if (NCH(ch) == 2) ! 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: fprintf(stderr, "unexpected flow_stmt: %d\n", TYPE(ch)); *************** *** 862,866 **** for (i = 1; i < NCH(n); i += 2) asdl_seq_append(aliases, alias_for_import_name(CHILD(n, i))); ! return Import(aliases); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ alias_ty mod = alias_for_import_name(CHILD(n, 1)); --- 891,895 ---- for (i = 1; i < NCH(n); i += 2) asdl_seq_append(aliases, alias_for_import_name(CHILD(n, i))); ! return Import(aliases, LINENO(n)); } else if (STR(CHILD(n, 0))[0] == 'f') { /* from */ alias_ty mod = alias_for_import_name(CHILD(n, 1)); *************** *** 868,872 **** for (i = 3; i <= NCH(n); i += 2) asdl_seq_append(aliases, alias_for_import_name(CHILD(n, i))); ! return ImportFrom(mod->name, aliases); } return NULL; --- 897,901 ---- for (i = 3; i <= NCH(n); i += 2) asdl_seq_append(aliases, alias_for_import_name(CHILD(n, i))); ! return ImportFrom(mod->name, aliases, LINENO(n)); } return NULL; *************** *** 890,894 **** return NULL; } ! return Global(s); } --- 919,923 ---- return NULL; } ! return Global(s, LINENO(n)); } *************** *** 899,910 **** REQ(n, exec_stmt); if (NCH(n) == 2) ! return Exec(ast_for_expr(CHILD(n, 1)), NULL, NULL); else if (NCH(n) == 4) return Exec(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), NULL); else if (NCH(n) == 6) return Exec(ast_for_expr(CHILD(n, 1)), ast_for_expr(CHILD(n, 3)), ! ast_for_expr(CHILD(n, 5))); return NULL; } --- 928,939 ---- REQ(n, exec_stmt); if (NCH(n) == 2) ! 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)); return NULL; } *************** *** 916,923 **** REQ(n, assert_stmt); if (NCH(n) == 2) ! return Assert(ast_for_expr(CHILD(n, 1)), NULL); else if (NCH(n) == 4) return Assert(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3))); return NULL; } --- 945,952 ---- REQ(n, assert_stmt); if (NCH(n) == 2) ! return Assert(ast_for_expr(CHILD(n, 1)), NULL, LINENO(n)); else if (NCH(n) == 4) return Assert(ast_for_expr(CHILD(n, 1)), ! ast_for_expr(CHILD(n, 3)), LINENO(n)); return NULL; } *************** *** 965,969 **** if (NCH(n) == 4) return If(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), NULL); s = STR(CHILD(n, 4)); /* s[2], the third character in the string, will be --- 994,998 ---- if (NCH(n) == 4) return If(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), NULL, LINENO(n)); s = STR(CHILD(n, 4)); /* s[2], the third character in the string, will be *************** *** 974,978 **** return If(ast_for_expr(CHILD(n, 1)), ast_for_suite(CHILD(n, 3)), ! ast_for_suite(CHILD(n, 6))); else { int i, n_elif, has_else = 0; --- 1003,1007 ---- return If(ast_for_expr(CHILD(n, 1)), ast_for_suite(CHILD(n, 3)), ! ast_for_suite(CHILD(n, 6)), LINENO(n)); else { int i, n_elif, has_else = 0; *************** *** 991,995 **** If(ast_for_expr(CHILD(n, NCH(n) - 6)), ast_for_suite(CHILD(n, NCH(n) - 4)), ! ast_for_suite(CHILD(n, NCH(n) - 1)))); /* the just-created orelse handled the last elif */ n_elif--; --- 1020,1025 ---- 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 */ n_elif--; *************** *** 1003,1011 **** If(ast_for_expr(CHILD(n, off)), ast_for_suite(CHILD(n, off + 2)), ! orelse)); } return If(ast_for_expr(CHILD(n, 1)), ast_for_suite(CHILD(n, 3)), ! orelse); } --- 1033,1041 ---- If(ast_for_expr(CHILD(n, off)), ast_for_suite(CHILD(n, off + 2)), ! orelse, LINENO(n))); } return If(ast_for_expr(CHILD(n, 1)), ast_for_suite(CHILD(n, 3)), ! orelse, LINENO(n)); } *************** *** 1021,1029 **** if (NCH(n) == 4) return While(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), NULL); else return While(ast_for_expr(CHILD(n, 1)), ast_for_suite(CHILD(n, 3)), ! ast_for_suite(CHILD(n, 6))); return NULL; --- 1051,1059 ---- if (NCH(n) == 4) return While(ast_for_expr(CHILD(n, 1)), ! ast_for_suite(CHILD(n, 3)), NULL, LINENO(n)); else return While(ast_for_expr(CHILD(n, 1)), ast_for_suite(CHILD(n, 3)), ! ast_for_suite(CHILD(n, 6)), LINENO(n)); return NULL; *************** *** 1052,1056 **** ast_for_testlist(CHILD(n, 3)), ast_for_suite(CHILD(n, 5)), ! seq); return NULL; } --- 1082,1086 ---- ast_for_testlist(CHILD(n, 3)), ast_for_suite(CHILD(n, 5)), ! seq, LINENO(n)); return NULL; } *************** *** 1083,1087 **** /* try_stmt: 'try' ':' suite 'finally' ':' suite) */ return TryFinally(ast_for_suite(CHILD(n, 2)), ! ast_for_suite(CHILD(n, 5))); } else { /* try_stmt: ('try' ':' suite (except_clause ':' suite)+ --- 1113,1117 ---- /* try_stmt: 'try' ':' suite 'finally' ':' suite) */ return TryFinally(ast_for_suite(CHILD(n, 2)), ! ast_for_suite(CHILD(n, 5)), LINENO(n)); } else { /* try_stmt: ('try' ':' suite (except_clause ':' suite)+ *************** *** 1101,1105 **** CHILD(n, 5 + i * 3))); return TryExcept(ast_for_suite(CHILD(n, 2)), handlers, ! has_else ? ast_for_suite(CHILD(n, NCH(n) - 1)): NULL); } return NULL; --- 1131,1136 ---- CHILD(n, 5 + i * 3))); return TryExcept(ast_for_suite(CHILD(n, 2)), handlers, ! has_else ? ast_for_suite(CHILD(n, NCH(n) - 1)): NULL, ! LINENO(n)); } return NULL; *************** *** 1115,1119 **** if (NCH(n) == 4) return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, ! ast_for_suite(CHILD(n, 3))); /* else handle the base class list */ _bases = ast_for_testlist(CHILD(n, 3)); --- 1146,1150 ---- if (NCH(n) == 4) return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, ! ast_for_suite(CHILD(n, 3)), LINENO(n)); /* else handle the base class list */ _bases = ast_for_testlist(CHILD(n, 3)); *************** *** 1125,1129 **** } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, ! ast_for_suite(CHILD(n, 6))); return NULL; } --- 1156,1160 ---- } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, ! ast_for_suite(CHILD(n, 6)), LINENO(n)); return NULL; } *************** *** 1160,1164 **** return ast_for_del_stmt(n); case pass_stmt: ! return Pass(); case flow_stmt: return ast_for_flow_stmt(n); --- 1191,1195 ---- return ast_for_del_stmt(n); case pass_stmt: ! return Pass(LINENO(n)); case flow_stmt: return ast_for_flow_stmt(n); From jhylton@users.sourceforge.net Fri Jul 5 20:58:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 05 Jul 2002 12:58:11 -0700 Subject: [Python-checkins] python/nondist/sandbox/ast test.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/ast In directory usw-pr-cvs1:/tmp/cvs-serv30046 Modified Files: test.py Log Message: fiddle test script to print stmt that caused error. Index: test.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/ast/test.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test.py 30 May 2002 20:09:14 -0000 1.5 --- test.py 5 Jul 2002 19:58:09 -0000 1.6 *************** *** 1,5 **** import ast ! ast.transform("""# let's start with a whole bunch of argument lists ! def f(x): pass def f(x, y): pass def f(x, y,): pass --- 1,27 ---- import ast ! ! NEWLINE = "\n" ! ! def transform(s): ! try: ! ast.transform(s) ! except: ! print s ! raise ! ! def main(): ! multi = None ! for line in stmts.split(NEWLINE): ! if not line: ! if multi: ! multi.append('') ! transform(NEWLINE.join(multi)) ! multi = [] ! if multi is None: ! transform(line) ! else: ! multi.append(line) ! ! stmts = """def f(x): pass def f(x, y): pass def f(x, y,): pass *************** *** 54,60 **** --- 76,110 ---- import a.b from a.b import c + class C: pass + class C(A): pass + class C(A, B): pass + class C(A, B, (C,)): pass + d = {} + d = {1:2} + d = {1:2,} + d = {1:2, 3:4,} + [1,2,3,4] + [x for x in x if x if x for y in y if y] + [x for x in x] + obj.attr + l[...] + x[0] + x[:] + x[1:] + x[:1] + x[::] + x[1:1] + x[1::] + x[:1:] + x[::1] + x[1:1:] + x[1:1:1] + x[1:2,2:3] + # put all the multi-line stmts here + if a: print b a + if a: a *************** *** 62,69 **** --- 112,121 ---- print b c + if a: a elif b: b + if a == 1: a *************** *** 76,96 **** --- 128,154 ---- else: pass + while 1: 1 2 + while 1: pass + while 1 and 2: pass else: 1 + try: 1 finally: 2 + try: a + b except: pass + try: a + b *************** *** 99,102 **** --- 157,161 ---- except: pass + try: a + b *************** *** 105,108 **** --- 164,168 ---- except: pass + try: a + b *************** *** 111,137 **** except: pass ! class C: pass ! class C(A): pass ! class C(A, B): pass ! class C(A, B, (C,)): pass ! d = {} ! d = {1:2} ! d = {1:2,} ! d = {1:2, 3:4,} ! [1,2,3,4] ! [x for x in x if x if x for y in y if y] ! [x for x in x] ! obj.attr ! x[0] ! x[:] ! x[1:] ! x[:1] ! x[::] ! x[1:1] ! x[1::] ! x[:1:] ! x[::1] ! x[1:1:] ! x[1:1:1] ! x[1:2,2:3] ! """) --- 171,176 ---- except: pass ! """ ! ! if __name__ == "__main__": ! main() From jhylton@users.sourceforge.net Sat Jul 6 19:48:10 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sat, 06 Jul 2002 11:48:10 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2953 Modified Files: httplib.py Log Message: Handle HTTP/0.9 responses. Section 19.6 of RFC 2616 (HTTP/1.1): It is beyond the scope of a protocol specification to mandate compliance with previous versions. HTTP/1.1 was deliberately designed, however, to make supporting previous versions easy.... And we would expect HTTP/1.1 clients to: - recognize the format of the Status-Line for HTTP/1.0 and 1.1 responses; - understand any valid response in the format of HTTP/0.9, 1.0, or 1.1. The changes to the code do handle response in the format of HTTP/0.9. Some users may consider this a bug because all responses with a sufficiently corrupted status line will look like an HTTP/0.9 response. These users can pass strict=1 to the HTTP constructors to get a BadStatusLine exception instead. While this is a new feature of sorts, it enhances the robustness of the code (be tolerant in what you accept). Thus, I consider it a bug fix candidate. XXX strict needs to be documented. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** httplib.py 2 Jul 2002 20:19:08 -0000 1.54 --- httplib.py 6 Jul 2002 18:48:07 -0000 1.55 *************** *** 96,102 **** class HTTPResponse: ! def __init__(self, sock, debuglevel=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.msg = None --- 96,112 ---- class HTTPResponse: ! ! # strict: If true, raise BadStatusLine if the status line can't be ! # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prvents clients from talking to HTTP/0.9 ! # servers. Note that a response with a sufficiently corrupted ! # status line will look like an HTTP/0.9 response. ! ! # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. ! ! def __init__(self, sock, debuglevel=0, strict=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel + self.strict = strict self.msg = None *************** *** 113,116 **** --- 123,127 ---- def _read_status(self): + # Initialize with Simple-Response defaults line = self.fp.readline() if self.debuglevel > 0: *************** *** 123,132 **** reason = "" except ValueError: ! version = "HTTP/0.9" ! status = "200" ! reason = "" ! if version[:5] != 'HTTP/': ! self.close() ! raise BadStatusLine(line) # The status code is a three-digit number --- 134,148 ---- reason = "" except ValueError: ! # empty version will cause next test to fail and status ! # will be treated as 0.9 response. ! version = "" ! if not version.startswith('HTTP/'): ! if self.strict: ! self.close() ! raise BadStatusLine(line) ! else: ! # assume it's a Simple-Response from an 0.9 server ! self.fp = LineAndFileWrapper(line, self.fp) ! return "HTTP/0.9", 200, "" # The status code is a three-digit number *************** *** 170,173 **** --- 186,190 ---- if self.version == 9: self.chunked = 0 + self.will_close = 1 self.msg = mimetools.Message(StringIO()) return *************** *** 354,364 **** auto_open = 1 debuglevel = 0 ! def __init__(self, host, port=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) def _set_hostport(self, host, port): --- 371,384 ---- auto_open = 1 debuglevel = 0 + strict = 0 ! def __init__(self, host, port=None, strict=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) + if strict is not None: + self.strict = strict def _set_hostport(self, host, port): *************** *** 611,617 **** if self.debuglevel > 0: ! response = self.response_class(self.sock, self.debuglevel) else: ! response = self.response_class(self.sock) response._begin() --- 631,638 ---- if self.debuglevel > 0: ! response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict) else: ! response = self.response_class(self.sock, strict=self.strict) response._begin() *************** *** 734,739 **** default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None): ! HTTPConnection.__init__(self, host, port) self.key_file = key_file self.cert_file = cert_file --- 755,761 ---- default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None, ! strict=None): ! HTTPConnection.__init__(self, host, port, strict) self.key_file = key_file self.cert_file = cert_file *************** *** 761,765 **** _connection_class = HTTPConnection ! def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one." --- 783,787 ---- _connection_class = HTTPConnection ! def __init__(self, host='', port=None, strict=None): "Provide a default host, since the superclass requires one." *************** *** 771,775 **** # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port)) def _setup(self, conn): --- 793,797 ---- # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port, strict)) def _setup(self, conn): *************** *** 851,855 **** _connection_class = HTTPSConnection ! def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info --- 873,878 ---- _connection_class = HTTPSConnection ! def __init__(self, host='', port=None, key_file=None, cert_file=None, ! strict=None): # provide a default host, pass the X509 cert info *************** *** 857,866 **** if port == 0: port = None ! self._setup(self._connection_class(host, port, **x509)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. ! self.key_file = x509.get('key_file') ! self.cert_file = x509.get('cert_file') --- 880,890 ---- if port == 0: port = None ! self._setup(self._connection_class(host, port, key_file, ! cert_file, strict)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. ! self.key_file = key_file ! self.cert_file = cert_file *************** *** 907,910 **** --- 931,993 ---- error = HTTPException + class LineAndFileWrapper: + """A limited file-like object for HTTP/0.9 responses.""" + + # The status-line parsing code calls readline(), which normally + # get the HTTP status line. For a 0.9 response, however, this is + # actually the first line of the body! Clients need to get a + # readable file object that contains that line. + + def __init__(self, line, file): + self._line = line + self._file = file + self._line_consumed = 0 + self._line_offset = 0 + self._line_left = len(line) + + def __getattr__(self, attr): + return getattr(self._file, attr) + + def _done(self): + # called when the last byte is read from the line. After the + # call, all read methods are delegated to the underlying file + # obhect. + self._line_consumed = 1 + self.read = self._file.read + self.readline = self._file.readline + self.readlines = self._file.readlines + + def read(self, amt=None): + assert not self._line_consumed and self._line_left + if amt is None or amt > self._line_left: + s = self._line[self._line_offset:] + self._done() + if amt is None: + return s + self._file.read() + else: + return s + self._file.read(amt - len(s)) + else: + assert amt <= self._line_left + i = self._line_offset + j = i + amt + s = self._line[i:j] + self._line_offset = j + self._line_left -= amt + if self._line_left == 0: + self._done() + return s + + def readline(self): + s = self._line[self._line_offset:] + self._done() + return s + + def readlines(self, size=None): + L = [self._line[self._line_offset:]] + self._done() + if size is None: + return L + self._file.readlines() + else: + return L + self._file.readlines(size) # *************** *** 971,974 **** --- 1054,1087 ---- print "read", len(hs.getfile().read()) + + # Test a buggy server -- returns garbled status line. + # http://www.yahoo.com/promotions/mom_com97/supermom.html + c = HTTPConnection("promotions.yahoo.com") + c.set_debuglevel(1) + c.connect() + c.request("GET", "/promotions/mom_com97/supermom.html") + r = c.getresponse() + print r.status, r.version + lines = r.read().split("\n") + print "\n".join(lines[:5]) + + c = HTTPConnection("promotions.yahoo.com", strict=1) + c.set_debuglevel(1) + c.connect() + c.request("GET", "/promotions/mom_com97/supermom.html") + try: + r = c.getresponse() + except BadStatusLine, err: + print "strict mode failed as expected" + else: + print "XXX strict mode should have failed" + + for strict in 0, 1: + h = HTTP(strict=strict) + h.connect("promotions.yahoo.com") + h.putrequest('GET', "/promotions/mom_com97/supermom.html") + h.endheaders() + status, reason, headers = h.getreply() + assert (strict and status == -1) or status == 200, (strict, status) if __name__ == '__main__': From jhylton@users.sourceforge.net Sat Jul 6 19:55:04 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sat, 06 Jul 2002 11:55:04 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4115 Modified Files: httplib.py Log Message: Fix SF bug #575360 Subclasses of Exception that define an __init__ must call Exception.__init__ or define self.args. Otherwise, str() will fail. Bug fix candidate. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** httplib.py 6 Jul 2002 18:48:07 -0000 1.55 --- httplib.py 6 Jul 2002 18:55:01 -0000 1.56 *************** *** 890,893 **** --- 890,895 ---- class HTTPException(Exception): + # Subclasses that define an __init__ must call Exception.__init__ + # or define self.args. Otherwise, str() will fail. pass *************** *** 900,903 **** --- 902,906 ---- class UnknownProtocol(HTTPException): def __init__(self, version): + self.args = version, self.version = version *************** *** 910,913 **** --- 913,917 ---- class IncompleteRead(HTTPException): def __init__(self, partial): + self.args = partial, self.partial = partial *************** *** 926,929 **** --- 930,934 ---- class BadStatusLine(HTTPException): def __init__(self, line): + self.args = line, self.line = line *************** *** 1074,1077 **** --- 1079,1083 ---- except BadStatusLine, err: print "strict mode failed as expected" + print err else: print "XXX strict mode should have failed" From tim_one@users.sourceforge.net Sun Jul 7 04:59:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:36 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.436,1.437 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/Misc Modified Files: NEWS Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.436 retrieving revision 1.437 diff -C2 -d -r1.436 -r1.437 *** NEWS 3 Jul 2002 03:31:20 -0000 1.436 --- NEWS 7 Jul 2002 03:59:33 -0000 1.437 *************** *** 171,174 **** --- 171,179 ---- Library + - binascii.crc32() and the zipfile module had problems on some 64-bit + platforms. These have been fixed. On a platform with 8-byte C longs, + crc32() now returns a signed-extended 4-byte result, so that its value + as a Python int is equal to the value computed a 32-bit platform. + - xml.dom.minidom.toxml and toprettyxml now take an optional encoding argument. *************** *** 289,292 **** --- 294,306 ---- Build + + - Compiling out the cyclic garbage collector is no longer an option. + The old symbol WITH_CYCLE_GC is now ignored, and Python.h arranges + that it's always defined (for the benefit of any extension modules + that may be conditionalizing on it). A bonus is that any extension + type participating in cyclic gc can choose to participate in the + Py_TRASHCAN mechanism now too; in the absence of cyclic gc, this used + to require editing the core to teach the trashcan mechanism about the + new type. - Accoring to Annex F of the current C standard, From tim_one@users.sourceforge.net Sun Jul 7 04:59:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:36 -0700 Subject: [Python-checkins] python/dist/src/Modules config.c.in,1.75,1.76 gcmodule.c,2.52,2.53 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/Modules Modified Files: config.c.in gcmodule.c Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: config.c.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/config.c.in,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** config.c.in 30 Aug 2001 00:12:32 -0000 1.75 --- config.c.in 7 Jul 2002 03:59:34 -0000 1.76 *************** *** 41,48 **** {"exceptions", NULL}, - #ifdef WITH_CYCLE_GC /* This lives in gcmodule.c */ {"gc", initgc}, - #endif /* Sentinel */ --- 41,46 ---- Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** gcmodule.c 4 Jul 2002 17:11:36 -0000 2.52 --- gcmodule.c 7 Jul 2002 03:59:34 -0000 2.53 *************** *** 21,26 **** #include "Python.h" - #ifdef WITH_CYCLE_GC - /* Get an object's GC head */ #define AS_GC(o) ((PyGC_Head *)(o)-1) --- 21,24 ---- *************** *** 942,947 **** } - #endif /* WITH_CYCLE_GC */ - /* extension modules might be compiled with GC support so these functions must always be available */ --- 940,943 ---- *************** *** 968,975 **** PyObject_GC_UnTrack(void *op) { - #ifdef WITH_CYCLE_GC if (IS_TRACKED(op)) _PyObject_GC_UNTRACK(op); - #endif } --- 964,969 ---- *************** *** 985,989 **** { PyObject *op; - #ifdef WITH_CYCLE_GC PyGC_Head *g = PyObject_MALLOC(sizeof(PyGC_Head) + basicsize); if (g == NULL) --- 979,982 ---- *************** *** 1001,1010 **** } op = FROM_GC(g); - #else - op = PyObject_MALLOC(basicsize); - if (op == NULL) - return PyErr_NoMemory(); - - #endif return op; } --- 994,997 ---- *************** *** 1033,1037 **** { const size_t basicsize = _PyObject_VAR_SIZE(op->ob_type, nitems); - #ifdef WITH_CYCLE_GC PyGC_Head *g = AS_GC(op); g = PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize); --- 1020,1023 ---- *************** *** 1039,1047 **** return (PyVarObject *)PyErr_NoMemory(); op = (PyVarObject *) FROM_GC(g); - #else - op = PyObject_REALLOC(op, basicsize); - if (op == NULL) - return (PyVarObject *)PyErr_NoMemory(); - #endif op->ob_size = nitems; return op; --- 1025,1028 ---- *************** *** 1051,1055 **** PyObject_GC_Del(void *op) { - #ifdef WITH_CYCLE_GC PyGC_Head *g = AS_GC(op); if (IS_TRACKED(op)) --- 1032,1035 ---- *************** *** 1059,1065 **** } PyObject_FREE(g); - #else - PyObject_FREE(op); - #endif } --- 1039,1042 ---- From tim_one@users.sourceforge.net Sun Jul 7 04:59:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:36 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.158,2.159 object.c,2.179,2.180 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/Objects Modified Files: classobject.c object.c Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.158 retrieving revision 2.159 diff -C2 -d -r2.158 -r2.159 *** classobject.c 18 Jun 2002 12:38:06 -0000 2.158 --- classobject.c 7 Jul 2002 03:59:34 -0000 2.159 *************** *** 679,685 **** inst->ob_type->tp_frees--; #endif - #ifndef WITH_CYCLE_GC - inst->ob_type = NULL; - #endif #endif Py_DECREF(inst->in_class); --- 679,682 ---- Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.179 retrieving revision 2.180 diff -C2 -d -r2.179 -r2.180 *** object.c 13 Jun 2002 21:42:51 -0000 2.179 --- object.c 7 Jul 2002 03:59:34 -0000 2.180 *************** *** 2081,2107 **** _PyTrash_deposit_object(PyObject *op) { - #ifndef WITH_CYCLE_GC - int typecode; - - if (PyTuple_Check(op)) - typecode = Py_TRASHCAN_TUPLE; - else if (PyList_Check(op)) - typecode = Py_TRASHCAN_LIST; - else if (PyDict_Check(op)) - typecode = Py_TRASHCAN_DICT; - else if (PyFrame_Check(op)) - typecode = Py_TRASHCAN_FRAME; - else if (PyTraceBack_Check(op)) - typecode = Py_TRASHCAN_TRACEBACK; - else /* We have a bug here -- those are the only types in GC */ { - Py_FatalError("Type not supported in GC -- internal bug"); - return; /* pacify compiler -- execution never here */ - } - op->ob_refcnt = typecode; - op->ob_type = (PyTypeObject*)_PyTrash_delete_later; - #else assert (_Py_AS_GC(op)->gc.gc_next == NULL); _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; - #endif _PyTrash_delete_later = op; } --- 2081,2086 ---- *************** *** 2113,2140 **** PyObject *shredder = _PyTrash_delete_later; - #ifndef WITH_CYCLE_GC - _PyTrash_delete_later = (PyObject*) shredder->ob_type; - - switch (shredder->ob_refcnt) { - case Py_TRASHCAN_TUPLE: - shredder->ob_type = &PyTuple_Type; - break; - case Py_TRASHCAN_LIST: - shredder->ob_type = &PyList_Type; - break; - case Py_TRASHCAN_DICT: - shredder->ob_type = &PyDict_Type; - break; - case Py_TRASHCAN_FRAME: - shredder->ob_type = &PyFrame_Type; - break; - case Py_TRASHCAN_TRACEBACK: - shredder->ob_type = &PyTraceBack_Type; - break; - } - #else _PyTrash_delete_later = (PyObject*) _Py_AS_GC(shredder)->gc.gc_prev; - #endif _Py_NewReference(shredder); --- 2092,2097 ---- From tim_one@users.sourceforge.net Sun Jul 7 04:59:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:36 -0700 Subject: [Python-checkins] python/dist/src/PC config.c,1.34,1.35 pyconfig.h,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/PC Modified Files: config.c pyconfig.h Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/config.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** config.c 16 Jun 2002 01:34:49 -0000 1.34 --- config.c 7 Jul 2002 03:59:34 -0000 1.35 *************** *** 13,19 **** extern void initcmath(void); extern void initerrno(void); - #ifdef WITH_CYCLE_GC extern void initgc(void); - #endif #ifndef MS_WIN64 extern void initimageop(void); --- 13,17 ---- *************** *** 64,70 **** {"cmath", initcmath}, {"errno", initerrno}, - #ifdef WITH_CYCLE_GC {"gc", initgc}, - #endif #ifndef MS_WIN64 {"imageop", initimageop}, --- 62,66 ---- Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pyconfig.h 30 Jun 2002 15:26:10 -0000 1.11 --- pyconfig.h 7 Jul 2002 03:59:34 -0000 1.12 *************** *** 500,506 **** #endif - /* Define if you want cycle garbage collection */ - #define WITH_CYCLE_GC 1 - /* Use Python's own small-block memory-allocator. */ #define WITH_PYMALLOC 1 --- 500,503 ---- From tim_one@users.sourceforge.net Sun Jul 7 04:59:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:36 -0700 Subject: [Python-checkins] python/dist/src/RISCOS pyconfig.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/RISCOS Modified Files: pyconfig.h Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/pyconfig.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pyconfig.h 13 Jun 2002 21:09:11 -0000 1.4 --- pyconfig.h 7 Jul 2002 03:59:34 -0000 1.5 *************** *** 237,243 **** #undef WANT_WCTYPE_FUNCTIONS - /* Define if you want to compile in cycle garbage collection */ - #define WITH_CYCLE_GC 1 - /* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), --- 237,240 ---- From tim_one@users.sourceforge.net Sun Jul 7 04:59:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:36 -0700 Subject: [Python-checkins] python/dist/src/RISCOS/Modules config.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/RISCOS/Modules Modified Files: config.c Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/Modules/config.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config.c 24 Oct 2001 20:12:29 -0000 1.2 --- config.c 7 Jul 2002 03:59:34 -0000 1.3 *************** *** 66,73 **** {"exceptions", NULL}, - #ifdef WITH_CYCLE_GC /* This lives in gcmodule.c */ {"gc", initgc}, - #endif /* Sentinel */ --- 66,71 ---- From tim_one@users.sourceforge.net Sun Jul 7 04:59:35 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 20:59:35 -0700 Subject: [Python-checkins] python/dist/src/Include Python.h,2.52,2.53 object.h,2.101,2.102 objimpl.h,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv12674/python/Include Modified Files: Python.h object.h objimpl.h Log Message: Removed WITH_CYCLE_GC #ifdef-ery. Holes: + I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do. Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** Python.h 20 Jun 2002 22:23:15 -0000 2.52 --- Python.h 7 Jul 2002 03:59:33 -0000 2.53 *************** *** 24,27 **** --- 24,35 ---- #include "pyconfig.h" + /* Cyclic gc is always enabled, starting with release 2.3a1. Supply the + * old symbol for the benefit of extension modules written before then + * that may be conditionalizing on it. The core doesn't use it anymore. + */ + #ifndef WITH_CYCLE_GC + #define WITH_CYCLE_GC 1 + #endif + #ifdef HAVE_LIMITS_H #include Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.101 retrieving revision 2.102 diff -C2 -d -r2.101 -r2.102 *** object.h 12 Apr 2002 01:57:06 -0000 2.101 --- object.h 7 Jul 2002 03:59:33 -0000 2.102 *************** *** 442,450 **** /* Objects support garbage collection (see objimp.h) */ - #ifdef WITH_CYCLE_GC #define Py_TPFLAGS_HAVE_GC (1L<<14) - #else - #define Py_TPFLAGS_HAVE_GC 0 - #endif #define Py_TPFLAGS_DEFAULT ( \ --- 442,446 ---- Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** objimpl.h 2 Jul 2002 18:12:34 -0000 2.55 --- objimpl.h 7 Jul 2002 03:59:33 -0000 2.56 *************** *** 227,234 **** * Garbage Collection Support * ========================== - * - * Some of the functions and macros below are always defined; when - * WITH_CYCLE_GC is undefined, they simply don't do anything different - * than their non-GC counterparts. */ --- 227,230 ---- *************** *** 247,252 **** #define _PyObject_GC_Del PyObject_GC_Del - #ifdef WITH_CYCLE_GC - /* GC information is stored BEFORE the object structure. */ typedef union _gc_head { --- 243,246 ---- *************** *** 305,321 **** ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) - - #else /* !WITH_CYCLE_GC */ - - #define _PyObject_GC_Malloc PyObject_Malloc - #define PyObject_GC_New PyObject_New - #define PyObject_GC_NewVar PyObject_NewVar - #define PyObject_GC_Del PyObject_Del - #define _PyObject_GC_TRACK(op) - #define _PyObject_GC_UNTRACK(op) - #define PyObject_GC_Track(op) - #define PyObject_GC_UnTrack(op) - - #endif /* This is here for the sake of backwards compatibility. Extensions that --- 299,302 ---- From tim_one@users.sourceforge.net Sun Jul 7 06:13:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 22:13:58 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.53,2.54 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27054/python/Modules Modified Files: gcmodule.c Log Message: Trashcan cleanup: Now that cyclic gc is always there, the trashcan mechanism is no longer evil: it no longer plays dangerous games with the type pointer or refcounts, and objects in extension modules can play along too without needing to edit the core first. Rewrote all the comments to explain this, and (I hope) give clear guidance to extension authors who do want to play along. Documented all the functions. Added more asserts (it may no longer be evil, but it's still dangerous <0.9 wink>). Rearranged the generated code to make it clearer, and to tolerate either the presence or absence of a semicolon after the macros. Rewrote _PyTrash_destroy_chain() to call tp_dealloc directly; it was doing a Py_DECREF again, and that has all sorts of obscure distorting effects in non-release builds (Py_DECREF was already called on the object!). Removed Christian's little "embedded change log" comments -- that's what checkin messages are for, and since it was impossible to correlate the comments with the code that changed, I found them merely distracting. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** gcmodule.c 7 Jul 2002 03:59:34 -0000 2.53 --- gcmodule.c 7 Jul 2002 05:13:56 -0000 2.54 *************** *** 964,967 **** --- 964,970 ---- PyObject_GC_UnTrack(void *op) { + /* Obscure: the Py_TRASHCAN mechanism requires that we be able to + * call PyObject_GC_UnTrack twice on an object. + */ if (IS_TRACKED(op)) _PyObject_GC_UNTRACK(op); From tim_one@users.sourceforge.net Sun Jul 7 06:13:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 22:13:58 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.102,2.103 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27054/python/Include Modified Files: object.h Log Message: Trashcan cleanup: Now that cyclic gc is always there, the trashcan mechanism is no longer evil: it no longer plays dangerous games with the type pointer or refcounts, and objects in extension modules can play along too without needing to edit the core first. Rewrote all the comments to explain this, and (I hope) give clear guidance to extension authors who do want to play along. Documented all the functions. Added more asserts (it may no longer be evil, but it's still dangerous <0.9 wink>). Rearranged the generated code to make it clearer, and to tolerate either the presence or absence of a semicolon after the macros. Rewrote _PyTrash_destroy_chain() to call tp_dealloc directly; it was doing a Py_DECREF again, and that has all sorts of obscure distorting effects in non-release builds (Py_DECREF was already called on the object!). Removed Christian's little "embedded change log" comments -- that's what checkin messages are for, and since it was impossible to correlate the comments with the code that changed, I found them merely distracting. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.102 retrieving revision 2.103 diff -C2 -d -r2.102 -r2.103 *** object.h 7 Jul 2002 03:59:33 -0000 2.102 --- object.h 7 Jul 2002 05:13:56 -0000 2.103 *************** *** 77,81 **** PyObject_HEAD \ int ob_size; /* Number of items in variable part */ ! typedef struct _object { PyObject_HEAD --- 77,81 ---- PyObject_HEAD \ int ob_size; /* Number of items in variable part */ ! typedef struct _object { PyObject_HEAD *************** *** 198,202 **** getcharbufferproc bf_getcharbuffer; } PyBufferProcs; ! typedef void (*freefunc)(void *); --- 198,202 ---- getcharbufferproc bf_getcharbuffer; } PyBufferProcs; ! typedef void (*freefunc)(void *); *************** *** 223,229 **** char *tp_name; /* For printing, in format "." */ int tp_basicsize, tp_itemsize; /* For allocation */ ! /* Methods to implement standard operations */ ! destructor tp_dealloc; printfunc tp_print; --- 223,229 ---- char *tp_name; /* For printing, in format "." */ int tp_basicsize, tp_itemsize; /* For allocation */ ! /* Methods to implement standard operations */ ! destructor tp_dealloc; printfunc tp_print; *************** *** 232,238 **** cmpfunc tp_compare; reprfunc tp_repr; ! /* Method suites for standard classes */ ! PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; --- 232,238 ---- cmpfunc tp_compare; reprfunc tp_repr; ! /* Method suites for standard classes */ ! PyNumberMethods *tp_as_number; PySequenceMethods *tp_as_sequence; *************** *** 249,253 **** /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; ! /* Flags to define presence of optional/expanded features */ long tp_flags; --- 249,253 ---- /* Functions to access object as input/output buffer */ PyBufferProcs *tp_as_buffer; ! /* Flags to define presence of optional/expanded features */ long tp_flags; *************** *** 258,262 **** /* call function for all accessible objects */ traverseproc tp_traverse; ! /* delete references to contained objects */ inquiry tp_clear; --- 258,262 ---- /* call function for all accessible objects */ traverseproc tp_traverse; ! /* delete references to contained objects */ inquiry tp_clear; *************** *** 655,710 **** */ - /* - trashcan - CT 2k0130 - non-recursively destroy nested objects ! CT 2k0223 ! redefinition for better locality and less overhead. ! Objects that want to be recursion safe need to use ! the macro's ! Py_TRASHCAN_SAFE_BEGIN(name) ! and ! Py_TRASHCAN_SAFE_END(name) ! surrounding their actual deallocation code. ! It would be nice to do this using the thread state. ! Also, we could do an exact stack measure then. ! Unfortunately, deallocations also take place when ! the thread state is undefined. ! CT 2k0422 complete rewrite. ! There is no need to allocate new objects. ! Everything is done vialob_refcnt and ob_type now. ! Adding support for free-threading should be easy, too. ! */ ! #define PyTrash_UNWIND_LEVEL 50 ! #define Py_TRASHCAN_SAFE_BEGIN(op) \ ! { \ ! ++_PyTrash_delete_nesting; \ ! if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ ! #define Py_TRASHCAN_SAFE_END(op) \ ! ;} \ ! else \ ! _PyTrash_deposit_object((PyObject*)op);\ ! --_PyTrash_delete_nesting; \ ! if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \ ! _PyTrash_destroy_chain(); \ ! } \ extern DL_IMPORT(void) _PyTrash_deposit_object(PyObject*); extern DL_IMPORT(void) _PyTrash_destroy_chain(void); - extern DL_IMPORT(int) _PyTrash_delete_nesting; extern DL_IMPORT(PyObject *) _PyTrash_delete_later; ! /* swap the "xx" to check the speed loss */ ! #define xxPy_TRASHCAN_SAFE_BEGIN(op) ! #define xxPy_TRASHCAN_SAFE_END(op) ; #ifdef __cplusplus --- 655,713 ---- */ ! /* Trashcan mechanism, thanks to Christian Tismer. ! When deallocating a container object, it's possible to trigger an unbounded ! chain of deallocations, as each Py_DECREF in turn drops the refcount on "the ! next" object in the chain to 0. This can easily lead to stack faults, and ! especially in threads (which typically have less stack space to work with). ! A container object that participates in cyclic gc can avoid this by ! bracketing the body of its tp_dealloc function with a pair of macros: ! static void ! mytype_dealloc(mytype *p) ! { ! ... declarations go here ... ! PyObject_GC_UnTrack(p); // must untrack first ! Py_TRASHCAN_SAFE_BEGIN(p) ! ... The body of the deallocator goes here, including all calls ... ! ... to Py_DECREF on contained objects. ... ! Py_TRASHCAN_SAFE_END(p) ! } ! How it works: The BEGIN macro increments a call-depth counter. So long ! as this counter is small, the body of the deallocator is run directly without ! further ado. But if the counter gets large, it instead adds p to a list of ! objects to be deallocated later, skips the body of the deallocator, and ! resumes execution after the END macro. The tp_dealloc routine then returns ! without deallocating anything (and so unbounded call-stack depth is avoided). ! When the call stack finishes unwinding again, code generated by the END macro ! notices this, and calls another routine to deallocate all the objects that ! may have been added to the list of deferred deallocations. In effect, a ! chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, ! with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. ! */ extern DL_IMPORT(void) _PyTrash_deposit_object(PyObject*); extern DL_IMPORT(void) _PyTrash_destroy_chain(void); extern DL_IMPORT(int) _PyTrash_delete_nesting; extern DL_IMPORT(PyObject *) _PyTrash_delete_later; ! #define PyTrash_UNWIND_LEVEL 50 ! #define Py_TRASHCAN_SAFE_BEGIN(op) \ ! if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ ! ++_PyTrash_delete_nesting; ! /* The body of the deallocator is here. */ ! #define Py_TRASHCAN_SAFE_END(op) \ ! --_PyTrash_delete_nesting; \ ! if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \ ! _PyTrash_destroy_chain(); \ ! } \ ! else \ ! _PyTrash_deposit_object((PyObject*)op); #ifdef __cplusplus From tim_one@users.sourceforge.net Sun Jul 7 06:13:59 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 06 Jul 2002 22:13:59 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.180,2.181 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27054/python/Objects Modified Files: object.c Log Message: Trashcan cleanup: Now that cyclic gc is always there, the trashcan mechanism is no longer evil: it no longer plays dangerous games with the type pointer or refcounts, and objects in extension modules can play along too without needing to edit the core first. Rewrote all the comments to explain this, and (I hope) give clear guidance to extension authors who do want to play along. Documented all the functions. Added more asserts (it may no longer be evil, but it's still dangerous <0.9 wink>). Rearranged the generated code to make it clearer, and to tolerate either the presence or absence of a semicolon after the macros. Rewrote _PyTrash_destroy_chain() to call tp_dealloc directly; it was doing a Py_DECREF again, and that has all sorts of obscure distorting effects in non-release builds (Py_DECREF was already called on the object!). Removed Christian's little "embedded change log" comments -- that's what checkin messages are for, and since it was impossible to correlate the comments with the code that changed, I found them merely distracting. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.180 retrieving revision 2.181 diff -C2 -d -r2.180 -r2.181 *** object.c 7 Jul 2002 03:59:34 -0000 2.180 --- object.c 7 Jul 2002 05:13:56 -0000 2.181 *************** *** 193,197 **** /* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */ ! void _PyObject_Dump(PyObject* op) { if (op == NULL) --- 193,197 ---- /* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */ ! void _PyObject_Dump(PyObject* op) { if (op == NULL) *************** *** 257,261 **** { PyObject *res; ! if (v == NULL) return PyString_FromString(""); --- 257,261 ---- { PyObject *res; ! if (v == NULL) return PyString_FromString(""); *************** *** 296,300 **** { PyObject *res; ! if (v == NULL) res = PyString_FromString(""); --- 296,300 ---- { PyObject *res; ! if (v == NULL) res = PyString_FromString(""); *************** *** 700,706 **** PyErr_BadInternalCall(); return NULL; ! } ! inprogress = PyDict_GetItem(tstate_dict, key); if (inprogress == NULL) { inprogress = PyDict_New(); --- 700,706 ---- PyErr_BadInternalCall(); return NULL; ! } ! inprogress = PyDict_GetItem(tstate_dict, key); if (inprogress == NULL) { inprogress = PyDict_New(); *************** *** 849,853 **** return result; } ! /* We want a rich comparison but don't have one. Try a 3-way cmp instead. Return --- 849,853 ---- return result; } ! /* We want a rich comparison but don't have one. Try a 3-way cmp instead. Return *************** *** 1064,1068 **** PyObject* longobj; long x; ! if ((longobj = PyLong_FromVoidPtr(p)) == NULL) { x = -1; --- 1064,1068 ---- PyObject* longobj; long x; ! if ((longobj = PyLong_FromVoidPtr(p)) == NULL) { x = -1; *************** *** 1070,1074 **** } x = PyObject_Hash(longobj); ! finally: Py_XDECREF(longobj); --- 1070,1074 ---- } x = PyObject_Hash(longobj); ! finally: Py_XDECREF(longobj); *************** *** 1196,1200 **** return -1; } ! else #endif { --- 1196,1200 ---- return -1; } ! else #endif { *************** *** 1286,1290 **** return NULL; } ! else #endif { --- 1286,1290 ---- return NULL; } ! else #endif { *************** *** 1362,1366 **** return -1; } ! else #endif { --- 1362,1366 ---- return -1; } ! else #endif { *************** *** 1451,1455 **** } ! /* equivalent of 'not v' Return -1 if an error occurred */ --- 1451,1455 ---- } ! /* equivalent of 'not v' Return -1 if an error occurred */ *************** *** 1759,1763 **** /* ARGUSED */ static void ! none_dealloc(PyObject* ignore) { /* This should never get called, but we also don't want to SEGV if --- 1759,1763 ---- /* ARGUSED */ static void ! none_dealloc(PyObject* ignore) { /* This should never get called, but we also don't want to SEGV if *************** *** 2043,2102 **** } ! /* ! trashcan ! CT 2k0130 ! non-recursively destroy nested objects ! ! CT 2k0223 ! everything is now done in a macro. ! ! CT 2k0305 ! modified to use functions, after Tim Peter's suggestion. ! ! CT 2k0309 ! modified to restore a possible error. ! ! CT 2k0325 ! added better safe than sorry check for threadstate ! ! CT 2k0422 ! complete rewrite. We now build a chain via ob_type ! and save the limited number of types in ob_refcnt. ! This is perfect since we don't need any memory. ! A patch for free-threading would need just a lock. ! */ ! ! #define Py_TRASHCAN_TUPLE 1 ! #define Py_TRASHCAN_LIST 2 ! #define Py_TRASHCAN_DICT 3 ! #define Py_TRASHCAN_FRAME 4 ! #define Py_TRASHCAN_TRACEBACK 5 ! /* extend here if other objects want protection */ int _PyTrash_delete_nesting = 0; ! PyObject * _PyTrash_delete_later = NULL; void _PyTrash_deposit_object(PyObject *op) { ! assert (_Py_AS_GC(op)->gc.gc_next == NULL); _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; _PyTrash_delete_later = op; } void _PyTrash_destroy_chain(void) { while (_PyTrash_delete_later) { ! PyObject *shredder = _PyTrash_delete_later; _PyTrash_delete_later = ! (PyObject*) _Py_AS_GC(shredder)->gc.gc_prev; ! ! _Py_NewReference(shredder); ++_PyTrash_delete_nesting; ! Py_DECREF(shredder); --_PyTrash_delete_nesting; } --- 2043,2092 ---- } ! /* Trashcan support. */ + /* Current call-stack depth of tp_dealloc calls. */ int _PyTrash_delete_nesting = 0; ! /* List of objects that still need to be cleaned up, singly linked via their ! * gc headers' gc_prev pointers. ! */ ! PyObject *_PyTrash_delete_later = NULL; + /* Add op to the _PyTrash_delete_later list. Called when the current + * call-stack depth gets large. op must be a currently untracked gc'ed + * object, with refcount 0. Py_DECREF must already have been called on it. + */ void _PyTrash_deposit_object(PyObject *op) { ! assert(PyObject_IS_GC(op)); ! assert(_Py_AS_GC(op)->gc.gc_refs == _PyGC_REFS_UNTRACKED); ! assert(op->ob_refcnt == 0); _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; _PyTrash_delete_later = op; } + /* Dealloccate all the objects in the _PyTrash_delete_later list. Called when + * the call-stack unwinds again. + */ void _PyTrash_destroy_chain(void) { while (_PyTrash_delete_later) { ! PyObject *op = _PyTrash_delete_later; ! destructor dealloc = op->ob_type->tp_dealloc; _PyTrash_delete_later = ! (PyObject*) _Py_AS_GC(op)->gc.gc_prev; + /* Call the deallocator directly. This used to try to + * fool Py_DECREF into calling it indirectly, but + * Py_DECREF was already called on this object, and in + * assorted non-release builds calling Py_DECREF again ends + * up distorting allocation statistics. + */ + assert(op->ob_refcnt == 0); ++_PyTrash_delete_nesting; ! (*dealloc)(op); --_PyTrash_delete_nesting; } From jhylton@users.sourceforge.net Sun Jul 7 17:51:39 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 09:51:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14230/test Modified Files: test_httplib.py Log Message: Fix for SF bug #432621: httplib: multiple Set-Cookie headers If multiple header fields with the same name occur, they are combined according to the rules in RFC 2616 sec 4.2: Appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is significant to the interpretation of the combined field value. Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_httplib.py 28 Jun 2002 23:54:30 -0000 1.5 --- test_httplib.py 7 Jul 2002 16:51:37 -0000 1.6 *************** *** 16,20 **** body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock,1) resp._begin() print resp.read() --- 16,20 ---- body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock, 1) resp._begin() print resp.read() *************** *** 23,27 **** body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock,1) try: resp._begin() --- 23,27 ---- body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock, 1) try: resp._begin() *************** *** 40,41 **** --- 40,59 ---- else: print "Expect InvalidURL" + + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s, 1) + r._begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + raise AssertionError, "multiple headers not combined properly" + From jhylton@users.sourceforge.net Sun Jul 7 17:51:40 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 09:51:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_httplib,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv14230/test/output Modified Files: test_httplib Log Message: Fix for SF bug #432621: httplib: multiple Set-Cookie headers If multiple header fields with the same name occur, they are combined according to the rules in RFC 2616 sec 4.2: Appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is significant to the interpretation of the combined field value. Index: test_httplib =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_httplib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_httplib 24 Mar 2002 16:54:38 -0000 1.2 --- test_httplib 7 Jul 2002 16:51:37 -0000 1.3 *************** *** 6,7 **** --- 6,10 ---- InvalidURL raised as expected InvalidURL raised as expected + reply: 'HTTP/1.1 200 OK\r\n' + header: Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme" + header: Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme" From jhylton@users.sourceforge.net Sun Jul 7 17:51:39 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 09:51:39 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14230 Modified Files: httplib.py Log Message: Fix for SF bug #432621: httplib: multiple Set-Cookie headers If multiple header fields with the same name occur, they are combined according to the rules in RFC 2616 sec 4.2: Appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is significant to the interpretation of the combined field value. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** httplib.py 6 Jul 2002 18:55:01 -0000 1.56 --- httplib.py 7 Jul 2002 16:51:37 -0000 1.57 *************** *** 94,97 **** --- 94,203 ---- _CS_REQ_SENT = 'Request-sent' + class HTTPMessage(mimetools.Message): + + def addheader(self, key, value): + """Add header for field key handling repeats.""" + prev = self.dict.get(key) + if prev is None: + self.dict[key] = value + else: + combined = ", ".join((prev, value)) + self.dict[key] = combined + + def addcontinue(self, key, more): + """Add more field data from a continuation line.""" + prev = self.dict[key] + self.dict[key] = prev + "\n " + more + + def readheaders(self): + """Read header lines. + + Read header lines up to the entirely blank line that terminates them. + The (normally blank) line that ends the headers is skipped, but not + included in the returned list. If a non-header line ends the headers, + (which is an error), an attempt is made to backspace over it; it is + never included in the returned list. + + The variable self.status is set to the empty string if all went well, + otherwise it is an error message. The variable self.headers is a + completely uninterpreted list of lines contained in the header (so + printing them will reproduce the header exactly as it appears in the + file). + + If multiple header fields with the same name occur, they are combined + according to the rules in RFC 2616 sec 4.2: + + Appending each subsequent field-value to the first, each separated + by a comma. The order in which header fields with the same field-name + are received is significant to the interpretation of the combined + field value. + """ + # XXX The implementation overrides the readheaders() method of + # rfc822.Message. The base class design isn't amenable to + # customized behavior here so the method here is a copy of the + # base class code with a few small changes. + + self.dict = {} + self.unixfrom = '' + self.headers = list = [] + self.status = '' + headerseen = "" + firstline = 1 + startofline = unread = tell = None + if hasattr(self.fp, 'unread'): + unread = self.fp.unread + elif self.seekable: + tell = self.fp.tell + while 1: + if tell: + try: + startofline = tell() + except IOError: + startofline = tell = None + self.seekable = 0 + line = self.fp.readline() + if not line: + self.status = 'EOF in headers' + break + # Skip unix From name time lines + if firstline and line.startswith('From '): + self.unixfrom = self.unixfrom + line + continue + firstline = 0 + if headerseen and line[0] in ' \t': + # XXX Not sure if continuation lines are handled properly + # for http and/or for repeating headers + # It's a continuation line. + list.append(line) + x = self.dict[headerseen] + "\n " + line.strip() + self.addcontinue(headerseen, line.strip()) + continue + elif self.iscomment(line): + # It's a comment. Ignore it. + continue + elif self.islast(line): + # Note! No pushback here! The delimiter line gets eaten. + break + headerseen = self.isheader(line) + if headerseen: + # It's a legal header line, save it. + list.append(line) + self.addheader(headerseen, line[len(headerseen)+1:].strip()) + continue + else: + # It's not a header line; throw it back and stop here. + if not self.dict: + self.status = 'No headers' + else: + self.status = 'Non-header line where header expected' + # Try to undo the read. + if unread: + unread(line) + elif tell: + self.fp.seek(startofline) + else: + self.status = self.status + '; bad seek' + break + class HTTPResponse: *************** *** 187,194 **** self.chunked = 0 self.will_close = 1 ! self.msg = mimetools.Message(StringIO()) return ! self.msg = mimetools.Message(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: --- 293,300 ---- self.chunked = 0 self.will_close = 1 ! self.msg = HTTPMessage(StringIO()) return ! self.msg = HTTPMessage(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: From tim_one@users.sourceforge.net Sun Jul 7 17:52:53 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 07 Jul 2002 09:52:53 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.181,2.182 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14374/python/Objects Modified Files: object.c Log Message: Removed 3 unlikely #includes that were only needed for the non-gc flavor of the trashcan code. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.181 retrieving revision 2.182 diff -C2 -d -r2.181 -r2.182 *** object.c 7 Jul 2002 05:13:56 -0000 2.181 --- object.c 7 Jul 2002 16:52:50 -0000 2.182 *************** *** 8,16 **** #endif - /* just for trashcan: */ - #include "compile.h" - #include "frameobject.h" - #include "traceback.h" - #if defined( Py_TRACE_REFS ) || defined( Py_REF_DEBUG ) DL_IMPORT(long) _Py_RefTotal; --- 8,11 ---- From jhylton@users.sourceforge.net Sun Jul 7 17:57:37 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 09:57:37 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15349 Modified Files: urllib2.py Log Message: Fix from SF patch #527518: proxy config with user+pass authentication. Bug fix candidate. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** urllib2.py 3 Jun 2002 16:53:00 -0000 1.31 --- urllib2.py 7 Jul 2002 16:57:35 -0000 1.32 *************** *** 459,464 **** if '@' in host: user_pass, host = host.split('@', 1) ! user_pass = base64.encodestring(unquote(user_pass)).strip() ! req.add_header('Proxy-Authorization', 'Basic '+user_pass) host = unquote(host) req.set_proxy(host, type) --- 459,467 ---- if '@' in host: user_pass, host = host.split('@', 1) ! if ':' in user_pass: ! user, password = user_pass.split(':', 1) ! user_pass = base64.encodestring('%s:%s' % (unquote(user), ! unquote(password))) ! req.add_header('Proxy-Authorization', 'Basic ' + user_pass) host = unquote(host) req.set_proxy(host, type) *************** *** 765,769 **** raise URLError(err) ! h.putheader('Host', host) for args in self.parent.addheaders: h.putheader(*args) --- 768,774 ---- raise URLError(err) ! scheme, sel = splittype(req.get_selector()) ! sel_host, sel_path = splithost(sel) ! h.putheader('Host', sel_host or host) for args in self.parent.addheaders: h.putheader(*args) From jhylton@users.sourceforge.net Sun Jul 7 18:34:46 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:34:46 -0700 Subject: [Python-checkins] python/dist/src/Python asdl.c,NONE,1.1.2.1 ast.c,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28375/Python Added Files: Tag: ast-branch asdl.c ast.c Log Message: New files needed for AST XXX Where to put asdl.py code? Perhaps new AST directory would be better than Parser. --- NEW FILE: asdl.c --- #include "Python.h" #include "asdl.h" asdl_seq * asdl_seq_new(int size) { asdl_seq *seq = (asdl_seq *)malloc(sizeof(asdl_seq)); if (!seq) return NULL; seq->elements = malloc(sizeof(void *) * size); if (!seq->elements) { free(seq); return NULL; } seq->size = size; seq->used = 0; return seq; } void * asdl_seq_get(asdl_seq *seq, int offset) { if (offset > seq->used) return NULL; return seq->elements[offset]; } int asdl_seq_append(asdl_seq *seq, void *elt) { if (seq->size == seq->used) { void *newptr; int nsize = seq->size * 2; newptr = realloc(seq->elements, sizeof(void *) * nsize); if (!newptr) return 0; seq->elements = newptr; } seq->elements[seq->used++] = elt; return 1; } void asdl_seq_free(asdl_seq *seq) { if (seq->elements) free(seq->elements); free(seq); } --- NEW FILE: ast.c --- #include "Python.h" #include "Python-ast.h" #include "grammar.h" #include "node.h" #include "ast.h" #include "token.h" #include "parsetok.h" #include "graminit.h" #include /* XXX TO DO re-indent this file internal error checking syntax errors */ static asdl_seq *seq_for_testlist(node *); static expr_ty ast_for_expr(node *); [...1211 lines suppressed...] switch (TYPE(ch)) { case if_stmt: return ast_for_if_stmt(ch); case while_stmt: return ast_for_while_stmt(ch); case for_stmt: return ast_for_for_stmt(ch); case try_stmt: return ast_for_try_stmt(ch); case funcdef: return ast_for_funcdef(ch); case classdef: return ast_for_classdef(ch); default: return NULL; } } return NULL; } From jhylton@users.sourceforge.net Sun Jul 7 18:34:46 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:34:46 -0700 Subject: [Python-checkins] python/dist/src/Include asdl.h,NONE,1.1.2.1 ast.h,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28375/Include Added Files: Tag: ast-branch asdl.h ast.h Log Message: New files needed for AST XXX Where to put asdl.py code? Perhaps new AST directory would be better than Parser. --- NEW FILE: asdl.h --- #ifndef Py_ASDL_H #define Py_ASDL_H typedef PyObject * identifier; typedef PyObject * string; typedef PyObject * object; #include /* It would be nice if the code generated by asdl_c.py was completely independent of Python, but it is a goal the requires too much work at this stage. So, for example, I'll represent identifiers as interned Python strings. */ /* A sequence should be typed so that its use can be typechecked. */ typedef struct { int size; int used; void **elements; } asdl_seq; asdl_seq *asdl_seq_new(int size); void *asdl_seq_get(asdl_seq *seq, int offset); int asdl_seq_append(asdl_seq *seq, void *elt); void asdl_seq_free(asdl_seq *); #define asdl_seq_LEN(S) ((S)->used) #endif /* !Py_ASDL_H */ --- NEW FILE: ast.h --- #ifndef Py_AST_H #define Py_AST_H #ifdef __cplusplus extern "C" { #endif extern DL_IMPORT(mod_ty) PyAST_FromNode(node *); #ifdef __cplusplus } #endif #endif /* !Py_AST_H */ From jhylton@users.sourceforge.net Sun Jul 7 18:34:46 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:34:46 -0700 Subject: [Python-checkins] python/dist/src/Parser Python.asdl,NONE,1.1.2.1 asdl.py,NONE,1.1.2.1 asdl_c.py,NONE,1.1.2.1 spark.py,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv28375/Parser Added Files: Tag: ast-branch Python.asdl asdl.py asdl_c.py spark.py Log Message: New files needed for AST XXX Where to put asdl.py code? Perhaps new AST directory would be better than Parser. --- NEW FILE: Python.asdl --- -- ASDL's three builtin types are identifier, int, string module Python { mod = Module(stmt* body) | Interactive(stmt body) | Expression(expr body) -- not really an actual node but useful in Jython's typesystem. | Suite(stmt* body) stmt = FunctionDef(identifier name, arguments args, stmt* body) | ClassDef(identifier name, expr* bases, stmt* body) | Return(expr? value) | Yield(expr value) | Delete(expr* targets) | Assign(expr* targets, expr value) | AugAssign(expr target, operator op, expr value) -- not sure if bool is allowed, can always use int | Print(expr? dest, expr* value, bool nl) -- use 'orelse' because else is a keyword in target languages | For(expr target, expr iter, stmt* body, stmt* orelse) | While(expr test, stmt* body, stmt* orelse) | If(expr test, stmt* body, stmt* orelse) -- 'type' is a bad name | Raise(expr? type, expr? inst, expr? tback) | TryExcept(stmt* body, excepthandler* handlers, stmt* orelse) | TryFinally(stmt* body, stmt* finalbody) | Assert(expr test, expr? msg) | Import(alias* names) | ImportFrom(identifier module, alias* names) -- Doesn't capture requirement that locals must be -- defined if globals is -- still supports use as a function! | Exec(expr body, expr? globals, expr? locals) | Global(identifier* names) | Expr(expr value) | Pass | Break | Continue -- XXX Jython will be different attributes (int lineno) -- BoolOp() can yuse left & right? expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) | UnaryOp(unaryop op, expr operand) | Lambda(arguments args, expr body) | Dict(expr* keys, expr *values) | ListComp(expr target, listcomp* generators) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) | Call(expr func, expr* args, keyword* keywords, expr? starargs, expr? kwargs) | Repr(expr value) | Num(object n) -- a number as a PyObject. | Str(string s) -- need to specify raw, unicode, etc? -- other literals? bools? -- the following expression can appear in assignment context | Attribute(expr value, identifier attr, expr_context ctx) | Subscript(expr value, slice slice, expr_context ctx) | Name(identifier id, expr_context ctx) | List(expr* elts, expr_context ctx) | Tuple(expr *elts, expr_context ctx) expr_context = Load | Store | Del | AugStore slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step) | ExtSlice(slice* dims) | Index(expr value) boolop = And | Or operator = Add | Sub | Mult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv unaryop = Invert | Not | UAdd | USub cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn listcomp = (expr target, expr iter, expr* ifs) -- not sure what to call the first argument for raise and except excepthandler = (expr? type, expr? name, stmt* body) arguments = (expr* args, identifier? vararg, identifier? kwarg, expr* defaults) -- keyword arguments supplied to call keyword = (identifier arg, expr value) -- import name with optional 'as' alias. alias = (identifier name, identifier? asname) } --- NEW FILE: asdl.py --- """An implementation of the Zephyr Abstract Syntax Definition Language. See http://asdl.sourceforge.net/ and http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html. Only supports top level module decl, not view. I'm guessing that view is intended to support the browser and I'm not interested in the browser. """ #__metaclass__ = type import os import traceback import spark class Token: # spark seems to dispatch in the parser based on a token's # type attribute def __init__(self, type, lineno): self.type = type self.lineno = lineno def __str__(self): return self.type def __repr__(self): return str(self) class Id(Token): def __init__(self, value, lineno): self.type = 'Id' self.value = value self.lineno = lineno def __str__(self): return self.value class ASDLSyntaxError: def __init__(self, lineno, token=None, msg=None): self.lineno = lineno self.token = token self.msg = msg def __str__(self): if self.msg is None: return "Error at '%s', line %d" % (self.token, self.lineno) else: return "%s, line %d" % (self.msg, self.lineno) class ASDLScanner(spark.GenericScanner, object): def tokenize(self, input): self.rv = [] self.lineno = 1 super(ASDLScanner, self).tokenize(input) return self.rv def t_id(self, s): r"[\w\.]+" # XXX doesn't distinguish upper vs. lower, which is # significant for ASDL. self.rv.append(Id(s, self.lineno)) def t_xxx(self, s): # not sure what this production means r"<=" self.rv.append(Token(s, self.lineno)) def t_punctuation(self, s): r"[\{\}\*\=\|\(\)\,\?\:]" self.rv.append(Token(s, self.lineno)) def t_comment(self, s): r"\-\-[^\n]*" pass def t_newline(self, s): r"\n" self.lineno += 1 def t_whitespace(self, s): r"[ \t]+" pass def t_default(self, s): r" . +" raise ValueError, "unmatched input: %s" % `s` class ASDLParser(spark.GenericParser, object): def __init__(self): super(ASDLParser, self).__init__("module") def typestring(self, tok): return tok.type def error(self, tok): raise ASDLSyntaxError(tok.lineno, tok) def p_module_0(self, (module, name, _0, _1)): " module ::= Id Id { } " if module.value != "module": raise ASDLSyntaxError(module.lineno, msg="expected 'module', found %s" % module) return Module(name, None) def p_module(self, (module, name, _0, definitions, _1)): " module ::= Id Id { definitions } " if module.value != "module": raise ASDLSyntaxError(module.lineno, msg="expected 'module', found %s" % module) return Module(name, definitions) def p_definition_0(self, (definition,)): " definitions ::= definition " return definition def p_definition_1(self, (definitions, definition)): " definitions ::= definition definitions " return definitions + definition def p_definition(self, (id, _, type)): " definition ::= Id = type " return [Type(id, type)] def p_type_0(self, (product,)): " type ::= product " return product def p_type_1(self, (sum,)): " type ::= sum " return Sum(sum) def p_type_2(self, (sum, id, _0, attributes, _1)): " type ::= sum Id ( fields ) " if id.value != "attributes": raise ASDLSyntaxError(id.lineno, msg="expected attributes, found %s" % id) return Sum(sum, attributes) def p_product(self, (_0, fields, _1)): " product ::= ( fields ) " # XXX can't I just construct things in the right order? fields.reverse() return Product(fields) def p_sum_0(self, (constructor,)): " sum ::= constructor """ return [constructor] def p_sum_1(self, (constructor, _, sum)): " sum ::= constructor | sum " return [constructor] + sum def p_sum_2(self, (constructor, _, sum)): " sum ::= constructor | sum " return [constructor] + sum def p_constructor_0(self, (id,)): " constructor ::= Id " return Constructor(id) def p_constructor_1(self, (id, _0, fields, _1)): " constructor ::= Id ( fields ) " # XXX can't I just construct things in the right order? fields.reverse() return Constructor(id, fields) def p_fields_0(self, (field,)): " fields ::= field " return [field] def p_fields_1(self, (field, _, fields)): " fields ::= field , fields " return fields + [field] def p_field_0(self, (type,)): " field ::= Id " return Field(type) def p_field_1(self, (type, name)): " field ::= Id Id " return Field(type, name) def p_field_2(self, (type, _, name)): " field ::= Id * Id " return Field(type, name, seq=1) def p_field_3(self, (type, _, name)): " field ::= Id ? Id " return Field(type, name, opt=1) def p_field_4(self, (type, _)): " field ::= Id * " return Field(type, seq=1) def p_field_5(self, (type, _)): " field ::= Id ? " return Field(type, opt=1) builtin_types = ("identifier", "string", "int", "bool", "object") # below is a collection of classes to capture the AST of an AST :-) # not sure if any of the methods are useful yet, but I'm adding them # piecemeal as they seem helpful class AST: pass # a marker class class Module(AST): def __init__(self, name, dfns): self.name = name self.dfns = dfns self.types = {} # maps type name to value (from dfns) for type in dfns: self.types[type.name.value] = type.value def __repr__(self): return "Module(%s, %s)" % (self.name, self.dfns) class Type(AST): def __init__(self, name, value): self.name = name self.value = value def __repr__(self): return "Type(%s, %s)" % (self.name, self.value) class Constructor(AST): def __init__(self, name, fields=None): self.name = name self.fields = fields or [] def __repr__(self): return "Constructor(%s, %s)" % (self.name, self.fields) class Field(AST): def __init__(self, type, name=None, seq=0, opt=0): self.type = type self.name = name self.seq = seq self.opt = opt def __repr__(self): if self.seq: extra = ", seq=1" elif self.opt: extra = ", opt=1" else: extra = "" if self.name is None: return "Field(%s%s)" % (self.type, extra) else: return "Field(%s, %s,%s)" % (self.type, self.name, extra) class Sum(AST): def __init__(self, types, attributes=None): self.types = types self.attributes = attributes or [] def __repr__(self): if self.attributes is None: return "Sum(%s)" % self.types else: return "Sum(%s, %s)" % (self.types, self.attributes) class Product(AST): def __init__(self, fields): self.fields = fields def __repr__(self): return "Product(%s)" % self.fields class VisitorBase(object): def __init__(self, skip=0): self.cache = {} self.skip = skip def visit(self, object, *args): meth = self._dispatch(object) if meth is None: return try: meth(object, *args) except Exception, err: print "Error visiting", repr(object) print err traceback.print_exc() # XXX hack if hasattr(self, 'file'): self.file.flush() os._exit(1) def _dispatch(self, object): assert isinstance(object, AST), repr(object) klass = object.__class__ meth = self.cache.get(klass) if meth is None: methname = "visit" + klass.__name__ if self.skip: meth = getattr(self, methname, None) else: meth = getattr(self, methname) self.cache[klass] = meth return meth class Check(VisitorBase): def __init__(self): super(Check, self).__init__(skip=1) self.cons = {} self.errors = 0 self.types = {} def visitModule(self, mod): for dfn in mod.dfns: self.visit(dfn) def visitType(self, type): self.visit(type.value, str(type.name)) def visitSum(self, sum, name): for t in sum.types: self.visit(t, name) def visitConstructor(self, cons, name): key = str(cons.name) conflict = self.cons.get(key) if conflict is None: self.cons[key] = name else: print "Redefinition of constructor %s" % key print "Defined in %s and %s" % (conflict, name) self.errors += 1 for f in cons.fields: self.visit(f, key) def visitField(self, field, name): key = str(field.type) l = self.types.setdefault(key, []) l.append(name) def visitProduct(self, prod, name): for f in prod.fields: self.visit(f, name) def check(mod): v = Check() v.visit(mod) for t in v.types: if not mod.types.has_key(t) and not t in builtin_types: v.errors += 1 uses = ", ".join(v.types[t]) print "Undefined type %s, used in %s" % (t, uses) return not v.errors def parse(file): scanner = ASDLScanner() parser = ASDLParser() buf = open(file).read() tokens = scanner.tokenize(buf) try: return parser.parse(tokens) except ASDLSyntaxError, err: print err lines = buf.split("\n") print lines[err.lineno - 1] # lines starts at 0, files at 1 if __name__ == "__main__": import glob import sys if len(sys.argv) > 1: files = sys.argv[1:] else: testdir = "tests" files = glob.glob(testdir + "/*.asdl") for file in files: print file mod = parse(file) print "module", mod.name print len(mod.dfns), "definitions" if not check(mod): print "Check failed" else: for dfn in mod.dfns: print dfn.type --- NEW FILE: asdl_c.py --- #! /usr/bin/env python """Generate C code from an ASDL description.""" # TO DO # handle fields that have a type but no name import os, sys, traceback import asdl TABSIZE = 8 MAX_COL = 76 def get_c_type(name): """Return a string for the C name of the type. This function special cases the default types provided by asdl: identifier, string, int, bool. """ # XXX ack! need to figure out where Id is useful and where string if isinstance(name, asdl.Id): name = name.value if name in asdl.builtin_types: return name else: return "%s_ty" % name def reflow_lines(s, depth): """Reflow the line s indented depth tabs. Return a sequence of lines where no line extends beyond MAX_COL when properly indented. The first line is properly indented based exclusively on depth * TABSIZE. All following lines -- these are the reflowed lines generated by this function -- start at the same column as the first character beyond the opening { in the first line. """ size = MAX_COL - depth * TABSIZE if len(s) < size: return [s] lines = [] cur = s padding = "" while len(cur) > size: i = cur.rfind(' ', 0, size) assert i != -1, "Impossible line to reflow: %s" % `s` lines.append(padding + cur[:i]) if len(lines) == 1: # find new size based on brace j = cur.find('{', 0, i) if j >= 0: j += 2 # account for the brace and the space after it size -= j padding = " " * j else: j = cur.find('(', 0, i) if j >= 0: j += 1 # account for the paren (no space after it) size -= j padding = " " * j cur = cur[i+1:] else: lines.append(padding + cur) return lines class EmitVisitor(asdl.VisitorBase): """Visit that emits lines""" def __init__(self, file): self.file = file super(EmitVisitor, self).__init__() def emit(self, s, depth, reflow=1): # XXX reflow long lines? if reflow: lines = reflow_lines(s, depth) else: lines = [s] for line in lines: line = (" " * TABSIZE * depth) + line + "\n" self.file.write(line) def is_simple(self, sum): """Return true if a sum is a simple. A sum is simple if its types have no fields, e.g. unaryop = Invert | Not | UAdd | USub """ simple = 1 for t in sum.types: if t.fields: simple = 0 break return simple class TypeDefVisitor(EmitVisitor): def visitModule(self, mod): for dfn in mod.dfns: self.visit(dfn) def visitType(self, type, depth=0): self.visit(type.value, type.name, depth) def visitSum(self, sum, name, depth): if self.is_simple(sum): self.simple_sum(sum, name, depth) else: self.sum_with_constructors(sum, name, depth) def simple_sum(self, sum, name, depth): enum = [] for i in range(len(sum.types)): type = sum.types[i] enum.append("%s=%d" % (type.name, i + 1)) enums = ", ".join(enum) ctype = get_c_type(name) s = "typedef enum _%s { %s } %s;" % (name, enums, ctype) self.emit(s, depth) self.emit("", depth) def sum_with_constructors(self, sum, name, depth): ctype = get_c_type(name) s = "typedef struct _%(name)s *%(ctype)s;" % locals() self.emit(s, depth) self.emit("", depth) def visitProduct(self, product, name, depth): ctype = get_c_type(name) s = "typedef struct _%(name)s *%(ctype)s;" % locals() self.emit(s, depth) self.emit("", depth) class StructVisitor(EmitVisitor): """Visitor to generate typdefs for AST.""" def visitModule(self, mod): for dfn in mod.dfns: self.visit(dfn) def visitType(self, type, depth=0): self.visit(type.value, type.name, depth) def visitSum(self, sum, name, depth): if not self.is_simple(sum): self.sum_with_constructors(sum, name, depth) def sum_with_constructors(self, sum, name, depth): def emit(s, depth=depth): self.emit(s % sys._getframe(1).f_locals, depth) enum = [] for i in range(len(sum.types)): type = sum.types[i] enum.append("%s_kind=%d" % (type.name, i + 1)) emit("struct _%(name)s {") emit("enum { " + ", ".join(enum) + " } kind;", depth + 1) emit("union {", depth + 1) for t in sum.types: self.visit(t, depth + 2) emit("} v;", depth + 1) for field in sum.attributes: # rudimentary attribute handling type = str(field.type) assert type in asdl.builtin_types, type emit("%s %s;" % (type, field.name), depth + 1); emit("};") emit("") def visitConstructor(self, cons, depth): if cons.fields: self.emit("struct {", depth) for f in cons.fields: self.visit(f, depth + 1) self.emit("} %s;" % cons.name, depth) self.emit("", depth) else: # XXX not sure what I want here, nothing is probably fine pass def visitField(self, field, depth): # XXX need to lookup field.type, because it might be something # like a builtin... ctype = get_c_type(field.type) name = field.name if field.seq: self.emit("asdl_seq *%(name)s;" % locals(), depth) else: self.emit("%(ctype)s %(name)s;" % locals(), depth) def visitProduct(self, product, name, depth): self.emit("struct _%(name)s {" % locals(), depth) for f in product.fields: self.visit(f, depth + 1) self.emit("};", depth) self.emit("", depth) class PrototypeVisitor(EmitVisitor): """Generate function prototypes for the .h file""" def visitModule(self, mod): for dfn in mod.dfns: self.visit(dfn) def visitType(self, type): self.visit(type.value, type.name) def visitSum(self, sum, name): if self.is_simple(sum): pass # XXX else: for t in sum.types: self.visit(t, name, sum.attributes) def get_args(self, fields): """Return list of C argument into, one for each field. Argument info is 3-tuple of a C type, variable name, and flag that is true if type can be NULL. """ args = [] unnamed = {} for f in fields: if f.name is None: name = f.type c = unnamed[name] = unnamed.get(name, 0) + 1 if c > 1: name = "name%d" % (c - 1) else: name = f.name # XXX should extend get_c_type() to handle this if f.seq: ctype = "asdl_seq *" else: ctype = get_c_type(f.type) args.append((ctype, name, f.opt or f.seq)) return args def visitConstructor(self, cons, type, attrs): args = self.get_args(cons.fields) attrs = self.get_args(attrs) ctype = get_c_type(type) self.emit_function(cons.name, ctype, args, attrs) def emit_function(self, name, ctype, args, attrs, union=1): args = args + attrs if args: argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname, opt in args]) else: argstr = "void" self.emit("%s %s(%s);" % (ctype, name, argstr), 0) def visitProduct(self, prod, name): self.emit_function(name, get_c_type(name), self.get_args(prod.fields), [], union=0) class FunctionVisitor(PrototypeVisitor): """Visitor to generate constructor functions for AST.""" def emit_function(self, name, ctype, args, attrs, union=1): def emit(s, depth=0, reflow=1): self.emit(s, depth, reflow) argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname, opt in args + attrs]) self.emit("%s" % ctype, 0) emit("%s(%s)" % (name, argstr)) emit("{") emit("%s p;" % ctype, 1) for argtype, argname, opt in args: # XXX hack alert: false is allowed for a bool if not opt and not argtype == "bool": emit("if (!%s) {" % argname, 1) emit("PyErr_SetString(PyExc_ValueError,", 2) msg = "field %s is required for %s" % (argname, name) emit(' "%s");' % msg, 2, reflow=0) emit('return NULL;', 2) emit('}', 1) emit("p = (%s)malloc(sizeof(*p));" % ctype, 1) emit("if (!p) {", 1) emit("PyErr_SetString(PyExc_MemoryError, \"no memory\");", 2) emit("return NULL;", 2) emit("}", 1) if union: self.emit_body_union(name, args, attrs) else: self.emit_body_struct(name, args, attrs) emit("return p;", 1) emit("}") emit("") def emit_body_union(self, name, args, attrs): def emit(s, depth=0, reflow=1): self.emit(s, depth, reflow) emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: emit("p->v.%s.%s = %s;" % (name, argname, argname), 1) for argtype, argname, opt in attrs: emit("p->%s = %s;" % (argname, argname), 1) def emit_body_struct(self, name, args, attrs): def emit(s, depth=0, reflow=1): self.emit(s, depth, reflow) for argtype, argname, opt in args: emit("p->%s = %s;" % (argname, argname), 1) assert not attrs class PickleVisitor(EmitVisitor): def visitModule(self, mod): for dfn in mod.dfns: self.visit(dfn) def visitType(self, type): self.visit(type.value, type.name) def visitSum(self, sum, name): pass def visitProduct(self, sum, name): pass def visitConstructor(self, cons, name): pass def visitField(self, sum): pass class PicklePrototypeVisitor(PickleVisitor): def visitSum(self, sum, name): ctype = get_c_type(name) self.emit("int pkl_write_%s(PyObject *write, %s o);" % (name, ctype), 0) class PickleFunctionVisitor(PickleVisitor): def visitSum(self, sum, name): ctype = get_c_type(name) self.emit("int", 0) self.emit("pkl_write_%s(PyObject *write, %s o)" % (name, ctype), 0) self.emit("{", 0) self.emit("switch (o->kind) {", 1) simple = self.is_simple(sum) for i in range(len(sum.types)): t = sum.types[i] self.visit(t, i + 1, name, simple) self.emit("}", 1) self.emit("return 0;", 1) self.emit("}", 0) self.emit("", 0) def visitConstructor(self, cons, enum, name, simple): if simple: pass else: self.emit("case %s_kind:" % cons.name, 1) self.emit("pkl_write_int(write, %d);" % enum, 2) for f in cons.fields: self.visit(f, cons.name) self.emit("break;", 2) def visitField(self, field, name): # handle seq and opt self.emit("pkl_write_%s(write, o->v.%s.%s);" % ( field.type, name, field.name), 2) class ChainOfVisitors: def __init__(self, *visitors): self.visitors = visitors def visit(self, object): for v in self.visitors: v.visit(object) def main(srcfile): auto_gen_msg = '/* File automatically generated by %s */\n' % sys.argv[0] mod = asdl.parse(srcfile) if not asdl.check(mod): sys.exit(1) if INC_DIR: p = "%s/%s-ast.h" % (INC_DIR, mod.name) else: p = "%s-ast.h" % mod.name f = open(p, "wb") print >> f, auto_gen_msg print >> f, '#include "asdl.h"\n' c = ChainOfVisitors(TypeDefVisitor(f), StructVisitor(f), PrototypeVisitor(f), ## PicklePrototypeVisitor(f), ) c.visit(mod) f.close() if SRC_DIR: p = "%s/%s-ast.c" % (SRC_DIR, mod.name) else: p = "%s-ast.c" % mod.name f = open(p, "wb") print >> f, auto_gen_msg print >> f, '#include "Python.h"' print >> f, '#include "%s-ast.h"' % mod.name print >> f v = ChainOfVisitors(FunctionVisitor(f), ## PickleFunctionVisitor(f), ) v.visit(mod) f.close() if __name__ == "__main__": import sys import getopt INC_DIR = '' SRC_DIR = '' opts, args = getopt.getopt(sys.argv[1:], "h:c:") for o, v in opts: if o == '-h': INC_DIR = v if o == '-c': SRC_DIR = v if len(args) != 1: print "Must specify single input file" main(args[0]) --- NEW FILE: spark.py --- # Copyright (c) 1998-2002 John Aycock # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. __version__ = 'SPARK-0.7 (pre-alpha-5)' import re import sys import string def _namelist(instance): namelist, namedict, classlist = [], {}, [instance.__class__] for c in classlist: for b in c.__bases__: classlist.append(b) for name in c.__dict__.keys(): if not namedict.has_key(name): namelist.append(name) namedict[name] = 1 return namelist class GenericScanner: def __init__(self, flags=0): pattern = self.reflect() self.re = re.compile(pattern, re.VERBOSE|flags) self.index2func = {} for name, number in self.re.groupindex.items(): self.index2func[number-1] = getattr(self, 't_' + name) def makeRE(self, name): doc = getattr(self, name).__doc__ rv = '(?P<%s>%s)' % (name[2:], doc) return rv def reflect(self): rv = [] for name in _namelist(self): if name[:2] == 't_' and name != 't_default': rv.append(self.makeRE(name)) rv.append(self.makeRE('t_default')) return string.join(rv, '|') def error(self, s, pos): print "Lexical error at position %s" % pos raise SystemExit def tokenize(self, s): pos = 0 n = len(s) while pos < n: m = self.re.match(s, pos) if m is None: self.error(s, pos) groups = m.groups() for i in range(len(groups)): if groups[i] and self.index2func.has_key(i): self.index2func[i](groups[i]) pos = m.end() def t_default(self, s): r'( . | \n )+' print "Specification error: unmatched input" raise SystemExit # # Extracted from GenericParser and made global so that [un]picking works. # class _State: def __init__(self, stateno, items): self.T, self.complete, self.items = [], [], items self.stateno = stateno class GenericParser: # # An Earley parser, as per J. Earley, "An Efficient Context-Free # Parsing Algorithm", CACM 13(2), pp. 94-102. Also J. C. Earley, # "An Efficient Context-Free Parsing Algorithm", Ph.D. thesis, # Carnegie-Mellon University, August 1968. New formulation of # the parser according to J. Aycock, "Practical Earley Parsing # and the SPARK Toolkit", Ph.D. thesis, University of Victoria, # 2001, and J. Aycock and R. N. Horspool, "Practical Earley # Parsing", unpublished paper, 2001. # def __init__(self, start): self.rules = {} self.rule2func = {} self.rule2name = {} self.collectRules() self.augment(start) self.ruleschanged = 1 _NULLABLE = '\e_' _START = 'START' _BOF = '|-' # # When pickling, take the time to generate the full state machine; # some information is then extraneous, too. Unfortunately we # can't save the rule2func map. # def __getstate__(self): if self.ruleschanged: # # XXX - duplicated from parse() # self.computeNull() self.newrules = {} self.new2old = {} self.makeNewRules() self.ruleschanged = 0 self.edges, self.cores = {}, {} self.states = { 0: self.makeState0() } self.makeState(0, self._BOF) # # XXX - should find a better way to do this.. # changes = 1 while changes: changes = 0 for k, v in self.edges.items(): if v is None: state, sym = k if self.states.has_key(state): self.goto(state, sym) changes = 1 rv = self.__dict__.copy() for s in self.states.values(): del s.items del rv['rule2func'] del rv['nullable'] del rv['cores'] return rv def __setstate__(self, D): self.rules = {} self.rule2func = {} self.rule2name = {} self.collectRules() start = D['rules'][self._START][0][1][1] # Blech. self.augment(start) D['rule2func'] = self.rule2func D['makeSet'] = self.makeSet_fast self.__dict__ = D # # A hook for GenericASTBuilder and GenericASTMatcher. Mess # thee not with this; nor shall thee toucheth the _preprocess # argument to addRule. # def preprocess(self, rule, func): return rule, func def addRule(self, doc, func, _preprocess=1): fn = func rules = string.split(doc) index = [] for i in range(len(rules)): if rules[i] == '::=': index.append(i-1) index.append(len(rules)) for i in range(len(index)-1): lhs = rules[index[i]] rhs = rules[index[i]+2:index[i+1]] rule = (lhs, tuple(rhs)) if _preprocess: rule, fn = self.preprocess(rule, func) if self.rules.has_key(lhs): self.rules[lhs].append(rule) else: self.rules[lhs] = [ rule ] self.rule2func[rule] = fn self.rule2name[rule] = func.__name__[2:] self.ruleschanged = 1 def collectRules(self): for name in _namelist(self): if name[:2] == 'p_': func = getattr(self, name) doc = func.__doc__ self.addRule(doc, func) def augment(self, start): rule = '%s ::= %s %s' % (self._START, self._BOF, start) self.addRule(rule, lambda args: args[1], 0) def computeNull(self): self.nullable = {} tbd = [] for rulelist in self.rules.values(): lhs = rulelist[0][0] self.nullable[lhs] = 0 for rule in rulelist: rhs = rule[1] if len(rhs) == 0: self.nullable[lhs] = 1 continue # # We only need to consider rules which # consist entirely of nonterminal symbols. # This should be a savings on typical # grammars. # for sym in rhs: if not self.rules.has_key(sym): break else: tbd.append(rule) changes = 1 while changes: changes = 0 for lhs, rhs in tbd: if self.nullable[lhs]: continue for sym in rhs: if not self.nullable[sym]: break else: self.nullable[lhs] = 1 changes = 1 def makeState0(self): s0 = _State(0, []) for rule in self.newrules[self._START]: s0.items.append((rule, 0)) return s0 def finalState(self, tokens): # # Yuck. # if len(self.newrules[self._START]) == 2 and len(tokens) == 0: return 1 start = self.rules[self._START][0][1][1] return self.goto(1, start) def makeNewRules(self): worklist = [] for rulelist in self.rules.values(): for rule in rulelist: worklist.append((rule, 0, 1, rule)) for rule, i, candidate, oldrule in worklist: lhs, rhs = rule n = len(rhs) while i < n: sym = rhs[i] if not self.rules.has_key(sym) or \ not self.nullable[sym]: candidate = 0 i = i + 1 continue newrhs = list(rhs) newrhs[i] = self._NULLABLE+sym newrule = (lhs, tuple(newrhs)) worklist.append((newrule, i+1, candidate, oldrule)) candidate = 0 i = i + 1 else: if candidate: lhs = self._NULLABLE+lhs rule = (lhs, rhs) if self.newrules.has_key(lhs): self.newrules[lhs].append(rule) else: self.newrules[lhs] = [ rule ] self.new2old[rule] = oldrule def typestring(self, token): return None def error(self, token): print "Syntax error at or near `%s' token" % token raise SystemExit def parse(self, tokens): sets = [ [(1,0), (2,0)] ] self.links = {} if self.ruleschanged: self.computeNull() self.newrules = {} self.new2old = {} self.makeNewRules() self.ruleschanged = 0 self.edges, self.cores = {}, {} self.states = { 0: self.makeState0() } self.makeState(0, self._BOF) for i in xrange(len(tokens)): sets.append([]) if sets[i] == []: break self.makeSet(tokens[i], sets, i) else: sets.append([]) self.makeSet(None, sets, len(tokens)) #_dump(tokens, sets, self.states) finalitem = (self.finalState(tokens), 0) if finalitem not in sets[-2]: if len(tokens) > 0: self.error(tokens[i-1]) else: self.error(None) return self.buildTree(self._START, finalitem, tokens, len(sets)-2) def isnullable(self, sym): # # For symbols in G_e only. If we weren't supporting 1.5, # could just use sym.startswith(). # return self._NULLABLE == sym[0:len(self._NULLABLE)] def skip(self, (lhs, rhs), pos=0): n = len(rhs) while pos < n: if not self.isnullable(rhs[pos]): break pos = pos + 1 return pos def makeState(self, state, sym): assert sym is not None # # Compute \epsilon-kernel state's core and see if # it exists already. # kitems = [] for rule, pos in self.states[state].items: lhs, rhs = rule if rhs[pos:pos+1] == (sym,): kitems.append((rule, self.skip(rule, pos+1))) core = kitems core.sort() tcore = tuple(core) if self.cores.has_key(tcore): return self.cores[tcore] # # Nope, doesn't exist. Compute it and the associated # \epsilon-nonkernel state together; we'll need it right away. # k = self.cores[tcore] = len(self.states) K, NK = _State(k, kitems), _State(k+1, []) self.states[k] = K predicted = {} edges = self.edges rules = self.newrules for X in K, NK: worklist = X.items for item in worklist: rule, pos = item lhs, rhs = rule if pos == len(rhs): X.complete.append(rule) continue nextSym = rhs[pos] key = (X.stateno, nextSym) if not rules.has_key(nextSym): if not edges.has_key(key): edges[key] = None X.T.append(nextSym) else: edges[key] = None if not predicted.has_key(nextSym): predicted[nextSym] = 1 for prule in rules[nextSym]: ppos = self.skip(prule) new = (prule, ppos) NK.items.append(new) # # Problem: we know K needs generating, but we # don't yet know about NK. Can't commit anything # regarding NK to self.edges until we're sure. Should # we delay committing on both K and NK to avoid this # hacky code? This creates other problems.. # if X is K: edges = {} if NK.items == []: return k # # Check for \epsilon-nonkernel's core. Unfortunately we # need to know the entire set of predicted nonterminals # to do this without accidentally duplicating states. # core = predicted.keys() core.sort() tcore = tuple(core) if self.cores.has_key(tcore): self.edges[(k, None)] = self.cores[tcore] return k nk = self.cores[tcore] = self.edges[(k, None)] = NK.stateno self.edges.update(edges) self.states[nk] = NK return k def goto(self, state, sym): key = (state, sym) if not self.edges.has_key(key): # # No transitions from state on sym. # return None rv = self.edges[key] if rv is None: # # Target state isn't generated yet. Remedy this. # rv = self.makeState(state, sym) self.edges[key] = rv return rv def gotoT(self, state, t): return [self.goto(state, t)] def gotoST(self, state, st): rv = [] for t in self.states[state].T: if st == t: rv.append(self.goto(state, t)) return rv def add(self, set, item, i=None, predecessor=None, causal=None): if predecessor is None: if item not in set: set.append(item) else: key = (item, i) if item not in set: self.links[key] = [] set.append(item) self.links[key].append((predecessor, causal)) def makeSet(self, token, sets, i): cur, next = sets[i], sets[i+1] ttype = token is not None and self.typestring(token) or None if ttype is not None: fn, arg = self.gotoT, ttype else: fn, arg = self.gotoST, token for item in cur: ptr = (item, i) state, parent = item add = fn(state, arg) for k in add: if k is not None: self.add(next, (k, parent), i+1, ptr) nk = self.goto(k, None) if nk is not None: self.add(next, (nk, i+1)) if parent == i: continue for rule in self.states[state].complete: lhs, rhs = rule for pitem in sets[parent]: pstate, pparent = pitem k = self.goto(pstate, lhs) if k is not None: why = (item, i, rule) pptr = (pitem, parent) self.add(cur, (k, pparent), i, pptr, why) nk = self.goto(k, None) if nk is not None: self.add(cur, (nk, i)) def makeSet_fast(self, token, sets, i): # # Call *only* when the entire state machine has been built! # It relies on self.edges being filled in completely, and # then duplicates and inlines code to boost speed at the # cost of extreme ugliness. # cur, next = sets[i], sets[i+1] ttype = token is not None and self.typestring(token) or None for item in cur: ptr = (item, i) state, parent = item if ttype is not None: k = self.edges.get((state, ttype), None) if k is not None: #self.add(next, (k, parent), i+1, ptr) #INLINED --v new = (k, parent) key = (new, i+1) if new not in next: self.links[key] = [] next.append(new) self.links[key].append((ptr, None)) #INLINED --^ #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: #self.add(next, (nk, i+1)) #INLINED --v new = (nk, i+1) if new not in next: next.append(new) #INLINED --^ else: add = self.gotoST(state, token) for k in add: if k is not None: self.add(next, (k, parent), i+1, ptr) #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: self.add(next, (nk, i+1)) if parent == i: continue for rule in self.states[state].complete: lhs, rhs = rule for pitem in sets[parent]: pstate, pparent = pitem #k = self.goto(pstate, lhs) k = self.edges.get((pstate, lhs), None) if k is not None: why = (item, i, rule) pptr = (pitem, parent) #self.add(cur, (k, pparent), # i, pptr, why) #INLINED --v new = (k, pparent) key = (new, i) if new not in cur: self.links[key] = [] cur.append(new) self.links[key].append((pptr, why)) #INLINED --^ #nk = self.goto(k, None) nk = self.edges.get((k, None), None) if nk is not None: #self.add(cur, (nk, i)) #INLINED --v new = (nk, i) if new not in cur: cur.append(new) #INLINED --^ def predecessor(self, key, causal): for p, c in self.links[key]: if c == causal: return p assert 0 def causal(self, key): links = self.links[key] if len(links) == 1: return links[0][1] choices = [] rule2cause = {} for p, c in links: rule = c[2] choices.append(rule) rule2cause[rule] = c return rule2cause[self.ambiguity(choices)] def deriveEpsilon(self, nt): if len(self.newrules[nt]) > 1: rule = self.ambiguity(self.newrules[nt]) else: rule = self.newrules[nt][0] #print rule rhs = rule[1] attr = [None] * len(rhs) for i in range(len(rhs)-1, -1, -1): attr[i] = self.deriveEpsilon(rhs[i]) return self.rule2func[self.new2old[rule]](attr) def buildTree(self, nt, item, tokens, k): state, parent = item choices = [] for rule in self.states[state].complete: if rule[0] == nt: choices.append(rule) rule = choices[0] if len(choices) > 1: rule = self.ambiguity(choices) #print rule rhs = rule[1] attr = [None] * len(rhs) for i in range(len(rhs)-1, -1, -1): sym = rhs[i] if not self.newrules.has_key(sym): if sym != self._BOF: attr[i] = tokens[k-1] key = (item, k) item, k = self.predecessor(key, None) #elif self.isnullable(sym): elif self._NULLABLE == sym[0:len(self._NULLABLE)]: attr[i] = self.deriveEpsilon(sym) else: key = (item, k) why = self.causal(key) attr[i] = self.buildTree(sym, why[0], tokens, why[1]) item, k = self.predecessor(key, why) return self.rule2func[self.new2old[rule]](attr) def ambiguity(self, rules): # # XXX - problem here and in collectRules() if the same rule # appears in >1 method. Also undefined results if rules # causing the ambiguity appear in the same method. # sortlist = [] name2index = {} for i in range(len(rules)): lhs, rhs = rule = rules[i] name = self.rule2name[self.new2old[rule]] sortlist.append((len(rhs), name)) name2index[name] = i sortlist.sort() list = map(lambda (a,b): b, sortlist) return rules[name2index[self.resolve(list)]] def resolve(self, list): # # Resolve ambiguity in favor of the shortest RHS. # Since we walk the tree from the top down, this # should effectively resolve in favor of a "shift". # return list[0] # # GenericASTBuilder automagically constructs a concrete/abstract syntax tree # for a given input. The extra argument is a class (not an instance!) # which supports the "__setslice__" and "__len__" methods. # # XXX - silently overrides any user code in methods. # class GenericASTBuilder(GenericParser): def __init__(self, AST, start): GenericParser.__init__(self, start) self.AST = AST def preprocess(self, rule, func): rebind = lambda lhs, self=self: \ lambda args, lhs=lhs, self=self: \ self.buildASTNode(args, lhs) lhs, rhs = rule return rule, rebind(lhs) def buildASTNode(self, args, lhs): children = [] for arg in args: if isinstance(arg, self.AST): children.append(arg) else: children.append(self.terminal(arg)) return self.nonterminal(lhs, children) def terminal(self, token): return token def nonterminal(self, type, args): rv = self.AST(type) rv[:len(args)] = args return rv # # GenericASTTraversal is a Visitor pattern according to Design Patterns. For # each node it attempts to invoke the method n_, falling # back onto the default() method if the n_* can't be found. The preorder # traversal also looks for an exit hook named n__exit (no default # routine is called if it's not found). To prematurely halt traversal # of a subtree, call the prune() method -- this only makes sense for a # preorder traversal. Node type is determined via the typestring() method. # class GenericASTTraversalPruningException: pass class GenericASTTraversal: def __init__(self, ast): self.ast = ast def typestring(self, node): return node.type def prune(self): raise GenericASTTraversalPruningException def preorder(self, node=None): if node is None: node = self.ast try: name = 'n_' + self.typestring(node) if hasattr(self, name): func = getattr(self, name) func(node) else: self.default(node) except GenericASTTraversalPruningException: return for kid in node: self.preorder(kid) name = name + '_exit' if hasattr(self, name): func = getattr(self, name) func(node) def postorder(self, node=None): if node is None: node = self.ast for kid in node: self.postorder(kid) name = 'n_' + self.typestring(node) if hasattr(self, name): func = getattr(self, name) func(node) else: self.default(node) def default(self, node): pass # # GenericASTMatcher. AST nodes must have "__getitem__" and "__cmp__" # implemented. # # XXX - makes assumptions about how GenericParser walks the parse tree. # class GenericASTMatcher(GenericParser): def __init__(self, start, ast): GenericParser.__init__(self, start) self.ast = ast def preprocess(self, rule, func): rebind = lambda func, self=self: \ lambda args, func=func, self=self: \ self.foundMatch(args, func) lhs, rhs = rule rhslist = list(rhs) rhslist.reverse() return (lhs, tuple(rhslist)), rebind(func) def foundMatch(self, args, func): func(args[-1]) return args[-1] def match_r(self, node): self.input.insert(0, node) children = 0 for child in node: if children == 0: self.input.insert(0, '(') children = children + 1 self.match_r(child) if children > 0: self.input.insert(0, ')') def match(self, ast=None): if ast is None: ast = self.ast self.input = [] self.match_r(ast) self.parse(self.input) def resolve(self, list): # # Resolve ambiguity in favor of the longest RHS. # return list[-1] def _dump(tokens, sets, states): for i in range(len(sets)): print 'set', i for item in sets[i]: print '\t', item for (lhs, rhs), pos in states[item[0]].items: print '\t\t', lhs, '::=', print string.join(rhs[:pos]), print '.', print string.join(rhs[pos:]) if i < len(tokens): print print 'token', str(tokens[i]) print From jhylton@users.sourceforge.net Sun Jul 7 18:37:25 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:37:25 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.86,1.86.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv29437 Modified Files: Tag: ast-branch Makefile.pre.in Log Message: Add commands to generate and build with AST code XXX The Python-ast.h/.c files are generated, but I'm going to keep tem under CVS, too. Otherwise a Python build would require an existing Python install. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.86 retrieving revision 1.86.2.1 diff -C2 -d -r1.86 -r1.86.2.1 *** Makefile.pre.in 21 Jun 2002 14:48:36 -0000 1.86 --- Makefile.pre.in 7 Jul 2002 17:37:22 -0000 1.86.2.1 *************** *** 194,198 **** Parser/tokenizer.o \ Parser/bitset.o \ ! Parser/metagrammar.o PARSER_OBJS= $(POBJS) Parser/myreadline.o --- 194,198 ---- Parser/tokenizer.o \ Parser/bitset.o \ ! Parser/metagrammar.o PARSER_OBJS= $(POBJS) Parser/myreadline.o *************** *** 209,216 **** --- 209,227 ---- PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS) + ########################################################################## + # AST + AST_H= $(srcdir)/Include/Python-ast.h + AST_C= $(srcdir)/Python/Python-ast.c + AST_ASDL= $(srcdir)/Parser/Python.asdl + + # XXX Note that a build now requires Python exist before the build starts + ASDLGEN= $(srcdir)/Parser/asdl_c.py -h $(srcdir)/Include -c $(srcdir)/Python ########################################################################## # Python PYTHON_OBJS= \ + Python/Python-ast.o \ + Python/asdl.o \ + Python/ast.o \ Python/bltinmodule.o \ Python/exceptions.o \ *************** *** 417,422 **** Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c ! Python/compile.o Python/symtable.o: $(GRAMMAR_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c --- 428,435 ---- Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c + $(AST_H) $(AST_C): $(AST_ASDL) + $(ASDLGEN) $(AST_ASDL) ! Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c *************** *** 434,437 **** --- 447,452 ---- PYTHON_HEADERS= \ Include/Python.h \ + Include/Python-ast.h \ + Include/asdl.h \ Include/abstract.h \ Include/boolobject.h \ From jhylton@users.sourceforge.net Sun Jul 7 18:37:52 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:37:52 -0700 Subject: [Python-checkins] python/dist/src/Parser .cvsignore,2.1,2.1.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv29684/Parser Modified Files: Tag: ast-branch .cvsignore Log Message: ignore .pyc files for asdl code Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/.cvsignore,v retrieving revision 2.1 retrieving revision 2.1.30.1 diff -C2 -d -r2.1 -r2.1.30.1 *** .cvsignore 2 May 2000 18:34:01 -0000 2.1 --- .cvsignore 7 Jul 2002 17:37:50 -0000 2.1.30.1 *************** *** 2,3 **** --- 2,6 ---- pgen add2lib + asdl.pyc + asdl_c.pyc + spark.pyc From jhylton@users.sourceforge.net Sun Jul 7 18:39:25 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:39:25 -0700 Subject: [Python-checkins] python/dist/src/Python Python-ast.c,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30111/Python Added Files: Tag: ast-branch Python-ast.c Log Message: Add generated AST files --- NEW FILE: Python-ast.c --- /* File automatically generated by ../Parser/asdl_c.py */ #include "Python.h" #include "Python-ast.h" mod_ty Module(asdl_seq * body) { mod_ty p; p = (mod_ty)malloc(sizeof(*p)); if (!p) { PyErr_SetString(PyExc_MemoryError, "no memory"); return NULL; } p->kind = Module_kind; p->v.Module.body = body; return p; } [...1008 lines suppressed...] alias_ty alias(identifier name, identifier asname) { alias_ty p; if (!name) { PyErr_SetString(PyExc_ValueError, "field name is required for alias"); return NULL; } p = (alias_ty)malloc(sizeof(*p)); if (!p) { PyErr_SetString(PyExc_MemoryError, "no memory"); return NULL; } p->name = name; p->asname = asname; return p; } From jhylton@users.sourceforge.net Sun Jul 7 18:39:24 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:39:24 -0700 Subject: [Python-checkins] python/dist/src/Include Python-ast.h,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv30111/Include Added Files: Tag: ast-branch Python-ast.h Log Message: Add generated AST files --- NEW FILE: Python-ast.h --- /* File automatically generated by ../Parser/asdl_c.py */ #include "asdl.h" typedef struct _mod *mod_ty; typedef struct _stmt *stmt_ty; typedef struct _expr *expr_ty; typedef enum _expr_context { Load=1, Store=2, Del=3, AugStore=4 } expr_context_ty; typedef struct _slice *slice_ty; typedef enum _boolop { And=1, Or=2 } boolop_ty; typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7, RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 } operator_ty; typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, In=9, NotIn=10 } cmpop_ty; typedef struct _listcomp *listcomp_ty; typedef struct _excepthandler *excepthandler_ty; typedef struct _arguments *arguments_ty; typedef struct _keyword *keyword_ty; typedef struct _alias *alias_ty; struct _mod { enum { Module_kind=1, Interactive_kind=2, Expression_kind=3, Suite_kind=4 } kind; union { struct { asdl_seq *body; } Module; struct { stmt_ty body; } Interactive; struct { expr_ty body; } Expression; struct { asdl_seq *body; } Suite; } v; }; struct _stmt { enum { FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, Yield_kind=4, Delete_kind=5, Assign_kind=6, AugAssign_kind=7, Print_kind=8, For_kind=9, While_kind=10, If_kind=11, Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14, Assert_kind=15, Import_kind=16, ImportFrom_kind=17, Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21, Break_kind=22, Continue_kind=23 } kind; union { struct { identifier name; arguments_ty args; asdl_seq *body; } FunctionDef; struct { identifier name; asdl_seq *bases; asdl_seq *body; } ClassDef; struct { expr_ty value; } Return; struct { expr_ty value; } Yield; struct { asdl_seq *targets; } Delete; struct { asdl_seq *targets; expr_ty value; } Assign; struct { expr_ty target; operator_ty op; expr_ty value; } AugAssign; struct { expr_ty dest; asdl_seq *value; bool nl; } Print; struct { expr_ty target; expr_ty iter; asdl_seq *body; asdl_seq *orelse; } For; struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } While; struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } If; struct { expr_ty type; expr_ty inst; expr_ty tback; } Raise; struct { asdl_seq *body; asdl_seq *handlers; asdl_seq *orelse; } TryExcept; struct { asdl_seq *body; asdl_seq *finalbody; } TryFinally; struct { expr_ty test; expr_ty msg; } Assert; struct { asdl_seq *names; } Import; struct { identifier module; asdl_seq *names; } ImportFrom; struct { expr_ty body; expr_ty globals; expr_ty locals; } Exec; struct { asdl_seq *names; } Global; struct { expr_ty value; } Expr; } v; int lineno; }; struct _expr { enum { BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, Dict_kind=5, ListComp_kind=6, Compare_kind=7, Call_kind=8, Repr_kind=9, Num_kind=10, Str_kind=11, Attribute_kind=12, Subscript_kind=13, Name_kind=14, List_kind=15, Tuple_kind=16 } kind; union { struct { boolop_ty op; asdl_seq *values; } BoolOp; struct { expr_ty left; operator_ty op; expr_ty right; } BinOp; struct { unaryop_ty op; expr_ty operand; } UnaryOp; struct { arguments_ty args; expr_ty body; } Lambda; struct { asdl_seq *keys; asdl_seq *values; } Dict; struct { expr_ty target; asdl_seq *generators; } ListComp; struct { expr_ty left; asdl_seq *ops; asdl_seq *comparators; } Compare; struct { expr_ty func; asdl_seq *args; asdl_seq *keywords; expr_ty starargs; expr_ty kwargs; } Call; struct { expr_ty value; } Repr; struct { object n; } Num; struct { string s; } Str; struct { expr_ty value; identifier attr; expr_context_ty ctx; } Attribute; struct { expr_ty value; slice_ty slice; expr_context_ty ctx; } Subscript; struct { identifier id; expr_context_ty ctx; } Name; struct { asdl_seq *elts; expr_context_ty ctx; } List; struct { asdl_seq *elts; expr_context_ty ctx; } Tuple; } v; }; struct _slice { enum { Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4 } kind; union { struct { expr_ty lower; expr_ty upper; expr_ty step; } Slice; struct { asdl_seq *dims; } ExtSlice; struct { expr_ty value; } Index; } v; }; struct _listcomp { expr_ty target; expr_ty iter; asdl_seq *ifs; }; struct _excepthandler { expr_ty type; expr_ty name; asdl_seq *body; }; struct _arguments { asdl_seq *args; identifier vararg; identifier kwarg; asdl_seq *defaults; }; struct _keyword { identifier arg; expr_ty value; }; struct _alias { identifier name; identifier asname; }; mod_ty Module(asdl_seq * body); mod_ty Interactive(stmt_ty body); mod_ty Expression(expr_ty body); mod_ty Suite(asdl_seq * body); stmt_ty FunctionDef(identifier name, arguments_ty args, asdl_seq * body, int lineno); stmt_ty ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int lineno); stmt_ty Return(expr_ty value, int lineno); stmt_ty Yield(expr_ty value, int lineno); stmt_ty Delete(asdl_seq * targets, int lineno); stmt_ty Assign(asdl_seq * targets, expr_ty value, int lineno); stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno); stmt_ty Print(expr_ty dest, asdl_seq * value, bool nl, int lineno); stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int lineno); stmt_ty While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno); stmt_ty If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno); stmt_ty Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno); stmt_ty TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno); stmt_ty TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno); stmt_ty Assert(expr_ty test, expr_ty msg, int lineno); stmt_ty Import(asdl_seq * names, int lineno); stmt_ty ImportFrom(identifier module, asdl_seq * names, int lineno); stmt_ty Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno); stmt_ty Global(asdl_seq * names, int lineno); stmt_ty Expr(expr_ty value, int lineno); stmt_ty Pass(int lineno); stmt_ty Break(int lineno); stmt_ty Continue(int lineno); expr_ty BoolOp(boolop_ty op, asdl_seq * values); expr_ty BinOp(expr_ty left, operator_ty op, expr_ty right); expr_ty UnaryOp(unaryop_ty op, expr_ty operand); 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 starargs, expr_ty kwargs); expr_ty Repr(expr_ty value); expr_ty Num(object n); expr_ty Str(string s); expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx); expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx); expr_ty Name(identifier id, expr_context_ty ctx); expr_ty List(asdl_seq * elts, expr_context_ty ctx); expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx); slice_ty Ellipsis(void); slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step); slice_ty ExtSlice(asdl_seq * dims); slice_ty Index(expr_ty value); listcomp_ty listcomp(expr_ty target, expr_ty iter, asdl_seq * ifs); excepthandler_ty excepthandler(expr_ty type, expr_ty name, asdl_seq * body); arguments_ty arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq * defaults); keyword_ty keyword(identifier arg, expr_ty value); alias_ty alias(identifier name, identifier asname); From jhylton@users.sourceforge.net Sun Jul 7 18:43:10 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:43:10 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.161,2.161.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31177/Python Modified Files: Tag: ast-branch pythonrun.c Log Message: New preferred interface to parser is: PyParser_ASTFromString PyParser_ASTFromFile Incorporates logic of theller's pending patch -- filename is passed as arg to String version. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161 retrieving revision 2.161.2.1 diff -C2 -d -r2.161 -r2.161.2.1 *** pythonrun.c 30 Jun 2002 15:26:10 -0000 2.161 --- pythonrun.c 7 Jul 2002 17:43:08 -0000 2.161.2.1 *************** *** 4,7 **** --- 4,8 ---- #include "Python.h" + #include "Python-ast.h" #include "grammar.h" #include "node.h" *************** *** 11,14 **** --- 12,16 ---- #include "compile.h" #include "symtable.h" + #include "ast.h" #include "eval.h" #include "marshal.h" *************** *** 1154,1157 **** --- 1156,1185 ---- PyNode_Free(n); return st; + } + + /* Preferred access to parser is through AST. */ + mod_ty + PyParser_ASTFromString(char *s, char *filename, grammar *g, int start, + perrdetail *err_ret, int flags) + { + node *n; + n = PyParser_ParseStringFlags(s, g, start, err_ret, flags); + if (n) + return PyAST_FromNode(n); + else + return NULL; + } + + mod_ty + PyParser_ASTFromFile(FILE *fp, char *filename, grammar *g, int start, + char *ps1, char *ps2, perrdetail *err_ret, int flags) + { + node *n; + n = PyParser_ParseFileFlags(fp, filename, g, start, ps1, ps2, + err_ret, flags); + if (n) + return PyAST_FromNode(n); + else + return NULL; } From jhylton@users.sourceforge.net Sun Jul 7 18:43:10 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:43:10 -0700 Subject: [Python-checkins] python/dist/src/Include parsetok.h,2.17,2.17.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv31177/Include Modified Files: Tag: ast-branch parsetok.h Log Message: New preferred interface to parser is: PyParser_ASTFromString PyParser_ASTFromFile Incorporates logic of theller's pending patch -- filename is passed as arg to String version. Index: parsetok.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/parsetok.h,v retrieving revision 2.17 retrieving revision 2.17.2.1 diff -C2 -d -r2.17 -r2.17.2.1 *** parsetok.h 22 Mar 2002 23:52:35 -0000 2.17 --- parsetok.h 7 Jul 2002 17:43:07 -0000 2.17.2.1 *************** *** 33,36 **** --- 33,41 ---- perrdetail *, int); + extern DL_IMPORT(mod_ty) PyParser_ASTFromString(char *, char *, grammar *, + int, perrdetail *, int); + extern DL_IMPORT(mod_ty) PyParser_ASTFromFile(FILE *, char *, grammar *, + int, char *, char *, + perrdetail *, int); #ifdef __cplusplus } From jhylton@users.sourceforge.net Sun Jul 7 18:44:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:44:11 -0700 Subject: [Python-checkins] python/dist/src/Include pyerrors.h,2.54,2.54.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv31629/Include Modified Files: Tag: ast-branch pyerrors.h Log Message: Add some constification. Perhaps this is a distraction from the real AST changes. Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.54 retrieving revision 2.54.2.1 diff -C2 -d -r2.54 -r2.54.2.1 *** pyerrors.h 29 May 2002 15:54:54 -0000 2.54 --- pyerrors.h 7 Jul 2002 17:44:09 -0000 2.54.2.1 *************** *** 100,105 **** /* Issue a warning or exception */ extern DL_IMPORT(int) PyErr_Warn(PyObject *, char *); ! extern DL_IMPORT(int) PyErr_WarnExplicit(PyObject *, char *, ! char *, int, char *, PyObject *); /* In sigcheck.c or signalmodule.c */ --- 100,105 ---- /* Issue a warning or exception */ extern DL_IMPORT(int) PyErr_Warn(PyObject *, char *); ! extern DL_IMPORT(int) PyErr_WarnExplicit(PyObject *, char *, const char *, ! int, char *, PyObject *); /* In sigcheck.c or signalmodule.c */ *************** *** 108,113 **** /* Support for adding program text to SyntaxErrors */ ! extern DL_IMPORT(void) PyErr_SyntaxLocation(char *, int); ! extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); /* These APIs aren't really part of the error implementation, but --- 108,113 ---- /* Support for adding program text to SyntaxErrors */ ! extern DL_IMPORT(void) PyErr_SyntaxLocation(const char *, int); ! extern DL_IMPORT(PyObject *) PyErr_ProgramText(const char *, int); /* These APIs aren't really part of the error implementation, but From jhylton@users.sourceforge.net Sun Jul 7 18:44:12 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:44:12 -0700 Subject: [Python-checkins] python/dist/src/Python errors.c,2.70,2.70.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31629/Python Modified Files: Tag: ast-branch errors.c Log Message: Add some constification. Perhaps this is a distraction from the real AST changes. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.70 retrieving revision 2.70.2.1 diff -C2 -d -r2.70 -r2.70.2.1 *** errors.c 30 Jun 2002 15:26:10 -0000 2.70 --- errors.c 7 Jul 2002 17:44:09 -0000 2.70.2.1 *************** *** 534,538 **** int PyErr_WarnExplicit(PyObject *category, char *message, ! char *filename, int lineno, char *module, PyObject *registry) { --- 534,538 ---- int PyErr_WarnExplicit(PyObject *category, char *message, ! const char *filename, int lineno, char *module, PyObject *registry) { *************** *** 575,579 **** void ! PyErr_SyntaxLocation(char *filename, int lineno) { PyObject *exc, *v, *tb, *tmp; --- 575,579 ---- void ! PyErr_SyntaxLocation(const char *filename, int lineno) { PyObject *exc, *v, *tb, *tmp; *************** *** 639,643 **** PyObject * ! PyErr_ProgramText(char *filename, int lineno) { FILE *fp; --- 639,643 ---- PyObject * ! PyErr_ProgramText(const char *filename, int lineno) { FILE *fp; From jhylton@users.sourceforge.net Sun Jul 7 18:47:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:47:44 -0700 Subject: [Python-checkins] python/dist/src/Modules symtablemodule.c,1.5,1.5.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv579/Modules Modified Files: Tag: ast-branch symtablemodule.c Log Message: checkin of partial progress: Revise symtable to use AST. Move the code to symtable.c in the process. Haven't yet nuked the old code in compile.c. Note that this code doesn't even compile. Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** symtablemodule.c 6 Dec 2001 14:34:58 -0000 1.5 --- symtablemodule.c 7 Jul 2002 17:47:42 -0000 1.5.8.1 *************** *** 2,5 **** --- 2,6 ---- #include "compile.h" + #include "Python-ast.h" #include "symtable.h" *************** *** 63,69 **** PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); ! PyModule_AddIntConstant(m, "TYPE_FUNCTION", TYPE_FUNCTION); ! PyModule_AddIntConstant(m, "TYPE_CLASS", TYPE_CLASS); ! PyModule_AddIntConstant(m, "TYPE_MODULE", TYPE_MODULE); PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); --- 64,70 ---- PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); ! PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionScope); ! PyModule_AddIntConstant(m, "TYPE_CLASS", ClassScope); ! PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleScope); PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); From jhylton@users.sourceforge.net Sun Jul 7 18:47:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:47:44 -0700 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.9,2.9.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv579/Include Modified Files: Tag: ast-branch symtable.h Log Message: checkin of partial progress: Revise symtable to use AST. Move the code to symtable.c in the process. Haven't yet nuked the old code in compile.c. Note that this code doesn't even compile. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9 retrieving revision 2.9.18.1 diff -C2 -d -r2.9 -r2.9.18.1 *** symtable.h 11 Aug 2001 21:51:17 -0000 2.9 --- symtable.h 7 Jul 2002 17:47:41 -0000 2.9.18.1 *************** *** 5,19 **** #endif ! /* A symbol table is constructed each time PyNode_Compile() is ! called. The table walks the entire parse tree and identifies each ! use or definition of a variable. ! ! The symbol table contains a dictionary for each code block in a ! module: The symbol dictionary for the block. They keys of these ! dictionaries are the name of all variables used or defined in the ! block; the integer values are used to store several flags, ! e.g. DEF_PARAM indicates that a variable is a parameter to a ! function. ! */ struct _symtable_entry; --- 5,10 ---- #endif ! typedef enum _scope_type { FunctionScope, ClassScope, ModuleScope } ! scope_ty; struct _symtable_entry; *************** *** 21,25 **** struct symtable { int st_pass; /* pass == 1 or 2 */ ! char *st_filename; /* name of file being compiled */ struct _symtable_entry *st_cur; /* current symbol table entry */ PyObject *st_symbols; /* dictionary of symbol table entries */ --- 12,16 ---- struct symtable { int st_pass; /* pass == 1 or 2 */ ! const char *st_filename; /* name of file being compiled */ struct _symtable_entry *st_cur; /* current symbol table entry */ PyObject *st_symbols; /* dictionary of symbol table entries */ *************** *** 40,44 **** PyObject *ste_varnames; /* list of variable names */ PyObject *ste_children; /* list of child ids */ ! int ste_type; /* module, class, or function */ int ste_lineno; /* first line of scope */ int ste_optimized; /* true if namespace can't be optimized */ --- 31,35 ---- PyObject *ste_varnames; /* list of variable names */ PyObject *ste_children; /* list of child ids */ ! scope_ty ste_type; /* module, class, or function */ int ste_lineno; /* first line of scope */ int ste_optimized; /* true if namespace can't be optimized */ *************** *** 55,67 **** #define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type) ! extern DL_IMPORT(PyObject *) PySymtableEntry_New(struct symtable *, ! char *, int, int); DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); DL_IMPORT(void) PySymtable_Free(struct symtable *); - - #define TOP "global" - /* Flags for def-use information */ --- 46,56 ---- #define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type) ! extern DL_IMPORT(PySymtableEntryObject *) \ ! PySymtableEntry_New(struct symtable *, identifier, scope_ty, void *, ! int); DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); DL_IMPORT(void) PySymtable_Free(struct symtable *); /* Flags for def-use information */ *************** *** 79,86 **** #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) - - #define TYPE_FUNCTION 1 - #define TYPE_CLASS 2 - #define TYPE_MODULE 3 #define LOCAL 1 --- 68,71 ---- From jhylton@users.sourceforge.net Sun Jul 7 18:47:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 10:47:44 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.247,2.247.2.1 future.c,2.12,2.12.2.1 symtable.c,2.10,2.10.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv579/Python Modified Files: Tag: ast-branch compile.c future.c symtable.c Log Message: checkin of partial progress: Revise symtable to use AST. Move the code to symtable.c in the process. Haven't yet nuked the old code in compile.c. Note that this code doesn't even compile. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.247 retrieving revision 2.247.2.1 diff -C2 -d -r2.247 -r2.247.2.1 *** compile.c 20 Jun 2002 22:23:14 -0000 2.247 --- compile.c 7 Jul 2002 17:47:42 -0000 2.247.2.1 *************** *** 12,15 **** --- 12,16 ---- #include "Python.h" + #include "Python-ast.h" #include "node.h" #include "token.h" *************** *** 1012,1016 **** switch (reftype) { case LOCAL: ! if (c->c_symtable->st_cur->ste_type == TYPE_FUNCTION) scope = NAME_LOCAL; break; --- 1013,1017 ---- switch (reftype) { case LOCAL: ! if (c->c_symtable->st_cur->ste_type == FunctionScope) scope = NAME_LOCAL; break; *************** *** 4096,4099 **** --- 4097,4107 ---- PyCodeObject * + PyAST_Compile(mod_ty mod, char *filename, PyCompilerFlags *flags) + { + /* XXX */ + return NULL; + } + + PyCodeObject * PyNode_Compile(node *n, char *filename) { *************** *** 4110,4113 **** --- 4118,4123 ---- PyNode_CompileSymtable(node *n, char *filename) { + return NULL; + /* XXX struct symtable *st; PyFutureFeatures *ff; *************** *** 4136,4139 **** --- 4146,4150 ---- PySymtable_Free(st); return NULL; + */ } *************** *** 4157,4161 **** /* c_symtable still points to parent's symbols */ if (base->c_nested ! || (sc.c_symtable->st_cur->ste_type == TYPE_FUNCTION)) sc.c_nested = 1; sc.c_flags |= base->c_flags & PyCF_MASK; --- 4168,4172 ---- /* c_symtable still points to parent's symbols */ if (base->c_nested ! || (sc.c_symtable->st_cur->ste_type == FunctionScope)) sc.c_nested = 1; sc.c_flags |= base->c_flags & PyCF_MASK; *************** *** 4295,4299 **** static int ! issue_warning(char *msg, char *filename, int lineno) { if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, filename, --- 4306,4310 ---- static int ! issue_warning(char *msg, const char *filename, int lineno) { if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, filename, *************** *** 4321,4343 **** static int - symtable_build(struct compiling *c, node *n) - { - if ((c->c_symtable = symtable_init()) == NULL) - return -1; - c->c_symtable->st_future = c->c_future; - c->c_symtable->st_filename = c->c_filename; - symtable_enter_scope(c->c_symtable, TOP, TYPE(n), n->n_lineno); - if (c->c_symtable->st_errors > 0) - return -1; - symtable_node(c->c_symtable, n); - if (c->c_symtable->st_errors > 0) - return -1; - /* reset for second pass */ - c->c_symtable->st_nscopes = 1; - c->c_symtable->st_pass = 2; - return 0; - } - - static int symtable_init_compiling_symbols(struct compiling *c) { --- 4332,4335 ---- *************** *** 4394,4398 **** method and a free variable with the same name. */ ! if (c->c_symtable->st_cur->ste_type == TYPE_FUNCTION) { /* If it isn't declared locally, it can't be a cell. */ if (!(flags & (DEF_LOCAL | DEF_PARAM))) --- 4386,4390 ---- method and a free variable with the same name. */ ! if (c->c_symtable->st_cur->ste_type == FunctionScope) { /* If it isn't declared locally, it can't be a cell. */ if (!(flags & (DEF_LOCAL | DEF_PARAM))) *************** *** 4585,4591 **** if (ste->ste_generator) c->c_flags |= CO_GENERATOR; ! if (ste->ste_type != TYPE_MODULE) c->c_flags |= CO_NEWLOCALS; ! if (ste->ste_type == TYPE_FUNCTION) { c->c_nlocals = si->si_nlocals; if (ste->ste_optimized == 0) --- 4577,4583 ---- if (ste->ste_generator) c->c_flags |= CO_GENERATOR; ! if (ste->ste_type != ModuleScope) c->c_flags |= CO_NEWLOCALS; ! if (ste->ste_type == FunctionScope) { c->c_nlocals = si->si_nlocals; if (ste->ste_optimized == 0) *************** *** 4677,4681 **** goto fail; Py_DECREF(v); ! if (ste->ste_type != TYPE_CLASS) if (PyList_Append(c->c_varnames, name) < 0) goto fail; --- 4669,4673 ---- goto fail; Py_DECREF(v); ! if (ste->ste_type != ClassScope) if (PyList_Append(c->c_varnames, name) < 0) goto fail; *************** *** 4775,4779 **** PySymtableEntryObject *child, *ste = st->st_cur; ! if (ste->ste_type == TYPE_CLASS) def = DEF_FREE_CLASS; else --- 4767,4771 ---- PySymtableEntryObject *child, *ste = st->st_cur; ! if (ste->ste_type == ClassScope) def = DEF_FREE_CLASS; else *************** *** 4814,4818 **** nested scopes. */ ! if (v && (ste->ste_type != TYPE_CLASS)) { int flags = PyInt_AS_LONG(v); if (flags & DEF_GLOBAL) { --- 4806,4810 ---- nested scopes. */ ! if (v && (ste->ste_type != ClassScope)) { int flags = PyInt_AS_LONG(v); if (flags & DEF_GLOBAL) { *************** *** 4854,4858 **** PySymtableEntryObject *ste = st->st_cur; ! if (ste->ste_type == TYPE_CLASS) return symtable_undo_free(st, child, name); o = PyDict_GetItem(ste->ste_symbols, name); --- 4846,4850 ---- PySymtableEntryObject *ste = st->st_cur; ! if (ste->ste_type == ClassScope) return symtable_undo_free(st, child, name); o = PyDict_GetItem(ste->ste_symbols, name); *************** *** 4904,4953 **** } - /* symtable_enter_scope() gets a reference via PySymtableEntry_New(). - This reference is released when the scope is exited, via the DECREF - in symtable_exit_scope(). - */ - - static int - symtable_exit_scope(struct symtable *st) - { - int end; - - if (st->st_pass == 1) - symtable_update_free_vars(st); - Py_DECREF(st->st_cur); - end = PyList_GET_SIZE(st->st_stack) - 1; - st->st_cur = (PySymtableEntryObject *)PyList_GET_ITEM(st->st_stack, - end); - if (PySequence_DelItem(st->st_stack, end) < 0) - return -1; - return 0; - } - - static void - symtable_enter_scope(struct symtable *st, char *name, int type, - int lineno) - { - PySymtableEntryObject *prev = NULL; - - if (st->st_cur) { - prev = st->st_cur; - if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { - Py_DECREF(st->st_cur); - st->st_errors++; - return; - } - } - st->st_cur = (PySymtableEntryObject *) - PySymtableEntry_New(st, name, type, lineno); - if (strcmp(name, TOP) == 0) - st->st_global = st->st_cur->ste_symbols; - if (prev && st->st_pass == 1) { - if (PyList_Append(prev->ste_children, - (PyObject *)st->st_cur) < 0) - st->st_errors++; - } - } - static int symtable_lookup(struct symtable *st, char *name) --- 4896,4899 ---- *************** *** 5455,5459 **** } if (TYPE(CHILD(n, 3)) == STAR) { ! if (st->st_cur->ste_type != TYPE_MODULE) { if (symtable_warn(st, "import * only allowed at module level") < 0) --- 5401,5405 ---- } if (TYPE(CHILD(n, 3)) == STAR) { ! if (st->st_cur->ste_type != ModuleScope) { if (symtable_warn(st, "import * only allowed at module level") < 0) Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.12 retrieving revision 2.12.2.1 diff -C2 -d -r2.12 -r2.12.2.1 *** future.c 12 Apr 2002 01:20:10 -0000 2.12 --- future.c 7 Jul 2002 17:47:42 -0000 2.12.2.1 *************** *** 1,3 **** --- 1,4 ---- #include "Python.h" + #include "Python-ast.h" #include "node.h" #include "token.h" Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10 retrieving revision 2.10.8.1 diff -C2 -d -r2.10 -r2.10.8.1 *** symtable.c 10 Dec 2001 00:53:18 -0000 2.10 --- symtable.c 7 Jul 2002 17:47:42 -0000 2.10.8.1 *************** *** 1,36 **** #include "Python.h" #include "compile.h" #include "symtable.h" - #include "graminit.h" #include "structmember.h" ! /* The compiler uses this function to load a PySymtableEntry object ! for a code block. Each block is loaded twice, once during the ! symbol table pass and once during the code gen pass. Entries ! created during the first pass are cached for the second pass, using ! the st_symbols dictionary. ! ! The cache is keyed by st_nscopes. Each code block node in a ! module's parse tree can be assigned a unique id based on the order ! in which the nodes are visited by the compiler. This strategy ! works so long as the symbol table and codegen passes visit the same ! nodes in the same order. ! */ ! ! ! PyObject * ! PySymtableEntry_New(struct symtable *st, char *name, int type, int lineno) { PySymtableEntryObject *ste = NULL; PyObject *k, *v; ! k = PyInt_FromLong(st->st_nscopes++); if (k == NULL) goto fail; v = PyDict_GetItem(st->st_symbols, k); if (v) { Py_DECREF(k); Py_INCREF(v); ! return v; } --- 1,24 ---- #include "Python.h" + #include "Python-ast.h" #include "compile.h" #include "symtable.h" #include "structmember.h" ! PySymtableEntryObject * ! PySymtableEntry_New(struct symtable *st, identifier name, scope_ty scope, ! void *key, int lineno) { PySymtableEntryObject *ste = NULL; PyObject *k, *v; ! k = PyLong_FromVoidPtr(key); if (k == NULL) goto fail; v = PyDict_GetItem(st->st_symbols, k); if (v) { + assert(PySymtableEntry_Check(v)); Py_DECREF(k); Py_INCREF(v); ! return (PySymtableEntryObject *)v; } *************** *** 40,47 **** ste->ste_id = k; ! v = PyString_FromString(name); ! if (v == NULL) ! goto fail; ! ste->ste_name = v; v = PyDict_New(); --- 28,33 ---- ste->ste_id = k; ! ste->ste_name = name; ! Py_INCREF(name); v = PyDict_New(); *************** *** 60,85 **** ste->ste_children = v; ste->ste_optimized = 0; ste->ste_opt_lineno = 0; ste->ste_lineno = lineno; - switch (type) { - case funcdef: - case lambdef: - ste->ste_type = TYPE_FUNCTION; - break; - case classdef: - ste->ste_type = TYPE_CLASS; - break; - case single_input: - case eval_input: - case file_input: - ste->ste_type = TYPE_MODULE; - break; - } if (st->st_cur == NULL) ste->ste_nested = 0; else if (st->st_cur->ste_nested ! || st->st_cur->ste_type == TYPE_FUNCTION) ste->ste_nested = 1; else --- 46,58 ---- ste->ste_children = v; + ste->ste_type = scope; ste->ste_optimized = 0; ste->ste_opt_lineno = 0; ste->ste_lineno = lineno; if (st->st_cur == NULL) ste->ste_nested = 0; else if (st->st_cur->ste_nested ! || st->st_cur->ste_type == FunctionScope) ste->ste_nested = 1; else *************** *** 91,95 **** goto fail; ! return (PyObject *)ste; fail: Py_XDECREF(ste); --- 64,68 ---- goto fail; ! return ste; fail: Py_XDECREF(ste); *************** *** 178,179 **** --- 151,523 ---- 0, /* tp_new */ }; + + static int symtable_enter_scope(struct symtable *st, identifier name, + scope_ty scope, void *ast, int lineno); + static int symtable_exit_scope(struct symtable *st, void *ast); + static int symtable_visit_stmt(struct symtable *st, stmt_ty s); + static int symtable_visit_stmts(struct symtable *st, asdl_seq *seq); + static int symtable_visit_expr(struct symtable *st, expr_ty s); + static int symtable_visit_exprs(struct symtable *st, asdl_seq *seq); + + static identifier top = NULL, lambda = NULL; + + #define GET_IDENTIFIER(VAR) \ + ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) + + static struct symtable * + symtable_new(void) + { + struct symtable *st; + + st = (struct symtable *)PyMem_Malloc(sizeof(struct symtable)); + if (st == NULL) + return NULL; + + st->st_filename = NULL; + if ((st->st_stack = PyList_New(0)) == NULL) + goto fail; + if ((st->st_symbols = PyDict_New()) == NULL) + goto fail; + st->st_cur = NULL; + st->st_errors = 0; + st->st_tmpname = 0; + st->st_private = NULL; + return st; + fail: + PySymtable_Free(st); + return NULL; + } + + void + PySymtable_Free(struct symtable *st) + { + Py_XDECREF(st->st_symbols); + Py_XDECREF(st->st_stack); + Py_XDECREF(st->st_cur); + PyMem_Free((void *)st); + } + + struct symtable * + PySymtable_Build(mod_ty mod, const char *filename, PyFutureFeatures *future) + { + struct symtable *st = symtable_new(); + + if (st == NULL) + return st; + st->st_filename = filename; + st->st_future = future; + /* XXX not a stmt_ty */ + symtable_enter_scope(st, GET_IDENTIFIER(top), + ModuleScope, (void *)mod, 0); + /* Any other top-level initialization? */ + if (mod->kind == Module_kind) + symtable_visit_stmts(st, mod->v.Module.body); + /* XXX not a stmt_ty */ + symtable_exit_scope(st, (void *)mod); + return st; + } + + + /* symtable_enter_scope() gets a reference via PySymtableEntry_New(). + This reference is released when the scope is exited, via the DECREF + in symtable_exit_scope(). + */ + + static int + symtable_exit_scope(struct symtable *st, void *ast) + { + int end; + + if (st->st_pass == 1) + symtable_update_free_vars(st); + Py_DECREF(st->st_cur); + end = PyList_GET_SIZE(st->st_stack) - 1; + st->st_cur = (PySymtableEntryObject *)PyList_GET_ITEM(st->st_stack, + end); + if (PySequence_DelItem(st->st_stack, end) < 0) + return -1; + return 0; + } + + static int + symtable_enter_scope(struct symtable *st, identifier name, scope_ty scope, + void *ast, int lineno) + { + PySymtableEntryObject *prev = NULL; + + if (st->st_cur) { + prev = st->st_cur; + if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { + Py_DECREF(st->st_cur); + st->st_errors++; + return 0; + } + } + st->st_cur = PySymtableEntry_New(st, name, scope, ast, lineno); + if (name == GET_IDENTIFIER(top)) + st->st_global = st->st_cur->ste_symbols; + if (prev && st->st_pass == 1) { + if (PyList_Append(prev->ste_children, + (PyObject *)st->st_cur) < 0) { + st->st_errors++; + return 0; + } + } + return 1; + } + + /* macros to help visit expressions that result in def or use + will return 0 from current function on error. + */ + #define V_EXPR(ST, E) { \ + if (!symtable_visit_expr((ST), (E))) \ + return 0; \ + } + + #define V_EXPRS(ST, LE) { \ + if (!symtable_visit_exprs((ST), (LE))) \ + return 0; \ + } + + #define V_STMTS(ST, LS) { \ + if (!symtable_visit_stmts((ST), (LS))) \ + return 0; \ + } + + static int + symtable_visit_stmts(struct symtable *st, asdl_seq *seq) + { + int i; + for (i = 0; i < asdl_seq_LEN(seq); i++) { + stmt_ty s = asdl_seq_get(seq, i); + if (!symtable_visit_stmt(st, s)) + return 0; + } + return 1; + } + + static int + symtable_visit_stmt(struct symtable *st, stmt_ty s) + { + switch (s->kind) { + case FunctionDef_kind: + symtable_add_def_o(st, s->v.FunctionDef.name, DEF_LOCAL); + if (!symtable_visit_arguments(st, s->v.FunctionDef.args)) + return 0; + symtable_enter_scope(st, s->v.FunctionDef.name, FunctionScope, + (void *)s, s->lineno); + V_STMTS(st, s->v.FunctionDef.body); + symtable_exit_scope(st, s); + break; + case ClassDef_kind: + symtable_add_def_o(st, s->v.ClassDef.name, DEF_LOCAL); + V_EXPRS(st, s->v.ClassDef.bases); + symtable_enter_scope(st, s->v.ClassDef.name, ClassScope, + (void *)s, s->lineno); + V_STMTS(st, s->v.ClassDef.body); + symtable_exit_scope(st, s); + break; + case Return_kind: + if (s->v.Return.value) + V_EXPR(st, s->v.Return.value); + break; + case Yield_kind: + V_EXPR(st, s->v.Yield.value); + break; + case Delete_kind: + V_EXPRS(st, s->v.Delete.targets); + break; + case Assign_kind: + V_EXPRS(st, s->v.Assign.targets); + V_EXPR(st, s->v.Assign.value); + break; + case AugAssign_kind: + V_EXPR(st, s->v.AugAssign.target); + V_EXPR(st, s->v.AugAssign.value); + break; + case Print_kind: + if (s->v.Print.dest) + V_EXPR(st, s->v.Print.dest); + V_EXPRS(st, s->v.Print.value); + break; + case For_kind: + V_EXPR(st, s->v.For.target); + V_EXPR(st, s->v.For.iter); + V_STMTS(st, s->v.For.body); + if (s->v.For.orelse) + V_STMTS(st, s->v.For.orelse); + break; + case While_kind: + V_EXPR(st, s->v.While.test); + V_STMTS(st, s->v.While.body); + if (s->v.While.orelse) + V_STMTS(st, s->v.While.orelse); + break; + case If_kind: + V_EXPR(st, s->v.If.test); + V_STMTS(st, s->v.If.body); + if (s->v.If.orelse) + V_STMTS(st, s->v.If.orelse); + break; + case Raise_kind: + if (s->v.Raise.type) { + V_EXPR(st, s->v.Raise.type); + if (s->v.Raise.inst) { + V_EXPR(st, s->v.Raise.inst); + if (s->v.Raise.tback) + V_EXPR(st, s->v.Raise.tback); + } + } + break; + case TryExcept_kind: + V_STMTS(st, s->v.TryExcept.body); + V_STMTS(st, s->v.TryExcept.orelse); + if (!symtable_visit_excepthandles(st, s->v.TryExcept.handlers)) + return 0; + break; + case TryFinally_kind: + V_STMTS(st, s->v.TryFinally.body); + V_STMTS(st, s->v.TryFinally.finalbody); + break; + case Assert_kind: + V_EXPR(st, s->v.Assert.test); + if (s->v.Assert.msg) + V_EXPR(st, s->v.Assert.msg); + break; + case Import_kind: + if (!symtable_visit_aliases(st, s->v.Import.names)) + return 0; + break; + case ImportFrom_kind: + if (!symtable_visit_aliases(st, s->v.ImportFrom.names)) + return 0; + break; + case Exec_kind: + V_EXPR(st, s->v.Exec.body); + if (s->v.Exec.globals) { + V_EXPR(st, s->v.Exec.globals); + if (s->v.Exec.locals) + V_EXPR(st, s->v.Exec.locals); + } + break; + case Global_kind: { + int i; + asdl_seq *seq = s->v.Global.names; + for (i = 0; i < asdl_seq_SIZE(seq); i++) + symtable_add_def_o(st, asdl_seq_get(seq, i), + DEF_GLOBAL); + + break; + } + case Expr_kind: + V_EXPR(st, s->v.Expr.value); + break; + case Pass_kind: + case Break_kind: + case Continue_kind: + /* nothing to do here */ + break; + default: + PyErr_Format(PyExc_AssertionError, + "invalid statement kind: %d\n", s->kind); + return 0; + } + return 1; + } + + static int + symtable_visit_exprs(struct symtable *st, asdl_seq *seq) + { + int i; + for (i = 0; i < asdl_seq_LEN(seq); i++) { + stmt_ty s = asdl_seq_get(seq, i); + if (!symtable_visit_expr(st, s)) + return 0; + } + return 1; + } + + static int + symtable_visit_expr(struct symtable *st, expr_ty e) + { + switch (e->kind) { + case BoolOp_kind: + V_EXPRS(st, e->v.BoolOp.values); + break; + case BinOp_kind: + V_EXPR(st, e->v.BinOp.left); + V_EXPR(st, e->v.BinOp.right); + break; + case UnaryOp_kind: + V_EXPR(st, e->v.UnaryOp.operand); + break; + case Lambda_kind: + symtable_add_def_o(st, GET_IDENTIFIER(lambda), DEF_LOCAL); + if (!symtable_visit_arguments(st, e->v.Lambda.args)) + return 0; + /* XXX need to make name an identifier + XXX how to get line numbers for expressions + */ + symtable_enter_scope(st, GET_IDENTIFIER(lambda), + FunctionScope, (void *)e, 0); + V_STMTS(st, e->v.Lambda.body); + symtable_exit_scope(st, (void *)e); + break; + case Dict_kind: + V_EXPRS(st, e->v.Dict.keys); + V_EXPRS(st, e->v.Dict.values); + break; + case ListComp_kind: + V_EXPR(st, e->v.ListComp.target); + if (!symtable_visit_listcomp(e->v.ListComp.generators)) + return 0; + break; + case Compare_kind: + V_EXPR(st, e->v.Compare.left); + V_EXPRS(st, e->v.Compare.comparators); + break; + case Call_kind: + V_EXPR(st, e->v.Call.func); + V_EXPRS(st, e->v.Call.args); + if (!symtable_visit_keyword(st, e->v.Call.keywords)) + return 0; + if (e->v.Call.starargs) + V_EXPR(st, e->v.Call.starargs); + if (e->v.Call.kwargs) + V_EXPR(st, e->v.Call.kwargs); + break; + case Repr_kind: + V_EXPR(st, e->v.Repr.value); + break; + case Num_kind: + case Str_kind: + /* Nothing to do here. */ + break; + /* The following exprs can be assignment targets. */ + case Attribute_kind: + V_EXPR(st, e->v.Attribute.value); + break; + case Subscript_kind: + V_EXPR(st, e->v.Subscript.value); + if (!symtable_visit_slice(st, e->v.Subscript.slice)) + return 0; + break; + case Name_kind: + symtable_add_def_o(st, e->v.Name.id, + e->v.Name.ctx == Load ? USE : DEF_LOCAL); + break; + /* child nodes of List and Tuple will have expr_context set */ + case List_kind: + V_EXPRS(st, e->v.List.elts); + break; + case Tuple_kind: + V_EXPRS(st, e->v.Tuple.elts); + break; + default: + PyErr_Format(PyExc_AssertionError, + "invalid expression kind: %d\n", e->kind); + return 0; + } + return 1; + } + From jhylton@users.sourceforge.net Sun Jul 7 19:18:21 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 11:18:21 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.161.2.1,2.161.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11421/Python Modified Files: Tag: ast-branch pythonrun.c Log Message: Move PyParser_ASTFromString() and Filename() into pythonrun.h where they interfere less with the parser. Declare return value to be pointer to struct to avoid dependency on Python-ast.h. Make sure new interfaces use const where appopriate and chase this partway into the parser. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.1 retrieving revision 2.161.2.2 diff -C2 -d -r2.161.2.1 -r2.161.2.2 *** pythonrun.c 7 Jul 2002 17:43:08 -0000 2.161.2.1 --- pythonrun.c 7 Jul 2002 18:18:18 -0000 2.161.2.2 *************** *** 1160,1185 **** /* Preferred access to parser is through AST. */ mod_ty ! PyParser_ASTFromString(char *s, char *filename, grammar *g, int start, ! perrdetail *err_ret, int flags) { node *n; ! n = PyParser_ParseStringFlags(s, g, start, err_ret, flags); if (n) return PyAST_FromNode(n); ! else return NULL; } mod_ty ! PyParser_ASTFromFile(FILE *fp, char *filename, grammar *g, int start, ! char *ps1, char *ps2, perrdetail *err_ret, int flags) { node *n; ! n = PyParser_ParseFileFlags(fp, filename, g, start, ps1, ps2, ! err_ret, flags); if (n) return PyAST_FromNode(n); ! else return NULL; } --- 1160,1192 ---- /* Preferred access to parser is through AST. */ mod_ty ! PyParser_ASTFromString(const char *s, const char *filename, int start, ! int flags) { node *n; ! perrdetail err; ! n = PyParser_ParseStringFlags(s, &_PyParser_Grammar, start, &err, ! flags); if (n) return PyAST_FromNode(n); ! else { ! err_input(&err); return NULL; + } } mod_ty ! PyParser_ASTFromFile(FILE *fp, const char *filename, int start, char *ps1, ! char *ps2, int flags) { node *n; ! perrdetail err; ! n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, start, ! ps1, ps2, &err, flags); if (n) return PyAST_FromNode(n); ! else { ! err_input(&err); return NULL; + } } *************** *** 1195,1198 **** --- 1202,1206 ---- if (n == NULL) err_input(&err); + return n; } *************** *** 1207,1211 **** node * ! PyParser_SimpleParseStringFlags(char *str, int start, int flags) { node *n; --- 1215,1219 ---- node * ! PyParser_SimpleParseStringFlags(const char *str, int start, int flags) { node *n; From jhylton@users.sourceforge.net Sun Jul 7 19:18:20 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 11:18:20 -0700 Subject: [Python-checkins] python/dist/src/Include parsetok.h,2.17.2.1,2.17.2.2 pythonrun.h,2.49,2.49.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv11421/Include Modified Files: Tag: ast-branch parsetok.h pythonrun.h Log Message: Move PyParser_ASTFromString() and Filename() into pythonrun.h where they interfere less with the parser. Declare return value to be pointer to struct to avoid dependency on Python-ast.h. Make sure new interfaces use const where appopriate and chase this partway into the parser. Index: parsetok.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/parsetok.h,v retrieving revision 2.17.2.1 retrieving revision 2.17.2.2 diff -C2 -d -r2.17.2.1 -r2.17.2.2 *** parsetok.h 7 Jul 2002 17:43:07 -0000 2.17.2.1 --- parsetok.h 7 Jul 2002 18:18:18 -0000 2.17.2.2 *************** *** 10,14 **** typedef struct { int error; ! char *filename; int lineno; int offset; --- 10,14 ---- typedef struct { int error; ! const char *filename; int lineno; int offset; *************** *** 27,41 **** char *, char *, perrdetail *); ! extern DL_IMPORT(node *) PyParser_ParseStringFlags(char *, grammar *, int, ! perrdetail *, int); ! extern DL_IMPORT(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *, int, char *, char *, perrdetail *, int); - - extern DL_IMPORT(mod_ty) PyParser_ASTFromString(char *, char *, grammar *, - int, perrdetail *, int); - extern DL_IMPORT(mod_ty) PyParser_ASTFromFile(FILE *, char *, grammar *, - int, char *, char *, - perrdetail *, int); #ifdef __cplusplus } --- 27,36 ---- char *, char *, perrdetail *); ! extern DL_IMPORT(node *) PyParser_ParseStringFlags(const char *, grammar *, ! int, perrdetail *, int); ! extern DL_IMPORT(node *) PyParser_ParseFileFlags(FILE *, const char *, ! grammar *, int, char *, char *, perrdetail *, int); #ifdef __cplusplus } Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.49 retrieving revision 2.49.2.1 diff -C2 -d -r2.49 -r2.49.2.1 *** pythonrun.h 12 Apr 2002 01:20:10 -0000 2.49 --- pythonrun.h 7 Jul 2002 18:18:18 -0000 2.49.2.1 *************** *** 43,49 **** DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); ! DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); DL_IMPORT(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, int, int); --- 43,55 ---- DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); + + DL_IMPORT(struct _mod *) PyParser_ASTFromString(const char *, const char *, + int, int); + DL_IMPORT(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, + char *, char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); ! DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, ! int); DL_IMPORT(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, int, int); From jhylton@users.sourceforge.net Sun Jul 7 19:18:21 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 11:18:21 -0700 Subject: [Python-checkins] python/dist/src/Parser parsetok.c,2.30,2.30.2.1 tokenizer.h,2.16,2.16.28.1 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv11421/Parser Modified Files: Tag: ast-branch parsetok.c tokenizer.h Log Message: Move PyParser_ASTFromString() and Filename() into pythonrun.h where they interfere less with the parser. Declare return value to be pointer to struct to avoid dependency on Python-ast.h. Make sure new interfaces use const where appopriate and chase this partway into the parser. Index: parsetok.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/parsetok.c,v retrieving revision 2.30 retrieving revision 2.30.2.1 diff -C2 -d -r2.30 -r2.30.2.1 *** parsetok.c 22 Mar 2002 23:53:03 -0000 2.30 --- parsetok.c 7 Jul 2002 18:18:18 -0000 2.30.2.1 *************** *** 15,19 **** /* Forward */ static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int); ! static void initerr(perrdetail *err_ret, char* filename); /* Parse input coming from a string. Return error code, print some errors. */ --- 15,19 ---- /* Forward */ static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int); ! static void initerr(perrdetail *err_ret, const char* filename); /* Parse input coming from a string. Return error code, print some errors. */ *************** *** 25,29 **** node * ! PyParser_ParseStringFlags(char *s, grammar *g, int start, perrdetail *err_ret, int flags) { --- 25,29 ---- node * ! PyParser_ParseStringFlags(const char *s, grammar *g, int start, perrdetail *err_ret, int flags) { *************** *** 32,36 **** initerr(err_ret, NULL); ! if ((tok = PyTokenizer_FromString(s)) == NULL) { err_ret->error = E_NOMEM; return NULL; --- 32,37 ---- initerr(err_ret, NULL); ! /* XXX Don't want to chase const into parser right now. */ ! if ((tok = PyTokenizer_FromString((char *)s)) == NULL) { err_ret->error = E_NOMEM; return NULL; *************** *** 59,63 **** node * ! PyParser_ParseFileFlags(FILE *fp, char *filename, grammar *g, int start, char *ps1, char *ps2, perrdetail *err_ret, int flags) { --- 60,64 ---- node * ! PyParser_ParseFileFlags(FILE *fp, const char *filename, grammar *g, int start, char *ps1, char *ps2, perrdetail *err_ret, int flags) { *************** *** 185,189 **** static void ! initerr(perrdetail *err_ret, char* filename) { err_ret->error = E_OK; --- 186,190 ---- static void ! initerr(perrdetail *err_ret, const char *filename) { err_ret->error = E_OK; Index: tokenizer.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.h,v retrieving revision 2.16 retrieving revision 2.16.28.1 diff -C2 -d -r2.16 -r2.16.28.1 *** tokenizer.h 1 Sep 2000 23:29:28 -0000 2.16 --- tokenizer.h 7 Jul 2002 18:18:18 -0000 2.16.28.1 *************** *** 34,38 **** /* Used to allow free continuations inside them */ /* Stuff for checking on different tab sizes */ ! char *filename; /* For error messages */ int altwarning; /* Issue warning if alternate tabs don't match */ int alterror; /* Issue error if alternate tabs don't match */ --- 34,38 ---- /* Used to allow free continuations inside them */ /* Stuff for checking on different tab sizes */ ! const char *filename; /* For error messages */ int altwarning; /* Issue warning if alternate tabs don't match */ int alterror; /* Issue error if alternate tabs don't match */ From tim_one@users.sourceforge.net Sun Jul 7 20:59:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 07 Jul 2002 12:59:52 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.182,2.183 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7577/python/Objects Modified Files: object.c Log Message: Rearranged and added comments to object.h, to clarify many things that have taken me "too long" to reverse-engineer over the years. Vastly reduced the nesting level and redundancy of #ifdef-ery. Took a light stab at repairing comments that are no longer true. sys_gettotalrefcount(): Changed to enable under Py_REF_DEBUG. It was enabled under Py_TRACE_REFS, which was much heavier than necessary. sys.gettotalrefcount() is now available in a Py_REF_DEBUG-only build. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.182 retrieving revision 2.183 diff -C2 -d -r2.182 -r2.183 *** object.c 7 Jul 2002 16:52:50 -0000 2.182 --- object.c 7 Jul 2002 19:59:50 -0000 2.183 *************** *** 1859,1865 **** refchain._ob_next->_ob_prev = op; refchain._ob_next = op; ! #ifdef COUNT_ALLOCS ! inc_count(op->ob_type); ! #endif } --- 1859,1863 ---- refchain._ob_next->_ob_prev = op; refchain._ob_next = op; ! _PyMAYBE_BUMP_COUNT(op); } *************** *** 1886,1892 **** op->_ob_prev->_ob_next = op->_ob_next; op->_ob_next = op->_ob_prev = NULL; ! #ifdef COUNT_ALLOCS ! op->ob_type->tp_frees++; ! #endif } --- 1884,1888 ---- op->_ob_prev->_ob_next = op->_ob_next; op->_ob_next = op->_ob_prev = NULL; ! _PyMAYBE_BUMP_FREECOUNT(op); } From tim_one@users.sourceforge.net Sun Jul 7 20:59:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 07 Jul 2002 12:59:52 -0700 Subject: [Python-checkins] python/dist/src/Python sysmodule.c,2.107,2.108 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7577/python/Python Modified Files: sysmodule.c Log Message: Rearranged and added comments to object.h, to clarify many things that have taken me "too long" to reverse-engineer over the years. Vastly reduced the nesting level and redundancy of #ifdef-ery. Took a light stab at repairing comments that are no longer true. sys_gettotalrefcount(): Changed to enable under Py_REF_DEBUG. It was enabled under Py_TRACE_REFS, which was much heavier than necessary. sys.gettotalrefcount() is now available in a Py_REF_DEBUG-only build. Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.107 retrieving revision 2.108 diff -C2 -d -r2.107 -r2.108 *** sysmodule.c 30 Jun 2002 15:26:10 -0000 2.107 --- sysmodule.c 7 Jul 2002 19:59:50 -0000 2.108 *************** *** 470,478 **** } ! #ifdef Py_TRACE_REFS static PyObject * sys_gettotalrefcount(PyObject *self) { - extern long _Py_RefTotal; return PyInt_FromLong(_Py_RefTotal); } --- 470,477 ---- } ! #ifdef Py_REF_DEBUG static PyObject * sys_gettotalrefcount(PyObject *self) { return PyInt_FromLong(_Py_RefTotal); } *************** *** 565,568 **** --- 564,569 ---- #ifdef Py_TRACE_REFS {"getobjects", _Py_GetObjects, METH_VARARGS}, + #endif + #ifdef Py_REF_DEBUG {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS}, #endif From tim_one@users.sourceforge.net Sun Jul 7 20:59:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 07 Jul 2002 12:59:52 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.103,2.104 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv7577/python/Include Modified Files: object.h Log Message: Rearranged and added comments to object.h, to clarify many things that have taken me "too long" to reverse-engineer over the years. Vastly reduced the nesting level and redundancy of #ifdef-ery. Took a light stab at repairing comments that are no longer true. sys_gettotalrefcount(): Changed to enable under Py_REF_DEBUG. It was enabled under Py_TRACE_REFS, which was much heavier than necessary. sys.gettotalrefcount() is now available in a Py_REF_DEBUG-only build. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.103 retrieving revision 2.104 diff -C2 -d -r2.103 -r2.104 *** object.h 7 Jul 2002 05:13:56 -0000 2.103 --- object.h 7 Jul 2002 19:59:50 -0000 2.104 *************** *** 14,18 **** accessed through special macros and functions only. (Type objects are exceptions to the first rule; the standard types are represented by ! statically initialized type objects.) An object has a 'reference count' that is increased or decreased when a --- 14,19 ---- accessed through special macros and functions only. (Type objects are exceptions to the first rule; the standard types are represented by ! statically initialized type objects, although work on type/class unification ! for Python 2.2 made it possible to have heap-allocated type objects too). An object has a 'reference count' that is increased or decreased when a *************** *** 52,81 **** #ifdef Py_DEBUG ! /* Turn on heavy reference debugging */ #define Py_TRACE_REFS ! /* Turn on reference counting */ #define Py_REF_DEBUG ! ! #endif /* Py_DEBUG */ #ifdef Py_TRACE_REFS ! #define PyObject_HEAD \ ! struct _object *_ob_next, *_ob_prev; \ ! int ob_refcnt; \ ! struct _typeobject *ob_type; ! #define PyObject_HEAD_INIT(type) 0, 0, 1, type, ! #else /* !Py_TRACE_REFS */ ! #define PyObject_HEAD \ ! int ob_refcnt; \ struct _typeobject *ob_type; - #define PyObject_HEAD_INIT(type) 1, type, - #endif /* !Py_TRACE_REFS */ ! #define PyObject_VAR_HEAD \ ! PyObject_HEAD \ int ob_size; /* Number of items in variable part */ typedef struct _object { PyObject_HEAD --- 53,126 ---- #ifdef Py_DEBUG + /* Turn on aggregate reference counting. This arranges that extern + * _Py_RefTotal hold a count of all references, the sum of ob_refcnt + * across all objects. The value can be gotten programatically via + * sys.gettotalrefcount() (which exists only if Py_REF_DEBUG is enabled). + * In a debug-mode build, this is where the "8288" comes from in + * + * >>> 23 + * 23 + * [8288 refs] + * >>> + * + * Note that if this count increases when you're not storing away new objects, + * there's probably a leak. Remember, though, that in interactive mode the + * special name "_" holds a reference to the last result displayed! + */ + #define Py_REF_DEBUG ! /* 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). This list can be ! * materialized into a Python list via sys.getobjects() (which exists only ! * if Py_TRACE_REFS is enabled). Py_TRACE_REFS implies Py_REF_DEBUG. ! */ #define Py_TRACE_REFS + #endif /* Py_DEBUG */ ! /* Py_TRACE_REFS implies Py_REF_DEBUG. */ ! #if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) #define Py_REF_DEBUG ! #endif #ifdef Py_TRACE_REFS ! /* Define pointers to support a doubly-linked list of all live heap objects. */ ! #define _PyObject_HEAD_EXTRA \ ! struct _object *_ob_next; \ ! struct _object *_ob_prev; ! ! #define _PyObject_EXTRA_INIT 0, 0, ! ! #else ! #define _PyObject_HEAD_EXTRA ! #define _PyObject_EXTRA_INIT ! #endif ! ! /* PyObject_HEAD defines the initial segment of every PyObject. */ ! #define PyObject_HEAD \ ! _PyObject_HEAD_EXTRA \ ! int ob_refcnt; \ struct _typeobject *ob_type; ! #define PyObject_HEAD_INIT(type) \ ! _PyObject_EXTRA_INIT \ ! 1, type, ! ! /* PyObject_VAR_HEAD defines the initial segment of all variable-size ! * container objects. These end with a declaration of an array with 1 ! * element, but enough space is malloc'ed so that the array actually ! * has room for ob_size elements. Note that ob_size is an element count, ! * not necessarily a byte count. ! */ ! #define PyObject_VAR_HEAD \ ! PyObject_HEAD \ int ob_size; /* Number of items in variable part */ + /* Nothing is actually declared to be a PyObject, but every pointer to + * a Python object can be cast to a PyObject*. This is inheritance built + * by hand. Similarly every pointer to a variable-size Python object can, + * in addition, be cast to PyVarObject*. + */ typedef struct _object { PyObject_HEAD *************** *** 89,99 **** /* Type objects contain a string containing the type name (to help somewhat ! in debugging), the allocation parameters (see newobj() and newvarobj()), ! and methods for accessing objects of the type. Methods are optional,a nil pointer meaning that particular kind of access is not available for this type. The Py_DECREF() macro uses the tp_dealloc method without checking for a nil pointer; it should always be implemented except if the implementation can guarantee that the reference count will never ! reach zero (e.g., for type objects). NB: the methods for certain type groups are now contained in separate --- 134,145 ---- /* Type objects contain a string containing the type name (to help somewhat ! in debugging), the allocation parameters (see PyObject_New() and ! PyObject_NewVar()), ! and methods for accessing objects of the type. Methods are optional, a nil pointer meaning that particular kind of access is not available for this type. The Py_DECREF() macro uses the tp_dealloc method without checking for a nil pointer; it should always be implemented except if the implementation can guarantee that the reference count will never ! reach zero (e.g., for statically allocated type objects). NB: the methods for certain type groups are now contained in separate *************** *** 122,126 **** /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all arguments are guaranteed to be of the object's type (modulo ! coercion hacks that is -- i.e. if the type's coercion function returns other types, then these are allowed as well). Numbers that have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both* --- 168,172 ---- /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all arguments are guaranteed to be of the object's type (modulo ! coercion hacks -- i.e. if the type's coercion function returns other types, then these are allowed as well). Numbers that have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both* *************** *** 379,384 **** /* ! ! Type flags (tp_flags) These flags are used to extend the type structure in a backwards-compatible --- 425,429 ---- /* ! `Type flags (tp_flags) These flags are used to extend the type structure in a backwards-compatible *************** *** 398,402 **** Code can use PyType_HasFeature(type_ob, flag_value) to test whether the given type object has a specified feature. - */ --- 443,446 ---- *************** *** 459,474 **** /* The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement ! reference counts. Py_DECREF calls the object's deallocator function; for objects that don't contain references to other objects or heap memory this can be the standard function free(). Both macros can be used ! wherever a void expression is allowed. The argument shouldn't be a ! NIL pointer. The macro _Py_NewReference(op) is used only to initialize ! reference counts to 1; it is defined here for convenience. We assume that the reference count field can never overflow; this can ! be proven when the size of the field is the same as the pointer size ! but even with a 16-bit reference count field it is pretty unlikely so ! we ignore the possibility. (If you are paranoid, make it a long.) Type objects should never be deallocated; the type pointer in an object is not considered to be a reference to the type object, to save --- 503,525 ---- /* The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement ! reference counts. Py_DECREF calls the object's deallocator function when ! the refcount falls to 0; for objects that don't contain references to other objects or heap memory this can be the standard function free(). Both macros can be used ! wherever a void expression is allowed. The argument must not be a ! NIL pointer. If it may be NIL, use Py_XINCREF/Py_XDECREF instead. ! The macro _Py_NewReference(op) initialize reference counts to 1, and ! in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional ! bookkeeping appropriate to the special build. We assume that the reference count field can never overflow; this can ! be proven when the size of the field is the same as the pointer size, so ! we ignore the possibility. Provided a C int is at least 32 bits (which ! is implicitly assumed in many parts of this code), that's enough for ! about 2**31 references to an object. + XXX The following became out of date in Python 2.2, but I'm not sure + XXX what the full truth is now. Certainly, heap-allocated type objects + XXX can and should be deallocated. Type objects should never be deallocated; the type pointer in an object is not considered to be a reference to the type object, to save *************** *** 484,543 **** */ ! #ifdef Py_TRACE_REFS ! #ifndef Py_REF_DEBUG ! #define Py_REF_DEBUG #endif #endif #ifdef Py_TRACE_REFS ! extern DL_IMPORT(void) _Py_Dealloc(PyObject *); extern DL_IMPORT(void) _Py_NewReference(PyObject *); extern DL_IMPORT(void) _Py_ForgetReference(PyObject *); extern DL_IMPORT(void) _Py_PrintReferences(FILE *); extern DL_IMPORT(void) _Py_ResetReferences(void); - #endif - - #ifndef Py_TRACE_REFS - #ifdef COUNT_ALLOCS - #define _Py_Dealloc(op) ((op)->ob_type->tp_frees++, (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) - #define _Py_ForgetReference(op) ((op)->ob_type->tp_frees++) - #else /* !COUNT_ALLOCS */ - #define _Py_Dealloc(op) (*(op)->ob_type->tp_dealloc)((PyObject *)(op)) - #define _Py_ForgetReference(op) /*empty*/ - #endif /* !COUNT_ALLOCS */ - #endif /* !Py_TRACE_REFS */ ! #ifdef COUNT_ALLOCS ! extern DL_IMPORT(void) inc_count(PyTypeObject *); ! #endif ! #ifdef Py_REF_DEBUG ! extern DL_IMPORT(long) _Py_RefTotal; - #ifndef Py_TRACE_REFS - #ifdef COUNT_ALLOCS - #define _Py_NewReference(op) (inc_count((op)->ob_type), _Py_RefTotal++, (op)->ob_refcnt = 1) - #else - #define _Py_NewReference(op) (_Py_RefTotal++, (op)->ob_refcnt = 1) - #endif #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++) ! /* under Py_REF_DEBUG: also log negative ref counts after Py_DECREF() !! */ #define Py_DECREF(op) \ if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \ else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \ ! else ((void)fprintf( stderr, "%s:%i negative ref count %i\n", \ __FILE__, __LINE__, (op)->ob_refcnt), abort()) - #else /* !Py_REF_DEBUG */ - #ifdef COUNT_ALLOCS - #define _Py_NewReference(op) (inc_count((op)->ob_type), (op)->ob_refcnt = 1) #else - #define _Py_NewReference(op) ((op)->ob_refcnt = 1) - #endif - - #define Py_INCREF(op) ((op)->ob_refcnt++) #define Py_DECREF(op) \ if (--(op)->ob_refcnt != 0) \ --- 535,592 ---- */ ! #ifdef Py_REF_DEBUG ! extern DL_IMPORT(long) _Py_RefTotal; ! #define _PyMAYBE_BUMP_REFTOTAL _Py_RefTotal++ ! #else ! #define _PyMAYBE_BUMP_REFTOTAL (void)0 #endif + + #ifdef COUNT_ALLOCS + extern DL_IMPORT(void) inc_count(PyTypeObject *); + #define _PyMAYBE_BUMP_COUNT(OP) inc_count((OP)->ob_type) + #define _PyMAYBE_BUMP_FREECOUNT(OP) (OP)->ob_type->tp_frees++ + #else + #define _PyMAYBE_BUMP_COUNT(OP) (void)0 + #define _PyMAYBE_BUMP_FREECOUNT(OP) (void)0 #endif #ifdef Py_TRACE_REFS ! /* Py_TRACE_REFS is such major surgery that we call external routines. */ extern DL_IMPORT(void) _Py_NewReference(PyObject *); extern DL_IMPORT(void) _Py_ForgetReference(PyObject *); + extern DL_IMPORT(void) _Py_Dealloc(PyObject *); extern DL_IMPORT(void) _Py_PrintReferences(FILE *); extern DL_IMPORT(void) _Py_ResetReferences(void); ! #else ! /* Without Py_TRACE_REFS, there's little enough to do that we expand code ! * inline. ! */ ! #define _Py_NewReference(op) ( \ ! _PyMAYBE_BUMP_COUNT(op), \ ! _PyMAYBE_BUMP_REFTOTAL, \ ! (op)->ob_refcnt = 1) ! #define _Py_ForgetReference(op) (_PyMAYBE_BUMP_FREECOUNT(op)) ! #define _Py_Dealloc(op) ( \ ! _Py_ForgetReference(op), \ ! (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _PyMAYBE_BUMP_REFTOTAL, \ ! (op)->ob_refcnt++) ! ! #ifdef Py_REF_DEBUG ! /* under Py_REF_DEBUG: also log negative ref counts after Py_DECREF() !! */ #define Py_DECREF(op) \ if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \ else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \ ! else ((void)fprintf(stderr, "%s:%i negative ref count %i\n", \ __FILE__, __LINE__, (op)->ob_refcnt), abort()) #else #define Py_DECREF(op) \ if (--(op)->ob_refcnt != 0) \ *************** *** 548,552 **** /* Macros to use in case the object pointer may be NULL: */ - #define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op) #define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op) --- 597,600 ---- *************** *** 558,564 **** Don't forget to apply Py_INCREF() when returning this value!!! */ - extern DL_IMPORT(PyObject) _Py_NoneStruct; /* Don't use this directly */ - #define Py_None (&_Py_NoneStruct) --- 606,610 ---- *************** *** 567,573 **** not implemented for a given type combination. */ - extern DL_IMPORT(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ - #define Py_NotImplemented (&_Py_NotImplementedStruct) --- 613,617 ---- *************** *** 625,629 **** an integer return -1 (which could be a legal return value too!), and other functions return 0 for success and -1 for failure. ! Callers should always check for errors before using the result. Reference Counts --- 669,675 ---- an integer return -1 (which could be a legal return value too!), and other functions return 0 for success and -1 for failure. ! Callers should always check for errors before using the result. If ! an error was set, the caller must either explicitly clear it, or pass ! the error on to its caller. Reference Counts From jhylton@users.sourceforge.net Sun Jul 7 21:50:12 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 07 Jul 2002 13:50:12 -0700 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.1,2.10.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19497/Python Modified Files: Tag: ast-branch symtable.c Log Message: Change the macros used for visitor and finish symtable visitor. This code seems to be a clear improvement over the old compile.c version. It was wriiten in about a quarter of the time. It is shorter (350 lines vs. 510 lines). It's independent of Grammar. And it in't filled with magic constants. XXX A uture revision should extract out the navigation part of the code and make it generic. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.1 retrieving revision 2.10.8.2 diff -C2 -d -r2.10.8.1 -r2.10.8.2 *** symtable.c 7 Jul 2002 17:47:42 -0000 2.10.8.1 --- symtable.c 7 Jul 2002 20:50:10 -0000 2.10.8.2 *************** *** 156,162 **** static int symtable_exit_scope(struct symtable *st, void *ast); static int symtable_visit_stmt(struct symtable *st, stmt_ty s); - static int symtable_visit_stmts(struct symtable *st, asdl_seq *seq); static int symtable_visit_expr(struct symtable *st, expr_ty s); ! static int symtable_visit_exprs(struct symtable *st, asdl_seq *seq); static identifier top = NULL, lambda = NULL; --- 156,166 ---- static int symtable_exit_scope(struct symtable *st, void *ast); static int symtable_visit_stmt(struct symtable *st, stmt_ty s); static int symtable_visit_expr(struct symtable *st, expr_ty s); ! static int symtable_visit_arguments(struct symtable *st, arguments_ty); ! static int symtable_visit_excepthandler(struct symtable *st, excepthandler_ty); ! static int symtable_visit_alias(struct symtable *st, alias_ty); ! static int symtable_visit_listcomp(struct symtable *st, listcomp_ty); ! static int symtable_visit_keyword(struct symtable *st, keyword_ty); ! static int symtable_visit_slice(struct symtable *st, slice_ty); static identifier top = NULL, lambda = NULL; *************** *** 165,168 **** --- 169,175 ---- ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) + #define DUPLICATE_ARGUMENT \ + "duplicate argument '%s' in function definition" + static struct symtable * symtable_new(void) *************** *** 207,217 **** st->st_filename = filename; st->st_future = future; ! /* XXX not a stmt_ty */ ! symtable_enter_scope(st, GET_IDENTIFIER(top), ! ModuleScope, (void *)mod, 0); /* Any other top-level initialization? */ ! if (mod->kind == Module_kind) ! symtable_visit_stmts(st, mod->v.Module.body); ! /* XXX not a stmt_ty */ symtable_exit_scope(st, (void *)mod); return st; --- 214,229 ---- st->st_filename = filename; st->st_future = future; ! symtable_enter_scope(st, GET_IDENTIFIER(top), ModuleScope, ! (void *)mod, 0); /* Any other top-level initialization? */ ! if (mod->kind == Module_kind) { ! int i; ! asdl_seq *seq = mod->v.Module.body; ! for (i = 0; i < asdl_seq_LEN(seq); i++) ! if (!symtable_visit_stmt(st, asdl_seq_get(seq, i))) { ! PySymtable_Free(st); ! return NULL; ! } ! } symtable_exit_scope(st, (void *)mod); return st; *************** *** 267,300 **** } - /* macros to help visit expressions that result in def or use - will return 0 from current function on error. - */ - #define V_EXPR(ST, E) { \ - if (!symtable_visit_expr((ST), (E))) \ - return 0; \ - } - - #define V_EXPRS(ST, LE) { \ - if (!symtable_visit_exprs((ST), (LE))) \ - return 0; \ - } - - #define V_STMTS(ST, LS) { \ - if (!symtable_visit_stmts((ST), (LS))) \ - return 0; \ - } - static int ! symtable_visit_stmts(struct symtable *st, asdl_seq *seq) { ! int i; ! for (i = 0; i < asdl_seq_LEN(seq); i++) { ! stmt_ty s = asdl_seq_get(seq, i); ! if (!symtable_visit_stmt(st, s)) ! return 0; } ! return 1; } static int symtable_visit_stmt(struct symtable *st, stmt_ty s) --- 279,350 ---- } static int ! symtable_add_def(struct symtable *st, PyObject *name, int flag) { ! PyObject *o; ! PyObject *dict; ! int val; ! ! /* XXX must always be called with mangled names. */ ! ! dict = st->st_cur->ste_symbols; ! if ((o = PyDict_GetItem(dict, name))) { ! val = PyInt_AS_LONG(o); ! if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { ! PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, ! PyString_AsString(name)); ! PyErr_SyntaxLocation(st->st_filename, ! st->st_cur->ste_lineno); ! return -1; ! } ! val |= flag; ! } else ! val = flag; ! o = PyInt_FromLong(val); ! if (PyDict_SetItem(dict, name, o) < 0) { ! Py_DECREF(o); ! return -1; } ! Py_DECREF(o); ! ! if (flag & DEF_PARAM) { ! if (PyList_Append(st->st_cur->ste_varnames, name) < 0) ! return -1; ! } else if (flag & DEF_GLOBAL) { ! /* XXX need to update DEF_GLOBAL for other flags too; ! perhaps only DEF_FREE_GLOBAL */ ! if ((o = PyDict_GetItem(st->st_global, name))) { ! val = PyInt_AS_LONG(o); ! val |= flag; ! } else ! val = flag; ! o = PyInt_FromLong(val); ! if (PyDict_SetItem(st->st_global, name, o) < 0) { ! Py_DECREF(o); ! return -1; ! } ! Py_DECREF(o); ! } ! return 0; } + /* 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. + */ + + #define VISIT(ST, TYPE, V) \ + if (!symtable_visit_ ## TYPE((ST), (V))) \ + return 0; + + #define VISIT_SEQ(ST, TYPE, SEQ) { \ + int i; \ + asdl_seq *seq = (SEQ); /* avoid variable capture */ \ + for (i = 0; i < asdl_seq_LEN(seq); i++) { \ + TYPE ## _ty elt = asdl_seq_get(seq, i); \ + if (!symtable_visit_ ## TYPE((ST), elt)) \ + return 0; \ + } \ + } + static int symtable_visit_stmt(struct symtable *st, stmt_ty s) *************** *** 302,402 **** switch (s->kind) { case FunctionDef_kind: ! symtable_add_def_o(st, s->v.FunctionDef.name, DEF_LOCAL); ! if (!symtable_visit_arguments(st, s->v.FunctionDef.args)) ! return 0; symtable_enter_scope(st, s->v.FunctionDef.name, FunctionScope, (void *)s, s->lineno); ! V_STMTS(st, s->v.FunctionDef.body); symtable_exit_scope(st, s); break; case ClassDef_kind: ! symtable_add_def_o(st, s->v.ClassDef.name, DEF_LOCAL); ! V_EXPRS(st, s->v.ClassDef.bases); symtable_enter_scope(st, s->v.ClassDef.name, ClassScope, (void *)s, s->lineno); ! V_STMTS(st, s->v.ClassDef.body); symtable_exit_scope(st, s); break; case Return_kind: if (s->v.Return.value) ! V_EXPR(st, s->v.Return.value); break; case Yield_kind: ! V_EXPR(st, s->v.Yield.value); break; case Delete_kind: ! V_EXPRS(st, s->v.Delete.targets); break; case Assign_kind: ! V_EXPRS(st, s->v.Assign.targets); ! V_EXPR(st, s->v.Assign.value); break; case AugAssign_kind: ! V_EXPR(st, s->v.AugAssign.target); ! V_EXPR(st, s->v.AugAssign.value); break; case Print_kind: if (s->v.Print.dest) ! V_EXPR(st, s->v.Print.dest); ! V_EXPRS(st, s->v.Print.value); break; case For_kind: ! V_EXPR(st, s->v.For.target); ! V_EXPR(st, s->v.For.iter); ! V_STMTS(st, s->v.For.body); if (s->v.For.orelse) ! V_STMTS(st, s->v.For.orelse); break; case While_kind: ! V_EXPR(st, s->v.While.test); ! V_STMTS(st, s->v.While.body); if (s->v.While.orelse) ! V_STMTS(st, s->v.While.orelse); break; case If_kind: ! V_EXPR(st, s->v.If.test); ! V_STMTS(st, s->v.If.body); if (s->v.If.orelse) ! V_STMTS(st, s->v.If.orelse); break; case Raise_kind: if (s->v.Raise.type) { ! V_EXPR(st, s->v.Raise.type); if (s->v.Raise.inst) { ! V_EXPR(st, s->v.Raise.inst); if (s->v.Raise.tback) ! V_EXPR(st, s->v.Raise.tback); } } break; case TryExcept_kind: ! V_STMTS(st, s->v.TryExcept.body); ! V_STMTS(st, s->v.TryExcept.orelse); ! if (!symtable_visit_excepthandles(st, s->v.TryExcept.handlers)) ! return 0; break; case TryFinally_kind: ! V_STMTS(st, s->v.TryFinally.body); ! V_STMTS(st, s->v.TryFinally.finalbody); break; case Assert_kind: ! V_EXPR(st, s->v.Assert.test); if (s->v.Assert.msg) ! V_EXPR(st, s->v.Assert.msg); break; case Import_kind: ! if (!symtable_visit_aliases(st, s->v.Import.names)) ! return 0; break; case ImportFrom_kind: ! if (!symtable_visit_aliases(st, s->v.ImportFrom.names)) ! return 0; break; case Exec_kind: ! V_EXPR(st, s->v.Exec.body); if (s->v.Exec.globals) { ! V_EXPR(st, s->v.Exec.globals); if (s->v.Exec.locals) ! V_EXPR(st, s->v.Exec.locals); } break; --- 352,451 ---- switch (s->kind) { case FunctionDef_kind: ! symtable_add_def(st, s->v.FunctionDef.name, DEF_LOCAL); ! if (s->v.FunctionDef.args->defaults) ! VISIT_SEQ(st, expr, s->v.FunctionDef.args->defaults); symtable_enter_scope(st, s->v.FunctionDef.name, FunctionScope, (void *)s, s->lineno); ! VISIT(st, arguments, s->v.FunctionDef.args); ! VISIT_SEQ(st, stmt, s->v.FunctionDef.body); symtable_exit_scope(st, s); break; case ClassDef_kind: ! symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL); ! VISIT_SEQ(st, expr, s->v.ClassDef.bases); symtable_enter_scope(st, s->v.ClassDef.name, ClassScope, (void *)s, s->lineno); ! VISIT_SEQ(st, stmt, s->v.ClassDef.body); symtable_exit_scope(st, s); break; case Return_kind: if (s->v.Return.value) ! VISIT(st, expr, s->v.Return.value); break; case Yield_kind: ! VISIT(st, expr, s->v.Yield.value); break; case Delete_kind: ! VISIT_SEQ(st, expr, s->v.Delete.targets); break; case Assign_kind: ! VISIT_SEQ(st, expr, s->v.Assign.targets); ! VISIT(st, expr, s->v.Assign.value); break; case AugAssign_kind: ! VISIT(st, expr, s->v.AugAssign.target); ! VISIT(st, expr, s->v.AugAssign.value); break; case Print_kind: if (s->v.Print.dest) ! VISIT(st, expr, s->v.Print.dest); ! VISIT_SEQ(st, expr, s->v.Print.value); break; case For_kind: ! VISIT(st, expr, s->v.For.target); ! VISIT(st, expr, s->v.For.iter); ! VISIT_SEQ(st, stmt, s->v.For.body); if (s->v.For.orelse) ! VISIT_SEQ(st, stmt, s->v.For.orelse); break; case While_kind: ! VISIT(st, expr, s->v.While.test); ! VISIT_SEQ(st, stmt, s->v.While.body); if (s->v.While.orelse) ! VISIT_SEQ(st, stmt, s->v.While.orelse); break; case If_kind: ! /* XXX if 0: and lookup_yield() hacks */ ! VISIT(st, expr, s->v.If.test); ! VISIT_SEQ(st, stmt, s->v.If.body); if (s->v.If.orelse) ! VISIT_SEQ(st, stmt, s->v.If.orelse); break; case Raise_kind: if (s->v.Raise.type) { ! VISIT(st, expr, s->v.Raise.type); if (s->v.Raise.inst) { ! VISIT(st, expr, s->v.Raise.inst); if (s->v.Raise.tback) ! VISIT(st, expr, s->v.Raise.tback); } } break; case TryExcept_kind: ! VISIT_SEQ(st, stmt, s->v.TryExcept.body); ! VISIT_SEQ(st, stmt, s->v.TryExcept.orelse); ! VISIT_SEQ(st, excepthandler, s->v.TryExcept.handlers); break; case TryFinally_kind: ! VISIT_SEQ(st, stmt, s->v.TryFinally.body); ! VISIT_SEQ(st, stmt, s->v.TryFinally.finalbody); break; case Assert_kind: ! VISIT(st, expr, s->v.Assert.test); if (s->v.Assert.msg) ! VISIT(st, expr, s->v.Assert.msg); break; case Import_kind: ! VISIT_SEQ(st, alias, s->v.Import.names); break; case ImportFrom_kind: ! VISIT_SEQ(st, alias, s->v.ImportFrom.names); break; case Exec_kind: ! VISIT(st, expr, s->v.Exec.body); if (s->v.Exec.globals) { ! VISIT(st, expr, s->v.Exec.globals); if (s->v.Exec.locals) ! VISIT(st, expr, s->v.Exec.locals); } break; *************** *** 404,415 **** int i; asdl_seq *seq = s->v.Global.names; ! for (i = 0; i < asdl_seq_SIZE(seq); i++) ! symtable_add_def_o(st, asdl_seq_get(seq, i), ! DEF_GLOBAL); break; } case Expr_kind: ! V_EXPR(st, s->v.Expr.value); break; case Pass_kind: --- 453,463 ---- int i; asdl_seq *seq = s->v.Global.names; ! for (i = 0; i < asdl_seq_LEN(seq); i++) ! symtable_add_def(st, asdl_seq_get(seq, i), DEF_GLOBAL); break; } case Expr_kind: ! VISIT(st, expr, s->v.Expr.value); break; case Pass_kind: *************** *** 426,441 **** } - static int - symtable_visit_exprs(struct symtable *st, asdl_seq *seq) - { - int i; - for (i = 0; i < asdl_seq_LEN(seq); i++) { - stmt_ty s = asdl_seq_get(seq, i); - if (!symtable_visit_expr(st, s)) - return 0; - } - return 1; - } - static int symtable_visit_expr(struct symtable *st, expr_ty e) --- 474,477 ---- *************** *** 443,492 **** switch (e->kind) { case BoolOp_kind: ! V_EXPRS(st, e->v.BoolOp.values); break; case BinOp_kind: ! V_EXPR(st, e->v.BinOp.left); ! V_EXPR(st, e->v.BinOp.right); break; case UnaryOp_kind: ! V_EXPR(st, e->v.UnaryOp.operand); break; case Lambda_kind: ! symtable_add_def_o(st, GET_IDENTIFIER(lambda), DEF_LOCAL); ! if (!symtable_visit_arguments(st, e->v.Lambda.args)) ! return 0; ! /* XXX need to make name an identifier ! XXX how to get line numbers for expressions ! */ symtable_enter_scope(st, GET_IDENTIFIER(lambda), FunctionScope, (void *)e, 0); ! V_STMTS(st, e->v.Lambda.body); symtable_exit_scope(st, (void *)e); break; case Dict_kind: ! V_EXPRS(st, e->v.Dict.keys); ! V_EXPRS(st, e->v.Dict.values); break; case ListComp_kind: ! V_EXPR(st, e->v.ListComp.target); ! if (!symtable_visit_listcomp(e->v.ListComp.generators)) ! return 0; break; case Compare_kind: ! V_EXPR(st, e->v.Compare.left); ! V_EXPRS(st, e->v.Compare.comparators); break; case Call_kind: ! V_EXPR(st, e->v.Call.func); ! V_EXPRS(st, e->v.Call.args); ! if (!symtable_visit_keyword(st, e->v.Call.keywords)) ! return 0; if (e->v.Call.starargs) ! V_EXPR(st, e->v.Call.starargs); if (e->v.Call.kwargs) ! V_EXPR(st, e->v.Call.kwargs); break; case Repr_kind: ! V_EXPR(st, e->v.Repr.value); break; case Num_kind: --- 479,523 ---- switch (e->kind) { case BoolOp_kind: ! VISIT_SEQ(st, expr, e->v.BoolOp.values); break; case BinOp_kind: ! VISIT(st, expr, e->v.BinOp.left); ! VISIT(st, expr, e->v.BinOp.right); break; case UnaryOp_kind: ! VISIT(st, expr, e->v.UnaryOp.operand); break; case Lambda_kind: ! symtable_add_def(st, GET_IDENTIFIER(lambda), DEF_LOCAL); ! VISIT(st, arguments, e->v.Lambda.args); ! /* XXX how to get line numbers for expressions */ symtable_enter_scope(st, GET_IDENTIFIER(lambda), FunctionScope, (void *)e, 0); ! VISIT(st, expr, e->v.Lambda.body); symtable_exit_scope(st, (void *)e); break; case Dict_kind: ! VISIT_SEQ(st, expr, e->v.Dict.keys); ! 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); ! VISIT_SEQ(st, expr, e->v.Compare.comparators); break; case Call_kind: ! VISIT(st, expr, e->v.Call.func); ! VISIT_SEQ(st, expr, e->v.Call.args); ! VISIT_SEQ(st, keyword, e->v.Call.keywords); if (e->v.Call.starargs) ! VISIT(st, expr, e->v.Call.starargs); if (e->v.Call.kwargs) ! VISIT(st, expr, e->v.Call.kwargs); break; case Repr_kind: ! VISIT(st, expr, e->v.Repr.value); break; case Num_kind: *************** *** 496,516 **** /* The following exprs can be assignment targets. */ case Attribute_kind: ! V_EXPR(st, e->v.Attribute.value); break; case Subscript_kind: ! V_EXPR(st, e->v.Subscript.value); ! if (!symtable_visit_slice(st, e->v.Subscript.slice)) ! return 0; break; case Name_kind: ! symtable_add_def_o(st, e->v.Name.id, ! e->v.Name.ctx == Load ? USE : DEF_LOCAL); break; /* child nodes of List and Tuple will have expr_context set */ case List_kind: ! V_EXPRS(st, e->v.List.elts); break; case Tuple_kind: ! V_EXPRS(st, e->v.Tuple.elts); break; default: --- 527,546 ---- /* The following exprs can be assignment targets. */ case Attribute_kind: ! VISIT(st, expr, e->v.Attribute.value); break; case Subscript_kind: ! VISIT(st, expr, e->v.Subscript.value); ! VISIT(st, slice, e->v.Subscript.slice); break; case Name_kind: ! symtable_add_def(st, e->v.Name.id, ! e->v.Name.ctx == Load ? USE : DEF_LOCAL); break; /* child nodes of List and Tuple will have expr_context set */ case List_kind: ! VISIT_SEQ(st, expr, e->v.List.elts); break; case Tuple_kind: ! VISIT_SEQ(st, expr, e->v.Tuple.elts); break; default: *************** *** 521,523 **** --- 551,684 ---- return 1; } + + static int + symtable_implicit_arg(struct symtable *st, int pos) + { + PyObject *id = PyString_FromFormat(".%d", pos); + if (id == NULL) + return 0; + /* XXX intern id? */ + symtable_add_def(st, id, DEF_PARAM); + Py_DECREF(id); + return 1; + } + + static int + symtable_visit_params(struct symtable *st, asdl_seq *args, int toplevel) + { + int i; + + for (i = 0; i < asdl_seq_LEN(args); i++) { + expr_ty arg = asdl_seq_get(args, i); + if (arg->kind == Name_kind) { + assert(arg->v.Name.ctx == Load); + if (!symtable_add_def(st, arg->v.Name.id, DEF_PARAM)) + return 0; + } + else if (arg->kind == Tuple_kind) { + assert(arg->v.Tuple.ctx == Load); + if (toplevel) { + if (!symtable_implicit_arg(st, i)) + return 0; + } + if (!symtable_visit_params(st, arg->v.Tuple.elts, 0)) + return 0; + } + else { + /* syntax error */ + return 0; + } + } + + return 1; + } + + static int + symtable_visit_arguments(struct symtable *st, arguments_ty a) + { + /* skip default arguments inside function scope + XXX should ast be different? + */ + if (!symtable_visit_params(st, a->args, 1)) + return 0; + + if (a->vararg) + if (!symtable_add_def(st, a->vararg, DEF_PARAM)) + return 0; + if (a->kwarg) + if (!symtable_add_def(st, a->kwarg, DEF_PARAM)) + return 0; + + return 1; + } + + + static int + symtable_visit_excepthandler(struct symtable *st, excepthandler_ty eh) + { + if (eh->type) + VISIT(st, expr, eh->type); + if (eh->name) + VISIT(st, expr, eh->name); + VISIT_SEQ(st, stmt, eh->body); + return 1; + } + + + static int + symtable_visit_alias(struct symtable *st, alias_ty a) + { + if (a->asname) { + if (!symtable_add_def(st, a->asname, DEF_IMPORT)) + return 0; + } + else if (!symtable_add_def(st, a->name, DEF_IMPORT)) + return 0; + + return 1; + } + + + static int + symtable_visit_listcomp(struct symtable *st, listcomp_ty lc) + { + VISIT(st, expr, lc->target); + VISIT(st, expr, lc->iter); + VISIT_SEQ(st, expr, lc->ifs); + return 1; + } + + + static int + symtable_visit_keyword(struct symtable *st, keyword_ty k) + { + VISIT(st, expr, k->value); + return 1; + } + + + static int + symtable_visit_slice(struct symtable *st, slice_ty s) + { + switch (s->kind) { + case Slice_kind: + if (s->v.Slice.lower) + VISIT(st, expr, s->v.Slice.lower) + if (s->v.Slice.upper) + VISIT(st, expr, s->v.Slice.upper) + if (s->v.Slice.step) + VISIT(st, expr, s->v.Slice.step) + break; + case ExtSlice_kind: + VISIT_SEQ(st, slice, s->v.ExtSlice.dims) + break; + case Index_kind: + VISIT(st, expr, s->v.Index.value) + break; + case Ellipsis_kind: + break; + } + return 1; + } + From jackjansen@users.sourceforge.net Sun Jul 7 21:54:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 07 Jul 2002 13:54:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules macconfig.c,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20229/Mac/Modules Modified Files: macconfig.c Log Message: - Got rid if WITH_CYCLE_GC - Cleaned up Python banner string, so the normal build for MacPython 2.3 will have a short banner. Index: macconfig.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macconfig.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** macconfig.c 20 Jun 2002 22:56:17 -0000 1.31 --- macconfig.c 7 Jul 2002 20:54:44 -0000 1.32 *************** *** 164,170 **** extern void initpyexpat(); #endif - #ifdef WITH_CYCLE_GC extern void initgc(); - #endif extern void initcPickle(); --- 164,168 ---- *************** *** 296,302 **** {"pyexpat", initpyexpat}, #endif - #ifdef WITH_CYCLE_GC {"gc", initgc}, - #endif {"cPickle", initcPickle}, {"cStringIO", initcStringIO}, --- 294,298 ---- From jackjansen@users.sourceforge.net Sun Jul 7 21:54:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 07 Jul 2002 13:54:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macgetcompiler.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv20229/Mac/Python Modified Files: macgetcompiler.c Log Message: - Got rid if WITH_CYCLE_GC - Cleaned up Python banner string, so the normal build for MacPython 2.3 will have a short banner. Index: macgetcompiler.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetcompiler.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** macgetcompiler.c 11 Apr 2002 20:46:16 -0000 1.17 --- macgetcompiler.c 7 Jul 2002 20:54:44 -0000 1.18 *************** *** 37,64 **** #ifdef __MWERKS__ #ifdef USE_GUSI2 - #define HASGUSI " GUSI2" - #else #define HASGUSI "" #endif #ifdef WITH_THREAD - #define HASTHREAD " THREADS" - #else #define HASTHREAD "" #endif #if TARGET_API_MAC_CARBON ! #define TARGET_API " CARBON" #else #define TARGET_API " PPC" #endif ! #ifdef WITH_CYCLE_GC ! #define HASGC " GC" ! #else ! #define HASGC "" ! #endif ! ! #define COMPILER " [CW" TARGET_API HASGUSI HASTHREAD HASGC"]" #endif --- 37,58 ---- #ifdef __MWERKS__ #ifdef USE_GUSI2 #define HASGUSI "" + #else + #define HASGUSI " WITHOUT_GUSI2" #endif #ifdef WITH_THREAD #define HASTHREAD "" + #else + #define HASTHREAD " WITHOUT_THREAD" #endif #if TARGET_API_MAC_CARBON ! #define TARGET_API "" #else #define TARGET_API " PPC" #endif ! #define COMPILER " [CW" TARGET_API HASGUSI HASTHREAD"]" #endif From jackjansen@users.sourceforge.net Sun Jul 7 21:54:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 07 Jul 2002 13:54:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include pyconfig.h,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv20229/Mac/Include Modified Files: pyconfig.h Log Message: - Got rid if WITH_CYCLE_GC - Cleaned up Python banner string, so the normal build for MacPython 2.3 will have a short banner. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pyconfig.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pyconfig.h 13 Jun 2002 21:09:04 -0000 1.10 --- pyconfig.h 7 Jul 2002 20:54:44 -0000 1.11 *************** *** 284,290 **** #undef WANT_WCTYPE_FUNCTIONS - /* Define if you want to compile in cycle garbage collection */ - #define WITH_CYCLE_GC 1 - /* Define if you want cross-platform newline support for reading */ #define WITH_UNIVERSAL_NEWLINES --- 284,287 ---- From tim.one@comcast.net Mon Jul 8 02:27:17 2002 From: tim.one@comcast.net (Tim Peters) Date: Sun, 07 Jul 2002 21:27:17 -0400 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.1,2.10.8.2 In-Reply-To: Message-ID: [jhylton@users.sourceforge.net] > This code seems to be a clear improvement over the old compile.c > version. It was wriiten in about a quarter of the time. It is > shorter (350 lines vs. 510 lines). It's independent of Grammar. And > it in't filled with magic constants. That may all be true, but in what way is it an improvement ? From tim_one@users.sourceforge.net Mon Jul 8 07:32:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 07 Jul 2002 23:32:11 -0700 Subject: [Python-checkins] python/dist/src/Parser node.c,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv26084/python/Parser Modified Files: node.c Log Message: PyNode_AddChild(): Do aggressive over-allocation when the number of children gets large, to avoid severe platform realloc() degeneration in extreme cases (like test_longexp). Bugfix candidate. This was doing extremely timid over-allocation, just rounding up to the nearest multiple of 3. Now so long as the number of children is <= 128, it rounds up to a multiple of 4 but via a much faster method. When the number of children exceeds 128, though, and more space is needed, it doubles the capacity. This is aggressive over-allocation. SF patch has Andrew MacIntyre using PyMalloc in the parser to overcome platform malloc problems in test_longexp on OS/2 EMX. Jack Jansen notes there that it didn't help him on the Mac, because the Mac has problems with frequent ever-growing reallocs, not just with gazillions of teensy mallocs. Win98 has no visible problems with test_longexp, but I tried boosting the test-case size and soon got "senseless" MemoryErrors out of it, and soon after crashed the OS: as I've seen in many other contexts before, while the Win98 realloc remains zippy in bad cases, it leads to extreme fragmentation of user address space, to the point that the OS barfs. I don't yet know whether this fixes Jack's Mac problems, but it does cure Win98's problems when boosting the test case size. It also speeds test_longexp in its unaltered state. Index: node.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/node.c,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** node.c 26 Sep 2000 06:11:54 -0000 2.16 --- node.c 8 Jul 2002 06:32:09 -0000 2.17 *************** *** 19,41 **** } ! #define XXX 3 /* Node alignment factor to speed up realloc */ ! #define XXXROUNDUP(n) ((n) == 1 ? 1 : ((n) + XXX - 1) / XXX * XXX) int PyNode_AddChild(register node *n1, int type, char *str, int lineno) { ! register int nch = n1->n_nchildren; ! register int nch1 = nch+1; ! register node *n; if (nch == INT_MAX || nch < 0) return E_OVERFLOW; ! if (XXXROUNDUP(nch) < nch1) { n = n1->n_child; ! nch1 = XXXROUNDUP(nch1); ! PyMem_RESIZE(n, node, nch1); if (n == NULL) return E_NOMEM; n1->n_child = n; } n = &n1->n_child[n1->n_nchildren++]; n->n_type = type; --- 19,74 ---- } ! /* See comments at XXXROUNDUP below. */ ! static int ! fancy_roundup(int n) ! { ! /* Round up to the closest power of 2 >= n. */ ! int result = 256; ! assert(n > 128); ! while (result < n) ! result <<= 1; ! return result; ! } ! ! /* A gimmick to make massive numbers of reallocs quicker. The result is ! * a number >= the input. For n=0 we must return 0. ! * For n=1, we return 1, to avoid wasting memory in common 1-child nodes ! * (XXX are those actually common?). ! * Else for n <= 128, round up to the closest multiple of 4. Why 4? ! * Rounding up to a multiple of an exact power of 2 is very efficient. ! * Else call fancy_roundup() to grow proportionately to n. We've got an ! * extreme case then (like test_longexp.py), and on many platforms doing ! * anything less than proportional growth leads to exorbitant runtime ! * (e.g., MacPython), or extreme fragmentation of user address space (e.g., ! * Win98). ! * This would be straightforward if a node stored its current capacity. The ! * code is tricky to avoid that. ! */ ! #define XXXROUNDUP(n) ((n) == 1 ? 1 : \ ! (n) <= 128 ? (((n) + 3) & ~3) : \ ! fancy_roundup(n)) ! int PyNode_AddChild(register node *n1, int type, char *str, int lineno) { ! const int nch = n1->n_nchildren; ! int current_capacity; ! int required_capacity; ! node *n; ! if (nch == INT_MAX || nch < 0) return E_OVERFLOW; ! ! current_capacity = XXXROUNDUP(nch); ! required_capacity = XXXROUNDUP(nch + 1); ! if (current_capacity < required_capacity) { n = n1->n_child; ! PyMem_RESIZE(n, node, required_capacity); if (n == NULL) return E_NOMEM; n1->n_child = n; } + n = &n1->n_child[n1->n_nchildren++]; n->n_type = type; From gvanrossum@users.sourceforge.net Mon Jul 8 07:48:57 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 07 Jul 2002 23:48:57 -0700 Subject: [Python-checkins] python/nondist/peps pep-0234.txt,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31984 Modified Files: pep-0234.txt Log Message: Typo (has_keys -> has_key), found by F.Pinard. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pep-0234.txt 25 Oct 2001 20:14:01 -0000 1.16 --- pep-0234.txt 8 Jul 2002 06:48:55 -0000 1.17 *************** *** 312,316 **** - Regarding "if key in dict": there is no doubt that the ! dict.has_keys(x) interpretation of "x in dict" is by far the most useful interpretation, probably the only useful one. There has been resistance against this because "x in list" checks --- 312,316 ---- - Regarding "if key in dict": there is no doubt that the ! dict.has_key(x) interpretation of "x in dict" is by far the most useful interpretation, probably the only useful one. There has been resistance against this because "x in list" checks From jackjansen@users.sourceforge.net Mon Jul 8 11:05:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 08 Jul 2002 03:05:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Include pyconfig.h,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv25203 Modified Files: pyconfig.h Log Message: Define WITH_PYMALLOC as 1 Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pyconfig.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pyconfig.h 7 Jul 2002 20:54:44 -0000 1.11 --- pyconfig.h 8 Jul 2002 10:05:23 -0000 1.12 *************** *** 307,311 **** /* Define if you want to compile in Python-specific mallocs */ ! #define WITH_PYMALLOC /* Define if you want to produce an OpenStep/Rhapsody framework --- 307,311 ---- /* Define if you want to compile in Python-specific mallocs */ ! #define WITH_PYMALLOC 1 /* Define if you want to produce an OpenStep/Rhapsody framework From jackjansen@users.sourceforge.net Mon Jul 8 11:07:28 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 08 Jul 2002 03:07:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_longexp.py,1.6,1.7 test_import.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25966 Modified Files: test_longexp.py test_import.py Log Message: Got rid of special case for Macintosh realloc slowdown: Tim fixed the problem. Index: test_longexp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_longexp.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_longexp.py 16 Apr 2002 01:38:40 -0000 1.6 --- test_longexp.py 8 Jul 2002 10:07:25 -0000 1.7 *************** *** 6,13 **** REPS = 65580 - if sys.platform == 'mac': - import gestalt - if gestalt.gestalt('sysv') > 0x9ff: - raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython' if sys.platform == "os2emx": raise TestFailed, "OS/2+EMX port has malloc problems with long expressions" --- 6,9 ---- Index: test_import.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_import.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_import.py 20 Jun 2002 21:34:35 -0000 1.15 --- test_import.py 8 Jul 2002 10:07:25 -0000 1.16 *************** *** 108,111 **** os.unlink(fname) ! if sys.platform != 'mac': ! test_module_with_large_stack('longlist') --- 108,110 ---- os.unlink(fname) ! test_module_with_large_stack('longlist') From fdrake@users.sourceforge.net Mon Jul 8 13:28:08 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 05:28:08 -0700 Subject: [Python-checkins] python/dist/src/Lib pprint.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv843/Lib Modified Files: pprint.py Log Message: Change the "__ private" names to "_ protected"; this has been a pain for subclassing so many times it should simply be changed. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pprint.py 1 Jun 2002 16:07:16 -0000 1.22 --- pprint.py 8 Jul 2002 12:28:06 -0000 1.23 *************** *** 99,116 **** assert depth is None or depth > 0, "depth must be > 0" assert width ! self.__depth = depth ! self.__indent_per_level = indent ! self.__width = width if stream is not None: ! self.__stream = stream else: ! self.__stream = sys.stdout def pprint(self, object): ! self.__stream.write(self.pformat(object) + "\n") def pformat(self, object): sio = StringIO() ! self.__format(object, sio, 0, 0, {}, 0) return sio.getvalue() --- 99,116 ---- assert depth is None or depth > 0, "depth must be > 0" assert width ! self._depth = depth ! self._indent_per_level = indent ! self._width = width if stream is not None: ! self._stream = stream else: ! self._stream = sys.stdout def pprint(self, object): ! self._stream.write(self.pformat(object) + "\n") def pformat(self, object): sio = StringIO() ! self._format(object, sio, 0, 0, {}, 0) return sio.getvalue() *************** *** 122,136 **** return readable and not recursive ! def __format(self, object, stream, indent, allowance, context, level): level = level + 1 objid = _id(object) if objid in context: stream.write(_recursion(object)) ! self.__recursive = True ! self.__readable = False return ! rep = self.__repr(object, context, level - 1) typ = _type(object) ! sepLines = _len(rep) > (self.__width - 1 - indent - allowance) write = stream.write --- 122,136 ---- return readable and not recursive ! def _format(self, object, stream, indent, allowance, context, level): level = level + 1 objid = _id(object) if objid in context: stream.write(_recursion(object)) ! self._recursive = True ! self._readable = False return ! rep = self._repr(object, context, level - 1) typ = _type(object) ! sepLines = _len(rep) > (self._width - 1 - indent - allowance) write = stream.write *************** *** 138,162 **** if typ is DictType: write('{') ! if self.__indent_per_level > 1: ! write((self.__indent_per_level - 1) * ' ') length = _len(object) if length: context[objid] = 1 ! indent = indent + self.__indent_per_level items = object.items() items.sort() key, ent = items[0] ! rep = self.__repr(key, context, level) write(rep) write(': ') ! self.__format(ent, stream, indent + _len(rep) + 2, allowance + 1, context, level) if length > 1: for key, ent in items[1:]: ! rep = self.__repr(key, context, level) write(',\n%s%s: ' % (' '*indent, rep)) ! self.__format(ent, stream, indent + _len(rep) + 2, allowance + 1, context, level) ! indent = indent - self.__indent_per_level del context[objid] write('}') --- 138,162 ---- if typ is DictType: write('{') ! if self._indent_per_level > 1: ! write((self._indent_per_level - 1) * ' ') length = _len(object) if length: context[objid] = 1 ! indent = indent + self._indent_per_level items = object.items() items.sort() key, ent = items[0] ! rep = self._repr(key, context, level) write(rep) write(': ') ! self._format(ent, stream, indent + _len(rep) + 2, allowance + 1, context, level) if length > 1: for key, ent in items[1:]: ! rep = self._repr(key, context, level) write(',\n%s%s: ' % (' '*indent, rep)) ! self._format(ent, stream, indent + _len(rep) + 2, allowance + 1, context, level) ! indent = indent - self._indent_per_level del context[objid] write('}') *************** *** 170,187 **** write('(') endchar = ')' ! if self.__indent_per_level > 1: ! write((self.__indent_per_level - 1) * ' ') length = _len(object) if length: context[objid] = 1 ! indent = indent + self.__indent_per_level ! self.__format(object[0], stream, indent, allowance + 1, ! context, level) if length > 1: for ent in object[1:]: write(',\n' + ' '*indent) ! self.__format(ent, stream, indent, allowance + 1, context, level) ! indent = indent - self.__indent_per_level del context[objid] if typ is TupleType and length == 1: --- 170,187 ---- write('(') endchar = ')' ! if self._indent_per_level > 1: ! write((self._indent_per_level - 1) * ' ') length = _len(object) if length: context[objid] = 1 ! indent = indent + self._indent_per_level ! self._format(object[0], stream, indent, allowance + 1, ! context, level) if length > 1: for ent in object[1:]: write(',\n' + ' '*indent) ! self._format(ent, stream, indent, allowance + 1, context, level) ! indent = indent - self._indent_per_level del context[objid] if typ is TupleType and length == 1: *************** *** 192,202 **** write(rep) ! def __repr(self, object, context, level): repr, readable, recursive = self.format(object, context.copy(), ! self.__depth, level) if not readable: ! self.__readable = False if recursive: ! self.__recursive = True return repr --- 192,202 ---- write(rep) ! def _repr(self, object, context, level): repr, readable, recursive = self.format(object, context.copy(), ! self._depth, level) if not readable: ! self._readable = False if recursive: ! self._recursive = True return repr From jackjansen@users.sourceforge.net Mon Jul 8 14:34:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 08 Jul 2002 06:34:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv18028/Mac/OSX Modified Files: Makefile Log Message: Got rid of symlink target, and in stead have "make dontinstallmacsubtree" which uses a .pth file to add the Mac/Lib from your source tree to sys.path. Also put the Python version number in a variable.Killed by signal 2. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Makefile 21 Jun 2002 14:48:38 -0000 1.12 --- Makefile 8 Jul 2002 13:34:23 -0000 1.13 *************** *** 16,19 **** --- 16,20 ---- # Items more-or-less copied from the main Makefile + VERSION=2.3 DIRMODE=755 INSTALL=/usr/bin/install -c *************** *** 205,209 **** done ! $(INSTALL_DATA) $(PYTHONSRCDIR)/Mac/OSX/Mac.pth $(INSTALLDIR)/lib/python2.3/site-packages/ # Put symlinks "python" and "pythonw" in the standard place --- 206,210 ---- done ! $(INSTALL_DATA) $(PYTHONSRCDIR)/Mac/OSX/Mac.pth $(INSTALLDIR)/lib/python$(VERSION)/site-packages/ # Put symlinks "python" and "pythonw" in the standard place *************** *** 213,223 **** $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw ! # This is for development purposes: put a symlink to the Mac source subtree in the ! # framework ! symlinkmacsubtree: ! ln -sf `cd $(PYTHONBUILDDIR)/Mac; pwd` $(INSTALLDIR)/Mac ! ! @echo '** Copy the contents of sample_sitecustomize.py (or similar code) into' ! @echo '**' $(INSTALLDIR)/lib/python2.3/sitecustomize.py --- 214,223 ---- $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw ! # This is for development purposes: create a Mac.pth that refers to the source ! # directories ! dontinstallmacsubtree: ! l=`cd $(PYTHONSRCDIR)/Mac/Lib; pwd`; \ ! echo $$l > $(INSTALLDIR)/lib/python$(VERSION)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(INSTALLDIR)/lib/python$(VERSION)/site-packages/Mac.pth From fdrake@users.sourceforge.net Mon Jul 8 15:08:51 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:08:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/paper-a4 pypaper.sty,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/paper-a4 In directory usw-pr-cvs1:/tmp/cvs-serv28558 Modified Files: pypaper.sty Log Message: Added font-setting line (and associated comments) to the A4 version of this file; the lack of this was causing the A4 version of tutorial to use really bad Type 3 fonts instead of Type 1 fonts, which also bloated the file size substantially. I thought there was a SourceForge bug for this, but couldn't find it. Index: pypaper.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/paper-a4/pypaper.sty,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pypaper.sty 6 May 1998 21:40:50 -0000 1.1 --- pypaper.sty 8 Jul 2002 14:08:48 -0000 1.2 *************** *** 4,5 **** --- 4,17 ---- \newcommand{\py@paper}{a4paper} \newcommand{\py@ptsize}{10pt} + + % These set up the fonts for the documents. + % + % The "times" package makes the default font the PostScript Times + % font, which makes for smaller PostScript and a font that more people + % like. + % + % The "avant" package causes the AvantGarde font to be used for + % sans-serif text, instead of the uglier Helvetica set up by the "times" + % package. + % + \RequirePackage{times}\typeout{Using Times instead of Computer Modern.} From fdrake@users.sourceforge.net Mon Jul 8 15:10:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:10:43 -0700 Subject: [Python-checkins] python/dist/src/Doc README,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv29170 Modified Files: README Log Message: Fixed a typo and updated information about using the Times fonts when formatting PostScript documents. Reported by Dave Kuhlman. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/README,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** README 27 Feb 2002 13:29:45 -0000 1.46 --- README 8 Jul 2002 14:10:41 -0000 1.47 *************** *** 158,167 **** As distributed, the LaTeX documents use PostScript Times fonts. This is done since they are much better looking and produce smaller ! PostScript files. If, however, your TeX installation does not support them, they may be easily disabled. Edit the file ! texiinputs/manual.cls and comment out the line that starts "\RequirePackage{times}" by inserting a "%" character at the beginning ! of the line. An alternative is to install the right fonts and LaTeX ! style file. --- 158,168 ---- As distributed, the LaTeX documents use PostScript Times fonts. This is done since they are much better looking and produce smaller ! PostScript files. If, however, your TeX installation does not support them, they may be easily disabled. Edit the file ! texinputs/pypaper.sty and comment out the line that starts "\RequirePackage{times}" by inserting a "%" character at the beginning ! of the line. If you're formatting the docs for A4 paper instead of ! US-Letter paper, change paper-a4/pypaper.sty instead. An alternative ! is to install the right fonts and LaTeX style file. From fdrake@users.sourceforge.net Mon Jul 8 15:29:08 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:29:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.109,1.110 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1905 Modified Files: libfuncs.tex Log Message: Fix typo: "an Unicode string" --> "a Unicode string" Clarify the return value when the parameter is a Unicode object. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** libfuncs.tex 29 Jun 2002 16:06:47 -0000 1.109 --- libfuncs.tex 8 Jul 2002 14:29:05 -0000 1.110 *************** *** 872,877 **** If no optional parameters are given, \code{unicode()} will mimic the behaviour of \code{str()} except that it returns Unicode strings ! instead of 8-bit strings. More precisely, if \var{object} is an ! Unicode string or subclass it will return a Unicode string without any additional decoding applied. --- 872,877 ---- If no optional parameters are given, \code{unicode()} will mimic the behaviour of \code{str()} except that it returns Unicode strings ! instead of 8-bit strings. More precisely, if \var{object} is a ! Unicode string or subclass it will return that Unicode string without any additional decoding applied. From fdrake@users.sourceforge.net Mon Jul 8 15:29:30 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:29:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.4,1.100.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2038 Modified Files: Tag: release22-maint libfuncs.tex Log Message: Fix typo: "an Unicode string" --> "a Unicode string" Clarify the return value when the parameter is a Unicode object. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.4 retrieving revision 1.100.4.5 diff -C2 -d -r1.100.4.4 -r1.100.4.5 *** libfuncs.tex 29 Jun 2002 16:11:08 -0000 1.100.4.4 --- libfuncs.tex 8 Jul 2002 14:29:28 -0000 1.100.4.5 *************** *** 832,837 **** If no optional parameters are given, \code{unicode()} will mimic the behaviour of \code{str()} except that it returns Unicode strings ! instead of 8-bit strings. More precisely, if \var{object} is an ! Unicode string or subclass it will return a Unicode string without any additional decoding applied. --- 832,837 ---- If no optional parameters are given, \code{unicode()} will mimic the behaviour of \code{str()} except that it returns Unicode strings ! instead of 8-bit strings. More precisely, if \var{object} is a ! Unicode string or subclass it will return that Unicode string without any additional decoding applied. From fdrake@users.sourceforge.net Mon Jul 8 15:42:24 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:42:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6290 Modified Files: tkinter.tex Log Message: Fix typo reported by Kent Engström, and a bunch of broken markup. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tkinter.tex 31 May 2002 18:21:56 -0000 1.12 --- tkinter.tex 8 Jul 2002 14:42:22 -0000 1.13 *************** *** 472,486 **** The options supported by a given widget are listed in that widget's man page, or can be queried at runtime by calling the ! \kbd{config()} method with arguments, or by calling the keys() ! method on that widget. The return value of these calls is a dictionary ! whose key is the name of the option (e.g. \kbd{relief}) and whose ! values are 5 tuples. ! (Some options, like \kbd{bg} are synonyms for common options with ! hard-to-type names (\kbd{bg} is shorthand for "background"). ! Passing the \kbd{config()} method the name of a ! shorthand option will return a 2-tuple, not 5-tuple. The 2-tuple ! passed back will contain the name of the synonym ``real'' ! option. (\kbd{bg}, \kbd{background})) \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example} --- 472,486 ---- The options supported by a given widget are listed in that widget's man page, or can be queried at runtime by calling the ! \method{config()} method without arguments, or by calling the ! \method{keys()} method on that widget. The return value of these ! calls is a dictionary whose key is the name of the option as a string ! (for example, \code{'relief'}) and whose values are 5-tuples. ! Some options, like \code{bg} are synonyms for common options with long ! names (\code{bg} is shorthand for "background"). Passing the ! \code{config()} method the name of a shorthand option will return a ! 2-tuple, not 5-tuple. The 2-tuple passed back will contain the name of ! the synonym and the ``real'' option (such as \code{('bg', ! 'background')}). \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example} From fdrake@users.sourceforge.net Mon Jul 8 15:42:47 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:42:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.10.6.2,1.10.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6428 Modified Files: Tag: release22-maint tkinter.tex Log Message: Fix typo reported by Kent Engström, and a bunch of broken markup. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.10.6.2 retrieving revision 1.10.6.3 diff -C2 -d -r1.10.6.2 -r1.10.6.3 *** tkinter.tex 31 May 2002 18:22:14 -0000 1.10.6.2 --- tkinter.tex 8 Jul 2002 14:42:45 -0000 1.10.6.3 *************** *** 472,486 **** The options supported by a given widget are listed in that widget's man page, or can be queried at runtime by calling the ! \kbd{config()} method with arguments, or by calling the keys() ! method on that widget. The return value of these calls is a dictionary ! whose key is the name of the option (e.g. \kbd{relief}) and whose ! values are 5 tuples. ! (Some options, like \kbd{bg} are synonyms for common options with ! hard-to-type names (\kbd{bg} is shorthand for "background"). ! Passing the \kbd{config()} method the name of a ! shorthand option will return a 2-tuple, not 5-tuple. The 2-tuple ! passed back will contain the name of the synonym ``real'' ! option. (\kbd{bg}, \kbd{background})) \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example} --- 472,486 ---- The options supported by a given widget are listed in that widget's man page, or can be queried at runtime by calling the ! \method{config()} method without arguments, or by calling the ! \method{keys()} method on that widget. The return value of these ! calls is a dictionary whose key is the name of the option as a string ! (for example, \code{'relief'}) and whose values are 5-tuples. ! Some options, like \code{bg} are synonyms for common options with long ! names (\code{bg} is shorthand for "background"). Passing the ! \code{config()} method the name of a shorthand option will return a ! 2-tuple, not 5-tuple. The 2-tuple passed back will contain the name of ! the synonym and the ``real'' option (such as \code{('bg', ! 'background')}). \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example} From fdrake@users.sourceforge.net Mon Jul 8 15:46:51 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:46:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.36.16.1,1.36.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory usw-pr-cvs1:/tmp/cvs-serv7900 Modified Files: Tag: release22-maint dist.tex Log Message: Fix typo. Closes SF bug #578420. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.36.16.1 retrieving revision 1.36.16.2 diff -C2 -d -r1.36.16.1 -r1.36.16.2 *** dist.tex 8 Mar 2002 22:02:17 -0000 1.36.16.1 --- dist.tex 8 Jul 2002 14:46:49 -0000 1.36.16.2 *************** *** 1273,1277 **** If you have a non-pure distribution, the extensions can only be ! created on a Windows platform, and will be Python version dependend. The installer filename will reflect this and now has the form \file{Foo-1.0.win32-py2.0.exe}. You have to create a separate installer --- 1273,1277 ---- If you have a non-pure distribution, the extensions can only be ! created on a Windows platform, and will be Python version dependent. The installer filename will reflect this and now has the form \file{Foo-1.0.win32-py2.0.exe}. You have to create a separate installer From nascheme@users.sourceforge.net Mon Jul 8 15:46:57 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:46:57 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.327,1.328 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7936 Modified Files: configure.in Log Message: Remove the configure option for disabling the reference cycle GC. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.327 retrieving revision 1.328 diff -C2 -d -r1.327 -r1.328 *** configure.in 25 Jun 2002 05:53:48 -0000 1.327 --- configure.in 8 Jul 2002 14:46:55 -0000 1.328 *************** *** 1454,1472 **** fi - # Check for GC support - AC_MSG_CHECKING(for --with-cycle-gc) - AC_ARG_WITH(cycle-gc, - [ --with(out)-cycle-gc disable/enable garbage collection]) - - if test -z "$with_cycle_gc" - then with_cycle_gc="yes" - fi - if test "$with_cycle_gc" != "no" - then - AC_DEFINE(WITH_CYCLE_GC, 1, - [Define if you want to compile in cycle garbage collection.]) - fi - AC_MSG_RESULT($with_cycle_gc) - # Check for universal newline support AC_MSG_CHECKING(for --with-universal-newline) --- 1454,1457 ---- From nascheme@users.sourceforge.net Mon Jul 8 15:47:17 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 08 Jul 2002 07:47:17 -0700 Subject: [Python-checkins] python/dist/src configure,1.317,1.318 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv8028 Modified Files: configure Log Message: Remove the configure option for disabling the reference cycle GC. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.317 retrieving revision 1.318 diff -C2 -d -r1.317 -r1.318 *** configure 25 Jun 2002 05:53:47 -0000 1.317 --- configure 8 Jul 2002 14:47:12 -0000 1.318 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.325 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.327 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 844,848 **** --with(out)-thread=DIRECTORY deprecated; use --with(out)-threads --with-pth use GNU pth threading libraries - --with(out)-cycle-gc disable/enable garbage collection --with(out)-universal-newlines disable/enable foreign newlines --with(out)-doc-strings disable/enable documentation strings --- 844,847 ---- *************** *** 11056,11083 **** fi - # Check for GC support - echo "$as_me:$LINENO: checking for --with-cycle-gc" >&5 - echo $ECHO_N "checking for --with-cycle-gc... $ECHO_C" >&6 - - # Check whether --with-cycle-gc or --without-cycle-gc was given. - if test "${with_cycle_gc+set}" = set; then - withval="$with_cycle_gc" - - fi; - - if test -z "$with_cycle_gc" - then with_cycle_gc="yes" - fi - if test "$with_cycle_gc" != "no" - then - - cat >>confdefs.h <<\_ACEOF - #define WITH_CYCLE_GC 1 - _ACEOF - - fi - echo "$as_me:$LINENO: result: $with_cycle_gc" >&5 - echo "${ECHO_T}$with_cycle_gc" >&6 - # Check for universal newline support echo "$as_me:$LINENO: checking for --with-universal-newline" >&5 --- 11055,11058 ---- *************** *** 11368,11372 **** # checks for library functions - --- 11343,11346 ---- From bwarsaw@users.sourceforge.net Mon Jul 8 17:50:46 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 09:50:46 -0700 Subject: [Python-checkins] python/nondist/peps pep-0282.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14349 Modified Files: pep-0282.txt Log Message: Vinay's update, with lots of reformatting by Barry. Index: pep-0282.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0282.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0282.txt 23 Jun 2002 23:58:18 -0000 1.2 --- pep-0282.txt 8 Jul 2002 16:50:43 -0000 1.3 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: vinay_sajip@red-dove.com (Vinay Sajip) Status: Draft Type: Standards Track --- 3,7 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: vinay_sajip at red-dove.com (Vinay Sajip) Status: Draft Type: Standards Track *************** *** 16,25 **** standard library. ! Basically the system involves the user creating one or more ! logging objects on which methods are called to log debugging ! notes/general information/warnings/errors/etc. Different logging ! 'levels' can be used to distinguish important messages from ! trivial ones. ! A registry of named singleton logger objects is maintained so that --- 16,25 ---- standard library. ! Basically the system involves the user creating one or more logger ! objects on which methods are called to log debugging notes, ! general information, warnings, errors etc. Different logging ! 'levels' can be used to distinguish important messages from less ! important ones. ! A registry of named singleton logger objects is maintained so that *************** *** 27,31 **** (say, one for 'zope.zodb' stuff and another for 'mywebsite'-specific stuff) ! 2) one does not have to pass logger object references around. --- 27,31 ---- (say, one for 'zope.zodb' stuff and another for 'mywebsite'-specific stuff) ! 2) one does not have to pass logger object references around. *************** *** 34,38 **** while not touching the application itself. ! Motivation --- 34,38 ---- while not touching the application itself. ! Motivation *************** *** 45,114 **** Influences ! This proposal was put together after having somewhat studied the following logging packages: o java.util.logging in JDK 1.4 (a.k.a. JSR047) [1] o log4j [2] - These two systems are *very* similar. o the Syslog package from the Protomatter project [3] o MAL's mx.Log package [4] - This proposal will basically look like java.util.logging with a - smattering of log4j. - Simple Example This shows a very simple example of how the logging package can be ! used to generate simple logging output on stdout. ! --------- mymodule.py ------------------------------- import logging log = logging.getLogger("MyModule") ! def doit(): ! log.debug("doin' stuff") ! # do stuff ... ----------------------------------------------------- --------- myapp.py ---------------------------------- import mymodule, logging log = logging.getLogger("MyApp") ! log.info("start my app") try: ! mymodule.doit() except Exception, e: ! log.error("There was a problem doin' stuff.") ! log.info("end my app") ----------------------------------------------------- ! > python myapp.py ! 0 [myapp.py:4] INFO MyApp - start my app ! 36 [mymodule.py:5] DEBUG MyModule - doin' stuff ! 51 [myapp.py:9] INFO MyApp - end my app ! ^^ ^^^^^^^^^^^^ ^^^^ ^^^^^ ^^^^^^^^^^ ! | | | | `-- message ! | | | `-- logging name/channel ! | | `-- level ! | `-- location ! `-- time ! NOTE: Not sure exactly what the default format will look like yet. ! Control Flow ! [Note: excerpts from Java Logging Overview. [5]] Applications make logging calls on *Logger* objects. Loggers are ! organized in a hierarchical namespace and child Loggers may ! inherit some logging properties from their parents in the ! namespace. ! ! Notes on namespace: Logger names fit into a "dotted name" ! namespace, with dots (periods) indicating sub-namespaces. The ! namespace of logger objects therefore corresponds to a single tree ! data structure. "" is the root of the namespace --- 45,121 ---- Influences ! This proposal was put together after having studied the following logging packages: o java.util.logging in JDK 1.4 (a.k.a. JSR047) [1] o log4j [2] o the Syslog package from the Protomatter project [3] o MAL's mx.Log package [4] Simple Example This shows a very simple example of how the logging package can be ! used to generate simple logging output on stderr. ! --------- mymodule.py ------------------------------- import logging log = logging.getLogger("MyModule") ! def doIt(): ! log.debug("Doin' stuff...") ! #do stuff... ! raise TypeError, "Bogus type error for testing" ----------------------------------------------------- --------- myapp.py ---------------------------------- import mymodule, logging + + logging.basicConfig() + log = logging.getLogger("MyApp") ! log.info("Starting my app") try: ! mymodule.doIt() except Exception, e: ! log.exception("There was a problem.") ! log.info("Ending my app") ----------------------------------------------------- ! % python myapp.py ! INFO:MyApp: Starting my app ! DEBUG:MyModule: Doin' stuff... ! ERROR:MyApp: There was a problem. ! Traceback (most recent call last): ! File "myapp.py", line 9, in ? ! mymodule.doIt() ! File "mymodule.py", line 7, in doIt ! raise TypeError, "Bogus type error for testing" ! TypeError: Bogus type error for testing + INFO:MyApp: Ending my app ! The above example shows the default output format. All ! aspects of the output format should be configurable, so that ! you could have output formatted like this: ! 2002-04-19 07:56:58,174 MyModule DEBUG - Doin' stuff... ! ! or just ! ! Doin' stuff... ! ! ! Control Flow Applications make logging calls on *Logger* objects. Loggers are ! organized in a hierarchical namespace and child Loggers inherit ! some logging properties from their parents in the namespace. ! ! Logger names fit into a "dotted name" namespace, with dots ! (periods) indicating sub-namespaces. The namespace of logger ! objects therefore corresponds to a single tree data structure. "" is the root of the namespace *************** *** 116,131 **** "Zope.ZODB" would be a child node of "Zope" ! These Logger objects allocate *LogRecord* objects which are passed ! to *Handler* objects for publication. Both Loggers and Handlers ! may use logging *levels* and (optionally) *Filters* to decide if ! they are interested in a particular LogRecord. When it is ! necessary to publish a LogRecord externally, a Handler can ! (optionally) use a *Formatter* to localize and format the message ! before publishing it to an I/O stream. Each Logger keeps track of a set of output Handlers. By default ! all Loggers also send their output to their parent Logger. But ! Loggers may also be configured to ignore Handlers higher up the ! tree. The APIs are structured so that calls on the Logger APIs can be --- 123,138 ---- "Zope.ZODB" would be a child node of "Zope" ! These Logger objects create *LogRecord* objects which are passed ! to *Handler* objects for output. Both Loggers and Handlers may ! use logging *levels* and (optionally) *Filters* to decide if they ! are interested in a particular LogRecord. When it is necessary to ! output a LogRecord externally, a Handler can (optionally) use a ! *Formatter* to localize and format the message before sending it ! to an I/O stream. Each Logger keeps track of a set of output Handlers. By default ! all Loggers also send their output to all Handlers of their ! ancestor Loggers. Loggers may, however, also be configured to ! ignore Handlers higher up the tree. The APIs are structured so that calls on the Logger APIs can be *************** *** 138,144 **** Handler requests them. Levels ! The logging levels, in increasing order of importance, are: --- 145,162 ---- Handler requests them. + The overall Logger hierarchy can also have a level associated with + it, which takes precedence over the levels of individual Loggers. + This is done through a module-level function: + + def disable(lvl): + """ + Do not generate any LogRecords for requests with a severity less + than 'lvl'. + """ + ... + Levels ! The logging levels, in increasing order of importance, are: *************** *** 147,160 **** WARN ERROR ! FATAL ! ALL ! This is consistent with log4j and Protomatter's Syslog and not ! with JSR047 which has a few more levels and some different names. ! Implementation-wise: these are just integer constants, to allow ! simple comparison of importance. See "What Logging Levels?" below ! for a debate on what standard levels should be defined. Loggers --- 165,203 ---- WARN ERROR ! CRITICAL ! The term CRITICAL is used in preference to FATAL, which is used by ! log4j. The levels are conceptually the same - that of a serious, ! or very serious, error. However, FATAL implies death, which in ! Python implies a raised and uncaught exception, traceback, and ! exit. Since the logging module does not enforce such an outcome ! from a FATAL-level log entry, it makes sense to use CRITICAL in ! preference to FATAL. ! These are just integer constants, to allow simple comparison of ! importance. Experience has shown that too many levels can be ! confusing, as they lead to subjective interpretation of which ! level should be applied to any particular log request. ! ! Although the above levels are strongly recommended, the logging ! system should not be prescriptive. Users may define their own ! levels, as well as the textual representation of any levels. User ! defined levels must, however, obey the constraints that they are ! all positive integers and that they increase in order of ! increasing severity. ! ! User-defined logging levels are supported through two module-level ! functions: + def getLevelName(lvl): + """Return the text for level 'lvl'.""" + ... + + def addLevelName(lvl, lvlName): + """ + Add the level 'lvl' with associated text 'levelName', or + set the textual representation of existing level 'lvl' to be + 'lvlName'.""" + ... Loggers *************** *** 163,195 **** it is interested in, and discards log requests below that level. ! The *LogManager* maintains a hierarchical namespace of named ! Logger objects. Generations are denoted with dot-separated names: ! Logger "foo" is the parent of Loggers "foo.bar" and "foo.baz". ! The main logging method is: class Logger: ! def log(self, level, msg, *args): ! """Log 'msg % args' at logging level 'level'.""" ... ! however convenience functions are defined for each logging level: ! def debug(self, msg, *args): ... ! def info(self, msg, *args): ... ! def warn(self, msg, *args): ... ! def error(self, msg, *args): ... ! def fatal(self, msg, *args): ... ! XXX How to defined a nice convenience function for logging an exception? ! mx.Log has something like this, doesn't it? ! XXX What about a .raising() convenience function? How about: ! def raising(self, exception, level=ERROR): ... ! It would create a log message describing an exception that is ! about to be raised. I don't like that 'level' is not first ! when it *is* first for .log(). --- 206,329 ---- it is interested in, and discards log requests below that level. ! A *Manager* class instance maintains the hierarchical namespace of ! named Logger objects. Generations are denoted with dot-separated ! names: Logger "foo" is the parent of Loggers "foo.bar" and ! "foo.baz". ! The Manager class instance is a singleton and is not directly ! exposed to users, who interact with it using various module-level ! functions. ! ! The general logging method is: class Logger: ! def log(self, lvl, msg, *args, **kwargs): ! """Log 'str(msg) % args' at logging level 'lvl'.""" ... ! However, convenience functions are defined for each logging level: ! class Logger: ! def debug(self, msg, *args, **kwargs): ... ! def info(self, msg, *args, **kwargs): ... ! def warn(self, msg, *args, **kwargs): ... ! def error(self, msg, *args, **kwargs): ... ! def critical(self, msg, *args, **kwargs): ... ! Only one keyword argument is recognized at present - "exc_info". ! If true, the caller wants exception information to be provided in ! the logging output. This mechanism is only needed if exception ! information needs to be provided at *any* logging level. In the ! more common case, where exception information needs to be added to ! the log only when errors occur, i.e. at the ERROR level, then ! another convenience method is provided: ! class Logger: ! def exception(self, msg, *args): ... ! This should only be called in the context of an exception handler, ! and is the preferred way of indicating a desire for exception ! information in the log. The other convenience methods are ! intended to be called with exc_info only in the unusual situation ! where you might want to provide exception information in the ! context of an INFO message, for example. ! The "msg" argument shown above will normally be a format string; ! however, it can be any object x for which str(x) returns the ! format string. This facilitates, for example, the use of an ! object which fetches a locale- specific message for an ! internationalized/localized application, perhaps using the ! standard gettext module. An outline example: ! ! class Message: ! """Represents a message""" ! def __init__(self, id): ! """Initialize with the message ID""" ! ! def __str__(self): ! """Return an appropriate localized message text""" ! ! ... ! ! logger.info(Message("abc"), ...) ! ! Gathering and formatting data for a log message may be expensive, ! and a waste if the logger was going to discard the message anyway. ! To see if a request will be honoured by the logger, the ! isEnabledFor() method can be used: ! ! class Logger: ! def isEnabledFor(self, lvl): ! """ ! Return true if requests at level 'lvl' will NOT be ! discarded. ! """ ! ... ! ! so instead of this expensive and possibly wasteful DOM to XML ! conversion: ! ! ... ! hamletStr = hamletDom.toxml() ! log.info(hamletStr) ! ... ! ! one can do this: ! ! if log.isEnabledFor(logging.INFO): ! hamletStr = hamletDom.toxml() ! log.info(hamletStr) ! ! When new loggers are created, they are initialized with a level ! which signifies "no level". A level can be set explicitly using ! the setLevel() method: ! ! class Logger: ! def setLevel(self, lvl): ... ! ! If a logger's level is not set, the system consults all its ! ancestors, walking up the hierarchy until an explicitly set level ! is found. That is regarded as the "effective level" of the ! logger, and can be queried via the getEffectiveLevel() method: ! ! def getEffectiveLevel(self): ... ! ! Loggers are never instantiated directly. Instead, a module-level ! function is used: ! ! def getLogger(name=None): ... ! ! If no name is specified, the root logger is returned. Otherwise, ! if a logger with that name exists, it is returned. If not, a new ! logger is initialized and returned. Here, "name" is synonymous ! with "channel name". ! ! Users can specify a custom subclass of Logger to be used by the ! system when instantiating new loggers: ! ! def setLoggerClass(klass): ... ! ! The passed class should be a subclass of Logger, and it's __init__ ! method should call Logger.__init__. *************** *** 202,217 **** - FileHandler: A handler for writing to a single file or set of rotating files. - - More standard Handlers may be implemented if deemed desirable and - feasible. Other interesting candidates: - - SocketHandler: A handler for writing to remote TCP ports. ! - CreosoteHandler: A handler for writing to UDP packets, for low-cost logging. Jeff Bauer already had such a system [5]. - MemoryHandler: A handler that buffers log records in memory ! (JSR047). ! - SMTPHandler: Akin to log4j's SMTPAppender. ! - SyslogHandler: Akin to log4j's SyslogAppender. ! - NTEventLogHandler: Akin to log4j's NTEventLogAppender. --- 336,386 ---- - FileHandler: A handler for writing to a single file or set of rotating files. - SocketHandler: A handler for writing to remote TCP ports. ! - DatagramHandler: A handler for writing to UDP sockets, for low-cost logging. Jeff Bauer already had such a system [5]. - MemoryHandler: A handler that buffers log records in memory ! until the buffer is full or a particular condition occurs ! [1]. ! - SMTPHandler: A handler for sending to email addresses via SMTP. ! - SysLogHandler: A handler for writing to Unix syslog via UDP. ! - NTEventLogHandler: A handler for writing to event logs on ! Windows NT, 2000 and XP. ! - HTTPHandler: A handler for writing to a Web server with ! either GET or POST semantics. ! ! Handlers can also have levels set for them using the ! setLevel() method: ! ! def setLevel(self, lvl): ... ! ! ! The FileHandler can be set up to create a rotating set of log ! files. In this case, the file name passed to the constructor is ! taken as a "base" file name. Additional file names for the ! rotation are created by appending .1, .2, etc. to the base file ! name, up to a maximum as specified when rollover is requested. ! The setRollover method is used to specify a maximum size for a log ! file and a maximum number of backup files in the rotation. ! ! def setRollover(maxBytes, backupCount): ... ! ! If maxBytes is specified as zero, no rollover ever occurs and the ! log file grows indefinitely. If a non-zero size is specified, ! when that size is about to be exceeded, rollover occurs. The ! rollover method ensures that the base file name is always the most ! recent, .1 is the next most recent, .2 the next most recent after ! that, and so on. ! ! There are many additional handlers implemented in the test/example ! scripts provided with [6] - for example, XMLHandler and ! SOAPHandler. ! ! ! LogRecords ! ! A LogRecord acts as a receptacle for information about a ! logging event. It is little more than a dictionary, though it ! does define a getMessage method which merges a message with ! optional runarguments. *************** *** 222,411 **** record. The following core Formatters will be implemented: ! - Formatter: Provide printf-like formatting, perhaps akin to ! log4j's PatternAppender. ! ! Other possible candidates for implementation: ! - XMLFormatter: Serialize a LogRecord according to a specific ! schema. Could copy the schema from JSR047's XMLFormatter or ! log4j's XMLAppender. ! - HTMLFormatter: Provide a simple HTML output of log ! information. (See log4j's HTMLAppender.) ! Filters ! A Filter can be called by a Logger or Handler to decide if a ! LogRecord should be logged. ! JSR047 and log4j have slightly different filtering interfaces. The ! former is simpler: ! class Filter: ! def isLoggable(self): ! """Return a boolean.""" ! The latter is modeled after Linux's ipchains (where Filter's can ! be chained with each filter either 'DENY'ing, 'ACCEPT'ing, or ! being 'NEUTRAL' on each check). I would probably favor to former ! because it is simpler and I don't immediate see the need for the ! latter. ! ! No filter implementations are currently proposed (other that the ! do nothing base class) because I don't have enough experience to ! know what kinds of filters would be common. Users can always ! subclass Filter for their own purposes. Log4j includes a few ! filters that might be interesting. ! Configuration ! Note: Configuration for the proposed logging system is currently ! under-specified. ! The main benefit of a logging system like this is that one can ! control how much and what logging output one gets from an ! application without changing that application's source code. ! Log4j and Syslog provide for configuration via an external XML ! file. Log4j and JSR047 provide for configuration via Java ! properties (similar to -D #define's to a C/C++ compiler). All ! three provide for configuration via API calls. ! Configuration includes the following: ! - What logging level a logger should be interested in. ! - What handlers should be attached to which loggers. ! - What filters should be attached to which handlers and loggers. ! - Specifying attributes specific to certain Handlers and Filters. ! - Defining the default configuration. ! - XXX Add others. ! In general each application will have its own requirements for how ! a user may configure logging output. One application ! (e.g. distutils) may want to control logging levels via ! '-q,--quiet,-v,--verbose' options to setup.py. Zope may want to ! configure logging via certain environment variables ! (e.g. 'STUPID_LOG_FILE' :). Komodo may want to configure logging ! via its preferences system. ! This PEP proposes to clearly document the API for configuring each ! of the above listed configurable elements and to define a ! reasonable default configuration. This PEP does not propose to ! define a general XML or .ini file configuration schema and the ! backend to parse it. ! ! It might, however, be worthwhile to define an abstraction of the ! configuration API to allow the expressiveness of Syslog ! configuration. Greg Wilson made this argument: ! In Protomatter [Syslog], you configure by saying "give me ! everything that matches these channel+level combinations", ! such as "server.error" and "database.*". The log4j "configure ! by inheritance" model, on the other hand, is very clever, but ! hard for non-programmers to manage without a GUI that ! essentially reduces it to Protomatter's. ! Case Scenarios - This section presents a few usage scenarios which will be used to - help decide how best to specify the logging API. ! (1) A short simple script. ! This script does not have many lines. It does not heavily use ! any third party modules (i.e. the only code doing any logging ! would be the main script). Only one logging channel is really ! needed and thus, the channel name is unnecessary. The user ! doesn't want to bother with logging system configuration much. ! (2) Medium sized app with C extension module. ! ! Includes a few Python modules and a main script. Employs, ! perhaps, a few logging channels. Includes a C extension ! module which might want to make logging calls as well. ! (3) Distutils. ! A large number of Python packages/modules. Perhaps (but not ! necessarily) a number of logging channels are used. ! Specifically needs to facilitate the controlling verbosity ! levels via simple command line options to 'setup.py'. - (4) Large, possibly multi-language, app. E.g. Zope or (my - experience) Komodo. ! (I don't expect this logging system to deal with any ! cross-language issues but it is something to think about.) ! Many channels are used. Many developers involved. People ! providing user support are possibly not the same people who ! developed the application. Users should be able to generate ! log files (i.e. configure logging) while reproducing a bug to ! send back to developers. ! Implementation ! XXX Details to follow consensus that this proposal is a good idea. ! What Logging Levels? ! The following are the logging levels defined by the systems I looked at: ! - log4j: DEBUG, INFO, WARN, ERROR, FATAL ! - syslog: DEBUG, INFO, WARNING, ERROR, FATAL ! - JSR047: FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE ! - zLOG (used by Zope): ! TRACE=-300 -- Trace messages ! DEBUG=-200 -- Debugging messages ! BLATHER=-100 -- Somebody shut this app up. ! INFO=0 -- For things like startup and shutdown. ! PROBLEM=100 -- This isn't causing any immediate problems, but ! deserves attention. ! WARNING=100 -- A wishy-washy alias for PROBLEM. ! ERROR=200 -- This is going to have adverse effects. ! PANIC=300 -- We're dead! ! - mx.Log: ! SYSTEM_DEBUG ! SYSTEM_INFO ! SYSTEM_UNIMPORTANT ! SYSTEM_MESSAGE ! SYSTEM_WARNING ! SYSTEM_IMPORTANT ! SYSTEM_CANCEL ! SYSTEM_ERROR ! SYSTEM_PANIC ! SYSTEM_FATAL ! The current proposal is to copy log4j. XXX I suppose I could see ! adding zLOG's "TRACE" level, but I am not sure of the usefulness ! of others. - Static Logging Methods (as per Syslog)? ! Both zLOG and Syslog provide module-level logging functions rather ! (or in addition to) logging methods on a created Logger object. ! XXX Is this something that is deemed worth including? ! Pros: ! - It would make the simplest case shorter: - import logging - logging.error("Something is wrong") ! instead of ! import logging ! log = logging.getLogger("") ! log.error("Something is wrong") ! Cons: ! - It provides more than one way to do it. ! - It encourages logging without a channel name, because this ! mechanism would likely be implemented by implicitly logging ! on the root (and nameless) logger of the hierarchy. --- 391,576 ---- record. The following core Formatters will be implemented: ! - Formatter: Provide printf-like formatting, using the % operator. ! - BufferingFormatter: Provide formatting for multiple ! messages, with header and trailer formatting support. + Formatters are associated with Handlers by calling setFormatter() + on a handler: ! def setFormatter(self, form): ... ! Formatters use the % operator to format the logging message. The ! format string should contain %(name)x and the attribute dictionary ! of the LogRecord is used to obtain message-specific data. The ! following attributes are provided: ! %(name)s Name of the logger (logging channel) ! %(levelno)s Numeric logging level for the message (DEBUG, ! INFO, WARN, ERROR, CRITICAL) ! %(levelname)s Text logging level for the message ("DEBUG", "INFO", ! "WARN", "ERROR", "CRITICAL") + %(pathname)s Full pathname of the source file where the logging + call was issued (if available) ! %(filename)s Filename portion of pathname ! %(module)s Module from which logging call was made ! %(lineno)d Source line number where the logging call was issued ! (if available) ! %(created)f Time when the LogRecord was created (time.time() ! return value) ! %(asctime)s Textual time when the LogRecord was created ! %(msecs)d Millisecond portion of the creation time ! %(relativeCreated)d Time in milliseconds when the LogRecord was created, ! relative to the time the logging module was loaded ! (typically at application startup time) ! %(thread)d Thread ID (if available) ! %(message)s The result of record.getMessage(), computed just as ! the record is emitted + If a formatter sees that the format string includes "(asctime)s", + the creation time is formatted into the LogRecord's asctime + attribute. To allow flexibility in formatting dates, Formatters + are initialized with a format string for the message as a whole, + and a separate format string for date/time. The date/time format + string should be in time.strftime format. The default value for + the message format is "%(message)s". The default date/time format + is ISO8601. ! The formatter uses a class attribute, "converter", to indicate how ! to convert a time from seconds to a tuple. By default, the value ! of "converter" is "time.localtime". If needed, a different ! converter (e.g. "time.gmtime") can be set on an individual ! formatter instance, or the class attribute changed to affect all ! formatter instances. ! Filters ! When level-based filtering is insufficient, a Filter can be called ! by a Logger or Handler to decide if a LogRecord should be output. ! Loggers and Handlers can have multiple filters installed, and any ! one of them can veto a LogRecord being output. ! class Filter: ! def filter(self, record): ! """ ! Return a value indicating true if the record is to be ! processed. Possibly modify the record, if deemed ! appropriate by the filter. ! """ ! The default behaviour allows a Filter to be initialized with a ! Logger name. This will only allow through events which are ! generated using the named logger or any of its children. For ! example, a filter initialized with "A.B" will allow events logged ! by loggers "A.B", "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", ! "B.A.B" etc. If initialized with the empty string, all events are ! passed by the Filter. This filter behaviour is useful when it is ! desired to focus attention on one particular area of an ! application; the focus can be changed simply by changing a filter ! attached to the root logger. ! There are many examples of Filters provided in [6]. ! Configuration + The main benefit of a logging system like this is that one can + control how much and what logging output one gets from an + application without changing that application's source code. + Therefore, although configuration can be performed through the + logging API, it must also be possible to change the logging + configuration without changing an application at all. For + long-running programs like Zope, it should be possible to change + the logging configuration while the program is running. ! Configuration includes the following: ! - What logging level a logger or handler should be interested in. ! - What handlers should be attached to which loggers. ! - What filters should be attached to which handlers and loggers. ! - Specifying attributes specific to certain handlers and filters. + In general each application will have its own requirements for how + a user may configure logging output. However, each application + will specify the required configuration to the logging system + through a standard mechanism. ! The most simple configuration is that of a single handler, writing ! to stderr, attached to the root logger. This configuration is set ! up by calling the basicConfig() function once the logging module ! has been imported. ! def basicConfig(): ... ! For more sophisticated configurations, this PEP makes no specific ! proposals, for the following reasons: ! - A specific proposal may be seen as prescriptive. ! - Without the benefit of wide practical experience in the ! Python community, there is no way to know whether any given ! configuration approach is a good one. That practice can't ! really come until the logging module is used, and that means ! until *after* Python 2.3 has shipped. ! - There is a likelihood that different types of applications ! may require different configuration approaches, so that no ! "one size fits all". + The reference implementation [6] has a working configuration file + format, implemented for the purpose of proving the concept and + suggesting one possible alternative. It may be that separate + extension modules, not part of the core Python distribution, are + created for logging configuration and log viewing, supplemental + handlers and other features which are not of interest to the bulk + of the community. ! Thread Safety ! The logging system should support thread-safe operation without ! any special action needing to be taken by its users. ! Module-Level Functions ! To support use of the logging mechanism in short scripts and small ! applications, module-level functions debug(), info(), warn(), ! error(), critical() and exception() are provided. These work in ! the same way as the correspondingly named methods of Logger - in ! fact they delegate to the corresponding methods on the root ! logger. A further convenience provided by these functions is that ! if no configuration has been done, basicConfig() is automatically ! called. ! At application exit, all handlers can be flushed by calling the function ! ! def shutdown(): ... ! ! This will flush and close all handlers. ! ! ! Implementation ! ! The reference implementation is Vinay Sajip's logging module [6]. ! ! ! Packaging ! ! The reference implementation is implemented as a single module. ! This offers the simplest interface - all users have to do is ! "import logging" and they are in a position to use all the ! functionality available. *************** *** 423,431 **** [4] MAL mentions his mx.Log logging module: ! http://mail.python.org/pipermail/python-dev/2002-February/019767.html [5] Jeff Bauer's Mr. Creosote http://starship.python.net/crew/jbauer/creosote/ Copyright --- 588,600 ---- [4] MAL mentions his mx.Log logging module: ! http://mail.python.org/pipermail/python-dev/2002-February/019767.html [5] Jeff Bauer's Mr. Creosote http://starship.python.net/crew/jbauer/creosote/ + [6] Vinay Sajip's logging module. + http://www.red-dove.com/python_logging.html + + Copyright *************** *** 437,440 **** --- 606,610 ---- mode: indented-text indent-tabs-mode: nil + sentence-end-double-space: t fill-column: 70 End: From tim_one@users.sourceforge.net Mon Jul 8 20:11:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 12:11:10 -0700 Subject: [Python-checkins] python/dist/src/Parser node.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv21629 Modified Files: node.c Log Message: PyNode_AddChild() and fancy_roundup(): Be paranoid about int overflow. Index: node.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/node.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** node.c 8 Jul 2002 06:32:09 -0000 2.17 --- node.c 8 Jul 2002 19:11:07 -0000 2.18 *************** *** 19,23 **** } ! /* See comments at XXXROUNDUP below. */ static int fancy_roundup(int n) --- 19,23 ---- } ! /* See comments at XXXROUNDUP below. Returns -1 on overflow. */ static int fancy_roundup(int n) *************** *** 26,31 **** int result = 256; assert(n > 128); ! while (result < n) result <<= 1; return result; } --- 26,34 ---- int result = 256; assert(n > 128); ! while (result < n) { result <<= 1; + if (result <= 0) + return -1; + } return result; } *************** *** 63,66 **** --- 66,71 ---- current_capacity = XXXROUNDUP(nch); required_capacity = XXXROUNDUP(nch + 1); + if (current_capacity < 0 || required_capacity < 0) + return E_OVERFLOW; if (current_capacity < required_capacity) { n = n1->n_child; From tim_one@users.sourceforge.net Mon Jul 8 20:35:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 12:35:58 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.28,1.337.2.4.2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30495/Misc Modified Files: Tag: release22-maint NEWS Log Message: PyNode_AddChild(): Backporting an aggressive over-allocation policy when a parse node grows a very large number of children. This sidesteps platform realloc() disasters on several platforms. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.28 retrieving revision 1.337.2.4.2.29 diff -C2 -d -r1.337.2.4.2.28 -r1.337.2.4.2.29 *** NEWS 12 Jun 2002 03:48:46 -0000 1.337.2.4.2.28 --- NEWS 8 Jul 2002 19:35:54 -0000 1.337.2.4.2.29 *************** *** 5,8 **** --- 5,14 ---- Core and builtins + - Source that creates parse nodes with an extremely large number of + children (e.g., test_longexp.py) triggers problems with the + platform realloc() under several platforms (e.g., MacPython, and + Win98). This has been fixed via a more-aggressive overallocation + strategy. + - Fixed a bug with a continue inside a try block and a yield in the finally clause. [SF bug 567538] *************** *** 28,32 **** - String methods lstrip(), rstrip() and strip() now take an optional argument that specifies the characters to strip. For example, ! "Foo!!!?!?!?".rstrip("?!") -> "Foo". In addition, "200L".strip("L") will return "200". This is useful for replacing code that assumed longs will always be printed with a trailing "L". --- 34,38 ---- - String methods lstrip(), rstrip() and strip() now take an optional argument that specifies the characters to strip. For example, ! "Foo!!!?!?!?".rstrip("?!") -> "Foo". In addition, "200L".strip("L") will return "200". This is useful for replacing code that assumed longs will always be printed with a trailing "L". From tim_one@users.sourceforge.net Mon Jul 8 20:35:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 12:35:58 -0700 Subject: [Python-checkins] python/dist/src/Parser node.c,2.16,2.16.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv30495/Parser Modified Files: Tag: release22-maint node.c Log Message: PyNode_AddChild(): Backporting an aggressive over-allocation policy when a parse node grows a very large number of children. This sidesteps platform realloc() disasters on several platforms. Index: node.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/node.c,v retrieving revision 2.16 retrieving revision 2.16.26.1 diff -C2 -d -r2.16 -r2.16.26.1 *** node.c 26 Sep 2000 06:11:54 -0000 2.16 --- node.c 8 Jul 2002 19:35:56 -0000 2.16.26.1 *************** *** 19,41 **** } ! #define XXX 3 /* Node alignment factor to speed up realloc */ ! #define XXXROUNDUP(n) ((n) == 1 ? 1 : ((n) + XXX - 1) / XXX * XXX) int PyNode_AddChild(register node *n1, int type, char *str, int lineno) { ! register int nch = n1->n_nchildren; ! register int nch1 = nch+1; ! register node *n; if (nch == INT_MAX || nch < 0) return E_OVERFLOW; ! if (XXXROUNDUP(nch) < nch1) { n = n1->n_child; ! nch1 = XXXROUNDUP(nch1); ! PyMem_RESIZE(n, node, nch1); if (n == NULL) return E_NOMEM; n1->n_child = n; } n = &n1->n_child[n1->n_nchildren++]; n->n_type = type; --- 19,79 ---- } ! /* See comments at XXXROUNDUP below. Returns -1 on overflow. */ ! static int ! fancy_roundup(int n) ! { ! /* Round up to the closest power of 2 >= n. */ ! int result = 256; ! assert(n > 128); ! while (result < n) { ! result <<= 1; ! if (result <= 0) ! return -1; ! } ! return result; ! } ! ! /* A gimmick to make massive numbers of reallocs quicker. The result is ! * a number >= the input. For n=0 we must return 0. ! * For n=1, we return 1, to avoid wasting memory in common 1-child nodes ! * (XXX are those actually common?). ! * Else for n <= 128, round up to the closest multiple of 4. Why 4? ! * Rounding up to a multiple of an exact power of 2 is very efficient. ! * Else call fancy_roundup() to grow proportionately to n. We've got an ! * extreme case then (like test_longexp.py), and on many platforms doing ! * anything less than proportional growth leads to exorbitant runtime ! * (e.g., MacPython), or extreme fragmentation of user address space (e.g., ! * Win98). ! * This would be straightforward if a node stored its current capacity. The ! * code is tricky to avoid that. ! */ ! #define XXXROUNDUP(n) ((n) == 1 ? 1 : \ ! (n) <= 128 ? (((n) + 3) & ~3) : \ ! fancy_roundup(n)) ! int PyNode_AddChild(register node *n1, int type, char *str, int lineno) { ! const int nch = n1->n_nchildren; ! int current_capacity; ! int required_capacity; ! node *n; ! if (nch == INT_MAX || nch < 0) return E_OVERFLOW; ! ! current_capacity = XXXROUNDUP(nch); ! required_capacity = XXXROUNDUP(nch + 1); ! if (current_capacity < 0 || required_capacity < 0) ! return E_OVERFLOW; ! if (current_capacity < required_capacity) { n = n1->n_child; ! PyMem_RESIZE(n, node, required_capacity); if (n == NULL) return E_NOMEM; n1->n_child = n; } + n = &n1->n_child[n1->n_nchildren++]; n->n_type = type; From jackjansen@users.sourceforge.net Mon Jul 8 22:39:39 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 08 Jul 2002 14:39:39 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.98,1.99 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv3934 Modified Files: setup.py Log Message: The readme file said that OSX Carbon modules were only built for -enable-framework builds, but setup.py built them anyway. Fixed. Also normalized whitespace. Bugfix candidate. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** setup.py 27 Jun 2002 22:06:49 -0000 1.98 --- setup.py 8 Jul 2002 21:39:36 -0000 1.99 *************** *** 511,514 **** --- 511,515 ---- raise found except found: + dblibs = [dblib] # A default source build puts Berkeley DB in something like # /usr/local/Berkeley.3.3 and the lib dir under that isn't *************** *** 525,529 **** include_dirs=db_incs, define_macros=[('HAVE_DB_185_H',1)], ! libraries=[dblib])) else: exts.append(Extension('bsddb', ['bsddbmodule.c'], --- 526,530 ---- include_dirs=db_incs, define_macros=[('HAVE_DB_185_H',1)], ! libraries=dblibs)) else: exts.append(Extension('bsddb', ['bsddbmodule.c'], *************** *** 531,535 **** runtime_library_dirs=[dblib_dir], include_dirs=db_incs, ! libraries=[dblib])) else: db_incs = None --- 532,536 ---- runtime_library_dirs=[dblib_dir], include_dirs=db_incs, ! libraries=dblibs)) else: db_incs = None *************** *** 538,555 **** # The standard Unix dbm module: ! if platform not in ['cygwin', 'mac']: ! if (self.compiler.find_library_file(lib_dirs, 'ndbm')): exts.append( Extension('dbm', ['dbmmodule.c'], libraries = ['ndbm'] ) ) ! elif self.compiler.find_library_file(lib_dirs, 'gdbm'): exts.append( Extension('dbm', ['dbmmodule.c'], libraries = ['gdbm'] ) ) elif db_incs is not None: exts.append( Extension('dbm', ['dbmmodule.c'], ! library_dirs=dblib_dir, include_dirs=db_incs, libraries=dblibs)) - else: - exts.append( Extension('dbm', ['dbmmodule.c']) ) # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: --- 539,565 ---- # The standard Unix dbm module: ! if platform not in ['cygwin']: ! if (self.compiler.find_library_file(lib_dirs, 'ndbm') ! and find_file("ndbm.h", inc_dirs, []) is not None): exts.append( Extension('dbm', ['dbmmodule.c'], + define_macros=[('HAVE_NDBM_H',None)], libraries = ['ndbm'] ) ) ! elif (platform in ['darwin'] ! and find_file("ndbm.h", inc_dirs, []) is not None): ! # Darwin has ndbm in libc exts.append( Extension('dbm', ['dbmmodule.c'], + define_macros=[('HAVE_NDBM_H',None)]) ) + elif (self.compiler.find_library_file(lib_dirs, 'gdbm') + and find_file("gdbm/ndbm.h", inc_dirs, []) is not None): + exts.append( Extension('dbm', ['dbmmodule.c'], + define_macros=[('HAVE_GDBM_NDBM_H',None)], libraries = ['gdbm'] ) ) elif db_incs is not None: exts.append( Extension('dbm', ['dbmmodule.c'], ! library_dirs=[dblib_dir], include_dirs=db_incs, + define_macros=[('HAVE_BERKDB_H',None), + ('DB_DBM_HSEARCH',None)], libraries=dblibs)) # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: *************** *** 713,742 **** if platform == 'darwin': ! # Mac OS X specific modules. These are ported over from MacPython ! # and still experimental. Some (such as gestalt or icglue) are ! # already generally useful, some (the GUI ones) really need to ! # be used from a framework. # # I would like to trigger on WITH_NEXT_FRAMEWORK but that isn't # available here. This Makefile variable is also what the install # procedure triggers on. - frameworkdir = sysconfig.get_config_var('PYTHONFRAMEWORKDIR') - exts.append( Extension('gestalt', ['gestaltmodule.c'], - extra_link_args=['-framework', 'Carbon']) ) - exts.append( Extension('MacOS', ['macosmodule.c'], - extra_link_args=['-framework', 'Carbon']) ) - exts.append( Extension('icglue', ['icgluemodule.c'], - extra_link_args=['-framework', 'Carbon']) ) - exts.append( Extension('macfs', - ['macfsmodule.c', - '../Python/getapplbycreator.c'], - extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_CF', ['cf/_CFmodule.c', 'cf/pycfbridge.c'], extra_link_args=['-framework', 'CoreFoundation']) ) ! exts.append( Extension('_Res', ['res/_Resmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! if frameworkdir: exts.append( Extension('Nav', ['Nav.c'], extra_link_args=['-framework', 'Carbon']) ) --- 723,754 ---- if platform == 'darwin': ! # Mac OS X specific modules. Modules linked against the Carbon ! # framework are only built for framework-enabled Pythons. As ! # of MacOSX 10.1 importing the Carbon framework from a non-windowing ! # application (MacOSX server, not logged in on the console) may ! # result in Python crashing. # # I would like to trigger on WITH_NEXT_FRAMEWORK but that isn't # available here. This Makefile variable is also what the install # procedure triggers on. exts.append( Extension('_CF', ['cf/_CFmodule.c', 'cf/pycfbridge.c'], extra_link_args=['-framework', 'CoreFoundation']) ) ! ! framework = sysconfig.get_config_var('PYTHONFRAMEWORK') ! if framework: ! exts.append( Extension('gestalt', ['gestaltmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('MacOS', ['macosmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('icglue', ['icgluemodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('macfs', ! ['macfsmodule.c', ! '../Python/getapplbycreator.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Res', ['res/_Resmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('Nav', ['Nav.c'], extra_link_args=['-framework', 'Carbon']) ) *************** *** 790,794 **** ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) waste_libs = find_library_file(self.compiler, "WASTE", [], ! ["../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) if waste_incs != None and waste_libs != None: (srcdir,) = sysconfig.get_config_vars('srcdir') --- 802,806 ---- ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) waste_libs = find_library_file(self.compiler, "WASTE", [], ! [ "../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) if waste_incs != None and waste_libs != None: (srcdir,) = sysconfig.get_config_vars('srcdir') From tim_one@users.sourceforge.net Mon Jul 8 23:12:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 15:12:03 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.437,1.438 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12066/python/Misc Modified Files: NEWS Log Message: SF bug 578752: COUNT_ALLOCS vs heap types Repair segfaults and infinite loops in COUNT_ALLOCS builds in the presence of new-style (heap-allocated) classes/types. Bugfix candidate. I'll backport this to 2.2. It's irrelevant in 2.1. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.437 retrieving revision 1.438 diff -C2 -d -r1.437 -r1.438 *** NEWS 7 Jul 2002 03:59:33 -0000 1.437 --- NEWS 8 Jul 2002 22:11:50 -0000 1.438 *************** *** 295,298 **** --- 295,306 ---- Build + - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or + get into infinite loops, when a new-style class got garbage-collected. + Unfortunately, to avoid this, the way COUNT_ALLOCS works requires + that new-style classes be immortal in COUNT_ALLOCS builds. Note that + COUNT_ALLOCS is not enabled by default, in either release or debug + builds, and that new-style classes are immortal only in COUNT_ALLOCS + builds. + - Compiling out the cyclic garbage collector is no longer an option. The old symbol WITH_CYCLE_GC is now ignored, and Python.h arranges From tim_one@users.sourceforge.net Mon Jul 8 23:12:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 15:12:03 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.183,2.184 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12066/python/Objects Modified Files: object.c Log Message: SF bug 578752: COUNT_ALLOCS vs heap types Repair segfaults and infinite loops in COUNT_ALLOCS builds in the presence of new-style (heap-allocated) classes/types. Bugfix candidate. I'll backport this to 2.2. It's irrelevant in 2.1. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.183 retrieving revision 2.184 diff -C2 -d -r2.183 -r2.184 *** object.c 7 Jul 2002 19:59:50 -0000 2.183 --- object.c 8 Jul 2002 22:11:52 -0000 2.184 *************** *** 75,78 **** --- 75,87 ---- Py_FatalError("XXX inc_count sanity check"); tp->tp_next = type_list; + /* Note that as of Python 2.2, heap-allocated type objects + * can go away, but this code requires that they stay alive + * until program exit. That's why we're careful with + * refcounts here. type_list gets a new reference to tp, + * while ownership of the reference type_list used to hold + * (if any) was transferred to tp->tp_next in the line above. + * tp is thus effectively immortal after this. + */ + Py_INCREF(tp); type_list = tp; } From tim_one@users.sourceforge.net Mon Jul 8 23:30:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 15:30:54 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.29,1.337.2.4.2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18101/Misc Modified Files: Tag: release22-maint NEWS Log Message: SF bug 578752: COUNT_ALLOCS vs heap types Repair segfaults and infinite loops in COUNT_ALLOCS builds in the presence of new-style (heap-allocated) classes/types. Note: test_gc fails in a COUNT_ALLOCS build now, because it expects a new-style class to get garbage collected. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.29 retrieving revision 1.337.2.4.2.30 diff -C2 -d -r1.337.2.4.2.29 -r1.337.2.4.2.30 *** NEWS 8 Jul 2002 19:35:54 -0000 1.337.2.4.2.29 --- NEWS 8 Jul 2002 22:30:52 -0000 1.337.2.4.2.30 *************** *** 46,52 **** [SF patch 560794]. ! C API Windows --- 46,60 ---- [SF patch 560794]. + Build ! - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or ! get into infinite loops, when a new-style class got garbage-collected. ! Unfortunately, to avoid this, the way COUNT_ALLOCS works requires ! that new-style classes be immortal in COUNT_ALLOCS builds. Note that ! COUNT_ALLOCS is not enabled by default, in either release or debug ! builds, and that new-style classes are immortal only in COUNT_ALLOCS ! builds. SourceForge bug 578752. + C API Windows From tim_one@users.sourceforge.net Mon Jul 8 23:30:55 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 15:30:55 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.162.6.4,2.162.6.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18101/Objects Modified Files: Tag: release22-maint object.c Log Message: SF bug 578752: COUNT_ALLOCS vs heap types Repair segfaults and infinite loops in COUNT_ALLOCS builds in the presence of new-style (heap-allocated) classes/types. Note: test_gc fails in a COUNT_ALLOCS build now, because it expects a new-style class to get garbage collected. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.162.6.4 retrieving revision 2.162.6.5 diff -C2 -d -r2.162.6.4 -r2.162.6.5 *** object.c 13 Jun 2002 21:39:47 -0000 2.162.6.4 --- object.c 8 Jul 2002 22:30:52 -0000 2.162.6.5 *************** *** 80,83 **** --- 80,92 ---- Py_FatalError("XXX inc_count sanity check"); tp->tp_next = type_list; + /* Note that as of Python 2.2, heap-allocated type objects + * can go away, but this code requires that they stay alive + * until program exit. That's why we're careful with + * refcounts here. type_list gets a new reference to tp, + * while ownership of the reference type_list used to hold + * (if any) was transferred to tp->tp_next in the line above. + * tp is thus effectively immortal after this. + */ + Py_INCREF(tp); type_list = tp; } From bwarsaw@users.sourceforge.net Tue Jul 9 03:13:12 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:13:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv6079/email Modified Files: __init__.py Log Message: With the addition of Oleg's support for RFC 2231, it's time to bump the version number to 2.1. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 1 Jun 2002 06:03:09 -0000 1.8 --- __init__.py 9 Jul 2002 02:13:10 -0000 1.9 *************** *** 5,9 **** """ ! __version__ = '2.0.5' __all__ = ['Charset', --- 5,9 ---- """ ! __version__ = '2.1' __all__ = ['Charset', From bwarsaw@users.sourceforge.net Tue Jul 9 03:36:12 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:36:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/data msg_28.txt,NONE,1.1 msg_30.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/data In directory usw-pr-cvs1:/tmp/cvs-serv11554/test/data Added Files: msg_28.txt msg_30.txt Log Message: New files which test the corners of multipart/message and message/rfc822 compliance. --- NEW FILE: msg_28.txt --- From: aperson@dom.ain MIME-Version: 1.0 Content-Type: multipart/digest; boundary=BOUNDARY --BOUNDARY Content-Type: message/rfc822 Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 1 --BOUNDARY Content-Type: message/rfc822 Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 2 --BOUNDARY-- --- NEW FILE: msg_30.txt --- From: aperson@dom.ain MIME-Version: 1.0 Content-Type: multipart/digest; boundary=BOUNDARY --BOUNDARY Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 1 --BOUNDARY Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 2 --BOUNDARY-- From bwarsaw@users.sourceforge.net Tue Jul 9 03:38:26 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:38:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11982/test Modified Files: test_email.py Log Message: TestEmailBase.ndiffAssertEqual(): Python 2.1's difflib doesn't have an ndiff function, so just alias it to assertEqual in that case. Various: make sure all openfile()/read()'s are wrapped in try/finally's so the file gets closed. A bunch of new tests checking the corner cases for multipart/digest and message/rfc822. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** test_email.py 29 Jun 2002 15:23:39 -0000 1.38 --- test_email.py 9 Jul 2002 02:38:24 -0000 1.39 *************** *** 24,27 **** --- 24,28 ---- from email.MIMEBase import MIMEBase from email.MIMEMessage import MIMEMessage + from email.MIMEMultipart import MIMEMultipart from email import Utils from email import Errors *************** *** 52,62 **** # Base test class class TestEmailBase(unittest.TestCase): ! def ndiffAssertEqual(self, first, second): ! """Like failUnlessEqual except use ndiff to produce readable output.""" ! if first <> second: ! diff = difflib.ndiff(first.splitlines(), second.splitlines()) ! fp = StringIO() ! print >> fp, NL, NL.join(diff) ! raise self.failureException, fp.getvalue() def _msgobj(self, filename): --- 53,68 ---- # Base test class class TestEmailBase(unittest.TestCase): ! if hasattr(difflib, 'ndiff'): ! # Python 2.2 and beyond ! def ndiffAssertEqual(self, first, second): ! """Like failUnlessEqual except use ndiff for readable output.""" ! if first <> second: ! diff = difflib.ndiff(first.splitlines(), second.splitlines()) ! fp = StringIO() ! print >> fp, NL, NL.join(diff) ! raise self.failureException, fp.getvalue() ! else: ! # Python 2.1 ! ndiffAssertEqual = unittest.TestCase.assertEqual def _msgobj(self, filename): *************** *** 907,911 **** def test_multipart_no_boundary(self): fp = openfile(findfile('msg_25.txt')) ! self.assertRaises(Errors.BoundaryError, email.message_from_file, fp) --- 913,921 ---- def test_multipart_no_boundary(self): fp = openfile(findfile('msg_25.txt')) ! try: ! self.assertRaises(Errors.BoundaryError, ! email.message_from_file, fp) ! finally: ! fp.close() *************** *** 949,954 **** def setUp(self): fp = openfile('msg_11.txt') ! self._text = fp.read() ! fp.close() def test_type_error(self): --- 959,966 ---- def setUp(self): fp = openfile('msg_11.txt') ! try: ! self._text = fp.read() ! finally: ! fp.close() def test_type_error(self): *************** *** 1092,1095 **** --- 1104,1221 ---- self.assertEqual(sfp.getvalue(), text) + def test_default_type(self): + eq = self.assertEqual + fp = openfile('msg_30.txt') + try: + msg = email.message_from_file(fp) + finally: + fp.close() + container1 = msg.get_payload(0) + eq(container1.get_default_type(), 'message/rfc822') + eq(container1.get_type(), None) + container2 = msg.get_payload(1) + eq(container2.get_default_type(), 'message/rfc822') + eq(container2.get_type(), None) + container1a = container1.get_payload(0) + eq(container1a.get_default_type(), 'text/plain') + eq(container1a.get_type(), 'text/plain') + container2a = container2.get_payload(0) + eq(container2a.get_default_type(), 'text/plain') + eq(container2a.get_type(), 'text/plain') + + def test_default_type_with_explicit_container_type(self): + eq = self.assertEqual + fp = openfile('msg_28.txt') + try: + msg = email.message_from_file(fp) + finally: + fp.close() + container1 = msg.get_payload(0) + eq(container1.get_default_type(), 'message/rfc822') + eq(container1.get_type(), 'message/rfc822') + container2 = msg.get_payload(1) + eq(container2.get_default_type(), 'message/rfc822') + eq(container2.get_type(), 'message/rfc822') + container1a = container1.get_payload(0) + eq(container1a.get_default_type(), 'text/plain') + eq(container1a.get_type(), 'text/plain') + container2a = container2.get_payload(0) + eq(container2a.get_default_type(), 'text/plain') + eq(container2a.get_type(), 'text/plain') + + def test_default_type_non_parsed(self): + eq = self.assertEqual + neq = self.ndiffAssertEqual + # Set up container + container = MIMEMultipart('digest', 'BOUNDARY') + container.epilogue = '\n' + # Set up subparts + subpart1a = MIMEText('message 1\n') + subpart2a = MIMEText('message 2\n') + subpart1 = MIMEMessage(subpart1a) + subpart2 = MIMEMessage(subpart2a) + container.attach(subpart1) + container.attach(subpart2) + eq(subpart1.get_type(), 'message/rfc822') + eq(subpart1.get_default_type(), 'message/rfc822') + eq(subpart2.get_type(), 'message/rfc822') + eq(subpart2.get_default_type(), 'message/rfc822') + neq(container.as_string(0), '''\ + Content-Type: multipart/digest; boundary="BOUNDARY" + MIME-Version: 1.0 + + --BOUNDARY + Content-Type: message/rfc822 + MIME-Version: 1.0 + + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + message 1 + + --BOUNDARY + Content-Type: message/rfc822 + MIME-Version: 1.0 + + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + message 2 + + --BOUNDARY-- + ''') + del subpart1['content-type'] + del subpart1['mime-version'] + del subpart2['content-type'] + del subpart2['mime-version'] + eq(subpart1.get_type(), None) + eq(subpart1.get_default_type(), 'message/rfc822') + eq(subpart2.get_type(), None) + eq(subpart2.get_default_type(), 'message/rfc822') + neq(container.as_string(0), '''\ + Content-Type: multipart/digest; boundary="BOUNDARY" + MIME-Version: 1.0 + + --BOUNDARY + + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + message 1 + + --BOUNDARY + + Content-Type: text/plain; charset="us-ascii" + MIME-Version: 1.0 + Content-Transfer-Encoding: 7bit + + message 2 + + --BOUNDARY-- + ''') + *************** *** 1148,1154 **** self._idempotent(msg, text) ! ## def test_MIME_digest_with_part_headers(self): ! ## msg, text = self._msgobj('msg_28.txt') ! ## self._idempotent(msg, text) def test_mixed_with_image(self): --- 1274,1280 ---- self._idempotent(msg, text) ! def test_MIME_digest_with_part_headers(self): ! msg, text = self._msgobj('msg_28.txt') ! self._idempotent(msg, text) def test_mixed_with_image(self): *************** *** 1401,1405 **** lines = list(it) eq(len(lines), 43) ! eq(EMPTYSTRING.join(lines), openfile('msg_19.txt').read()) def test_typed_subpart_iterator(self): --- 1527,1535 ---- lines = list(it) eq(len(lines), 43) ! fp = openfile('msg_19.txt') ! try: ! eq(EMPTYSTRING.join(lines), fp.read()) ! finally: ! fp.close() def test_typed_subpart_iterator(self): *************** *** 1441,1451 **** ! class TestParsers(unittest.TestCase): def test_header_parser(self): eq = self.assertEqual # Parse only the headers of a complex multipart MIME document - p = HeaderParser() fp = openfile('msg_02.txt') ! msg = p.parse(fp) eq(msg['from'], 'ppp-request@zzz.org') eq(msg['to'], 'ppp@zzz.org') --- 1571,1583 ---- ! class TestParsers(TestEmailBase): def test_header_parser(self): eq = self.assertEqual # Parse only the headers of a complex multipart MIME document fp = openfile('msg_02.txt') ! try: ! msg = HeaderParser().parse(fp) ! finally: ! fp.close() eq(msg['from'], 'ppp-request@zzz.org') eq(msg['to'], 'ppp@zzz.org') *************** *** 1475,1480 **** eq = self.assertEqual fp = openfile('msg_26.txt') ! p = Parser() ! msg = p.parse(fp) eq(len(msg.get_payload()), 2) part1 = msg.get_payload(0) --- 1607,1614 ---- eq = self.assertEqual fp = openfile('msg_26.txt') ! try: ! msg = Parser().parse(fp) ! finally: ! fp.close() eq(len(msg.get_payload()), 2) part1 = msg.get_payload(0) *************** *** 1484,1500 **** eq(part2.get_type(), 'application/riscos') ! ## def test_multipart_digest_with_extra_mime_headers(self): ! ## eq = self.assertEqual ! ## fp = openfile('msg_28.txt') ! ## p = Parser() ! ## msg = p.parse(fp) ! ## self.failUnless(msg.is_multipart()) ! ## eq(len(msg.get_payload()), 2) ! ## part1 = msg.get_payload(0) ! ## eq(part1.get_type(), 'text/plain') ! ## eq(part1.get_payload(), 'message 1') ! ## part2 = msg.get_payload(1) ! ## eq(part2.get_type(), 'text/plain') ! ## eq(part2.get_payload(), 'message 2') --- 1618,1654 ---- eq(part2.get_type(), 'application/riscos') ! def test_multipart_digest_with_extra_mime_headers(self): ! eq = self.assertEqual ! neq = self.ndiffAssertEqual ! fp = openfile('msg_28.txt') ! try: ! msg = email.message_from_file(fp) ! finally: ! fp.close() ! # Structure is: ! # multipart/digest ! # message/rfc822 ! # text/plain ! # message/rfc822 ! # text/plain ! eq(msg.is_multipart(), 1) ! eq(len(msg.get_payload()), 2) ! part1 = msg.get_payload(0) ! eq(part1.get_type(), 'message/rfc822') ! eq(part1.is_multipart(), 1) ! eq(len(part1.get_payload()), 1) ! part1a = part1.get_payload(0) ! eq(part1a.is_multipart(), 0) ! eq(part1a.get_type(), 'text/plain') ! neq(part1a.get_payload(), 'message 1\n') ! # next message/rfc822 ! part2 = msg.get_payload(1) ! eq(part2.get_type(), 'message/rfc822') ! eq(part2.is_multipart(), 1) ! eq(len(part2.get_payload()), 1) ! part2a = part2.get_payload(0) ! eq(part2a.is_multipart(), 0) ! eq(part2a.get_type(), 'text/plain') ! neq(part2a.get_payload(), 'message 2\n') From bwarsaw@users.sourceforge.net Tue Jul 9 03:39:09 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:39:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv12158/email Modified Files: Iterators.py Log Message: _structure(): A handy little debugging aid that I don't (yet) intend to make public, but that others might still find useful. Index: Iterators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Iterators.py 19 May 2002 23:44:19 -0000 1.7 --- Iterators.py 9 Jul 2002 02:39:07 -0000 1.8 *************** *** 10,11 **** --- 10,21 ---- # Python 2.1 doesn't have generators from email._compat21 import body_line_iterator, typed_subpart_iterator + + + + def _structure(msg, level=0): + """A handy debugging aid""" + tab = ' ' * (level * 4) + print tab + msg.get('content-type', msg.get_default_type()) + if msg.is_multipart(): + for subpart in msg.get_payload(): + _structure(subpart, level+1) From bwarsaw@users.sourceforge.net Tue Jul 9 03:40:37 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:40:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/email MIMEMessage.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv12501/email Modified Files: MIMEMessage.py Log Message: __init__(): Be sure to set the default type to message/rfc822. Index: MIMEMessage.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/MIMEMessage.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MIMEMessage.py 2 Jun 2002 19:05:08 -0000 1.5 --- MIMEMessage.py 9 Jul 2002 02:40:35 -0000 1.6 *************** *** 29,30 **** --- 29,32 ---- # this way or we'll get an exception Message.Message.attach(self, _msg) + # And be sure our default type is set correctly + self.set_default_type('message/rfc822') From bwarsaw@users.sourceforge.net Tue Jul 9 03:43:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:43:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv13350/email Modified Files: Generator.py Log Message: clone(): A new method for creating a clone of this generator (for recursive generation). _dispatch(): If the message object doesn't have a Content-Type: header, check its default type instead of assuming it's text/plain. This makes for correct generation of message/rfc822 containers. _handle_multipart(): We can get rid of the isdigest kludge. Just print the message as normal and everything will work out correctly. _handle_mulitpart_digest(): We don't need this anymore either. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Generator.py 28 Jun 2002 23:41:42 -0000 1.10 --- Generator.py 9 Jul 2002 02:43:47 -0000 1.11 *************** *** 84,87 **** --- 84,91 ---- __call__ = flatten + def clone(self, fp): + """Clone this generator with the exact same options.""" + return self.__class__(fp, self._mangle_from_, self.__maxheaderlen) + # # Protected interface - undocumented ;/ *************** *** 122,137 **** ctype = msg.get_type() if ctype is None: ! # No Content-Type: header so try the default handler ! self._writeBody(msg) ! else: ! # We do have a Content-Type: header. ! specific = UNDERSCORE.join(ctype.split('/')).replace('-', '_') ! meth = getattr(self, '_handle_' + specific, None) if meth is None: ! generic = msg.get_main_type().replace('-', '_') ! meth = getattr(self, '_handle_' + generic, None) ! if meth is None: ! meth = self._writeBody ! meth(msg) # --- 126,143 ---- ctype = msg.get_type() if ctype is None: ! # No Content-Type: header so use the default type, which must be ! # either text/plain or message/rfc822. ! ctype = msg.get_default_type() ! assert ctype in ('text/plain', 'message/rfc822') ! # We do have a Content-Type: header. ! main, sub = ctype.split('/') ! specific = UNDERSCORE.join((main, sub)).replace('-', '_') ! meth = getattr(self, '_handle_' + specific, None) ! if meth is None: ! generic = main.replace('-', '_') ! meth = getattr(self, '_handle_' + generic, None) if meth is None: ! meth = self._writeBody ! meth(msg) # *************** *** 197,201 **** _writeBody = _handle_text ! def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't --- 203,207 ---- _writeBody = _handle_text ! def _handle_multipart(self, msg): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't *************** *** 204,208 **** subparts = msg.get_payload() if subparts is None: ! # Nothing has every been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary --- 210,214 ---- subparts = msg.get_payload() if subparts is None: ! # Nothing has ever been attached boundary = msg.get_boundary(failobj=_make_boundary()) print >> self._fp, '--' + boundary *************** *** 215,219 **** for part in subparts: s = StringIO() ! g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) g.flatten(part, unixfrom=0) msgtexts.append(s.getvalue()) --- 221,225 ---- for part in subparts: s = StringIO() ! g = self.clone(s) g.flatten(part, unixfrom=0) msgtexts.append(s.getvalue()) *************** *** 237,248 **** # newline. print >> self._fp, '--' + boundary - if isdigest: - print >> self._fp # Join and write the individual parts joiner = '\n--' + boundary + '\n' - if isdigest: - # multipart/digest types effectively add an extra newline between - # the boundary and the body part. - joiner += '\n' self._fp.write(joiner.join(msgtexts)) print >> self._fp, '\n--' + boundary + '--', --- 243,248 ---- *************** *** 253,259 **** self._fp.write(msg.epilogue) - def _handle_multipart_digest(self, msg): - self._handle_multipart(msg, isdigest=1) - def _handle_message_delivery_status(self, msg): # We can't just write the headers directly to self's file object --- 253,256 ---- *************** *** 263,267 **** for part in msg.get_payload(): s = StringIO() ! g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) g.flatten(part, unixfrom=0) text = s.getvalue() --- 260,264 ---- for part in msg.get_payload(): s = StringIO() ! g = self.clone(s) g.flatten(part, unixfrom=0) text = s.getvalue() *************** *** 279,287 **** def _handle_message(self, msg): s = StringIO() ! g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message ! # object for the subpart.Extract that object, stringify it, and write ! # that out. g.flatten(msg.get_payload(0), unixfrom=0) self._fp.write(s.getvalue()) --- 276,284 ---- def _handle_message(self, msg): s = StringIO() ! g = self.clone(s) # The payload of a message/rfc822 part should be a multipart sequence # of length 1. The zeroth element of the list should be the Message ! # object for the subpart. Extract that object, stringify it, and ! # write it out. g.flatten(msg.get_payload(0), unixfrom=0) self._fp.write(s.getvalue()) From bwarsaw@users.sourceforge.net Tue Jul 9 03:44:28 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:44:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/email MIMEMultipart.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv13493/email Modified Files: MIMEMultipart.py Log Message: __init__(): Don't attach the subparts if its an empty tuple. If the boundary was given in the arguments, call set_boundary(). Index: MIMEMultipart.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/MIMEMultipart.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MIMEMultipart.py 1 Jun 2002 05:59:12 -0000 1.1 --- MIMEMultipart.py 9 Jul 2002 02:44:26 -0000 1.2 *************** *** 31,34 **** keyword arguments (or passed into the _params argument). """ ! MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **params) ! self.attach(*list(_subparts)) --- 31,37 ---- keyword arguments (or passed into the _params argument). """ ! MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params) ! if _subparts: ! self.attach(*list(_subparts)) ! if boundary: ! self.set_boundary(boundary) From bwarsaw@users.sourceforge.net Tue Jul 9 03:46:14 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:46:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv13919/email Modified Files: Message.py Log Message: Add the concept of a "default type". Normally the default type is text/plain but the RFCs state that inside a multipart/digest, the default type is message/rfc822. To preserve idempotency, we need a separate place to define the default type than the Content-Type: header. get_default_type(), set_default_type(): Accessor and mutator methods for the default type. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Message.py 29 Jun 2002 05:56:15 -0000 1.14 --- Message.py 9 Jul 2002 02:46:12 -0000 1.15 *************** *** 80,83 **** --- 80,85 ---- # Defaults for multipart messages self.preamble = self.epilogue = None + # Default content type + self._default_type = 'text/plain' def __str__(self): *************** *** 395,398 **** --- 397,420 ---- return ctype.split('/')[1] return failobj + + def get_default_type(self): + """Return the `default' content type. + + Most messages have a default content type of text/plain, except for + messages that are subparts of multipart/digest containers. Such + subparts then have a default content type of message/rfc822. + """ + return self._default_type + + def set_default_type(self, ctype): + """Set the `default' content type. + + ctype must be either "text/plain" or "message/rfc822". The default + content type is not stored in the Content-Type: header. + """ + if ctype not in ('text/plain', 'message/rfc822'): + raise ValueError( + 'first arg must be either "text/plain" or "message/rfc822"') + self._default_type = ctype def _get_params_preserve(self, failobj, header): From bwarsaw@users.sourceforge.net Tue Jul 9 03:50:04 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:50:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv14753/email Modified Files: Parser.py Log Message: Anthony Baxter's patch for non-strict parsing. This adds a `strict' argument to the constructor -- defaulting to true -- which is different than Anthony's approach of using global state. parse(), parsestr(): Grow a `headersonly' argument which stops parsing once the header block has been seen, i.e. it does /not/ parse or even read the body of the message. This is used for parsing message/rfc822 type messages. We need test cases for the non-strict parsing. Anthony will supply these. _parsebody(): We can get rid of the isdigest end-of-line kludges, although we still need to know if we're parsing a multipart/digest so we can set the default type accordingly. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Parser.py 2 Jun 2002 19:12:03 -0000 1.9 --- Parser.py 9 Jul 2002 02:50:02 -0000 1.10 *************** *** 15,22 **** NL = '\n' - class Parser: ! def __init__(self, _class=Message.Message): """Parser of RFC 2822 and MIME email messages. --- 15,21 ---- NL = '\n' class Parser: ! def __init__(self, _class=Message.Message, strict=1): """Parser of RFC 2822 and MIME email messages. *************** *** 33,47 **** must be created. This class must have a constructor that can take zero arguments. Default is Message.Message. """ self._class = _class ! def parse(self, fp): root = self._class() self._parseheaders(root, fp) ! self._parsebody(root, fp) return root ! def parsestr(self, text): ! return self.parse(StringIO(text)) def _parseheaders(self, container, fp): --- 32,54 ---- must be created. This class must have a constructor that can take zero arguments. Default is Message.Message. + + Optional strict tells the parser to be strictly RFC compliant or to be + more forgiving in parsing of ill-formatted MIME documents. When + non-strict mode is used, the parser will try to make up for missing or + erroneous boundaries and other peculiarities seen in the wild. + Defaults to strict parsing. """ self._class = _class + self._strict = strict ! def parse(self, fp, headersonly=0): root = self._class() self._parseheaders(root, fp) ! if not headersonly: ! self._parsebody(root, fp) return root ! def parsestr(self, text, headersonly=0): ! return self.parse(StringIO(text), headersonly=headersonly) def _parseheaders(self, container, fp): *************** *** 68,74 **** container.set_unixfrom(line) continue ! else: raise Errors.HeaderParseError( 'Unix-from in headers after first rfc822 header') # Header continuation line if line[0] in ' \t': --- 75,85 ---- container.set_unixfrom(line) continue ! elif self._strict: raise Errors.HeaderParseError( 'Unix-from in headers after first rfc822 header') + else: + # ignore the wierdly placed From_ line + # XXX: maybe set unixfrom anyway? or only if not already? + continue # Header continuation line if line[0] in ' \t': *************** *** 85,90 **** i = line.find(':') if i < 0: ! raise Errors.HeaderParseError( ! 'Not a header, not a continuation') if lastheader: container[lastheader] = NL.join(lastvalue) --- 96,108 ---- i = line.find(':') if i < 0: ! 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) *************** *** 123,127 **** mo = cre.search(payload, start) if mo: ! start += len(mo.group(0)) * (1 + isdigest) # We create a compiled regexp first because we need to be able to # specify the start position, and the module function doesn't --- 141,145 ---- mo = cre.search(payload, start) if mo: ! start += len(mo.group(0)) # We create a compiled regexp first because we need to be able to # specify the start position, and the module function doesn't *************** *** 130,151 **** re.escape(separator) + '--') mo = cre.search(payload, start) ! if not mo: raise Errors.BoundaryError( ! "Couldn't find terminating boundary: %s" % boundary) ! terminator = mo.start() ! linesep = mo.group('sep') ! if mo.end() < len(payload): ! # there's some post-MIME boundary epilogue ! epilogue = payload[mo.end():] # We split the textual payload on the boundary separator, which ! # includes the trailing newline. If the container is a ! # multipart/digest then the subparts are by default message/rfc822 ! # instead of text/plain. In that case, they'll have an extra ! # newline before the headers to distinguish the message's headers ! # from the subpart headers. ! separator += linesep * (1 + isdigest) parts = payload[start:terminator].split(linesep + separator) for part in parts: ! msgobj = self.parsestr(part) container.preamble = preamble container.epilogue = epilogue --- 148,198 ---- re.escape(separator) + '--') mo = cre.search(payload, start) ! if mo: ! terminator = mo.start() ! linesep = mo.group('sep') ! if mo.end() < len(payload): ! # there's some post-MIME boundary epilogue ! epilogue = payload[mo.end():] ! elif self._strict: raise Errors.BoundaryError( ! "Couldn't find terminating boundary: %s" % boundary) ! else: ! # handle the case of no trailing boundary. I hate mail clients. ! # check that it ends in a blank line ! endre = re.compile('(?P\r\n|\r|\n){2}$') ! mo = endre.search(payload) ! if not mo: ! raise Errors.BoundaryError( ! "Couldn't find terminating boundary, and no "+ ! "trailing empty line") ! else: ! linesep = mo.group('sep') ! terminator = len(payload) # We split the textual payload on the boundary separator, which ! # includes the trailing newline. If the container is a ! # multipart/digest then the subparts are by default message/rfc822 ! # instead of text/plain. In that case, they'll have a optional ! # block of MIME headers, then an empty line followed by the ! # message headers. ! separator += linesep parts = payload[start:terminator].split(linesep + separator) for part in parts: ! if isdigest: ! if part[0] == linesep: ! # There's no header block so create an empty message ! # object as the container, and lop off the newline so ! # we can parse the sub-subobject ! msgobj = self._class() ! part = part[1:] ! else: ! parthdrs, part = part.split(linesep+linesep, 1) ! # msgobj in this case is the "message/rfc822" container ! msgobj = self.parsestr(parthdrs, headersonly=1) ! # while submsgobj is the message itself ! submsgobj = self.parsestr(part) ! msgobj.attach(submsgobj) ! msgobj.set_default_type('message/rfc822') ! else: ! msgobj = self.parsestr(part) container.preamble = preamble container.epilogue = epilogue From tim_one@users.sourceforge.net Tue Jul 9 03:57:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:57:03 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.184,2.185 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13269/python/Objects Modified Files: object.c Log Message: The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -d -r2.184 -r2.185 *** object.c 8 Jul 2002 22:11:52 -0000 2.184 --- object.c 9 Jul 2002 02:57:01 -0000 2.185 *************** *** 92,95 **** --- 92,110 ---- #endif + #ifdef Py_REF_DEBUG + /* Log a fatal error; doesn't return. */ + void + _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op) + { + char buf[300]; + + PyOS_snprintf(buf, sizeof(buf), + "%s:%i object at %p has negative ref count %i", + fname, lineno, op, op->ob_refcnt); + Py_FatalError(buf); + } + + #endif /* Py_REF_DEBUG */ + PyObject * PyObject_Init(PyObject *op, PyTypeObject *tp) From tim_one@users.sourceforge.net Tue Jul 9 03:57:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:57:03 -0700 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv13269/python/Doc/api Modified Files: utilities.tex Log Message: The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** utilities.tex 17 Jun 2002 15:44:18 -0000 1.5 --- utilities.tex 9 Jul 2002 02:57:01 -0000 1.6 *************** *** 59,63 **** \section{Process Control \label{processControl}} ! \begin{cfuncdesc}{void}{Py_FatalError}{char *message} Print a fatal error message and kill the process. No cleanup is performed. This function should only be invoked when a condition is --- 59,63 ---- \section{Process Control \label{processControl}} ! \begin{cfuncdesc}{void}{Py_FatalError}{const char *message} Print a fatal error message and kill the process. No cleanup is performed. This function should only be invoked when a condition is From tim_one@users.sourceforge.net Tue Jul 9 03:57:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:57:03 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.438,1.439 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13269/python/Misc Modified Files: NEWS Log Message: The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.438 retrieving revision 1.439 diff -C2 -d -r1.438 -r1.439 *** NEWS 8 Jul 2002 22:11:50 -0000 1.438 --- NEWS 9 Jul 2002 02:57:01 -0000 1.439 *************** *** 353,356 **** --- 353,360 ---- C API + - Py_FatalError() is now declared as taking a const char* argument. It + was previously declared without const. This should not affect working + code. + - Added new macro PySequence_ITEM(o, i) that directly calls sq_item without rechecking that o is a sequence and without From tim_one@users.sourceforge.net Tue Jul 9 03:57:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:57:03 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.104,2.105 pydebug.h,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv13269/python/Include Modified Files: object.h pydebug.h Log Message: The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.104 retrieving revision 2.105 diff -C2 -d -r2.104 -r2.105 *** object.h 7 Jul 2002 19:59:50 -0000 2.104 --- object.h 9 Jul 2002 02:57:01 -0000 2.105 *************** *** 67,70 **** --- 67,72 ---- * there's probably a leak. Remember, though, that in interactive mode the * special name "_" holds a reference to the last result displayed! + * Py_REF_DEBUG also checks after every decref to verify that the refcount + * hasn't gone negative, and causes an immediate fatal error if it has. */ #define Py_REF_DEBUG *************** *** 537,543 **** #ifdef Py_REF_DEBUG extern DL_IMPORT(long) _Py_RefTotal; ! #define _PyMAYBE_BUMP_REFTOTAL _Py_RefTotal++ #else ! #define _PyMAYBE_BUMP_REFTOTAL (void)0 #endif --- 539,557 ---- #ifdef Py_REF_DEBUG extern DL_IMPORT(long) _Py_RefTotal; ! extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname, ! int lineno, PyObject *op); ! #define _PyMAYBE_BUMP_REFTOTAL _Py_RefTotal++ ! #define _PyMAYBE_DROP_REFTOTAL _Py_RefTotal-- ! #define _PyMAYBE_REFTOTAL_COMMA , ! #define _PyMAYBE_CHECK_REFCNT(OP) \ ! { if ((OP)->ob_refcnt < 0) \ ! _Py_NegativeRefcount(__FILE__, __LINE__, \ ! (PyObject *)(OP)); \ ! } #else ! #define _PyMAYBE_BUMP_REFTOTAL ! #define _PyMAYBE_DROP_REFTOTAL ! #define _PyMAYBE_REFTOTAL_COMMA ! #define _PyMAYBE_CHECK_REFCNT(OP) ; #endif *************** *** 546,552 **** #define _PyMAYBE_BUMP_COUNT(OP) inc_count((OP)->ob_type) #define _PyMAYBE_BUMP_FREECOUNT(OP) (OP)->ob_type->tp_frees++ #else ! #define _PyMAYBE_BUMP_COUNT(OP) (void)0 ! #define _PyMAYBE_BUMP_FREECOUNT(OP) (void)0 #endif --- 560,570 ---- #define _PyMAYBE_BUMP_COUNT(OP) inc_count((OP)->ob_type) #define _PyMAYBE_BUMP_FREECOUNT(OP) (OP)->ob_type->tp_frees++ + #define _PyMAYBE_BUMP_COUNT_COMMA , + #define _PyMAYBE_BUMP_FREECOUNT_COMMA , #else ! #define _PyMAYBE_BUMP_COUNT(OP) ! #define _PyMAYBE_BUMP_FREECOUNT(OP) ! #define _PyMAYBE_BUMP_COUNT_COMMA ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA #endif *************** *** 563,598 **** * inline. */ ! #define _Py_NewReference(op) ( \ ! _PyMAYBE_BUMP_COUNT(op), \ ! _PyMAYBE_BUMP_REFTOTAL, \ (op)->ob_refcnt = 1) ! #define _Py_ForgetReference(op) (_PyMAYBE_BUMP_FREECOUNT(op)) ! #define _Py_Dealloc(op) ( \ ! _Py_ForgetReference(op), \ (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) - #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _PyMAYBE_BUMP_REFTOTAL, \ (op)->ob_refcnt++) ! #ifdef Py_REF_DEBUG ! /* under Py_REF_DEBUG: also log negative ref counts after Py_DECREF() !! */ ! #define Py_DECREF(op) \ ! if (--_Py_RefTotal, 0 < (--((op)->ob_refcnt))) ; \ ! else if (0 == (op)->ob_refcnt) _Py_Dealloc( (PyObject*)(op)); \ ! else ((void)fprintf(stderr, "%s:%i negative ref count %i\n", \ ! __FILE__, __LINE__, (op)->ob_refcnt), abort()) ! ! #else ! #define Py_DECREF(op) \ ! if (--(op)->ob_refcnt != 0) \ ! ; \ ! else \ _Py_Dealloc((PyObject *)(op)) - #endif /* !Py_REF_DEBUG */ /* Macros to use in case the object pointer may be NULL: */ --- 581,606 ---- * inline. */ ! #define _Py_NewReference(op) ( \ ! _PyMAYBE_BUMP_COUNT(op) _PyMAYBE_BUMP_COUNT_COMMA \ ! _PyMAYBE_BUMP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA \ (op)->ob_refcnt = 1) ! #define _Py_ForgetReference(op) _PyMAYBE_BUMP_FREECOUNT(op) ! #define _Py_Dealloc(op) ( \ ! _PyMAYBE_BUMP_FREECOUNT(op) _PyMAYBE_BUMP_FREECOUNT_COMMA \ (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _PyMAYBE_BUMP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA \ (op)->ob_refcnt++) ! #define Py_DECREF(op) \ ! if (_PyMAYBE_DROP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA \ ! --(op)->ob_refcnt != 0) \ ! _PyMAYBE_CHECK_REFCNT(op) \ ! else \ _Py_Dealloc((PyObject *)(op)) /* Macros to use in case the object pointer may be NULL: */ Index: pydebug.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pydebug.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** pydebug.h 6 Dec 2001 06:23:25 -0000 2.19 --- pydebug.h 9 Jul 2002 02:57:01 -0000 2.20 *************** *** 27,31 **** #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) ! DL_IMPORT(void) Py_FatalError(char *message); #ifdef __cplusplus --- 27,31 ---- #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) ! DL_IMPORT(void) Py_FatalError(const char *message); #ifdef __cplusplus From tim_one@users.sourceforge.net Tue Jul 9 03:57:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:57:03 -0700 Subject: [Python-checkins] python/dist/src/Parser pgenmain.c,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv13269/python/Parser Modified Files: pgenmain.c Log Message: The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms. Index: pgenmain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/pgenmain.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** pgenmain.c 31 May 2002 14:32:07 -0000 2.26 --- pgenmain.c 9 Jul 2002 02:57:01 -0000 2.27 *************** *** 148,152 **** void ! Py_FatalError(char *msg) { fprintf(stderr, "pgen: FATAL ERROR: %s\n", msg); --- 148,152 ---- void ! Py_FatalError(const char *msg) { fprintf(stderr, "pgen: FATAL ERROR: %s\n", msg); From tim_one@users.sourceforge.net Tue Jul 9 03:57:04 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 08 Jul 2002 19:57:04 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.161,2.162 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13269/python/Python Modified Files: pythonrun.c Log Message: The Py_REF_DEBUG/COUNT_ALLOCS/Py_TRACE_REFS macro minefield: added more trivial lexical helper macros so that uses of these guys expand to nothing at all when they're not enabled. This should help sub- standard compilers that can't do a good job of optimizing away the previous "(void)0" expressions. Py_DECREF: There's only one definition of this now. Yay! That was that last one in the family defined multiple times in an #ifdef maze. Py_FatalError(): Changed the char* signature to const char*. _Py_NegativeRefcount(): New helper function for the Py_REF_DEBUG expansion of Py_DECREF. Calling an external function cuts down on the volume of generated code. The previous inline expansion of abort() didn't work as intended on Windows (the program often kept going, and the error msg scrolled off the screen unseen). _Py_NegativeRefcount calls Py_FatalError instead, which captures our best knowledge of how to abort effectively across platforms. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161 retrieving revision 2.162 diff -C2 -d -r2.161 -r2.162 *** pythonrun.c 30 Jun 2002 15:26:10 -0000 2.161 --- pythonrun.c 9 Jul 2002 02:57:01 -0000 2.162 *************** *** 1267,1271 **** void ! Py_FatalError(char *msg) { fprintf(stderr, "Fatal Python error: %s\n", msg); --- 1267,1271 ---- void ! Py_FatalError(const char *msg) { fprintf(stderr, "Fatal Python error: %s\n", msg); From fdrake@users.sourceforge.net Tue Jul 9 04:24:34 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 20:24:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools mkinfo,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv23241/Doc/tools Modified Files: mkinfo Log Message: Remove unused variable. Index: mkinfo =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkinfo,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mkinfo 3 May 2002 04:50:51 -0000 1.3 --- mkinfo 9 Jul 2002 03:24:32 -0000 1.4 *************** *** 8,12 **** # Written by Fred L. Drake, Jr. - PERL=${PERL:-perl} EMACS=${EMACS:-emacs} MAKEINFO=${MAKEINFO:-makeinfo} --- 8,11 ---- From fdrake@users.sourceforge.net Tue Jul 9 06:25:48 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 22:25:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.110,1.111 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17895/lib Modified Files: libfuncs.tex Log Message: Note that unicode() can raise LookupError for unknown codecs. Closes SF bug #513666. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** libfuncs.tex 8 Jul 2002 14:29:05 -0000 1.110 --- libfuncs.tex 9 Jul 2002 05:25:46 -0000 1.111 *************** *** 860,864 **** will decode the object which can either be an 8-bit string or a character buffer using the codec for \var{encoding}. The ! \var{encoding} parameter is a string giving the name of an encoding. Error handling is done according to \var{errors}; this specifies the treatment of characters which are invalid in the input encoding. If --- 860,865 ---- will decode the object which can either be an 8-bit string or a character buffer using the codec for \var{encoding}. The ! \var{encoding} parameter is a string giving the name of an encoding; ! if the encoding is not known, \exception{LookupError} is raised. Error handling is done according to \var{errors}; this specifies the treatment of characters which are invalid in the input encoding. If From fdrake@users.sourceforge.net Tue Jul 9 06:27:14 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 08 Jul 2002 22:27:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.5,1.100.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18183/lib Modified Files: Tag: release22-maint libfuncs.tex Log Message: Note that unicode() can raise LookupError for unknown codecs. Closes SF bug #513666. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.5 retrieving revision 1.100.4.6 diff -C2 -d -r1.100.4.5 -r1.100.4.6 *** libfuncs.tex 8 Jul 2002 14:29:28 -0000 1.100.4.5 --- libfuncs.tex 9 Jul 2002 05:27:12 -0000 1.100.4.6 *************** *** 820,824 **** will decode the object which can either be an 8-bit string or a character buffer using the codec for \var{encoding}. The ! \var{encoding} parameter is a string giving the name of an encoding. Error handling is done according to \var{errors}; this specifies the treatment of characters which are invalid in the input encoding. If --- 820,825 ---- will decode the object which can either be an 8-bit string or a character buffer using the codec for \var{encoding}. The ! \var{encoding} parameter is a string giving the name of an encoding; ! if the encoding is not known, \exception{LookupError} is raised. Error handling is done according to \var{errors}; this specifies the treatment of characters which are invalid in the input encoding. If From theller@users.sourceforge.net Tue Jul 9 10:23:29 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 09 Jul 2002 02:23:29 -0700 Subject: [Python-checkins] python/dist/src/Include parsetok.h,2.17,2.18 pythonrun.h,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv24231/Include Modified Files: parsetok.h pythonrun.h Log Message: Fix SF Bug 564931: compile() traceback must include filename. Index: parsetok.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/parsetok.h,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** parsetok.h 22 Mar 2002 23:52:35 -0000 2.17 --- parsetok.h 9 Jul 2002 09:23:26 -0000 2.18 *************** *** 33,36 **** --- 33,40 ---- perrdetail *, int); + extern DL_IMPORT(node *) PyParser_ParseStringFlagsFilename(char *, + char *, + grammar *, int, + perrdetail *, int); #ifdef __cplusplus } Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** pythonrun.h 12 Apr 2002 01:20:10 -0000 2.49 --- pythonrun.h 9 Jul 2002 09:23:26 -0000 2.50 *************** *** 46,49 **** --- 46,53 ---- DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); + DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *, + char *, + int, + int); DL_IMPORT(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, int, int); From theller@users.sourceforge.net Tue Jul 9 10:23:29 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 09 Jul 2002 02:23:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_compile.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24231/Lib/test Modified Files: test_compile.py Log Message: Fix SF Bug 564931: compile() traceback must include filename. Index: test_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_compile.py 13 Nov 2001 22:03:20 -0000 1.10 --- test_compile.py 9 Jul 2002 09:23:26 -0000 1.11 *************** *** 23,26 **** --- 23,35 ---- pass + if verbose: + print "compiling string with syntax error" + + try: + compile("1+*3", "filename", "exec") + except SyntaxError, detail: + if not detail.filename == "filename": + raise TestFailed, "expected 'filename', got %r" % detail.filename + try: exec 'def f(a = 0, a = 1): pass' From theller@users.sourceforge.net Tue Jul 9 10:23:29 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 09 Jul 2002 02:23:29 -0700 Subject: [Python-checkins] python/dist/src/Parser parsetok.c,2.30,2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv24231/Parser Modified Files: parsetok.c Log Message: Fix SF Bug 564931: compile() traceback must include filename. Index: parsetok.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/parsetok.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** parsetok.c 22 Mar 2002 23:53:03 -0000 2.30 --- parsetok.c 9 Jul 2002 09:23:27 -0000 2.31 *************** *** 28,34 **** perrdetail *err_ret, int flags) { struct tok_state *tok; ! initerr(err_ret, NULL); if ((tok = PyTokenizer_FromString(s)) == NULL) { --- 28,43 ---- perrdetail *err_ret, int flags) { + return PyParser_ParseStringFlagsFilename(s, NULL, + g, start, err_ret, 0); + } + + node * + PyParser_ParseStringFlagsFilename(char *s, char *filename, + grammar *g, int start, + perrdetail *err_ret, int flags) + { struct tok_state *tok; ! initerr(err_ret, filename); if ((tok = PyTokenizer_FromString(s)) == NULL) { *************** *** 38,42 **** if (Py_TabcheckFlag || Py_VerboseFlag) { ! tok->filename = ""; tok->altwarning = (tok->filename != NULL); if (Py_TabcheckFlag >= 2) --- 47,51 ---- if (Py_TabcheckFlag || Py_VerboseFlag) { ! tok->filename = filename ? filename : ""; tok->altwarning = (tok->filename != NULL); if (Py_TabcheckFlag >= 2) From theller@users.sourceforge.net Tue Jul 9 10:23:29 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 09 Jul 2002 02:23:29 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.162,2.163 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24231/Python Modified Files: pythonrun.c Log Message: Fix SF Bug 564931: compile() traceback must include filename. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.162 retrieving revision 2.163 diff -C2 -d -r2.162 -r2.163 *** pythonrun.c 9 Jul 2002 02:57:01 -0000 2.162 --- pythonrun.c 9 Jul 2002 09:23:27 -0000 2.163 *************** *** 1135,1139 **** node *n; PyCodeObject *co; ! n = PyParser_SimpleParseStringFlags(str, start, PARSER_FLAGS(flags)); if (n == NULL) return NULL; --- 1135,1141 ---- node *n; PyCodeObject *co; ! ! n = PyParser_SimpleParseStringFlagsFilename(str, filename, start, ! PARSER_FLAGS(flags)); if (n == NULL) return NULL; *************** *** 1148,1152 **** node *n; struct symtable *st; ! n = PyParser_SimpleParseString(str, start); if (n == NULL) return NULL; --- 1150,1155 ---- node *n; struct symtable *st; ! n = PyParser_SimpleParseStringFlagsFilename(str, filename, ! start, 0); if (n == NULL) return NULL; *************** *** 1194,1197 **** --- 1197,1222 ---- { return PyParser_SimpleParseStringFlags(str, start, 0); + } + + node * + PyParser_SimpleParseStringFlagsFilename(char *str, char *filename, + int start, int flags) + { + node *n; + perrdetail err; + + n = PyParser_ParseStringFlagsFilename(str, filename, + &_PyParser_Grammar, + start, &err, flags); + if (n == NULL) + err_input(&err); + return n; + } + + node * + PyParser_SimpleParseStringFilename(char *str, char *filename, int start) + { + return PyParser_SimpleParseStringFlagsFilename(str, filename, + start, 0); } From jhylton@users.sourceforge.net Tue Jul 9 14:19:55 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:19:55 -0700 Subject: [Python-checkins] python/dist/src/Parser Python.asdl,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv9523/Parser Modified Files: Tag: ast-branch Python.asdl Log Message: make name assoc w/ expr* plural Index: Python.asdl =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/Python.asdl,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Python.asdl 7 Jul 2002 17:34:44 -0000 1.1.2.1 --- Python.asdl 9 Jul 2002 13:19:53 -0000 1.1.2.2 *************** *** 19,23 **** -- not sure if bool is allowed, can always use int ! | Print(expr? dest, expr* value, bool nl) -- use 'orelse' because else is a keyword in target languages --- 19,23 ---- -- not sure if bool is allowed, can always use int ! | Print(expr? dest, expr* values, bool nl) -- use 'orelse' because else is a keyword in target languages From jhylton@users.sourceforge.net Tue Jul 9 14:20:13 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:20:13 -0700 Subject: [Python-checkins] python/dist/src/Include Python-ast.h,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv9608/Include Modified Files: Tag: ast-branch Python-ast.h Log Message: make name assoc w/ expr* plural Index: Python-ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/Python-ast.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Python-ast.h 7 Jul 2002 17:39:22 -0000 1.1.2.1 --- Python-ast.h 9 Jul 2002 13:20:11 -0000 1.1.2.2 *************** *** 105,109 **** struct { expr_ty dest; ! asdl_seq *value; bool nl; } Print; --- 105,109 ---- struct { expr_ty dest; ! asdl_seq *values; bool nl; } Print; *************** *** 335,339 **** stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno); ! stmt_ty Print(expr_ty dest, asdl_seq * value, bool nl, int lineno); stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int lineno); --- 335,339 ---- stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno); ! stmt_ty Print(expr_ty dest, asdl_seq * values, bool nl, int lineno); stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int lineno); From jhylton@users.sourceforge.net Tue Jul 9 14:20:14 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:20:14 -0700 Subject: [Python-checkins] python/dist/src/Python Python-ast.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9608/Python Modified Files: Tag: ast-branch Python-ast.c Log Message: make name assoc w/ expr* plural Index: Python-ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/Python-ast.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Python-ast.c 7 Jul 2002 17:39:22 -0000 1.1.2.1 --- Python-ast.c 9 Jul 2002 13:20:11 -0000 1.1.2.2 *************** *** 223,227 **** stmt_ty ! Print(expr_ty dest, asdl_seq * value, bool nl, int lineno) { stmt_ty p; --- 223,227 ---- stmt_ty ! Print(expr_ty dest, asdl_seq * values, bool nl, int lineno) { stmt_ty p; *************** *** 233,237 **** p->kind = Print_kind; p->v.Print.dest = dest; ! p->v.Print.value = value; p->v.Print.nl = nl; p->lineno = lineno; --- 233,237 ---- p->kind = Print_kind; p->v.Print.dest = dest; ! p->v.Print.values = values; p->v.Print.nl = nl; p->lineno = lineno; From jhylton@users.sourceforge.net Tue Jul 9 14:22:02 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:22:02 -0700 Subject: [Python-checkins] python/dist/src/Include code.h,NONE,1.1.2.1 compile.h,2.37,2.37.2.1 symtable.h,2.9.18.1,2.9.18.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv9917/Include Modified Files: Tag: ast-branch compile.h symtable.h Added Files: Tag: ast-branch code.h Log Message: Move PyCodeObject from compile.c to Objects/codeobject.c. --- NEW FILE: code.h --- /* Definitions for bytecode */ #ifndef Py_CODE_H #define Py_CODE_H #ifdef __cplusplus extern "C" { #endif /* Bytecode object */ typedef struct { PyObject_HEAD int co_argcount; /* #arguments, except *args */ int co_nlocals; /* #local variables */ int co_stacksize; /* #entries needed for evaluation stack */ int co_flags; /* CO_..., see below */ PyObject *co_code; /* instruction opcodes */ PyObject *co_consts; /* list (constants used) */ PyObject *co_names; /* list of strings (names used) */ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ /* The rest doesn't count for hash/cmp */ PyObject *co_filename; /* string (where it was loaded from) */ PyObject *co_name; /* string (name, for reference) */ int co_firstlineno; /* first source line number */ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */ } PyCodeObject; /* Masks for co_flags above */ #define CO_OPTIMIZED 0x0001 #define CO_NEWLOCALS 0x0002 #define CO_VARARGS 0x0004 #define CO_VARKEYWORDS 0x0008 #define CO_NESTED 0x0010 #define CO_GENERATOR 0x0020 /* XXX Temporary hack. Until generators are a permanent part of the language, we need a way for a code object to record that generators were *possible* when it was compiled. This is so code dynamically compiled *by* a code object knows whether to allow yield stmts. In effect, this passes on the "from __future__ import generators" state in effect when the code block was compiled. */ #define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */ #define CO_FUTURE_DIVISION 0x2000 #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ extern DL_IMPORT(PyTypeObject) PyCode_Type; #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) /* Public interface */ DL_IMPORT(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ DL_IMPORT(int) PyCode_Addr2Line(PyCodeObject *, int); /* for internal use only */ #define _PyCode_GETCODEPTR(co, pp) \ ((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \ ((co)->co_code, 0, (void **)(pp))) #ifdef __cplusplus } #endif #endif /* !Py_CODE_H */ Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37 retrieving revision 2.37.2.1 diff -C2 -d -r2.37 -r2.37.2.1 *** compile.h 12 Apr 2002 01:20:09 -0000 2.37 --- compile.h 9 Jul 2002 13:22:00 -0000 2.37.2.1 *************** *** 1,62 **** - - /* Definitions for bytecode */ - #ifndef Py_COMPILE_H #define Py_COMPILE_H #ifdef __cplusplus ! extern "C" { #endif - /* Bytecode object */ - typedef struct { - PyObject_HEAD - int co_argcount; /* #arguments, except *args */ - int co_nlocals; /* #local variables */ - int co_stacksize; /* #entries needed for evaluation stack */ - int co_flags; /* CO_..., see below */ - PyObject *co_code; /* instruction opcodes */ - PyObject *co_consts; /* list (constants used) */ - PyObject *co_names; /* list of strings (names used) */ - PyObject *co_varnames; /* tuple of strings (local variable names) */ - PyObject *co_freevars; /* tuple of strings (free variable names) */ - PyObject *co_cellvars; /* tuple of strings (cell variable names) */ - /* The rest doesn't count for hash/cmp */ - PyObject *co_filename; /* string (where it was loaded from) */ - PyObject *co_name; /* string (name, for reference) */ - int co_firstlineno; /* first source line number */ - PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */ - } PyCodeObject; - - /* Masks for co_flags above */ - #define CO_OPTIMIZED 0x0001 - #define CO_NEWLOCALS 0x0002 - #define CO_VARARGS 0x0004 - #define CO_VARKEYWORDS 0x0008 - #define CO_NESTED 0x0010 - #define CO_GENERATOR 0x0020 - /* XXX Temporary hack. Until generators are a permanent part of the - language, we need a way for a code object to record that generators - were *possible* when it was compiled. This is so code dynamically - compiled *by* a code object knows whether to allow yield stmts. In - effect, this passes on the "from __future__ import generators" state - in effect when the code block was compiled. */ - #define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */ - #define CO_FUTURE_DIVISION 0x2000 - - extern DL_IMPORT(PyTypeObject) PyCode_Type; - - #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) - #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) - - #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ - /* Public interface */ struct _node; /* Declare the existence of this type */ DL_IMPORT(PyCodeObject *) PyNode_Compile(struct _node *, char *); - DL_IMPORT(PyCodeObject *) PyCode_New( - int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, - PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); - /* same as struct above */ - DL_IMPORT(int) PyCode_Addr2Line(PyCodeObject *, int); /* Future feature support */ --- 1,11 ---- #ifndef Py_COMPILE_H #define Py_COMPILE_H #ifdef __cplusplus ! //extern "C" { #endif /* Public interface */ struct _node; /* Declare the existence of this type */ DL_IMPORT(PyCodeObject *) PyNode_Compile(struct _node *, char *); /* Future feature support */ *************** *** 76,83 **** #define FUTURE_DIVISION "division" ! /* for internal use only */ ! #define _PyCode_GETCODEPTR(co, pp) \ ! ((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \ ! ((co)->co_code, 0, (void **)(pp))) #ifdef __cplusplus --- 25,47 ---- #define FUTURE_DIVISION "division" ! struct _mod; /* Declare the existence of this type */ ! DL_IMPORT(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, ! PyCompilerFlags *); ! DL_IMPORT(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); ! ! #define DEFAULT_BLOCK_SIZE 32 ! #define DEFAULT_BLOCKS 8 ! ! struct instr { ! int i_opcode; ! int i_oparg; ! PyObject *i_arg; ! }; ! ! struct basicblock { ! size_t b_iused; ! size_t b_ialloc; ! struct instr b_instr[DEFAULT_BLOCK_SIZE]; ! }; #ifdef __cplusplus Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9.18.1 retrieving revision 2.9.18.2 diff -C2 -d -r2.9.18.1 -r2.9.18.2 *** symtable.h 7 Jul 2002 17:47:41 -0000 2.9.18.1 --- symtable.h 9 Jul 2002 13:22:00 -0000 2.9.18.2 *************** *** 51,54 **** --- 51,57 ---- DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); + DL_IMPORT(struct symtable *) PySymtable_Build(mod_ty, const char *, + PyFutureFeatures *); + DL_IMPORT(void) PySymtable_Free(struct symtable *); From jhylton@users.sourceforge.net Tue Jul 9 14:22:02 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:22:02 -0700 Subject: [Python-checkins] python/dist/src/Modules main.c,1.64,1.64.2.1 symtablemodule.c,1.5.8.1,1.5.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9917/Modules Modified Files: Tag: ast-branch main.c symtablemodule.c Log Message: Move PyCodeObject from compile.c to Objects/codeobject.c. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.64 retrieving revision 1.64.2.1 diff -C2 -d -r1.64 -r1.64.2.1 *** main.c 3 Mar 2002 02:59:16 -0000 1.64 --- main.c 9 Jul 2002 13:22:00 -0000 1.64.2.1 *************** *** 3,7 **** #include "Python.h" #include "osdefs.h" ! #include "compile.h" /* For CO_FUTURE_DIVISION */ #ifdef MS_WINDOWS --- 3,7 ---- #include "Python.h" #include "osdefs.h" ! #include "code.h" /* For CO_FUTURE_DIVISION */ #ifdef MS_WINDOWS Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.5.8.1 retrieving revision 1.5.8.2 diff -C2 -d -r1.5.8.1 -r1.5.8.2 *** symtablemodule.c 7 Jul 2002 17:47:42 -0000 1.5.8.1 --- symtablemodule.c 9 Jul 2002 13:22:00 -0000 1.5.8.2 *************** *** 1,4 **** --- 1,5 ---- #include "Python.h" + #include "code.h" #include "compile.h" #include "Python-ast.h" From jhylton@users.sourceforge.net Tue Jul 9 14:22:03 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:22:03 -0700 Subject: [Python-checkins] python/dist/src/Objects codeobject.c,NONE,1.1.2.1 frameobject.c,2.62,2.62.2.1 funcobject.c,2.55,2.55.2.1 object.c,2.179,2.179.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9917/Objects Modified Files: Tag: ast-branch frameobject.c funcobject.c object.c Added Files: Tag: ast-branch codeobject.c Log Message: Move PyCodeObject from compile.c to Objects/codeobject.c. --- NEW FILE: codeobject.c --- #include "Python.h" #include "code.h" #include "structmember.h" #define OFF(x) offsetof(PyCodeObject, x) static PyMemberDef code_memberlist[] = { {"co_argcount", T_INT, OFF(co_argcount), READONLY}, {"co_nlocals", T_INT, OFF(co_nlocals), READONLY}, {"co_stacksize",T_INT, OFF(co_stacksize), READONLY}, {"co_flags", T_INT, OFF(co_flags), READONLY}, {"co_code", T_OBJECT, OFF(co_code), READONLY}, {"co_consts", T_OBJECT, OFF(co_consts), READONLY}, {"co_names", T_OBJECT, OFF(co_names), READONLY}, {"co_varnames", T_OBJECT, OFF(co_varnames), READONLY}, {"co_freevars", T_OBJECT, OFF(co_freevars), READONLY}, {"co_cellvars", T_OBJECT, OFF(co_cellvars), READONLY}, {"co_filename", T_OBJECT, OFF(co_filename), READONLY}, {"co_name", T_OBJECT, OFF(co_name), READONLY}, {"co_firstlineno", T_INT, OFF(co_firstlineno), READONLY}, {"co_lnotab", T_OBJECT, OFF(co_lnotab), READONLY}, {NULL} /* Sentinel */ }; PyDoc_STRVAR(code_doc, "code(argcount, nlocals, stacksize, flags, codestring, constants, names,\n\ varnames, filename, name, firstlineno, lnotab[, freevars[, cellvars]])\n\ \n\ Create a code object. Not for the faint of heart."); static PyObject * code_new(PyTypeObject *type, PyObject *args, PyObject *kw) { int argcount; int nlocals; int stacksize; int flags; PyObject *code; PyObject *consts; PyObject *names; PyObject *varnames; PyObject *freevars = NULL; PyObject *cellvars = NULL; PyObject *filename; PyObject *name; int firstlineno; PyObject *lnotab; if (!PyArg_ParseTuple(args, "iiiiSO!O!O!SSiS|O!O!:code", &argcount, &nlocals, &stacksize, &flags, &code, &PyTuple_Type, &consts, &PyTuple_Type, &names, &PyTuple_Type, &varnames, &filename, &name, &firstlineno, &lnotab, &PyTuple_Type, &freevars, &PyTuple_Type, &cellvars)) return NULL; if (freevars == NULL || cellvars == NULL) { PyObject *empty = PyTuple_New(0); if (empty == NULL) return NULL; if (freevars == NULL) { freevars = empty; Py_INCREF(freevars); } if (cellvars == NULL) { cellvars = empty; Py_INCREF(cellvars); } Py_DECREF(empty); } if (!PyObject_CheckReadBuffer(code)) { PyErr_SetString(PyExc_TypeError, "bytecode object must be a single-segment read-only buffer"); return NULL; } return (PyObject *)PyCode_New(argcount, nlocals, stacksize, flags, code, consts, names, varnames, freevars, cellvars, filename, name, firstlineno, lnotab); } static void code_dealloc(PyCodeObject *co) { Py_XDECREF(co->co_code); Py_XDECREF(co->co_consts); Py_XDECREF(co->co_names); Py_XDECREF(co->co_varnames); Py_XDECREF(co->co_freevars); Py_XDECREF(co->co_cellvars); Py_XDECREF(co->co_filename); Py_XDECREF(co->co_name); Py_XDECREF(co->co_lnotab); PyObject_DEL(co); } static PyObject * code_repr(PyCodeObject *co) { char buf[500]; int lineno = -1; char *filename = "???"; char *name = "???"; if (co->co_firstlineno != 0) lineno = co->co_firstlineno; if (co->co_filename && PyString_Check(co->co_filename)) filename = PyString_AS_STRING(co->co_filename); if (co->co_name && PyString_Check(co->co_name)) name = PyString_AS_STRING(co->co_name); PyOS_snprintf(buf, sizeof(buf), "", name, co, filename, lineno); return PyString_FromString(buf); } static int code_compare(PyCodeObject *co, PyCodeObject *cp) { int cmp; cmp = PyObject_Compare(co->co_name, cp->co_name); if (cmp) return cmp; cmp = co->co_argcount - cp->co_argcount; if (cmp) return cmp; cmp = co->co_nlocals - cp->co_nlocals; if (cmp) return cmp; cmp = co->co_flags - cp->co_flags; if (cmp) return cmp; cmp = PyObject_Compare(co->co_code, cp->co_code); if (cmp) return cmp; cmp = PyObject_Compare(co->co_consts, cp->co_consts); if (cmp) return cmp; cmp = PyObject_Compare(co->co_names, cp->co_names); if (cmp) return cmp; cmp = PyObject_Compare(co->co_varnames, cp->co_varnames); if (cmp) return cmp; cmp = PyObject_Compare(co->co_freevars, cp->co_freevars); if (cmp) return cmp; cmp = PyObject_Compare(co->co_cellvars, cp->co_cellvars); return cmp; } static long code_hash(PyCodeObject *co) { long h, h0, h1, h2, h3, h4, h5, h6; h0 = PyObject_Hash(co->co_name); if (h0 == -1) return -1; h1 = PyObject_Hash(co->co_code); if (h1 == -1) return -1; h2 = PyObject_Hash(co->co_consts); if (h2 == -1) return -1; h3 = PyObject_Hash(co->co_names); if (h3 == -1) return -1; h4 = PyObject_Hash(co->co_varnames); if (h4 == -1) return -1; h5 = PyObject_Hash(co->co_freevars); if (h5 == -1) return -1; h6 = PyObject_Hash(co->co_cellvars); if (h6 == -1) return -1; h = h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ co->co_argcount ^ co->co_nlocals ^ co->co_flags; if (h == -1) h = -2; return h; } /* XXX code objects need to participate in GC? */ PyTypeObject PyCode_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "code", sizeof(PyCodeObject), 0, (destructor)code_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)code_compare, /* tp_compare */ (reprfunc)code_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)code_hash, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ code_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ code_memberlist, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ code_new, /* tp_new */ }; Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.62 retrieving revision 2.62.2.1 diff -C2 -d -r2.62 -r2.62.2.1 *** frameobject.c 20 Apr 2002 04:46:55 -0000 2.62 --- frameobject.c 9 Jul 2002 13:22:00 -0000 2.62.2.1 *************** *** 4,7 **** --- 4,8 ---- #include "Python.h" + #include "code.h" #include "compile.h" #include "frameobject.h" Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.55 retrieving revision 2.55.2.1 diff -C2 -d -r2.55 -r2.55.2.1 *** funcobject.c 14 Jun 2002 20:41:15 -0000 2.55 --- funcobject.c 9 Jul 2002 13:22:01 -0000 2.55.2.1 *************** *** 3,7 **** #include "Python.h" ! #include "compile.h" #include "eval.h" #include "structmember.h" --- 3,7 ---- #include "Python.h" ! #include "code.h" #include "eval.h" #include "structmember.h" Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.179 retrieving revision 2.179.2.1 diff -C2 -d -r2.179 -r2.179.2.1 *** object.c 13 Jun 2002 21:42:51 -0000 2.179 --- object.c 9 Jul 2002 13:22:01 -0000 2.179.2.1 *************** *** 9,13 **** /* just for trashcan: */ ! #include "compile.h" #include "frameobject.h" #include "traceback.h" --- 9,13 ---- /* just for trashcan: */ ! #include "code.h" #include "frameobject.h" #include "traceback.h" From jhylton@users.sourceforge.net Tue Jul 9 14:22:04 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:22:04 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.261,2.261.2.1 ceval.c,2.314,2.314.2.1 compile.c,2.247.2.1,2.247.2.2 future.c,2.12.2.1,2.12.2.2 import.c,2.208,2.208.2.1 marshal.c,1.72,1.72.2.1 pythonrun.c,2.161.2.2,2.161.2.3 symtable.c,2.10.8.2,2.10.8.3 sysmodule.c,2.107,2.107.2.1 traceback.c,2.38,2.38.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9917/Python Modified Files: Tag: ast-branch bltinmodule.c ceval.c compile.c future.c import.c marshal.c pythonrun.c symtable.c sysmodule.c traceback.c Log Message: Move PyCodeObject from compile.c to Objects/codeobject.c. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.261 retrieving revision 2.261.2.1 diff -C2 -d -r2.261 -r2.261.2.1 *** bltinmodule.c 30 Jun 2002 15:26:10 -0000 2.261 --- bltinmodule.c 9 Jul 2002 13:22:01 -0000 2.261.2.1 *************** *** 1,3 **** - /* Built-in functions */ --- 1,2 ---- *************** *** 5,8 **** --- 4,8 ---- #include "node.h" + #include "code.h" #include "compile.h" #include "eval.h" Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.314 retrieving revision 2.314.2.1 diff -C2 -d -r2.314 -r2.314.2.1 *** ceval.c 14 Jun 2002 13:53:29 -0000 2.314 --- ceval.c 9 Jul 2002 13:22:01 -0000 2.314.2.1 *************** *** 9,13 **** #include "Python.h" ! #include "compile.h" #include "frameobject.h" #include "eval.h" --- 9,13 ---- #include "Python.h" ! #include "code.h" #include "frameobject.h" #include "eval.h" Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.247.2.1 retrieving revision 2.247.2.2 diff -C2 -d -r2.247.2.1 -r2.247.2.2 *** compile.c 7 Jul 2002 17:47:42 -0000 2.247.2.1 --- compile.c 9 Jul 2002 13:22:01 -0000 2.247.2.2 *************** *** 16,19 **** --- 16,20 ---- #include "token.h" #include "graminit.h" + #include "code.h" #include "compile.h" #include "symtable.h" *************** *** 4094,4104 **** } return tuple; - } - - PyCodeObject * - PyAST_Compile(mod_ty mod, char *filename, PyCompilerFlags *flags) - { - /* XXX */ - return NULL; } --- 4095,4098 ---- Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.12.2.1 retrieving revision 2.12.2.2 diff -C2 -d -r2.12.2.1 -r2.12.2.2 *** future.c 7 Jul 2002 17:47:42 -0000 2.12.2.1 --- future.c 9 Jul 2002 13:22:01 -0000 2.12.2.2 *************** *** 4,7 **** --- 4,8 ---- #include "token.h" #include "graminit.h" + #include "code.h" #include "compile.h" #include "symtable.h" Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.208 retrieving revision 2.208.2.1 diff -C2 -d -r2.208 -r2.208.2.1 *** import.c 30 Jun 2002 15:26:10 -0000 2.208 --- import.c 9 Jul 2002 13:22:01 -0000 2.208.2.1 *************** *** 8,11 **** --- 8,12 ---- #include "errcode.h" #include "marshal.h" + #include "code.h" #include "compile.h" #include "eval.h" Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.72 retrieving revision 1.72.2.1 diff -C2 -d -r1.72 -r1.72.2.1 *** marshal.c 14 Jun 2002 01:07:39 -0000 1.72 --- marshal.c 9 Jul 2002 13:22:01 -0000 1.72.2.1 *************** *** 7,10 **** --- 7,11 ---- #include "Python.h" #include "longintrepr.h" + #include "code.h" #include "compile.h" #include "marshal.h" Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.2 retrieving revision 2.161.2.3 diff -C2 -d -r2.161.2.2 -r2.161.2.3 *** pythonrun.c 7 Jul 2002 18:18:18 -0000 2.161.2.2 --- pythonrun.c 9 Jul 2002 13:22:01 -0000 2.161.2.3 *************** *** 10,13 **** --- 10,14 ---- #include "parsetok.h" #include "errcode.h" + #include "code.h" #include "compile.h" #include "symtable.h" Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.2 retrieving revision 2.10.8.3 diff -C2 -d -r2.10.8.2 -r2.10.8.3 *** symtable.c 7 Jul 2002 20:50:10 -0000 2.10.8.2 --- symtable.c 9 Jul 2002 13:22:01 -0000 2.10.8.3 *************** *** 1,4 **** --- 1,5 ---- #include "Python.h" #include "Python-ast.h" + #include "code.h" #include "compile.h" #include "symtable.h" *************** *** 15,18 **** --- 16,20 ---- if (k == NULL) goto fail; + /* XXX do we need the lookup code anymore? */ v = PyDict_GetItem(st->st_symbols, k); if (v) { *************** *** 390,394 **** if (s->v.Print.dest) VISIT(st, expr, s->v.Print.dest); ! VISIT_SEQ(st, expr, s->v.Print.value); break; case For_kind: --- 392,396 ---- if (s->v.Print.dest) VISIT(st, expr, s->v.Print.dest); ! VISIT_SEQ(st, expr, s->v.Print.values); break; case For_kind: *************** *** 466,473 **** /* nothing to do here */ break; - default: - PyErr_Format(PyExc_AssertionError, - "invalid statement kind: %d\n", s->kind); - return 0; } return 1; --- 468,471 ---- *************** *** 544,551 **** VISIT_SEQ(st, expr, e->v.Tuple.elts); break; - default: - PyErr_Format(PyExc_AssertionError, - "invalid expression kind: %d\n", e->kind); - return 0; } return 1; --- 542,545 ---- Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.107 retrieving revision 2.107.2.1 diff -C2 -d -r2.107 -r2.107.2.1 *** sysmodule.c 30 Jun 2002 15:26:10 -0000 2.107 --- sysmodule.c 9 Jul 2002 13:22:01 -0000 2.107.2.1 *************** *** 16,20 **** #include "Python.h" ! #include "compile.h" #include "frameobject.h" --- 16,20 ---- #include "Python.h" ! #include "code.h" #include "frameobject.h" Index: traceback.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/traceback.c,v retrieving revision 2.38 retrieving revision 2.38.2.1 diff -C2 -d -r2.38 -r2.38.2.1 *** traceback.c 14 Apr 2002 20:12:41 -0000 2.38 --- traceback.c 9 Jul 2002 13:22:01 -0000 2.38.2.1 *************** *** 4,8 **** #include "Python.h" ! #include "compile.h" #include "frameobject.h" #include "structmember.h" --- 4,8 ---- #include "Python.h" ! #include "code.h" #include "frameobject.h" #include "structmember.h" From jhylton@users.sourceforge.net Tue Jul 9 14:24:47 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:24:47 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.86.2.1,1.86.2.2 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv10776 Modified Files: Tag: ast-branch Makefile.pre.in Log Message: Temporarily commit newcompile.c which will replace compile.c. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.86.2.1 retrieving revision 1.86.2.2 diff -C2 -d -r1.86.2.1 -r1.86.2.2 *** Makefile.pre.in 7 Jul 2002 17:37:22 -0000 1.86.2.1 --- Makefile.pre.in 9 Jul 2002 13:24:45 -0000 1.86.2.2 *************** *** 227,230 **** --- 227,231 ---- Python/exceptions.o \ Python/ceval.o \ + Python/newcompile.o \ Python/compile.o \ Python/codecs.o \ *************** *** 268,271 **** --- 269,273 ---- Objects/classobject.o \ Objects/cobject.o \ + Objects/codeobject.o \ Objects/complexobject.o \ Objects/descrobject.o \ *************** *** 455,458 **** --- 457,461 ---- Include/classobject.h \ Include/cobject.h \ + Include/code.h \ Include/codecs.h \ Include/compile.h \ From jhylton@users.sourceforge.net Tue Jul 9 14:24:47 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 06:24:47 -0700 Subject: [Python-checkins] python/dist/src/Python newcompile.c,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10776/Python Added Files: Tag: ast-branch newcompile.c Log Message: Temporarily commit newcompile.c which will replace compile.c. --- NEW FILE: newcompile.c --- #include "Python.h" #include "Python-ast.h" #include "code.h" #include "compile.h" #include "symtable.h" #include "opcode.h" struct compiler { const char *c_filename; struct symtable *c_st; PyFutureFeatures *c_future; /* pointer to module's __future__ */ PyCompilerFlags *c_flags; int c_interactive; /* info that changes for each code block */ PySymtableEntryObject *c_symbols; int c_nblocks; int c_curblock; struct basicblock c_entry; struct basicblock c_exit; struct basicblock **c_blocks; }; static void compiler_free(struct compiler *c) { int i; if (c->c_st) PySymtable_Free(c->c_st); if (c->c_future) PyMem_Free((void *)c->c_future); for (i = 0; i < c->c_nblocks; i++) free((void *)c->c_blocks[i]); if (c->c_blocks) free((void *)c->c_blocks); } PyCodeObject * PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags) { struct compiler c; PyCodeObject *co; c.c_filename = filename; c.c_future = PyFuture_FromAST(mod, filename); if (c.c_future == NULL) goto error; if (flags) { int merged = c.c_future->ff_features | flags->cf_flags; c.c_future->ff_features = merged; flags->cf_flags = merged; } c.c_st = PySymtable_Build(mod, filename, flags); if (c.c_st == NULL) goto error; return NULL; compiler_mod(&c, mod); error: compiler_free(&c); return NULL; } static int compiler_enter_scope(struct compiler *c, identifier name, void *key) { /* XXX need stack of info */ PyObject *k, *v; k = PyLong_FromVoidPtr(key); if (k == NULL) return 0; v = PyDict_GetItem(c->c_st->st_symbols, k); if (!v) { /* XXX */ PyErr_SetObject(PyExc_KeyError, name); return 0; } assert(PySymtableEntry_Check(v)); c->c_symbols = v; c->c_nblocks = 0; c->c_blocks = (struct basicblock **)malloc(sizeof(struct basicblock *) * DEFAULT_BLOCKS); if (!c->c_blocks) return 0; return 1; } static int compiler_exit_scope(struct compiler *c, identifier name, void *key) { /* pop current scope off stack & reinit */ return 1; } static PyCodeObject * compiler_get_code(struct compiler *c) { /* get the code object for the current block. XXX may want to return a thunk insttead to allow later passes */ return NULL; } static int compiler_new_block(struct compiler *c) { int i; struct basicblock *b; if (c->c_nblocks && c->c_nblocks % DEFAULT_BLOCKS == 0) { /* XXX should double */ int newsize = c->c_nblocks + DEFAULT_BLOCKS; c->c_blocks = (struct basicblock **)realloc(c->c_blocks, newsize); if (c->c_blocks == NULL) return 0; } i = c->c_nblocks++; b = (struct basicblock *)malloc(sizeof(struct basicblock)); if (b == NULL) return 0; memset((void *)b, 0, sizeof(struct basicblock)); b->b_ialloc = DEFAULT_BLOCK_SIZE; c->c_blocks[i] = b; return i; } /* Note: returns -1 on failure */ static int compiler_next_instr(struct compiler *c, int block) { struct basicblock *b; assert(block < c->c_nblocks); b = c->c_blocks[block]; if (b->b_ioffset == b->b_ialloc) { void *ptr; int newsize; b->b_ialloc *= 2; /* XXX newsize is wrong */ ptr = realloc((void *)b, newsize); if (ptr == NULL) return -1; if (ptr != (void *)b) c->c_blocks[block] = (struct basicblock *)ptr; } return b->b_ioffset++; } static int compiler_addop(struct compiler *c, int opcode) { int off; off = compiler_next_instr(c, c->c_curblock); if (off < 0) return 0; c->c_blocks[c->c_curblock]->b_instr[off].i_opcode = opcode; return 1; } static int compiler_addop_o(struct compiler *c, int opcode, PyObject *o) { struct instr *i; int off; off = compiler_next_instr(c, c->c_curblock); if (off < 0) return 0; i = c->c_blocks[c->c_curblock]; i->i_opcode = i->i_opcode; i->i_arg = o; return 1; } static int compiler_addop_i(struct compiler *c, int opcode, int oparg) { struct instr *i; int off; off = compiler_next_instr(c, c->c_curblock); if (off < 0) return 0; i = c->c_blocks[c->c_curblock]; i->i_opcode = i->i_opcode; i->i_oparg = oparg; return 1; } /* 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. */ #define ADDOP(C, OP) { \ if (!compiler_addop((C), (OP))) \ return 0; \ } #define ADDOP_O(C, OP, O) { \ if (!compiler_addop_o((C), (OP), (O))) \ return 0; \ } #define ADDOP_I(C, OP, O) { \ if (!compiler_addop_i((C), (OP), (O))) \ return 0; \ } #define VISIT(C, TYPE, V) {\ if (!compiler_visit_ ## TYPE((C), (V))) \ return 0; \ } #define VISIT_SEQ(C, TYPE, SEQ) { \ int i; \ asdl_seq *seq = (SEQ); /* avoid variable capture */ \ for (i = 0; i < asdl_seq_LEN(seq); i++) { \ TYPE ## _ty elt = asdl_seq_get(seq, i); \ if (!compiler_visit_ ## TYPE((C), elt)) \ return 0; \ } \ } static int compiler_mod(struct compiler *c, mod_ty mod) { switch (mod->kind) { case Module_kind: break; case Interactive_kind: break; case Expression_kind: break; case Suite_kind: break; } return 1; } static int compiler_function(struct compiler *c, stmt_ty s) { PyCodeObject *co; assert(s->kind == Function_kind); if (s->v.FunctionDef.args->defaults) VISIT_SEQ(c, expr, s->v.FunctionDef.args->defaults); if (!compiler_enter_scope(c, s->v.FunctionDef.name, (void *)s)) return 0; VISIT(c, arguments, s->v.FunctionDef.args); VISIT_SEQ(c, stmt, s->v.FunctionDef.body); co = compiler_get_code(c); if (co == NULL) return 0; return 1; } static int compiler_print(struct compiler *c, stmt_ty s) { int i, n; bool dest; assert(s->kind == Print_kind); n = asdl_seq_LEN(s->v.Print.values); dest = false; if (s->v.Print.dest) { VISIT(C, EXPR, s->v.Print.dest); dest = true; } for (i = 0; i < n; i++) { if (dest) { ADDOP(c, DUP_TOP); VISIT(c, expr, asdl_get_seq(s->v.Print.values, i)); ADDOP(c, ROT_TWO); ADDOP(c, PRINT_ITEM_TO); } else { VISIT(c, expr, asdl_get_seq(s->v.Print.values, i)); ADDOP(c, PRINT_ITEM); } } if (s->v.Print.nl) { if (dest) ADDOP(c, PRINT_NEWLINE_TO); else ADDOP(c, PRINT_NEWLINE); } else if (dest) ADDOP(c, POP_TOP); return 1; } static int compiler_function(struct compiler *c, stmt_ty s) { int i, n; assert(s->kind == If_kind); } static int compiler_stmt(struct compiler *c, stmt_ty s) { int i, n; switch (s->kind) { case FunctionDef_kind: return compiler_function(c, s); break; case ClassDef_kind: break; case Return_kind: if (s->v.Return.value) VISIT(c, expr, s->v.Return.value) else ADDOP_O(c, LOAD_CONST, Py_None); ADDOP(c, RETURN_VALUE); break; case Yield_kind: VISIT(c, expr, s->v.Yield.value); ADDOP(c, YIELD_VALUE); break; case Delete_kind: VISIT_SEQ(c, expr, s->v.Delete.targets) break; case Assign_kind: n = asdl_seq_LEN(s->v.Assign.targets); VISIT(c, expr, s->v.Assign.value); for (i = 0; i < n; i++) { if (i < n - 1) ADDOP(c, DUP_TOP); VISIT(c, expr, asdl_get_seq(s->v.Assign.targets, i)); } break; case AugAssign_kind: break; case Print_kind: return compiler_print(c, s); break; case For_kind: break; case While_kind: break; case If_kind: return compiler_if(c, s); break; case Raise_kind: if (s->v.Raise.type) { VISIT(st, expr, s->v.Raise.type); n++; if (s->v.Raise.inst) { VISIT(st, expr, s->v.Raise.inst); n++; if (s->v.Raise.tback) { VISIT(st, expr, s->v.Raise.tback); n++; } } } ADDOP_I(c, RAISE_VARARGS, n); break; case TryExcept_kind: break; case TryFinally_kind: break; case Assert_kind: break; case Import_kind: break; case ImportFrom_kind: break; case Exec_kind: VISIT(st, expr, s->v.Exec.body); if (s->v.Exec.globals) { VISIT(st, expr, s->v.Exec.globals); if (s->v.Exec.locals) VISIT(st, expr, s->v.Exec.locals); else ADDOP(c, DUP_TOP); } else { ADDOP_O(c, LOAD_CONST, Py_None); ADDOP(c, DUP_TOP); } ADDOP(c, EXEC_STMT); break; case Global_kind: break; case Expr_kind: VISIT(c, expr, s->v.Expr.value); if (c->c_interactive) ADDOP(c, PRINT_EXPR); else ADDOP(c, DUP_TOP); break; case Pass_kind: break; case Break_kind: break; case Continue_kind: break; } return 1; } static int unaryop(unaryop_ty op) { switch (op) { case Invert: return UNARY_INVERT; case Not: return UNARY_NOT; case UAdd: return UNARY_POSITIVE; case USub: return UNARY_NEGATIVE; } } static int binop(operator_ty op) { switch (op) { case Add: return BINARY_ADD; case Sub: return BINARY_SUBTRACT; case Mult: return BINARY_MULTIPLY; case Div: if (c->c_flags & CO_FUTURE_DIVISION) return BINARY_TRUE_DIVIDE; else return BINARY_DIVIDE; case Mod: return BINARY_MODULO; case Pow: return BINARY_POWER; case LShift: return BINARY_LSHIFT; case RShift: return BINARY_RSHIFT; case BitOr: return BINARY_OR; case BitXor: return BINARY_XOR; case BitAnd: return BINARY_AND; case FloorDiv: return BINARY_FLOOR_DIVIDE; } } static int compiler_visit_expr(struct compiler *c, expr_ty e) { int i, n; switch (e->kind) { case BoolOp_kind: break; case BinOp_kind: VISIT(c, expr, e->v.BinOp.left); VISIT(c, expr, e->v.BinOp.right); ADDOP(c, binop(e->v.BinOp.op)); break; case UnaryOp_kind: VISIT(c, expr, e->v.UnaryOp.operand); ADDOP(c, unaryop(e->v.UnaryOp.op)); break; case Lambda_kind: break; case Dict_kind: /* XXX get rid of arg? */ ADDOP_I(c, BUILD_MAP, 0); n = asdl_seq_LEN(e->v.Dict.values); /* We must arrange things just right for STORE_SUBSCR. It wants the stack to look like (value) (dict) (key) */ for (i = 0; i < n; i++) { ADDOP(c, DUP_TOP); VISIT(c, expr, asdl_seq_get(e->v.Dict.values, i)); ADDOP(c, ROT_TWO); VISIT(c, expr, asdl_seq_get(e->v.Dict.keys, i)); ADDOP(c, STORE_SUBSCR); } break; case ListComp_kind: break; case Compare_kind: break; case Call_kind: break; case Repr_kind: VISIT(c, expr, e->v.Repr.value); ADDOP(c, UNARY_CONVERT); break; case Num_kind: break; case Str_kind: break; /* The following exprs can be assignment targets. */ case Attribute_kind: VISIT(c, expr, e->v.Attribute.value); switch (e->v.Attribute.ctx) { case Load: ADDOP_O(c, LOAD_ATTR, e->v.Attribute.attr); break; case Store: ADDOP_O(c, STORE_ATTR, e->v.Attribute.attr); break; case Del: ADDOP_O(c, DELETE_ATTR, e->v.Attribute.attr); break; case AugStore: /* XXX */ break; } break; case Subscript_kind: VISIT(c, expr, e->v.Subscript.value); VISIT(c, slice, e->v.Subscript.slice); break; case Name_kind: compiler_add_def(c, e->v.Name.id, e->v.Name.ctx == Load ? USE : DEF_LOCAL); break; /* child nodes of List and Tuple will have expr_context set */ case List_kind: VISIT_SEQ(c, expr, e->v.List.elts); break; case Tuple_kind: VISIT_SEQ(c, expr, e->v.Tuple.elts); break; } return 1; } From bwarsaw@users.sourceforge.net Tue Jul 9 17:33:50 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 09 Jul 2002 09:33:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv3358 Modified Files: Header.py Log Message: make_header(): New function to take the output of decode_header() and create a Header instance. Closes feature request #539481. Header.__init__(): Allow the initial string to be omitted. __eq__(), __ne__(): Support rich comparisons for equality of Header instances withy Header instances or strings. Also, update a bunch of docstrings. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Header.py 3 Jul 2002 05:04:04 -0000 1.7 --- Header.py 9 Jul 2002 16:33:47 -0000 1.8 *************** *** 94,105 **** class Header: ! def __init__(self, s, charset=None, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a MIME-compliant header that can contain many languages. ! Specify the initial header value in s. Specify its character set as a ! Charset object in the charset argument. If None, a default Charset ! instance will be used. You can later append to the header with append(s, charset) below; --- 94,132 ---- + def make_header(decoded_seq, maxlinelen=None, header_name=None, + continuation_ws=' '): + """Create a Header from a sequence of pairs as returned by decode_header() + + decode_header() takes a header value string and returns a sequence of + pairs of the format (decoded_string, charset) where charset is the string + name of the character set. + + This function takes one of those sequence of pairs and returns a Header + instance. Optional maxlinelen, header_name, and continuation_ws are as in + the Header constructor. + """ + h = Header(maxlinelen=maxlinelen, header_name=header_name, + continuation_ws=continuation_ws) + for s, charset in decoded_seq: + if not isinstance(charset, Charset): + charset = Charset(charset) + h.append(s, charset) + return h + + + 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 languages. ! Specify the initial header value in s. If None, the initial header ! value is not set. ! ! Specify both s's character set, and the default character set by ! setting the charset argument to a Charset object (not a character set ! name string!). If None, a us-ascii Charset is used as both s's ! initial charset and as the default character set for subsequent ! .append() calls. You can later append to the header with append(s, charset) below; *************** *** 124,128 **** # BAW: I believe `chunks' and `maxlinelen' should be non-public. self._chunks = [] ! self.append(s, charset) if maxlinelen is None: maxlinelen = MAXLINELEN --- 151,156 ---- # BAW: I believe `chunks' and `maxlinelen' should be non-public. self._chunks = [] ! if s is not None: ! self.append(s, charset) if maxlinelen is None: maxlinelen = MAXLINELEN *************** *** 149,157 **** return u''.join(uchunks) def append(self, s, charset=None): """Append string s with Charset charset to the MIME header. charset defaults to the one given in the class constructor. If ! charset is given, it should be an instance of email.Charset.Charset. """ if charset is None: --- 177,196 ---- return u''.join(uchunks) + # Rich comparison operators for equality only. BAW: does it make sense to + # have or explicitly disable <, <=, >, >= operators? + def __eq__(self, other): + # other may be a Header or a string. Both are fine so coerce + # ourselves to a string, swap the args and do another comparison. + return other == self.encode() + + def __ne__(self, other): + return not self == other + def append(self, s, charset=None): """Append string s with Charset charset to the MIME header. charset defaults to the one given in the class constructor. If ! charset is given, it should be an instance of Charset (not a character ! set name string!). """ if charset is None: From bwarsaw@users.sourceforge.net Tue Jul 9 17:36:40 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 09 Jul 2002 09:36:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4489 Modified Files: test_email.py Log Message: ndiffAssertEqual(): Stringify the arguments before running .splitlines() on them, since they may be Header instances. test_multilingual(), test_header_ctor_default_args(): New tests of make_header() and that Header can take all default arguments. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_email.py 9 Jul 2002 02:38:24 -0000 1.39 --- test_email.py 9 Jul 2002 16:36:36 -0000 1.40 *************** *** 15,19 **** from email.Charset import Charset ! from email.Header import Header, decode_header from email.Parser import Parser, HeaderParser from email.Generator import Generator, DecodedGenerator --- 15,19 ---- from email.Charset import Charset ! from email.Header import Header, decode_header, make_header from email.Parser import Parser, HeaderParser from email.Generator import Generator, DecodedGenerator *************** *** 58,62 **** """Like failUnlessEqual except use ndiff for readable output.""" if first <> second: ! diff = difflib.ndiff(first.splitlines(), second.splitlines()) fp = StringIO() print >> fp, NL, NL.join(diff) --- 58,64 ---- """Like failUnlessEqual except use ndiff for readable output.""" if first <> second: ! sfirst = str(first) ! ssecond = str(second) ! diff = difflib.ndiff(sfirst.splitlines(), ssecond.splitlines()) fp = StringIO() print >> fp, NL, NL.join(diff) *************** *** 1027,1031 **** eq = self.assertEqual unless = self.failUnless ! # msg 16 is a Delivery Status Notification, see RFC XXXX msg = self._msgobj('msg_16.txt') eq(msg.get_type(), 'multipart/report') --- 1029,1033 ---- eq = self.assertEqual unless = self.failUnless ! # msg 16 is a Delivery Status Notification, see RFC 1894 msg = self._msgobj('msg_16.txt') eq(msg.get_type(), 'multipart/report') *************** *** 1879,1883 **** def test_multilingual(self): ! eq = self.assertEqual g = Charset("iso-8859-1") cz = Charset("iso-8859-2") --- 1881,1885 ---- def test_multilingual(self): ! eq = self.ndiffAssertEqual g = Charset("iso-8859-1") cz = Charset("iso-8859-2") *************** *** 1930,1933 **** --- 1932,1945 ---- 'gersput.\xe3\x80\x8d\xe3\x81\xa8\xe8\xa8\x80\xe3\x81\xa3\xe3\x81' '\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x99\xe3\x80\x82') + # Test make_header() + newh = make_header(decode_header(enc)) + eq(newh, enc) + + def test_header_ctor_default_args(self): + eq = self.ndiffAssertEqual + h = Header() + eq(h, '') + h.append('foo', Charset('iso-8859-1')) + eq(h, '=?iso-8859-1?q?foo?=') def test_explicit_maxlinelen(self): From tim_one@users.sourceforge.net Tue Jul 9 19:22:57 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 11:22:57 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.163,2.164 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv6159/python/Python Modified Files: pythonrun.c Log Message: _Py_AskYesNo(): Removed this function. It was defined only in a Py_TRACE_REFS build, but wasn't referenced. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.163 retrieving revision 2.164 diff -C2 -d -r2.163 -r2.164 *** pythonrun.c 9 Jul 2002 09:23:27 -0000 2.163 --- pythonrun.c 9 Jul 2002 18:22:55 -0000 2.164 *************** *** 43,51 **** static void call_sys_exitfunc(void); static void call_ll_exitfuncs(void); - - #ifdef Py_TRACE_REFS - int _Py_AskYesNo(char *prompt); - #endif - extern void _PyUnicode_Init(void); extern void _PyUnicode_Fini(void); --- 43,46 ---- *************** *** 1389,1407 **** PyOS_InitInterrupts(); /* May imply initsignal() */ } - - #ifdef Py_TRACE_REFS - /* Ask a yes/no question */ - - int - _Py_AskYesNo(char *prompt) - { - char buf[256]; - - fprintf(stderr, "%s [ny] ", prompt); - if (fgets(buf, sizeof buf, stdin) == NULL) - return 0; - return buf[0] == 'y' || buf[0] == 'Y'; - } - #endif #ifdef MPW --- 1384,1387 ---- From doerwalter@users.sourceforge.net Tue Jul 9 19:35:06 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 09 Jul 2002 11:35:06 -0700 Subject: [Python-checkins] python/nondist/peps pep-0293.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9051 Modified Files: pep-0293.txt Log Message: Incorporate the result of the XML-SIG discussion: stream readers/writers need a changeable errors attribute. Index: pep-0293.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0293.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0293.txt 19 Jun 2002 11:12:50 -0000 1.2 --- pep-0293.txt 9 Jul 2002 18:35:04 -0000 1.3 *************** *** 337,340 **** --- 337,349 ---- changes to many C functions, this approach has been rejected. + For stream readers/writers the errors attribute must be changeable + to be able to switch between different error handling methods + during the lifetime of the stream reader/writer. This is currently + the case for codecs.StreamReader and codecs.StreamWriter and + all their subclasses. All core codecs and probably most of the + third party codecs (e.g. JapaneseCodecs) derive their stream + readers/writers from these classes so this already works, + but the attribute errors should be documented as a requirement. + Implementation Notes From tim_one@users.sourceforge.net Tue Jul 9 19:35:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 11:35:36 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8891 Added Files: SpecialBuilds.txt Log Message: New file to try to document the "special build" preprocessor symbols. Incomplete. Add to it! Once it settles down, it would make a nice appendix in the real docs. --- NEW FILE: SpecialBuilds.txt --- This file describes some special Python build types enabled via compile-time preprocessor defines. --------------------------------------------------------------------------- Py_REF_DEBUG Turn on aggregate reference counting. This arranges that extern _Py_RefTotal hold a count of all references, the sum of ob_refcnt across all objects. In a debug-mode build, this is where the "8288" comes from in >>> 23 23 [8288 refs] >>> Note that if this count increases when you're not storing away new objects, there's probably a leak. Remember, though, that in interactive mode the special name "_" holds a reference to the last result displayed! Py_REF_DEBUG also checks after every decref to verify that the refcount hasn't gone negative, and causes an immediate fatal error if it has. Special gimmicks: sys.gettotalrefcount() Return current total of all refcounts. Available under Py_REF_DEBUG in Python 2.3. Before 2.3, Py_TRACE_REFS was required to enable this function. --------------------------------------------------------------------------- Py_TRACE_REFS 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. Special gimmicks: sys.getobjects(max[, type]) Return list of the most-recently allocated max objects, most recently allocated first in the list, least-recently allocated last in the list. max=0 means no limit on list length. If an optional type object is passed, the list is also restricted to objects of that type. envar PYTHONDUMPREFS If this envar exists, Py_Finalize() arranges to print a list of all still-live heap objects. --------------------------------------------------------------------------- COUNT_ALLOCS Special gimmicks: sys.getcounts() --------------------------------------------------------------------------- PYMALLOC_DEBUG Special gimmicks: envar PYTHONMALLOCSTATS If this envar exists, a report of pymalloc summary statistics is printed to stderr whenever a new arena is allocated, and also by Py_Finalize(). --------------------------------------------------------------------------- Py_DEBUG This is what is generally meant by "a debug build" of Python. Py_DEBUG implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled). --------------------------------------------------------------------------- From gvanrossum@users.sourceforge.net Tue Jul 9 19:44:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 09 Jul 2002 11:44:12 -0700 Subject: [Python-checkins] python/dist/src README,1.148,1.149 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11903 Modified Files: README Log Message: Actualized descrintro.html URL. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** README 23 Jun 2002 16:29:36 -0000 1.148 --- README 9 Jul 2002 18:44:09 -0000 1.149 *************** *** 92,96 **** unification features is Guido's tutorial introduction, at ! http://www.python.org/2.2/descrintro.html --- 92,96 ---- unification features is Guido's tutorial introduction, at ! http://www.python.org/2.2.1/descrintro.html From tim_one@users.sourceforge.net Tue Jul 9 19:48:34 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 11:48:34 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13064 Modified Files: SpecialBuilds.txt Log Message: Checkin comment. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SpecialBuilds.txt 9 Jul 2002 18:35:34 -0000 1.1 --- SpecialBuilds.txt 9 Jul 2002 18:48:32 -0000 1.2 *************** *** 47,51 **** list. max=0 means no limit on list length. If an optional type object is passed, the list is also restricted to objects of that ! type. envar PYTHONDUMPREFS --- 47,52 ---- list. max=0 means no limit on list length. If an optional type object is passed, the list is also restricted to objects of that ! type. The return list itself, and some temp objects created just ! to call sys.getobjects(), are excluded from the return list. envar PYTHONDUMPREFS From tim_one@users.sourceforge.net Tue Jul 9 20:24:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 12:24:56 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22922 Modified Files: SpecialBuilds.txt Log Message: Moved COUNT_ALLOCS down and finished writing its description. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SpecialBuilds.txt 9 Jul 2002 18:48:32 -0000 1.2 --- SpecialBuilds.txt 9 Jul 2002 19:24:54 -0000 1.3 *************** *** 54,63 **** all still-live heap objects. --------------------------------------------------------------------------- - COUNT_ALLOCS - - Special gimmicks: - - sys.getcounts() - --------------------------------------------------------------------------- PYMALLOC_DEBUG --- 54,57 ---- *************** *** 75,77 **** --- 69,116 ---- Py_DEBUG implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled). + --------------------------------------------------------------------------- + COUNT_ALLOCS + + Each type object grows three new members: + + /* Number of times an object of this type was allocated. */ + int tp_allocs; + + /* Number of times an object of this type was deallocated. */ + int tp_frees; + + /* Highwater mark: the maximum value of tp_allocs - tp_frees so + * far; or, IOW, the largest number of objects of this type alive at + * the same time. + */ + int tp_maxalloc; + + Allocation and deallocation code keeps these counts up to date. + Py_Finalize() displays a summary of the info returned by sys.getcounts() + (see below), along with assorted other special allocation counts (like + the number of tuple allocations satisfied by a tuple free-list, the number + of 1-character strings allocated, etc). + + Before Python 2.2, type objects were immortal, and the COUNT_ALLOCS + implementation relies on that. As of Python 2.2, heap-allocated type/ + class objects can go away. COUNT_ALLOCS can blow up in 2.2 and 2.2.1 + because of this; this was fixed in 2.2.2. Use of COUNT_ALLOCS makes + all heap-allocated type objects immortal, except for those for which no + object of that type is ever allocated. + + Special gimmicks: + + sys.getcounts() + Return a list of 4-tuples, one entry for each type object for which + at least one object of that type was allocated. Each tuple is of + the form: + + (tp_name, tp_allocs, tp_frees, tp_maxalloc) + + Each distinct type objects gets a distinct entry in this list, even + if two or more type objects have the same tp_name (in which case + there's no way to distinguish them by looking at this list). The + list is ordered by time of first object allocation: the type object + for which the first allocation of an object of that type occurred + most recently is at the front of the list. --------------------------------------------------------------------------- From tim_one@users.sourceforge.net Tue Jul 9 20:27:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 12:27:22 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23645 Modified Files: SpecialBuilds.txt Log Message: Typo repair. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SpecialBuilds.txt 9 Jul 2002 19:24:54 -0000 1.3 --- SpecialBuilds.txt 9 Jul 2002 19:27:20 -0000 1.4 *************** *** 108,112 **** (tp_name, tp_allocs, tp_frees, tp_maxalloc) ! Each distinct type objects gets a distinct entry in this list, even if two or more type objects have the same tp_name (in which case there's no way to distinguish them by looking at this list). The --- 108,112 ---- (tp_name, tp_allocs, tp_frees, tp_maxalloc) ! Each distinct type object gets a distinct entry in this list, even if two or more type objects have the same tp_name (in which case there's no way to distinguish them by looking at this list). The From guido@python.org Tue Jul 9 20:47:32 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 09 Jul 2002 15:47:32 -0400 Subject: [Python-checkins] python/dist/src/Lib pre.py,1.12,1.13 In-Reply-To: Your message of "Thu, 27 Jun 2002 12:59:30 PDT." References: Message-ID: <200207091947.g69JlWI03779@odiug.zope.com> > Fix bug #570057: Broken pre.subn() (and pre.sub()) > > This should be backported to the 2.2.X series (how > do I do that?) Check out the branch named "release22-maint" and apply the change there. The -j option to cvs update may be handy, but I usually find it easier to simply use patch. Or was this not what you were asking? --Guido van Rossum (home page: http://www.python.org/~guido/) From jhylton@users.sourceforge.net Tue Jul 9 22:22:38 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 09 Jul 2002 14:22:38 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26945 Modified Files: httplib.py Log Message: Fix for SF bug 579107. The recent SSL changes resulted in important, but subtle changes to close() semantics. Since builtin socket makefile() is not called for SSL connections, we don't get separately closeable fds for connection and response. Comments in the code explain how to restore makefile semantics. Bug fix candidate. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** httplib.py 7 Jul 2002 16:51:37 -0000 1.57 --- httplib.py 9 Jul 2002 21:22:36 -0000 1.58 *************** *** 755,759 **** return response ! class SSLFile: """File-like object wrapping an SSL socket.""" --- 755,805 ---- return response ! # The next several classes are used to define FakeSocket,a socket-like ! # interface to an SSL connection. ! ! # The primary complexity comes from faking a makefile() method. The ! # standard socket makefile() implementation calls dup() on the socket ! # file descriptor. As a consequence, clients can call close() on the ! # parent socket and its makefile children in any order. The underlying ! # socket isn't closed until they are all closed. ! ! # The implementation uses reference counting to keep the socket open ! # until the last client calls close(). SharedSocket keeps track of ! # the reference counting and SharedSocketClient provides an constructor ! # and close() method that call incref() and decref() correctly. ! ! class SharedSocket: ! ! def __init__(self, sock): ! self.sock = sock ! self._refcnt = 0 ! ! def incref(self): ! self._refcnt += 1 ! ! def decref(self): ! self._refcnt -= 1 ! assert self._refcnt >= 0 ! if self._refcnt == 0: ! self.sock.close() ! ! def __del__(self): ! self.sock.close() ! ! class SharedSocketClient: ! ! def __init__(self, shared): ! self._closed = 0 ! self._shared = shared ! self._shared.incref() ! self._sock = shared.sock ! ! def close(self): ! if not self._closed: ! self._shared.decref() ! self._closed = 1 ! self._shared = None ! ! class SSLFile(SharedSocketClient): """File-like object wrapping an SSL socket.""" *************** *** 761,765 **** def __init__(self, sock, ssl, bufsize=None): ! self._sock = sock self._ssl = ssl self._buf = '' --- 807,811 ---- def __init__(self, sock, ssl, bufsize=None): ! SharedSocketClient.__init__(self, sock) self._ssl = ssl self._buf = '' *************** *** 830,857 **** return line ! def close(self): ! self._sock.close() - class FakeSocket: def __init__(self, sock, ssl): ! self.__sock = sock ! self.__ssl = ssl def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self.__sock, self.__ssl, bufsize) def send(self, stuff, flags = 0): ! return self.__ssl.write(stuff) ! def sendall(self, stuff, flags = 0): ! return self.__ssl.write(stuff) def recv(self, len = 1024, flags = 0): ! return self.__ssl.read(len) def __getattr__(self, attr): ! return getattr(self.__sock, attr) --- 876,909 ---- return line ! class FakeSocket(SharedSocketClient): ! ! class _closedsocket: ! def __getattr__(self, name): ! raise error(9, 'Bad file descriptor') def __init__(self, sock, ssl): ! sock = SharedSocket(sock) ! SharedSocketClient.__init__(self, sock) ! self._ssl = ssl ! ! def close(self): ! SharedSocketClient.close(self) ! self._sock = self.__class__._closedsocket() def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self._shared, self._ssl, bufsize) def send(self, stuff, flags = 0): ! return self._ssl.write(stuff) ! sendall = send def recv(self, len = 1024, flags = 0): ! return self._ssl.read(len) def __getattr__(self, attr): ! return getattr(self._sock, attr) *************** *** 1102,1114 **** return L + self._file.readlines(size) - # - # snarfed from httplib.py for now... - # def test(): """Test this module. ! The test consists of retrieving and displaying the Python ! home page, along with the error code and error string returned ! by the www.python.org server. """ --- 1154,1162 ---- return L + self._file.readlines(size) def test(): """Test this module. ! A hodge podge of tests collected here, because they have too many ! external dependencies for the regular test suite. """ *************** *** 1131,1139 **** print 'status =', status print 'reason =', reason print if headers: for header in headers.headers: print header.strip() print - print "read", len(h.getfile().read()) # minimal test that code to extract host from url works --- 1179,1187 ---- print 'status =', status print 'reason =', reason + print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works *************** *** 1149,1168 **** if hasattr(socket, 'ssl'): ! host = 'sourceforge.net' ! selector = '/projects/python' ! hs = HTTPS() ! hs.connect(host) ! hs.putrequest('GET', selector) ! hs.endheaders() ! status, reason, headers = hs.getreply() ! # XXX why does this give a 302 response? ! print 'status =', status ! print 'reason =', reason ! print ! if headers: ! for header in headers.headers: print header.strip() ! print ! print "read", len(hs.getfile().read()) # Test a buggy server -- returns garbled status line. --- 1197,1220 ---- if hasattr(socket, 'ssl'): ! ! for host, selector in (('sourceforge.net', '/projects/python'), ! ('dbserv2.theopalgroup.com', '/mediumfile'), ! ('dbserv2.theopalgroup.com', '/smallfile'), ! ): ! print "https://%s%s" % (host, selector) ! hs = HTTPS() ! hs.connect(host) ! hs.putrequest('GET', selector) ! hs.endheaders() ! status, reason, headers = hs.getreply() ! print 'status =', status ! print 'reason =', reason ! print "read", len(hs.getfile().read()) ! print ! if headers: ! for header in headers.headers: print header.strip() ! print + return # Test a buggy server -- returns garbled status line. From tim_one@users.sourceforge.net Wed Jul 10 03:37:24 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 19:37:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pyclbr.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31271/python/Lib/test Modified Files: test_pyclbr.py Log Message: assertHasattr(): Made failure msg better than useless. test_others(): httplib failed in two new ways. Blame Thumb Boy . Index: test_pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyclbr.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_pyclbr.py 5 Jun 2002 19:07:39 -0000 1.9 --- test_pyclbr.py 10 Jul 2002 02:37:21 -0000 1.10 *************** *** 34,38 **** if attr in ignore: return if not hasattr(obj, attr): print "???", attr ! self.failUnless(hasattr(obj, attr)) --- 34,39 ---- if attr in ignore: return if not hasattr(obj, attr): print "???", attr ! self.failUnless(hasattr(obj, attr), ! 'expected hasattr(%r, %r)' % (obj, attr)) *************** *** 140,143 **** --- 141,146 ---- cm('httplib', ignore=('error', # set with = + 'sendall', # set with = + '_closedsocket', # it's a nested class 'HTTPS', 'HTTP11')) # not on all platforms From mhammond@users.sourceforge.net Wed Jul 10 07:22:13 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue, 09 Jul 2002 23:22:13 -0700 Subject: [Python-checkins] python/dist/src/PCbuild _sre.dsp,1.6,1.7 _tkinter.dsp,1.18,1.19 bsddb.dsp,1.13,1.14 parser.dsp,1.12,1.13 pyexpat.dsp,1.8,1.9 python.dsp,1.14,1.15 pythoncore.dsp,1.37,1.38 pythonw.dsp,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv10449 Modified Files: _sre.dsp _tkinter.dsp bsddb.dsp parser.dsp pyexpat.dsp python.dsp pythoncore.dsp pythonw.dsp Log Message: Remove the unused, and therefore distracting, "Alpha" build configurations. Index: _sre.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_sre.dsp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _sre.dsp 6 Sep 2001 06:39:39 -0000 1.6 --- _sre.dsp 10 Jul 2002 06:22:10 -0000 1.7 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 ! CFG=_sre - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=_sre - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 15,19 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "_sre.mak" CFG="_sre - Win32 Alpha Debug" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "_sre.mak" CFG="_sre - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 21,26 **** !MESSAGE "_sre - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_sre - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") - !MESSAGE "_sre - Win32 Alpha Debug" (based on "Win32 (ALPHA) Dynamic-Link Library") - !MESSAGE "_sre - Win32 Alpha Release" (based on "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE --- 20,23 ---- *************** *** 29,32 **** --- 26,32 ---- # PROP Scc_ProjName "_sre" # PROP Scc_LocalPath ".." + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe !IF "$(CFG)" == "_sre - Win32 Release" *************** *** 44,54 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 - MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 44,51 ---- *************** *** 75,85 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 - MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 72,79 ---- *************** *** 92,159 **** # SUBTRACT LINK32 /pdb:none - !ELSEIF "$(CFG)" == "_sre - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\_sre" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MTd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./_sre_d.pyd" /pdbtype:sept /export:init_sre - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e1F0000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-debug/_sre_d.pyd" /pdbtype:sept /export:init_sre - # SUBTRACT LINK32 /pdb:none - - !ELSEIF "$(CFG)" == "_sre - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\sre" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./_sre.pyd" /export:init_sre - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e1F0000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-release/_sre.pyd" /export:init_sre - # SUBTRACT LINK32 /pdb:none - !ENDIF --- 86,89 ---- *************** *** 162,181 **** # Name "_sre - Win32 Release" # Name "_sre - Win32 Debug" - # Name "_sre - Win32 Alpha Debug" - # Name "_sre - Win32 Alpha Release" # Begin Source File SOURCE=..\Modules\_sre.c - - !IF "$(CFG)" == "_sre - Win32 Release" - - !ELSEIF "$(CFG)" == "_sre - Win32 Debug" - - !ELSEIF "$(CFG)" == "_sre - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "_sre - Win32 Alpha Release" - - !ENDIF - # End Source File # End Target --- 92,98 ---- Index: _tkinter.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_tkinter.dsp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** _tkinter.dsp 25 Aug 2000 06:52:44 -0000 1.18 --- _tkinter.dsp 10 Jul 2002 06:22:10 -0000 1.19 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 ! CFG=_tkinter - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=_tkinter - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 15,24 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "_tkinter.mak" CFG="_tkinter - Win32 Alpha Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE - !MESSAGE "_tkinter - Win32 Alpha Debug" (based on "Win32 (ALPHA) Dynamic-Link Library") - !MESSAGE "_tkinter - Win32 Alpha Release" (based on "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE "_tkinter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_tkinter - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") --- 14,21 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "_tkinter.mak" CFG="_tkinter - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "_tkinter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_tkinter - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") *************** *** 29,98 **** # PROP Scc_ProjName "_tkinter" # PROP Scc_LocalPath "..\..\.." - - !IF "$(CFG)" == "_tkinter - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\_tkinter" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MTd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 tcl80.lib tk80.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" /export:init_tkinter - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 ..\..\tcl\lib\tcl83.lib ..\..\tcl\lib\tk83.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-debug/_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" /export:init_tkinter - # SUBTRACT LINK32 /pdb:none - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\_tkinter" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" CPP=cl.exe - # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /I "..\..\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c MTL=midl.exe - # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 RSC=rc.exe - # 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 tcl80.lib tk80.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" /export:init_tkinter - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 ..\..\tcl\lib\tcl83.lib ..\..\tcl\lib\tk83.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-release/_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" /export:init_tkinter - # SUBTRACT LINK32 /pdb:none ! !ELSEIF "$(CFG)" == "_tkinter - Win32 Debug" # PROP BASE Use_MFC 0 --- 26,34 ---- # PROP Scc_ProjName "_tkinter" # PROP Scc_LocalPath "..\..\.." CPP=cl.exe MTL=midl.exe RSC=rc.exe ! !IF "$(CFG)" == "_tkinter - Win32 Debug" # PROP BASE Use_MFC 0 *************** *** 108,118 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 "..\..\tcl\include" /I "..\Include" /I "..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 44,51 ---- *************** *** 139,149 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 "..\..\tcl\include" /I "..\Include" /I "..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 72,79 ---- *************** *** 160,165 **** # Begin Target - # Name "_tkinter - Win32 Alpha Debug" - # Name "_tkinter - Win32 Alpha Release" # Name "_tkinter - Win32 Debug" # Name "_tkinter - Win32 Release" --- 90,93 ---- *************** *** 167,196 **** SOURCE=..\Modules\_tkinter.c - - !IF "$(CFG)" == "_tkinter - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Alpha Release" - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Debug" - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Release" - - !ENDIF - # End Source File # Begin Source File SOURCE=..\Modules\tkappinit.c - - !IF "$(CFG)" == "_tkinter - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Alpha Release" - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Debug" - - !ELSEIF "$(CFG)" == "_tkinter - Win32 Release" - - !ENDIF - # End Source File # End Target --- 95,102 ---- Index: bsddb.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/bsddb.dsp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** bsddb.dsp 13 Aug 2000 22:59:26 -0000 1.13 --- bsddb.dsp 10 Jul 2002 06:22:10 -0000 1.14 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 ! CFG=bsddb - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=bsddb - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 15,19 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "bsddb.mak" CFG="bsddb - Win32 Alpha Debug" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "bsddb.mak" CFG="bsddb - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 21,26 **** !MESSAGE "bsddb - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "bsddb - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") - !MESSAGE "bsddb - Win32 Alpha Debug" (based on "Win32 (ALPHA) Dynamic-Link Library") - !MESSAGE "bsddb - Win32 Alpha Release" (based on "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE --- 20,23 ---- *************** *** 29,32 **** --- 26,32 ---- # PROP Scc_ProjName "bsddb" # PROP Scc_LocalPath ".." + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe !IF "$(CFG)" == "bsddb - Win32 Release" *************** *** 44,54 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 "..\..\bsddb\include" /I "..\..\bsddb\port\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 44,51 ---- *************** *** 75,85 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 "..\..\bsddb\include" /I "..\..\bsddb\port\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 72,79 ---- *************** *** 92,159 **** # SUBTRACT LINK32 /verbose /pdb:none - !ELSEIF "$(CFG)" == "bsddb - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\bsddb" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MTd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "..\..\bsddb\include" /I "..\..\bsddb\port\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "..\..\bsddb\include" /I "..\..\bsddb\port\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 ..\..\bsddb\port\win32\db.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:ALPHA /nodefaultlib:"MSVCRT" /out:"./bsddb_d.pyd" /pdbtype:sept /export:initbsddb - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 ..\..\bsddb\port\win32\db.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:ALPHA /nodefaultlib:"MSVCRT" /out:"alpha-temp-debug\bsddb_d.pyd" /pdbtype:sept /export:initbsddb - # SUBTRACT LINK32 /verbose /pdb:none - - !ELSEIF "$(CFG)" == "bsddb - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\bsddb" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\..\bsddb\include" /I "..\..\bsddb\port\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /I "..\..\bsddb\include" /I "..\..\bsddb\port\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 ..\..\bsddb\port\win32\db.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:ALPHA /out:"./bsddb.pyd" /export:initbsddb - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 ..\..\bsddb\port\win32\db.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-release\bsddb.pyd" /export:initbsddb - # SUBTRACT LINK32 /verbose /pdb:none - !ENDIF --- 86,89 ---- *************** *** 162,167 **** # Name "bsddb - Win32 Release" # Name "bsddb - Win32 Debug" - # Name "bsddb - Win32 Alpha Debug" - # Name "bsddb - Win32 Alpha Release" # Begin Source File --- 92,95 ---- *************** *** 177,184 **** # ADD CPP /I "..\..\bsddb\PORT\win32\include" /I "..\..\bsddb\PORT\include" /D "__DBINTERFACE_PRIVATE" # SUBTRACT CPP /I "..\..\bsddb\port\include" - - !ELSEIF "$(CFG)" == "bsddb - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "bsddb - Win32 Alpha Release" !ENDIF --- 105,108 ---- Index: parser.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/parser.dsp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** parser.dsp 6 Sep 2001 06:39:39 -0000 1.12 --- parser.dsp 10 Jul 2002 06:22:10 -0000 1.13 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 ! CFG=parser - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=parser - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 15,19 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "parser.mak" CFG="parser - Win32 Alpha Debug" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "parser.mak" CFG="parser - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 21,26 **** !MESSAGE "parser - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "parser - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") - !MESSAGE "parser - Win32 Alpha Debug" (based on "Win32 (ALPHA) Dynamic-Link Library") - !MESSAGE "parser - Win32 Alpha Release" (based on "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE --- 20,23 ---- *************** *** 29,32 **** --- 26,32 ---- # PROP Scc_ProjName "parser" # PROP Scc_LocalPath ".." + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe !IF "$(CFG)" == "parser - Win32 Release" *************** *** 44,54 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 - MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 44,51 ---- *************** *** 75,85 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 - MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 72,79 ---- *************** *** 92,159 **** # SUBTRACT LINK32 /pdb:none - !ELSEIF "$(CFG)" == "parser - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\parser" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MTd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./parser_d.pyd" /pdbtype:sept /export:initparser - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1eA00000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-debug/parser_d.pyd" /pdbtype:sept /export:initparser - # SUBTRACT LINK32 /pdb:none - - !ELSEIF "$(CFG)" == "parser - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\parser" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./parser.pyd" /export:initparser - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1eA00000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-release/parser.pyd" /export:initparser - # SUBTRACT LINK32 /pdb:none - !ENDIF --- 86,89 ---- *************** *** 162,181 **** # Name "parser - Win32 Release" # Name "parser - Win32 Debug" - # Name "parser - Win32 Alpha Debug" - # Name "parser - Win32 Alpha Release" # Begin Source File SOURCE=..\Modules\parsermodule.c - - !IF "$(CFG)" == "parser - Win32 Release" - - !ELSEIF "$(CFG)" == "parser - Win32 Debug" - - !ELSEIF "$(CFG)" == "parser - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "parser - Win32 Alpha Release" - - !ENDIF - # End Source File # End Target --- 92,98 ---- Index: pyexpat.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pyexpat.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pyexpat.dsp 13 Feb 2002 07:47:16 -0000 1.8 --- pyexpat.dsp 10 Jul 2002 06:22:10 -0000 1.9 *************** *** 1,26 **** # Microsoft Developer Studio Project File - Name="pyexpat" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** NICHT BEARBEITEN ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 ! CFG=pyexpat - Win32 Alpha Debug ! !MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE ! !MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl !MESSAGE !MESSAGE NMAKE /f "pyexpat.mak". !MESSAGE ! !MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben ! !MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: !MESSAGE ! !MESSAGE NMAKE /f "pyexpat.mak" CFG="pyexpat - Win32 Alpha Debug" !MESSAGE ! !MESSAGE Für die Konfiguration stehen zur Auswahl: !MESSAGE ! !MESSAGE "pyexpat - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") ! !MESSAGE "pyexpat - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") ! !MESSAGE "pyexpat - Win32 Alpha Debug" (basierend auf "Win32 (ALPHA) Dynamic-Link Library") ! !MESSAGE "pyexpat - Win32 Alpha Release" (basierend auf "Win32 (ALPHA) Dynamic-Link Library") !MESSAGE --- 1,23 ---- # Microsoft Developer Studio Project File - Name="pyexpat" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=pyexpat - Win32 Alpha 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 "pyexpat.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 "pyexpat.mak" CFG="pyexpat - Win32 Alpha Release" !MESSAGE ! !MESSAGE Possible choices for configuration are: !MESSAGE ! !MESSAGE "pyexpat - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") ! !MESSAGE "pyexpat - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE *************** *** 29,32 **** --- 26,32 ---- # PROP Scc_ProjName "pyexpat" # PROP Scc_LocalPath ".." + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe !IF "$(CFG)" == "pyexpat - Win32 Release" *************** *** 44,54 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 "..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_EXPAT_H" /D "XML_NS" /D "XML_DTD" /D XML_BYTE_ORDER=12 /D XML_CONTEXT_BYTES=1024 /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 44,51 ---- *************** *** 75,85 **** # PROP Target_Dir "" F90=df.exe - CPP=cl.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 "..\Modules\expat" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_EXPAT_H" /D "XML_NS" /D "XML_DTD" /D XML_BYTE_ORDER=12 /D XML_CONTEXT_BYTES=1024 /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 72,79 ---- *************** *** 92,159 **** # SUBTRACT LINK32 /pdb:none - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\pyexpat" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MTd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./pyexpat_d.pyd" /pdbtype:sept /export:initpyexpat - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1D100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-debug/pyexpat_d.pyd" /pdbtype:sept /export:initpyexpat - # SUBTRACT LINK32 /pdb:none - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\pyexpat" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "C:\Program Files\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"./pyexpat.pyd" /export:initpyexpat - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1D100000" /subsystem:windows /dll /debug /machine:ALPHA /out:"alpha-temp-release/pyexpat.pyd" /export:initpyexpat - # SUBTRACT LINK32 /pdb:none - !ENDIF --- 86,89 ---- *************** *** 162,226 **** # Name "pyexpat - Win32 Release" # Name "pyexpat - Win32 Debug" - # Name "pyexpat - Win32 Alpha Debug" - # Name "pyexpat - Win32 Alpha Release" # Begin Source File SOURCE=..\Modules\pyexpat.c - - !IF "$(CFG)" == "pyexpat - Win32 Release" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Release" - - !ENDIF - # End Source File # Begin Source File SOURCE=..\Modules\expat\xmlparse.c - - !IF "$(CFG)" == "pyexpat - Win32 Release" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Release" - - !ENDIF - # End Source File # Begin Source File SOURCE=..\Modules\expat\xmlrole.c - - !IF "$(CFG)" == "pyexpat - Win32 Release" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Release" - - !ENDIF - # End Source File # Begin Source File SOURCE=..\Modules\expat\xmltok.c - - !IF "$(CFG)" == "pyexpat - Win32 Release" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "pyexpat - Win32 Alpha Release" - - !ENDIF - # End Source File # End Target --- 92,110 ---- Index: python.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python.dsp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** python.dsp 6 Sep 2001 06:39:39 -0000 1.14 --- python.dsp 10 Jul 2002 06:22:10 -0000 1.15 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Console Application" 0x0103 - # TARGTYPE "Win32 (ALPHA) Console Application" 0x0603 ! CFG=python - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! CFG=python - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 15,19 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "python.mak" CFG="python - Win32 Alpha Debug" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "python.mak" CFG="python - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 21,26 **** !MESSAGE "python - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "python - Win32 Debug" (based on "Win32 (x86) Console Application") - !MESSAGE "python - Win32 Alpha Debug" (based on "Win32 (ALPHA) Console Application") - !MESSAGE "python - Win32 Alpha Release" (based on "Win32 (ALPHA) Console Application") !MESSAGE --- 20,23 ---- *************** *** 29,32 **** --- 26,31 ---- # PROP Scc_ProjName "python" # PROP Scc_LocalPath ".." + CPP=cl.exe + RSC=rc.exe !IF "$(CFG)" == "python - Win32 Release" *************** *** 43,50 **** # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" - CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 42,47 ---- *************** *** 70,77 **** # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" - CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" --- 67,72 ---- *************** *** 84,141 **** # SUBTRACT LINK32 /pdb:none - !ELSEIF "$(CFG)" == "python - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\python" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c - RSC=rc.exe - # ADD BASE RSC /l 0x409 /i "..\Include" /d "_DEBUG" - # ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" - BSC32=bscmake.exe - # ADD BASE BSC32 /nologo - # ADD BSC32 /nologo - LINK32=link.exe - # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:ALPHA /out:"./python_d.exe" /pdbtype:sept - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /subsystem:console /debug /machine:ALPHA /out:"./python_d.exe" /pdbtype:sept - - !ELSEIF "$(CFG)" == "python - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\python" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c - RSC=rc.exe - # 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 /nologo /subsystem:console /debug /machine:ALPHA - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /subsystem:console /debug /machine:ALPHA - !ENDIF --- 79,82 ---- *************** *** 144,149 **** # Name "python - Win32 Release" # Name "python - Win32 Debug" - # Name "python - Win32 Alpha Debug" - # Name "python - Win32 Alpha Release" # Begin Source File --- 85,88 ---- *************** *** 153,167 **** SOURCE=..\Modules\python.c - - !IF "$(CFG)" == "python - Win32 Release" - - !ELSEIF "$(CFG)" == "python - Win32 Debug" - - !ELSEIF "$(CFG)" == "python - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "python - Win32 Alpha Release" - - !ENDIF - # End Source File # Begin Source File --- 92,95 ---- Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** pythoncore.dsp 16 Jun 2002 01:34:49 -0000 1.37 --- pythoncore.dsp 10 Jul 2002 06:22:10 -0000 1.38 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - # TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602 ! CFG=pythoncore - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 [...1814 lines suppressed...] - !ENDIF - # End Source File # Begin Source File SOURCE=..\Modules\yuvconvert.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 # End Target --- 433,548 ---- Index: pythonw.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythonw.dsp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pythonw.dsp 6 Sep 2001 06:39:39 -0000 1.12 --- pythonw.dsp 10 Jul 2002 06:22:10 -0000 1.13 *************** *** 4,10 **** # TARGTYPE "Win32 (x86) Application" 0x0101 - # TARGTYPE "Win32 (ALPHA) Application" 0x0601 ! CFG=pythonw - Win32 Alpha Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 4,9 ---- # TARGTYPE "Win32 (x86) Application" 0x0101 ! CFG=pythonw - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 15,19 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "pythonw.mak" CFG="pythonw - Win32 Alpha Debug" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "pythonw.mak" CFG="pythonw - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 21,26 **** !MESSAGE "pythonw - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "pythonw - Win32 Debug" (based on "Win32 (x86) Application") - !MESSAGE "pythonw - Win32 Alpha Debug" (based on "Win32 (ALPHA) Application") - !MESSAGE "pythonw - Win32 Alpha Release" (based on "Win32 (ALPHA) Application") !MESSAGE --- 20,23 ---- *************** *** 29,32 **** --- 26,32 ---- # PROP Scc_ProjName "pythonw" # PROP Scc_LocalPath "..\pc" + CPP=cl.exe + MTL=midl.exe + RSC=rc.exe !IF "$(CFG)" == "pythonw - Win32 Release" *************** *** 43,53 **** # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" - CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 43,50 ---- *************** *** 73,83 **** # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" - CPP=cl.exe # ADD BASE CPP /nologo /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" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 70,77 ---- *************** *** 90,157 **** # SUBTRACT LINK32 /pdb:none - !ELSEIF "$(CFG)" == "pythonw - Win32 Alpha Debug" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 1 - # PROP BASE Output_Dir "Debug" - # PROP BASE Intermediate_Dir "Debug" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 1 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-debug\pythonw" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MDd /Gt0 /W3 /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e190000" /subsystem:windows /debug /machine:ALPHA /out:"./pythonw_d.exe" /pdbtype:sept - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e190000" /subsystem:windows /debug /machine:ALPHA /out:"./pythonw_d.exe" /pdbtype:sept - # SUBTRACT LINK32 /pdb:none - - !ELSEIF "$(CFG)" == "pythonw - Win32 Alpha Release" - - # PROP BASE Use_MFC 0 - # PROP BASE Use_Debug_Libraries 0 - # PROP BASE Output_Dir "Release" - # PROP BASE Intermediate_Dir "Release" - # PROP BASE Ignore_Export_Lib 0 - # PROP BASE Target_Dir "" - # PROP Use_MFC 0 - # PROP Use_Debug_Libraries 0 - # PROP Output_Dir "." - # PROP Intermediate_Dir "alpha-temp-release\pythonw" - # PROP Ignore_Export_Lib 0 - # PROP Target_Dir "" - CPP=cl.exe - # ADD BASE CPP /nologo /Gt0 /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - # ADD CPP /nologo /MD /Gt0 /W3 /GX /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c - MTL=midl.exe - # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 - RSC=rc.exe - # 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 /nologo /base:"0x1e190000" /subsystem:windows /debug /machine:ALPHA - # SUBTRACT BASE LINK32 /pdb:none - # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /base:"0x1e190000" /subsystem:windows /debug /machine:ALPHA - # SUBTRACT LINK32 /pdb:none - !ENDIF --- 84,87 ---- *************** *** 160,165 **** # Name "pythonw - Win32 Release" # Name "pythonw - Win32 Debug" - # Name "pythonw - Win32 Alpha Debug" - # Name "pythonw - Win32 Alpha Release" # Begin Source File --- 90,93 ---- *************** *** 169,183 **** SOURCE=..\PC\WinMain.c - - !IF "$(CFG)" == "pythonw - Win32 Release" - - !ELSEIF "$(CFG)" == "pythonw - Win32 Debug" - - !ELSEIF "$(CFG)" == "pythonw - Win32 Alpha Debug" - - !ELSEIF "$(CFG)" == "pythonw - Win32 Alpha Release" - - !ENDIF - # End Source File # End Target --- 97,100 ---- From tim_one@users.sourceforge.net Wed Jul 10 07:34:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 09 Jul 2002 23:34:22 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.105,2.106 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv12319/python/Include Modified Files: object.h Log Message: Uglified the new Py_REF_DEBUG (etc) lexical helper macro definitions so that their uses can be prettier. I've come to despise the names I picked for these things, though, and expect to change all of them -- I changed a bunch of other files to use them (replacing #ifdef blocks), but the names were so obscure out of context that I backed that all out again. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.105 retrieving revision 2.106 diff -C2 -d -r2.105 -r2.106 *** object.h 9 Jul 2002 02:57:01 -0000 2.105 --- object.h 10 Jul 2002 06:34:15 -0000 2.106 *************** *** 543,547 **** #define _PyMAYBE_BUMP_REFTOTAL _Py_RefTotal++ #define _PyMAYBE_DROP_REFTOTAL _Py_RefTotal-- ! #define _PyMAYBE_REFTOTAL_COMMA , #define _PyMAYBE_CHECK_REFCNT(OP) \ { if ((OP)->ob_refcnt < 0) \ --- 543,548 ---- #define _PyMAYBE_BUMP_REFTOTAL _Py_RefTotal++ #define _PyMAYBE_DROP_REFTOTAL _Py_RefTotal-- ! #define _PyMAYBE_BUMP_REFTOTAL_COMMA _PyMAYBE_BUMP_REFTOTAL , ! #define _PyMAYBE_DROP_REFTOTAL_COMMA _PyMAYBE_DROP_REFTOTAL , #define _PyMAYBE_CHECK_REFCNT(OP) \ { if ((OP)->ob_refcnt < 0) \ *************** *** 552,558 **** #define _PyMAYBE_BUMP_REFTOTAL #define _PyMAYBE_DROP_REFTOTAL ! #define _PyMAYBE_REFTOTAL_COMMA ! #define _PyMAYBE_CHECK_REFCNT(OP) ; ! #endif #ifdef COUNT_ALLOCS --- 553,560 ---- #define _PyMAYBE_BUMP_REFTOTAL #define _PyMAYBE_DROP_REFTOTAL ! #define _PyMAYBE_BUMP_REFTOTAL_COMMA ! #define _PyMAYBE_DROP_REFTOTAL_COMMA ! #define _PyMAYBE_CHECK_REFCNT(OP) /* a semicolon */; ! #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS *************** *** 560,571 **** #define _PyMAYBE_BUMP_COUNT(OP) inc_count((OP)->ob_type) #define _PyMAYBE_BUMP_FREECOUNT(OP) (OP)->ob_type->tp_frees++ ! #define _PyMAYBE_BUMP_COUNT_COMMA , ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA , #else #define _PyMAYBE_BUMP_COUNT(OP) #define _PyMAYBE_BUMP_FREECOUNT(OP) ! #define _PyMAYBE_BUMP_COUNT_COMMA ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA ! #endif #ifdef Py_TRACE_REFS --- 562,575 ---- #define _PyMAYBE_BUMP_COUNT(OP) inc_count((OP)->ob_type) #define _PyMAYBE_BUMP_FREECOUNT(OP) (OP)->ob_type->tp_frees++ ! #define _PyMAYBE_DROP_FREECOUNT(OP) (OP)->ob_type->tp_frees-- ! #define _PyMAYBE_BUMP_COUNT_COMMA(OP) _PyMAYBE_BUMP_COUNT(OP) , ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA(OP) _PyMAYBE_BUMP_FREECOUNT(OP) , #else #define _PyMAYBE_BUMP_COUNT(OP) #define _PyMAYBE_BUMP_FREECOUNT(OP) ! #define _PyMAYBE_DROP_FREECOUNT(OP) ! #define _PyMAYBE_BUMP_COUNT_COMMA(OP) ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA(OP) ! #endif /* COUNT_ALLOCS */ #ifdef Py_TRACE_REFS *************** *** 581,605 **** * inline. */ ! #define _Py_NewReference(op) ( \ ! _PyMAYBE_BUMP_COUNT(op) _PyMAYBE_BUMP_COUNT_COMMA \ ! _PyMAYBE_BUMP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA \ (op)->ob_refcnt = 1) #define _Py_ForgetReference(op) _PyMAYBE_BUMP_FREECOUNT(op) ! #define _Py_Dealloc(op) ( \ ! _PyMAYBE_BUMP_FREECOUNT(op) _PyMAYBE_BUMP_FREECOUNT_COMMA \ (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _PyMAYBE_BUMP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA \ (op)->ob_refcnt++) ! #define Py_DECREF(op) \ ! if (_PyMAYBE_DROP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA \ ! --(op)->ob_refcnt != 0) \ ! _PyMAYBE_CHECK_REFCNT(op) \ ! else \ _Py_Dealloc((PyObject *)(op)) --- 585,609 ---- * inline. */ ! #define _Py_NewReference(op) ( \ ! _PyMAYBE_BUMP_COUNT_COMMA(op) \ ! _PyMAYBE_BUMP_REFTOTAL_COMMA \ (op)->ob_refcnt = 1) #define _Py_ForgetReference(op) _PyMAYBE_BUMP_FREECOUNT(op) ! #define _Py_Dealloc(op) ( \ ! _PyMAYBE_BUMP_FREECOUNT_COMMA(op) \ (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _PyMAYBE_BUMP_REFTOTAL_COMMA \ (op)->ob_refcnt++) ! #define Py_DECREF(op) \ ! if (_PyMAYBE_DROP_REFTOTAL_COMMA \ ! --(op)->ob_refcnt != 0) \ ! _PyMAYBE_CHECK_REFCNT(op) \ ! else \ _Py_Dealloc((PyObject *)(op)) From tim_one@users.sourceforge.net Wed Jul 10 18:05:17 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 10:05:17 -0700 Subject: [Python-checkins] python/dist/src/PCbuild readme.txt,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv22409/python/PCbuild Modified Files: readme.txt Log Message: Removed no-longer-relevant explanation of "alpha" builds. Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** readme.txt 13 Mar 2002 21:51:55 -0000 1.23 --- readme.txt 10 Jul 2002 17:05:14 -0000 1.24 *************** *** 103,114 **** - NOTE ON CONFIGURATIONS - ---------------------- - Under Build -> Configuration ..., you'll find several Alpha configurations, - such as "Win32 Alpha Release". These do not refer to alpha versions (as in - alpha, beta, final), but to the DEC/COMPAQ Alpha processor. Ignore them if - you're not building on an Alpha box. - - YOUR OWN EXTENSION DLLs ----------------------- --- 103,106 ---- From tim_one@users.sourceforge.net Wed Jul 10 19:47:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 11:47:06 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23632/python/Misc Modified Files: SpecialBuilds.txt Log Message: Clarified sys.getobjects() pragmatics. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SpecialBuilds.txt 9 Jul 2002 19:27:20 -0000 1.4 --- SpecialBuilds.txt 10 Jul 2002 18:47:03 -0000 1.5 *************** *** 43,52 **** sys.getobjects(max[, type]) ! Return list of the most-recently allocated max objects, most recently ! allocated first in the list, least-recently allocated last in the ! list. max=0 means no limit on list length. If an optional type ! object is passed, the list is also restricted to objects of that ! type. The return list itself, and some temp objects created just ! to call sys.getobjects(), are excluded from the return list. envar PYTHONDUMPREFS --- 43,57 ---- sys.getobjects(max[, type]) ! Return list of the (no more than) max most-recently allocated objects, ! most recently allocated first in the list, least-recently allocated ! last in the list. max=0 means no limit on list length. ! If an optional type object is passed, the list is also restricted to ! objects of that type. ! The return list itself, and some temp objects created just to call ! sys.getobjects(), are excluded from the return list. Note that the ! list returned is just another object, though, so may appear in the ! return list the next time you call getobjects(); note that every ! object in the list is kept alive too, simply by virtue of being in ! the list. envar PYTHONDUMPREFS From fdrake@users.sourceforge.net Wed Jul 10 20:01:28 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 10 Jul 2002 12:01:28 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.24,1.24.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29553 Modified Files: Tag: release22-maint Setup.dist Log Message: Update the comments on building the pyexpat extension. Closes SF bug #577774. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.24 retrieving revision 1.24.10.1 diff -C2 -d -r1.24 -r1.24.10.1 *** Setup.dist 17 Oct 2001 13:46:28 -0000 1.24 --- Setup.dist 10 Jul 2002 19:01:25 -0000 1.24.10.1 *************** *** 440,462 **** # Interface to the Expat XML parser # ! # Expat is written by James Clark and must be downloaded separately ! # (see below). The pyexpat module was written by Paul Prescod after a ! # prototype by Jack Jansen. ! # ! # The Expat dist includes Windows .lib and .dll files. Home page is at ! # http://www.jclark.com/xml/expat.html, the current production release is ! # always ftp://ftp.jclark.com/pub/xml/expat.zip. ! # ! # EXPAT_DIR, below, should point to the expat/ directory created by ! # unpacking the Expat source distribution. # ! # Note: the expat build process doesn't yet build a libexpat.a; you can ! # do this manually while we try convince the author to add it. To do so, ! # cd to EXPAT_DIR, run "make" if you have not done so, then run: # ! # ar cr libexpat.a xmltok/*.o xmlparse/*.o # ! #EXPAT_DIR=/usr/local/src/expat ! #pyexpat pyexpat.c -I$(EXPAT_DIR)/xmlparse -L$(EXPAT_DIR) -lexpat --- 440,457 ---- # Interface to the Expat XML parser # ! # Expat was written by James Clark and is now maintained by a group of ! # developers on SourceForge; see www.libexpat.org for more ! # information. The pyexpat module was written by Paul Prescod after a ! # prototype by Jack Jansen. Expat 1.95.2 is the recommended version ! # of Expat for use with Python. Usage of a system shared ! # libexpat.so/expat.dll is not advised; a static version of the ! # library is sufficient. # ! # The Expat library should be installed so that the linker will find ! # it properly. # ! # More information on Expat can be found at www.libexpat.org. # ! #pyexpat pyexpat.c -DHAVE_EXPAT_H -lexpat From fdrake@users.sourceforge.net Wed Jul 10 20:21:10 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 10 Jul 2002 12:21:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3216/lib Modified Files: libgc.tex Log Message: Document gc.get_objects(). Closes SF bug #578308. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libgc.tex 26 Jan 2002 20:11:50 -0000 1.10 --- libgc.tex 10 Jul 2002 19:21:07 -0000 1.11 *************** *** 52,55 **** --- 52,61 ---- \end{funcdesc} + \begin{funcdesc}{get_objects}{} + Returns a list of all objects tracked by the collector, excluding the + list returned. + \versionadded{2.2} + \end{funcdesc} + \begin{funcdesc}{set_threshold}{threshold0\optional{, threshold1\optional{, threshold2}}} From fdrake@users.sourceforge.net Wed Jul 10 20:21:57 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 10 Jul 2002 12:21:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgc.tex,1.9,1.9.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3419/lib Modified Files: Tag: release22-maint libgc.tex Log Message: Document gc.get_objects(). Closes SF bug #578308. Index: libgc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgc.tex,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -C2 -d -r1.9 -r1.9.4.1 *** libgc.tex 14 Dec 2001 21:19:08 -0000 1.9 --- libgc.tex 10 Jul 2002 19:21:55 -0000 1.9.4.1 *************** *** 52,55 **** --- 52,61 ---- \end{funcdesc} + \begin{funcdesc}{get_objects}{} + Returns a list of all objects tracked by the collector, excluding the + list returned. + \versionadded{2.2} + \end{funcdesc} + \begin{funcdesc}{set_threshold}{threshold0\optional{, threshold1\optional{, threshold2}}} From tim_one@users.sourceforge.net Wed Jul 10 20:29:51 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 12:29:51 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5575/python/Objects Modified Files: obmalloc.c Log Message: Documented PYMALLOC_DEBUG. This completes primary coverage of all the "special builds" I ever use. If you use others, document them here, or don't be surprised if I rip out the code for them <0.5 wink>. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** obmalloc.c 2 May 2002 20:19:34 -0000 2.45 --- obmalloc.c 10 Jul 2002 19:29:49 -0000 2.46 *************** *** 882,886 **** #undef FORBIDDENBYTE #define CLEANBYTE 0xCB /* clean (newly allocated) memory */ ! #define DEADBYTE 0xDB /* deed (newly freed) memory */ #define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ --- 882,886 ---- #undef FORBIDDENBYTE #define CLEANBYTE 0xCB /* clean (newly allocated) memory */ ! #define DEADBYTE 0xDB /* dead (newly freed) memory */ #define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ From tim_one@users.sourceforge.net Wed Jul 10 20:29:51 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 12:29:51 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5575/python/Misc Modified Files: SpecialBuilds.txt Log Message: Documented PYMALLOC_DEBUG. This completes primary coverage of all the "special builds" I ever use. If you use others, document them here, or don't be surprised if I rip out the code for them <0.5 wink>. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SpecialBuilds.txt 10 Jul 2002 18:47:03 -0000 1.5 --- SpecialBuilds.txt 10 Jul 2002 19:29:49 -0000 1.6 *************** *** 61,64 **** --- 61,116 ---- PYMALLOC_DEBUG + When pymalloc is enabled (WITH_PYMALLOC is defined), calls to the PyObject_ + memory routines are handled by Python's own small-object allocator, while + calls to the PyMem_ memory routines are directed to the system malloc/ + realloc/free. If PYMALLOC_DEBUG is also defined, calls to both PyObject_ + and PyMem_ memory routines are directed to a special debugging mode of + Python's small-object allocator. + + This mode fills dynamically allocated memory blocks with special, + recognizable bit patterns, and adds debugging info on each end of + dynamically allocated memory blocks. The special bit patterns are: + + #define CLEANBYTE 0xCB /* clean (newly allocated) memory */ + #define DEADBYTE 0xDB /* dead (newly freed) memory */ + #define FORBIDDENBYTE 0xFB /* fordidden -- untouchable bytes */ + + Strings of these bytes are unlikely to be valid addresses, floats, or 7-bit + ASCII strings. + + 8 bytes are added at each end of each block of N bytes requested. The + memory layout is like so, where p represents the address returned by a + malloc-like or realloc-like function: + + p[-8:-4] + Number of bytes originally asked for. 4-byte unsigned integer, + big-endian (easier to read in a memory dump). + p[-4:0] + Copies of FORBIDDENBYTE. Used to catch under- writes and reads. + p[0:N] + The requested memory, filled with copies of CLEANBYTE. + Used to catch reference to uninitialized memory. + When a realloc-like function is called requesting a larger memory + block, the new excess bytes are also filled with CLEANBYTE. + When a free-like function is called, these are overwritten with + DEADBYTE, to catch reference to free()ed memory. When a realloc- + like function is called requesting a smaller memory block, the excess + old bytes are also filled with DEADBYTE. + p[N:N+4] + Copies of FORBIDDENBYTE. Used to catch over- writes and reads. + p[N+4:N+8] + A serial number, incremented by 1 on each call to a malloc-like or + realloc-like function. + 4-byte unsigned integer, big-endian. + If "bad memory" is detected later, the serial number gives an + excellent way to set a breakpoint on the next run, to capture the + instant at which this block was passed out. + + A malloc-like or free-like function first checks that the FORBIDDENBYTEs + at each end are intact. If they've been altered, diagnostic output is + written to stderr, and the program is aborted by Py_FatalError(). + + Note that PYMALLOC_DEBUG requires WITH_PYMALLOC. + Special gimmicks: From tim_one@users.sourceforge.net Thu Jul 11 01:02:55 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 17:02:55 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv16392/python/Misc Modified Files: SpecialBuilds.txt Log Message: Some clarifications. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SpecialBuilds.txt 10 Jul 2002 19:29:49 -0000 1.6 --- SpecialBuilds.txt 11 Jul 2002 00:02:52 -0000 1.7 *************** *** 81,85 **** 8 bytes are added at each end of each block of N bytes requested. The memory layout is like so, where p represents the address returned by a ! malloc-like or realloc-like function: p[-8:-4] --- 81,87 ---- 8 bytes are added at each end of each block of N bytes requested. The memory layout is like so, where p represents the address returned by a ! malloc-like or realloc-like function (p[i:j] means the slice of bytes ! from *(p+i) inclusive up to *(p+j) exclusive; note that the treatment ! of negative indices differs from a Python slice): p[-8:-4] *************** *** 105,109 **** If "bad memory" is detected later, the serial number gives an excellent way to set a breakpoint on the next run, to capture the ! instant at which this block was passed out. A malloc-like or free-like function first checks that the FORBIDDENBYTEs --- 107,113 ---- If "bad memory" is detected later, the serial number gives an excellent way to set a breakpoint on the next run, to capture the ! instant at which this block was passed out. The static function ! bumpserialno() in obmalloc.c is the only place the serial number ! is incremented, and exists so you can set such a breakpoint easily. A malloc-like or free-like function first checks that the FORBIDDENBYTEs *************** *** 125,129 **** Py_DEBUG implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if ! WITH_PYMALLOC is enabled). --------------------------------------------------------------------------- COUNT_ALLOCS --- 129,135 ---- Py_DEBUG implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if ! WITH_PYMALLOC is enabled). In addition, C assert()s are enabled (via ! the C way: by not defining NDEBUG), and some routines do additional ! sanity checks inside "#ifdef Py_DEBUG" blocks. --------------------------------------------------------------------------- COUNT_ALLOCS From tim_one@users.sourceforge.net Thu Jul 11 01:24:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 17:24:00 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20407/python/Misc Modified Files: SpecialBuilds.txt Log Message: Recorded the introduction release for each gimmick, as best I was able to reconstruct that info. Filled out some sketchy explanations of pragmatics. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SpecialBuilds.txt 11 Jul 2002 00:02:52 -0000 1.7 --- SpecialBuilds.txt 11 Jul 2002 00:23:58 -0000 1.8 *************** *** 3,7 **** --------------------------------------------------------------------------- ! Py_REF_DEBUG Turn on aggregate reference counting. This arranges that extern --- 3,8 ---- --------------------------------------------------------------------------- ! Py_REF_DEBUG introduced in 1.4 ! named REF_DEBUG before 1.4 Turn on aggregate reference counting. This arranges that extern *************** *** 29,33 **** Before 2.3, Py_TRACE_REFS was required to enable this function. --------------------------------------------------------------------------- ! Py_TRACE_REFS Turn on heavy reference debugging. This is major surgery. Every PyObject --- 30,35 ---- Before 2.3, Py_TRACE_REFS was required to enable this function. --------------------------------------------------------------------------- ! Py_TRACE_REFS introduced in 1.4 ! named TRACE_REFS before 1.4 Turn on heavy reference debugging. This is major surgery. Every PyObject *************** *** 59,63 **** all still-live heap objects. --------------------------------------------------------------------------- ! PYMALLOC_DEBUG When pymalloc is enabled (WITH_PYMALLOC is defined), calls to the PyObject_ --- 61,65 ---- all still-live heap objects. --------------------------------------------------------------------------- ! PYMALLOC_DEBUG introduced in 2.3 When pymalloc is enabled (WITH_PYMALLOC is defined), calls to the PyObject_ *************** *** 91,100 **** Copies of FORBIDDENBYTE. Used to catch under- writes and reads. p[0:N] ! The requested memory, filled with copies of CLEANBYTE. ! Used to catch reference to uninitialized memory. When a realloc-like function is called requesting a larger memory block, the new excess bytes are also filled with CLEANBYTE. When a free-like function is called, these are overwritten with ! DEADBYTE, to catch reference to free()ed memory. When a realloc- like function is called requesting a smaller memory block, the excess old bytes are also filled with DEADBYTE. --- 93,102 ---- Copies of FORBIDDENBYTE. Used to catch under- writes and reads. p[0:N] ! The requested memory, filled with copies of CLEANBYTE, used to catch ! reference to uninitialized memory. When a realloc-like function is called requesting a larger memory block, the new excess bytes are also filled with CLEANBYTE. When a free-like function is called, these are overwritten with ! DEADBYTE, to catch reference to freed memory. When a realloc- like function is called requesting a smaller memory block, the excess old bytes are also filled with DEADBYTE. *************** *** 111,117 **** is incremented, and exists so you can set such a breakpoint easily. ! A malloc-like or free-like function first checks that the FORBIDDENBYTEs at each end are intact. If they've been altered, diagnostic output is ! written to stderr, and the program is aborted by Py_FatalError(). Note that PYMALLOC_DEBUG requires WITH_PYMALLOC. --- 113,124 ---- is incremented, and exists so you can set such a breakpoint easily. ! A realloc-like or free-like function first checks that the FORBIDDENBYTEs at each end are intact. If they've been altered, diagnostic output is ! written to stderr, and the program is aborted via Py_FatalError(). The ! other main failure mode is provoking a memory error when a program ! reads up one of the special bit patterns and tries to use it as an address. ! If you get in a debugger then and look at the object, you're likely ! to see that it's entirely filled with 0xDB (meaning freed memory is ! getting used) or 0xCB (meaning uninitialized memory is getting used). Note that PYMALLOC_DEBUG requires WITH_PYMALLOC. *************** *** 124,128 **** by Py_Finalize(). --------------------------------------------------------------------------- ! Py_DEBUG This is what is generally meant by "a debug build" of Python. --- 131,136 ---- by Py_Finalize(). --------------------------------------------------------------------------- ! Py_DEBUG introduced in 1.5 ! named DEBUG before 1.5 This is what is generally meant by "a debug build" of Python. *************** *** 133,137 **** sanity checks inside "#ifdef Py_DEBUG" blocks. --------------------------------------------------------------------------- ! COUNT_ALLOCS Each type object grows three new members: --- 141,145 ---- sanity checks inside "#ifdef Py_DEBUG" blocks. --------------------------------------------------------------------------- ! COUNT_ALLOCS introduced in 0.9.9 Each type object grows three new members: From tim_one@users.sourceforge.net Thu Jul 11 01:38:07 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 17:38:07 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24297/python/Misc Modified Files: SpecialBuilds.txt Log Message: Noted the releases in which COUNT_ALLOCS can blow up. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SpecialBuilds.txt 11 Jul 2002 00:23:58 -0000 1.8 --- SpecialBuilds.txt 11 Jul 2002 00:38:05 -0000 1.9 *************** *** 142,145 **** --- 142,146 ---- --------------------------------------------------------------------------- COUNT_ALLOCS introduced in 0.9.9 + partly broken in 2.2 and 2.2.1 Each type object grows three new members: From gvanrossum@users.sourceforge.net Thu Jul 11 02:01:52 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 10 Jul 2002 18:01:52 -0700 Subject: [Python-checkins] python/dist/src/Misc README,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29974 Modified Files: README Log Message: Note the existence of SpecialBuilds.txt. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/README,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** README 11 Feb 2002 01:18:25 -0000 1.17 --- README 11 Jul 2002 01:01:49 -0000 1.18 *************** *** 26,29 **** --- 26,30 ---- RFD Request For Discussion about a Python newsgroup RPM (Old) tools to build RPMs + SpecialBuilds.txt Describes extra symbols you can set for debug builds setuid-prog.c C helper program for set-uid Python scripts vgrindefs Python configuration for vgrind (a generic pretty printer) From gvanrossum@users.sourceforge.net Thu Jul 11 02:04:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 10 Jul 2002 18:04:35 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30684 Modified Files: SpecialBuilds.txt Log Message: Replace rare tabs with 4 spaces, assuming that's what was intended. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SpecialBuilds.txt 11 Jul 2002 00:38:05 -0000 1.9 --- SpecialBuilds.txt 11 Jul 2002 01:04:32 -0000 1.10 *************** *** 147,160 **** /* Number of times an object of this type was allocated. */ ! int tp_allocs; /* Number of times an object of this type was deallocated. */ ! int tp_frees; ! /* Highwater mark: the maximum value of tp_allocs - tp_frees so ! * far; or, IOW, the largest number of objects of this type alive at ! * the same time. ! */ ! int tp_maxalloc; Allocation and deallocation code keeps these counts up to date. --- 147,160 ---- /* Number of times an object of this type was allocated. */ ! int tp_allocs; /* Number of times an object of this type was deallocated. */ ! int tp_frees; ! /* Highwater mark: the maximum value of tp_allocs - tp_frees so ! * far; or, IOW, the largest number of objects of this type alive at ! * the same time. ! */ ! int tp_maxalloc; Allocation and deallocation code keeps these counts up to date. From tim_one@users.sourceforge.net Thu Jul 11 07:23:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 23:23:52 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.159,2.160 object.c,2.185,2.186 stringobject.c,2.168,2.169 tupleobject.c,2.68,2.69 typeobject.c,2.157,2.158 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22768/python/Objects Modified Files: classobject.c object.c stringobject.c tupleobject.c typeobject.c Log Message: object.h special-build macro minefield: renamed all the new lexical helper macros to something saner, and used them appropriately in other files too, to reduce #ifdef blocks. classobject.c, instance_dealloc(): One of my worst Python Memories is trying to fix this routine a few years ago when COUNT_ALLOCS was defined but Py_TRACE_REFS wasn't. The special-build code here is way too complicated. Now it's much simpler. Difference: in a Py_TRACE_REFS build, the instance is no longer in the doubly-linked list of live objects while its __del__ method is executing, and that may be visible via sys.getobjects() called from a __del__ method. Tough -- the object is presumed dead while its __del__ is executing anyway, and not calling _Py_NewReference() at the start allows enormous code simplification. typeobject.c, call_finalizer(): The special-build instance_dealloc() pain apparently spread to here too via cut-'n-paste, and this is much simpler now too. In addition, I didn't understand why this routine was calling _PyObject_GC_TRACK() after a resurrection, since there's no plausible way _PyObject_GC_UNTRACK() could have been called on the object by this point. I suspect it was left over from pasting the instance_delloc() code. Instead asserted that the object is still tracked. Caution: I suspect we don't have a test that actually exercises the subtype_dealloc() __del__-resurrected-me code. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** classobject.c 7 Jul 2002 03:59:34 -0000 2.159 --- classobject.c 11 Jul 2002 06:23:50 -0000 2.160 *************** *** 616,622 **** PyObject *del; static PyObject *delstr; ! #ifdef Py_REF_DEBUG ! extern long _Py_RefTotal; ! #endif _PyObject_GC_UNTRACK(inst); if (inst->in_weakreflist != NULL) --- 616,620 ---- PyObject *del; static PyObject *delstr; ! _PyObject_GC_UNTRACK(inst); if (inst->in_weakreflist != NULL) *************** *** 624,644 **** /* Temporarily resurrect the object. */ ! #ifdef Py_TRACE_REFS ! #ifndef Py_REF_DEBUG ! # error "Py_TRACE_REFS defined but Py_REF_DEBUG not." ! #endif ! /* much too complicated if Py_TRACE_REFS defined */ ! inst->ob_type = &PyInstance_Type; ! _Py_NewReference((PyObject *)inst); ! #ifdef COUNT_ALLOCS ! /* compensate for boost in _Py_NewReference; note that ! * _Py_RefTotal was also boosted; we'll knock that down later. ! */ ! inst->ob_type->tp_allocs--; ! #endif ! #else /* !Py_TRACE_REFS */ ! /* Py_INCREF boosts _Py_RefTotal if Py_REF_DEBUG is defined */ ! Py_INCREF(inst); ! #endif /* !Py_TRACE_REFS */ /* Save the current exception, if any. */ --- 622,628 ---- /* Temporarily resurrect the object. */ ! assert(inst->ob_type == &PyInstance_Type); ! assert(inst->ob_refcnt == 0); ! inst->ob_refcnt = 1; /* Save the current exception, if any. */ *************** *** 657,686 **** /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); /* Undo the temporary resurrection; can't use DECREF here, it would * cause a recursive call. */ ! #ifdef Py_REF_DEBUG ! /* _Py_RefTotal was boosted either by _Py_NewReference or ! * Py_INCREF above. ! */ ! _Py_RefTotal--; ! #endif ! if (--inst->ob_refcnt > 0) { ! #ifdef COUNT_ALLOCS ! inst->ob_type->tp_frees--; ! #endif ! _PyObject_GC_TRACK(inst); ! return; /* __del__ added a reference; don't delete now */ } ! #ifdef Py_TRACE_REFS ! _Py_ForgetReference((PyObject *)inst); #ifdef COUNT_ALLOCS ! /* compensate for increment in _Py_ForgetReference */ ! inst->ob_type->tp_frees--; ! #endif #endif ! Py_DECREF(inst->in_class); ! Py_XDECREF(inst->in_dict); ! PyObject_GC_Del(inst); } --- 641,675 ---- /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); + /* Undo the temporary resurrection; can't use DECREF here, it would * cause a recursive call. */ ! assert(inst->ob_refcnt > 0); ! if (--inst->ob_refcnt == 0) { ! Py_DECREF(inst->in_class); ! Py_XDECREF(inst->in_dict); ! PyObject_GC_Del(inst); } ! else { ! int refcnt = inst->ob_refcnt; ! /* __del__ resurrected it! Make it look like the original ! * Py_DECREF never happened. ! */ ! _Py_NewReference((PyObject *)inst); ! inst->ob_refcnt = refcnt; ! _PyObject_GC_TRACK(inst); ! /* If Py_REF_DEBUG, the original decref dropped _Py_RefTotal, ! * but _Py_NewReference bumped it again, so that's a wash. ! * If Py_TRACE_REFS, _Py_NewReference re-added self to the ! * object chain, so no more to do there either. ! * If COUNT_ALLOCS, the original decref bumped tp_frees, and ! * _Py_NewReference bumped tp_allocs: both of those need to ! * be undone. ! */ #ifdef COUNT_ALLOCS ! --inst->ob_type->tp_frees; ! --inst->ob_type->tp_allocs; #endif ! } } *************** *** 1098,1102 **** if (!start) return NULL; ! end = PyInt_FromLong((long)j); if (!end) { --- 1087,1091 ---- if (!start) return NULL; ! end = PyInt_FromLong((long)j); if (!end) { *************** *** 1132,1138 **** return NULL; arg = Py_BuildValue("(N)", sliceobj_from_intint(i, j)); ! } else arg = Py_BuildValue("(ii)", i, j); ! if (arg == NULL) { Py_DECREF(func); --- 1121,1127 ---- return NULL; arg = Py_BuildValue("(N)", sliceobj_from_intint(i, j)); ! } else arg = Py_BuildValue("(ii)", i, j); ! if (arg == NULL) { Py_DECREF(func); *************** *** 1267,1271 **** Py_DECREF(func); Py_DECREF(arg); ! if(res == NULL) return -1; ret = PyObject_IsTrue(res); --- 1256,1260 ---- Py_DECREF(func); Py_DECREF(arg); ! if(res == NULL) return -1; ret = PyObject_IsTrue(res); *************** *** 1340,1344 **** /* Try one half of a binary operator involving a class instance. */ static PyObject * ! half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, int swapped) { --- 1329,1333 ---- /* Try one half of a binary operator involving a class instance. */ static PyObject * ! half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, int swapped) { *************** *** 1348,1352 **** PyObject *v1; PyObject *result; ! if (!PyInstance_Check(v)) { Py_INCREF(Py_NotImplemented); --- 1337,1341 ---- PyObject *v1; PyObject *result; ! if (!PyInstance_Check(v)) { Py_INCREF(Py_NotImplemented); *************** *** 1709,1713 **** static PyObject * instance_pow(PyObject *v, PyObject *w, PyObject *z) ! { if (z == Py_None) { return do_binop(v, w, "__pow__", "__rpow__", bin_power); --- 1698,1702 ---- static PyObject * instance_pow(PyObject *v, PyObject *w, PyObject *z) ! { if (z == Py_None) { return do_binop(v, w, "__pow__", "__rpow__", bin_power); *************** *** 1778,1782 **** static PyObject **name_op = NULL; ! static int init_name_op(void) { --- 1767,1771 ---- static PyObject **name_op = NULL; ! static int init_name_op(void) { *************** *** 1819,1823 **** exception on failure. */ if (((PyInstanceObject *)v)->in_class->cl_getattr == NULL) { ! method = instance_getattr2((PyInstanceObject *)v, name_op[op]); if (method == NULL) { --- 1808,1812 ---- exception on failure. */ if (((PyInstanceObject *)v)->in_class->cl_getattr == NULL) { ! method = instance_getattr2((PyInstanceObject *)v, name_op[op]); if (method == NULL) { Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** object.c 9 Jul 2002 02:57:01 -0000 2.185 --- object.c 11 Jul 2002 06:23:50 -0000 2.186 *************** *** 8,12 **** #endif ! #if defined( Py_TRACE_REFS ) || defined( Py_REF_DEBUG ) DL_IMPORT(long) _Py_RefTotal; #endif --- 8,12 ---- #endif ! #ifdef Py_REF_DEBUG DL_IMPORT(long) _Py_RefTotal; #endif *************** *** 1877,1881 **** _Py_NewReference(PyObject *op) { ! _Py_RefTotal++; op->ob_refcnt = 1; op->_ob_next = refchain._ob_next; --- 1877,1881 ---- _Py_NewReference(PyObject *op) { ! _Py_INC_REFTOTAL; op->ob_refcnt = 1; op->_ob_next = refchain._ob_next; *************** *** 1883,1887 **** refchain._ob_next->_ob_prev = op; refchain._ob_next = op; ! _PyMAYBE_BUMP_COUNT(op); } --- 1883,1887 ---- refchain._ob_next->_ob_prev = op; refchain._ob_next = op; ! _Py_INC_TPALLOCS(op); } *************** *** 1908,1912 **** op->_ob_prev->_ob_next = op->_ob_next; op->_ob_next = op->_ob_prev = NULL; ! _PyMAYBE_BUMP_FREECOUNT(op); } --- 1908,1912 ---- op->_ob_prev->_ob_next = op->_ob_next; op->_ob_next = op->_ob_prev = NULL; ! _Py_INC_TPFREES(op); } Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** stringobject.c 14 Jun 2002 00:50:41 -0000 2.168 --- stringobject.c 11 Jul 2002 06:23:50 -0000 2.169 *************** *** 3061,3067 **** } /* XXX UNREF/NEWREF interface should be more symmetrical */ ! #ifdef Py_REF_DEBUG ! --_Py_RefTotal; ! #endif _Py_ForgetReference(v); *pv = (PyObject *) --- 3061,3065 ---- } /* XXX UNREF/NEWREF interface should be more symmetrical */ ! _Py_DEC_REFTOTAL; _Py_ForgetReference(v); *pv = (PyObject *) Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** tupleobject.c 20 Jun 2002 23:13:17 -0000 2.68 --- tupleobject.c 11 Jul 2002 06:23:50 -0000 2.69 *************** *** 678,684 **** /* XXX UNREF/NEWREF interface should be more symmetrical */ ! #ifdef Py_REF_DEBUG ! --_Py_RefTotal; ! #endif _PyObject_GC_UNTRACK(v); _Py_ForgetReference((PyObject *) v); --- 678,682 ---- /* XXX UNREF/NEWREF interface should be more symmetrical */ ! _Py_DEC_REFTOTAL; _PyObject_GC_UNTRACK(v); _Py_ForgetReference((PyObject *) v); Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.157 retrieving revision 2.158 diff -C2 -d -r2.157 -r2.158 *** typeobject.c 24 Jun 2002 13:08:14 -0000 2.157 --- typeobject.c 11 Jul 2002 06:23:50 -0000 2.158 *************** *** 366,385 **** /* Temporarily resurrect the object. */ ! #ifdef Py_TRACE_REFS ! #ifndef Py_REF_DEBUG ! # error "Py_TRACE_REFS defined but Py_REF_DEBUG not." ! #endif ! /* much too complicated if Py_TRACE_REFS defined */ ! _Py_NewReference((PyObject *)self); ! #ifdef COUNT_ALLOCS ! /* compensate for boost in _Py_NewReference; note that ! * _Py_RefTotal was also boosted; we'll knock that down later. ! */ ! self->ob_type->tp_allocs--; ! #endif ! #else /* !Py_TRACE_REFS */ ! /* Py_INCREF boosts _Py_RefTotal if Py_REF_DEBUG is defined */ ! Py_INCREF(self); ! #endif /* !Py_TRACE_REFS */ /* Save the current exception, if any. */ --- 366,371 ---- /* Temporarily resurrect the object. */ ! assert(self->ob_refcnt == 0); ! self->ob_refcnt = 1; /* Save the current exception, if any. */ *************** *** 403,428 **** * cause a recursive call. */ ! #ifdef Py_REF_DEBUG ! /* _Py_RefTotal was boosted either by _Py_NewReference or ! * Py_INCREF above. */ ! _Py_RefTotal--; ! #endif ! if (--self->ob_refcnt > 0) { ! #ifdef COUNT_ALLOCS ! self->ob_type->tp_frees--; ! #endif ! _PyObject_GC_TRACK(self); ! return -1; /* __del__ added a reference; don't delete now */ } ! #ifdef Py_TRACE_REFS ! _Py_ForgetReference((PyObject *)self); #ifdef COUNT_ALLOCS ! /* compensate for increment in _Py_ForgetReference */ ! self->ob_type->tp_frees--; ! #endif #endif ! ! return 0; } --- 389,418 ---- * cause a recursive call. */ ! assert(self->ob_refcnt > 0); ! if (--self->ob_refcnt == 0) ! return 0; /* this is the normal path out */ ! ! /* __del__ resurrected it! Make it look like the original Py_DECREF ! * never happened. */ ! { ! int refcnt = self->ob_refcnt; ! _Py_NewReference(self); ! self->ob_refcnt = refcnt; } ! assert(_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); ! /* If Py_REF_DEBUG, the original decref dropped _Py_RefTotal, but ! * _Py_NewReference bumped it again, so that's a wash. ! * If Py_TRACE_REFS, _Py_NewReference re-added self to the object ! * chain, so no more to do there either. ! * If COUNT_ALLOCS, the original decref bumped tp_frees, and ! * _Py_NewReference bumped tp_allocs: both of those need to be ! * undone. ! */ #ifdef COUNT_ALLOCS ! --self->ob_type->tp_frees; ! --self->ob_type->tp_allocs; #endif ! return -1; /* __del__ added a reference; don't delete now */ } *************** *** 1388,1392 **** /* No readable descriptor found yet */ meta_get = NULL; ! /* Look for the attribute in the metatype */ meta_attribute = _PyType_Lookup(metatype, name); --- 1378,1382 ---- /* No readable descriptor found yet */ meta_get = NULL; ! /* Look for the attribute in the metatype */ meta_attribute = _PyType_Lookup(metatype, name); *************** *** 1394,1398 **** if (meta_attribute != NULL) { meta_get = meta_attribute->ob_type->tp_descr_get; ! if (meta_get != NULL && PyDescr_IsData(meta_attribute)) { /* Data descriptors implement tp_descr_set to intercept --- 1384,1388 ---- if (meta_attribute != NULL) { meta_get = meta_attribute->ob_type->tp_descr_get; ! if (meta_get != NULL && PyDescr_IsData(meta_attribute)) { /* Data descriptors implement tp_descr_set to intercept *************** *** 1417,1421 **** (PyObject *)type); } ! Py_INCREF(attribute); return attribute; --- 1407,1411 ---- (PyObject *)type); } ! Py_INCREF(attribute); return attribute; From tim_one@users.sourceforge.net Thu Jul 11 07:23:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 23:23:52 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.106,2.107 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22768/python/Include Modified Files: object.h Log Message: object.h special-build macro minefield: renamed all the new lexical helper macros to something saner, and used them appropriately in other files too, to reduce #ifdef blocks. classobject.c, instance_dealloc(): One of my worst Python Memories is trying to fix this routine a few years ago when COUNT_ALLOCS was defined but Py_TRACE_REFS wasn't. The special-build code here is way too complicated. Now it's much simpler. Difference: in a Py_TRACE_REFS build, the instance is no longer in the doubly-linked list of live objects while its __del__ method is executing, and that may be visible via sys.getobjects() called from a __del__ method. Tough -- the object is presumed dead while its __del__ is executing anyway, and not calling _Py_NewReference() at the start allows enormous code simplification. typeobject.c, call_finalizer(): The special-build instance_dealloc() pain apparently spread to here too via cut-'n-paste, and this is much simpler now too. In addition, I didn't understand why this routine was calling _PyObject_GC_TRACK() after a resurrection, since there's no plausible way _PyObject_GC_UNTRACK() could have been called on the object by this point. I suspect it was left over from pasting the instance_delloc() code. Instead asserted that the object is still tracked. Caution: I suspect we don't have a test that actually exercises the subtype_dealloc() __del__-resurrected-me code. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.106 retrieving revision 2.107 diff -C2 -d -r2.106 -r2.107 *** object.h 10 Jul 2002 06:34:15 -0000 2.106 --- object.h 11 Jul 2002 06:23:49 -0000 2.107 *************** *** 52,84 **** */ ! #ifdef Py_DEBUG ! /* Turn on aggregate reference counting. This arranges that extern ! * _Py_RefTotal hold a count of all references, the sum of ob_refcnt ! * across all objects. The value can be gotten programatically via ! * sys.gettotalrefcount() (which exists only if Py_REF_DEBUG is enabled). ! * In a debug-mode build, this is where the "8288" comes from in ! * ! * >>> 23 ! * 23 ! * [8288 refs] ! * >>> ! * ! * Note that if this count increases when you're not storing away new objects, ! * there's probably a leak. Remember, though, that in interactive mode the ! * special name "_" holds a reference to the last result displayed! ! * Py_REF_DEBUG also checks after every decref to verify that the refcount ! * hasn't gone negative, and causes an immediate fatal error if it has. ! */ ! #define Py_REF_DEBUG ! ! /* 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). This list can be ! * materialized into a Python list via sys.getobjects() (which exists only ! * if Py_TRACE_REFS is enabled). Py_TRACE_REFS implies Py_REF_DEBUG. ! */ #define Py_TRACE_REFS ! #endif /* Py_DEBUG */ /* Py_TRACE_REFS implies Py_REF_DEBUG. */ --- 52,59 ---- */ ! /* Py_DEBUG implies Py_TRACE_REFS. */ ! #if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) #define Py_TRACE_REFS ! #endif /* Py_TRACE_REFS implies Py_REF_DEBUG. */ *************** *** 537,549 **** */ #ifdef Py_REF_DEBUG extern DL_IMPORT(long) _Py_RefTotal; extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op); ! #define _PyMAYBE_BUMP_REFTOTAL _Py_RefTotal++ ! #define _PyMAYBE_DROP_REFTOTAL _Py_RefTotal-- ! #define _PyMAYBE_BUMP_REFTOTAL_COMMA _PyMAYBE_BUMP_REFTOTAL , ! #define _PyMAYBE_DROP_REFTOTAL_COMMA _PyMAYBE_DROP_REFTOTAL , ! #define _PyMAYBE_CHECK_REFCNT(OP) \ { if ((OP)->ob_refcnt < 0) \ _Py_NegativeRefcount(__FILE__, __LINE__, \ --- 512,532 ---- */ + /* First define a pile of simple helper macros, one set per special + * build symbol. These either expand to the obvious things, or to + * nothing at all when the special mode isn't in effect. The main + * macros can later be defined just once then, yet expand to different + * things depending on which special build options are and aren't in effect. + * Trust me : while painful, this is 20x easier to understand than, + * e.g, defining _Py_NewReference five different times in a maze of nested + * #ifdefs (we used to do that -- it was impenetrable). + */ #ifdef Py_REF_DEBUG extern DL_IMPORT(long) _Py_RefTotal; extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op); ! #define _Py_INC_REFTOTAL _Py_RefTotal++ ! #define _Py_DEC_REFTOTAL _Py_RefTotal-- ! #define _Py_REF_DEBUG_COMMA , ! #define _Py_CHECK_REFCNT(OP) \ { if ((OP)->ob_refcnt < 0) \ _Py_NegativeRefcount(__FILE__, __LINE__, \ *************** *** 551,574 **** } #else ! #define _PyMAYBE_BUMP_REFTOTAL ! #define _PyMAYBE_DROP_REFTOTAL ! #define _PyMAYBE_BUMP_REFTOTAL_COMMA ! #define _PyMAYBE_DROP_REFTOTAL_COMMA ! #define _PyMAYBE_CHECK_REFCNT(OP) /* a semicolon */; #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS extern DL_IMPORT(void) inc_count(PyTypeObject *); ! #define _PyMAYBE_BUMP_COUNT(OP) inc_count((OP)->ob_type) ! #define _PyMAYBE_BUMP_FREECOUNT(OP) (OP)->ob_type->tp_frees++ ! #define _PyMAYBE_DROP_FREECOUNT(OP) (OP)->ob_type->tp_frees-- ! #define _PyMAYBE_BUMP_COUNT_COMMA(OP) _PyMAYBE_BUMP_COUNT(OP) , ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA(OP) _PyMAYBE_BUMP_FREECOUNT(OP) , #else ! #define _PyMAYBE_BUMP_COUNT(OP) ! #define _PyMAYBE_BUMP_FREECOUNT(OP) ! #define _PyMAYBE_DROP_FREECOUNT(OP) ! #define _PyMAYBE_BUMP_COUNT_COMMA(OP) ! #define _PyMAYBE_BUMP_FREECOUNT_COMMA(OP) #endif /* COUNT_ALLOCS */ --- 534,554 ---- } #else ! #define _Py_INC_REFTOTAL ! #define _Py_DEC_REFTOTAL ! #define _Py_REF_DEBUG_COMMA ! #define _Py_CHECK_REFCNT(OP) /* a semicolon */; #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS extern DL_IMPORT(void) inc_count(PyTypeObject *); ! #define _Py_INC_TPALLOCS(OP) inc_count((OP)->ob_type) ! #define _Py_INC_TPFREES(OP) (OP)->ob_type->tp_frees++ ! #define _Py_DEC_TPFREES(OP) (OP)->ob_type->tp_frees-- ! #define _Py_COUNT_ALLOCS_COMMA , #else ! #define _Py_INC_TPALLOCS(OP) ! #define _Py_INC_TPFREES(OP) ! #define _Py_DEC_TPFREES(OP) ! #define _Py_COUNT_ALLOCS_COMMA #endif /* COUNT_ALLOCS */ *************** *** 585,609 **** * inline. */ ! #define _Py_NewReference(op) ( \ ! _PyMAYBE_BUMP_COUNT_COMMA(op) \ ! _PyMAYBE_BUMP_REFTOTAL_COMMA \ (op)->ob_refcnt = 1) ! #define _Py_ForgetReference(op) _PyMAYBE_BUMP_FREECOUNT(op) #define _Py_Dealloc(op) ( \ ! _PyMAYBE_BUMP_FREECOUNT_COMMA(op) \ (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _PyMAYBE_BUMP_REFTOTAL_COMMA \ (op)->ob_refcnt++) ! #define Py_DECREF(op) \ ! if (_PyMAYBE_DROP_REFTOTAL_COMMA \ ! --(op)->ob_refcnt != 0) \ ! _PyMAYBE_CHECK_REFCNT(op) \ ! else \ _Py_Dealloc((PyObject *)(op)) --- 565,589 ---- * inline. */ ! #define _Py_NewReference(op) ( \ ! _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ ! _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ (op)->ob_refcnt = 1) ! #define _Py_ForgetReference(op) _Py_INC_TPFREES(op) #define _Py_Dealloc(op) ( \ ! _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ (*(op)->ob_type->tp_dealloc)((PyObject *)(op))) #endif /* !Py_TRACE_REFS */ ! #define Py_INCREF(op) ( \ ! _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ (op)->ob_refcnt++) ! #define Py_DECREF(op) \ ! if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ ! --(op)->ob_refcnt != 0) \ ! _Py_CHECK_REFCNT(op) \ ! else \ _Py_Dealloc((PyObject *)(op)) From tim_one@users.sourceforge.net Thu Jul 11 07:56:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 10 Jul 2002 23:56:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.144,1.145 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30463/python/Lib/test Modified Files: test_descr.py Log Message: Added a test that provokes the hypothesized (in my last checkin comment) debug-build failure when an instance of a new-style class is resurrected by a __del__ method -- we simply never had any code that tried this. This is already fixed in 2.3 CVS. In 2.2.1, it blows up via Fatal Python error: GC object already in linked list I'll fix it in 2.2.1 CVS next. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** test_descr.py 24 Jun 2002 13:08:16 -0000 1.144 --- test_descr.py 11 Jul 2002 06:56:07 -0000 1.145 *************** *** 3184,3187 **** --- 3184,3206 ---- vereq(a, [2,3,1]) + def subtype_resurrection(): + if verbose: + print "Testing resurrection of new-style instance." + + class C(object): + container = [] + + def __del__(self): + # resurrect the instance + C.container.append(self) + + c = C() + c.attr = 42 + # The only interesting thing here is whether this blows up in a + # debug build, due to flawed GC tracking logic in typeobject.c's + # call_finalizer() (a 2.2.1 bug). + del c + del C.container[-1] # resurrect it again for the heck of it + vereq(C.container[-1].attr, 42) def do_this_first(): *************** *** 3275,3278 **** --- 3294,3298 ---- copy_setstate() slices() + subtype_resurrection() if verbose: print "All OK" From tim_one@users.sourceforge.net Thu Jul 11 08:06:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 00:06:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.19,1.113.4.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv414/22/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: Attempting to resurrect a dying instance of a new-style class in a __del__ method died with Fatal Python error: GC object already in linked list in both release and debug builds. Fixed that. Added a new test that dies without the fix. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.19 retrieving revision 1.113.4.20 diff -C2 -d -r1.113.4.19 -r1.113.4.20 *** test_descr.py 24 Jun 2002 13:25:41 -0000 1.113.4.19 --- test_descr.py 11 Jul 2002 07:06:42 -0000 1.113.4.20 *************** *** 2982,2985 **** --- 2982,3005 ---- vereq(b.getfoo(), 24) + def subtype_resurrection(): + if verbose: + print "Testing resurrection of new-style instance..." + + class C(object): + container = [] + + def __del__(self): + # resurrect the instance + C.container.append(self) + + c = C() + c.attr = 42 + # The only interesting thing here is whether this blows up in a + # debug build, due to flawed GC tracking logic in typeobject.c's + # call_finalizer() (a 2.2.1 bug). + del c + del C.container[-1] # resurrect it again for the heck of it + vereq(C.container[-1].attr, 42) + def test_main(): class_docstrings() *************** *** 3042,3045 **** --- 3062,3066 ---- imulbug() copy_setstate() + subtype_resurrection() if verbose: print "All OK" From tim_one@users.sourceforge.net Thu Jul 11 08:06:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 00:06:46 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.30,1.337.2.4.2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv414/22/Misc Modified Files: Tag: release22-maint NEWS Log Message: Attempting to resurrect a dying instance of a new-style class in a __del__ method died with Fatal Python error: GC object already in linked list in both release and debug builds. Fixed that. Added a new test that dies without the fix. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.30 retrieving revision 1.337.2.4.2.31 diff -C2 -d -r1.337.2.4.2.30 -r1.337.2.4.2.31 *** NEWS 8 Jul 2002 22:30:52 -0000 1.337.2.4.2.30 --- NEWS 11 Jul 2002 07:06:43 -0000 1.337.2.4.2.31 *************** *** 5,8 **** --- 5,11 ---- Core and builtins + - If a dying instance of a new-style class got resurrected by its class's + __del__ method, Python aborted with a fatal error. + - Source that creates parse nodes with an extremely large number of children (e.g., test_longexp.py) triggers problems with the From tim_one@users.sourceforge.net Thu Jul 11 08:06:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 00:06:46 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.18,2.126.4.19 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv414/22/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: Attempting to resurrect a dying instance of a new-style class in a __del__ method died with Fatal Python error: GC object already in linked list in both release and debug builds. Fixed that. Added a new test that dies without the fix. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.18 retrieving revision 2.126.4.19 diff -C2 -d -r2.126.4.18 -r2.126.4.19 *** typeobject.c 24 Jun 2002 13:25:41 -0000 2.126.4.18 --- typeobject.c 11 Jul 2002 07:06:44 -0000 2.126.4.19 *************** *** 404,408 **** self->ob_type->tp_frees--; #endif ! _PyObject_GC_TRACK(self); return -1; /* __del__ added a reference; don't delete now */ } --- 404,409 ---- self->ob_type->tp_frees--; #endif ! /* This should still be a tracked gc'ed object. */ ! assert(((PyGC_Head *)(self)-1)->gc.gc_next != NULL); return -1; /* __del__ added a reference; don't delete now */ } From tim_one@users.sourceforge.net Thu Jul 11 08:09:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 00:09:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.145,1.146 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2288/python/Lib/test Modified Files: test_descr.py Log Message: Repaired optimistic comment in new test. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -d -r1.145 -r1.146 *** test_descr.py 11 Jul 2002 06:56:07 -0000 1.145 --- test_descr.py 11 Jul 2002 07:09:42 -0000 1.146 *************** *** 3186,3190 **** def subtype_resurrection(): if verbose: ! print "Testing resurrection of new-style instance." class C(object): --- 3186,3190 ---- def subtype_resurrection(): if verbose: ! print "Testing resurrection of new-style instance..." class C(object): *************** *** 3197,3203 **** c = C() c.attr = 42 ! # The only interesting thing here is whether this blows up in a ! # debug build, due to flawed GC tracking logic in typeobject.c's ! # call_finalizer() (a 2.2.1 bug). del c del C.container[-1] # resurrect it again for the heck of it --- 3197,3202 ---- c = C() c.attr = 42 ! # The only interesting thing here is whether this blows up, due to flawed ! # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). del c del C.container[-1] # resurrect it again for the heck of it From tim_one@users.sourceforge.net Thu Jul 11 08:11:16 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 00:11:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.20,1.113.4.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2919/22/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: Repaired optimistic comment in new test. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.20 retrieving revision 1.113.4.21 diff -C2 -d -r1.113.4.20 -r1.113.4.21 *** test_descr.py 11 Jul 2002 07:06:42 -0000 1.113.4.20 --- test_descr.py 11 Jul 2002 07:11:13 -0000 1.113.4.21 *************** *** 2995,3001 **** c = C() c.attr = 42 ! # The only interesting thing here is whether this blows up in a ! # debug build, due to flawed GC tracking logic in typeobject.c's ! # call_finalizer() (a 2.2.1 bug). del c del C.container[-1] # resurrect it again for the heck of it --- 2995,3000 ---- c = C() c.attr = 42 ! # The only interesting thing here is whether this blows up, due to flawed ! # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). del c del C.container[-1] # resurrect it again for the heck of it From jhylton@users.sourceforge.net Thu Jul 11 16:43:39 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 08:43:39 -0700 Subject: [Python-checkins] python/dist/src/Parser acceler.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv6005 Modified Files: acceler.c Log Message: I trust the parser accelators are getting added :-). Index: acceler.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/acceler.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** acceler.c 1 Sep 2000 23:29:28 -0000 2.17 --- acceler.c 11 Jul 2002 15:43:37 -0000 2.18 *************** *** 26,39 **** dfa *d; int i; - #ifdef Py_DEBUG - fprintf(stderr, "Adding parser accelerators ...\n"); - #endif d = g->g_dfa; for (i = g->g_ndfas; --i >= 0; d++) fixdfa(g, d); g->g_accel = 1; - #ifdef Py_DEBUG - fprintf(stderr, "Done.\n"); - #endif } --- 26,33 ---- From jhylton@users.sourceforge.net Thu Jul 11 17:56:40 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 09:56:40 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.314,2.315 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30561 Modified Files: ceval.c Log Message: Don't stomp on an exception set by PyCell_Get() Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.314 retrieving revision 2.315 diff -C2 -d -r2.314 -r2.315 *** ceval.c 14 Jun 2002 13:53:29 -0000 2.314 --- ceval.c 11 Jul 2002 16:56:38 -0000 2.315 *************** *** 1735,1738 **** --- 1735,1742 ---- w = PyCell_Get(x); if (w == NULL) { + err = -1; + /* Don't stomp existing exception */ + if (PyErr_Occurred()) + break; if (oparg < f->f_ncells) { v = PyTuple_GetItem(co->co_cellvars, *************** *** 1751,1755 **** v); } - err = -1; break; } --- 1755,1758 ---- From jhylton@users.sourceforge.net Thu Jul 11 19:11:34 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:11:34 -0700 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.59,1.60 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv27935 Modified Files: pep-0042.txt Log Message: Add eval / free var feature request. Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** pep-0042.txt 10 Jun 2002 21:24:27 -0000 1.59 --- pep-0042.txt 11 Jul 2002 18:11:32 -0000 1.60 *************** *** 83,86 **** --- 83,90 ---- http://www.python.org/sf/481171 + - eval and free variables: It might be useful if there was a way + to pass bindings for free variables to eval when a code object + with free variables is passed. + http://www.python.org/sf/443866 Standard Library From tim_one@users.sourceforge.net Thu Jul 11 19:26:24 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:26:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.146,1.147 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv945/python/Lib/test Modified Files: test_descr.py Log Message: subtype_resurrection(): The test suite with -l properly reported the immortal object here as a leak. Made the object mortal again at the end. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** test_descr.py 11 Jul 2002 07:09:42 -0000 1.146 --- test_descr.py 11 Jul 2002 18:26:21 -0000 1.147 *************** *** 3185,3188 **** --- 3185,3189 ---- def subtype_resurrection(): + import gc if verbose: print "Testing resurrection of new-style instance..." *************** *** 3197,3205 **** c = C() c.attr = 42 ! # The only interesting thing here is whether this blows up, due to flawed # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). del c ! del C.container[-1] # resurrect it again for the heck of it vereq(C.container[-1].attr, 42) def do_this_first(): --- 3198,3216 ---- c = C() c.attr = 42 ! # The most interesting thing here is whether this blows up, due to flawed # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). del c ! ! # If that didn't blow up, it's also interesting to see whether clearing ! # the last container slot works: that will attempt to delete c again, ! # which will cause c to get appended back to the container again "during" ! # the del. ! del C.container[-1] ! vereq(len(C.container), 1) vereq(C.container[-1].attr, 42) + + # Make c mortal again, so that the test framework with -l doesn't report + # it as a leak. + del C.__del__ def do_this_first(): From tim_one@users.sourceforge.net Thu Jul 11 19:30:04 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:30:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.21,1.113.4.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2600/22/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: subtype_resurrection(): The test suite with -l properly reported the immortal object here as a leak. Made the object mortal again at the end. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.21 retrieving revision 1.113.4.22 diff -C2 -d -r1.113.4.21 -r1.113.4.22 *** test_descr.py 11 Jul 2002 07:11:13 -0000 1.113.4.21 --- test_descr.py 11 Jul 2002 18:30:02 -0000 1.113.4.22 *************** *** 2983,2986 **** --- 2983,2987 ---- def subtype_resurrection(): + import gc if verbose: print "Testing resurrection of new-style instance..." *************** *** 2995,3003 **** c = C() c.attr = 42 ! # The only interesting thing here is whether this blows up, due to flawed # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). del c ! del C.container[-1] # resurrect it again for the heck of it vereq(C.container[-1].attr, 42) def test_main(): --- 2996,3014 ---- c = C() c.attr = 42 ! # The most interesting thing here is whether this blows up, due to flawed # GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug). del c ! ! # If that didn't blow up, it's also interesting to see whether clearing ! # the last container slot works: that will attempt to delete c again, ! # which will cause c to get appended back to the container again "during" ! # the del. ! del C.container[-1] ! vereq(len(C.container), 1) vereq(C.container[-1].attr, 42) + + # Make c mortal again, so that the test framework with -l doesn't report + # it as a leak. + del C.__del__ def test_main(): From jhylton@users.sourceforge.net Thu Jul 11 19:30:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:30:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_new.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2891/Lib/test Modified Files: test_new.py Log Message: Extend function() to support an optional closure argument. Also, simplify some ref counting for other optional arguments. Index: test_new.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_new.py 9 Dec 2001 10:19:25 -0000 1.14 --- test_new.py 11 Jul 2002 18:30:27 -0000 1.15 *************** *** 72,75 **** --- 72,99 ---- 'Could not create a proper function object') + # test the various extended flavors of function.new + def f(x): + def g(y): + return x + y + return g + g = f(4) + new.function(f.func_code, {}, "blah") + g2 = new.function(g.func_code, {}, "blah", (2,), g.func_closure) + verify(g2() == 6) + g3 = new.function(g.func_code, {}, "blah", None, g.func_closure) + verify(g3(5) == 9) + def test_closure(func, closure, exc): + try: + new.function(func.func_code, {}, "", None, closure) + except exc: + pass + else: + print "corrupt closure accepted" + + test_closure(g, None, TypeError) # invalid closure + test_closure(g, (1,), TypeError) # non-cell in closure + test_closure(g, (1, 1), ValueError) # closure is wrong size + test_closure(f, g.func_closure, ValueError) # no closure needed + print 'new.code()' # bogus test of new.code() From jhylton@users.sourceforge.net Thu Jul 11 19:30:30 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:30:30 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2891/Objects Modified Files: funcobject.c Log Message: Extend function() to support an optional closure argument. Also, simplify some ref counting for other optional arguments. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** funcobject.c 14 Jun 2002 20:41:15 -0000 2.55 --- funcobject.c 11 Jul 2002 18:30:27 -0000 2.56 *************** *** 268,291 **** PyDoc_STRVAR(func_doc, ! "function(code, globals[, name[, argdefs]])\n\ \n\ Create a function object from a code object and a dictionary.\n\ The optional name string overrides the name from the code object.\n\ ! The optional argdefs tuple specifies the default argument values."); static PyObject * func_new(PyTypeObject* type, PyObject* args, PyObject* kw) { ! PyObject *code; PyObject *globals; PyObject *name = Py_None; PyObject *defaults = Py_None; PyFunctionObject *newfunc; ! if (!PyArg_ParseTuple(args, "O!O!|OO!:function", &PyCode_Type, &code, &PyDict_Type, &globals, ! &name, ! &PyTuple_Type, &defaults)) return NULL; if (name != Py_None && !PyString_Check(name)) { --- 268,303 ---- PyDoc_STRVAR(func_doc, ! "function(code, globals[, name[, argdefs[, closure]]])\n\ \n\ Create a function object from a code object and a dictionary.\n\ The optional name string overrides the name from the code object.\n\ ! The optional argdefs tuple specifies the default argument values.\n\ ! The optional closure tuple supplies the bindings for free variables."); ! ! /* func_new() maintains the following invariants for closures. The ! closure must correspond to the free variables of the code object. ! ! if len(code.co_freevars) == 0: ! closure = NULL ! else: ! len(closure) == len(code.co_freevars) ! for every elt in closure, type(elt) == cell ! */ static PyObject * func_new(PyTypeObject* type, PyObject* args, PyObject* kw) { ! PyCodeObject *code; PyObject *globals; PyObject *name = Py_None; PyObject *defaults = Py_None; + PyObject *closure = Py_None; PyFunctionObject *newfunc; + int nfree, nclosure; ! if (!PyArg_ParseTuple(args, "O!O!|OOO:function", &PyCode_Type, &code, &PyDict_Type, &globals, ! &name, &defaults, &closure)) return NULL; if (name != Py_None && !PyString_Check(name)) { *************** *** 294,311 **** return NULL; } ! newfunc = (PyFunctionObject *)PyFunction_New(code, globals); if (newfunc == NULL) return NULL; ! if (name != Py_None) { ! Py_XINCREF(name); ! Py_XDECREF(newfunc->func_name); newfunc->func_name = name; } if (defaults != Py_None) { ! Py_XINCREF(defaults); ! Py_XDECREF(newfunc->func_defaults); newfunc->func_defaults = defaults; } --- 306,364 ---- return NULL; } + if (defaults != Py_None && !PyTuple_Check(defaults)) { + PyErr_SetString(PyExc_TypeError, + "arg 4 (defaults) must be None or tuple"); + return NULL; + } + nfree = PyTuple_GET_SIZE(code->co_freevars); + if (!PyTuple_Check(closure)) { + if (nfree && closure == Py_None) { + PyErr_SetString(PyExc_TypeError, + "arg 5 (closure) must be tuple"); + return NULL; + } + else if (closure != Py_None) { + PyErr_SetString(PyExc_TypeError, + "arg 5 (closure) must be None or tuple"); + return NULL; + } + } ! /* check that the closure is well-formed */ ! nclosure = closure == Py_None ? 0 : PyTuple_GET_SIZE(closure); ! if (nfree != nclosure) ! return PyErr_Format(PyExc_ValueError, ! "%s requires closure of length %d, not %d", ! PyString_AS_STRING(code->co_name), ! nfree, nclosure); ! if (nclosure) { ! int i; ! for (i = 0; i < nclosure; i++) { ! PyObject *o = PyTuple_GET_ITEM(closure, i); ! if (!PyCell_Check(o)) { ! return PyErr_Format(PyExc_TypeError, ! "arg 5 (closure) expected cell, found %s", ! o->ob_type->tp_name); ! } ! } ! } ! ! newfunc = (PyFunctionObject *)PyFunction_New((PyObject *)code, ! globals); if (newfunc == NULL) return NULL; ! if (name != Py_None) { ! Py_INCREF(name); ! Py_DECREF(newfunc->func_name); newfunc->func_name = name; } if (defaults != Py_None) { ! Py_INCREF(defaults); newfunc->func_defaults = defaults; + } + if (closure != Py_None) { + Py_INCREF(closure); + newfunc->func_closure = closure; } From tim_one@users.sourceforge.net Thu Jul 11 19:39:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:39:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.147,1.148 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6162/python/Lib/test Modified Files: test_descr.py Log Message: subtype_resurrection(): Removed unused import. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -d -r1.147 -r1.148 *** test_descr.py 11 Jul 2002 18:26:21 -0000 1.147 --- test_descr.py 11 Jul 2002 18:39:56 -0000 1.148 *************** *** 3185,3189 **** def subtype_resurrection(): - import gc if verbose: print "Testing resurrection of new-style instance..." --- 3185,3188 ---- From tim_one@users.sourceforge.net Thu Jul 11 19:40:14 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:40:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.22,1.113.4.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6374/22/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: subtype_resurrection(): Removed unused import. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.22 retrieving revision 1.113.4.23 diff -C2 -d -r1.113.4.22 -r1.113.4.23 *** test_descr.py 11 Jul 2002 18:30:02 -0000 1.113.4.22 --- test_descr.py 11 Jul 2002 18:40:12 -0000 1.113.4.23 *************** *** 2983,2987 **** def subtype_resurrection(): - import gc if verbose: print "Testing resurrection of new-style instance..." --- 2983,2986 ---- From bwarsaw@users.sourceforge.net Thu Jul 11 19:48:42 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 11 Jul 2002 11:48:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv9561 Modified Files: Generator.py Log Message: _dispatch(): Comment improvements. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Generator.py 9 Jul 2002 02:43:47 -0000 1.11 --- Generator.py 11 Jul 2002 18:48:40 -0000 1.12 *************** *** 121,127 **** def _dispatch(self, msg): # Get the Content-Type: for the message, then try to dispatch to ! # self._handle_maintype_subtype(). If there's no handler for the full ! # MIME type, then dispatch to self._handle_maintype(). If that's ! # missing too, then dispatch to self._writeBody(). ctype = msg.get_type() if ctype is None: --- 121,127 ---- def _dispatch(self, msg): # Get the Content-Type: for the message, then try to dispatch to ! # self._handle__(). If there's no handler for the ! # full MIME type, then dispatch to self._handle_(). If ! # that's missing too, then dispatch to self._writeBody(). ctype = msg.get_type() if ctype is None: From tim_one@users.sourceforge.net Thu Jul 11 20:07:47 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 12:07:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14525/python/Lib/test Modified Files: test_gc.py Log Message: test_trashcan() and supporting class Ouch(): Jeremy noted that this test takes much longer to run in the context of the test suite than when run in isolation. That's because it forces a large number of full collections, which take time proportional to the total number of gc'ed objects in the whole system. But since the dangerous implementation trickery that caused this test to fail in 2.0, 2.1 and 2.2 doesn't exist in 2.3 anymore (the trashcan mechanism stopped doing evil things when the possibility for compiling without cyclic gc was taken away), such an expensive test is no longer justified. This checkin leaves the test intact, but fiddles the constants to reduce the runtime by about a factor of 5. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_gc.py 13 Jun 2002 11:53:12 -0000 1.16 --- test_gc.py 11 Jul 2002 19:07:45 -0000 1.17 *************** *** 182,186 **** def __del__(self): Ouch.n = Ouch.n + 1 ! if Ouch.n % 7 == 0: gc.collect() --- 182,186 ---- def __del__(self): Ouch.n = Ouch.n + 1 ! if Ouch.n % 17 == 0: gc.collect() *************** *** 193,199 **** # most likely die via segfault. gc.enable() ! N = 200 ! for count in range(3): t = [] for i in range(N): --- 193,205 ---- # most likely die via segfault. + # Note: In 2.3 the possibility for compiling without cyclic gc was + # removed, and that in turn allows the trashcan mechanism to work + # via much simpler means (e.g., it never abuses the type pointer or + # refcount fields anymore). Since it's much less likely to cause a + # problem now, the various constants in this expensive (we force a lot + # of full collections) test are cut back from the 2.2 version. gc.enable() ! N = 150 ! for count in range(2): t = [] for i in range(N): From jhylton@users.sourceforge.net Thu Jul 11 20:26:33 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 12:26:33 -0700 Subject: [Python-checkins] python/dist/src/Demo/newmetaclasses - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Demo/newmetaclasses In directory usw-pr-cvs1:/tmp/cvs-serv23180/newmetaclasses Log Message: Directory /cvsroot/python/python/dist/src/Demo/newmetaclasses added to the repository From akuchling@users.sourceforge.net Thu Jul 11 20:27:49 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 11 Jul 2002 12:27:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv23523 Modified Files: whatsnew23.tex Log Message: [Bug #567607] Suggest METH_NOARGS to replace PyArg_NoArgs Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** whatsnew23.tex 3 Jul 2002 12:02:01 -0000 1.31 --- whatsnew23.tex 11 Jul 2002 19:27:46 -0000 1.32 *************** *** 654,660 **** \item The \cfunction{PyArg_NoArgs()} macro is now deprecated, and code ! that ! uses it should be changed to use \code{PyArg_ParseTuple(args, "")} ! instead. \item A new function, \cfunction{PyObject_DelItemString(\var{mapping}, --- 654,664 ---- \item The \cfunction{PyArg_NoArgs()} macro is now deprecated, and code ! that uses it should be changed. For Python 2.2 and later, the method ! definition table can specify the ! \constant{METH_NOARGS} flag, signalling that there are no arguments, and ! the argument checking can then be removed. If compatibility with ! pre-2.2 versions of Python is important, the code could use ! \code{PyArg_ParseTuple(args, "")} instead, but this will be slower ! than using \constant{METH_NOARGS}. \item A new function, \cfunction{PyObject_DelItemString(\var{mapping}, *************** *** 722,727 **** suggestions, corrections and assistance with various drafts of this article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., ! Michael Hudson, Detlef Lannert, Andrew MacIntyre, Gustavo Niemeyer, ! Neal Norwitz. \end{document} --- 726,731 ---- suggestions, corrections and assistance with various drafts of this article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., ! Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, ! Gustavo Niemeyer, Neal Norwitz. \end{document} From akuchling@users.sourceforge.net Thu Jul 11 21:09:53 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 11 Jul 2002 13:09:53 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv3048 Modified Files: whatsnew23.tex Log Message: Add some items Expand the "Other Language Changes" section Rewrite various passages. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** whatsnew23.tex 11 Jul 2002 19:27:46 -0000 1.32 --- whatsnew23.tex 11 Jul 2002 20:09:50 -0000 1.33 *************** *** 23,30 **** % Optik (or whatever it gets called) % - % getopt.gnu_getopt - % - % Docstrings now optional (with --without-doc-strings) - % % New dependency argument to distutils.Extension % --- 23,26 ---- *************** *** 234,238 **** %====================================================================== ! \section{PEP 279: The \function{enumerate()} Built-in Function} A new built-in function, \function{enumerate()}, will make --- 230,234 ---- %====================================================================== ! \section{PEP 279: The \function{enumerate()} Built-in Function\label{section-enumerate}} A new built-in function, \function{enumerate()}, will make *************** *** 341,353 **** \end{seealso} - \section{Extended Slices\label{extended-slices}} ! Ever since Python 1.4 the slice syntax has supported a third ! ``stride'' argument, but the built-in sequence types have not ! supported this feature (it was initially included at the behest of the ! developers of the Numerical Python package). Starting with Python ! 2.3, the built-in sequence types do support the stride. ! For example, to extract the elements of a list with even indexes: \begin{verbatim} --- 337,355 ---- \end{seealso} ! \section{Extended Slices\label{section-slices}} ! Ever since Python 1.4, the slicing syntax has supported an optional ! third ``step'' or ``stride'' argument. For example, these are all ! legal Python syntax: \code{L[1:10:2]}, \code{L[:-1:1]}, ! \code{L[::-1]}. This was added to Python included at the request of ! the developers of Numerical Python. However, the built-in sequence ! types of lists, tuples, and strings have never supported this feature, ! and you got a \exception{TypeError} if you tried it. Michael Hudson ! contributed a patch that was applied to Python 2.3 and fixed this ! shortcoming. ! ! For example, you can now easily extract the elements of a list that ! have even indexes: \begin{verbatim} *************** *** 357,361 **** \end{verbatim} ! To make a copy of the same list in reverse order: \begin{verbatim} --- 359,364 ---- \end{verbatim} ! Negative values also work, so you can make a copy of the same list in ! reverse order: \begin{verbatim} *************** *** 364,392 **** \end{verbatim} %====================================================================== \section{Other Language Changes} ! %Here are the changes that Python 2.3 makes to the core language. ! %\begin{itemize} ! %\item The \keyword{yield} statement is now always a keyword, as ! %described in section~\ref{section-generators}. ! %\item Two new constants, \constant{True} and \constant{False} were ! %added along with the built-in \class{bool} type, as described in ! %section~\ref{section-bool}. ! %\item ! %\end{itemize} ! %\begin{PendingDeprecationWarning} A new warning, \exception{PendingDeprecationWarning} was added to provide direction on features which are in the process of being ! deprecated. The warning will not be printed by default. To see the ! pending deprecations, use ! \programopt{-Walways::PendingDeprecationWarning::} on the command line ! or use \function{warnings.filterwarnings()}. ! %\end{PendingDeprecationWarning} --- 367,493 ---- \end{verbatim} + This also works for strings: + + \begin{verbatim} + >>> s='abcd' + >>> s[::2] + 'ac' + >>> s[::-1] + 'dcba' + \end{verbatim} + + + %====================================================================== \section{Other Language Changes} ! Here are all of the changes that Python 2.3 makes to the core Python ! language. ! \begin{itemize} ! \item The \keyword{yield} statement is now always a keyword, as ! described in section~\ref{section-generators} of this document. ! \item A new built-in function \function{enumerate()} ! was added, as described in section~\ref{section-enumerate} of this ! document. ! \item Two new constants, \constant{True} and \constant{False} were ! added along with the built-in \class{bool} type, as described in ! section~\ref{section-bool} of this document. + \item Built-in types now support the extended slicing syntax, + as described in section~\ref{section-slices} of this document. ! \item Dictionaries have a new method, \method{pop(\var{key})}, that ! returns the value corresponding to \var{key} and removes that ! key/value pair from the dictionary. \method{pop()} will raise a ! \exception{KeyError} if the requested key isn't present in the ! dictionary: ! ! \begin{verbatim} ! >>> d = {1:2} ! >>> d ! {1: 2} ! >>> d.pop(4) ! Traceback (most recent call last): ! File ``stdin'', line 1, in ? ! KeyError: 4 ! >>> d.pop(1) ! 2 ! >>> d.pop(1) ! Traceback (most recent call last): ! File ``stdin'', line 1, in ? ! KeyError: pop(): dictionary is empty ! >>> d ! {} ! >>> ! \end{verbatim} ! ! (Patch contributed by Raymond Hettinger.) ! ! \item The \method{strip()}, \method{lstrip()}, and \method{rstrip()} ! string methods now have an optional argument for specifying the ! characters to strip. The default is still to remove all whitespace ! characters: ! ! \begin{verbatim} ! >>> ' abc '.strip() ! 'abc' ! >>> '><><><>'.strip('<>') ! 'abc' ! >>> '><><><>\n'.strip('<>') ! 'abc<><><>\n' ! >>> u'\u4000\u4001abc\u4000'.strip(u'\u4000') ! u'\u4001abc' ! >>> ! \end{verbatim} ! ! \item The \method{startswith()} and \method{endswith()} ! string methods now accept negative numbers for the start and end ! parameters. ! ! \item Another new string method is \method{zfill()}, originally a ! function in the \module{string} module. \method{zfill()} pads a ! numeric string with zeros on the left until it's the specified width. ! Note that the \code{\%} operator is still more flexible and powerful ! than \method{zfill()}. ! ! \begin{verbatim} ! >>> '45'.zfill(4) ! '0045' ! >>> '12345'.zfill(4) ! '12345' ! >>> 'goofy'.zfill(6) ! '0goofy' ! \end{verbatim} ! ! \item A new warning, \exception{PendingDeprecationWarning} was added to provide direction on features which are in the process of being ! deprecated. The warning will \emph{not} be printed by default. To ! check for use of features that will be deprecated in the future, ! supply \programopt{-Walways::PendingDeprecationWarning::} on the ! command line or use \function{warnings.filterwarnings()}. ! ! \item One minor but far-reaching change is that the names of extension ! types defined by the modules included with Python now contain the ! module and a \samp{.} in front of the type name. For example, in ! Python 2.2, if you created a socket and printed its ! \member{__class__}, you'd get this output: ! ! \begin{verbatim} ! >>> s = socket.socket() ! >>> s.__class__ ! ! \end{verbatim} ! ! In 2.3, you get this: ! \begin{verbatim} ! >>> s.__class__ ! ! \end{verbatim} ! ! \end{itemize} *************** *** 458,464 **** distributed with the source to Python 2.3 that allows Python extensions to use the 2.3 interfaces to memory allocation and compile ! against any version of Python since 1.5.2. (The idea is that you take ! the file from Python's source distribution and bundle it with the ! source of your extension). \begin{seealso} --- 559,565 ---- distributed with the source to Python 2.3 that allows Python extensions to use the 2.3 interfaces to memory allocation and compile ! against any version of Python since 1.5.2. You would copy the file ! from Python's source distribution and bundle it with the source of ! your extension. \begin{seealso} *************** *** 472,475 **** --- 573,577 ---- \end{seealso} + %====================================================================== \section{New and Improved Modules} *************** *** 516,600 **** (Contributed by Greg Ward.) - \item One minor but far-reaching change is that the names of extension - types defined by the modules included with Python now contain the - module and a \samp{.} in front of the type name. For example, in - Python 2.2, if you created a socket and printed its - \member{__class__}, you'd get this output: - - \begin{verbatim} - >>> s = socket.socket() - >>> s.__class__ - - \end{verbatim} - - In 2.3, you get this: - \begin{verbatim} - >>> s.__class__ - - \end{verbatim} - - \item The \method{strip()}, \method{lstrip()}, and \method{rstrip()} - string methods now have an optional argument for specifying the - characters to strip. The default is still to remove all whitespace - characters: - - \begin{verbatim} - >>> ' abc '.strip() - 'abc' - >>> '><><><>'.strip('<>') - 'abc' - >>> '><><><>\n'.strip('<>') - 'abc<><><>\n' - >>> u'\u4000\u4001abc\u4000'.strip(u'\u4000') - u'\u4001abc' - >>> - \end{verbatim} - - \item The \method{startswith()} and \method{endswith()} - string methods now have accept negative numbers for - start and end parameters. - - \item Another new string method is \method{zfill()}, originally a - function in the \module{string} module. \method{zfill()} pads a - numeric string with zeros on the left until it's the specified width. - Note that the \code{\%} operator is still more flexible and powerful - than \method{zfill()}. - - \begin{verbatim} - >>> '45'.zfill(4) - '0045' - >>> '12345'.zfill(4) - '12345' - >>> 'goofy'.zfill(6) - '0goofy' - \end{verbatim} - - \item Dictionaries have a new method, \method{pop(\var{key})}, that - returns the value corresponding to \var{key} and removes that - key/value pair from the dictionary. \method{pop()} will raise a - \exception{KeyError} if the requsted key isn't present in the - dictionary: - - \begin{verbatim} - >>> d = {1:2} - >>> d - {1: 2} - >>> d.pop(4) - Traceback (most recent call last): - File ``stdin'', line 1, in ? - KeyError: 4 - >>> d.pop(1) - 2 - >>> d.pop(1) - Traceback (most recent call last): - File ``stdin'', line 1, in ? - KeyError: pop(): dictionary is empty - >>> d - {} - >>> - \end{verbatim} - - (Contributed by Raymond Hettinger.) - \item Two new functions in the \module{math} module, \function{degrees(\var{rads})} and \function{radians(\var{degs})}, --- 618,621 ---- *************** *** 606,610 **** \item Three new functions, \function{getpgid()}, \function{killpg()}, and \function{mknod()}, were added to the \module{posix} module that ! underlies the \module{os} module. \item Two new binary packagers were added to the Distutils. --- 627,649 ---- \item Three new functions, \function{getpgid()}, \function{killpg()}, and \function{mknod()}, were added to the \module{posix} module that ! underlies the \module{os} module. (Contributed by Gustavo Niemeyer ! and Geert Jansen.) ! ! \item The \module{getopt} module gained a new function, ! \function{gnu_getopt()}, that supports the same arguments as the existing ! \function{getopt()} function but uses GNU-style scanning mode. ! The existing \function{getopt()} stops processing options as soon as a ! non-option argument is encountered, but in GNU-style mode processing ! continues, meaning that options and arguments can be mixed. For ! example: ! ! \begin{verbatim} ! >>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v') ! ([('-f', 'filename')], ['output', '-v']) ! >>> getopt.gnu_getopt(['-f', 'filename', 'output', '-v'], 'f:v') ! ([('-f', 'filename'), ('-v', '')], ['output']) ! \end{verbatim} ! ! (Contributed by Peter \AA{strand}.) \item Two new binary packagers were added to the Distutils. *************** *** 652,655 **** --- 691,701 ---- when running Python's \file{configure} script. (Contributed by Ondrej Palkovsky.) + + \item The interpreter can be compiled without any docstrings for + the built-in functions and modules by supplying + \longprogramopt{--without-doc-strings} to the \file{configure} script. + This makes the Python executable about 10\% smaller, but will also + mean that you can't get help for Python's built-ins. (Contributed by + Gustavo Niemeyer.) \item The \cfunction{PyArg_NoArgs()} macro is now deprecated, and code From jhylton@users.sourceforge.net Thu Jul 11 21:22:13 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 13:22:13 -0700 Subject: [Python-checkins] python/dist/src/Demo/metaclasses Eiffel.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/metaclasses In directory usw-pr-cvs1:/tmp/cvs-serv7459 Modified Files: Eiffel.py Log Message: Repair example code in doc string. Bug fix candiadte. Index: Eiffel.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/metaclasses/Eiffel.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Eiffel.py 14 Sep 1998 16:44:13 -0000 1.3 --- Eiffel.py 11 Jul 2002 20:22:11 -0000 1.4 *************** *** 29,33 **** class D(C): def m1(self, arg): ! return whatever**2 def m1_post(self, Result, arg): C.m1_post(self, Result, arg) --- 29,33 ---- class D(C): def m1(self, arg): ! return arg**2 def m1_post(self, Result, arg): C.m1_post(self, Result, arg) From bwarsaw@users.sourceforge.net Thu Jul 11 21:24:38 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 11 Jul 2002 13:24:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv8212 Modified Files: Iterators.py Log Message: _structure(): Don't get the whole Content-Type: header, just get the type with get_type(). Index: Iterators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Iterators.py 9 Jul 2002 02:39:07 -0000 1.8 --- Iterators.py 11 Jul 2002 20:24:36 -0000 1.9 *************** *** 16,20 **** """A handy debugging aid""" tab = ' ' * (level * 4) ! print tab + msg.get('content-type', msg.get_default_type()) if msg.is_multipart(): for subpart in msg.get_payload(): --- 16,20 ---- """A handy debugging aid""" tab = ' ' * (level * 4) ! print tab + msg.get_type(msg.get_default_type()) if msg.is_multipart(): for subpart in msg.get_payload(): From akuchling@users.sourceforge.net Thu Jul 11 21:50:37 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 11 Jul 2002 13:50:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv15804 Modified Files: whatsnew23.tex Log Message: Make another pass through Misc/NEWS and add stuff. Bump version number. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** whatsnew23.tex 11 Jul 2002 20:09:50 -0000 1.33 --- whatsnew23.tex 11 Jul 2002 20:50:34 -0000 1.34 *************** *** 6,10 **** \title{What's New in Python 2.3} ! \release{0.02} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} --- 6,10 ---- \title{What's New in Python 2.3} ! \release{0.03} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} *************** *** 14,37 **** \tableofcontents - % Types now callable; `new' module replaced - % - % Timeout sockets: - % Executive summary: after sock.settimeout(T), all methods of sock will - % block for at most T floating seconds and fail if they can't complete - % within that time. sock.settimeout(None) restores full blocking mode. - % % Optik (or whatever it gets called) % % New dependency argument to distutils.Extension % %\section{Introduction \label{intro}} {\large This article is a draft, and is currently up to date for some ! random version of the CVS tree around May 26 2002. Please send any additions, comments or errata to the author.} This article explains the new features in Python 2.3. The tentative ! release date of Python 2.3 is currently scheduled for August 30 2002. This article doesn't attempt to provide a complete specification of --- 14,34 ---- \tableofcontents % Optik (or whatever it gets called) % % New dependency argument to distutils.Extension % + % The assert statement no longer tests __debug__ at runtime. + % + % %\section{Introduction \label{intro}} {\large This article is a draft, and is currently up to date for some ! random version of the CVS tree around mid-July 2002. Please send any additions, comments or errata to the author.} This article explains the new features in Python 2.3. The tentative ! release date of Python 2.3 is currently scheduled for some undefined ! time before the end of 2002. This article doesn't attempt to provide a complete specification of *************** *** 463,469 **** \end{verbatim} \item A new warning, \exception{PendingDeprecationWarning} was added to ! provide direction on features which are in the process of being deprecated. The warning will \emph{not} be printed by default. To check for use of features that will be deprecated in the future, --- 460,489 ---- \end{verbatim} + \item A new type object, \class{basestring}, has been added. + Both 8-bit strings and Unicode strings inherit from this type, so + \code{isinstance(obj, basestring)} will return \constant{True} for + either kind of string. It's a completely abstract type, so you + can't create \class{basestring} instances. + + \item Most type objects are now callable, so you can use them + to create new objects such as functions, classes, and modules. (This + means that the \module{new} module can be deprecated in a future + Python version, because you can now use the type objects available + in the \module{types} module.) + % XXX should new.py use PendingDeprecationWarning? + For example, you can create a new module object with the following code: + + \begin{verbatim} + >>> import types + >>> m = types.ModuleType('abc','docstring') + >>> m + + >>> m.__doc__ + 'docstring' + \end{verbatim} + \item A new warning, \exception{PendingDeprecationWarning} was added to ! indicate features which are in the process of being deprecated. The warning will \emph{not} be printed by default. To check for use of features that will be deprecated in the future, *************** *** 583,587 **** \begin{itemize} ! \item The \module{textwrap} module contains functions for wrapping strings containing paragraphs of text. The \function{wrap(\var{text}, \var{width})} function takes a string and returns a list containing --- 603,607 ---- \begin{itemize} ! \item The new \module{textwrap} module contains functions for wrapping strings containing paragraphs of text. The \function{wrap(\var{text}, \var{width})} function takes a string and returns a list containing *************** *** 630,633 **** --- 650,665 ---- and Geert Jansen.) + \item The \module{socket} module now supports timeouts. You + can call the \method{settimeout(\var{t})} method on a socket object to + set a timeout of \var{t} seconds. Subsequent socket operations that + take longer than \var{t} seconds to complete will abort and raise a + \exception{socket.error} exception. + + (The original timeout implementation was by Tim O'Malley. Michael + Gilfix integrated it into the Python \module{socket} module, after the + patch had undergone a lengthy review. After it was checked in, Guido + van~Rossum rewrote parts of it. This is a good example of the free + software development process.) + \item The \module{getopt} module gained a new function, \function{gnu_getopt()}, that supports the same arguments as the existing *************** *** 650,654 **** \code{bdist_pkgtool} builds \file{.pkg} files to use with Solaris \program{pkgtool}, and \code{bdist_sdux} builds \program{swinstall} ! packages for use on HP-UX. (Contributed by Mark Alexander.) \item The \module{array} module now supports arrays of Unicode --- 682,690 ---- \code{bdist_pkgtool} builds \file{.pkg} files to use with Solaris \program{pkgtool}, and \code{bdist_sdux} builds \program{swinstall} ! packages for use on HP-UX. ! An abstract binary packager class, ! \module{distutils.command.bdist_packager}, was added; this may make it ! easier to write binary packaging commands. (Contributed by Mark ! Alexander.) \item The \module{array} module now supports arrays of Unicode *************** *** 658,662 **** (Contributed by Jason Orendorff.) ! \item The \module{grp} module now returns enhanced tuples: \begin{verbatim} --- 694,699 ---- (Contributed by Jason Orendorff.) ! \item The \module{grp}, \module{pwd}, and \module{resource} modules ! now return enhanced tuples: \begin{verbatim} *************** *** 677,680 **** --- 714,722 ---- unavoidable race conditions. + \item The DOM implementation + in \module{xml.dom.minidom} can now generate XML output in a + particular encoding, by specifying an optional encoding argument to + the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. + \end{itemize} *************** *** 694,702 **** \item The interpreter can be compiled without any docstrings for the built-in functions and modules by supplying ! \longprogramopt{--without-doc-strings} to the \file{configure} script. This makes the Python executable about 10\% smaller, but will also mean that you can't get help for Python's built-ins. (Contributed by Gustavo Niemeyer.) \item The \cfunction{PyArg_NoArgs()} macro is now deprecated, and code that uses it should be changed. For Python 2.2 and later, the method --- 736,749 ---- \item The interpreter can be compiled without any docstrings for the built-in functions and modules by supplying ! \longprogramopt{without-doc-strings} to the \file{configure} script. This makes the Python executable about 10\% smaller, but will also mean that you can't get help for Python's built-ins. (Contributed by Gustavo Niemeyer.) + \item The cycle detection implementation used by the garbage collection + has proven to be stable, so it's now being made mandatory; you can no + longer compile Python without it, and the + \longprogramopt{with-cycle-gc} switch to \file{configure} has been removed. + \item The \cfunction{PyArg_NoArgs()} macro is now deprecated, and code that uses it should be changed. For Python 2.2 and later, the method *************** *** 751,754 **** --- 798,803 ---- Python source distribution, were updated for 2.3. (Contributed by Sean Reifschneider.) + + Python now supports AtheOS (\url{www.atheos.cx}) and GNU/Hurd. From jhylton@users.sourceforge.net Thu Jul 11 22:08:08 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 14:08:08 -0700 Subject: [Python-checkins] python/dist/src/Demo/newmetaclasses Eiffel.py,NONE,1.1 Enum.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/newmetaclasses In directory usw-pr-cvs1:/tmp/cvs-serv21592 Added Files: Eiffel.py Enum.py Log Message: Add Enum and Eiffel examples using new-style classes. --- NEW FILE: Eiffel.py --- """Support Eiffel-style preconditions and postconditions.""" from new import function class EiffelBaseMetaClass(type): def convert_methods(cls, dict): """Replace functions in dict with EiffelMethod wrappers. The dict is modified in place. If a method ends in _pre or _post, it is removed from the dict regardless of whether there is a corresponding method. """ # find methods with pre or post conditions methods = [] prenpost = [] for k, v in dict.iteritems(): if k.endswith('_pre') or k.endswith('_post'): assert isinstance(v, function) prenpost.append(k) elif isinstance(v, function): methods.append(k) for m in methods: pre = dict.get("%s_pre" % m) post = dict.get("%s_post" % m) if pre or post: dict[k] = cls.make_eiffel_method(dict[m], pre, post) convert_methods = classmethod(convert_methods) def make_eiffel_method(func, pre, post): def method(self, *args, **kwargs): if pre: pre(self, *args, **kwargs) x = func(self, *args, **kwargs) if post: post(self, x, *args, **kwargs) return x if func.__doc__: method.__doc__ = func.__doc__ return method make_eiffel_method = staticmethod(make_eiffel_method) class EiffelMetaClass1(EiffelBaseMetaClass): # an implementation of the "eiffel" meta class that uses nested functions def __new__(meta, name, bases, dict): meta.convert_methods(dict) return super(EiffelMetaClass1, meta).__new__(meta, name, bases, dict) class EiffelMethodWrapper: def __init__(self, inst, descr): self._inst = inst self._descr = descr def __call__(self, *args, **kwargs): return self._descr.callmethod(self._inst, args, kwargs) class EiffelDescriptor(object): def __init__(self, func, pre, post): self._func = func self._pre = pre self._post = post self.__name__ = func.__name__ self.__doc__ = func.__doc__ def __get__(self, obj, cls): return EiffelMethodWrapper(obj, self) def callmethod(self, inst, args, kwargs): if self._pre: self._pre(inst, *args, **kwargs) x = self._func(inst, *args, **kwargs) if self._post: self._post(inst, x, *args, **kwargs) return x class EiffelMetaClass2(EiffelMetaClass1): # an implementation of the "eiffel" meta class that uses descriptors make_eiffel_method = EiffelDescriptor def _test(metaclass): class Eiffel: __metaclass__ = metaclass class Test(Eiffel): def m(self, arg): """Make it a little larger""" return arg + 1 def m2(self, arg): """Make it a little larger""" return arg + 1 def m2_pre(self, arg): assert arg > 0 def m2_post(self, result, arg): assert result > arg class Sub(Test): def m2(self, arg): return arg**2 def m2_post(self, Result, arg): super(Sub, self).m2_post(Result, arg) assert Result < 100 t = Test() t.m(1) t.m2(1) try: t.m2(0) except AssertionError: pass else: assert False s = Sub() try: s.m2(1) except AssertionError: pass # result == arg else: assert False try: s.m2(10) except AssertionError: pass # result == 100 else: assert False if __name__ == "__main__": _test(EiffelMetaClass1) _test(EiffelMetaClass2) --- NEW FILE: Enum.py --- """Enumeration metaclass.""" class EnumMetaclass(type): """Metaclass for enumeration. To define your own enumeration, do something like class Color(Enum): red = 1 green = 2 blue = 3 Now, Color.red, Color.green and Color.blue behave totally different: they are enumerated values, not integers. Enumerations cannot be instantiated; however they can be subclassed. """ def __init__(cls, name, bases, dict): super(EnumMetaclass, cls).__init__(name, bases, dict) cls._members = [] for attr in dict.keys(): if not (attr.startswith('__') and attr.endswith('__')): enumval = EnumInstance(name, attr, dict[attr]) setattr(cls, attr, enumval) cls._members.append(attr) def __getattr__(cls, name): if name == "__members__": return cls._members raise AttributeError, name def __repr__(cls): s1 = s2 = "" enumbases = [base.__name__ for base in cls.__bases__ if isinstance(base, EnumMetaclass) and not base is Enum] if enumbases: s1 = "(%s)" % ", ".join(enumbases) enumvalues = ["%s: %d" % (val, getattr(cls, val)) for val in cls._members] if enumvalues: s2 = ": {%s}" % ", ".join(enumvalues) return "%s%s%s" % (cls.__name__, s1, s2) class FullEnumMetaclass(EnumMetaclass): """Metaclass for full enumerations. A full enumeration displays all the values defined in base classes. """ def __init__(cls, name, bases, dict): super(FullEnumMetaclass, cls).__init__(name, bases, dict) for obj in cls.__mro__: if isinstance(obj, EnumMetaclass): for attr in obj._members: # XXX inefficient if not attr in cls._members: cls._members.append(attr) class EnumInstance(int): """Class to represent an enumeration value. EnumInstance('Color', 'red', 12) prints as 'Color.red' and behaves like the integer 12 when compared, but doesn't support arithmetic. XXX Should it record the actual enumeration rather than just its name? """ def __new__(cls, classname, enumname, value): return int.__new__(cls, value) def __init__(self, classname, enumname, value): self.__classname = classname self.__enumname = enumname def __repr__(self): return "EnumInstance(%s, %s, %d)" % (self.__classname, self.__enumname, self) def __str__(self): return "%s.%s" % (self.__classname, self.__enumname) class Enum: __metaclass__ = EnumMetaclass class FullEnum: __metaclass__ = FullEnumMetaclass def _test(): class Color(Enum): red = 1 green = 2 blue = 3 print Color.red print `Color.red` print Color.red == Color.red print Color.red == Color.blue print Color.red == 1 print Color.red == 2 class ExtendedColor(Color): white = 0 orange = 4 yellow = 5 purple = 6 black = 7 print ExtendedColor.orange print ExtendedColor.red print Color.red == ExtendedColor.red class OtherColor(Enum): white = 4 blue = 5 class MergedColor(Color, OtherColor): pass print MergedColor.red print MergedColor.white print Color print ExtendedColor print OtherColor print MergedColor def _test2(): class Color(FullEnum): red = 1 green = 2 blue = 3 print Color.red print `Color.red` print Color.red == Color.red print Color.red == Color.blue print Color.red == 1 print Color.red == 2 class ExtendedColor(Color): white = 0 orange = 4 yellow = 5 purple = 6 black = 7 print ExtendedColor.orange print ExtendedColor.red print Color.red == ExtendedColor.red class OtherColor(FullEnum): white = 4 blue = 5 class MergedColor(Color, OtherColor): pass print MergedColor.red print MergedColor.white print Color print ExtendedColor print OtherColor print MergedColor if __name__ == '__main__': _test() _test2() From jhylton@users.sourceforge.net Thu Jul 11 22:09:36 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 14:09:36 -0700 Subject: [Python-checkins] python/dist/src/Demo/newmetaclasses Eiffel.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/newmetaclasses In directory usw-pr-cvs1:/tmp/cvs-serv22008 Modified Files: Eiffel.py Log Message: Add a call to a Sub() method that actually works. Index: Eiffel.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/newmetaclasses/Eiffel.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Eiffel.py 11 Jul 2002 21:08:06 -0000 1.1 --- Eiffel.py 11 Jul 2002 21:09:34 -0000 1.2 *************** *** 139,142 **** --- 139,143 ---- else: assert False + s.m2(5) if __name__ == "__main__": From jhylton@users.sourceforge.net Thu Jul 11 22:14:16 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 14:14:16 -0700 Subject: [Python-checkins] python/dist/src/Demo/newmetaclasses Eiffel.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/newmetaclasses In directory usw-pr-cvs1:/tmp/cvs-serv23479 Modified Files: Eiffel.py Log Message: Remove list prenpost. It's not used any longer. Index: Eiffel.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/newmetaclasses/Eiffel.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Eiffel.py 11 Jul 2002 21:09:34 -0000 1.2 --- Eiffel.py 11 Jul 2002 21:14:14 -0000 1.3 *************** *** 15,23 **** # find methods with pre or post conditions methods = [] - prenpost = [] for k, v in dict.iteritems(): if k.endswith('_pre') or k.endswith('_post'): assert isinstance(v, function) - prenpost.append(k) elif isinstance(v, function): methods.append(k) --- 15,21 ---- *************** *** 61,65 **** def __call__(self, *args, **kwargs): return self._descr.callmethod(self._inst, args, kwargs) - class EiffelDescriptor(object): --- 59,62 ---- From jhylton@users.sourceforge.net Thu Jul 11 22:17:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 14:17:29 -0700 Subject: [Python-checkins] python/dist/src/Demo/newmetaclasses Eiffel.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/newmetaclasses In directory usw-pr-cvs1:/tmp/cvs-serv24494 Modified Files: Eiffel.py Log Message: move make_eiffel_method() out of base metaclass Index: Eiffel.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/newmetaclasses/Eiffel.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Eiffel.py 11 Jul 2002 21:14:14 -0000 1.3 --- Eiffel.py 11 Jul 2002 21:17:26 -0000 1.4 *************** *** 28,31 **** --- 28,38 ---- convert_methods = classmethod(convert_methods) + class EiffelMetaClass1(EiffelBaseMetaClass): + # an implementation of the "eiffel" meta class that uses nested functions + + def __new__(meta, name, bases, dict): + meta.convert_methods(dict) + return super(EiffelMetaClass1, meta).__new__(meta, name, bases, dict) + def make_eiffel_method(func, pre, post): def method(self, *args, **kwargs): *************** *** 43,53 **** make_eiffel_method = staticmethod(make_eiffel_method) - - class EiffelMetaClass1(EiffelBaseMetaClass): - # an implementation of the "eiffel" meta class that uses nested functions - - def __new__(meta, name, bases, dict): - meta.convert_methods(dict) - return super(EiffelMetaClass1, meta).__new__(meta, name, bases, dict) class EiffelMethodWrapper: --- 50,53 ---- From tim_one@users.sourceforge.net Thu Jul 11 22:46:18 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 14:46:18 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.114,2.115 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30893/python/Objects Modified Files: listobject.c Log Message: docompare(): Use PyTuple_New instead of Py_BuildValue to build compare's arg tuple. This was suggested on c.l.py but afraid I can't find the msg again for proper attribution. For list.sort(cmp) where list is a list of random ints, and cmp is __builtin__.cmp, this yields an overall 50-60% speedup on my Win2K box. Of course this is a best case, because the overhead of calling cmp relative to the cost of actually comparing two ints is at an extreme. Nevertheless it's huge bang for the buck. An additionak 20-30% can be bought by making the arg tuple an immortal static (avoiding all but "the first" PyTuple_New), but that's tricky to make correct since docompare needs to be reentrant. So this picks the cherry and leaves the pits for Fred . Note that this makes no difference to the list.sort() case; an arg tuple gets built only if the user specifies an explicit sort function. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.114 retrieving revision 2.115 diff -C2 -d -r2.114 -r2.115 *** listobject.c 19 Jun 2002 15:44:15 -0000 2.114 --- listobject.c 11 Jul 2002 21:46:16 -0000 2.115 *************** *** 757,761 **** docompare(PyObject *x, PyObject *y, PyObject *compare) { ! PyObject *args, *res; int i; --- 757,762 ---- docompare(PyObject *x, PyObject *y, PyObject *compare) { ! PyObject *res; ! PyObject *args; int i; *************** *** 773,779 **** } ! args = Py_BuildValue("(OO)", x, y); if (args == NULL) return CMPERROR; res = PyEval_CallObject(compare, args); Py_DECREF(args); --- 774,784 ---- } ! args = PyTuple_New(2); if (args == NULL) return CMPERROR; + Py_INCREF(x); + Py_INCREF(y); + PyTuple_SET_ITEM(args, 0, x); + PyTuple_SET_ITEM(args, 1, y); res = PyEval_CallObject(compare, args); Py_DECREF(args); From jhylton@users.sourceforge.net Thu Jul 11 23:01:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 15:01:44 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5524 Modified Files: cPickle.c Log Message: Do more robust test of whether global objects are accessible. PyImport_ImportModule() is not guaranteed to return a module object. When another type of object was returned, the PyModule_GetDict() call return NULL and the subsequent GetItem() seg faulted. Bug fix candidate. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -d -r2.86 -r2.87 *** cPickle.c 26 Jun 2002 20:40:42 -0000 2.86 --- cPickle.c 11 Jul 2002 22:01:40 -0000 2.87 *************** *** 1720,1727 **** goto finally; } ! /* borrowed ref */ ! moddict = PyModule_GetDict(mod); ! /* borrowed ref */ ! klass = PyDict_GetItemString(moddict, name_str); if (klass == NULL) { cPickle_ErrFormat(PicklingError, --- 1720,1724 ---- goto finally; } ! klass = PyObject_GetAttrString(mod, name_str); if (klass == NULL) { cPickle_ErrFormat(PicklingError, *************** *** 1731,1734 **** --- 1728,1732 ---- } if (klass != args) { + Py_DECREF(klass); cPickle_ErrFormat(PicklingError, "Can't pickle %s: it's not the same object as %s.%s", *************** *** 1736,1739 **** --- 1734,1738 ---- goto finally; } + Py_DECREF(klass); if ((*self->write_func)(self, &global, 1) < 0) From jhylton@users.sourceforge.net Thu Jul 11 23:02:35 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 11 Jul 2002 15:02:35 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.87,2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5867 Modified Files: cPickle.c Log Message: remove decl of unused variable Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -d -r2.87 -r2.88 *** cPickle.c 11 Jul 2002 22:01:40 -0000 2.87 --- cPickle.c 11 Jul 2002 22:02:33 -0000 2.88 *************** *** 1687,1691 **** save_global(Picklerobject *self, PyObject *args, PyObject *name) { ! PyObject *global_name = 0, *module = 0, *mod = 0, *moddict = 0, *klass = 0; char *name_str, *module_str; int module_size, name_size, res = -1; --- 1687,1691 ---- save_global(Picklerobject *self, PyObject *args, PyObject *name) { ! PyObject *global_name = 0, *module = 0, *mod = 0, *klass = 0; char *name_str, *module_str; int module_size, name_size, res = -1; From fredrik@pythonware.com Thu Jul 11 23:48:26 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Fri, 12 Jul 2002 00:48:26 +0200 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.114,2.115 References: Message-ID: <042401c2292d$12b16d00$0900a8c0@spiff> tim wrote: > This was suggested on c.l.py but afraid I can't find the msg > again for proper attribution.=20 Jonathan Hogg, provoked by yours truly. http://groups.google.com/groups?selm=3DB951E705.DB73%25jonathan%40onegood= idea.com using PyTuple_SET_ITEM instead of PyTuple_SetItem is an obvious improvement, but feel free to attribute that to yourself ;-) ::: and btw, if some python-checkins lurker feels really inspired, there are probably other "critical paths" that could benefit from the same optimization... From tim_one@users.sourceforge.net Fri Jul 12 06:01:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 11 Jul 2002 22:01:22 -0700 Subject: [Python-checkins] python/dist/src/Include Python.h,2.53,2.54 longobject.h,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv2058 Modified Files: Python.h longobject.h Log Message: HAVE_LIMITS_H -- raise #error if not defined; limits.h is std C ULONG_MAX -- removed; std C requires it in limits.h LONGLONG_MAX -- removed; never used ULONGLONGMAX -- removed; never used Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** Python.h 7 Jul 2002 03:59:33 -0000 2.53 --- Python.h 12 Jul 2002 05:01:20 -0000 2.54 *************** *** 34,37 **** --- 34,39 ---- #ifdef HAVE_LIMITS_H #include + #else + #error "limits.h is required by std C -- why isn't HAVE_LIMITS_H defined?" #endif Index: longobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/longobject.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** longobject.h 10 Sep 2001 20:52:47 -0000 2.24 --- longobject.h 12 Jul 2002 05:01:20 -0000 2.25 *************** *** 34,49 **** #ifdef HAVE_LONG_LONG - - /* Hopefully this is portable... */ - #ifndef ULONG_MAX - #define ULONG_MAX 4294967295U - #endif - #ifndef LONGLONG_MAX - #define LONGLONG_MAX 9223372036854775807LL - #endif - #ifndef ULONGLONG_MAX - #define ULONGLONG_MAX 0xffffffffffffffffULL - #endif - extern DL_IMPORT(PyObject *) PyLong_FromLongLong(LONG_LONG); extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); --- 34,37 ---- From mwh@users.sourceforge.net Fri Jul 12 10:16:46 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 12 Jul 2002 02:16:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv30545 Modified Files: sysconfig.py Log Message: Well, Fred never did explain why the code to determine whether the calling Python was installed was so complicated, so I simplified it. This should get the snake-farm's build scripts working again. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** sysconfig.py 26 Jun 2002 22:05:33 -0000 1.49 --- sysconfig.py 12 Jul 2002 09:16:44 -0000 1.50 *************** *** 30,40 **** argv0_path = os.path.dirname(os.path.abspath(sys.executable)) landmark = os.path.join(argv0_path, "Modules", "Setup") ! if not os.path.isfile(landmark): ! python_build = 0 ! elif os.path.isfile(os.path.join(argv0_path, "Lib", "os.py")): ! python_build = 1 ! else: ! python_build = os.path.isfile(os.path.join(os.path.dirname(argv0_path), ! "Lib", "os.py")) del argv0_path, landmark --- 30,36 ---- argv0_path = os.path.dirname(os.path.abspath(sys.executable)) landmark = os.path.join(argv0_path, "Modules", "Setup") ! ! python_build = os.path.isfile(landmark) ! del argv0_path, landmark From jvr@users.sourceforge.net Fri Jul 12 13:06:20 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 12 Jul 2002 05:06:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv3845 Modified Files: PyEdit.py Log Message: minor fixes, removed obsolete warning Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** PyEdit.py 31 Mar 2002 22:01:33 -0000 1.31 --- PyEdit.py 12 Jul 2002 12:06:17 -0000 1.32 *************** *** 11,14 **** --- 11,15 ---- from Carbon import Res from Carbon import Evt + from Carbon import Qd import os import imp *************** *** 366,370 **** if self.editgroup.editor.changed: import EasyDialogs - from Carbon import Qd Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, --- 367,370 ---- *************** *** 510,514 **** if self.editgroup.editor.changed: import EasyDialogs ! import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: --- 510,514 ---- if self.editgroup.editor.changed: import EasyDialogs ! Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: *************** *** 521,534 **** self._run_with_interpreter() elif self.run_with_cl_interpreter: - # Until universal newline support - if self._eoln != '\n': - import EasyDialogs - ok = EasyDialogs.AskYesNoCancel('Warning: "%s" does not have Unix line-endings' - % self.title, 1, yes='OK', no='') - if not ok: - return if self.editgroup.editor.changed: import EasyDialogs ! import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: --- 521,527 ---- self._run_with_interpreter() elif self.run_with_cl_interpreter: if self.editgroup.editor.changed: import EasyDialogs ! Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: From gvanrossum@users.sourceforge.net Fri Jul 12 14:10:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 12 Jul 2002 06:10:56 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26665 Modified Files: pdb.py Log Message: Fix SF bug 579701 (Fernando Pérez); an input line consisting of one or more spaces only crashed pdb. While I was at it, cleaned up some style nits (spaces between function and parenthesis, and redundant parentheses in if statement). Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** pdb.py 1 Jun 2002 14:18:46 -0000 1.53 --- pdb.py 12 Jul 2002 13:10:53 -0000 1.54 *************** *** 103,108 **** for line in rcLines: line = line[:-1] ! if len (line) > 0 and line[0] != '#': ! self.onecmd (line) # Override Bdb methods (except user_call, for now) --- 103,108 ---- for line in rcLines: line = line[:-1] ! if len(line) > 0 and line[0] != '#': ! self.onecmd(line) # Override Bdb methods (except user_call, for now) *************** *** 152,156 **** def precmd(self, line): """Handle alias expansion and ';;' separator.""" ! if not line: return line args = line.split() --- 152,156 ---- def precmd(self, line): """Handle alias expansion and ';;' separator.""" ! if not line.strip(): return line args = line.split() *************** *** 322,327 **** line = line.strip() # Don't allow setting breakpoint at a blank line ! if ( not line or (line[0] == '#') or ! (line[:3] == '"""') or line[:3] == "'''" ): print '*** Blank or comment' return 0 --- 322,327 ---- line = line.strip() # Don't allow setting breakpoint at a blank line ! if (not line or (line[0] == '#') or ! (line[:3] == '"""') or line[:3] == "'''"): print '*** Blank or comment' return 0 *************** *** 402,408 **** if bp: bp.ignore = count ! if (count > 0): reply = 'Will ignore next ' ! if (count > 1): reply = reply + '%d crossings' % count else: --- 402,408 ---- if bp: bp.ignore = count ! if count > 0: reply = 'Will ignore next ' ! if count > 1: reply = reply + '%d crossings' % count else: *************** *** 615,619 **** print "%s = %s" % (alias, self.aliases[alias]) return ! if args[0] in self.aliases and len (args) == 1: print "%s = %s" % (args[0], self.aliases[args[0]]) else: --- 615,619 ---- print "%s = %s" % (alias, self.aliases[alias]) return ! if args[0] in self.aliases and len(args) == 1: print "%s = %s" % (args[0], self.aliases[args[0]]) else: From gvanrossum@users.sourceforge.net Fri Jul 12 14:13:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 12 Jul 2002 06:13:30 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.185,1.186 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27671 Modified Files: ACKS Log Message: Fernando Pérez of SF bug 579701 fame. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** ACKS 28 Jun 2002 22:39:56 -0000 1.185 --- ACKS 12 Jul 2002 13:13:28 -0000 1.186 *************** *** 358,361 **** --- 358,362 ---- Steven Pemberton Eduardo Pérez + Fernando Pérez Tim Peters Chris Petrilli From gvanrossum@users.sourceforge.net Fri Jul 12 14:12:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 12 Jul 2002 06:12:46 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.51,1.51.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27387 Modified Files: Tag: release22-maint pdb.py Log Message: (Backport.) Fix SF bug 579701 (Fernando Pérez); an input line consisting of one or more spaces only crashed pdb. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.51 retrieving revision 1.51.24.1 diff -C2 -d -r1.51 -r1.51.24.1 *** pdb.py 9 Feb 2001 23:28:07 -0000 1.51 --- pdb.py 12 Jul 2002 13:12:44 -0000 1.51.24.1 *************** *** 152,156 **** def precmd(self, line): """Handle alias expansion and ';;' separator.""" ! if not line: return line args = line.split() --- 152,156 ---- def precmd(self, line): """Handle alias expansion and ';;' separator.""" ! if not line.strip(): return line args = line.split() From jhylton@users.sourceforge.net Fri Jul 12 15:04:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 07:04:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11475a/test Modified Files: test_httplib.py Log Message: Change _begin() back to begin(). Client code could create responses explicitly. Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_httplib.py 7 Jul 2002 16:51:37 -0000 1.6 --- test_httplib.py 12 Jul 2002 14:04:09 -0000 1.7 *************** *** 17,21 **** sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) ! resp._begin() print resp.read() resp.close() --- 17,21 ---- sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) ! resp.begin() print resp.read() resp.close() *************** *** 25,29 **** resp = httplib.HTTPResponse(sock, 1) try: ! resp._begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" --- 25,29 ---- resp = httplib.HTTPResponse(sock, 1) try: ! resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" *************** *** 53,57 **** s = FakeSocket(text) r = httplib.HTTPResponse(s, 1) ! r._begin() cookies = r.getheader("Set-Cookie") if cookies != hdr: --- 53,57 ---- s = FakeSocket(text) r = httplib.HTTPResponse(s, 1) ! r.begin() cookies = r.getheader("Set-Cookie") if cookies != hdr: From jhylton@users.sourceforge.net Fri Jul 12 15:04:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 07:04:11 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11475a Modified Files: httplib.py Log Message: Change _begin() back to begin(). Client code could create responses explicitly. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** httplib.py 9 Jul 2002 21:22:36 -0000 1.58 --- httplib.py 12 Jul 2002 14:04:08 -0000 1.59 *************** *** 199,203 **** self.status = self.status + '; bad seek' break - class HTTPResponse: --- 199,202 ---- *************** *** 261,265 **** return version, status, reason ! def _begin(self): if self.msg is not None: # we've already started reading the response --- 260,264 ---- return version, status, reason ! def begin(self): if self.msg is not None: # we've already started reading the response *************** *** 742,746 **** response = self.response_class(self.sock, strict=self.strict) ! response._begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE --- 741,745 ---- response = self.response_class(self.sock, strict=self.strict) ! response.begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE From jhylton@users.sourceforge.net Fri Jul 12 15:23:45 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 07:23:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.2.12.1,1.2.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18737/test Modified Files: Tag: release22-maint test_httplib.py Log Message: Backport changes. Change _begin() back to begin(). Fix for SF bug 579107. Fix for SF bug #432621: httplib: multiple Set-Cookie headers Fix SF bug #575360 Handle HTTP/0.9 responses. Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.2.12.1 retrieving revision 1.2.12.2 diff -C2 -d -r1.2.12.1 -r1.2.12.2 *** test_httplib.py 2 Jul 2002 20:39:37 -0000 1.2.12.1 --- test_httplib.py 12 Jul 2002 14:23:43 -0000 1.2.12.2 *************** *** 9,13 **** def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': ! raise UnimplementedFileMode() return StringIO.StringIO(self.text) --- 9,13 ---- def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': ! raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) *************** *** 16,21 **** body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock,1) ! resp._begin() print resp.read() resp.close() --- 16,21 ---- body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock, 1) ! resp.begin() print resp.read() resp.close() *************** *** 23,31 **** body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock,1) try: ! resp._begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" --- 23,59 ---- body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock, 1) try: ! resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" + + # Check invalid host_port + + for hp in ("www.python.org:abc", "www.python.org:"): + try: + h = httplib.HTTP(hp) + except httplib.InvalidURL: + print "InvalidURL raised as expected" + else: + print "Expect InvalidURL" + + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s, 1) + r.begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + raise AssertionError, "multiple headers not combined properly" + From jhylton@users.sourceforge.net Fri Jul 12 15:23:45 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 07:23:45 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.42.10.6,1.42.10.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18737 Modified Files: Tag: release22-maint httplib.py Log Message: Backport changes. Change _begin() back to begin(). Fix for SF bug 579107. Fix for SF bug #432621: httplib: multiple Set-Cookie headers Fix SF bug #575360 Handle HTTP/0.9 responses. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.42.10.6 retrieving revision 1.42.10.7 diff -C2 -d -r1.42.10.6 -r1.42.10.7 *** httplib.py 2 Jul 2002 17:19:47 -0000 1.42.10.6 --- httplib.py 12 Jul 2002 14:23:38 -0000 1.42.10.7 *************** *** 94,102 **** _CS_REQ_SENT = 'Request-sent' class HTTPResponse: ! def __init__(self, sock, debuglevel=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.msg = None --- 94,217 ---- _CS_REQ_SENT = 'Request-sent' + class HTTPMessage(mimetools.Message): + + def addheader(self, key, value): + """Add header for field key handling repeats.""" + prev = self.dict.get(key) + if prev is None: + self.dict[key] = value + else: + combined = ", ".join((prev, value)) + self.dict[key] = combined + + def addcontinue(self, key, more): + """Add more field data from a continuation line.""" + prev = self.dict[key] + self.dict[key] = prev + "\n " + more + + def readheaders(self): + """Read header lines. + + Read header lines up to the entirely blank line that terminates them. + The (normally blank) line that ends the headers is skipped, but not + included in the returned list. If a non-header line ends the headers, + (which is an error), an attempt is made to backspace over it; it is + never included in the returned list. + + The variable self.status is set to the empty string if all went well, + otherwise it is an error message. The variable self.headers is a + completely uninterpreted list of lines contained in the header (so + printing them will reproduce the header exactly as it appears in the + file). + + If multiple header fields with the same name occur, they are combined + according to the rules in RFC 2616 sec 4.2: + + Appending each subsequent field-value to the first, each separated + by a comma. The order in which header fields with the same field-name + are received is significant to the interpretation of the combined + field value. + """ + # XXX The implementation overrides the readheaders() method of + # rfc822.Message. The base class design isn't amenable to + # customized behavior here so the method here is a copy of the + # base class code with a few small changes. + + self.dict = {} + self.unixfrom = '' + self.headers = list = [] + self.status = '' + headerseen = "" + firstline = 1 + startofline = unread = tell = None + if hasattr(self.fp, 'unread'): + unread = self.fp.unread + elif self.seekable: + tell = self.fp.tell + while 1: + if tell: + try: + startofline = tell() + except IOError: + startofline = tell = None + self.seekable = 0 + line = self.fp.readline() + if not line: + self.status = 'EOF in headers' + break + # Skip unix From name time lines + if firstline and line.startswith('From '): + self.unixfrom = self.unixfrom + line + continue + firstline = 0 + if headerseen and line[0] in ' \t': + # XXX Not sure if continuation lines are handled properly + # for http and/or for repeating headers + # It's a continuation line. + list.append(line) + x = self.dict[headerseen] + "\n " + line.strip() + self.addcontinue(headerseen, line.strip()) + continue + elif self.iscomment(line): + # It's a comment. Ignore it. + continue + elif self.islast(line): + # Note! No pushback here! The delimiter line gets eaten. + break + headerseen = self.isheader(line) + if headerseen: + # It's a legal header line, save it. + list.append(line) + self.addheader(headerseen, line[len(headerseen)+1:].strip()) + continue + else: + # It's not a header line; throw it back and stop here. + if not self.dict: + self.status = 'No headers' + else: + self.status = 'Non-header line where header expected' + # Try to undo the read. + if unread: + unread(line) + elif tell: + self.fp.seek(startofline) + else: + self.status = self.status + '; bad seek' + break class HTTPResponse: ! ! # strict: If true, raise BadStatusLine if the status line can't be ! # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prvents clients from talking to HTTP/0.9 ! # servers. Note that a response with a sufficiently corrupted ! # status line will look like an HTTP/0.9 response. ! ! # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. ! ! def __init__(self, sock, debuglevel=0, strict=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel + self.strict = strict self.msg = None *************** *** 113,116 **** --- 228,232 ---- def _read_status(self): + # Initialize with Simple-Response defaults line = self.fp.readline() if self.debuglevel > 0: *************** *** 123,132 **** reason = "" except ValueError: ! version = "HTTP/0.9" ! status = "200" ! reason = "" ! if version[:5] != 'HTTP/': ! self.close() ! raise BadStatusLine(line) # The status code is a three-digit number --- 239,253 ---- reason = "" except ValueError: ! # empty version will cause next test to fail and status ! # will be treated as 0.9 response. ! version = "" ! if not version.startswith('HTTP/'): ! if self.strict: ! self.close() ! raise BadStatusLine(line) ! else: ! # assume it's a Simple-Response from an 0.9 server ! self.fp = LineAndFileWrapper(line, self.fp) ! return "HTTP/0.9", 200, "" # The status code is a three-digit number *************** *** 139,143 **** return version, status, reason ! def _begin(self): if self.msg is not None: # we've already started reading the response --- 260,264 ---- return version, status, reason ! def begin(self): if self.msg is not None: # we've already started reading the response *************** *** 170,177 **** if self.version == 9: self.chunked = 0 ! self.msg = mimetools.Message(StringIO()) return ! self.msg = mimetools.Message(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: --- 291,299 ---- if self.version == 9: self.chunked = 0 ! self.will_close = 1 ! self.msg = HTTPMessage(StringIO()) return ! self.msg = HTTPMessage(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: *************** *** 354,364 **** auto_open = 1 debuglevel = 0 ! def __init__(self, host, port=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) def _set_hostport(self, host, port): --- 476,489 ---- auto_open = 1 debuglevel = 0 + strict = 0 ! def __init__(self, host, port=None, strict=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) + if strict is not None: + self.strict = strict def _set_hostport(self, host, port): *************** *** 369,373 **** port = int(host[i+1:]) except ValueError: ! raise InvalidURL, "nonnumeric port: '%s'"%host[i+1:] host = host[:i] else: --- 494,498 ---- port = int(host[i+1:]) except ValueError: ! raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) host = host[:i] else: *************** *** 611,619 **** if self.debuglevel > 0: ! response = self.response_class(self.sock, self.debuglevel) else: ! response = self.response_class(self.sock) ! response._begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE --- 736,745 ---- if self.debuglevel > 0: ! response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict) else: ! response = self.response_class(self.sock, strict=self.strict) ! response.begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE *************** *** 628,632 **** return response ! class SSLFile: """File-like object wrapping an SSL socket.""" --- 754,804 ---- return response ! # The next several classes are used to define FakeSocket,a socket-like ! # interface to an SSL connection. ! ! # The primary complexity comes from faking a makefile() method. The ! # standard socket makefile() implementation calls dup() on the socket ! # file descriptor. As a consequence, clients can call close() on the ! # parent socket and its makefile children in any order. The underlying ! # socket isn't closed until they are all closed. ! ! # The implementation uses reference counting to keep the socket open ! # until the last client calls close(). SharedSocket keeps track of ! # the reference counting and SharedSocketClient provides an constructor ! # and close() method that call incref() and decref() correctly. ! ! class SharedSocket: ! ! def __init__(self, sock): ! self.sock = sock ! self._refcnt = 0 ! ! def incref(self): ! self._refcnt += 1 ! ! def decref(self): ! self._refcnt -= 1 ! assert self._refcnt >= 0 ! if self._refcnt == 0: ! self.sock.close() ! ! def __del__(self): ! self.sock.close() ! ! class SharedSocketClient: ! ! def __init__(self, shared): ! self._closed = 0 ! self._shared = shared ! self._shared.incref() ! self._sock = shared.sock ! ! def close(self): ! if not self._closed: ! self._shared.decref() ! self._closed = 1 ! self._shared = None ! ! class SSLFile(SharedSocketClient): """File-like object wrapping an SSL socket.""" *************** *** 634,638 **** def __init__(self, sock, ssl, bufsize=None): ! self._sock = sock self._ssl = ssl self._buf = '' --- 806,810 ---- def __init__(self, sock, ssl, bufsize=None): ! SharedSocketClient.__init__(self, sock) self._ssl = ssl self._buf = '' *************** *** 703,730 **** return line ! def close(self): ! self._sock.close() - class FakeSocket: def __init__(self, sock, ssl): ! self.__sock = sock ! self.__ssl = ssl def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self.__sock, self.__ssl, bufsize) def send(self, stuff, flags = 0): ! return self.__ssl.write(stuff) ! def sendall(self, stuff, flags = 0): ! return self.__ssl.write(stuff) def recv(self, len = 1024, flags = 0): ! return self.__ssl.read(len) def __getattr__(self, attr): ! return getattr(self.__sock, attr) --- 875,908 ---- return line ! class FakeSocket(SharedSocketClient): ! ! class _closedsocket: ! def __getattr__(self, name): ! raise error(9, 'Bad file descriptor') def __init__(self, sock, ssl): ! sock = SharedSocket(sock) ! SharedSocketClient.__init__(self, sock) ! self._ssl = ssl ! ! def close(self): ! SharedSocketClient.close(self) ! self._sock = self.__class__._closedsocket() def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self._shared, self._ssl, bufsize) def send(self, stuff, flags = 0): ! return self._ssl.write(stuff) ! sendall = send def recv(self, len = 1024, flags = 0): ! return self._ssl.read(len) def __getattr__(self, attr): ! return getattr(self._sock, attr) *************** *** 734,739 **** default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None): ! HTTPConnection.__init__(self, host, port) self.key_file = key_file self.cert_file = cert_file --- 912,918 ---- default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None, ! strict=None): ! HTTPConnection.__init__(self, host, port, strict) self.key_file = key_file self.cert_file = cert_file *************** *** 761,765 **** _connection_class = HTTPConnection ! def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one." --- 940,944 ---- _connection_class = HTTPConnection ! def __init__(self, host='', port=None, strict=None): "Provide a default host, since the superclass requires one." *************** *** 771,775 **** # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port)) def _setup(self, conn): --- 950,954 ---- # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port, strict)) def _setup(self, conn): *************** *** 851,855 **** _connection_class = HTTPSConnection ! def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info --- 1030,1035 ---- _connection_class = HTTPSConnection ! def __init__(self, host='', port=None, key_file=None, cert_file=None, ! strict=None): # provide a default host, pass the X509 cert info *************** *** 857,869 **** if port == 0: port = None ! self._setup(self._connection_class(host, port, **x509)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. ! self.key_file = x509.get('key_file') ! self.cert_file = x509.get('cert_file') class HTTPException(Exception): pass --- 1037,1052 ---- if port == 0: port = None ! self._setup(self._connection_class(host, port, key_file, ! cert_file, strict)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. ! self.key_file = key_file ! self.cert_file = cert_file class HTTPException(Exception): + # Subclasses that define an __init__ must call Exception.__init__ + # or define self.args. Otherwise, str() will fail. pass *************** *** 876,879 **** --- 1059,1063 ---- class UnknownProtocol(HTTPException): def __init__(self, version): + self.args = version, self.version = version *************** *** 886,889 **** --- 1070,1074 ---- class IncompleteRead(HTTPException): def __init__(self, partial): + self.args = partial, self.partial = partial *************** *** 902,905 **** --- 1087,1091 ---- class BadStatusLine(HTTPException): def __init__(self, line): + self.args = line, self.line = line *************** *** 907,920 **** error = HTTPException - # - # snarfed from httplib.py for now... - # def test(): """Test this module. ! The test consists of retrieving and displaying the Python ! home page, along with the error code and error string returned ! by the www.python.org server. """ --- 1093,1161 ---- error = HTTPException + class LineAndFileWrapper: + """A limited file-like object for HTTP/0.9 responses.""" + + # The status-line parsing code calls readline(), which normally + # get the HTTP status line. For a 0.9 response, however, this is + # actually the first line of the body! Clients need to get a + # readable file object that contains that line. + + def __init__(self, line, file): + self._line = line + self._file = file + self._line_consumed = 0 + self._line_offset = 0 + self._line_left = len(line) + + def __getattr__(self, attr): + return getattr(self._file, attr) + + def _done(self): + # called when the last byte is read from the line. After the + # call, all read methods are delegated to the underlying file + # obhect. + self._line_consumed = 1 + self.read = self._file.read + self.readline = self._file.readline + self.readlines = self._file.readlines + + def read(self, amt=None): + assert not self._line_consumed and self._line_left + if amt is None or amt > self._line_left: + s = self._line[self._line_offset:] + self._done() + if amt is None: + return s + self._file.read() + else: + return s + self._file.read(amt - len(s)) + else: + assert amt <= self._line_left + i = self._line_offset + j = i + amt + s = self._line[i:j] + self._line_offset = j + self._line_left -= amt + if self._line_left == 0: + self._done() + return s + + def readline(self): + s = self._line[self._line_offset:] + self._done() + return s + + def readlines(self, size=None): + L = [self._line[self._line_offset:]] + self._done() + if size is None: + return L + self._file.readlines() + else: + return L + self._file.readlines(size) def test(): """Test this module. ! A hodge podge of tests collected here, because they have too many ! external dependencies for the regular test suite. """ *************** *** 937,945 **** print 'status =', status print 'reason =', reason print if headers: for header in headers.headers: print header.strip() print - print "read", len(h.getfile().read()) # minimal test that code to extract host from url works --- 1178,1186 ---- print 'status =', status print 'reason =', reason + print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works *************** *** 955,974 **** if hasattr(socket, 'ssl'): ! host = 'sourceforge.net' ! selector = '/projects/python' ! hs = HTTPS() ! hs.connect(host) ! hs.putrequest('GET', selector) ! hs.endheaders() ! status, reason, headers = hs.getreply() ! # XXX why does this give a 302 response? ! print 'status =', status ! print 'reason =', reason ! print ! if headers: ! for header in headers.headers: print header.strip() ! print ! print "read", len(hs.getfile().read()) if __name__ == '__main__': --- 1196,1250 ---- if hasattr(socket, 'ssl'): ! ! for host, selector in (('sourceforge.net', '/projects/python'), ! ('dbserv2.theopalgroup.com', '/mediumfile'), ! ('dbserv2.theopalgroup.com', '/smallfile'), ! ): ! print "https://%s%s" % (host, selector) ! hs = HTTPS() ! hs.connect(host) ! hs.putrequest('GET', selector) ! hs.endheaders() ! status, reason, headers = hs.getreply() ! print 'status =', status ! print 'reason =', reason ! print "read", len(hs.getfile().read()) ! print ! if headers: ! for header in headers.headers: print header.strip() ! print ! ! return + # Test a buggy server -- returns garbled status line. + # http://www.yahoo.com/promotions/mom_com97/supermom.html + c = HTTPConnection("promotions.yahoo.com") + c.set_debuglevel(1) + c.connect() + c.request("GET", "/promotions/mom_com97/supermom.html") + r = c.getresponse() + print r.status, r.version + lines = r.read().split("\n") + print "\n".join(lines[:5]) + + c = HTTPConnection("promotions.yahoo.com", strict=1) + c.set_debuglevel(1) + c.connect() + c.request("GET", "/promotions/mom_com97/supermom.html") + try: + r = c.getresponse() + except BadStatusLine, err: + print "strict mode failed as expected" + print err + else: + print "XXX strict mode should have failed" + + for strict in 0, 1: + h = HTTP(strict=strict) + h.connect("promotions.yahoo.com") + h.putrequest('GET', "/promotions/mom_com97/supermom.html") + h.endheaders() + status, reason, headers = h.getreply() + assert (strict and status == -1) or status == 200, (strict, status) if __name__ == '__main__': From lemburg@users.sourceforge.net Fri Jul 12 15:36:24 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri, 12 Jul 2002 07:36:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings palmos.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv23565 Added Files: palmos.py Log Message: Palm OS encoding from Sjoerd Mullender --- NEW FILE: palmos.py --- """ Python Character Mapping Codec for PalmOS 3.5. Written by Sjoerd Mullender (sjoerd@acm.org); based on iso8859_15.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_map) class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter) ### Decoding Map decoding_map = codecs.make_identity_dict(range(256)) # The PalmOS character set is mostly iso-8859-1 with some differences. decoding_map.update({ 0x0080: 0x20ac, # EURO SIGN 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK 0x0085: 0x2026, # HORIZONTAL ELLIPSIS 0x0086: 0x2020, # DAGGER 0x0087: 0x2021, # DOUBLE DAGGER 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT 0x0089: 0x2030, # PER MILLE SIGN 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE 0x008d: 0x2666, # BLACK DIAMOND SUIT 0x008e: 0x2663, # BLACK CLUB SUIT 0x008f: 0x2665, # BLACK HEART SUIT 0x0090: 0x2660, # BLACK SPADE SUIT 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK 0x0095: 0x2022, # BULLET 0x0096: 0x2013, # EN DASH 0x0097: 0x2014, # EM DASH 0x0098: 0x02dc, # SMALL TILDE 0x0099: 0x2122, # TRADE MARK SIGN 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON 0x009c: 0x0153, # LATIN SMALL LIGATURE OE 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS }) ### Encoding Map encoding_map = codecs.make_encoding_map(decoding_map) From lemburg@users.sourceforge.net Fri Jul 12 15:40:07 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri, 12 Jul 2002 07:40:07 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.439,1.440 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24795 Modified Files: NEWS Log Message: Mention new encoding. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.439 retrieving revision 1.440 diff -C2 -d -r1.439 -r1.440 *** NEWS 9 Jul 2002 02:57:01 -0000 1.439 --- NEWS 12 Jul 2002 14:40:04 -0000 1.440 *************** *** 171,174 **** --- 171,176 ---- Library + - New encoding for the Palm OS character set: palmos. + - binascii.crc32() and the zipfile module had problems on some 64-bit platforms. These have been fixed. On a platform with 8-byte C longs, From jhylton@users.sourceforge.net Fri Jul 12 16:22:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 08:22:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7434/test Modified Files: Tag: release21-maint test_httplib.py Log Message: Backport changes. Change _begin() back to begin(). Fix for SF bug 579107. Fix for SF bug #432621: httplib: multiple Set-Cookie headers Fix SF bug #575360 Handle HTTP/0.9 responses. Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** test_httplib.py 2 Jul 2002 20:42:50 -0000 1.1.2.1 --- test_httplib.py 12 Jul 2002 15:22:09 -0000 1.1.2.2 *************** *** 1,3 **** ! from test.test_support import verify,verbose import httplib import StringIO --- 1,3 ---- ! from test_support import verify,verbose import httplib import StringIO *************** *** 9,13 **** def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': ! raise UnimplementedFileMode() return StringIO.StringIO(self.text) --- 9,13 ---- def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': ! raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) *************** *** 16,21 **** body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock,1) ! resp._begin() print resp.read() resp.close() --- 16,21 ---- body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock, 1) ! resp.begin() print resp.read() resp.close() *************** *** 23,31 **** body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock,1) try: ! resp._begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" --- 23,59 ---- body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) ! resp = httplib.HTTPResponse(sock, 1) try: ! resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" + + # Check invalid host_port + + for hp in ("www.python.org:abc", "www.python.org:"): + try: + h = httplib.HTTP(hp) + except httplib.InvalidURL: + print "InvalidURL raised as expected" + else: + print "Expect InvalidURL" + + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s, 1) + r.begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + raise AssertionError, "multiple headers not combined properly" + From jhylton@users.sourceforge.net Fri Jul 12 16:22:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 08:22:11 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.34.2.4,1.34.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7434 Modified Files: Tag: release21-maint httplib.py Log Message: Backport changes. Change _begin() back to begin(). Fix for SF bug 579107. Fix for SF bug #432621: httplib: multiple Set-Cookie headers Fix SF bug #575360 Handle HTTP/0.9 responses. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.34.2.4 retrieving revision 1.34.2.5 diff -C2 -d -r1.34.2.4 -r1.34.2.5 *** httplib.py 2 Jul 2002 20:42:50 -0000 1.34.2.4 --- httplib.py 12 Jul 2002 15:22:07 -0000 1.34.2.5 *************** *** 94,102 **** _CS_REQ_SENT = 'Request-sent' class HTTPResponse: ! def __init__(self, sock, debuglevel=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.msg = None --- 94,217 ---- _CS_REQ_SENT = 'Request-sent' + class HTTPMessage(mimetools.Message): + + def addheader(self, key, value): + """Add header for field key handling repeats.""" + prev = self.dict.get(key) + if prev is None: + self.dict[key] = value + else: + combined = ", ".join((prev, value)) + self.dict[key] = combined + + def addcontinue(self, key, more): + """Add more field data from a continuation line.""" + prev = self.dict[key] + self.dict[key] = prev + "\n " + more + + def readheaders(self): + """Read header lines. + + Read header lines up to the entirely blank line that terminates them. + The (normally blank) line that ends the headers is skipped, but not + included in the returned list. If a non-header line ends the headers, + (which is an error), an attempt is made to backspace over it; it is + never included in the returned list. + + The variable self.status is set to the empty string if all went well, + otherwise it is an error message. The variable self.headers is a + completely uninterpreted list of lines contained in the header (so + printing them will reproduce the header exactly as it appears in the + file). + + If multiple header fields with the same name occur, they are combined + according to the rules in RFC 2616 sec 4.2: + + Appending each subsequent field-value to the first, each separated + by a comma. The order in which header fields with the same field-name + are received is significant to the interpretation of the combined + field value. + """ + # XXX The implementation overrides the readheaders() method of + # rfc822.Message. The base class design isn't amenable to + # customized behavior here so the method here is a copy of the + # base class code with a few small changes. + + self.dict = {} + self.unixfrom = '' + self.headers = list = [] + self.status = '' + headerseen = "" + firstline = 1 + startofline = unread = tell = None + if hasattr(self.fp, 'unread'): + unread = self.fp.unread + elif self.seekable: + tell = self.fp.tell + while 1: + if tell: + try: + startofline = tell() + except IOError: + startofline = tell = None + self.seekable = 0 + line = self.fp.readline() + if not line: + self.status = 'EOF in headers' + break + # Skip unix From name time lines + if firstline and line.startswith('From '): + self.unixfrom = self.unixfrom + line + continue + firstline = 0 + if headerseen and line[0] in ' \t': + # XXX Not sure if continuation lines are handled properly + # for http and/or for repeating headers + # It's a continuation line. + list.append(line) + x = self.dict[headerseen] + "\n " + line.strip() + self.addcontinue(headerseen, line.strip()) + continue + elif self.iscomment(line): + # It's a comment. Ignore it. + continue + elif self.islast(line): + # Note! No pushback here! The delimiter line gets eaten. + break + headerseen = self.isheader(line) + if headerseen: + # It's a legal header line, save it. + list.append(line) + self.addheader(headerseen, line[len(headerseen)+1:].strip()) + continue + else: + # It's not a header line; throw it back and stop here. + if not self.dict: + self.status = 'No headers' + else: + self.status = 'Non-header line where header expected' + # Try to undo the read. + if unread: + unread(line) + elif tell: + self.fp.seek(startofline) + else: + self.status = self.status + '; bad seek' + break class HTTPResponse: ! ! # strict: If true, raise BadStatusLine if the status line can't be ! # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prvents clients from talking to HTTP/0.9 ! # servers. Note that a response with a sufficiently corrupted ! # status line will look like an HTTP/0.9 response. ! ! # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. ! ! def __init__(self, sock, debuglevel=0, strict=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel + self.strict = strict self.msg = None *************** *** 113,116 **** --- 228,232 ---- def _read_status(self): + # Initialize with Simple-Response defaults line = self.fp.readline() if self.debuglevel > 0: *************** *** 123,132 **** reason = "" except ValueError: ! version = "HTTP/0.9" ! status = "200" ! reason = "" ! if version[:5] != 'HTTP/': ! self.close() ! raise BadStatusLine(line) # The status code is a three-digit number --- 239,253 ---- reason = "" except ValueError: ! # empty version will cause next test to fail and status ! # will be treated as 0.9 response. ! version = "" ! if not version.startswith('HTTP/'): ! if self.strict: ! self.close() ! raise BadStatusLine(line) ! else: ! # assume it's a Simple-Response from an 0.9 server ! self.fp = LineAndFileWrapper(line, self.fp) ! return "HTTP/0.9", 200, "" # The status code is a three-digit number *************** *** 139,143 **** return version, status, reason ! def _begin(self): if self.msg is not None: # we've already started reading the response --- 260,264 ---- return version, status, reason ! def begin(self): if self.msg is not None: # we've already started reading the response *************** *** 170,177 **** if self.version == 9: self.chunked = 0 ! self.msg = mimetools.Message(StringIO()) return ! self.msg = mimetools.Message(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: --- 291,299 ---- if self.version == 9: self.chunked = 0 ! self.will_close = 1 ! self.msg = HTTPMessage(StringIO()) return ! self.msg = HTTPMessage(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: *************** *** 354,364 **** auto_open = 1 debuglevel = 0 ! def __init__(self, host, port=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) def _set_hostport(self, host, port): --- 476,489 ---- auto_open = 1 debuglevel = 0 + strict = 0 ! def __init__(self, host, port=None, strict=None): self.sock = None self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) + if strict is not None: + self.strict = strict def _set_hostport(self, host, port): *************** *** 381,388 **** def connect(self): """Connect to the host and port specified in __init__.""" ! self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ! if self.debuglevel > 0: ! print "connect: (%s, %s)" % (self.host, self.port) ! self.sock.connect((self.host, self.port)) def close(self): --- 506,528 ---- def connect(self): """Connect to the host and port specified in __init__.""" ! msg = "getaddrinfo returns an empty list" ! for res in socket.getaddrinfo(self.host, self.port, 0, ! socket.SOCK_STREAM): ! af, socktype, proto, canonname, sa = res ! try: ! self.sock = socket.socket(af, socktype, proto) ! if self.debuglevel > 0: ! print "connect: (%s, %s)" % (self.host, self.port) ! self.sock.connect(sa) ! except socket.error, msg: ! if self.debuglevel > 0: ! print 'connect fail:', (self.host, self.port) ! if self.sock: ! self.sock.close() ! self.sock = None ! continue ! break ! if not self.sock: ! raise socket.error, msg def close(self): *************** *** 596,604 **** if self.debuglevel > 0: ! response = self.response_class(self.sock, self.debuglevel) else: ! response = self.response_class(self.sock) ! response._begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE --- 736,745 ---- if self.debuglevel > 0: ! response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict) else: ! response = self.response_class(self.sock, strict=self.strict) ! response.begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE *************** *** 613,617 **** return response ! class SSLFile: """File-like object wrapping an SSL socket.""" --- 754,804 ---- return response ! # The next several classes are used to define FakeSocket,a socket-like ! # interface to an SSL connection. ! ! # The primary complexity comes from faking a makefile() method. The ! # standard socket makefile() implementation calls dup() on the socket ! # file descriptor. As a consequence, clients can call close() on the ! # parent socket and its makefile children in any order. The underlying ! # socket isn't closed until they are all closed. ! ! # The implementation uses reference counting to keep the socket open ! # until the last client calls close(). SharedSocket keeps track of ! # the reference counting and SharedSocketClient provides an constructor ! # and close() method that call incref() and decref() correctly. ! ! class SharedSocket: ! ! def __init__(self, sock): ! self.sock = sock ! self._refcnt = 0 ! ! def incref(self): ! self._refcnt += 1 ! ! def decref(self): ! self._refcnt -= 1 ! assert self._refcnt >= 0 ! if self._refcnt == 0: ! self.sock.close() ! ! def __del__(self): ! self.sock.close() ! ! class SharedSocketClient: ! ! def __init__(self, shared): ! self._closed = 0 ! self._shared = shared ! self._shared.incref() ! self._sock = shared.sock ! ! def close(self): ! if not self._closed: ! self._shared.decref() ! self._closed = 1 ! self._shared = None ! ! class SSLFile(SharedSocketClient): """File-like object wrapping an SSL socket.""" *************** *** 619,623 **** def __init__(self, sock, ssl, bufsize=None): ! self._sock = sock self._ssl = ssl self._buf = '' --- 806,810 ---- def __init__(self, sock, ssl, bufsize=None): ! SharedSocketClient.__init__(self, sock) self._ssl = ssl self._buf = '' *************** *** 688,715 **** return line ! def close(self): ! self._sock.close() - class FakeSocket: def __init__(self, sock, ssl): ! self.__sock = sock ! self.__ssl = ssl def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self.__sock, self.__ssl, bufsize) def send(self, stuff, flags = 0): ! return self.__ssl.write(stuff) ! def sendall(self, stuff, flags = 0): ! return self.__ssl.write(stuff) def recv(self, len = 1024, flags = 0): ! return self.__ssl.read(len) def __getattr__(self, attr): ! return getattr(self.__sock, attr) --- 875,908 ---- return line ! class FakeSocket(SharedSocketClient): ! ! class _closedsocket: ! def __getattr__(self, name): ! raise error(9, 'Bad file descriptor') def __init__(self, sock, ssl): ! sock = SharedSocket(sock) ! SharedSocketClient.__init__(self, sock) ! self._ssl = ssl ! ! def close(self): ! SharedSocketClient.close(self) ! self._sock = self.__class__._closedsocket() def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() ! return SSLFile(self._shared, self._ssl, bufsize) def send(self, stuff, flags = 0): ! return self._ssl.write(stuff) ! sendall = send def recv(self, len = 1024, flags = 0): ! return self._ssl.read(len) def __getattr__(self, attr): ! return getattr(self._sock, attr) *************** *** 719,724 **** default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None): ! HTTPConnection.__init__(self, host, port) self.key_file = key_file self.cert_file = cert_file --- 912,918 ---- default_port = HTTPS_PORT ! def __init__(self, host, port=None, key_file=None, cert_file=None, ! strict=None): ! HTTPConnection.__init__(self, host, port, strict) self.key_file = key_file self.cert_file = cert_file *************** *** 746,750 **** _connection_class = HTTPConnection ! def __init__(self, host='', port=None): "Provide a default host, since the superclass requires one." --- 940,944 ---- _connection_class = HTTPConnection ! def __init__(self, host='', port=None, strict=None): "Provide a default host, since the superclass requires one." *************** *** 756,760 **** # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port)) def _setup(self, conn): --- 950,954 ---- # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. ! self._setup(self._connection_class(host, port, strict)) def _setup(self, conn): *************** *** 836,840 **** _connection_class = HTTPSConnection ! def __init__(self, host='', port=None, **x509): # provide a default host, pass the X509 cert info --- 1030,1035 ---- _connection_class = HTTPSConnection ! def __init__(self, host='', port=None, key_file=None, cert_file=None, ! strict=None): # provide a default host, pass the X509 cert info *************** *** 842,854 **** if port == 0: port = None ! self._setup(self._connection_class(host, port, **x509)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. ! self.key_file = x509.get('key_file') ! self.cert_file = x509.get('cert_file') class HTTPException(Exception): pass --- 1037,1052 ---- if port == 0: port = None ! self._setup(self._connection_class(host, port, key_file, ! cert_file, strict)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. ! self.key_file = key_file ! self.cert_file = cert_file class HTTPException(Exception): + # Subclasses that define an __init__ must call Exception.__init__ + # or define self.args. Otherwise, str() will fail. pass *************** *** 861,864 **** --- 1059,1063 ---- class UnknownProtocol(HTTPException): def __init__(self, version): + self.args = version, self.version = version *************** *** 871,874 **** --- 1070,1074 ---- class IncompleteRead(HTTPException): def __init__(self, partial): + self.args = partial, self.partial = partial *************** *** 887,890 **** --- 1087,1091 ---- class BadStatusLine(HTTPException): def __init__(self, line): + self.args = line, self.line = line *************** *** 892,905 **** error = HTTPException - # - # snarfed from httplib.py for now... - # def test(): """Test this module. ! The test consists of retrieving and displaying the Python ! home page, along with the error code and error string returned ! by the www.python.org server. """ --- 1093,1161 ---- error = HTTPException + class LineAndFileWrapper: + """A limited file-like object for HTTP/0.9 responses.""" + + # The status-line parsing code calls readline(), which normally + # get the HTTP status line. For a 0.9 response, however, this is + # actually the first line of the body! Clients need to get a + # readable file object that contains that line. + + def __init__(self, line, file): + self._line = line + self._file = file + self._line_consumed = 0 + self._line_offset = 0 + self._line_left = len(line) + + def __getattr__(self, attr): + return getattr(self._file, attr) + + def _done(self): + # called when the last byte is read from the line. After the + # call, all read methods are delegated to the underlying file + # obhect. + self._line_consumed = 1 + self.read = self._file.read + self.readline = self._file.readline + self.readlines = self._file.readlines + + def read(self, amt=None): + assert not self._line_consumed and self._line_left + if amt is None or amt > self._line_left: + s = self._line[self._line_offset:] + self._done() + if amt is None: + return s + self._file.read() + else: + return s + self._file.read(amt - len(s)) + else: + assert amt <= self._line_left + i = self._line_offset + j = i + amt + s = self._line[i:j] + self._line_offset = j + self._line_left -= amt + if self._line_left == 0: + self._done() + return s + + def readline(self): + s = self._line[self._line_offset:] + self._done() + return s + + def readlines(self, size=None): + L = [self._line[self._line_offset:]] + self._done() + if size is None: + return L + self._file.readlines() + else: + return L + self._file.readlines(size) def test(): """Test this module. ! A hodge podge of tests collected here, because they have too many ! external dependencies for the regular test suite. """ *************** *** 922,930 **** print 'status =', status print 'reason =', reason print if headers: for header in headers.headers: print header.strip() print - print "read", len(h.getfile().read()) # minimal test that code to extract host from url works --- 1178,1186 ---- print 'status =', status print 'reason =', reason + print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works *************** *** 940,959 **** if hasattr(socket, 'ssl'): ! host = 'sourceforge.net' ! selector = '/projects/python' ! hs = HTTPS() ! hs.connect(host) ! hs.putrequest('GET', selector) ! hs.endheaders() ! status, reason, headers = hs.getreply() ! # XXX why does this give a 302 response? ! print 'status =', status ! print 'reason =', reason ! print ! if headers: ! for header in headers.headers: print header.strip() ! print ! print "read", len(hs.getfile().read()) if __name__ == '__main__': --- 1196,1250 ---- if hasattr(socket, 'ssl'): ! ! for host, selector in (('sourceforge.net', '/projects/python'), ! ('dbserv2.theopalgroup.com', '/mediumfile'), ! ('dbserv2.theopalgroup.com', '/smallfile'), ! ): ! print "https://%s%s" % (host, selector) ! hs = HTTPS() ! hs.connect(host) ! hs.putrequest('GET', selector) ! hs.endheaders() ! status, reason, headers = hs.getreply() ! print 'status =', status ! print 'reason =', reason ! print "read", len(hs.getfile().read()) ! print ! if headers: ! for header in headers.headers: print header.strip() ! print + return + + # Test a buggy server -- returns garbled status line. + # http://www.yahoo.com/promotions/mom_com97/supermom.html + c = HTTPConnection("promotions.yahoo.com") + c.set_debuglevel(1) + c.connect() + c.request("GET", "/promotions/mom_com97/supermom.html") + r = c.getresponse() + print r.status, r.version + lines = r.read().split("\n") + print "\n".join(lines[:5]) + + c = HTTPConnection("promotions.yahoo.com", strict=1) + c.set_debuglevel(1) + c.connect() + c.request("GET", "/promotions/mom_com97/supermom.html") + try: + r = c.getresponse() + except BadStatusLine, err: + print "strict mode failed as expected" + print err + else: + print "XXX strict mode should have failed" + + for strict in 0, 1: + h = HTTP(strict=strict) + h.connect("promotions.yahoo.com") + h.putrequest('GET', "/promotions/mom_com97/supermom.html") + h.endheaders() + status, reason, headers = h.getreply() + assert (strict and status == -1) or status == 200, (strict, status) if __name__ == '__main__': From jhylton@users.sourceforge.net Fri Jul 12 16:42:12 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 08:42:12 -0700 Subject: [Python-checkins] python/dist/src/Demo/newmetaclasses Eiffel.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/newmetaclasses In directory usw-pr-cvs1:/tmp/cvs-serv14407 Modified Files: Eiffel.py Log Message: Get the meta class inheritance right. Index: Eiffel.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/newmetaclasses/Eiffel.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Eiffel.py 11 Jul 2002 21:17:26 -0000 1.4 --- Eiffel.py 12 Jul 2002 15:42:10 -0000 1.5 *************** *** 5,8 **** --- 5,13 ---- class EiffelBaseMetaClass(type): + def __new__(meta, name, bases, dict): + meta.convert_methods(dict) + return super(EiffelBaseMetaClass, meta).__new__(meta, name, bases, + dict) + def convert_methods(cls, dict): """Replace functions in dict with EiffelMethod wrappers. *************** *** 31,38 **** # an implementation of the "eiffel" meta class that uses nested functions - def __new__(meta, name, bases, dict): - meta.convert_methods(dict) - return super(EiffelMetaClass1, meta).__new__(meta, name, bases, dict) - def make_eiffel_method(func, pre, post): def method(self, *args, **kwargs): --- 36,39 ---- *************** *** 81,85 **** return x ! class EiffelMetaClass2(EiffelMetaClass1): # an implementation of the "eiffel" meta class that uses descriptors --- 82,86 ---- return x ! class EiffelMetaClass2(EiffelBaseMetaClass): # an implementation of the "eiffel" meta class that uses descriptors From jhylton@users.sourceforge.net Fri Jul 12 16:52:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 08:52:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_httplib,1.1,1.1.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv17052/output Modified Files: Tag: release22-maint test_httplib Log Message: Update output for new tests. Index: test_httplib =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_httplib,v retrieving revision 1.1 retrieving revision 1.1.22.1 diff -C2 -d -r1.1 -r1.1.22.1 *** test_httplib 13 Apr 2001 14:57:44 -0000 1.1 --- test_httplib 12 Jul 2002 15:52:26 -0000 1.1.22.1 *************** *** 4,5 **** --- 4,10 ---- reply: 'HTTP/1.1 400.100 Not Ok\r\n' BadStatusLine raised as expected + InvalidURL raised as expected + InvalidURL raised as expected + reply: 'HTTP/1.1 200 OK\r\n' + header: Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme" + header: Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme" From jhylton@users.sourceforge.net Fri Jul 12 16:54:39 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 08:54:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pyclbr.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18730 Modified Files: test_pyclbr.py Log Message: Remove httplib from tested modules. The test of httplib makes it difficult to maintain httplib. There are two many idioms that pyclbr doesn't seem to understand, and I don't understand how to update these tests to make them work. Also remove commented out test of urllib2. Index: test_pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyclbr.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_pyclbr.py 10 Jul 2002 02:37:21 -0000 1.10 --- test_pyclbr.py 12 Jul 2002 15:54:37 -0000 1.11 *************** *** 127,148 **** 'open_https')) # not on all platforms - #XXXX bad example - #cm('urllib2', ignore=('at_cnri', # defined inside __main__ - # '__super_init', # set with =. - # '_HTTPError__super_init', # set with =. - # 'http_error_301', # set with =. - # )) - - - cm('pickle', ignore=('g',)) # deleted declaration cm('aifc', ignore=('openfp',)) # set with = - - cm('httplib', ignore=('error', # set with = - 'sendall', # set with = - '_closedsocket', # it's a nested class - 'HTTPS', - 'HTTP11')) # not on all platforms cm('Cookie', ignore=('__str__', 'Cookie')) # set with = --- 127,133 ---- From gvanrossum@users.sourceforge.net Fri Jul 12 17:03:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 12 Jul 2002 09:03:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pyclbr.py,1.6.10.2,1.6.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21044 Modified Files: Tag: release22-maint test_pyclbr.py Log Message: Backport: Remove httplib from tested modules. The test of httplib makes it difficult to maintain httplib. There are two many idioms that pyclbr doesn't seem to understand, and I don't understand how to update these tests to make them work. Also remove commented out test of urllib2. Index: test_pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyclbr.py,v retrieving revision 1.6.10.2 retrieving revision 1.6.10.3 diff -C2 -d -r1.6.10.2 -r1.6.10.3 *** test_pyclbr.py 5 Jun 2002 19:10:19 -0000 1.6.10.2 --- test_pyclbr.py 12 Jul 2002 16:03:09 -0000 1.6.10.3 *************** *** 127,146 **** 'open_https')) # not on all platforms - #XXXX bad example - #cm('urllib2', ignore=('at_cnri', # defined inside __main__ - # '__super_init', # set with =. - # '_HTTPError__super_init', # set with =. - # 'http_error_301', # set with =. - # )) - - - cm('pickle', ignore=('g',)) # deleted declaration cm('aifc', ignore=('openfp',)) # set with = - - cm('httplib', ignore=('error', # set with = - 'HTTPS', - 'HTTP11')) # not on all platforms cm('Cookie', ignore=('__str__', 'Cookie')) # set with = --- 127,133 ---- From jhylton@users.sourceforge.net Fri Jul 12 17:04:32 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 09:04:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_httplib,1.1,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv21273 Modified Files: Tag: release21-maint test_httplib Log Message: Update test output. Index: test_httplib =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_httplib,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** test_httplib 13 Apr 2001 14:57:44 -0000 1.1 --- test_httplib 12 Jul 2002 16:04:27 -0000 1.1.2.1 *************** *** 4,5 **** --- 4,10 ---- reply: 'HTTP/1.1 400.100 Not Ok\r\n' BadStatusLine raised as expected + InvalidURL raised as expected + InvalidURL raised as expected + reply: 'HTTP/1.1 200 OK\r\n' + header: Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme" + header: Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme" From bwarsaw@users.sourceforge.net Fri Jul 12 17:39:51 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 12 Jul 2002 09:39:51 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.34,1.35 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32562 Modified Files: pep-0001.txt Log Message: Addeda paragraph about transferring ownership of the PEP. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** pep-0001.txt 28 May 2002 15:20:17 -0000 1.34 --- pep-0001.txt 12 Jul 2002 16:39:49 -0000 1.35 *************** *** 334,337 **** --- 334,359 ---- + Transferring PEP Ownership + + It occasionally becomes necessary to transfer ownership of PEPs to + a new champion. In general, we'd like to retain the original + author as a co-author of the transferred PEP, but that's really up + to the original author. A good reason to transfer ownership is + because the original author no longer has the time or interest in + updating it or following through with the PEP process, or has + fallen off the face of the 'net (i.e. is unreachable or not + responding to email). A bad reason to transfer ownership is + because you don't agree with the direction of the PEP. We try to + build consensus around a PEP, but if that's not possible, you can + always submit a competing PEP. + + If you are interested assuming ownership of a PEP, send a message + asking to take over, addressed to both the original author and the + PEP editor . If the original author doesn't + respond to email in a timely manner, the PEP editor will make a + unilateral decision (it's not like such decisions can be + reversed. :). + + References and Footnotes From jvr@users.sourceforge.net Fri Jul 12 17:50:34 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 12 Jul 2002 09:50:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv3501 Modified Files: PythonIDEMain.py Log Message: fixed wrong classic MacOS pathname assumption Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PythonIDEMain.py 29 Mar 2002 21:47:56 -0000 1.18 --- PythonIDEMain.py 12 Jul 2002 16:50:32 -0000 1.19 *************** *** 27,31 **** def __init__(self): ! self.preffilepath = ":Python:PythonIDE preferences" Wapplication.Application.__init__(self, 'Pide') from Carbon import AE --- 27,31 ---- def __init__(self): ! self.preffilepath = os.path.join("Python", "PythonIDE preferences") Wapplication.Application.__init__(self, 'Pide') from Carbon import AE From fdrake@users.sourceforge.net Fri Jul 12 18:15:12 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 12 Jul 2002 10:15:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.98,1.99 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10343/lib Modified Files: libstdtypes.tex Log Message: Clarify the return value of __nonzero__(): It *must* be an integer. Closes SF bug #579991. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** libstdtypes.tex 14 Jun 2002 09:16:40 -0000 1.98 --- libstdtypes.tex 12 Jul 2002 17:15:10 -0000 1.99 *************** *** 48,54 **** \item instances of user-defined classes, if the class defines a \method{__nonzero__()} or \method{__len__()} method, when that ! method returns zero.\footnote{Additional information on these ! special methods may be found in the \citetitle[../ref/ref.html]{Python ! Reference Manual}.} \end{itemize} --- 48,54 ---- \item instances of user-defined classes, if the class defines a \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero.\footnote{Additional ! information on these special methods may be found in the ! \citetitle[../ref/ref.html]{Python Reference Manual}.} \end{itemize} From fdrake@users.sourceforge.net Fri Jul 12 18:15:47 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 12 Jul 2002 10:15:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.9,1.80.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10555/lib Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Clarify the return value of __nonzero__(): It *must* be an integer. Closes SF bug #579991. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.9 retrieving revision 1.80.6.10 diff -C2 -d -r1.80.6.9 -r1.80.6.10 *** libstdtypes.tex 15 May 2002 15:50:32 -0000 1.80.6.9 --- libstdtypes.tex 12 Jul 2002 17:15:45 -0000 1.80.6.10 *************** *** 40,46 **** \item instances of user-defined classes, if the class defines a \method{__nonzero__()} or \method{__len__()} method, when that ! method returns zero.\footnote{Additional information on these ! special methods may be found in the \citetitle[../ref/ref.html]{Python ! Reference Manual}.} \end{itemize} --- 40,46 ---- \item instances of user-defined classes, if the class defines a \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero.\footnote{Additional ! information on these special methods may be found in the ! \citetitle[../ref/ref.html]{Python Reference Manual}.} \end{itemize} From gvanrossum@users.sourceforge.net Fri Jul 12 20:51:58 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 12 Jul 2002 12:51:58 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26885 Modified Files: pep-0283.txt Log Message: Add PEP 263 as slated for inclusion. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0283.txt 18 Jun 2002 21:10:20 -0000 1.10 --- pep-0283.txt 12 Jul 2002 19:51:55 -0000 1.11 *************** *** 76,79 **** --- 76,83 ---- the near future. + - PEP 263 Defining Python Source Code Encodings + + I'm all for this plan. I haven't reviewed the implementation. + - A new command line option parser. Greg Ward's Optik (http://optik.sf.net) would fit the bill fine; there's only some From akuchling@users.sourceforge.net Fri Jul 12 21:24:44 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 12 Jul 2002 13:24:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv3149 Modified Files: whatsnew23.tex Log Message: Add more items Use \cfunction instead of \function in various places Add contributor names Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** whatsnew23.tex 11 Jul 2002 20:50:34 -0000 1.34 --- whatsnew23.tex 12 Jul 2002 20:24:42 -0000 1.35 *************** *** 16,24 **** % Optik (or whatever it gets called) % ! % New dependency argument to distutils.Extension ! % ! % The assert statement no longer tests __debug__ at runtime. % - % %\section{Introduction \label{intro}} --- 16,21 ---- % Optik (or whatever it gets called) % ! % Bug #580462: changes to GC API % %\section{Introduction \label{intro}} *************** *** 441,444 **** --- 438,443 ---- \end{verbatim} + (Contributed by Simon Brunning.) + \item The \method{startswith()} and \method{endswith()} string methods now accept negative numbers for the start and end *************** *** 460,463 **** --- 459,469 ---- \end{verbatim} + (Contributed by Walter D\"orwald.) + + \item The \keyword{assert} statement no longer checks the \code{__debug__} + flag, so you can no longer disable assertions by assigning to \code{__debug__}. + Running Python with the \programopt{-O} switch will still generate + code that doesn't execute any assertions. + \item A new type object, \class{basestring}, has been added. Both 8-bit strings and Unicode strings inherit from this type, so *************** *** 517,523 **** An experimental feature added to Python 2.1 was a specialized object allocator called pymalloc, written by Vladimir Marangozov. Pymalloc ! was intended to be faster than the system \function{malloc()} and have less memory overhead for typical allocation patterns of Python ! programs. The allocator uses C's \function{malloc()} function to get large pools of memory, and then fulfills smaller memory requests from these pools. --- 523,529 ---- An experimental feature added to Python 2.1 was a specialized object allocator called pymalloc, written by Vladimir Marangozov. Pymalloc ! was intended to be faster than the system \cfunction{malloc()} and have less memory overhead for typical allocation patterns 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. *************** *** 535,546 **** because some incorrect code may cause core dumps at runtime. There are a bunch of memory allocation functions in Python's C API that have ! previously been just aliases for the C library's \function{malloc()} ! and \function{free()}, meaning that if you accidentally called mismatched functions, the error wouldn't be noticeable. When the object allocator is enabled, these functions aren't aliases of ! \function{malloc()} and \function{free()} any more, and calling the wrong function to free memory may get you a core dump. For example, ! if memory was allocated using \function{PyObject_Malloc()}, it has to ! be freed using \function{PyObject_Free()}, not \function{free()}. A few modules included with Python fell afoul of this and had to be fixed; doubtless there are more third-party modules that will have the --- 541,552 ---- because some incorrect code may cause core dumps at runtime. There are a bunch of memory allocation functions in Python's C API that have ! previously been just aliases for the C library's \cfunction{malloc()} ! and \cfunction{free()}, meaning that if you accidentally called mismatched functions, the error wouldn't be noticeable. When the object allocator is enabled, these functions aren't aliases of ! \cfunction{malloc()} and \cfunction{free()} any more, and calling the wrong function to free memory may get you a core dump. For example, ! if memory was allocated using \cfunction{PyObject_Malloc()}, it has to ! be freed using \cfunction{PyObject_Free()}, not \cfunction{free()}. A few modules included with Python fell afoul of this and had to be fixed; doubtless there are more third-party modules that will have the *************** *** 688,694 **** Alexander.) \item The \module{array} module now supports arrays of Unicode ! characters using the \samp{u} format character. Arrays also ! now support using the \code{+=} assignment operator to add another array's contents, and the \code{*=} assignment operator to repeat an array. (Contributed by Jason Orendorff.) --- 694,717 ---- Alexander.) + \item The Distutils \class{Extension} class now supports + an extra constructor argument named \samp{depends} for listing + additional source files that an extension depends on. This lets + Distutils recompile the module if any of the dependency files are + modified. For example, if \samp{sampmodule.c} includes the header + file \file{sample.h}, you would create the \class{Extension} object like + this: + + \begin{verbatim} + ext = Extension("samp", + sources=["sampmodule.c"], + depends=["sample.h"]) + \end{verbatim} + + Modifying \file{sample.h} would then cause the module to be recompiled. + (Contributed by Jeremy Hylton.) + \item The \module{array} module now supports arrays of Unicode ! characters using the \samp{u} format character. Arrays also now ! support using the \code{+=} assignment operator to add another array's contents, and the \code{*=} assignment operator to repeat an array. (Contributed by Jason Orendorff.) *************** *** 719,722 **** --- 742,751 ---- the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. + \item The parser objects provided by the \module{pyexpat} module + can now optionally buffer character data, resulting in fewer calls to + your character data handler and therefore faster performance. Setting + the parser object's \member{buffer_text} attribute to \constant{True} + will enable buffering. + \end{itemize} *************** *** 774,777 **** --- 803,810 ---- \constant{METH_STATIC} flags in a method's \ctype{PyMethodDef} structure. + + \item Python now includes a copy of the Expat XML parser's source code, + removing any dependence on a system version or local installation of + Expat. \end{itemize} From gvanrossum@users.sourceforge.net Fri Jul 12 21:42:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 12 Jul 2002 13:42:31 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv7944 Modified Files: pep-0283.txt Log Message: Let's deprecate the buffer object. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0283.txt 12 Jul 2002 19:51:55 -0000 1.11 --- pep-0283.txt 12 Jul 2002 20:42:29 -0000 1.12 *************** *** 100,105 **** http://www.python.org/sf/560736 (This is done; also for xrange.) ! - Fix the buffer object??? ! http://mail.python.org/pipermail/python-dev/2002-May/023896.html - Lazily tracking tuples? --- 100,106 ---- http://www.python.org/sf/560736 (This is done; also for xrange.) ! - Deprecate the buffer object. ! http://mail.python.org/pipermail/python-dev/2002-July/026388.html ! http://mail.python.org/pipermail/python-dev/2002-July/026408.html - Lazily tracking tuples? From bwarsaw@users.sourceforge.net Fri Jul 12 23:31:50 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 12 Jul 2002 15:31:50 -0700 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,NONE,1.1 pep-0000.txt,1.190,1.191 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5985 Modified Files: pep-0000.txt Added Files: pep-0011.txt Log Message: PEP 11, Unsupported Platforms, Martin von Loewis --- NEW FILE: pep-0011.txt --- (This appears to be a binary file; contents omitted.) Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** pep-0000.txt 23 Jun 2002 23:58:18 -0000 1.190 --- pep-0000.txt 12 Jul 2002 22:31:47 -0000 1.191 *************** *** 40,43 **** --- 40,44 ---- I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw + I 11 Unsupported Platforms von Loewis Other Informational PEPs From bwarsaw@users.sourceforge.net Fri Jul 12 23:32:17 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 12 Jul 2002 15:32:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.191,1.192 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6119 Modified Files: pep-0000.txt Log Message: Oops, add PEP 11 one more place Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.191 retrieving revision 1.192 diff -C2 -d -r1.191 -r1.192 *** pep-0000.txt 12 Jul 2002 22:31:47 -0000 1.191 --- pep-0000.txt 12 Jul 2002 22:32:15 -0000 1.192 *************** *** 177,180 **** --- 177,181 ---- I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw + I 11 Unsupported Platforms von Loewis I 42 Small Feature Requests Hylton From bwarsaw@users.sourceforge.net Sat Jul 13 00:17:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 12 Jul 2002 16:17:02 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.192,1.193 pep-0282.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv17496 Modified Files: pep-0000.txt pep-0282.txt Log Message: Restore Trent Mick as co-author of PEP 282. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.192 retrieving revision 1.193 diff -C2 -d -r1.192 -r1.193 *** pep-0000.txt 12 Jul 2002 22:32:15 -0000 1.192 --- pep-0000.txt 12 Jul 2002 23:17:00 -0000 1.193 *************** *** 91,95 **** S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland ! S 282 A Logging System Sajip I 283 Python 2.3 Release Schedule van Rossum S 284 Integer for-loops Eppstein, Ewing --- 91,95 ---- S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland ! S 282 A Logging System Sajip, Mick I 283 Python 2.3 Release Schedule van Rossum S 284 Integer for-loops Eppstein, Ewing *************** *** 267,271 **** S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland ! S 282 A Logging System Sajip I 283 Python 2.3 Release Schedule van Rossum S 284 Integer for-loops Eppstein, Ewing --- 267,271 ---- S 280 Optimizing access to globals van Rossum S 281 Loop Counter Iteration with range and xrange Hetland ! S 282 A Logging System Sajip, Mick I 283 Python 2.3 Release Schedule van Rossum S 284 Integer for-loops Eppstein, Ewing Index: pep-0282.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0282.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0282.txt 8 Jul 2002 16:50:43 -0000 1.3 --- pep-0282.txt 12 Jul 2002 23:17:00 -0000 1.4 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: vinay_sajip at red-dove.com (Vinay Sajip) Status: Draft Type: Standards Track --- 3,8 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: vinay_sajip at red-dove.com (Vinay Sajip), ! trentm@activestate.com (Trent Mick) Status: Draft Type: Standards Track From bwarsaw@users.sourceforge.net Sat Jul 13 00:21:10 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 12 Jul 2002 16:21:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0292.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv18468 Modified Files: pep-0292.txt Log Message: Added a section containing Guido's list of real issues. Index: pep-0292.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0292.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0292.txt 23 Jun 2002 02:20:50 -0000 1.4 --- pep-0292.txt 12 Jul 2002 23:21:08 -0000 1.5 *************** *** 302,305 **** --- 302,330 ---- + BDFL Weathervane + + Guido lays out[3] what he feels are the real issues that need to + be fleshed out in this PEP: + + - Compile-time vs. run-time parsing. I've become convinced that + the compiler should do the parsing: this is the only way to make + access to variables in nested scopes work, avoids security + issues, and makes it easier to diagnose errors (e.g. in + PyChecker). + + - How to support translation. Here the template must be replaced + at run-time, but it is still desirable that the collection of + available names is known at compile time (to avoid the security + issues). + + - Optional formatting specifiers. I agree with Lalo that these + should not be part of the interpolation syntax but need to be + dealt with at a different level. I think these are only + relevant for numeric data. Funny, there's still a + (now-deprecated) module fpformat.py that supports arbitrary + floating point formatting, and string.zfill() supports a bit of + integer formatting. + + References *************** *** 309,312 **** --- 334,340 ---- [2] Identifiers and Keywords http://www.python.org/doc/current/ref/identifiers.html + + [3] Guido's python-dev posting from 21-Jul-2002 + http://mail.python.org/pipermail/python-dev/2002-July/026397.html From bwarsaw@users.sourceforge.net Sat Jul 13 02:12:42 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 12 Jul 2002 18:12:42 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.193,1.194 pep-0246.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8961 Modified Files: pep-0000.txt pep-0246.txt Log Message: Added Alex Martelli as primary author of PEP 246, with Clark Evans' permission. Retained Clark as secondary author. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.193 retrieving revision 1.194 diff -C2 -d -r1.193 -r1.194 *** pep-0000.txt 12 Jul 2002 23:17:00 -0000 1.193 --- pep-0000.txt 13 Jul 2002 01:12:40 -0000 1.194 *************** *** 324,327 **** --- 324,328 ---- Lielens, Gregory gregory.lielens@fft.be von Loewis, Martin loewis@informatik.hu-berlin.de + Martelli, Alex aleax@aleax.it McMillan, Gordon gmcm@hypernet.com Mick, Trent trentm@activestate.com Index: pep-0246.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0246.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0246.txt 4 Feb 2002 21:09:10 -0000 1.4 --- pep-0246.txt 13 Jul 2002 01:12:40 -0000 1.5 *************** *** 2,6 **** Title: Object Adaptation Version: $Revision$ ! Author: cce@clarkevans.com (Clark C. Evans) Status: Draft Type: Standards Track --- 2,7 ---- Title: Object Adaptation Version: $Revision$ ! Author: aleax@aleax.it (Alex Martelli), ! cce@clarkevans.com (Clark C. Evans) Status: Draft Type: Standards Track From jhylton@users.sourceforge.net Sat Jul 13 04:51:21 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 12 Jul 2002 20:51:21 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.115,2.116 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32107 Modified Files: listobject.c Log Message: Don't declare a function with staticforward. Just declare it static so that lame (BAD_STATIC_FORWARD) compilers don't see a mismatch between the prototype and the function. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.115 retrieving revision 2.116 diff -C2 -d -r2.115 -r2.116 *** listobject.c 11 Jul 2002 21:46:16 -0000 2.115 --- listobject.c 13 Jul 2002 03:51:17 -0000 2.116 *************** *** 1685,1691 **** "list(sequence) -> new list initialized from sequence's items"); ! staticforward PyObject * list_iter(PyObject *seq); ! static PyObject* list_subscript(PyListObject* self, PyObject* item) { --- 1685,1691 ---- "list(sequence) -> new list initialized from sequence's items"); ! static PyObject *list_iter(PyObject *seq); ! static PyObject * list_subscript(PyListObject* self, PyObject* item) { From gvanrossum@users.sourceforge.net Sat Jul 13 15:00:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 13 Jul 2002 07:00:07 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.194,1.195 pep-0283.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26932 Modified Files: pep-0000.txt pep-0283.txt Log Message: Revive PEP 218 (sets) for 2.3. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.194 retrieving revision 1.195 diff -C2 -d -r1.194 -r1.195 *** pep-0000.txt 13 Jul 2002 01:12:40 -0000 1.194 --- pep-0000.txt 13 Jul 2002 14:00:03 -0000 1.195 *************** *** 63,66 **** --- 63,67 ---- S 209 Adding Multidimensional Arrays Barrett, Oliphant S 215 String Interpolation Yee + S 218 Adding a Built-In Set Object Type Wilson S 228 Reworking Python's Numeric Model Zadka, van Rossum S 237 Unifying Long Integers and Integers Zadka, van Rossum *************** *** 147,151 **** SD 213 Attribute Access Handlers Prescod IR 216 Docstring Format Zadka - SD 218 Adding a Built-In Set Object Type Wilson SD 219 Stackless Python McMillan SD 222 Web Library Enhancements Kuchling --- 148,151 ---- *************** *** 203,207 **** IR 216 Docstring Format Zadka SF 217 Display Hook for Interactive Use Zadka ! SD 218 Adding a Built-In Set Object Type Wilson SD 219 Stackless Python McMillan ID 220 Coroutines, Generators, Continuations McMillan --- 203,207 ---- IR 216 Docstring Format Zadka SF 217 Display Hook for Interactive Use Zadka ! S 218 Adding a Built-In Set Object Type Wilson SD 219 Stackless Python McMillan ID 220 Coroutines, Generators, Continuations McMillan Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0283.txt 12 Jul 2002 20:42:29 -0000 1.12 --- pep-0283.txt 13 Jul 2002 14:00:04 -0000 1.13 *************** *** 80,83 **** --- 80,88 ---- I'm all for this plan. I haven't reviewed the implementation. + - PEP 218 Adding a Built-In Set Object Type + + I think it would be good to revive this in some form, using a + module rather than a built-in type. + - A new command line option parser. Greg Ward's Optik (http://optik.sf.net) would fit the bill fine; there's only some From gvanrossum@users.sourceforge.net Sat Jul 13 15:31:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 13 Jul 2002 07:31:56 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4036 Modified Files: longobject.c Log Message: Undef MIN and MAX before defining them, to avoid warnings on certain platforms. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** longobject.c 13 Jun 2002 20:33:01 -0000 1.118 --- longobject.c 13 Jul 2002 14:31:51 -0000 1.119 *************** *** 2004,2007 **** --- 2004,2009 ---- /* Bitwise and/xor/or operations */ + #undef MIN + #undef MAX #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x)) From nnorwitz@users.sourceforge.net Sat Jul 13 15:49:53 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 13 Jul 2002 07:49:53 -0700 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9075 Modified Files: pep-0011.txt Log Message: Fix typo. Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0011.txt 12 Jul 2002 22:31:47 -0000 1.1 --- pep-0011.txt 13 Jul 2002 14:49:50 -0000 1.2 *************** *** 43,47 **** If a certain platform that currently has special code in it is deemed to be without Python users, a note must be posted in this ! PEP that this platform is not longer actively supported. This note must include: --- 43,47 ---- If a certain platform that currently has special code in it is deemed to be without Python users, a note must be posted in this ! PEP that this platform is no longer actively supported. This note must include: From nnorwitz@users.sourceforge.net Sun Jul 14 01:27:28 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 13 Jul 2002 17:27:28 -0700 Subject: [Python-checkins] python/dist/src/Include frameobject.h,2.34,2.35 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28419/Include Modified Files: frameobject.h Log Message: SF patch # 580411, move frame macros from frameobject.h into ceval.c remove unused macros use co alias instead of f->f_code in macros Index: frameobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/frameobject.h,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** frameobject.h 29 Aug 2001 23:45:25 -0000 2.34 --- frameobject.h 14 Jul 2002 00:27:25 -0000 2.35 *************** *** 55,78 **** /* The rest of the interface is specific for frame objects */ - /* Tuple access macros */ - - #ifndef Py_DEBUG - #define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i)) - #define GETITEMNAME(v, i) \ - PyString_AS_STRING((PyStringObject *)GETITEM((v), (i))) - #else - #define GETITEM(v, i) PyTuple_GetItem((v), (i)) - #define GETITEMNAME(v, i) PyString_AsString(GETITEM(v, i)) - #endif - - #define GETUSTRINGVALUE(s) ((unsigned char *)PyString_AS_STRING(s)) - - /* Code access macros */ - - #define Getconst(f, i) (GETITEM((f)->f_code->co_consts, (i))) - #define Getname(f, i) (GETITEMNAME((f)->f_code->co_names, (i))) - #define Getnamev(f, i) (GETITEM((f)->f_code->co_names, (i))) - - /* Block management functions */ --- 55,58 ---- From nnorwitz@users.sourceforge.net Sun Jul 14 01:27:28 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 13 Jul 2002 17:27:28 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.315,2.316 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28419/Python Modified Files: ceval.c Log Message: SF patch # 580411, move frame macros from frameobject.h into ceval.c remove unused macros use co alias instead of f->f_code in macros Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.315 retrieving revision 2.316 diff -C2 -d -r2.315 -r2.316 *** ceval.c 11 Jul 2002 16:56:38 -0000 2.315 --- ceval.c 14 Jul 2002 00:27:26 -0000 2.316 *************** *** 522,530 **** #endif /* Code access macros */ ! #define GETCONST(i) Getconst(f, i) ! #define GETNAME(i) Getname(f, i) ! #define GETNAMEV(i) Getnamev(f, i) #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) --- 522,537 ---- #endif + /* Tuple access macros */ + + #ifndef Py_DEBUG + #define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i)) + #else + #define GETITEM(v, i) PyTuple_GetItem((v), (i)) + #endif + /* Code access macros */ ! #define GETCONST(i) (GETITEM(co->co_consts, (i))) ! #define GETNAMEV(i) (GETITEM(co->co_names, (i))) #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) From loewis@users.sourceforge.net Sun Jul 14 09:21:19 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 14 Jul 2002 01:21:19 -0700 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5455 Modified Files: pep-0011.txt Log Message: Add MS-DOS (proposed by Aahz). Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0011.txt 13 Jul 2002 14:49:50 -0000 1.2 --- pep-0011.txt 14 Jul 2002 08:21:16 -0000 1.3 *************** *** 77,80 **** --- 77,84 ---- Unsupported platforms + Name: MS-DOS, MS-Windows 3.x + Unsupported in: Python 2.0 + Code removed in: Python 2.1 + Name: SunOS 4 Unsupported in: Python 2.3 From tim_one@users.sourceforge.net Sun Jul 14 23:14:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 14 Jul 2002 15:14:21 -0700 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.33,2.34 posixmodule.c,2.241,2.242 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22290/python/Modules Modified Files: _localemodule.c posixmodule.c Log Message: WINDOWS_LEAN_AND_MEAN: There is no such symbol, although a very few MSDN sample programs use it, apparently in error. The correct name is WIN32_LEAN_AND_MEAN. After switching to the correct name, in two cases more was needed because the code actually relied on things that disappear when WIN32_LEAN_AND_MEAN is defined. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -d -r2.33 -r2.34 *** _localemodule.c 30 Jun 2002 15:26:09 -0000 2.33 --- _localemodule.c 14 Jul 2002 22:14:18 -0000 2.34 *************** *** 27,31 **** #if defined(MS_WINDOWS) ! #define WINDOWS_LEAN_AND_MEAN #include #endif --- 27,31 ---- #if defined(MS_WINDOWS) ! #define WIN32_LEAN_AND_MEAN #include #endif Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.241 retrieving revision 2.242 diff -C2 -d -r2.241 -r2.242 *** posixmodule.c 30 Jun 2002 15:26:09 -0000 2.241 --- posixmodule.c 14 Jul 2002 22:14:18 -0000 2.242 *************** *** 218,222 **** #include #include "osdefs.h" ! #define WINDOWS_LEAN_AND_MEAN #include #define popen _popen --- 218,222 ---- #include #include "osdefs.h" ! /* We don't want WIN32_LEAN_AND_MEAN here -- we need ShellExecute(). */ #include #define popen _popen From tim_one@users.sourceforge.net Sun Jul 14 23:14:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 14 Jul 2002 15:14:21 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.164,2.165 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22290/python/Objects Modified Files: fileobject.c Log Message: WINDOWS_LEAN_AND_MEAN: There is no such symbol, although a very few MSDN sample programs use it, apparently in error. The correct name is WIN32_LEAN_AND_MEAN. After switching to the correct name, in two cases more was needed because the code actually relied on things that disappear when WIN32_LEAN_AND_MEAN is defined. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.164 retrieving revision 2.165 diff -C2 -d -r2.164 -r2.165 *** fileobject.c 30 Jun 2002 15:26:09 -0000 2.164 --- fileobject.c 14 Jul 2002 22:14:19 -0000 2.165 *************** *** 13,17 **** /* can simulate truncate with Win32 API functions; see file_truncate */ #define HAVE_FTRUNCATE ! #define WINDOWS_LEAN_AND_MEAN #include #endif --- 13,17 ---- /* can simulate truncate with Win32 API functions; see file_truncate */ #define HAVE_FTRUNCATE ! #define WIN32_LEAN_AND_MEAN #include #endif From tim_one@users.sourceforge.net Sun Jul 14 23:14:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 14 Jul 2002 15:14:21 -0700 Subject: [Python-checkins] python/dist/src/PC w9xpopen.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv22290/python/PC Modified Files: w9xpopen.c Log Message: WINDOWS_LEAN_AND_MEAN: There is no such symbol, although a very few MSDN sample programs use it, apparently in error. The correct name is WIN32_LEAN_AND_MEAN. After switching to the correct name, in two cases more was needed because the code actually relied on things that disappear when WIN32_LEAN_AND_MEAN is defined. Index: w9xpopen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/w9xpopen.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** w9xpopen.c 15 Apr 2002 22:57:46 -0000 1.4 --- w9xpopen.c 14 Jul 2002 22:14:19 -0000 1.5 *************** *** 15,21 **** */ ! #define WINDOWS_LEAN_AND_MEAN #include #include const char *usage = --- 15,22 ---- */ ! #define WIN32_LEAN_AND_MEAN #include #include + #include /* for malloc and its friends */ const char *usage = From mhammond@users.sourceforge.net Mon Jul 15 00:12:31 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sun, 14 Jul 2002 16:12:31 -0700 Subject: [Python-checkins] python/dist/src/Parser myreadline.c,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv1634 Modified Files: myreadline.c Log Message: Fix bug 439992 - [win32] KeyboardInterrupt Not Caught. This gets us closer to consistent Ctrl+C behaviour on NT and Win9x. NT now reliably generates KeyboardInterrupt exceptions for NT when a file IO operation was aborted. Bugfix candidate Index: myreadline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/myreadline.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** myreadline.c 2 Mar 2001 06:29:51 -0000 2.26 --- myreadline.c 14 Jul 2002 23:12:29 -0000 2.27 *************** *** 11,14 **** --- 11,18 ---- #include "Python.h" + #ifdef MS_WINDOWS + #define WIN32_LEAN_AND_MEAN + #include "windows.h" + #endif /* MS_WINDOWS */ int (*PyOS_InputHook)(void) = NULL; *************** *** 32,35 **** --- 36,68 ---- if (p != NULL) return 0; /* No error */ + #ifdef MS_WINDOWS + /* In the case of a Ctrl+C or some other external event + interrupting the operation: + Win2k/NT: ERROR_OPERATION_ABORTED is the most recent Win32 + error code (and feof() returns TRUE). + Win9x: Ctrl+C seems to have no effect on fgets() returning + early - the signal handler is called, but the fgets() + only returns "normally" (ie, when Enter hit or feof()) + */ + if (GetLastError()==ERROR_OPERATION_ABORTED) { + /* Signals come asynchronously, so we sleep a brief + moment before checking if the handler has been + triggered (we cant just return 1 before the + signal handler has been called, as the later + signal may be treated as a separate interrupt). + */ + Sleep(1); + if (PyOS_InterruptOccurred()) { + return 1; /* Interrupt */ + } + /* Either the sleep wasn't long enough (need a + short loop retrying?) or not interrupted at all + (in which case we should revisit the whole thing!) + Logging some warning would be nice. assert is not + viable as under the debugger, the various dialogs + mean the condition is not true. + */ + } + #endif /* MS_WINDOWS */ if (feof(fp)) { return -1; /* EOF */ From mhammond@users.sourceforge.net Mon Jul 15 00:28:18 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Sun, 14 Jul 2002 16:28:18 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.242,2.243 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv4838 Modified Files: posixmodule.c Log Message: Fix bug 231273 - [windows] os.popen doens't kill subprocess when interrupted Don't pass CREATE_NEW_CONSOLE to CreateProcess(), meaning our child process is in the same "console group" and therefore interrupted by the same Ctrl+C that interrupts the parent. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.242 retrieving revision 2.243 diff -C2 -d -r2.242 -r2.243 *** posixmodule.c 14 Jul 2002 22:14:18 -0000 2.242 --- posixmodule.c 14 Jul 2002 23:28:16 -0000 2.243 *************** *** 3292,3296 **** NULL, TRUE, ! CREATE_NEW_CONSOLE, NULL, NULL, --- 3292,3296 ---- NULL, TRUE, ! 0, /* no new console so Ctrl+C kills child too */ NULL, NULL, From tim.one@comcast.net Mon Jul 15 01:09:18 2002 From: tim.one@comcast.net (Tim Peters) Date: Sun, 14 Jul 2002 20:09:18 -0400 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.242,2.243 In-Reply-To: Message-ID: [mhammond@users.sourceforge.net] > Modified Files: > posixmodule.c > Log Message: > Fix bug 231273 - [windows] os.popen doens't kill subprocess when > interrupted > > Don't pass CREATE_NEW_CONSOLE to CreateProcess(), meaning our > child process is in the same "console group" and therefore > interrupted by the same Ctrl+C that interrupts the parent. Do you consider this to be a bugfix candidate? From mhammond@skippinet.com.au Mon Jul 15 01:23:36 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Mon, 15 Jul 2002 10:23:36 +1000 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.242,2.243 In-Reply-To: Message-ID: > [mhammond@users.sourceforge.net] > > Modified Files: > > posixmodule.c > > Log Message: > > Fix bug 231273 - [windows] os.popen doens't kill subprocess when > > interrupted > > > > Don't pass CREATE_NEW_CONSOLE to CreateProcess(), meaning our > > child process is in the same "console group" and therefore > > interrupted by the same Ctrl+C that interrupts the parent. > > Do you consider this to be a bugfix candidate? Sorry - I meant to add this to the checkin message. This could be considered a low-priority bug fix - but as the behaviour has been "broken" ever since popen() appeared on Windows, and no one else has reported it, I don't think anyone would notice if it never made earlier versions. Mark. From bwarsaw@users.sourceforge.net Mon Jul 15 03:47:08 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 14 Jul 2002 19:47:08 -0700 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9725 Modified Files: pep-0263.txt Log Message: Typo Index: pep-0263.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0263.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0263.txt 19 Apr 2002 17:32:14 -0000 1.12 --- pep-0263.txt 15 Jul 2002 02:47:06 -0000 1.13 *************** *** 137,141 **** Scope ! This PEP intends to provide an upgrade path from th current (more-or-less) undefined source code encoding situation to a more robust and portable definition. --- 137,141 ---- Scope ! This PEP intends to provide an upgrade path from the current (more-or-less) undefined source code encoding situation to a more robust and portable definition. From tim_one@users.sourceforge.net Mon Jul 15 06:16:15 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 14 Jul 2002 22:16:15 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.186,1.187 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2860/Misc Modified Files: ACKS Log Message: docompare(): Another reasonable optimization from Jonathan Hogg for the explicit comparison function case: use PyObject_Call instead of PyEval_CallObject. Same thing in context, but gives a 2.4% overall speedup when sorting a list of ints via list.sort(__builtin__.cmp). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** ACKS 12 Jul 2002 13:13:28 -0000 1.186 --- ACKS 15 Jul 2002 05:16:13 -0000 1.187 *************** *** 214,217 **** --- 214,218 ---- Chris Hoffman Albert Hofkamp + Jonathan Hogg Gerrit Holl Philip Homburg From tim_one@users.sourceforge.net Mon Jul 15 06:16:15 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 14 Jul 2002 22:16:15 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.116,2.117 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2860/Objects Modified Files: listobject.c Log Message: docompare(): Another reasonable optimization from Jonathan Hogg for the explicit comparison function case: use PyObject_Call instead of PyEval_CallObject. Same thing in context, but gives a 2.4% overall speedup when sorting a list of ints via list.sort(__builtin__.cmp). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -d -r2.116 -r2.117 *** listobject.c 13 Jul 2002 03:51:17 -0000 2.116 --- listobject.c 15 Jul 2002 05:16:13 -0000 2.117 *************** *** 781,785 **** PyTuple_SET_ITEM(args, 0, x); PyTuple_SET_ITEM(args, 1, y); ! res = PyEval_CallObject(compare, args); Py_DECREF(args); if (res == NULL) --- 781,785 ---- PyTuple_SET_ITEM(args, 0, x); PyTuple_SET_ITEM(args, 1, y); ! res = PyObject_Call(compare, args, NULL); Py_DECREF(args); if (res == NULL) From fredrik@pythonware.com Mon Jul 15 11:59:21 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Mon, 15 Jul 2002 12:59:21 +0200 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.33,2.34 posixmodule.c,2.241,2.242 References: Message-ID: <004801c22bee$af75d0e0$0900a8c0@spiff> > #include > #include "osdefs.h" > ! /* We don't want WIN32_LEAN_AND_MEAN here -- we need ShellExecute(). = */ > #include > #define popen _popen hmm. my copy of the the ShellExecute docs tells you to explicitly include if you want to use that function... From aimacintyre@users.sourceforge.net Mon Jul 15 13:03:21 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 15 Jul 2002 05:03:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_longexp.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22993 Modified Files: test_longexp.py Log Message: Tim_one's change to aggressively overallocate nodes when adding child nodes (in Parser/node.c) resolves the gross memory consumption exhibited by the EMX runtime on OS/2, so the test should be exercised on this platform. Index: test_longexp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_longexp.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_longexp.py 8 Jul 2002 10:07:25 -0000 1.7 --- test_longexp.py 15 Jul 2002 12:03:19 -0000 1.8 *************** *** 1,12 **** - # this test has a malloc problem on OS/2+EMX, so skip test in that environment - - import sys - from test_support import TestFailed, TestSkipped REPS = 65580 ! if sys.platform == "os2emx": ! raise TestFailed, "OS/2+EMX port has malloc problems with long expressions" ! else: ! l = eval("[" + "2," * REPS + "]") ! print len(l) --- 1,5 ---- REPS = 65580 ! l = eval("[" + "2," * REPS + "]") ! print len(l) From tim@zope.com Mon Jul 15 17:02:06 2002 From: tim@zope.com (Tim Peters) Date: Mon, 15 Jul 2002 12:02:06 -0400 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.33,2.34 posixmodule.c,2.241,2.242 In-Reply-To: <004801c22bee$af75d0e0$0900a8c0@spiff> Message-ID: [Fredrik Lundh] > hmm. my copy of the the ShellExecute docs tells you to explicitly > include if you want to use that function... Thanks! Mine don't. Now that I know the answer, the only places that mention those two on the same page are two old articles in the Periodicals section of the CD. I blame Fred for this . From gvanrossum@users.sourceforge.net Mon Jul 15 17:08:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 15 Jul 2002 09:08:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5236 Modified Files: libsys.tex Log Message: Clarify that the description of sys.path[0] is only valid upon program start-up. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** libsys.tex 27 Mar 2002 17:29:50 -0000 1.58 --- libsys.tex 15 Jul 2002 16:08:10 -0000 1.59 *************** *** 283,290 **** \indexiii{module}{search}{path} A list of strings that specifies the search path for modules. ! Initialized from the environment variable \envvar{PYTHONPATH}, or an installation-dependent default. ! The first item of this list, \code{path[0]}, is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the --- 283,291 ---- \indexiii{module}{search}{path} A list of strings that specifies the search path for modules. ! Initialized from the environment variable \envvar{PYTHONPATH}, plus an installation-dependent default. ! As initialized upon program startup, ! the first item of this list, \code{path[0]}, is the directory containing the script that was used to invoke the Python interpreter. If the script directory is not available (e.g. if the *************** *** 294,297 **** --- 295,300 ---- that the script directory is inserted \emph{before} the entries inserted as a result of \envvar{PYTHONPATH}. + + A program is free to modify this list for its own purposes. \end{datadesc} From tim_one@users.sourceforge.net Mon Jul 15 17:10:57 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 15 Jul 2002 09:10:57 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.243,2.244 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5833/python/Modules Modified Files: posixmodule.c Log Message: /F revealed that ShellExecute() only requires shellapi.h, not the full-blown windows.h, so changed accordingly. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.243 retrieving revision 2.244 diff -C2 -d -r2.243 -r2.244 *** posixmodule.c 14 Jul 2002 23:28:16 -0000 2.243 --- posixmodule.c 15 Jul 2002 16:10:55 -0000 2.244 *************** *** 218,223 **** #include #include "osdefs.h" ! /* We don't want WIN32_LEAN_AND_MEAN here -- we need ShellExecute(). */ #include #define popen _popen #define pclose _pclose --- 218,224 ---- #include #include "osdefs.h" ! #define WIN32_LEAN_AND_MEAN #include + #include /* for ShellExecute() */ #define popen _popen #define pclose _pclose From tim_one@users.sourceforge.net Mon Jul 15 17:13:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 15 Jul 2002 09:13:08 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.187,1.188 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv6731/python/Misc Modified Files: ACKS Log Message: Added Andrew MacIntyre -- overdue! Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** ACKS 15 Jul 2002 05:16:13 -0000 1.187 --- ACKS 15 Jul 2002 16:13:06 -0000 1.188 *************** *** 296,301 **** Jim Lynch Mikael Lyngvig ! Nick Maclaren Tim MacKenzie Steve Majewski Grzegorz Makarewicz --- 296,302 ---- Jim Lynch Mikael Lyngvig ! Andrew I MacIntyre Tim MacKenzie + Nick Maclaren Steve Majewski Grzegorz Makarewicz From tim_one@users.sourceforge.net Mon Jul 15 18:58:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 15 Jul 2002 10:58:06 -0700 Subject: [Python-checkins] python/dist/src/Parser node.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv3757/python/Parser Modified Files: node.c Log Message: XXXROUNDUP(): Turns out this fixed Andrew MacIntyre's memory-mgmt disaster too, so this change is here to stay. Beefed up the comments and added some stats Andrew reported. Also a small change to the macro body, to make it obvious how XXXROUNDUP(0) ends up returning 0. See SF patch 578297 for context. Not a bugfix candidate, as the functional changes here have already been backported to the 2.2 line (this patch just improves clarity). Index: node.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/node.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** node.c 8 Jul 2002 19:11:07 -0000 2.18 --- node.c 15 Jul 2002 17:58:03 -0000 2.19 *************** *** 35,53 **** /* A gimmick to make massive numbers of reallocs quicker. The result is ! * a number >= the input. For n=0 we must return 0. ! * For n=1, we return 1, to avoid wasting memory in common 1-child nodes ! * (XXX are those actually common?). ! * Else for n <= 128, round up to the closest multiple of 4. Why 4? ! * Rounding up to a multiple of an exact power of 2 is very efficient. ! * Else call fancy_roundup() to grow proportionately to n. We've got an * extreme case then (like test_longexp.py), and on many platforms doing * anything less than proportional growth leads to exorbitant runtime * (e.g., MacPython), or extreme fragmentation of user address space (e.g., * Win98). ! * This would be straightforward if a node stored its current capacity. The ! * code is tricky to avoid that. */ ! #define XXXROUNDUP(n) ((n) == 1 ? 1 : \ ! (n) <= 128 ? (((n) + 3) & ~3) : \ fancy_roundup(n)) --- 35,76 ---- /* A gimmick to make massive numbers of reallocs quicker. The result is ! * a number >= the input. In PyNode_AddChild, it's used like so, when ! * we're about to add child number current_size + 1: ! * ! * if XXXROUNDUP(current_size) < XXXROUNDUP(current_size + 1): ! * allocate space for XXXROUNDUP(current_size + 1) total children ! * else: ! * we already have enough space ! * ! * Since a node starts out empty, we must have ! * ! * XXXROUNDUP(0) < XXXROUNDUP(1) ! * ! * so that we allocate space for the first child. One-child nodes are very ! * common (presumably that would change if we used a more abstract form ! * of syntax tree), so to avoid wasting memory it's desirable that ! * XXXROUNDUP(1) == 1. That in turn forces XXXROUNDUP(0) == 0. ! * ! * Else for 2 <= n <= 128, we round up to the closest multiple of 4. Why 4? ! * Rounding up to a multiple of an exact power of 2 is very efficient, and ! * most nodes with more than one child have <= 4 kids. ! * ! * Else we call fancy_roundup() to grow proportionately to n. We've got an * extreme case then (like test_longexp.py), and on many platforms doing * anything less than proportional growth leads to exorbitant runtime * (e.g., MacPython), or extreme fragmentation of user address space (e.g., * Win98). ! * ! * In a run of compileall across the 2.3a0 Lib directory, Andrew MacIntyre ! * reported that, with this scheme, 89% of PyMem_RESIZE calls in ! * PyNode_AddChild passed 1 for the size, and 9% passed 4. So this usually ! * wastes very little memory, but is very effective at sidestepping ! * platform-realloc disasters on vulnernable platforms. ! * ! * Note that this would be straightforward if a node stored its current ! * capacity. The code is tricky to avoid that. */ ! #define XXXROUNDUP(n) ((n) <= 1 ? (n) : \ ! (n) <= 128 ? (((n) + 3) & ~3) : \ fancy_roundup(n)) From loewis@users.sourceforge.net Mon Jul 15 19:26:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 15 Jul 2002 11:26:55 -0700 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv15389 Modified Files: pep-0011.txt Log Message: Change title. Proposed by /F. Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0011.txt 14 Jul 2002 08:21:16 -0000 1.3 --- pep-0011.txt 15 Jul 2002 18:26:52 -0000 1.4 *************** *** 1,4 **** PEP: 11 ! Title: Unsupported Platforms Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 11 ! Title: Removing support for little used platforms Version: $Revision$ Last-Modified: $Date$ *************** *** 75,79 **** ! Unsupported platforms Name: MS-DOS, MS-Windows 3.x --- 75,79 ---- ! No-longer-supported platforms Name: MS-DOS, MS-Windows 3.x From bwarsaw@users.sourceforge.net Mon Jul 15 19:37:28 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 15 Jul 2002 11:37:28 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.195,1.196 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv18877 Modified Files: pep-0000.txt Log Message: Update title of PEP 11 Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.195 retrieving revision 1.196 diff -C2 -d -r1.195 -r1.196 *** pep-0000.txt 13 Jul 2002 14:00:03 -0000 1.195 --- pep-0000.txt 15 Jul 2002 18:37:26 -0000 1.196 *************** *** 40,44 **** I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw ! I 11 Unsupported Platforms von Loewis Other Informational PEPs --- 40,44 ---- I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw ! I 11 Removing support for little used platforms von Loewis Other Informational PEPs *************** *** 177,181 **** I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw ! I 11 Unsupported Platforms von Loewis I 42 Small Feature Requests Hylton --- 177,181 ---- I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw ! I 11 Removing support for little used platforms von Loewis I 42 Small Feature Requests Hylton From bwarsaw@users.sourceforge.net Mon Jul 15 20:53:30 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 15 Jul 2002 12:53:30 -0700 Subject: [Python-checkins] python/dist/src/Tools/world world,3.15,3.16 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/world In directory usw-pr-cvs1:/tmp/cvs-serv13310 Modified Files: world Log Message: Added the "weird" ccTLDs ac, gg, im, and je. These are not recognized by ISO 3166 as country codes, but the are reserved by IANA nonetheless. The commonly used uk ccTLD is part of this group, near as I can tell. Index: world =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/world/world,v retrieving revision 3.15 retrieving revision 3.16 diff -C2 -d -r3.15 -r3.16 *** world 7 Jun 2002 15:48:52 -0000 3.15 --- world 15 Jul 2002 19:53:28 -0000 3.16 *************** *** 45,50 **** Friday, 5 April 2002, 12.00 CET 2002 ! This script also knows about non-geographic top-level domains. ! Usage: %(PROGRAM)s [-d] [-p file] [-o] [-h] addr [addr ...] --- 45,50 ---- Friday, 5 April 2002, 12.00 CET 2002 ! This script also knows about non-geographic top-level domains, and the ! additional ccTLDs reserved by IANA. Usage: %(PROGRAM)s [-d] [-p file] [-o] [-h] addr [addr ...] *************** *** 273,279 **** "org": "non-commercial", "pro": "professionals", ! # This isn't in the same class as those above, but is included here ! # because `uk' is the common practice country code for the United Kingdom. ! # AFAICT, the official `gb' code is routinely ignored! # # tells me that `uk' was long in use before ISO3166 --- 273,285 ---- "org": "non-commercial", "pro": "professionals", ! # These additional ccTLDs are included here even though they are not part ! # of ISO 3166. IANA has 5 reserved ccTLDs as described here: ! # ! # http://www.iso.org/iso/en/prods-services/iso3166ma/04background-on-iso-3166/iso3166-1-and-ccTLDs.html ! # ! # but I can't find an official list anywhere. ! # ! # Note that `uk' is the common practice country code for the United ! # Kingdom. AFAICT, the official `gb' code is routinely ignored! # # tells me that `uk' was long in use before ISO3166 *************** *** 284,287 **** --- 290,299 ---- # # See + # + # Also, `su', while obsolete is still in limited use. + "ac": "Ascension Island", + "gg": "Guernsey", + "im": "Isle of Man", + "je": "Jersey", "uk": "United Kingdom (common practice)", "su": "Soviet Union (still in limited use)", From mhammond@users.sourceforge.net Tue Jul 16 02:29:21 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 15 Jul 2002 18:29:21 -0700 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.128,2.129 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18190 Modified Files: timemodule.c Log Message: Fix bug 581232 - [Windows] Can not interrupt time.sleep() time.sleep() will now be interrupted on the main thread when Ctrl+C is pressed. Other threads are never interrupted. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.128 retrieving revision 2.129 diff -C2 -d -r2.128 -r2.129 *** timemodule.c 30 Jun 2002 15:26:09 -0000 2.128 --- timemodule.c 16 Jul 2002 01:29:19 -0000 2.129 *************** *** 29,33 **** --- 29,50 ---- #else #ifdef MS_WINDOWS + #define WIN32_LEAN_AND_MEAN #include + #include "pythread.h" + + /* helper to allow us to interrupt sleep() on Windows*/ + static HANDLE hInterruptEvent = NULL; + static BOOL WINAPI PyCtrlHandler(DWORD dwCtrlType) + { + SetEvent(hInterruptEvent); + /* allow other default handlers to be called. + Default Python handler will setup the + KeyboardInterrupt exception. + */ + return FALSE; + } + static long main_thread; + + #if defined(__BORLANDC__) /* These overrides not needed for Win32 */ *************** *** 681,685 **** #endif /* __CYGWIN__ */ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ ! PyStructSequence_InitType(&StructTimeType, &struct_time_type_desc); Py_INCREF(&StructTimeType); --- 698,710 ---- #endif /* __CYGWIN__ */ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ ! #ifdef MS_WINDOWS ! /* Helper to allow interrupts for Windows. ! If Ctrl+C event delivered while not sleeping ! it will be ignored. ! */ ! main_thread = PyThread_get_thread_ident(); ! hInterruptEvent = CreateEvent(NULL, TRUE, FALSE, NULL); ! SetConsoleCtrlHandler( PyCtrlHandler, TRUE); ! #endif /* MS_WINDOWS */ PyStructSequence_InitType(&StructTimeType, &struct_time_type_desc); Py_INCREF(&StructTimeType); *************** *** 776,782 **** return -1; } - /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS ! Sleep((unsigned long)millisecs); Py_END_ALLOW_THREADS } --- 801,825 ---- return -1; } Py_BEGIN_ALLOW_THREADS ! /* allow sleep(0) to maintain win32 semantics, and as decreed by ! Guido, only the main thread can be interrupted. */ ! if ((unsigned long)millisecs==0 || main_thread != PyThread_get_thread_ident()) ! Sleep((unsigned long)millisecs); ! else { ! DWORD rc; ! ResetEvent(hInterruptEvent); ! rc = WaitForSingleObject(hInterruptEvent, (unsigned long)millisecs); ! if (rc==WAIT_OBJECT_0) { ! /* yield to make sure real Python signal handler called */ ! Sleep(1); ! Py_BLOCK_THREADS ! /* PyErr_SetFromErrno() does the "right thing" wrt signals ! if errno=EINTR ! */ ! errno = EINTR; ! PyErr_SetFromErrno(PyExc_IOError); ! return -1; ! } ! } Py_END_ALLOW_THREADS } From mhammond@users.sourceforge.net Tue Jul 16 02:32:32 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 15 Jul 2002 18:32:32 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.440,1.441 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19075 Modified Files: NEWS Log Message: Add a blurb on the 3 Windows bugs I worked on over the last couple of days. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.440 retrieving revision 1.441 diff -C2 -d -r1.440 -r1.441 *** NEWS 12 Jul 2002 14:40:04 -0000 1.440 --- NEWS 16 Jul 2002 01:32:30 -0000 1.441 *************** *** 7,10 **** --- 7,18 ---- Core and builtins + - Ctrl+C handling on Windows has been made more consistent with + other platforms. KeyboardInterrupt can now reliably be caught, + and Ctrl+C at an interative prompt no longer terminates the + process under NT/2k/XP (it never did under Win9x). Ctrl+C will + interrupt time.sleep() in the main thread, and any child processes + created via the popen family are also interrupted (as generally + happens on for Linux/Unix). [SF bugs 231273, 439992 and 581232] + - Slices and repetitions of buffer objects now consistently return a string. Formerly, strings would be returned most of the time, From gvanrossum@users.sourceforge.net Tue Jul 16 15:30:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 07:30:31 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.158,2.159 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8795 Modified Files: typeobject.c Log Message: valid_identifier(): use an unsigned char* so that isalpha() will do the right thing even if char is unsigned. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.158 retrieving revision 2.159 diff -C2 -d -r2.158 -r2.159 *** typeobject.c 11 Jul 2002 06:23:50 -0000 2.158 --- typeobject.c 16 Jul 2002 14:30:28 -0000 2.159 *************** *** 963,967 **** valid_identifier(PyObject *s) { ! char *p; int i, n; --- 963,967 ---- valid_identifier(PyObject *s) { ! unsigned char *p; int i, n; *************** *** 971,975 **** return 0; } ! p = PyString_AS_STRING(s); n = PyString_GET_SIZE(s); /* We must reject an empty name. As a hack, we bump the --- 971,975 ---- return 0; } ! p = (unsigned char *) PyString_AS_STRING(s); n = PyString_GET_SIZE(s); /* We must reject an empty name. As a hack, we bump the From bwarsaw@users.sourceforge.net Tue Jul 16 16:56:31 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 16 Jul 2002 08:56:31 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.22,4.23 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv6017 Modified Files: python-mode.el Log Message: (py-pychecker-run): Thomas Heller points out that this function messes up the compile command's history. Fix that by using compile-internal. Fixes SF bug # 580631 Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.22 retrieving revision 4.23 diff -C2 -d -r4.22 -r4.23 *** python-mode.el 23 May 2002 19:42:16 -0000 4.22 --- python-mode.el 16 Jul 2002 15:56:28 -0000 4.23 *************** *** 2773,2779 **** (read-shell-command "Run pychecker like this: " default ! py-pychecker-history)))) (save-some-buffers (not py-ask-about-save) nil) ! (compile command)) --- 2773,2779 ---- (read-shell-command "Run pychecker like this: " default ! 'py-pychecker-history)))) (save-some-buffers (not py-ask-about-save) nil) ! (compile-internal command "No more errors")) From gvanrossum@users.sourceforge.net Tue Jul 16 16:56:54 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 08:56:54 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.117,2.118 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6189 Modified Files: listobject.c Log Message: Make list_iter() really static. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.117 retrieving revision 2.118 diff -C2 -d -r2.117 -r2.118 *** listobject.c 15 Jul 2002 05:16:13 -0000 2.117 --- listobject.c 16 Jul 2002 15:56:52 -0000 2.118 *************** *** 2022,2026 **** PyTypeObject PyListIter_Type; ! PyObject * list_iter(PyObject *seq) { --- 2022,2026 ---- PyTypeObject PyListIter_Type; ! static PyObject * list_iter(PyObject *seq) { From bwarsaw@users.sourceforge.net Tue Jul 16 17:04:15 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 16 Jul 2002 09:04:15 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.23,4.24 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8823 Modified Files: python-mode.el Log Message: (py-imenu-create-index-function): Skip over stuff that looks like code but which is in a comment or string. Closes SF bug # 572341 reported by Adrian van den Dries. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.23 retrieving revision 4.24 diff -C2 -d -r4.23 -r4.24 *** python-mode.el 16 Jul 2002 15:56:28 -0000 4.23 --- python-mode.el 16 Jul 2002 16:04:13 -0000 4.24 *************** *** 946,949 **** --- 946,951 ---- ;; or shallower indentation (cond + ;; Skip code in comments and strings + ((py-in-literal)) ;; at the same indent level, add it to the list... ((= start-indent cur-indent) From tim_one@users.sourceforge.net Tue Jul 16 20:31:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:31:00 -0700 Subject: [Python-checkins] python/dist/src/Lib atexit.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13334/python/Lib Modified Files: atexit.py Log Message: The atexit module effectively turned itself off if sys.exitfunc already existed at the time atexit first got imported. That's a bug, and this fixes it. Also reworked test_atexit.py to test for this too, and to stop using an "expected output" file, and to test what actually happens at exit instead of just simulating what it thinks atexit will do at exit. Bugfix candidate, but it's messy so I'll backport to 2.2 myself. Index: atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** atexit.py 21 Jan 2001 03:40:37 -0000 1.4 --- atexit.py 16 Jul 2002 19:30:58 -0000 1.5 *************** *** 30,42 **** import sys ! try: ! x = sys.exitfunc ! except AttributeError: ! sys.exitfunc = _run_exitfuncs ! else: ! # if x isn't our own exit func executive, assume it's another ! # registered exit function - append it to our list... ! if x != _run_exitfuncs: ! register(x) del sys --- 30,38 ---- import sys ! if hasattr(sys, "exitfunc"): ! # Assume it's another registered exit function - append it to our list ! register(sys.exitfunc) ! sys.exitfunc = _run_exitfuncs ! del sys From tim_one@users.sourceforge.net Tue Jul 16 20:31:01 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:31:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13334/python/Lib/test Modified Files: test_atexit.py Log Message: The atexit module effectively turned itself off if sys.exitfunc already existed at the time atexit first got imported. That's a bug, and this fixes it. Also reworked test_atexit.py to test for this too, and to stop using an "expected output" file, and to test what actually happens at exit instead of just simulating what it thinks atexit will do at exit. Bugfix candidate, but it's messy so I'll backport to 2.2 myself. Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_atexit.py 17 Jan 2001 21:51:35 -0000 1.3 --- test_atexit.py 16 Jul 2002 19:30:58 -0000 1.4 *************** *** 1,4 **** ! # Test the exit module ! from test_support import verbose import atexit --- 1,8 ---- ! # Test the atexit module. ! from test_support import TESTFN, vereq ! import atexit ! import os ! ! input = """\ import atexit *************** *** 9,24 **** print "handler2", args, kargs - # save any exit functions that may have been registered as part of the - # test framework - _exithandlers = atexit._exithandlers - atexit._exithandlers = [] - atexit.register(handler1) atexit.register(handler2) atexit.register(handler2, 7, kw="abc") ! # simulate exit behavior by calling atexit._run_exitfuncs directly... ! atexit._run_exitfuncs() ! # restore exit handlers ! atexit._exithandlers = _exithandlers --- 13,61 ---- print "handler2", args, kargs atexit.register(handler1) atexit.register(handler2) atexit.register(handler2, 7, kw="abc") + """ ! fname = TESTFN + ".py" ! f = file(fname, "w") ! f.write(input) ! f.close() ! p = os.popen("python " + fname) ! output = p.read() ! p.close() ! vereq(output, """\ ! handler2 (7,) {'kw': 'abc'} ! handler2 () {} ! handler1 ! """) ! ! input = """\ ! def direct(): ! print "direct exit" ! ! import sys ! sys.exitfunc = direct ! ! # Make sure atexit doesn't drop ! def indirect(): ! print "indirect exit" ! ! import atexit ! atexit.register(indirect) ! """ ! ! f = file(fname, "w") ! f.write(input) ! f.close() ! ! p = os.popen("python " + fname) ! output = p.read() ! p.close() ! vereq(output, """\ ! indirect exit ! direct exit ! """) ! ! os.unlink(fname) From tim_one@users.sourceforge.net Tue Jul 16 20:31:02 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:31:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_atexit,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv13334/python/Lib/test/output Removed Files: test_atexit Log Message: The atexit module effectively turned itself off if sys.exitfunc already existed at the time atexit first got imported. That's a bug, and this fixes it. Also reworked test_atexit.py to test for this too, and to stop using an "expected output" file, and to test what actually happens at exit instead of just simulating what it thinks atexit will do at exit. Bugfix candidate, but it's messy so I'll backport to 2.2 myself. --- test_atexit DELETED --- From jhylton@users.sourceforge.net Tue Jul 16 20:39:42 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:39:42 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.159,2.160 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18141 Modified Files: typeobject.c Log Message: The object returned by tp_new() may not have a tp_init. If the object is an ExtensionClass, for example, the slot is not even defined. So we must check that the type has the slot (implied by HAVE_CLASS) before calling tp_init(). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** typeobject.c 16 Jul 2002 14:30:28 -0000 2.159 --- typeobject.c 16 Jul 2002 19:39:38 -0000 2.160 *************** *** 200,204 **** return obj; type = obj->ob_type; ! if (type->tp_init != NULL && type->tp_init(obj, args, kwds) < 0) { Py_DECREF(obj); --- 200,205 ---- return obj; type = obj->ob_type; ! if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS) && ! type->tp_init != NULL && type->tp_init(obj, args, kwds) < 0) { Py_DECREF(obj); From jhylton@users.sourceforge.net Tue Jul 16 20:42:24 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:42:24 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.19,2.126.4.20 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19225 Modified Files: Tag: release22-maint typeobject.c Log Message: The object returned by tp_new() may not have a tp_init. If the object is an ExtensionClass, for example, the slot is not even defined. So we must check that the type has the slot (implied by HAVE_CLASS) before calling tp_init(). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.19 retrieving revision 2.126.4.20 diff -C2 -d -r2.126.4.19 -r2.126.4.20 *** typeobject.c 11 Jul 2002 07:06:44 -0000 2.126.4.19 --- typeobject.c 16 Jul 2002 19:42:21 -0000 2.126.4.20 *************** *** 191,195 **** return obj; type = obj->ob_type; ! if (type->tp_init != NULL && type->tp_init(obj, args, kwds) < 0) { Py_DECREF(obj); --- 191,196 ---- return obj; type = obj->ob_type; ! if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS) && ! type->tp_init != NULL && type->tp_init(obj, args, kwds) < 0) { Py_DECREF(obj); From jhylton@users.sourceforge.net Tue Jul 16 20:47:45 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:47:45 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.88,2.89 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20531/Modules Modified Files: cPickle.c Log Message: Given the persistent id code a shot at a class before calling save_global(). Some persistent picklers (well, probably, the *only* persistent pickler) would like to pickle some classes in a special way. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -d -r2.88 -r2.89 *** cPickle.c 11 Jul 2002 22:02:33 -0000 2.88 --- cPickle.c 16 Jul 2002 19:47:43 -0000 2.89 *************** *** 2016,2024 **** } - if (PyType_IsSubtype(type, &PyType_Type)) { - res = save_global(self, args, NULL); - goto finally; - } - if (!pers_save && self->inst_pers_func) { if ((tmp = save_pers(self, args, self->inst_pers_func)) != 0) { --- 2016,2019 ---- *************** *** 2026,2029 **** --- 2021,2029 ---- goto finally; } + } + + if (PyType_IsSubtype(type, &PyType_Type)) { + res = save_global(self, args, NULL); + goto finally; } From jhylton@users.sourceforge.net Tue Jul 16 20:47:45 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:47:45 -0700 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20531/Lib Modified Files: pickle.py Log Message: Given the persistent id code a shot at a class before calling save_global(). Some persistent picklers (well, probably, the *only* persistent pickler) would like to pickle some classes in a special way. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** pickle.py 30 Jun 2002 03:39:14 -0000 1.67 --- pickle.py 16 Jul 2002 19:47:43 -0000 1.68 *************** *** 214,217 **** --- 214,222 ---- f = self.dispatch[t] except KeyError: + pid = self.inst_persistent_id(object) + if pid is not None: + self.save_pers(pid) + return + try: issc = issubclass(t, TypeType) *************** *** 220,228 **** if issc: self.save_global(object) - return - - pid = self.inst_persistent_id(object) - if pid is not None: - self.save_pers(pid) return --- 225,228 ---- From gvanrossum@users.sourceforge.net Tue Jul 16 20:53:41 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 12:53:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.99,1.100 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22868 Modified Files: libstdtypes.tex Log Message: Record the decision that StopIteration is a sink state (see recent discussion in python-dev with subject "Termination of two-arg iter()"). Implementation will follow. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** libstdtypes.tex 12 Jul 2002 17:15:10 -0000 1.99 --- libstdtypes.tex 16 Jul 2002 19:53:39 -0000 1.100 *************** *** 378,381 **** --- 378,388 ---- implementation of the iterator protocol. + The intention of the protocol is that once an iterator's + \method{next()} method raises \exception{StopIteration}, it will + continue to do so on subsequent calls. Implementations that + do not obey this property are deemed broken. (This constraint + was added in Python 2.3; in Python 2.2, various iterators are + broken according to this rule.) + \subsection{Sequence Types \label{typesseq}} From jhylton@users.sourceforge.net Tue Jul 16 21:02:17 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:02:17 -0700 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.56.4.1,1.56.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25788/Lib Modified Files: Tag: release22-maint pickle.py Log Message: Given the persistent id code a shot at a class before calling save_global(). Backported from the trunk. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.56.4.1 retrieving revision 1.56.4.2 diff -C2 -d -r1.56.4.1 -r1.56.4.2 *** pickle.py 26 Mar 2002 09:57:13 -0000 1.56.4.1 --- pickle.py 16 Jul 2002 20:02:14 -0000 1.56.4.2 *************** *** 164,167 **** --- 164,172 ---- f = self.dispatch[t] except KeyError: + pid = self.inst_persistent_id(object) + if pid is not None: + self.save_pers(pid) + return + try: issc = issubclass(t, TypeType) *************** *** 170,178 **** if issc: self.save_global(object) - return - - pid = self.inst_persistent_id(object) - if pid is not None: - self.save_pers(pid) return --- 175,178 ---- From jhylton@users.sourceforge.net Tue Jul 16 21:02:18 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:02:18 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.73.2.1,2.73.2.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25788/Modules Modified Files: Tag: release22-maint cPickle.c Log Message: Given the persistent id code a shot at a class before calling save_global(). Backported from the trunk. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.73.2.1 retrieving revision 2.73.2.1.2.1 diff -C2 -d -r2.73.2.1 -r2.73.2.1.2.1 *** cPickle.c 21 Dec 2001 15:26:05 -0000 2.73.2.1 --- cPickle.c 16 Jul 2002 20:02:15 -0000 2.73.2.1.2.1 *************** *** 1993,2001 **** } - if (PyType_IsSubtype(type, &PyType_Type)) { - res = save_global(self, args, NULL); - goto finally; - } - if (!pers_save && self->inst_pers_func) { if ((tmp = save_pers(self, args, self->inst_pers_func)) != 0) { --- 1993,1996 ---- *************** *** 2003,2006 **** --- 1998,2006 ---- goto finally; } + } + + if (PyType_IsSubtype(type, &PyType_Type)) { + res = save_global(self, args, NULL); + goto finally; } From gvanrossum@users.sourceforge.net Tue Jul 16 21:07:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:07:34 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.118,2.119 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27419 Modified Files: listobject.c Log Message: Make StopIteration a sink state. This is done by clearing out the it_seq field when the end of the list is reached. Also remove the next() method -- one is supplied automatically by PyType_Ready() because the tp_iternext slot is set. That's a good thing, because the implementation given here was buggy (it never raised StopIteration). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.118 retrieving revision 2.119 diff -C2 -d -r2.118 -r2.119 *** listobject.c 16 Jul 2002 15:56:52 -0000 2.118 --- listobject.c 16 Jul 2002 20:07:32 -0000 2.119 *************** *** 1,3 **** - /* List object implementation */ --- 1,2 ---- *************** *** 2017,2021 **** PyObject_HEAD long it_index; ! PyListObject *it_seq; } listiterobject; --- 2016,2020 ---- PyObject_HEAD long it_index; ! PyListObject *it_seq; /* Set to NULL when iterator is exhausted */ } listiterobject; *************** *** 2045,2049 **** { _PyObject_GC_UNTRACK(it); ! Py_DECREF(it->it_seq); PyObject_GC_Del(it); } --- 2044,2048 ---- { _PyObject_GC_UNTRACK(it); ! Py_XDECREF(it->it_seq); PyObject_GC_Del(it); } *************** *** 2052,2055 **** --- 2051,2056 ---- listiter_traverse(listiterobject *it, visitproc visit, void *arg) { + if (it->it_seq == NULL) + return 0; return visit((PyObject *)it->it_seq, arg); } *************** *** 2071,2074 **** --- 2072,2077 ---- assert(it != NULL); seq = it->it_seq; + if (seq == NULL) + return NULL; assert(PyList_Check(seq)); *************** *** 2079,2091 **** return item; } return NULL; } - static PyMethodDef listiter_methods[] = { - {"next", (PyCFunction)listiter_next, METH_NOARGS, - "it.next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ - }; - PyTypeObject PyListIter_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 2082,2091 ---- return item; } + + Py_DECREF(seq); + it->it_seq = NULL; return NULL; } PyTypeObject PyListIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 2118,2122 **** (getiterfunc)listiter_getiter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ ! listiter_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 2118,2122 ---- (getiterfunc)listiter_getiter, /* tp_iter */ (iternextfunc)listiter_next, /* tp_iternext */ ! 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ *************** *** 2126,2128 **** 0, /* tp_descr_set */ }; - --- 2126,2127 ---- From tim_one@users.sourceforge.net Tue Jul 16 21:09:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:09:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.3,1.3.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27814/Lib/test Modified Files: Tag: release22-maint test_atexit.py Log Message: The atexit module effectively turned itself off if sys.exitfunc already existed at the time atexit first got imported. That's a bug, and this fixes it. Also reworked test_atexit.py to test for this too, and to stop using an "expected output" file, and to test what actually happens at exit instead of just simulating what it thinks atexit will do at exit. Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.3 retrieving revision 1.3.24.1 diff -C2 -d -r1.3 -r1.3.24.1 *** test_atexit.py 17 Jan 2001 21:51:35 -0000 1.3 --- test_atexit.py 16 Jul 2002 20:09:07 -0000 1.3.24.1 *************** *** 1,4 **** ! # Test the exit module ! from test_support import verbose import atexit --- 1,8 ---- ! # Test the atexit module. ! from test_support import TESTFN, vereq ! import atexit ! import os ! ! input = """\ import atexit *************** *** 9,24 **** print "handler2", args, kargs - # save any exit functions that may have been registered as part of the - # test framework - _exithandlers = atexit._exithandlers - atexit._exithandlers = [] - atexit.register(handler1) atexit.register(handler2) atexit.register(handler2, 7, kw="abc") ! # simulate exit behavior by calling atexit._run_exitfuncs directly... ! atexit._run_exitfuncs() ! # restore exit handlers ! atexit._exithandlers = _exithandlers --- 13,61 ---- print "handler2", args, kargs atexit.register(handler1) atexit.register(handler2) atexit.register(handler2, 7, kw="abc") + """ ! fname = TESTFN + ".py" ! f = file(fname, "w") ! f.write(input) ! f.close() ! p = os.popen("python " + fname) ! output = p.read() ! p.close() ! vereq(output, """\ ! handler2 (7,) {'kw': 'abc'} ! handler2 () {} ! handler1 ! """) ! ! input = """\ ! def direct(): ! print "direct exit" ! ! import sys ! sys.exitfunc = direct ! ! # Make sure atexit doesn't drop ! def indirect(): ! print "indirect exit" ! ! import atexit ! atexit.register(indirect) ! """ ! ! f = file(fname, "w") ! f.write(input) ! f.close() ! ! p = os.popen("python " + fname) ! output = p.read() ! p.close() ! vereq(output, """\ ! indirect exit ! direct exit ! """) ! ! os.unlink(fname) From tim_one@users.sourceforge.net Tue Jul 16 21:09:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:09:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_atexit,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv27814/Lib/test/output Removed Files: Tag: release22-maint test_atexit Log Message: The atexit module effectively turned itself off if sys.exitfunc already existed at the time atexit first got imported. That's a bug, and this fixes it. Also reworked test_atexit.py to test for this too, and to stop using an "expected output" file, and to test what actually happens at exit instead of just simulating what it thinks atexit will do at exit. --- test_atexit DELETED --- From tim_one@users.sourceforge.net Tue Jul 16 21:09:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:09:09 -0700 Subject: [Python-checkins] python/dist/src/Lib atexit.py,1.4,1.4.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27814/Lib Modified Files: Tag: release22-maint atexit.py Log Message: The atexit module effectively turned itself off if sys.exitfunc already existed at the time atexit first got imported. That's a bug, and this fixes it. Also reworked test_atexit.py to test for this too, and to stop using an "expected output" file, and to test what actually happens at exit instead of just simulating what it thinks atexit will do at exit. Index: atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v retrieving revision 1.4 retrieving revision 1.4.24.1 diff -C2 -d -r1.4 -r1.4.24.1 *** atexit.py 21 Jan 2001 03:40:37 -0000 1.4 --- atexit.py 16 Jul 2002 20:09:07 -0000 1.4.24.1 *************** *** 30,42 **** import sys ! try: ! x = sys.exitfunc ! except AttributeError: ! sys.exitfunc = _run_exitfuncs ! else: ! # if x isn't our own exit func executive, assume it's another ! # registered exit function - append it to our list... ! if x != _run_exitfuncs: ! register(x) del sys --- 30,38 ---- import sys ! if hasattr(sys, "exitfunc"): ! # Assume it's another registered exit function - append it to our list ! register(sys.exitfunc) ! sys.exitfunc = _run_exitfuncs ! del sys From gvanrossum@users.sourceforge.net Tue Jul 16 21:10:25 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:10:25 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.119,2.120 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28787 Modified Files: listobject.c Log Message: Whitespace normalization. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.119 retrieving revision 2.120 diff -C2 -d -r2.119 -r2.120 *** listobject.c 16 Jul 2002 20:07:32 -0000 2.119 --- listobject.c 16 Jul 2002 20:10:23 -0000 2.120 *************** *** 1921,1925 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; --- 1921,1925 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; *************** *** 2014,2019 **** typedef struct { ! PyObject_HEAD ! long it_index; PyListObject *it_seq; /* Set to NULL when iterator is exhausted */ } listiterobject; --- 2014,2019 ---- typedef struct { ! PyObject_HEAD ! long it_index; PyListObject *it_seq; /* Set to NULL when iterator is exhausted */ } listiterobject; *************** *** 2024,2041 **** list_iter(PyObject *seq) { ! listiterobject *it; ! if (!PyList_Check(seq)) { ! PyErr_BadInternalCall(); ! return NULL; ! } ! it = PyObject_GC_New(listiterobject, &PyListIter_Type); ! if (it == NULL) ! return NULL; ! it->it_index = 0; ! Py_INCREF(seq); ! it->it_seq = (PyListObject *)seq; ! _PyObject_GC_TRACK(it); ! return (PyObject *)it; } --- 2024,2041 ---- list_iter(PyObject *seq) { ! listiterobject *it; ! if (!PyList_Check(seq)) { ! PyErr_BadInternalCall(); ! return NULL; ! } ! it = PyObject_GC_New(listiterobject, &PyListIter_Type); ! if (it == NULL) ! return NULL; ! it->it_index = 0; ! Py_INCREF(seq); ! it->it_seq = (PyListObject *)seq; ! _PyObject_GC_TRACK(it); ! return (PyObject *)it; } *************** *** 2043,2049 **** listiter_dealloc(listiterobject *it) { ! _PyObject_GC_UNTRACK(it); Py_XDECREF(it->it_seq); ! PyObject_GC_Del(it); } --- 2043,2049 ---- listiter_dealloc(listiterobject *it) { ! _PyObject_GC_UNTRACK(it); Py_XDECREF(it->it_seq); ! PyObject_GC_Del(it); } *************** *** 2053,2057 **** if (it->it_seq == NULL) return 0; ! return visit((PyObject *)it->it_seq, arg); } --- 2053,2057 ---- if (it->it_seq == NULL) return 0; ! return visit((PyObject *)it->it_seq, arg); } *************** *** 2060,2065 **** listiter_getiter(PyObject *it) { ! Py_INCREF(it); ! return it; } --- 2060,2065 ---- listiter_getiter(PyObject *it) { ! Py_INCREF(it); ! return it; } *************** *** 2067,2127 **** listiter_next(listiterobject *it) { ! PyListObject *seq; ! PyObject *item; assert(it != NULL); ! seq = it->it_seq; if (seq == NULL) return NULL; ! assert(PyList_Check(seq)); ! if (it->it_index < PyList_GET_SIZE(seq)) { item = PyList_GET_ITEM(seq, it->it_index); ++it->it_index; ! Py_INCREF(item); ! return item; ! } Py_DECREF(seq); it->it_seq = NULL; ! return NULL; } PyTypeObject PyListIter_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "listiterator", /* tp_name */ ! sizeof(listiterobject), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! /* methods */ ! (destructor)listiter_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)listiter_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)listiter_getiter, /* tp_iter */ ! (iternextfunc)listiter_next, /* tp_iternext */ 0, /* tp_methods */ ! 0, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ }; --- 2067,2127 ---- listiter_next(listiterobject *it) { ! PyListObject *seq; ! PyObject *item; assert(it != NULL); ! seq = it->it_seq; if (seq == NULL) return NULL; ! assert(PyList_Check(seq)); ! if (it->it_index < PyList_GET_SIZE(seq)) { item = PyList_GET_ITEM(seq, it->it_index); ++it->it_index; ! Py_INCREF(item); ! return item; ! } Py_DECREF(seq); it->it_seq = NULL; ! return NULL; } PyTypeObject PyListIter_Type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "listiterator", /* tp_name */ ! sizeof(listiterobject), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! /* methods */ ! (destructor)listiter_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)listiter_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)listiter_getiter, /* tp_iter */ ! (iternextfunc)listiter_next, /* tp_iternext */ 0, /* tp_methods */ ! 0, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ }; From gvanrossum@users.sourceforge.net Tue Jul 16 21:24:49 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:24:49 -0700 Subject: [Python-checkins] python/dist/src/Objects iterobject.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1699 Modified Files: iterobject.c Log Message: Make StopIteration a sink state. This is done by clearing out the object references (it_seq for seqiterobject, it_callable and it_sentinel for calliterobject) when the end of the list is reached. Also remove the next() methods -- one is supplied automatically by PyType_Ready() because the tp_iternext slot is set. That's a good thing, because the implementation given here was buggy (it never raised StopIteration). Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iterobject.c 31 May 2002 21:37:01 -0000 1.10 --- iterobject.c 16 Jul 2002 20:24:46 -0000 1.11 *************** *** 6,10 **** PyObject_HEAD long it_index; ! PyObject *it_seq; } seqiterobject; --- 6,10 ---- PyObject_HEAD long it_index; ! PyObject *it_seq; /* Set to NULL when iterator is exhausted */ } seqiterobject; *************** *** 27,35 **** return (PyObject *)it; } static void iter_dealloc(seqiterobject *it) { _PyObject_GC_UNTRACK(it); ! Py_DECREF(it->it_seq); PyObject_GC_Del(it); } --- 27,36 ---- return (PyObject *)it; } + static void iter_dealloc(seqiterobject *it) { _PyObject_GC_UNTRACK(it); ! Py_XDECREF(it->it_seq); PyObject_GC_Del(it); } *************** *** 38,56 **** iter_traverse(seqiterobject *it, visitproc visit, void *arg) { return visit(it->it_seq, arg); } static PyObject * - iter_next(seqiterobject *it) - { - PyObject *seq = it->it_seq; - PyObject *result = PySequence_GetItem(seq, it->it_index++); - - if (result == NULL && PyErr_ExceptionMatches(PyExc_IndexError)) - PyErr_SetObject(PyExc_StopIteration, Py_None); - return result; - } - - static PyObject * iter_getiter(PyObject *it) { --- 39,48 ---- iter_traverse(seqiterobject *it, visitproc visit, void *arg) { + if (it->it_seq == NULL) + return 0; return visit(it->it_seq, arg); } static PyObject * iter_getiter(PyObject *it) { *************** *** 68,71 **** --- 60,65 ---- it = (seqiterobject *)iterator; seq = it->it_seq; + if (seq == NULL) + return NULL; if (PyTuple_CheckExact(seq)) { *************** *** 77,105 **** return item; } return NULL; } else { ! PyObject *result = PySequence_ITEM(seq, it->it_index); ! it->it_index++; if (result != NULL) { return result; } if (PyErr_ExceptionMatches(PyExc_IndexError) || ! PyErr_ExceptionMatches(PyExc_StopIteration)) { PyErr_Clear(); ! return NULL; ! } ! else { ! return NULL; } } } - static PyMethodDef iter_methods[] = { - {"next", (PyCFunction)iter_next, METH_NOARGS, - "it.next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ - }; - PyTypeObject PySeqIter_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 71,95 ---- return item; } + Py_DECREF(seq); + it->it_seq = NULL; return NULL; } else { ! PyObject *result = PySequence_GetItem(seq, it->it_index); if (result != NULL) { + it->it_index++; return result; } if (PyErr_ExceptionMatches(PyExc_IndexError) || ! PyErr_ExceptionMatches(PyExc_StopIteration)) ! { PyErr_Clear(); ! Py_DECREF(seq); ! it->it_seq = NULL; } + return NULL; } } PyTypeObject PySeqIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 132,136 **** (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ ! iter_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 122,126 ---- (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ ! 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ *************** *** 145,150 **** typedef struct { PyObject_HEAD ! PyObject *it_callable; ! PyObject *it_sentinel; } calliterobject; --- 135,140 ---- typedef struct { PyObject_HEAD ! PyObject *it_callable; /* Set to NULL when iterator is exhausted */ ! PyObject *it_sentinel; /* Set to NULL when iterator is exhausted */ } calliterobject; *************** *** 167,172 **** { _PyObject_GC_UNTRACK(it); ! Py_DECREF(it->it_callable); ! Py_DECREF(it->it_sentinel); PyObject_GC_Del(it); } --- 157,162 ---- { _PyObject_GC_UNTRACK(it); ! Py_XDECREF(it->it_callable); ! Py_XDECREF(it->it_sentinel); PyObject_GC_Del(it); } *************** *** 176,182 **** { int err; ! if ((err = visit(it->it_callable, arg))) return err; ! if ((err = visit(it->it_sentinel, arg))) return err; return 0; --- 166,172 ---- { int err; ! if (it->it_callable != NULL && (err = visit(it->it_callable, arg))) return err; ! if (it->it_sentinel != NULL && (err = visit(it->it_sentinel, arg))) return err; return 0; *************** *** 184,220 **** static PyObject * - calliter_next(calliterobject *it, PyObject *args) - { - PyObject *result = PyObject_CallObject(it->it_callable, NULL); - if (result != NULL) { - if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { - PyErr_SetObject(PyExc_StopIteration, Py_None); - Py_DECREF(result); - result = NULL; - } - } - return result; - } - - static PyMethodDef calliter_methods[] = { - {"next", (PyCFunction)calliter_next, METH_VARARGS, - "it.next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ - }; - - static PyObject * calliter_iternext(calliterobject *it) { ! PyObject *result = PyObject_CallObject(it->it_callable, NULL); ! if (result != NULL) { ! if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { Py_DECREF(result); ! result = NULL; } } ! else if (PyErr_ExceptionMatches(PyExc_StopIteration)) { ! PyErr_Clear(); ! } ! return result; } --- 174,205 ---- static PyObject * calliter_iternext(calliterobject *it) { ! if (it->it_callable != NULL) { ! PyObject *result = PyObject_CallObject(it->it_callable, NULL); ! if (result != NULL) { ! int ok; ! ok = PyObject_RichCompareBool(result, ! it->it_sentinel, ! Py_EQ); ! if (ok == 0) ! return result; /* Common case, fast path */ Py_DECREF(result); ! if (ok > 0) { ! Py_DECREF(it->it_callable); ! it->it_callable = NULL; ! Py_DECREF(it->it_sentinel); ! it->it_sentinel = NULL; ! } ! } ! else if (PyErr_ExceptionMatches(PyExc_StopIteration)) { ! PyErr_Clear(); ! Py_DECREF(it->it_callable); ! it->it_callable = NULL; ! Py_DECREF(it->it_sentinel); ! it->it_sentinel = NULL; } } ! return NULL; } *************** *** 249,253 **** (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ ! calliter_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 234,238 ---- (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ ! 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ From gvanrossum@users.sourceforge.net Tue Jul 16 21:47:52 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:47:52 -0700 Subject: [Python-checkins] python/dist/src/Objects rangeobject.c,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10421 Modified Files: rangeobject.c Log Message: Remove the next() method -- one is supplied automatically by PyType_Ready() because the tp_iternext slot is set. Also removed the redundant (and expensive!) call to raise StopIteration from rangeiter_next(). Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** rangeobject.c 13 Jun 2002 20:33:01 -0000 2.41 --- rangeobject.c 16 Jul 2002 20:47:50 -0000 2.42 *************** *** 1,3 **** - /* Range object implementation */ --- 1,2 ---- *************** *** 252,265 **** if (r->index < r->len) return PyInt_FromLong(r->start + (r->index++) * r->step); - PyErr_SetObject(PyExc_StopIteration, Py_None); return NULL; } - static PyMethodDef rangeiter_methods[] = { - {"next", (PyCFunction)rangeiter_next, METH_NOARGS, - "it.next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ - }; - static PyTypeObject Pyrangeiter_Type = { PyObject_HEAD_INIT(&PyType_Type) --- 251,257 ---- *************** *** 292,296 **** (getiterfunc)rangeiter_getiter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ ! rangeiter_methods, /* tp_methods */ }; - --- 284,287 ---- (getiterfunc)rangeiter_getiter, /* tp_iter */ (iternextfunc)rangeiter_next, /* tp_iternext */ ! 0, /* tp_methods */ }; From gvanrossum@users.sourceforge.net Tue Jul 16 21:30:25 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 13:30:25 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.126,2.127 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4011 Modified Files: dictobject.c Log Message: Make StopIteration a sink state. This is done by clearing out the di_dict field when the end of the list is reached. Also make the error ("dictionary changed size during iteration") a sticky state. Also remove the next() method -- one is supplied automatically by PyType_Ready() because the tp_iternext slot is set. That's a good thing, because the implementation given here was buggy (it never raised StopIteration). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -d -r2.126 -r2.127 *** dictobject.c 13 Jun 2002 20:32:57 -0000 2.126 --- dictobject.c 16 Jul 2002 20:30:22 -0000 2.127 *************** *** 1917,1921 **** typedef struct { PyObject_HEAD ! dictobject *di_dict; int di_used; int di_pos; --- 1917,1921 ---- typedef struct { PyObject_HEAD ! dictobject *di_dict; /* Set to NULL when iterator is exhausted */ int di_used; int di_pos; *************** *** 1941,1966 **** dictiter_dealloc(dictiterobject *di) { ! Py_DECREF(di->di_dict); PyObject_Del(di); } static PyObject * - dictiter_next(dictiterobject *di, PyObject *args) - { - PyObject *key, *value; - - if (di->di_used != di->di_dict->ma_used) { - PyErr_SetString(PyExc_RuntimeError, - "dictionary changed size during iteration"); - return NULL; - } - if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, &value)) { - return (*di->di_select)(key, value); - } - PyErr_SetObject(PyExc_StopIteration, Py_None); - return NULL; - } - - static PyObject * dictiter_getiter(PyObject *it) { --- 1941,1949 ---- dictiter_dealloc(dictiterobject *di) { ! Py_XDECREF(di->di_dict); PyObject_Del(di); } static PyObject * dictiter_getiter(PyObject *it) { *************** *** 1969,1990 **** } - static PyMethodDef dictiter_methods[] = { - {"next", (PyCFunction)dictiter_next, METH_VARARGS, - "it.next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ - }; - static PyObject *dictiter_iternext(dictiterobject *di) { PyObject *key, *value; if (di->di_used != di->di_dict->ma_used) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); return NULL; } ! if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, &value)) { return (*di->di_select)(key, value); ! } return NULL; } --- 1952,1973 ---- } static PyObject *dictiter_iternext(dictiterobject *di) { PyObject *key, *value; + if (di->di_dict == NULL) + return NULL; + if (di->di_used != di->di_dict->ma_used) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); + di->di_used = -1; /* Make this state sticky */ return NULL; } ! if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, &value)) return (*di->di_select)(key, value); ! ! Py_DECREF(di->di_dict); ! di->di_dict = NULL; return NULL; } *************** *** 2020,2024 **** (getiterfunc)dictiter_getiter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ ! dictiter_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 2003,2007 ---- (getiterfunc)dictiter_getiter, /* tp_iter */ (iternextfunc)dictiter_iternext, /* tp_iternext */ ! 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ From gvanrossum@users.sourceforge.net Tue Jul 16 22:02:44 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 14:02:44 -0700 Subject: [Python-checkins] python/dist/src/Objects enumobject.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15850 Modified Files: enumobject.c Log Message: Remove the next() method -- one is supplied automatically by PyType_Ready() because the tp_iternext slot is set (fortunately, because using the tp_iternext implementation for the the next() implementation is buggy). Also changed the allocation order in enum_next() so that the underlying iterator is only moved ahead when we have successfully allocated the result tuple and index. Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** enumobject.c 13 Jun 2002 20:32:59 -0000 1.2 --- enumobject.c 16 Jul 2002 21:02:42 -0000 1.3 *************** *** 55,77 **** PyObject *result; PyObject *next_index; ! PyObject *next_item = PyIter_Next(en->en_sit); ! if (next_item == NULL) return NULL; ! result = PyTuple_New(2); ! if (result == NULL) { ! Py_DECREF(next_item); return NULL; } ! next_index = PyInt_FromLong(en->en_index++); ! if (next_index == NULL) { ! Py_DECREF(next_item); Py_DECREF(result); return NULL; } ! PyTuple_SET_ITEM(result, 0, next_index); PyTuple_SET_ITEM(result, 1, next_item); return result; --- 55,78 ---- PyObject *result; PyObject *next_index; + PyObject *next_item; ! result = PyTuple_New(2); ! if (result == NULL) return NULL; ! next_index = PyInt_FromLong(en->en_index); ! if (next_index == NULL) { ! Py_DECREF(result); return NULL; } + PyTuple_SET_ITEM(result, 0, next_index); ! next_item = PyIter_Next(en->en_sit); ! if (next_item == NULL) { Py_DECREF(result); return NULL; } ! en->en_index++; PyTuple_SET_ITEM(result, 1, next_item); return result; *************** *** 85,94 **** } - static PyMethodDef enum_methods[] = { - {"next", (PyCFunction)enum_next, METH_NOARGS, - "return the next (index, value) pair, or raise StopIteration"}, - {NULL, NULL} /* sentinel */ - }; - PyDoc_STRVAR(enum_doc, "enumerate(iterable) -> create an enumerating-iterator"); --- 86,89 ---- *************** *** 125,129 **** (getiterfunc)enum_getiter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ ! enum_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ --- 120,124 ---- (getiterfunc)enum_getiter, /* tp_iter */ (iternextfunc)enum_next, /* tp_iternext */ ! 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ From jhylton@users.sourceforge.net Tue Jul 16 22:21:14 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 14:21:14 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23177 Modified Files: httplib.py Log Message: Send HTTP requests with a single send() call instead of many. The implementation now stores all the lines of the request in a buffer and makes a single send() call when the request is finished, specifically when endheaders() is called. This appears to improve performance. The old code called send() for each line. The sends are all short, so they caused bad interactions with the Nagle algorithm and delayed acknowledgements. In simple tests, the second packet was delayed by 100s of ms. The second send was delayed by the Nagle algorithm, waiting for the ack. The delayed ack strategy delays the ack in hopes of piggybacking it on a data packet, but the server won't send any data until it receives the complete request. This change minimizes the problem that Nagle + delayed ack will cause a problem, although a request large enough to be broken into two packets will still suffer some delay. Luckily the MSS is large enough to accomodate most single packets. XXX Bug fix candidate? Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** httplib.py 12 Jul 2002 14:04:08 -0000 1.59 --- httplib.py 16 Jul 2002 21:21:11 -0000 1.60 *************** *** 480,483 **** --- 480,484 ---- def __init__(self, host, port=None, strict=None): self.sock = None + self._buffer = [] self.__response = None self.__state = _CS_IDLE *************** *** 544,548 **** raise NotConnected() ! # send the data to the server. if we get a broken pipe, then close # the socket. we want to reconnect when somebody tries to send again. # --- 545,549 ---- raise NotConnected() ! # send the data to the server. if we get a broken pipe, then closesdwu # the socket. we want to reconnect when somebody tries to send again. # *************** *** 558,561 **** --- 559,579 ---- raise + def _output(self, s): + """Add a line of output to the current request buffer. + + Aassumes that the line does *not* end with \r\n. + """ + self._buffer.append(s) + + def _send_output(self): + """Send the currently buffered request and clear the buffer. + + Appends an extra \r\n to the buffer. + """ + self._buffer.extend(("", "")) + msg = "\r\n".join(self._buffer) + del self._buffer[:] + self.send(msg) + def putrequest(self, method, url, skip_host=0): """Send a request to the server. *************** *** 566,569 **** --- 584,588 ---- # check if a prior response has been completed + # XXX What if it hasn't? if self.__response and self.__response.isclosed(): self.__response = None *************** *** 595,608 **** if not url: url = '/' ! str = '%s %s %s\r\n' % (method, url, self._http_vsn_str) ! try: ! self.send(str) ! except socket.error, v: ! # trap 'Broken pipe' if we're allowed to automatically reconnect ! if v[0] != 32 or not self.auto_open: ! raise ! # try one more time (the socket was closed; this will reopen) ! self.send(str) if self._http_vsn == 11: --- 614,620 ---- if not url: url = '/' ! str = '%s %s %s' % (method, url, self._http_vsn_str) ! self._output(str) if self._http_vsn == 11: *************** *** 665,670 **** raise CannotSendHeader() ! str = '%s: %s\r\n' % (header, value) ! self.send(str) def endheaders(self): --- 677,682 ---- raise CannotSendHeader() ! str = '%s: %s' % (header, value) ! self._output(str) def endheaders(self): *************** *** 676,680 **** raise CannotSendHeader() ! self.send('\r\n') def request(self, method, url, body=None, headers={}): --- 688,692 ---- raise CannotSendHeader() ! self._send_output() def request(self, method, url, body=None, headers={}): *************** *** 1203,1206 **** --- 1215,1219 ---- print "https://%s%s" % (host, selector) hs = HTTPS() + hs.set_debuglevel(dl) hs.connect(host) hs.putrequest('GET', selector) *************** *** 1214,1219 **** for header in headers.headers: print header.strip() print - - return # Test a buggy server -- returns garbled status line. --- 1227,1230 ---- From tim_one@users.sourceforge.net Tue Jul 16 22:35:25 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 14:35:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.87,1.88 test_atexit.py,1.4,1.5 test_b1.py,1.47,1.48 test_generators.py,1.34,1.35 test_httplib.py,1.7,1.8 test_signal.py,1.10,1.11 test_types.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27557/python/Lib/test Modified Files: regrtest.py test_atexit.py test_b1.py test_generators.py test_httplib.py test_signal.py test_types.py Log Message: Whitespace normalization. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** regrtest.py 4 Jul 2002 19:45:06 -0000 1.87 --- regrtest.py 16 Jul 2002 21:35:23 -0000 1.88 *************** *** 712,742 **** """, 'atheos': ! """ ! test_al ! test_cd ! test_cl ! test_curses ! test_dl ! test_email_codecs ! test_gdbm ! test_gl ! test_imgfile ! test_largefile ! test_linuxaudiodev ! test_locale ! test_mhlib ! test_mmap ! test_mpz ! test_nis ! test_poll ! test_popen2 ! test_resource ! test_socket_ssl ! test_socketserver ! test_sunaudiodev ! test_unicode_file ! test_winreg ! test_winsound ! """, } --- 712,742 ---- """, 'atheos': ! """ ! test_al ! test_cd ! test_cl ! test_curses ! test_dl ! test_email_codecs ! test_gdbm ! test_gl ! test_imgfile ! test_largefile ! test_linuxaudiodev ! test_locale ! test_mhlib ! test_mmap ! test_mpz ! test_nis ! test_poll ! test_popen2 ! test_resource ! test_socket_ssl ! test_socketserver ! test_sunaudiodev ! test_unicode_file ! test_winreg ! test_winsound ! """, } Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_atexit.py 16 Jul 2002 19:30:58 -0000 1.4 --- test_atexit.py 16 Jul 2002 21:35:23 -0000 1.5 *************** *** 39,43 **** sys.exitfunc = direct ! # Make sure atexit doesn't drop def indirect(): print "indirect exit" --- 39,43 ---- sys.exitfunc = direct ! # Make sure atexit doesn't drop def indirect(): print "indirect exit" Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** test_b1.py 6 Jun 2002 15:45:38 -0000 1.47 --- test_b1.py 16 Jul 2002 21:35:23 -0000 1.48 *************** *** 103,109 **** print 'complex' class OS: ! def __complex__(self): return 1+10j class NS(object): ! def __complex__(self): return 1+10j if complex(OS()) != 1+10j: raise TestFailed, '__complex__ in old style class' if complex(NS()) != 1+10j: raise TestFailed, '__complex__ in new style class' --- 103,109 ---- print 'complex' class OS: ! def __complex__(self): return 1+10j class NS(object): ! def __complex__(self): return 1+10j if complex(OS()) != 1+10j: raise TestFailed, '__complex__ in old style class' if complex(NS()) != 1+10j: raise TestFailed, '__complex__ in new style class' Index: test_generators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_generators.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** test_generators.py 12 Jun 2002 03:45:20 -0000 1.34 --- test_generators.py 16 Jul 2002 21:35:23 -0000 1.35 *************** *** 815,819 **** ... finally: ... yield i ! ... >>> g = f() >>> print g.next() --- 815,819 ---- ... finally: ... yield i ! ... >>> g = f() >>> print g.next() Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_httplib.py 12 Jul 2002 14:04:09 -0000 1.7 --- test_httplib.py 16 Jul 2002 21:35:23 -0000 1.8 *************** *** 57,59 **** if cookies != hdr: raise AssertionError, "multiple headers not combined properly" - --- 57,58 ---- Index: test_signal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_signal.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_signal.py 27 May 2002 15:08:23 -0000 1.10 --- test_signal.py 16 Jul 2002 21:35:23 -0000 1.11 *************** *** 126,128 **** else: raise TestFailed, "sigsupsend didn't raise" - --- 126,127 ---- Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** test_types.py 21 Jun 2002 02:14:10 -0000 1.34 --- test_types.py 16 Jul 2002 21:35:23 -0000 1.35 *************** *** 212,216 **** vereq(a[100:-100:-1], a[::-1]) vereq(a[-100L:100L:2L], unicode('02468', 'ascii')) ! print '6.5.2 Tuples' --- 212,216 ---- vereq(a[100:-100:-1], a[::-1]) vereq(a[-100L:100L:2L], unicode('02468', 'ascii')) ! print '6.5.2 Tuples' From tim_one@users.sourceforge.net Tue Jul 16 22:35:25 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 14:35:25 -0700 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.20,1.21 httplib.py,1.60,1.61 imaplib.py,1.54,1.55 rfc822.py,1.72,1.73 textwrap.py,1.12,1.13 urllib2.py,1.32,1.33 weakref.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27557/python/Lib Modified Files: getopt.py httplib.py imaplib.py rfc822.py textwrap.py urllib2.py weakref.py Log Message: Whitespace normalization. Index: getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getopt.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** getopt.py 7 Jun 2002 03:26:43 -0000 1.20 --- getopt.py 16 Jul 2002 21:35:23 -0000 1.21 *************** *** 10,14 **** getopt() -- Parse command line options gnu_getopt() -- Like getopt(), but allow option and non-option arguments ! to be intermixed. GetoptError -- exception (class) raised with 'opt' attribute, which is the option involved with the exception. --- 10,14 ---- getopt() -- Parse command line options gnu_getopt() -- Like getopt(), but allow option and non-option arguments ! to be intermixed. GetoptError -- exception (class) raised with 'opt' attribute, which is the option involved with the exception. *************** *** 104,108 **** environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a non-option argument is encountered. ! """ --- 104,108 ---- environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a non-option argument is encountered. ! """ Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** httplib.py 16 Jul 2002 21:21:11 -0000 1.60 --- httplib.py 16 Jul 2002 21:35:23 -0000 1.61 *************** *** 277,281 **** if self.debuglevel > 0: print "header:", skip ! self.status = status self.reason = reason.strip() --- 277,281 ---- if self.debuglevel > 0: print "header:", skip ! self.status = status self.reason = reason.strip() *************** *** 483,487 **** self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) if strict is not None: --- 483,487 ---- self.__response = None self.__state = _CS_IDLE ! self._set_hostport(host, port) if strict is not None: *************** *** 816,820 **** BUFSIZE = 8192 ! def __init__(self, sock, ssl, bufsize=None): SharedSocketClient.__init__(self, sock) --- 816,820 ---- BUFSIZE = 8192 ! def __init__(self, sock, ssl, bufsize=None): SharedSocketClient.__init__(self, sock) *************** *** 1140,1144 **** return s + self._file.read() else: ! return s + self._file.read(amt - len(s)) else: assert amt <= self._line_left --- 1140,1144 ---- return s + self._file.read() else: ! return s + self._file.read(amt - len(s)) else: assert amt <= self._line_left *************** *** 1151,1155 **** self._done() return s ! def readline(self): s = self._line[self._line_offset:] --- 1151,1155 ---- self._done() return s ! def readline(self): s = self._line[self._line_offset:] *************** *** 1208,1212 **** if hasattr(socket, 'ssl'): ! for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), --- 1208,1212 ---- if hasattr(socket, 'ssl'): ! for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** imaplib.py 30 Jun 2002 03:39:14 -0000 1.54 --- imaplib.py 16 Jul 2002 21:35:23 -0000 1.55 *************** *** 1059,1063 **** data = self.sslobj.read(size) while len(data) < size: ! data += self.sslobj.read(size-len(data)) return data --- 1059,1063 ---- data = self.sslobj.read(size) while len(data) < size: ! data += self.sslobj.read(size-len(data)) return data Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** rfc822.py 5 Jun 2002 19:07:39 -0000 1.72 --- rfc822.py 16 Jul 2002 21:35:23 -0000 1.73 *************** *** 444,448 **** def __contains__(self, name): """Determine whether a message contains the named header.""" ! return name.lower() in self.dict def keys(self): --- 444,448 ---- def __contains__(self, name): """Determine whether a message contains the named header.""" ! return name.lower() in self.dict def keys(self): Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** textwrap.py 4 Jul 2002 14:51:49 -0000 1.12 --- textwrap.py 16 Jul 2002 21:35:23 -0000 1.13 *************** *** 49,53 **** ' ' * len(string.whitespace)) ! # This funky little regex is just the trick for splitting # text up into word-wrappable chunks. E.g. # "Hello there -- you goof-ball, use the -b option!" --- 49,53 ---- ' ' * len(string.whitespace)) ! # This funky little regex is just the trick for splitting # text up into word-wrappable chunks. E.g. # "Hello there -- you goof-ball, use the -b option!" *************** *** 82,86 **** self.fix_sentence_endings = fix_sentence_endings self.break_long_words = break_long_words ! # -- Private methods ----------------------------------------------- --- 82,86 ---- self.fix_sentence_endings = fix_sentence_endings self.break_long_words = break_long_words ! # -- Private methods ----------------------------------------------- *************** *** 210,214 **** # The current line is full, and the next chunk is too big to ! # fit on *any* line (not just this one). if chunks and len(chunks[0]) > width: self._handle_long_word(chunks, cur_line, cur_len, width) --- 210,214 ---- # The current line is full, and the next chunk is too big to ! # fit on *any* line (not just this one). if chunks and len(chunks[0]) > width: self._handle_long_word(chunks, cur_line, cur_len, width) Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** urllib2.py 7 Jul 2002 16:57:35 -0000 1.32 --- urllib2.py 16 Jul 2002 21:35:23 -0000 1.33 *************** *** 166,170 **** # object. In some cases, the HTTPError may not have a valid # file object. If this happens, the simplest workaround is to ! # not initialize the base classes. if fp is not None: self.__super_init(fp, hdrs, url) --- 166,170 ---- # object. In some cases, the HTTPError may not have a valid # file object. If this happens, the simplest workaround is to ! # not initialize the base classes. if fp is not None: self.__super_init(fp, hdrs, url) *************** *** 461,465 **** if ':' in user_pass: user, password = user_pass.split(':', 1) ! user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) req.add_header('Proxy-Authorization', 'Basic ' + user_pass) --- 461,465 ---- if ':' in user_pass: user, password = user_pass.split(':', 1) ! user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) req.add_header('Proxy-Authorization', 'Basic ' + user_pass) Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** weakref.py 10 Jun 2002 19:59:04 -0000 1.17 --- weakref.py 16 Jul 2002 21:35:23 -0000 1.18 *************** *** 192,196 **** return 0 return wr in self.data ! def items(self): L = [] --- 192,196 ---- return 0 return wr in self.data ! def items(self): L = [] From jhylton@users.sourceforge.net Tue Jul 16 22:41:45 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 16 Jul 2002 14:41:45 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29505 Modified Files: httplib.py Log Message: Fix typos and such caught by the pycheckerbot. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** httplib.py 16 Jul 2002 21:35:23 -0000 1.61 --- httplib.py 16 Jul 2002 21:41:43 -0000 1.62 *************** *** 545,549 **** raise NotConnected() ! # send the data to the server. if we get a broken pipe, then closesdwu # the socket. we want to reconnect when somebody tries to send again. # --- 545,549 ---- raise NotConnected() ! # send the data to the server. if we get a broken pipe, then close # the socket. we want to reconnect when somebody tries to send again. # *************** *** 562,566 **** """Add a line of output to the current request buffer. ! Aassumes that the line does *not* end with \r\n. """ self._buffer.append(s) --- 562,566 ---- """Add a line of output to the current request buffer. ! Assumes that the line does *not* end with \\r\\n. """ self._buffer.append(s) *************** *** 569,573 **** """Send the currently buffered request and clear the buffer. ! Appends an extra \r\n to the buffer. """ self._buffer.extend(("", "")) --- 569,573 ---- """Send the currently buffered request and clear the buffer. ! Appends an extra \\r\\n to the buffer. """ self._buffer.extend(("", "")) From gvanrossum@users.sourceforge.net Tue Jul 16 22:48:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 16 Jul 2002 14:48:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_iter.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31628 Modified Files: test_iter.py Log Message: Bunch of tests to make sure that StopIteration is a sink state. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_iter.py 29 Apr 2002 21:27:31 -0000 1.24 --- test_iter.py 16 Jul 2002 21:48:11 -0000 1.25 *************** *** 800,803 **** --- 800,879 ---- self.assertEqual(C.count, 0) + + # Make sure StopIteration is a "sink state". + # This tests various things that weren't sink states in Python 2.2.1, + # plus various things that always were fine. + + def test_sinkstate_list(self): + # This used to fail + a = range(5) + b = iter(a) + self.assertEqual(list(b), range(5)) + a.extend(range(5, 10)) + self.assertEqual(list(b), []) + + def test_sinkstate_tuple(self): + a = (0, 1, 2, 3, 4) + b = iter(a) + self.assertEqual(list(b), range(5)) + self.assertEqual(list(b), []) + + def test_sinkstate_string(self): + a = "abcde" + b = iter(a) + self.assertEqual(list(b), ['a', 'b', 'c', 'd', 'e']) + self.assertEqual(list(b), []) + + def test_sinkstate_sequence(self): + # This used to fail + a = SequenceClass(5) + b = iter(a) + self.assertEqual(list(b), range(5)) + a.n = 10 + self.assertEqual(list(b), []) + + def test_sinkstate_callable(self): + # This used to fail + def spam(state=[0]): + i = state[0] + state[0] = i+1 + if i == 10: + raise AssertionError, "shouldn't have gotten this far" + return i + b = iter(spam, 5) + self.assertEqual(list(b), range(5)) + self.assertEqual(list(b), []) + + def test_sinkstate_dict(self): + # XXX For a more thorough test, see towards the end of: + # http://mail.python.org/pipermail/python-dev/2002-July/026512.html + a = {1:1, 2:2, 0:0, 4:4, 3:3} + for b in iter(a), a.iterkeys(), a.iteritems(), a.itervalues(): + b = iter(a) + self.assertEqual(len(list(b)), 5) + self.assertEqual(list(b), []) + + def test_sinkstate_yield(self): + def gen(): + for i in range(5): + yield i + b = gen() + self.assertEqual(list(b), range(5)) + self.assertEqual(list(b), []) + + def test_sinkstate_range(self): + a = xrange(5) + b = iter(a) + self.assertEqual(list(b), range(5)) + self.assertEqual(list(b), []) + + def test_sinkstate_enumerate(self): + a = range(5) + e = enumerate(a) + b = iter(e) + self.assertEqual(list(b), zip(range(5), range(5))) + self.assertEqual(list(b), []) + + def test_main(): run_unittest(TestCase) From tim_one@users.sourceforge.net Wed Jul 17 01:15:25 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 17:15:25 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.316,2.317 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11884/python/Python Modified Files: ceval.c Log Message: There's no need for generators to define an explicit next() method. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.316 retrieving revision 2.317 diff -C2 -d -r2.316 -r2.317 *** ceval.c 14 Jul 2002 00:27:26 -0000 2.316 --- ceval.c 17 Jul 2002 00:15:22 -0000 2.317 *************** *** 167,185 **** static PyObject * - gen_next(genobject *gen) - { - PyObject *result; - - result = gen_iternext(gen); - - if (result == NULL && !PyErr_Occurred()) { - PyErr_SetObject(PyExc_StopIteration, Py_None); - return NULL; - } - - return result; - } - - static PyObject * gen_getiter(PyObject *gen) { --- 167,170 ---- *************** *** 188,197 **** } - static struct PyMethodDef gen_methods[] = { - {"next", (PyCFunction)gen_next, METH_NOARGS, - "next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* Sentinel */ - }; - static PyMemberDef gen_memberlist[] = { {"gi_frame", T_OBJECT, offsetof(genobject, gi_frame), RO}, --- 173,176 ---- *************** *** 230,234 **** (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ ! gen_methods, /* tp_methods */ gen_memberlist, /* tp_members */ 0, /* tp_getset */ --- 209,213 ---- (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ ! 0, /* tp_methods */ gen_memberlist, /* tp_members */ 0, /* tp_getset */ From tim_one@users.sourceforge.net Wed Jul 17 01:34:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 17:34:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16739/python/Lib/test Modified Files: test_atexit.py Log Message: Use sys.executable to run Python, as suggested by Neal Norwitz. Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_atexit.py 16 Jul 2002 21:35:23 -0000 1.5 --- test_atexit.py 17 Jul 2002 00:34:26 -0000 1.6 *************** *** 3,6 **** --- 3,7 ---- import atexit import os + import sys input = """\ *************** *** 23,27 **** f.close() ! p = os.popen("python " + fname) output = p.read() p.close() --- 24,28 ---- f.close() ! p = os.popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() *************** *** 51,55 **** f.close() ! p = os.popen("python " + fname) output = p.read() p.close() --- 52,56 ---- f.close() ! p = os.popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() From tim_one@users.sourceforge.net Wed Jul 17 01:42:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 16 Jul 2002 17:42:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.3.24.1,1.3.24.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18522/Lib/test Modified Files: Tag: release22-maint test_atexit.py Log Message: Use sys.executable to run Python, as suggested by Neal Norwitz. Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.3.24.1 retrieving revision 1.3.24.2 diff -C2 -d -r1.3.24.1 -r1.3.24.2 *** test_atexit.py 16 Jul 2002 20:09:07 -0000 1.3.24.1 --- test_atexit.py 17 Jul 2002 00:42:52 -0000 1.3.24.2 *************** *** 3,6 **** --- 3,7 ---- import atexit import os + import sys input = """\ *************** *** 23,27 **** f.close() ! p = os.popen("python " + fname) output = p.read() p.close() --- 24,28 ---- f.close() ! p = os.popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() *************** *** 51,55 **** f.close() ! p = os.popen("python " + fname) output = p.read() p.close() --- 52,56 ---- f.close() ! p = os.popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() From bwarsaw@users.sourceforge.net Wed Jul 17 14:45:03 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 17 Jul 2002 06:45:03 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.24,4.25 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17849 Modified Files: python-mode.el Log Message: We need to (require 'compile) to guarantee that compile-internal is defined. /Really/ closes SF # 580631. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.24 retrieving revision 4.25 diff -C2 -d -r4.24 -r4.25 *** python-mode.el 16 Jul 2002 16:04:13 -0000 4.24 --- python-mode.el 17 Jul 2002 13:45:00 -0000 4.25 *************** *** 60,63 **** --- 60,64 ---- (require 'custom) (require 'cl) + (require 'compile) From fdrake@users.sourceforge.net Wed Jul 17 14:55:35 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 06:55:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.111,1.112 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23103/lib Modified Files: libfuncs.tex Log Message: reduce(): Clarified what is returned in the case of a sequence 1 item long and initial/default value. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** libfuncs.tex 9 Jul 2002 05:25:46 -0000 1.111 --- libfuncs.tex 17 Jul 2002 13:55:33 -0000 1.112 *************** *** 718,727 **** Apply \var{function} of two arguments cumulatively to the items of \var{sequence}, from left to right, so as to reduce the sequence to ! a single value. For example, ! \code{reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])} calculates ! \code{((((1+2)+3)+4)+5)}. ! If the optional \var{initializer} is present, it is placed before ! the items of the sequence in the calculation, and serves as a ! default when the sequence is empty. \end{funcdesc} --- 718,727 ---- Apply \var{function} of two arguments cumulatively to the items of \var{sequence}, from left to right, so as to reduce the sequence to ! a single value. For example, \code{reduce(lambda x, y: x+y, [1, 2, ! 3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}. If the optional ! \var{initializer} is present, it is placed before the items of the ! sequence in the calculation, and serves as a default when the ! sequence is empty. If \var{initializer} is not given and ! \var{sequence} contains only one item, the first item is returned. \end{funcdesc} From fdrake@users.sourceforge.net Wed Jul 17 14:55:48 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 06:55:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.6,1.100.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23246/lib Modified Files: Tag: release22-maint libfuncs.tex Log Message: reduce(): Clarified what is returned in the case of a sequence 1 item long and initial/default value. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.6 retrieving revision 1.100.4.7 diff -C2 -d -r1.100.4.6 -r1.100.4.7 *** libfuncs.tex 9 Jul 2002 05:27:12 -0000 1.100.4.6 --- libfuncs.tex 17 Jul 2002 13:55:46 -0000 1.100.4.7 *************** *** 678,687 **** Apply \var{function} of two arguments cumulatively to the items of \var{sequence}, from left to right, so as to reduce the sequence to ! a single value. For example, ! \code{reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])} calculates ! \code{((((1+2)+3)+4)+5)}. ! If the optional \var{initializer} is present, it is placed before ! the items of the sequence in the calculation, and serves as a ! default when the sequence is empty. \end{funcdesc} --- 678,687 ---- Apply \var{function} of two arguments cumulatively to the items of \var{sequence}, from left to right, so as to reduce the sequence to ! a single value. For example, \code{reduce(lambda x, y: x+y, [1, 2, ! 3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}. If the optional ! \var{initializer} is present, it is placed before the items of the ! sequence in the calculation, and serves as a default when the ! sequence is empty. If \var{initializer} is not given and ! \var{sequence} contains only one item, the first item is returned. \end{funcdesc} From gvanrossum@users.sourceforge.net Wed Jul 17 15:33:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 17 Jul 2002 07:33:37 -0700 Subject: [Python-checkins] python/dist/src/Modules getaddrinfo.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7202 Modified Files: getaddrinfo.c Log Message: Wipe out some warnings about non-ANSI code and an unsafe arg to isdigit(). Index: getaddrinfo.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getaddrinfo.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** getaddrinfo.c 2 Dec 2001 10:15:37 -0000 1.10 --- getaddrinfo.c 17 Jul 2002 14:33:34 -0000 1.11 *************** *** 200,205 **** char * ! gai_strerror(ecode) ! int ecode; { if (ecode < 0 || ecode > EAI_MAX) --- 200,204 ---- char * ! gai_strerror(int ecode) { if (ecode < 0 || ecode > EAI_MAX) *************** *** 209,214 **** void ! freeaddrinfo(ai) ! struct addrinfo *ai; { struct addrinfo *next; --- 208,212 ---- void ! freeaddrinfo(struct addrinfo *ai) { struct addrinfo *next; *************** *** 224,231 **** static int ! str_isnumber(p) ! const char *p; { ! char *q = (char *)p; while (*q) { if (! isdigit(*q)) --- 222,228 ---- static int ! str_isnumber(const char *p) { ! unsigned char *q = (unsigned char *)p; while (*q) { if (! isdigit(*q)) From fdrake@users.sourceforge.net Wed Jul 17 15:45:35 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 07:45:35 -0700 Subject: [Python-checkins] python/dist/src/Modules/expat xmlrole.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules/expat In directory usw-pr-cvs1:/tmp/cvs-serv11151 Modified Files: xmlrole.c Log Message: Remove RCSId; this produces annoying warnings. This is already removed from Expat 1.95.4, so the problem will not recur when we update. Index: xmlrole.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/expat/xmlrole.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xmlrole.c 11 Feb 2002 23:16:32 -0000 1.2 --- xmlrole.c 17 Jul 2002 14:45:33 -0000 1.3 *************** *** 4,10 **** */ - static char RCSId[] - = "$Header$"; - #ifdef COMPILED_FROM_DSP # include "winconfig.h" --- 4,7 ---- From gvanrossum@users.sourceforge.net Wed Jul 17 16:08:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 17 Jul 2002 08:08:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.88,1.89 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18754 Modified Files: regrtest.py Log Message: Add a rather generous set of tests allowed to be skipped on sunos5. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** regrtest.py 16 Jul 2002 21:35:23 -0000 1.88 --- regrtest.py 17 Jul 2002 15:08:24 -0000 1.89 *************** *** 681,684 **** --- 681,707 ---- test_winsound """, + 'sunos5': + """ + test_al + test_bsddb + test_cd + test_cl + test_curses + test_dbm + test_email_codecs + test_gdbm + test_gl + test_gzip + test_imgfile + test_linuxaudiodev + test_mpz + test_openpty + test_socket_ssl + test_socketserver + test_winreg + test_winsound + test_zipfile + test_zlib + """ 'hp-ux11': """ From tim_one@users.sourceforge.net Wed Jul 17 16:32:42 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 17 Jul 2002 08:32:42 -0700 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv27559/python/PC Modified Files: pyconfig.h Log Message: Windows has no actual need for BAD_STATIC_FORWARD, so got rid of it. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pyconfig.h 7 Jul 2002 03:59:34 -0000 1.12 --- pyconfig.h 17 Jul 2002 15:32:40 -0000 1.13 *************** *** 436,443 **** /* #undef BAD_EXEC_PROTOTYPES */ - /* Define if your compiler botches static forward declarations - (as it does on SCI ODT 3.0) */ - #define BAD_STATIC_FORWARD 1 - /* Define if getpgrp() must be called as getpgrp(0) and (consequently) setpgrp() as setpgrp(0, 0). */ --- 436,439 ---- From jhylton@users.sourceforge.net Wed Jul 17 16:55:12 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 08:55:12 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv4492 Modified Files: Makefile.pre.in Log Message: Add test_zlib and test_struct to list of slow tests Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Makefile.pre.in 21 Jun 2002 14:48:36 -0000 1.86 --- Makefile.pre.in 17 Jul 2002 15:55:09 -0000 1.87 *************** *** 497,501 **** QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \ test_unicodedata test_re test_sre test_select test_poll \ ! test_linuxaudiodev test_sunaudiodev quicktest: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f --- 497,501 ---- QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \ test_unicodedata test_re test_sre test_select test_poll \ ! test_linuxaudiodev test_struct test_sunaudiodev test_zlib quicktest: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f From jhylton@users.sourceforge.net Wed Jul 17 16:56:57 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 08:56:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.89,1.90 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5212 Modified Files: regrtest.py Log Message: Add missing comma. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** regrtest.py 17 Jul 2002 15:08:24 -0000 1.89 --- regrtest.py 17 Jul 2002 15:56:55 -0000 1.90 *************** *** 703,707 **** test_zipfile test_zlib ! """ 'hp-ux11': """ --- 703,707 ---- test_zipfile test_zlib ! """, 'hp-ux11': """ From gvanrossum@users.sourceforge.net Wed Jul 17 17:12:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:12:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hotshot.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10955 Modified Files: test_hotshot.py Log Message: Add a test for the 'closed' attribute on the C-profiler object. Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_hotshot.py 8 Feb 2002 21:29:22 -0000 1.6 --- test_hotshot.py 17 Jul 2002 16:12:53 -0000 1.7 *************** *** 64,69 **** --- 64,72 ---- if profiler is None: profiler = self.new_profiler() + self.failUnless(not profiler._prof.closed) profiler.runcall(callable) + self.failUnless(not profiler._prof.closed) profiler.close() + self.failUnless(profiler._prof.closed) self.check_events(events) From gvanrossum@users.sourceforge.net Wed Jul 17 17:15:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:15:37 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12160 Modified Files: _hotshot.c Log Message: Some modernization. Get rid of the redundant next() method. Always assume tp_iter and later fields exist. Use PyObject_GenericGetAttr instead of providing our own tp_getattr hook. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _hotshot.c 30 Jun 2002 15:26:09 -0000 1.19 --- _hotshot.c 17 Jul 2002 16:15:35 -0000 1.20 *************** *** 121,129 **** } - #if Py_TPFLAGS_HAVE_ITER - /* This is only used if the interpreter has iterator support; the - * iternext handler is also used as a helper for other functions, so - * does not need to be included in this conditional section. - */ static PyObject * logreader_tp_iter(LogReaderObject *self) --- 121,124 ---- *************** *** 132,136 **** return (PyObject *) self; } - #endif --- 127,130 ---- *************** *** 523,547 **** } - PyDoc_STRVAR(next__doc__, - "next() -> event-info\n" - "Return the next event record from the log file."); - - static PyObject * - logreader_next(LogReaderObject *self, PyObject *args) - { - PyObject *result = NULL; - - if (PyArg_ParseTuple(args, ":next")) { - result = logreader_tp_iternext(self); - /* XXX return None if there's nothing left */ - /* tp_iternext does the right thing, though */ - if (result == NULL && !PyErr_Occurred()) { - result = Py_None; - Py_INCREF(result); - } - } - return result; - } - static void do_stop(ProfilerObject *self); --- 517,520 ---- *************** *** 1182,1189 **** } - /* Always use METH_VARARGS even though some of these could be METH_NOARGS; - * this allows us to maintain compatibility with Python versions < 2.2 - * more easily, requiring only the changes to the dispatcher to be made. - */ static PyMethodDef profiler_methods[] = { {"addinfo", (PyCFunction)profiler_addinfo, METH_VARARGS, addinfo__doc__}, --- 1155,1158 ---- *************** *** 1196,1204 **** }; ! /* Use a table even though there's only one "simple" member; this allows ! * __members__ and therefore dir() to work. ! */ ! static struct memberlist profiler_members[] = { ! {"closed", T_INT, -1, READONLY}, {"frametimings", T_LONG, offsetof(ProfilerObject, linetimings), READONLY}, {"lineevents", T_LONG, offsetof(ProfilerObject, lineevents), READONLY}, --- 1165,1169 ---- }; ! static PyMemberDef profiler_members[] = { {"frametimings", T_LONG, offsetof(ProfilerObject, linetimings), READONLY}, {"lineevents", T_LONG, offsetof(ProfilerObject, lineevents), READONLY}, *************** *** 1208,1228 **** static PyObject * ! profiler_getattr(ProfilerObject *self, char *name) { ! PyObject *result; ! if (strcmp(name, "closed") == 0) { ! result = (self->logfp == NULL) ? Py_True : Py_False; ! Py_INCREF(result); ! } ! else { ! result = PyMember_Get((char *)self, profiler_members, name); ! if (result == NULL) { ! PyErr_Clear(); ! result = Py_FindMethod(profiler_methods, (PyObject *)self, name); ! } ! } return result; } PyDoc_STRVAR(profiler_object__doc__, --- 1173,1188 ---- static PyObject * ! profiler_get_closed(ProfilerObject *self, void *closure) { ! PyObject *result = (self->logfp == NULL) ? Py_True : Py_False; ! Py_INCREF(result); return result; } + static PyGetSetDef profiler_getsets[] = { + {"closed", (getter)profiler_get_closed, NULL}, + {NULL} + }; + PyDoc_STRVAR(profiler_object__doc__, *************** *** 1252,1256 **** (destructor)profiler_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)profiler_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 1212,1216 ---- (destructor)profiler_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 1262,1270 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ profiler_object__doc__, /* tp_doc */ }; --- 1222,1243 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ profiler_object__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + profiler_methods, /* tp_methods */ + profiler_members, /* tp_members */ + profiler_getsets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ }; *************** *** 1273,1290 **** {"close", (PyCFunction)logreader_close, METH_VARARGS, logreader_close__doc__}, - {"next", (PyCFunction)logreader_next, METH_VARARGS, - next__doc__}, {NULL, NULL} }; ! static PyObject * ! logreader_getattr(LogReaderObject *self, char *name) ! { ! if (strcmp(name, "info") == 0) { ! Py_INCREF(self->info); ! return self->info; ! } ! return Py_FindMethod(logreader_methods, (PyObject *)self, name); ! } --- 1246,1256 ---- {"close", (PyCFunction)logreader_close, METH_VARARGS, logreader_close__doc__}, {NULL, NULL} }; ! static PyMemberDef logreader_members[] = { ! {"info", T_OBJECT, offsetof(LogReaderObject, info), RO}, ! {NULL} ! }; *************** *** 1314,1318 **** (destructor)logreader_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)logreader_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 1280,1284 ---- (destructor)logreader_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 1324,1333 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ logreader__doc__, /* tp_doc */ - #if Py_TPFLAGS_HAVE_ITER 0, /* tp_traverse */ 0, /* tp_clear */ --- 1290,1298 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ logreader__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ *************** *** 1336,1340 **** (getiterfunc)logreader_tp_iter, /* tp_iter */ (iternextfunc)logreader_tp_iternext,/* tp_iternext */ ! #endif }; --- 1301,1311 ---- (getiterfunc)logreader_tp_iter, /* tp_iter */ (iternextfunc)logreader_tp_iternext,/* tp_iternext */ ! logreader_methods, /* tp_methods */ ! logreader_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ }; From jhylton@users.sourceforge.net Wed Jul 17 17:30:41 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:30:41 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenObjectDefinition.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv17711/Tools/bgen/bgen Modified Files: bgenObjectDefinition.py Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: bgenObjectDefinition.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenObjectDefinition.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** bgenObjectDefinition.py 19 Apr 2002 14:29:47 -0000 1.16 --- bgenObjectDefinition.py 17 Jul 2002 16:30:38 -0000 1.17 *************** *** 41,45 **** OutHeader2("Object type " + self.name) ! sf = self.static and "staticforward " Output("%sPyTypeObject %s;", sf, self.typename) Output() --- 41,45 ---- OutHeader2("Object type " + self.name) ! sf = self.static and "static " Output("%sPyTypeObject %s;", sf, self.typename) Output() *************** *** 165,169 **** def outputTypeObject(self): ! sf = self.static and "staticforward " Output() Output("%sPyTypeObject %s = {", sf, self.typename) --- 165,169 ---- def outputTypeObject(self): ! sf = self.static and "static " Output() Output("%sPyTypeObject %s = {", sf, self.typename) From jhylton@users.sourceforge.net Wed Jul 17 17:30:41 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:30:41 -0700 Subject: [Python-checkins] python/dist/src/Tools/modulator/Templates object_head,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/modulator/Templates In directory usw-pr-cvs1:/tmp/cvs-serv17711/Tools/modulator/Templates Modified Files: object_head Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: object_head =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/modulator/Templates/object_head,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** object_head 16 May 1995 13:46:51 -0000 1.2 --- object_head 17 Jul 2002 16:30:39 -0000 1.3 *************** *** 7,11 **** } $abbrev$object; ! staticforward PyTypeObject $Abbrev$type; --- 7,11 ---- } $abbrev$object; ! static PyTypeObject $Abbrev$type; From jhylton@users.sourceforge.net Wed Jul 17 17:30:41 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:30:41 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.317,2.318 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv17711/Python Modified Files: ceval.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.317 retrieving revision 2.318 diff -C2 -d -r2.317 -r2.318 *** ceval.c 17 Jul 2002 00:15:22 -0000 2.317 --- ceval.c 17 Jul 2002 16:30:38 -0000 2.318 *************** *** 85,89 **** #endif ! staticforward PyTypeObject gentype; typedef struct { --- 85,89 ---- #endif ! static PyTypeObject gentype; typedef struct { From jhylton@users.sourceforge.net Wed Jul 17 17:30:40 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:30:40 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.127,2.128 floatobject.c,2.113,2.114 intobject.c,2.84,2.85 listobject.c,2.120,2.121 longobject.c,1.119,1.120 rangeobject.c,2.42,2.43 stringobject.c,2.169,2.170 tupleobject.c,2.69,2.70 typeobject.c,2.160,2.161 unicodeobject.c,2.155,2.156 xxobject.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17711/Objects Modified Files: dictobject.c floatobject.c intobject.c listobject.c longobject.c rangeobject.c stringobject.c tupleobject.c typeobject.c unicodeobject.c xxobject.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -d -r2.127 -r2.128 *** dictobject.c 16 Jul 2002 20:30:22 -0000 2.127 --- dictobject.c 17 Jul 2002 16:30:37 -0000 2.128 *************** *** 1612,1616 **** ! staticforward PyObject *dictiter_new(dictobject *, binaryfunc); static PyObject * --- 1612,1616 ---- ! static PyObject *dictiter_new(dictobject *, binaryfunc); static PyObject * Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.113 retrieving revision 2.114 diff -C2 -d -r2.113 -r2.114 *** floatobject.c 13 Jun 2002 20:33:00 -0000 2.113 --- floatobject.c 17 Jul 2002 16:30:38 -0000 2.114 *************** *** 679,683 **** ! staticforward PyObject * float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); --- 679,683 ---- ! static PyObject * float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -d -r2.84 -r2.85 *** intobject.c 13 Jun 2002 20:33:00 -0000 2.84 --- intobject.c 17 Jul 2002 16:30:38 -0000 2.85 *************** *** 776,780 **** } ! staticforward PyObject * int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); --- 776,780 ---- } ! static PyObject * int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.120 retrieving revision 2.121 diff -C2 -d -r2.120 -r2.121 *** listobject.c 16 Jul 2002 20:10:23 -0000 2.120 --- listobject.c 17 Jul 2002 16:30:38 -0000 2.121 *************** *** 1283,1287 **** #undef SETK ! staticforward PyTypeObject immutable_list_type; static PyObject * --- 1283,1287 ---- #undef SETK ! static PyTypeObject immutable_list_type; static PyObject * Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** longobject.c 13 Jul 2002 14:31:51 -0000 1.119 --- longobject.c 17 Jul 2002 16:30:38 -0000 1.120 *************** *** 2200,2204 **** return long_format(v, 16, 1); } ! staticforward PyObject * long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); --- 2200,2205 ---- return long_format(v, 16, 1); } ! ! static PyObject * long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** rangeobject.c 16 Jul 2002 20:47:50 -0000 2.42 --- rangeobject.c 17 Jul 2002 16:30:38 -0000 2.43 *************** *** 164,168 **** }; ! staticforward PyObject * range_iter(PyObject *seq); PyTypeObject PyRange_Type = { --- 164,168 ---- }; ! static PyObject * range_iter(PyObject *seq); PyTypeObject PyRange_Type = { *************** *** 218,222 **** } rangeiterobject; ! staticforward PyTypeObject Pyrangeiter_Type; static PyObject * --- 218,222 ---- } rangeiterobject; ! static PyTypeObject Pyrangeiter_Type; static PyObject * Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** stringobject.c 11 Jul 2002 06:23:50 -0000 2.169 --- stringobject.c 17 Jul 2002 16:30:38 -0000 2.170 *************** *** 2865,2869 **** }; ! staticforward PyObject * str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); --- 2865,2869 ---- }; ! static PyObject * str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** tupleobject.c 11 Jul 2002 06:23:50 -0000 2.69 --- tupleobject.c 17 Jul 2002 16:30:38 -0000 2.70 *************** *** 480,484 **** } ! staticforward PyObject * tuple_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); --- 480,484 ---- } ! static PyObject * tuple_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.160 retrieving revision 2.161 diff -C2 -d -r2.160 -r2.161 *** typeobject.c 16 Jul 2002 19:39:38 -0000 2.160 --- typeobject.c 17 Jul 2002 16:30:38 -0000 2.161 *************** *** 357,361 **** } ! staticforward PyObject *lookup_maybe(PyObject *, char *, PyObject **); static int --- 357,361 ---- } ! static PyObject *lookup_maybe(PyObject *, char *, PyObject **); static int *************** *** 470,474 **** } ! staticforward PyTypeObject *solid_base(PyTypeObject *type); /* type test with subclassing support */ --- 470,474 ---- } ! static PyTypeObject *solid_base(PyTypeObject *type); /* type test with subclassing support */ *************** *** 895,902 **** } ! staticforward void object_dealloc(PyObject *); ! staticforward int object_init(PyObject *, PyObject *, PyObject *); ! staticforward int update_slot(PyTypeObject *, PyObject *); ! staticforward void fixup_slot_dispatchers(PyTypeObject *); static PyObject * --- 895,902 ---- } ! static void object_dealloc(PyObject *); ! static int object_init(PyObject *, PyObject *, PyObject *); ! static int update_slot(PyTypeObject *, PyObject *); ! static void fixup_slot_dispatchers(PyTypeObject *); static PyObject * *************** *** 2188,2193 **** } ! staticforward int add_operators(PyTypeObject *); ! staticforward int add_subclass(PyTypeObject *base, PyTypeObject *type); int --- 2188,2193 ---- } ! static int add_operators(PyTypeObject *); ! static int add_subclass(PyTypeObject *base, PyTypeObject *type); int *************** *** 3119,3123 **** SLOT1BIN(slot_nb_divmod, nb_divmod, "__divmod__", "__rdivmod__") ! staticforward PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *); SLOT1BINFULL(slot_nb_power_binary, slot_nb_power, --- 3119,3123 ---- SLOT1BIN(slot_nb_divmod, nb_divmod, "__divmod__", "__rdivmod__") ! static PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *); SLOT1BINFULL(slot_nb_power_binary, slot_nb_power, *************** *** 4014,4019 **** } ! staticforward int recurse_down_subclasses(PyTypeObject *type, ! slotdef **pp, PyObject *name); /* In the type, update the slots whose slotdefs are gathered in the pp0 array, --- 4014,4019 ---- } ! 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, Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.155 retrieving revision 2.156 diff -C2 -d -r2.155 -r2.156 *** unicodeobject.c 30 Jun 2002 15:26:10 -0000 2.155 --- unicodeobject.c 17 Jul 2002 16:30:38 -0000 2.156 *************** *** 5797,5801 **** }; ! staticforward PyObject * unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); --- 5797,5801 ---- }; ! static PyObject * unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); Index: xxobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/xxobject.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** xxobject.c 23 May 2002 15:51:20 -0000 2.20 --- xxobject.c 17 Jul 2002 16:30:38 -0000 2.21 *************** *** 19,23 **** } xxobject; ! staticforward PyTypeObject Xxtype; #define is_xxobject(v) ((v)->ob_type == &Xxtype) --- 19,23 ---- } xxobject; ! static PyTypeObject Xxtype; #define is_xxobject(v) ((v)->ob_type == &Xxtype) From jhylton@users.sourceforge.net Wed Jul 17 17:30:40 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:30:40 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.80,2.81 _ssl.c,1.5,1.6 _tkinter.c,1.125,1.126 almodule.c,1.36,1.37 arraymodule.c,2.75,2.76 bsddbmodule.c,1.35,1.36 cPickle.c,2.89,2.90 cmathmodule.c,2.30,2.31 dbmmodule.c,2.30,2.31 dlmodule.c,2.21,2.22 flmodule.c,1.49,1.50 fmmodule.c,1.20,1.21 gdbmmodule.c,2.33,2.34 linuxaudiodev.c,2.18,2.19 md5module.c,2.30,2.31 mpzmodule.c,2.43,2.44 parsermodule.c,2.70,2.71 pcremodule.c,2.31,2.32 pyexpat.c,2.67,2.68 rotormodule.c,2.34,2.35 selectmodule.c,2.64,2.65 shamodule.c,2.19,2.20 socketmodule.c,1.229,1.230 sunaudiodev.c,1.29,1.30 threadmodule.c,2.50,2.51 xreadlinesmodule.c,1.10,1.11 xxmodule.c,2.28,2.29 xxsubtype.c,2.15,2.16 zlibmodule.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17711/Modules Modified Files: _sre.c _ssl.c _tkinter.c almodule.c arraymodule.c bsddbmodule.c cPickle.c cmathmodule.c dbmmodule.c dlmodule.c flmodule.c fmmodule.c gdbmmodule.c linuxaudiodev.c md5module.c mpzmodule.c parsermodule.c pcremodule.c pyexpat.c rotormodule.c selectmodule.c shamodule.c socketmodule.c sunaudiodev.c threadmodule.c xreadlinesmodule.c xxmodule.c xxsubtype.c zlibmodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -d -r2.80 -r2.81 *** _sre.c 13 Jun 2002 21:11:11 -0000 2.80 --- _sre.c 17 Jul 2002 16:30:35 -0000 2.81 *************** *** 1294,1300 **** /* see sre.h for object declarations */ ! staticforward PyTypeObject Pattern_Type; ! staticforward PyTypeObject Match_Type; ! staticforward PyTypeObject Scanner_Type; static PyObject * --- 1294,1300 ---- /* see sre.h for object declarations */ ! static PyTypeObject Pattern_Type; ! static PyTypeObject Match_Type; ! static PyTypeObject Scanner_Type; static PyObject * Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _ssl.c 2 Jul 2002 18:25:00 -0000 1.5 --- _ssl.c 17 Jul 2002 16:30:35 -0000 1.6 *************** *** 62,68 **** } PySSLObject; ! staticforward PyTypeObject PySSL_Type; ! staticforward PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args); ! staticforward PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args); #define PySSLObject_Check(v) ((v)->ob_type == &PySSL_Type) --- 62,68 ---- } PySSLObject; ! static PyTypeObject PySSL_Type; ! static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args); ! static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args); #define PySSLObject_Check(v) ((v)->ob_type == &PySSL_Type) *************** *** 355,359 **** } ! staticforward PyTypeObject PySSL_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 355,359 ---- } ! static PyTypeObject PySSL_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** _tkinter.c 4 Jun 2002 17:14:07 -0000 1.125 --- _tkinter.c 17 Jul 2002 16:30:35 -0000 1.126 *************** *** 187,191 **** int TkMacConvertEvent(EventRecord *eventPtr); ! staticforward int PyMacConvertEvent(EventRecord *eventPtr); #include --- 187,191 ---- int TkMacConvertEvent(EventRecord *eventPtr); ! static int PyMacConvertEvent(EventRecord *eventPtr); #include *************** *** 200,204 **** /**** Tkapp Object Declaration ****/ ! staticforward PyTypeObject Tkapp_Type; typedef struct { --- 200,204 ---- /**** Tkapp Object Declaration ****/ ! static PyTypeObject Tkapp_Type; typedef struct { *************** *** 1516,1520 **** /**** Tktt Object (timer token) ****/ ! staticforward PyTypeObject Tktt_Type; typedef struct { --- 1516,1520 ---- /**** Tktt Object (timer token) ****/ ! static PyTypeObject Tktt_Type; typedef struct { Index: almodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/almodule.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** almodule.c 13 Jun 2002 20:32:48 -0000 1.36 --- almodule.c 17 Jul 2002 16:30:35 -0000 1.37 *************** *** 25,29 **** } alpobject; ! staticforward PyTypeObject Alptype; --- 25,29 ---- } alpobject; ! static PyTypeObject Alptype; *************** *** 39,43 **** } alcobject; ! staticforward PyTypeObject Alctype; --- 39,43 ---- } alcobject; ! static PyTypeObject Alctype; Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.75 retrieving revision 2.76 diff -C2 -d -r2.75 -r2.76 *** arraymodule.c 19 Jun 2002 15:44:15 -0000 2.75 --- arraymodule.c 17 Jul 2002 16:30:36 -0000 2.76 *************** *** 36,40 **** } arrayobject; ! staticforward PyTypeObject Arraytype; #define array_Check(op) PyObject_TypeCheck(op, &Arraytype) --- 36,40 ---- } arrayobject; ! static PyTypeObject Arraytype; #define array_Check(op) PyObject_TypeCheck(op, &Arraytype) Index: bsddbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bsddbmodule.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** bsddbmodule.c 23 Apr 2002 02:11:03 -0000 1.35 --- bsddbmodule.c 17 Jul 2002 16:30:36 -0000 1.36 *************** *** 40,44 **** } bsddbobject; ! staticforward PyTypeObject Bsddbtype; #define is_bsddbobject(v) ((v)->ob_type == &Bsddbtype) --- 40,44 ---- } bsddbobject; ! static PyTypeObject Bsddbtype; #define is_bsddbobject(v) ((v)->ob_type == &Bsddbtype) Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -d -r2.89 -r2.90 *** cPickle.c 16 Jul 2002 19:47:43 -0000 2.89 --- cPickle.c 17 Jul 2002 16:30:36 -0000 2.90 *************** *** 289,293 **** #endif ! staticforward PyTypeObject Picklertype; typedef struct Unpicklerobject { --- 289,293 ---- #endif ! static PyTypeObject Picklertype; typedef struct Unpicklerobject { *************** *** 314,318 **** } Unpicklerobject; ! staticforward PyTypeObject Unpicklertype; /* Forward decls that need the above structs */ --- 314,318 ---- } Unpicklerobject; ! static PyTypeObject Unpicklertype; /* Forward decls that need the above structs */ Index: cmathmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cmathmodule.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** cmathmodule.c 13 Jun 2002 20:32:49 -0000 2.30 --- cmathmodule.c 17 Jul 2002 16:30:36 -0000 2.31 *************** *** 18,24 **** /* forward declarations */ ! staticforward Py_complex c_log(Py_complex); ! staticforward Py_complex c_prodi(Py_complex); ! staticforward Py_complex c_sqrt(Py_complex); --- 18,24 ---- /* forward declarations */ ! static Py_complex c_log(Py_complex); ! static Py_complex c_prodi(Py_complex); ! static Py_complex c_sqrt(Py_complex); Index: dbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dbmmodule.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** dbmmodule.c 14 Jun 2002 20:30:31 -0000 2.30 --- dbmmodule.c 17 Jul 2002 16:30:36 -0000 2.31 *************** *** 32,36 **** } dbmobject; ! staticforward PyTypeObject Dbmtype; #define is_dbmobject(v) ((v)->ob_type == &Dbmtype) --- 32,36 ---- } dbmobject; ! static PyTypeObject Dbmtype; #define is_dbmobject(v) ((v)->ob_type == &Dbmtype) Index: dlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dlmodule.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** dlmodule.c 31 Mar 2002 15:43:28 -0000 2.21 --- dlmodule.c 17 Jul 2002 16:30:36 -0000 2.22 *************** *** 16,20 **** } dlobject; ! staticforward PyTypeObject Dltype; static PyObject *Dlerror; --- 16,20 ---- } dlobject; ! static PyTypeObject Dltype; static PyObject *Dlerror; Index: flmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/flmodule.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** flmodule.c 31 Mar 2002 15:56:56 -0000 1.49 --- flmodule.c 17 Jul 2002 16:30:36 -0000 1.50 *************** *** 30,34 **** } genericobject; ! staticforward PyTypeObject GenericObjecttype; #define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) --- 30,34 ---- } genericobject; ! static PyTypeObject GenericObjecttype; #define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) *************** *** 1190,1194 **** } formobject; ! staticforward PyTypeObject Formtype; #define is_formobject(v) ((v)->ob_type == &Formtype) --- 1190,1194 ---- } formobject; ! static PyTypeObject Formtype; #define is_formobject(v) ((v)->ob_type == &Formtype) Index: fmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fmmodule.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** fmmodule.c 31 Mar 2002 14:57:24 -0000 1.20 --- fmmodule.c 17 Jul 2002 16:30:36 -0000 1.21 *************** *** 16,20 **** } fhobject; ! staticforward PyTypeObject Fhtype; #define is_fhobject(v) ((v)->ob_type == &Fhtype) --- 16,20 ---- } fhobject; ! static PyTypeObject Fhtype; #define is_fhobject(v) ((v)->ob_type == &Fhtype) Index: gdbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gdbmmodule.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -d -r2.33 -r2.34 *** gdbmmodule.c 13 Jun 2002 20:32:49 -0000 2.33 --- gdbmmodule.c 17 Jul 2002 16:30:36 -0000 2.34 *************** *** 35,39 **** } dbmobject; ! staticforward PyTypeObject Dbmtype; #define is_dbmobject(v) ((v)->ob_type == &Dbmtype) --- 35,39 ---- } dbmobject; ! static PyTypeObject Dbmtype; #define is_dbmobject(v) ((v)->ob_type == &Dbmtype) Index: linuxaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/linuxaudiodev.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** linuxaudiodev.c 27 Apr 2002 18:44:31 -0000 2.18 --- linuxaudiodev.c 17 Jul 2002 16:30:36 -0000 2.19 *************** *** 71,75 **** static int n_audio_types = sizeof(audio_types) / sizeof(audio_types[0]); ! staticforward PyTypeObject Ladtype; static PyObject *LinuxAudioError; --- 71,75 ---- static int n_audio_types = sizeof(audio_types) / sizeof(audio_types[0]); ! static PyTypeObject Ladtype; static PyObject *LinuxAudioError; Index: md5module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/md5module.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** md5module.c 13 Jun 2002 20:32:50 -0000 2.30 --- md5module.c 17 Jul 2002 16:30:37 -0000 2.31 *************** *** 18,22 **** } md5object; ! staticforward PyTypeObject MD5type; #define is_md5object(v) ((v)->ob_type == &MD5type) --- 18,22 ---- } md5object; ! static PyTypeObject MD5type; #define is_md5object(v) ((v)->ob_type == &MD5type) Index: mpzmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -d -r2.43 -r2.44 *** mpzmodule.c 1 Apr 2002 01:37:14 -0000 2.43 --- mpzmodule.c 17 Jul 2002 16:30:37 -0000 2.44 *************** *** 76,80 **** } mpzobject; ! staticforward PyTypeObject MPZtype; #define is_mpzobject(v) ((v)->ob_type == &MPZtype) --- 76,80 ---- } mpzobject; ! static PyTypeObject MPZtype; #define is_mpzobject(v) ((v)->ob_type == &MPZtype) Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** parsermodule.c 13 Jun 2002 20:32:50 -0000 2.70 --- parsermodule.c 17 Jul 2002 16:30:37 -0000 2.71 *************** *** 158,169 **** ! staticforward void ! parser_free(PyST_Object *st); ! ! staticforward int ! parser_compare(PyST_Object *left, PyST_Object *right); ! ! staticforward PyObject * ! parser_getattr(PyObject *self, char *name); --- 158,164 ---- ! static void parser_free(PyST_Object *st); ! static int parser_compare(PyST_Object *left, PyST_Object *right); ! static PyObject *parser_getattr(PyObject *self, char *name); *************** *** 551,557 **** ! staticforward node* build_node_tree(PyObject *tuple); ! staticforward int validate_expr_tree(node *tree); ! staticforward int validate_file_input(node *tree); --- 546,552 ---- ! static node* build_node_tree(PyObject *tuple); ! static int validate_expr_tree(node *tree); ! static int validate_file_input(node *tree); *************** *** 794,798 **** * Validation routines used within the validation section: */ ! staticforward int validate_terminal(node *terminal, int type, char *string); #define validate_ampersand(ch) validate_terminal(ch, AMPER, "&") --- 789,793 ---- * Validation routines used within the validation section: */ ! static int validate_terminal(node *terminal, int type, char *string); #define validate_ampersand(ch) validate_terminal(ch, AMPER, "&") Index: pcremodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pcremodule.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** pcremodule.c 17 Jan 2002 23:15:58 -0000 2.31 --- pcremodule.c 17 Jul 2002 16:30:37 -0000 2.32 *************** *** 25,29 **** } PcreObject; ! staticforward PyTypeObject Pcre_Type; #define PcreObject_Check(v) ((v)->ob_type == &Pcre_Type) --- 25,29 ---- } PcreObject; ! static PyTypeObject Pcre_Type; #define PcreObject_Check(v) ((v)->ob_type == &Pcre_Type) *************** *** 126,130 **** ! staticforward PyTypeObject Pcre_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 126,130 ---- ! static PyTypeObject Pcre_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** pyexpat.c 2 Jul 2002 15:44:36 -0000 2.67 --- pyexpat.c 17 Jul 2002 16:30:37 -0000 2.68 *************** *** 67,71 **** #define CHARACTER_DATA_BUFFER_SIZE 8192 ! staticforward PyTypeObject Xmlparsetype; typedef void (*xmlhandlersetter)(XML_Parser *self, void *meth); --- 67,71 ---- #define CHARACTER_DATA_BUFFER_SIZE 8192 ! static PyTypeObject Xmlparsetype; typedef void (*xmlhandlersetter)(XML_Parser *self, void *meth); *************** *** 80,84 **** }; ! staticforward struct HandlerInfo handler_info[64]; /* Set an integer attribute on the error object; return true on success, --- 80,84 ---- }; ! static struct HandlerInfo handler_info[64]; /* Set an integer attribute on the error object; return true on success, Index: rotormodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/rotormodule.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** rotormodule.c 10 Jun 2002 19:46:18 -0000 2.34 --- rotormodule.c 17 Jul 2002 16:30:37 -0000 2.35 *************** *** 79,83 **** } Rotorobj; ! staticforward PyTypeObject Rotor_Type; #define is_rotor(v) ((v)->ob_type == &Rotor_Type) --- 79,83 ---- } Rotorobj; ! static PyTypeObject Rotor_Type; #define is_rotor(v) ((v)->ob_type == &Rotor_Type) Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -d -r2.64 -r2.65 *** selectmodule.c 13 Jun 2002 20:32:52 -0000 2.64 --- selectmodule.c 17 Jul 2002 16:30:37 -0000 2.65 *************** *** 323,327 **** } pollObject; ! staticforward PyTypeObject poll_Type; /* Update the malloc'ed array of pollfds to match the dictionary --- 323,327 ---- } pollObject; ! static PyTypeObject poll_Type; /* Update the malloc'ed array of pollfds to match the dictionary Index: shamodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/shamodule.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** shamodule.c 13 Jun 2002 20:32:52 -0000 2.19 --- shamodule.c 17 Jul 2002 16:30:37 -0000 2.20 *************** *** 331,335 **** */ ! staticforward PyTypeObject SHAtype; --- 331,335 ---- */ ! static PyTypeObject SHAtype; Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.229 retrieving revision 1.230 diff -C2 -d -r1.229 -r1.230 *** socketmodule.c 2 Jul 2002 14:40:42 -0000 1.229 --- socketmodule.c 17 Jul 2002 16:30:37 -0000 1.230 *************** *** 277,281 **** some of which call new_sockobject(), which uses sock_type, so there has to be a circular reference. */ ! staticforward PyTypeObject sock_type; /* Convenience function to raise an error according to errno --- 277,281 ---- some of which call new_sockobject(), which uses sock_type, so there has to be a circular reference. */ ! static PyTypeObject sock_type; /* Convenience function to raise an error according to errno Index: sunaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sunaudiodev.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** sunaudiodev.c 31 Mar 2002 15:27:00 -0000 1.29 --- sunaudiodev.c 17 Jul 2002 16:30:37 -0000 1.30 *************** *** 37,42 **** } sadstatusobject; ! staticforward PyTypeObject Sadtype; ! staticforward PyTypeObject Sadstatustype; static sadstatusobject *sads_alloc(void); /* Forward */ --- 37,42 ---- } sadstatusobject; ! static PyTypeObject Sadtype; ! static PyTypeObject Sadstatustype; static sadstatusobject *sads_alloc(void); /* Forward */ Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** threadmodule.c 13 Jun 2002 20:32:53 -0000 2.50 --- threadmodule.c 17 Jul 2002 16:30:37 -0000 2.51 *************** *** 23,27 **** } lockobject; ! staticforward PyTypeObject Locktype; static lockobject * --- 23,27 ---- } lockobject; ! static PyTypeObject Locktype; static lockobject * Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** xreadlinesmodule.c 13 Jun 2002 20:32:53 -0000 1.10 --- xreadlinesmodule.c 17 Jul 2002 16:30:37 -0000 1.11 *************** *** 15,19 **** } PyXReadlinesObject; ! staticforward PyTypeObject XReadlinesObject_Type; static void --- 15,19 ---- } PyXReadlinesObject; ! static PyTypeObject XReadlinesObject_Type; static void Index: xxmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** xxmodule.c 23 May 2002 15:49:38 -0000 2.28 --- xxmodule.c 17 Jul 2002 16:30:37 -0000 2.29 *************** *** 24,28 **** } XxoObject; ! staticforward PyTypeObject Xxo_Type; #define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type) --- 24,28 ---- } XxoObject; ! static PyTypeObject Xxo_Type; #define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type) Index: xxsubtype.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxsubtype.c,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** xxsubtype.c 13 Jun 2002 20:32:54 -0000 2.15 --- xxsubtype.c 17 Jul 2002 16:30:37 -0000 2.16 *************** *** 80,84 **** }; ! staticforward PyTypeObject spamlist_type; static int --- 80,84 ---- }; ! static PyTypeObject spamlist_type; static int *************** *** 180,184 **** }; ! staticforward PyTypeObject spamdict_type; static int --- 180,184 ---- }; ! static PyTypeObject spamdict_type; static int Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** zlibmodule.c 13 Jun 2002 20:32:54 -0000 2.62 --- zlibmodule.c 17 Jul 2002 16:30:37 -0000 2.63 *************** *** 56,61 **** #define PyInit_zlib initzlib ! staticforward PyTypeObject Comptype; ! staticforward PyTypeObject Decomptype; static PyObject *ZlibError; --- 56,61 ---- #define PyInit_zlib initzlib ! static PyTypeObject Comptype; ! static PyTypeObject Decomptype; static PyObject *ZlibError; From jhylton@users.sourceforge.net Wed Jul 17 17:31:06 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/test/mkcwproj mkcwtestmodule.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/test/mkcwproj In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Lib/test/mkcwproj Modified Files: mkcwtestmodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: mkcwtestmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/test/mkcwproj/mkcwtestmodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mkcwtestmodule.c 8 Dec 2001 18:02:51 -0000 1.2 --- mkcwtestmodule.c 17 Jul 2002 16:30:34 -0000 1.3 *************** *** 24,28 **** } XxoObject; ! staticforward PyTypeObject Xxo_Type; #define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type) --- 24,28 ---- } XxoObject; ! static PyTypeObject Xxo_Type; #define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type) From jhylton@users.sourceforge.net Wed Jul 17 17:31:06 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:06 -0700 Subject: [Python-checkins] python/dist/src configure,1.318,1.319 configure.in,1.328,1.329 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17711 Modified Files: configure configure.in Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.318 retrieving revision 1.319 diff -C2 -d -r1.318 -r1.319 *** configure 8 Jul 2002 14:47:12 -0000 1.318 --- configure 17 Jul 2002 16:30:32 -0000 1.319 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.327 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.328 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 13774,13835 **** fi rm -f conftest.$ac_objext conftest.$ac_ext - - echo "$as_me:$LINENO: checking for bad static forward" >&5 - echo $ECHO_N "checking for bad static forward... $ECHO_C" >&6 - if test "${ac_cv_bad_static_forward+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - if test "$cross_compiling" = yes; then - ac_cv_bad_static_forward=no - else - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - - struct s { int a; int b; }; - static struct s foo; - int foobar() { - static int random; - random = (int) &foo; - return random; - } - static struct s foo = { 1, 2 }; - main() { - exit(!((int)&foo == foobar())); - } - _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_bad_static_forward=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_bad_static_forward=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_bad_static_forward" >&5 - echo "${ECHO_T}$ac_cv_bad_static_forward" >&6 - if test "$ac_cv_bad_static_forward" = yes - then - - cat >>confdefs.h <<\_ACEOF - #define BAD_STATIC_FORWARD 1 - _ACEOF - - fi va_list_is_array=no --- 13774,13777 ---- Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.328 retrieving revision 1.329 diff -C2 -d -r1.328 -r1.329 *** configure.in 8 Jul 2002 14:46:55 -0000 1.328 --- configure.in 17 Jul 2002 16:30:34 -0000 1.329 *************** *** 1897,1925 **** AC_MSG_RESULT(no)) - AC_MSG_CHECKING(for bad static forward) - AC_CACHE_VAL(ac_cv_bad_static_forward, - [AC_TRY_RUN([ - struct s { int a; int b; }; - static struct s foo; - int foobar() { - static int random; - random = (int) &foo; - return random; - } - static struct s foo = { 1, 2 }; - main() { - exit(!((int)&foo == foobar())); - }], - ac_cv_bad_static_forward=no, - ac_cv_bad_static_forward=yes, - ac_cv_bad_static_forward=no)]) - AC_MSG_RESULT($ac_cv_bad_static_forward) - if test "$ac_cv_bad_static_forward" = yes - then - AC_DEFINE(BAD_STATIC_FORWARD, 1, - [Define if your compiler botches static forward declarations - (as it does on SCI ODT 3.0)]) - fi - va_list_is_array=no AC_MSG_CHECKING(whether va_list is an array) --- 1897,1900 ---- From jhylton@users.sourceforge.net Wed Jul 17 17:31:06 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:06 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.107,2.108 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17711/Include Modified Files: object.h Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.107 retrieving revision 2.108 diff -C2 -d -r2.107 -r2.108 *** object.h 11 Jul 2002 06:23:49 -0000 2.107 --- object.h 17 Jul 2002 16:30:34 -0000 2.108 *************** *** 617,642 **** /* ! A common programming style in Python requires the forward declaration ! of static, initialized structures, e.g. for a type object that is used ! by the functions whose address must be used in the initializer. ! Some compilers (notably SCO ODT 3.0, I seem to remember early AIX as ! well) botch this if you use the static keyword for both declarations ! (they allocate two objects, and use the first, uninitialized one until ! the second declaration is encountered). Therefore, the forward ! declaration should use the 'forwardstatic' keyword. This expands to ! static on most systems, but to extern on a few. The actual storage ! and name will still be static because the second declaration is ! static, so no linker visible symbols will be generated. (Standard C ! compilers take offense to the extern forward declaration of a static ! object, so I can't just put extern in all cases. :-( ) */ - #ifdef BAD_STATIC_FORWARD - #define staticforward extern - #define statichere static - #else /* !BAD_STATIC_FORWARD */ #define staticforward static #define statichere static - #endif /* !BAD_STATIC_FORWARD */ --- 617,633 ---- /* ! Define staticforward and statichere for source compatibility with old ! C extensions. ! ! The staticforward define was needed to support certain broken C ! compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the ! static keyword when it was used with a forward declaration of a static ! initialized structure. Standard C allows the forward declaration with ! static, and we've decided to stop catering to broken C compilers. ! (In fact, we expect that the compilers are all fixed eight years later.) */ #define staticforward static #define statichere static From jhylton@users.sourceforge.net Wed Jul 17 17:31:06 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Modules/ctl Modified Files: _Ctlmodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: _Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** _Ctlmodule.c 23 Apr 2002 22:45:20 -0000 1.17 --- _Ctlmodule.c 17 Jul 2002 16:30:34 -0000 1.18 *************** *** 36,40 **** #endif ! staticforward PyObject *CtlObj_WhichControl(ControlHandle); #define as_Control(h) ((ControlHandle)h) --- 36,40 ---- #endif ! static PyObject *CtlObj_WhichControl(ControlHandle); #define as_Control(h) ((ControlHandle)h) *************** *** 140,146 **** static ControlUserPaneTrackingUPP mytrackingproc_upp; ! staticforward int settrackfunc(PyObject *); /* forward */ ! staticforward void clrtrackfunc(void); /* forward */ ! staticforward int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); static PyObject *Ctl_Error; --- 140,146 ---- static ControlUserPaneTrackingUPP mytrackingproc_upp; ! static int settrackfunc(PyObject *); /* forward */ ! static void clrtrackfunc(void); /* forward */ ! static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); static PyObject *Ctl_Error; From jhylton@users.sourceforge.net Wed Jul 17 17:31:07 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd _Qdmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Modules/qd Modified Files: _Qdmodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: _Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/_Qdmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Qdmodule.c 23 Apr 2002 22:44:08 -0000 1.9 --- _Qdmodule.c 17 Jul 2002 16:30:35 -0000 1.10 *************** *** 112,116 **** #endif /* !TARGET_API_MAC_CARBON */ ! staticforward PyObject *BMObj_NewCopied(BitMapPtr); /* --- 112,116 ---- #endif /* !TARGET_API_MAC_CARBON */ ! static PyObject *BMObj_NewCopied(BitMapPtr); /* *************** *** 528,532 **** /* ------------------ Object type QDGlobalsAccess ------------------- */ ! staticforward PyTypeObject QDGlobalsAccess_Type; #define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type) --- 528,532 ---- /* ------------------ Object type QDGlobalsAccess ------------------- */ ! static PyTypeObject QDGlobalsAccess_Type; #define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type) *************** *** 632,636 **** #define QDGA_hash NULL ! staticforward PyTypeObject QDGlobalsAccess_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 632,636 ---- #define QDGA_hash NULL ! static PyTypeObject QDGlobalsAccess_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ From jhylton@users.sourceforge.net Wed Jul 17 17:31:07 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Modules/mlte Modified Files: _Mltemodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: _Mltemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Mltemodule.c 23 Apr 2002 22:44:15 -0000 1.10 --- _Mltemodule.c 17 Jul 2002 16:30:34 -0000 1.11 *************** *** 28,35 **** /* For now we declare them forward here. They'll go to mactoolbox later */ ! staticforward PyObject *TXNObj_New(TXNObject); ! staticforward int TXNObj_Convert(PyObject *, TXNObject *); ! staticforward PyObject *TXNFontMenuObj_New(TXNFontMenuObject); ! staticforward int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); // ADD declarations --- 28,35 ---- /* For now we declare them forward here. They'll go to mactoolbox later */ ! static PyObject *TXNObj_New(TXNObject); ! static int TXNObj_Convert(PyObject *, TXNObject *); ! static PyObject *TXNFontMenuObj_New(TXNFontMenuObject); ! static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); // ADD declarations From jhylton@users.sourceforge.net Wed Jul 17 17:31:07 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastemodule.c,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Modules/waste Modified Files: wastemodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: wastemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** wastemodule.c 23 Apr 2002 22:42:50 -0000 1.23 --- wastemodule.c 17 Jul 2002 16:30:35 -0000 1.24 *************** *** 34,39 **** /* Forward declaration */ ! staticforward PyObject *WEOObj_New(WEObjectReference); ! staticforward PyObject *ExistingwasteObj_New(WEReference); /* --- 34,39 ---- /* Forward declaration */ ! static PyObject *WEOObj_New(WEObjectReference); ! static PyObject *ExistingwasteObj_New(WEReference); /* From jhylton@users.sourceforge.net Wed Jul 17 17:31:07 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macgetpath.c,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Python Modified Files: macgetpath.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: macgetpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetpath.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** macgetpath.c 11 Apr 2002 20:48:25 -0000 1.26 --- macgetpath.c 17 Jul 2002 16:30:35 -0000 1.27 *************** *** 65,69 **** #ifndef USE_BUILTIN_PATH ! staticforward char *PyMac_GetPythonPath(); #endif --- 65,69 ---- #ifndef USE_BUILTIN_PATH ! static char *PyMac_GetPythonPath(); #endif From jhylton@users.sourceforge.net Wed Jul 17 17:31:07 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/snd _Sndmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Modules/snd Modified Files: _Sndmodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: _Sndmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/_Sndmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Sndmodule.c 23 Apr 2002 22:43:06 -0000 1.8 --- _Sndmodule.c 17 Jul 2002 16:30:35 -0000 1.9 *************** *** 63,67 **** /* --------------------- Object type SndChannel --------------------- */ ! staticforward PyTypeObject SndChannel_Type; #define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type) --- 63,67 ---- /* --------------------- Object type SndChannel --------------------- */ ! static PyTypeObject SndChannel_Type; #define SndCh_Check(x) ((x)->ob_type == &SndChannel_Type) *************** *** 316,320 **** #define SndCh_hash NULL ! staticforward PyTypeObject SndChannel_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 316,320 ---- #define SndCh_hash NULL ! static PyTypeObject SndChannel_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ *************** *** 340,344 **** /* ------------------------ Object type SPB ------------------------- */ ! staticforward PyTypeObject SPB_Type; #define SPBObj_Check(x) ((x)->ob_type == &SPB_Type) --- 340,344 ---- /* ------------------------ Object type SPB ------------------------- */ ! static PyTypeObject SPB_Type; #define SPBObj_Check(x) ((x)->ob_type == &SPB_Type) *************** *** 444,448 **** #define SPBObj_hash NULL ! staticforward PyTypeObject SPB_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 444,448 ---- #define SPBObj_hash NULL ! static PyTypeObject SPB_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ From jhylton@users.sourceforge.net Wed Jul 17 17:31:06 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:31:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules Nav.c,1.17,1.18 calldll.c,1.8,1.9 ctbmodule.c,1.13,1.14 hfsplusmodule.c,1.5,1.6 icgluemodule.c,1.9,1.10 macfsmodule.c,1.55,1.56 macosmodule.c,1.60,1.61 macspeechmodule.c,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17711/Mac/Modules Modified Files: Nav.c calldll.c ctbmodule.c hfsplusmodule.c icgluemodule.c macfsmodule.c macosmodule.c macspeechmodule.c Log Message: staticforward bites the dust. The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation. Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Nav.c 22 May 2002 14:31:47 -0000 1.17 --- Nav.c 17 Jul 2002 16:30:34 -0000 1.18 *************** *** 234,238 **** } navrrobject; ! staticforward PyTypeObject Navrrtype; --- 234,238 ---- } navrrobject; ! static PyTypeObject Navrrtype; Index: calldll.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/calldll.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** calldll.c 22 May 2002 14:31:47 -0000 1.8 --- calldll.c 17 Jul 2002 16:30:34 -0000 1.9 *************** *** 472,476 **** } cdfobject; ! staticforward PyTypeObject Cdftype; --- 472,476 ---- } cdfobject; ! static PyTypeObject Cdftype; *************** *** 486,490 **** } cdrobject; ! staticforward PyTypeObject Cdrtype; --- 486,490 ---- } cdrobject; ! static PyTypeObject Cdrtype; *************** *** 504,508 **** } cdcobject; ! staticforward PyTypeObject Cdctype; --- 504,508 ---- } cdcobject; ! static PyTypeObject Cdctype; Index: ctbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctbmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ctbmodule.c 22 May 2002 14:31:47 -0000 1.13 --- ctbmodule.c 17 Jul 2002 16:30:34 -0000 1.14 *************** *** 81,85 **** } ctbcmobject; ! staticforward PyTypeObject ctbcmtype; #define is_ctbcmobject(v) ((v)->ob_type == &ctbcmtype) --- 81,85 ---- } ctbcmobject; ! static PyTypeObject ctbcmtype; #define is_ctbcmobject(v) ((v)->ob_type == &ctbcmtype) Index: hfsplusmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/hfsplusmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hfsplusmodule.c 8 Dec 2001 18:02:51 -0000 1.5 --- hfsplusmodule.c 17 Jul 2002 16:30:34 -0000 1.6 *************** *** 44,48 **** } forkRefObject; ! staticforward PyTypeObject forkRefObject_Type; #define forkRefObject_Check(v) ((v)->ob_type == &forkRefObject_Type) --- 44,48 ---- } forkRefObject; ! static PyTypeObject forkRefObject_Type; #define forkRefObject_Check(v) ((v)->ob_type == &forkRefObject_Type) *************** *** 360,364 **** } iteratorObject; ! staticforward PyTypeObject iteratorObject_Type; #define iteratorObject_Check(v) ((v)->ob_type == &iteratorObject_Type) --- 360,364 ---- } iteratorObject; ! static PyTypeObject iteratorObject_Type; #define iteratorObject_Check(v) ((v)->ob_type == &iteratorObject_Type) *************** *** 535,539 **** } fsRefObject; ! staticforward PyTypeObject fsRefObject_Type; #define fsRefObject_Check(v) ((v)->ob_type == &fsRefObject_Type) --- 535,539 ---- } fsRefObject; ! static PyTypeObject fsRefObject_Type; #define fsRefObject_Check(v) ((v)->ob_type == &fsRefObject_Type) Index: icgluemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icgluemodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** icgluemodule.c 22 May 2002 14:31:47 -0000 1.9 --- icgluemodule.c 17 Jul 2002 16:30:34 -0000 1.10 *************** *** 62,66 **** } iciobject; ! staticforward PyTypeObject Icitype; --- 62,66 ---- } iciobject; ! static PyTypeObject Icitype; Index: macfsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** macfsmodule.c 22 May 2002 14:31:48 -0000 1.55 --- macfsmodule.c 17 Jul 2002 16:30:34 -0000 1.56 *************** *** 71,75 **** } mfsaobject; ! staticforward PyTypeObject Mfsatype; #define is_mfsaobject(v) ((v)->ob_type == &Mfsatype) --- 71,75 ---- } mfsaobject; ! static PyTypeObject Mfsatype; #define is_mfsaobject(v) ((v)->ob_type == &Mfsatype) *************** *** 83,87 **** } mfssobject; ! staticforward PyTypeObject Mfsstype; #define is_mfssobject(v) ((v)->ob_type == &Mfsstype) --- 83,87 ---- } mfssobject; ! static PyTypeObject Mfsstype; #define is_mfssobject(v) ((v)->ob_type == &Mfsstype) *************** *** 95,99 **** } mfsrobject; ! staticforward PyTypeObject Mfsrtype; #define is_mfsrobject(v) ((v)->ob_type == &Mfsrtype) --- 95,99 ---- } mfsrobject; ! static PyTypeObject Mfsrtype; #define is_mfsrobject(v) ((v)->ob_type == &Mfsrtype) *************** *** 108,118 **** } mfsiobject; ! staticforward PyTypeObject Mfsitype; #define is_mfsiobject(v) ((v)->ob_type == &Mfsitype) ! staticforward mfssobject *newmfssobject(FSSpec *fss); /* Forward */ ! staticforward mfsrobject *newmfsrobject(FSRef *fsr); /* Forward */ /* ---------------------------------------------------------------- */ --- 108,118 ---- } mfsiobject; ! static PyTypeObject Mfsitype; #define is_mfsiobject(v) ((v)->ob_type == &Mfsitype) ! static mfssobject *newmfssobject(FSSpec *fss); /* Forward */ ! static mfsrobject *newmfsrobject(FSRef *fsr); /* Forward */ /* ---------------------------------------------------------------- */ Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** macosmodule.c 22 May 2002 14:31:48 -0000 1.60 --- macosmodule.c 17 Jul 2002 16:30:34 -0000 1.61 *************** *** 61,65 **** } rfobject; ! staticforward PyTypeObject Rftype; --- 61,65 ---- } rfobject; ! static PyTypeObject Rftype; Index: macspeechmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macspeechmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** macspeechmodule.c 22 May 2002 14:31:48 -0000 1.14 --- macspeechmodule.c 17 Jul 2002 16:30:34 -0000 1.15 *************** *** 89,93 **** } scobject; ! staticforward PyTypeObject sctype; #define is_scobject(v) ((v)->ob_type == &sctype) --- 89,93 ---- } scobject; ! static PyTypeObject sctype; #define is_scobject(v) ((v)->ob_type == &sctype) *************** *** 286,290 **** } mvobject; ! staticforward PyTypeObject mvtype; #define is_mvobject(v) ((v)->ob_type == &mvtype) --- 286,290 ---- } mvobject; ! static PyTypeObject mvtype; #define is_mvobject(v) ((v)->ob_type == &mvtype) From fdrake@users.sourceforge.net Wed Jul 17 17:40:42 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:40:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv21191 Modified Files: newtypes.tex Log Message: Remove now-obsolete staticforward/statichere discussion. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** newtypes.tex 14 May 2002 22:02:07 -0000 1.16 --- newtypes.tex 17 Jul 2002 16:40:39 -0000 1.17 *************** *** 39,43 **** \begin{verbatim} ! staticforward PyTypeObject noddy_NoddyType; \end{verbatim} --- 39,43 ---- \begin{verbatim} ! static PyTypeObject noddy_NoddyType; \end{verbatim} *************** *** 47,55 **** refer to it, hence the declaration. - The \code{staticforward} is required to placate various brain dead - compilers. The actual definition of the object declared using - \code{staticforward} should use \code{statichere} instead of - \keyword{static}. - \begin{verbatim} typedef struct { --- 47,50 ---- *************** *** 157,161 **** \begin{verbatim} ! statichere PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ --- 152,156 ---- \begin{verbatim} ! static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ *************** *** 175,181 **** }; \end{verbatim} - - (Note the use of \code{statichere} instead of \keyword{static}, since - we used \code{staticforward} in the declaration.) Now if you go and look up the definition of \ctype{PyTypeObject} in --- 170,173 ---- From fdrake@users.sourceforge.net Wed Jul 17 17:42:50 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:42:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv21911 Modified Files: noddy.c Log Message: Change staticforward and statichere to just use static. Removed ^M from some line-ends. Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** noddy.c 12 Apr 2002 16:17:06 -0000 1.2 --- noddy.c 17 Jul 2002 16:42:48 -0000 1.3 *************** *** 1,9 **** #include ! staticforward PyTypeObject noddy_NoddyType; typedef struct { PyObject_HEAD ! /* Type-specific fields go here. */ } noddy_NoddyObject; --- 1,9 ---- #include ! static PyTypeObject noddy_NoddyType; typedef struct { PyObject_HEAD ! /* Type-specific fields go here. */ } noddy_NoddyObject; *************** *** 15,20 **** noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); ! /* Initialize type-specific fields here. */ ! return (PyObject*)noddy; } --- 15,20 ---- noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); ! /* Initialize type-specific fields here. */ ! return (PyObject*)noddy; } *************** *** 23,34 **** noddy_noddy_dealloc(PyObject* self) { ! /* Free any external resources here; ! * if the instance owns references to any Python ! * objects, call Py_DECREF() on them here. ! */ PyObject_Del(self); } ! statichere PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, --- 23,34 ---- noddy_noddy_dealloc(PyObject* self) { ! /* Free any external resources here; ! * if the instance owns references to any Python ! * objects, call Py_DECREF() on them here. ! */ PyObject_Del(self); } ! static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, *************** *** 49,56 **** static PyMethodDef noddy_methods[] = { ! {"new_noddy", noddy_new_noddy, METH_NOARGS, "Create a new Noddy object."}, ! ! {NULL} /* Sentinel */ }; --- 49,56 ---- static PyMethodDef noddy_methods[] = { ! {"new_noddy", noddy_new_noddy, METH_NOARGS, "Create a new Noddy object."}, ! ! {NULL} /* Sentinel */ }; *************** *** 59,66 **** { noddy_NoddyType.ob_type = &PyType_Type; ! if (PyType_Ready(&noddy_NoddyType)) ! return; ! Py_InitModule3("noddy", noddy_methods ! "Example module that creates an extension type."); } --- 59,66 ---- { noddy_NoddyType.ob_type = &PyType_Type; ! if (PyType_Ready(&noddy_NoddyType)) ! return; ! Py_InitModule3("noddy", noddy_methods ! "Example module that creates an extension type."); } From tim_one@users.sourceforge.net Wed Jul 17 17:49:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:49:06 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.318,2.319 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv23912/python/Python Modified Files: ceval.c Log Message: Removed more stray instances of statichere, but left _sre.c alone. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.318 retrieving revision 2.319 diff -C2 -d -r2.318 -r2.319 *** ceval.c 17 Jul 2002 16:30:38 -0000 2.318 --- ceval.c 17 Jul 2002 16:49:03 -0000 2.319 *************** *** 179,183 **** }; ! statichere PyTypeObject gentype = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ --- 179,183 ---- }; ! static PyTypeObject gentype = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ From tim_one@users.sourceforge.net Wed Jul 17 17:49:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:49:05 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.76,2.77 md5module.c,2.31,2.32 pyexpat.c,2.68,2.69 rotormodule.c,2.35,2.36 selectmodule.c,2.65,2.66 xxmodule.c,2.29,2.30 zlibmodule.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23912/python/Modules Modified Files: arraymodule.c md5module.c pyexpat.c rotormodule.c selectmodule.c xxmodule.c zlibmodule.c Log Message: Removed more stray instances of statichere, but left _sre.c alone. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -d -r2.76 -r2.77 *** arraymodule.c 17 Jul 2002 16:30:36 -0000 2.76 --- arraymodule.c 17 Jul 2002 16:49:03 -0000 2.77 *************** *** 1859,1863 **** "); ! statichere PyTypeObject Arraytype = { PyObject_HEAD_INIT(NULL) 0, --- 1859,1863 ---- "); ! static PyTypeObject Arraytype = { PyObject_HEAD_INIT(NULL) 0, Index: md5module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/md5module.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** md5module.c 17 Jul 2002 16:30:37 -0000 2.31 --- md5module.c 17 Jul 2002 16:49:03 -0000 2.32 *************** *** 188,192 **** copy() -- return a copy of the current md5 object"); ! statichere PyTypeObject MD5type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 188,192 ---- copy() -- return a copy of the current md5 object"); ! static PyTypeObject MD5type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** pyexpat.c 17 Jul 2002 16:30:37 -0000 2.68 --- pyexpat.c 17 Jul 2002 16:49:03 -0000 2.69 *************** *** 1740,1744 **** } ! statichere struct HandlerInfo handler_info[] = { {"StartElementHandler", (xmlhandlersetter)XML_SetStartElementHandler, --- 1740,1744 ---- } ! static struct HandlerInfo handler_info[] = { {"StartElementHandler", (xmlhandlersetter)XML_SetStartElementHandler, Index: rotormodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/rotormodule.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** rotormodule.c 17 Jul 2002 16:30:37 -0000 2.35 --- rotormodule.c 17 Jul 2002 16:49:03 -0000 2.36 *************** *** 576,580 **** ! statichere PyTypeObject Rotor_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 576,580 ---- ! static PyTypeObject Rotor_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** selectmodule.c 17 Jul 2002 16:30:37 -0000 2.65 --- selectmodule.c 17 Jul 2002 16:49:03 -0000 2.66 *************** *** 560,564 **** } ! statichere PyTypeObject poll_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ --- 560,564 ---- } ! static PyTypeObject poll_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ Index: xxmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** xxmodule.c 17 Jul 2002 16:30:37 -0000 2.29 --- xxmodule.c 17 Jul 2002 16:49:03 -0000 2.30 *************** *** 94,98 **** } ! statichere PyTypeObject Xxo_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ --- 94,98 ---- } ! static PyTypeObject Xxo_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** zlibmodule.c 17 Jul 2002 16:30:37 -0000 2.63 --- zlibmodule.c 17 Jul 2002 16:49:03 -0000 2.64 *************** *** 786,790 **** }; ! statichere PyTypeObject Comptype = { PyObject_HEAD_INIT(0) 0, --- 786,790 ---- }; ! static PyTypeObject Comptype = { PyObject_HEAD_INIT(0) 0, *************** *** 803,807 **** }; ! statichere PyTypeObject Decomptype = { PyObject_HEAD_INIT(0) 0, --- 803,807 ---- }; ! static PyTypeObject Decomptype = { PyObject_HEAD_INIT(0) 0, From gvanrossum@users.sourceforge.net Wed Jul 17 17:57:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 17 Jul 2002 09:57:17 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.319,2.320 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27026 Modified Files: ceval.c Log Message: SF patch 552161 - Py_AddPendingCall doesn't unlock on fail (Daniel Dunbar) Can't test this, but looks correct to me. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.319 retrieving revision 2.320 diff -C2 -d -r2.319 -r2.320 *** ceval.c 17 Jul 2002 16:49:03 -0000 2.319 --- ceval.c 17 Jul 2002 16:57:13 -0000 2.320 *************** *** 380,385 **** i = pendinglast; j = (i + 1) % NPENDINGCALLS; ! if (j == pendingfirst) return -1; /* Queue full */ pendingcalls[i].func = func; pendingcalls[i].arg = arg; --- 380,387 ---- i = pendinglast; j = (i + 1) % NPENDINGCALLS; ! if (j == pendingfirst) { ! busy = 0; return -1; /* Queue full */ + } pendingcalls[i].func = func; pendingcalls[i].arg = arg; From fdrake@users.sourceforge.net Wed Jul 17 19:54:23 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 11:54:23 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7588 Modified Files: _hotshot.c Log Message: Added a docstring for the closed attribute. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** _hotshot.c 17 Jul 2002 16:15:35 -0000 1.20 --- _hotshot.c 17 Jul 2002 18:54:20 -0000 1.21 *************** *** 1181,1185 **** static PyGetSetDef profiler_getsets[] = { ! {"closed", (getter)profiler_get_closed, NULL}, {NULL} }; --- 1181,1186 ---- static PyGetSetDef profiler_getsets[] = { ! {"closed", (getter)profiler_get_closed, NULL, ! "True if the profiler's output file has already been closed."}, {NULL} }; *************** *** 1438,1444 **** PyObject *item = PyList_GET_ITEM(temp, i); buffer = PyString_AsString(item); ! if (buffer == NULL) ! return -1; ! pack_add_info(self, "sys-path-entry", buffer); } pack_frame_times(self); --- 1439,1449 ---- PyObject *item = PyList_GET_ITEM(temp, i); buffer = PyString_AsString(item); ! if (buffer == NULL) { ! pack_add_info(self, "sys-path-entry", ""); ! PyErr_Clear(); ! } ! else { ! pack_add_info(self, "sys-path-entry", buffer); ! } } pack_frame_times(self); From fdrake@acm.org Wed Jul 17 20:04:44 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Wed, 17 Jul 2002 15:04:44 -0400 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.20,1.21 In-Reply-To: References: Message-ID: <15669.49100.914533.34589@grendel.zope.com> fdrake@users.sourceforge.net writes: > Modified Files: > _hotshot.c > Log Message: > Added a docstring for the closed attribute. The rest of the checkin comment should have been: write_header(): When we encounter a non-string object in sys.path, record a fairly mindless placeholder rather than dying. Possibly could record the repr of the object found, but not clear whether that matters. This has been added in CVS, so archeologists will be able to figure it out. ;-) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake@users.sourceforge.net Wed Jul 17 20:38:07 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 12:38:07 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21683 Modified Files: _hotshot.c Log Message: Mark the closed attribute of the profiler with PyDoc_STR(), and added a docstring for the info attribute of the logreader object. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** _hotshot.c 17 Jul 2002 18:54:20 -0000 1.21 --- _hotshot.c 17 Jul 2002 19:38:05 -0000 1.22 *************** *** 1182,1186 **** static PyGetSetDef profiler_getsets[] = { {"closed", (getter)profiler_get_closed, NULL, ! "True if the profiler's output file has already been closed."}, {NULL} }; --- 1182,1186 ---- static PyGetSetDef profiler_getsets[] = { {"closed", (getter)profiler_get_closed, NULL, ! PyDoc_STR("True if the profiler's output file has already been closed.")}, {NULL} }; *************** *** 1251,1255 **** static PyMemberDef logreader_members[] = { ! {"info", T_OBJECT, offsetof(LogReaderObject, info), RO}, {NULL} }; --- 1251,1256 ---- static PyMemberDef logreader_members[] = { ! {"info", T_OBJECT, offsetof(LogReaderObject, info), RO, ! PyDoc_STR("Dictionary mapping informational keys to lists of values.")}, {NULL} }; From fdrake@users.sourceforge.net Wed Jul 17 21:31:54 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 17 Jul 2002 13:31:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libpyexpat.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10989 Modified Files: libpyexpat.tex Log Message: Added documentation for the buffer_text and related attributes of the xmlparser object provided by pyexpat, new in Python 2.3. Index: libpyexpat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpyexpat.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** libpyexpat.tex 20 Jun 2002 21:06:03 -0000 1.18 --- libpyexpat.tex 17 Jul 2002 20:31:52 -0000 1.19 *************** *** 160,163 **** --- 160,186 ---- \class{xmlparser} objects have the following attributes: + \begin{memberdesc}[xmlparser]{buffer_size} + The size of the buffer used when \member{buffer_text} is true. This + value cannot be changed at this time. + \versionadded{2.3} + \end{memberdesc} + + \begin{memberdesc}[xmlparser]{buffer_text} + Setting this to true causes the \class{xmlparser} object to buffer + textual content returned by Expat to avoid multiple calls to the + \method{CharacterDataHandler()} callback whenever possible. This can + improve performance substantially since Expat normally breaks + character data into chunks at every line ending. This attribute is + false by default, and may be changed at any time. + \versionadded{2.3} + \end{memberdesc} + + \begin{memberdesc}[xmlparser]{buffer_used} + If \member{buffer_text} is enabled, the number of bytes stored in the + buffer. These bytes represent UTF-8 encoded text. This attribute has + no meaningful interpretation when \member{buffer_text} is false. + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}[xmlparser]{ordered_attributes} Setting this attribute to a non-zero integer causes the attributes to From bwarsaw@users.sourceforge.net Wed Jul 17 22:25:46 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 17 Jul 2002 14:25:46 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.25,4.26 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv303 Modified Files: python-mode.el Log Message: (py-pychecker-run): Use the last pychecker invocation as the default contents of the next command. Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.25 retrieving revision 4.26 diff -C2 -d -r4.25 -r4.26 *** python-mode.el 17 Jul 2002 13:45:00 -0000 4.25 --- python-mode.el 17 Jul 2002 21:25:43 -0000 4.26 *************** *** 2775,2779 **** (list (read-shell-command "Run pychecker like this: " ! default 'py-pychecker-history)))) (save-some-buffers (not py-ask-about-save) nil) --- 2775,2781 ---- (list (read-shell-command "Run pychecker like this: " ! (if py-pychecker-history ! (car py-pychecker-history) ! default) 'py-pychecker-history)))) (save-some-buffers (not py-ask-about-save) nil) From tim_one@users.sourceforge.net Thu Jul 18 00:53:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 17 Jul 2002 16:53:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hotshot.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12345/python/Lib/test Modified Files: test_hotshot.py Log Message: test_hotshot fails on Windows now. Added XXX comment explaining why, and that I don't know how to fix it. Fred? Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_hotshot.py 17 Jul 2002 16:12:53 -0000 1.7 --- test_hotshot.py 17 Jul 2002 23:52:58 -0000 1.8 *************** *** 32,35 **** --- 32,39 ---- return hotshot.log.LogReader.next(self) except (IndexError, StopIteration): + # XXX This fails on Windows because the named file is still + # XXX open. Offhand I couldn't find an appropriate way to close + # XXX the file object, or even where the heck it is. LogReader + # XXX in particular doesn't have a close() method. os.unlink(self.__logfn) raise From tim_one@users.sourceforge.net Thu Jul 18 15:54:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 07:54:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot log.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv17095/python/Lib/hotshot Modified Files: log.py Log Message: Gave hotshot.LogReader a close() method, to allow users to close the file object that LogReader opens. Used it then in test_hotshot; the test passes again on Windows. Thank Guido for the analysis. Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/log.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** log.py 18 Jul 2002 14:33:14 -0000 1.7 --- log.py 18 Jul 2002 14:54:28 -0000 1.8 *************** *** 52,55 **** --- 52,58 ---- self._pop = self._stack.pop + def close(self): + self._reader.close() + def addinfo(self, key, value): """This method is called for each additional ADD_INFO record. From gvanrossum@users.sourceforge.net Thu Jul 18 15:33:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 07:33:17 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot log.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv8846 Modified Files: log.py Log Message: We're no longer trying to support older Python versions with this codebase, so get rid of the pre-2.2 contingency. Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/log.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** log.py 29 May 2002 19:40:36 -0000 1.6 --- log.py 18 Jul 2002 14:33:14 -0000 1.7 *************** *** 133,143 **** raise ValueError, "unknown event type" ! if sys.version < "2.2": ! # Don't add this for newer Python versions; we only want iteration ! # support, not general sequence support. ! __getitem__ = next ! else: ! def __iter__(self): ! return self # --- 133,138 ---- raise ValueError, "unknown event type" ! def __iter__(self): ! return self # From gvanrossum@users.sourceforge.net Thu Jul 18 18:08:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 10:08:37 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8306/Lib Modified Files: socket.py Log Message: Add default timeout functionality. This adds setdefaulttimeout() and getdefaulttimeout() functions to the socket and _socket modules, and appropriate tests. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** socket.py 13 Jun 2002 22:18:39 -0000 1.21 --- socket.py 18 Jul 2002 17:08:34 -0000 1.22 *************** *** 22,25 **** --- 22,27 ---- inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89) ssl() -- secure socket layer support (only available if configured) + socket.getdefaulttimeout() -- get the default timeout value + socket.setdefaulttimeout() -- set the default timeout value [*] not available on all platforms! From gvanrossum@users.sourceforge.net Thu Jul 18 18:08:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 10:08:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8306/Lib/test Modified Files: test_socket.py Log Message: Add default timeout functionality. This adds setdefaulttimeout() and getdefaulttimeout() functions to the socket and _socket modules, and appropriate tests. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_socket.py 20 Jun 2002 03:40:16 -0000 1.39 --- test_socket.py 18 Jul 2002 17:08:35 -0000 1.40 *************** *** 298,301 **** --- 298,331 ---- pass + def testDefaultTimeout(self): + """Testing default timeout.""" + # The default timeout should initially be None + self.assertEqual(socket.getdefaulttimeout(), None) + s = socket.socket() + self.assertEqual(s.gettimeout(), None) + s.close() + + # Set the default timeout to 10, and see if it propagates + socket.setdefaulttimeout(10) + self.assertEqual(socket.getdefaulttimeout(), 10) + s = socket.socket() + self.assertEqual(s.gettimeout(), 10) + s.close() + + # Reset the default timeout to None, and see if it propagates + socket.setdefaulttimeout(None) + self.assertEqual(socket.getdefaulttimeout(), None) + s = socket.socket() + self.assertEqual(s.gettimeout(), None) + s.close() + + # Check that setting it to an invalid value raises ValueError + self.assertRaises(ValueError, socket.setdefaulttimeout, -1) + + # Check that setting it to an invalid type raises TypeError + self.assertRaises(TypeError, socket.setdefaulttimeout, "spam") + + # XXX The following three don't test module-level functionality... + def testSockName(self): """Testing getsockname().""" From gvanrossum@users.sourceforge.net Thu Jul 18 18:08:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 10:08:37 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.230,1.231 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8306/Modules Modified Files: socketmodule.c Log Message: Add default timeout functionality. This adds setdefaulttimeout() and getdefaulttimeout() functions to the socket and _socket modules, and appropriate tests. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.230 retrieving revision 1.231 diff -C2 -d -r1.230 -r1.231 *** socketmodule.c 17 Jul 2002 16:30:37 -0000 1.230 --- socketmodule.c 18 Jul 2002 17:08:34 -0000 1.231 *************** *** 36,39 **** --- 36,41 ---- - socket.inet_aton(IP address) -> 32-bit packed IP representation - socket.inet_ntoa(packed IP) -> IP address string + - socket.getdefaulttimeout() -> None | float + - socket.setdefaulttimeout(None | float) - an Internet socket address is a pair (hostname, port) where hostname can be anything recognized by gethostbyname() *************** *** 522,525 **** --- 524,529 ---- /* Initialize a new socket object. */ + static float defaulttimeout = -1.0; /* Default timeout for new sockets */ + static void init_sockobject(PySocketSockObject *s, *************** *** 533,539 **** s->sock_type = type; s->sock_proto = proto; ! s->sock_timeout = -1.0; /* Start without timeout */ s->errorhandler = &set_error; #ifdef RISCOS if (taskwindow) --- 537,547 ---- s->sock_type = type; s->sock_proto = proto; ! s->sock_timeout = defaulttimeout; s->errorhandler = &set_error; + + if (defaulttimeout >= 0.0) + internal_setblocking(s, 0); + #ifdef RISCOS if (taskwindow) *************** *** 2726,2729 **** --- 2734,2789 ---- Get host and port for a sockaddr."); + + /* Python API to getting and setting the default timeout value. */ + + static PyObject * + socket_getdefaulttimeout(PyObject *self) + { + if (defaulttimeout < 0.0) { + Py_INCREF(Py_None); + return Py_None; + } + else + return PyFloat_FromDouble(defaulttimeout); + } + + PyDoc_STRVAR(getdefaulttimeout_doc, + "socket.getdefaulttimeout() -> None | float\n\ + \n\ + Returns the default timeout in floating seconds for new socket objects.\n\ + A value of None indicates that new socket objects have no timeout.\n\ + When the socket module is first imported, the default is None."); + + static PyObject * + socket_setdefaulttimeout(PyObject *self, PyObject *arg) + { + double timeout; + + if (arg == Py_None) + timeout = -1.0; + else { + timeout = PyFloat_AsDouble(arg); + if (timeout < 0.0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_ValueError, + "Timeout value out of range"); + return NULL; + } + } + + defaulttimeout = timeout; + + Py_INCREF(Py_None); + return Py_None; + } + + PyDoc_STRVAR(setdefaulttimeout_doc, + "socket.setdefaulttimeout(None | float)\n\ + \n\ + Set the default timeout in floating seconds for new socket objects.\n\ + A value of None indicates that new socket objects have no timeout.\n\ + When the socket module is first imported, the default is None."); + + /* List of functions exported by this module. */ *************** *** 2761,2764 **** --- 2821,2828 ---- {"getnameinfo", socket_getnameinfo, METH_VARARGS, getnameinfo_doc}, + {"getdefaulttimeout", socket_getdefaulttimeout, + METH_NOARGS, getdefaulttimeout_doc}, + {"setdefaulttimeout", socket_setdefaulttimeout, + METH_O, setdefaulttimeout_doc}, {NULL, NULL} /* Sentinel */ }; From tim_one@users.sourceforge.net Thu Jul 18 16:53:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 08:53:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test sortperf.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6534/python/Lib/test Modified Files: sortperf.py Log Message: Gave this a facelift: "/" vs "//", whrandom vs random, etc. Boosted the default range to end at 2**20 (machines are much faster now). Fixed what was quite a arguably a bug, explaining an old mystery: the "!sort" case here contructs what *was* a quadratic-time disaster for the old quicksort implementation. But under the current samplesort, it always ran much faster than *sort (the random case). This never made sense. Turns out it was because !sort was sorting an integer array, while all the other cases sort floats; and comparing ints goes much quicker than comparing floats in Python. After changing !sort to chew on floats instead, it's now slower than the random sort case, which makes more sense (but is just a few percent slower; samplesort is massively less sensitive to "bad patterns" than quicksort). Index: sortperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/sortperf.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sortperf.py 10 Apr 2002 14:54:39 -0000 1.7 --- sortperf.py 18 Jul 2002 15:53:32 -0000 1.8 *************** *** 11,28 **** import marshal import tempfile - import operator import os td = tempfile.gettempdir() ! def randrange(n): ! """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: ! result = [] ! for i in range(n): ! result.append(random.random()) try: try: --- 11,29 ---- import marshal import tempfile import os td = tempfile.gettempdir() ! def randfloats(n): ! """Return a list of n random floats in [0, 1).""" ! # Generating floats is expensive, so this writes them out to a file in ! # a temp directory. If the file already exists, it just reads them ! # back in and shuffles them a bit. fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: ! r = random.random ! result = [r() for i in xrange(n)] try: try: *************** *** 42,57 **** result = marshal.load(fp) fp.close() - ##assert len(result) == n # Shuffle it a bit... for i in range(10): ! i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() ! result[len(result):] = temp del temp return result ! def fl(): sys.stdout.flush() --- 43,58 ---- result = marshal.load(fp) fp.close() # Shuffle it a bit... for i in range(10): ! i = random.randrange(n) temp = result[:i] del result[:i] temp.reverse() ! result.extend(temp) del temp + assert len(result) == n return result ! def flush(): sys.stdout.flush() *************** *** 61,65 **** t1 = time.clock() print "%6.2f" % (t1-t0), ! fl() def tabulate(r): --- 62,66 ---- t1 = time.clock() print "%6.2f" % (t1-t0), ! flush() def tabulate(r): *************** *** 75,105 **** /sort: ascending data ~sort: many duplicates ! -sort: all equal !sort: worst case scenario """ ! cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") ! fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: ! n = 1< 4: del L[4:] ! L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L ! L = map(abs, [-0.5]*n) ! doit(L) # -sort ! L = range(n/2-1, -1, -1) ! L[len(L):] = range(n/2) doit(L) # !sort print --- 76,123 ---- /sort: ascending data ~sort: many duplicates ! =sort: all equal !sort: worst case scenario """ ! cases = ("*sort", "\\sort", "/sort", "~sort", "=sort", "!sort") ! fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: ! n = 1 << i ! L = randfloats(n) ! print "%2d %7d" % (i, n), ! flush() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort + + # Arrange for lots of duplicates. if n > 4: del L[4:] ! L = L * (n // 4) ! # Force the elements to be distinct objects, else timings can be ! # artificially low. L = map(lambda x: --x, L) doit(L) # ~sort del L ! ! # All equal. Again, force the elements to be distinct objects. ! L = map(abs, [-0.5] * n) ! doit(L) # =sort ! del L ! ! # This one looks like [3, 2, 1, 0, 0, 1, 2, 3]. It was a bad case ! # for an older implementation of quicksort, which used the median ! # of the first, last and middle elements as the pivot. It's still ! # a worse-than-average case for samplesort, but on the order of a ! # measly 5% worse, not a quadratic-time disaster as it was with ! # quicksort. ! half = n // 2 ! L = range(half - 1, -1, -1) ! L.extend(range(half)) ! # Force to float, so that the timings are comparable. This is ! # significantly faster if we leave tham as ints. ! L = map(float, L) doit(L) # !sort print *************** *** 115,119 **** # default range (inclusive) k1 = 15 ! k2 = 19 if sys.argv[1:]: # one argument: single point --- 133,137 ---- # default range (inclusive) k1 = 15 ! k2 = 20 if sys.argv[1:]: # one argument: single point *************** *** 124,138 **** if sys.argv[3:]: # derive random seed from remaining arguments ! x, y, z = 0, 0, 0 for a in sys.argv[3:]: ! h = hash(a) ! h, d = divmod(h, 256) ! h = h & 0xffffff ! x = (x^h^d) & 255 ! h = h>>8 ! y = (y^h^d) & 255 ! h = h>>8 ! z = (z^h^d) & 255 ! whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) --- 142,149 ---- if sys.argv[3:]: # derive random seed from remaining arguments ! x = 1 for a in sys.argv[3:]: ! x = 69069 * x + hash(a) ! random.seed(x) r = range(k1, k2+1) # include the end point tabulate(r) From tim_one@users.sourceforge.net Thu Jul 18 15:54:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 07:54:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hotshot.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17095/python/Lib/test Modified Files: test_hotshot.py Log Message: Gave hotshot.LogReader a close() method, to allow users to close the file object that LogReader opens. Used it then in test_hotshot; the test passes again on Windows. Thank Guido for the analysis. Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_hotshot.py 17 Jul 2002 23:52:58 -0000 1.8 --- test_hotshot.py 18 Jul 2002 14:54:28 -0000 1.9 *************** *** 32,39 **** return hotshot.log.LogReader.next(self) except (IndexError, StopIteration): ! # XXX This fails on Windows because the named file is still ! # XXX open. Offhand I couldn't find an appropriate way to close ! # XXX the file object, or even where the heck it is. LogReader ! # XXX in particular doesn't have a close() method. os.unlink(self.__logfn) raise --- 32,36 ---- return hotshot.log.LogReader.next(self) except (IndexError, StopIteration): ! self.close() os.unlink(self.__logfn) raise From jhylton@users.sourceforge.net Thu Jul 18 19:49:55 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 18 Jul 2002 11:49:55 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.46,2.47 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18490 Modified Files: obmalloc.c Log Message: Remove extraneous semicolon. (Silences compiler warning for Compaq C++ 6.5 on Tru64.) Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -d -r2.46 -r2.47 *** obmalloc.c 10 Jul 2002 19:29:49 -0000 2.46 --- obmalloc.c 18 Jul 2002 18:49:52 -0000 2.47 *************** *** 261,265 **** * This malloc lock */ ! SIMPLELOCK_DECL(_malloc_lock); #define LOCK() SIMPLELOCK_LOCK(_malloc_lock) #define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) --- 261,265 ---- * This malloc lock */ ! SIMPLELOCK_DECL(_malloc_lock) #define LOCK() SIMPLELOCK_LOCK(_malloc_lock) #define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) From fdrake@users.sourceforge.net Thu Jul 18 20:17:23 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 18 Jul 2002 12:17:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot log.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv32277 Modified Files: log.py Log Message: Expose the fileno() method of the underlying log reader. Remove the crufty support for Python's that don't have StopIteration; the HotShot patch for Python 2.1 has not been maintained. Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/log.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** log.py 18 Jul 2002 14:54:28 -0000 1.8 --- log.py 18 Jul 2002 19:17:20 -0000 1.9 *************** *** 22,31 **** - try: - StopIteration - except NameError: - StopIteration = IndexError - - class LogReader: def __init__(self, logfn): --- 22,25 ---- *************** *** 54,57 **** --- 48,55 ---- def close(self): self._reader.close() + + def fileno(self): + """Return the file descriptor of the log reader's log file.""" + return self._reader.fileno() def addinfo(self, key, value): From fdrake@users.sourceforge.net Thu Jul 18 20:17:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 18 Jul 2002 12:17:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot __init__.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv32508 Modified Files: __init__.py Log Message: Expose the fileno() method of the underlying profiler. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 16 Apr 2002 19:27:23 -0000 1.4 --- __init__.py 18 Jul 2002 19:17:54 -0000 1.5 *************** *** 26,29 **** --- 26,33 ---- self._prof.close() + def fileno(self): + """Return the file descriptor of the profiler's log file.""" + return self._prof.fileno() + def start(self): """Start the profiler.""" From fdrake@users.sourceforge.net Thu Jul 18 20:20:25 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 18 Jul 2002 12:20:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot log.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv1692 Modified Files: log.py Log Message: Simplify; the low-level log reader is now always a modern iterator, and should never return None. (It only did this for an old version of HotShot that was trying to still work with a patched Python 2.1.) Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/log.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** log.py 18 Jul 2002 19:17:20 -0000 1.9 --- log.py 18 Jul 2002 19:20:23 -0000 1.10 *************** *** 96,105 **** def next(self, index=0): while 1: ! try: ! what, tdelta, fileno, lineno = self._nextitem() ! except TypeError: ! # logreader().next() returns None at the end ! self._reader.close() ! raise StopIteration() # handle the most common cases first --- 96,100 ---- def next(self, index=0): while 1: ! what, tdelta, fileno, lineno = self._nextitem() # handle the most common cases first From fdrake@users.sourceforge.net Thu Jul 18 20:47:07 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 18 Jul 2002 12:47:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot stones.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv14158/Lib/hotshot Added Files: stones.py Log Message: Script to run the pystones "benchmark" under HotShot. --- NEW FILE: stones.py --- import errno import hotshot import hotshot.stats import os import sys import test.pystone if sys.argv[1:]: logfile = sys.argv[1] cleanup = 0 else: import tempfile logfile = tempfile.mktemp() cleanup = 1 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) if cleanup: os.unlink(logfile) stats.strip_dirs() stats.sort_stats('time', 'calls') try: stats.print_stats(20) except IOError, e: if e.errno != errno.EPIPE: raise From gvanrossum@users.sourceforge.net Thu Jul 18 20:48:49 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 12:48:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot log.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv14934 Modified Files: log.py Log Message: Add clarifying comment. Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/log.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** log.py 18 Jul 2002 19:20:23 -0000 1.10 --- log.py 18 Jul 2002 19:48:46 -0000 1.11 *************** *** 96,99 **** --- 96,100 ---- def next(self, index=0): while 1: + # This call may raise StopIteration: what, tdelta, fileno, lineno = self._nextitem() From jhylton@users.sourceforge.net Thu Jul 18 21:25:49 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 18 Jul 2002 13:25:49 -0700 Subject: [Python-checkins] python/dist/src configure,1.319,1.320 configure.in,1.329,1.330 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv30017 Modified Files: configure configure.in Log Message: Use AC_FUNC_SETPGRP. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.319 retrieving revision 1.320 diff -C2 -d -r1.319 -r1.320 *** configure 17 Jul 2002 16:30:32 -0000 1.319 --- configure 18 Jul 2002 20:25:43 -0000 1.320 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.328 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.329 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 12069,12095 **** 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 --- 12069,12088 ---- 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 *************** *** 12102,12125 **** 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 --- 12095,12112 ---- 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 *************** *** 12127,12188 **** 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 --- 12114,12137 ---- 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 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.329 retrieving revision 1.330 diff -C2 -d -r1.329 -r1.330 *** configure.in 17 Jul 2002 16:30:34 -0000 1.329 --- configure.in 18 Jul 2002 20:25:46 -0000 1.330 *************** *** 1633,1642 **** ) ) ! 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, --- 1633,1638 ---- ) ) ! AC_FUNC_SETPGRP(AC_DEFINE(SETPGRP_HAVE_ARG, 1, ! [Define if setpgrp() must be called as setpgrp(0, 0).]) ) AC_CHECK_FUNCS(gettimeofday, From gvanrossum@users.sourceforge.net Thu Jul 18 21:38:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 13:38:31 -0700 Subject: [Python-checkins] python/nondist/peps pep-0234.txt,1.18,1.19 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2163 Modified Files: pep-0234.txt Log Message: Add a number of clarifications and updates. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pep-0234.txt 18 Jul 2002 20:00:21 -0000 1.18 --- pep-0234.txt 18 Jul 2002 20:38:28 -0000 1.19 *************** *** 67,79 **** be propagated normally. ! In addition to the tp_iternext slot, every iterator object must ! also implement a next() method, callable without arguments. This ! should have the same semantics as the tp_iternext slot function, ! except that the only way to signal the end of the iteration is to ! raise StopIteration. The iterator object should not care whether ! its tp_iternext slot function is called or its next() method, and ! the caller may mix calls arbitrarily. (The next() method is for ! the benefit of Python code using iterators directly; the ! tp_iternext slot is added to make 'for' loops more efficient.) To ensure binary backwards compatibility, a new flag --- 67,80 ---- be propagated normally. ! Iterators implemented in C should *not* implement a next() method ! with similar semantics as the tp_iternext slot! When the type's ! dictionary is initialized (by PyType_Ready()), the presence of a ! tp_iternext slot causes a method next() wrapping that slot to be ! added to the type's tp_dict. (Exception: if the type doesn't use ! PyObject_GenericGetAttr() to access instance attributes, the ! next() method in the type's tp_dict may not be seen.) (Due to a ! misunderstanding in the original text of this PEP, in Python 2.2, ! all iterator types implemented a next() method that was overridden ! by the wrapper; this has been fixed in Python 2.3.) To ensure binary backwards compatibility, a new flag *************** *** 84,88 **** set and has a non-NULL tp_iternext slot. There is no such macro for the tp_iter slot (since the only place where this slot is ! referenced should be PyObject_GetIter()). (Note: the tp_iter slot can be present on any object; the --- 85,90 ---- set and has a non-NULL tp_iternext slot. There is no such macro for the tp_iter slot (since the only place where this slot is ! referenced should be PyObject_GetIter(), and this can check for ! the Py_TPFLAGS_HAVE_ITER flag directly). (Note: the tp_iter slot can be present on any object; the *************** *** 108,111 **** --- 110,121 ---- use an iterator (as opposed to a sequence) in a for loop. + Iterator implementations (in C or in Python) should guarantee that + once the iterator has signalled its exhaustion, subsequent calls + to tp_iternext or to the next() method will continue to do so. It + is not specified whether an iterator should enter the exhausted + state when an exception (other than StopIteration) is raised. + Note that Python cannot guarantee that user-defined or 3rd party + iterators implement this requirement correctly. + Python API Specification *************** *** 164,171 **** Dictionary Iterators - The following two proposals are somewhat controversial. They are - also independent from the main iterator implementation. However, - they are both very useful. - - Dictionaries implement a sq_contains slot that implements the same test as the has_key() method. This means that we can write --- 174,177 ---- *************** *** 205,210 **** dict.iterkeys()". ! If this proposal is accepted, it makes sense to recommend that ! other mappings, if they support iterators at all, should also iterate over the keys. However, this should not be taken as an absolute rule; specific applications may have different --- 211,215 ---- dict.iterkeys()". ! Other mappings, if they support iterators at all, should also iterate over the keys. However, this should not be taken as an absolute rule; specific applications may have different *************** *** 214,222 **** File Iterators ! The following proposal is not controversial, but should be ! considered a separate step after introducing the iterator ! framework described above. It is useful because it provides us ! with a good answer to the complaint that the common idiom to ! iterate over the lines of a file is ugly and slow. - Files implement a tp_iter slot that is equivalent to --- 219,225 ---- File Iterators ! The following proposal is useful because it provides us with a ! good answer to the complaint that the common idiom to iterate over ! the lines of a file is ugly and slow. - Files implement a tp_iter slot that is equivalent to *************** *** 246,249 **** --- 249,279 ---- the open file object really represents a pipe or a stream socket. + Because the file iterator uses an internal buffer, mixing this + with other file operations (e.g. file.readline()) doesn't work + right. Also, the following code: + + for line in file: + if line == "\n": + break + for line in file: + print line, + + doesn't work as you might expect, because the iterator created by + the second for-loop doesn't take the buffer read-ahead by the + first for-loop into account. A correct way to write this is: + + it = iter(file) + for line in it: + if line == "\n": + break + for line in it: + print line, + + (The rationale for these restrictions are that "for line in file" + ought to become the recommended, standard way to iterate over the + lines of a file, and this should be as fast as can be. The + iterator version is considerable faster than calling readline(), + due to the internal buffer in the iterator.) + Rationale *************** *** 294,300 **** than clarity. - Some folks have requested the ability to restart an iterator. This should be dealt with by calling iter() on a sequence ! repeatedly, not by the iterator protocol itself. - It has been questioned whether an exception to signal the end of --- 324,336 ---- than clarity. + (In retrospect, it might have been better to go for __next__() + and have a new built-in, next(it), which calls it.__next__(). + But alas, it's too late; this has been deployed in Python 2.2 + since December 2001.) + - Some folks have requested the ability to restart an iterator. This should be dealt with by calling iter() on a sequence ! repeatedly, not by the iterator protocol itself. (See also ! requested extensions below.) - It has been questioned whether an exception to signal the end of *************** *** 362,365 **** --- 398,406 ---- continues to raise StopIteration. + Note: this was in fact not implemented in Python 2.2; there are + many cases where an iterator's next() method can raise + StopIteration on one call but not on the next. This has been + remedied in Python 2.3. + - It has been proposed that a file object should be its own iterator, with a next() method returning the next line. This *************** *** 369,373 **** StopIteration" feature proposed in the previous bullet. ! Resolution: this has been implemented. - Some folks have requested extensions of the iterator protocol, --- 410,415 ---- StopIteration" feature proposed in the previous bullet. ! Resolution: tentatively rejected (though there are still people ! arguing for this). - Some folks have requested extensions of the iterator protocol, *************** *** 387,391 **** Resolution: rejected. ! - There is still discussion about whether for x in dict: ... --- 429,433 ---- Resolution: rejected. ! - There has been a long discussion about whether for x in dict: ... From ping@users.sourceforge.net Thu Jul 18 21:00:25 2002 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Thu, 18 Jul 2002 13:00:25 -0700 Subject: [Python-checkins] python/nondist/peps pep-0234.txt,1.17,1.18 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19150 Modified Files: pep-0234.txt Log Message: Adjusted the wording to make __iter__() more strongly required on iterators. See http://mail.python.org/pipermail/python-dev/2002-July/026668.html . Added text describing the distinct purposes of __iter__() and next(). See http://mail.python.org/pipermail/python-dev/2002-July/026683.html . Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pep-0234.txt 8 Jul 2002 06:48:55 -0000 1.17 --- pep-0234.txt 18 Jul 2002 20:00:21 -0000 1.18 *************** *** 140,147 **** Classes can define how they are iterated over by defining an __iter__() method; this should take no additional arguments and ! return a valid iterator object. A class is a valid iterator ! object when it defines a next() method that behaves as described ! above. A class that wants to be an iterator also ought to ! implement __iter__() returning itself. --- 140,163 ---- Classes can define how they are iterated over by defining an __iter__() method; this should take no additional arguments and ! return a valid iterator object. A class that wants to be an ! iterator should implement two methods: a next() method that behaves ! as described above, and an __iter__() method that returns self. ! ! The two methods correspond to two distinct protocols: ! ! 1. An object can be iterated over with "for" if it implements ! __iter__() or __getitem__(). ! ! 2. An object can function as an iterator if it implements next(). ! ! Container-like objects usually support protocol 1. Iterators are ! currently required to support both protocols. The semantics of ! iteration come only from protocol 2; protocol 1 is present to make ! iterators behave like sequences. But the analogy is weak -- unlike ! ordinary sequences, iterators are "sequences" that are destroyed ! by the act of looking at their elements. ! ! Consequently, whenever any Python programmer says "for x in y", ! he or she must be sure of whether this is going to destroy y. From fdrake@users.sourceforge.net Thu Jul 18 20:11:46 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 18 Jul 2002 12:11:46 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29392 Modified Files: _hotshot.c Log Message: - When the log reader detects end-of-file, close the file. - The log reader now provides a "closed" attribute similar to the profiler. - Both the profiler and log reader now provide a fileno() method. - Use METH_NOARGS where possible, allowing simpler code in the method implementations. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** _hotshot.c 17 Jul 2002 19:38:05 -0000 1.22 --- _hotshot.c 18 Jul 2002 19:11:44 -0000 1.23 *************** *** 109,122 **** logreader_close(LogReaderObject *self, PyObject *args) { ! PyObject *result = NULL; ! if (PyArg_ParseTuple(args, ":close")) { ! if (self->logfp != NULL) { ! fclose(self->logfp); ! self->logfp = NULL; ! } ! result = Py_None; ! Py_INCREF(result); } ! return result; } --- 109,135 ---- logreader_close(LogReaderObject *self, PyObject *args) { ! if (self->logfp != NULL) { ! fclose(self->logfp); ! self->logfp = NULL; } ! Py_INCREF(Py_None); ! ! return Py_None; ! } ! ! PyDoc_STRVAR(logreader_fileno__doc__, ! "fileno() -> file descriptor\n" ! "Returns the file descriptor for the log file, if open.\n" ! "Raises ValueError if the log file is closed."); ! ! static PyObject * ! logreader_fileno(LogReaderObject *self) ! { ! if (self->logfp == NULL) { ! PyErr_SetString(PyExc_ValueError, ! "logreader's file object already closed"); ! return NULL; ! } ! return PyInt_FromLong(fileno(self->logfp)); } *************** *** 351,356 **** static void ! eof_error(void) { PyErr_SetString(PyExc_EOFError, "end of file with incomplete profile record"); --- 364,371 ---- static void ! eof_error(LogReaderObject *self) { + fclose(self->logfp); + self->logfp = NULL; PyErr_SetString(PyExc_EOFError, "end of file with incomplete profile record"); *************** *** 380,386 **** restart: /* decode the record type */ ! if ((c = fgetc(self->logfp)) == EOF) return NULL; ! what = c & WHAT_OTHER; if (what == WHAT_OTHER) --- 395,403 ---- restart: /* decode the record type */ ! if ((c = fgetc(self->logfp)) == EOF) { ! fclose(self->logfp); ! self->logfp = NULL; return NULL; ! } what = c & WHAT_OTHER; if (what == WHAT_OTHER) *************** *** 451,455 **** } else if (err == ERR_EOF) { ! eof_error(); } else if (!err) { --- 468,472 ---- } else if (err == ERR_EOF) { ! eof_error(self); } else if (!err) { *************** *** 1023,1040 **** static PyObject * ! profiler_close(ProfilerObject *self, PyObject *args) { ! PyObject *result = NULL; ! if (PyArg_ParseTuple(args, ":close")) { ! do_stop(self); ! if (self->logfp != NULL) { ! fclose(self->logfp); ! self->logfp = NULL; ! } ! Py_INCREF(Py_None); ! result = Py_None; } ! return result; } --- 1040,1065 ---- static PyObject * ! profiler_close(ProfilerObject *self) { ! do_stop(self); ! if (self->logfp != NULL) { ! fclose(self->logfp); ! self->logfp = NULL; ! } ! Py_INCREF(Py_None); ! return Py_None; ! } ! #define fileno__doc__ logreader_fileno__doc__ ! ! static PyObject * ! profiler_fileno(ProfilerObject *self) ! { ! if (self->logfp == NULL) { ! PyErr_SetString(PyExc_ValueError, ! "profiler's file object already closed"); ! return NULL; } ! return PyInt_FromLong(fileno(self->logfp)); } *************** *** 1110,1119 **** PyObject *result = NULL; ! if (PyArg_ParseTuple(args, ":start")) { ! if (is_available(self)) { ! do_start(self); ! result = Py_None; ! Py_INCREF(result); ! } } return result; --- 1135,1142 ---- PyObject *result = NULL; ! if (is_available(self)) { ! do_start(self); ! result = Py_None; ! Py_INCREF(result); } return result; *************** *** 1129,1140 **** PyObject *result = NULL; ! if (PyArg_ParseTuple(args, ":stop")) { ! if (!self->active) ! PyErr_SetString(ProfilerError, "profiler not active"); ! else { ! do_stop(self); ! result = Py_None; ! Py_INCREF(result); ! } } return result; --- 1152,1161 ---- PyObject *result = NULL; ! if (!self->active) ! PyErr_SetString(ProfilerError, "profiler not active"); ! else { ! do_stop(self); ! result = Py_None; ! Py_INCREF(result); } return result; *************** *** 1157,1165 **** static PyMethodDef profiler_methods[] = { {"addinfo", (PyCFunction)profiler_addinfo, METH_VARARGS, addinfo__doc__}, ! {"close", (PyCFunction)profiler_close, METH_VARARGS, close__doc__}, {"runcall", (PyCFunction)profiler_runcall, METH_VARARGS, runcall__doc__}, {"runcode", (PyCFunction)profiler_runcode, METH_VARARGS, runcode__doc__}, ! {"start", (PyCFunction)profiler_start, METH_VARARGS, start__doc__}, ! {"stop", (PyCFunction)profiler_stop, METH_VARARGS, stop__doc__}, {NULL, NULL} }; --- 1178,1187 ---- static PyMethodDef profiler_methods[] = { {"addinfo", (PyCFunction)profiler_addinfo, METH_VARARGS, addinfo__doc__}, ! {"close", (PyCFunction)profiler_close, METH_NOARGS, close__doc__}, ! {"fileno", (PyCFunction)profiler_fileno, METH_NOARGS, fileno__doc__}, {"runcall", (PyCFunction)profiler_runcall, METH_VARARGS, runcall__doc__}, {"runcode", (PyCFunction)profiler_runcode, METH_VARARGS, runcode__doc__}, ! {"start", (PyCFunction)profiler_start, METH_NOARGS, start__doc__}, ! {"stop", (PyCFunction)profiler_stop, METH_NOARGS, stop__doc__}, {NULL, NULL} }; *************** *** 1193,1196 **** --- 1215,1219 ---- "\n" "close(): Stop the profiler and close the log files.\n" + "fileno(): Returns the file descriptor of the log file.\n" "runcall(): Run a single function call with profiling enabled.\n" "runcode(): Execute a code object with profiling enabled.\n" *************** *** 1245,1250 **** static PyMethodDef logreader_methods[] = { ! {"close", (PyCFunction)logreader_close, METH_VARARGS, logreader_close__doc__}, {NULL, NULL} }; --- 1268,1275 ---- static PyMethodDef logreader_methods[] = { ! {"close", (PyCFunction)logreader_close, METH_NOARGS, logreader_close__doc__}, + {"fileno", (PyCFunction)logreader_fileno, METH_NOARGS, + logreader_fileno__doc__}, {NULL, NULL} }; *************** *** 1274,1277 **** --- 1299,1316 ---- }; + static PyObject * + logreader_get_closed(LogReaderObject *self, void *closure) + { + PyObject *result = (self->logfp == NULL) ? Py_True : Py_False; + Py_INCREF(result); + return result; + } + + static PyGetSetDef logreader_getsets[] = { + {"closed", (getter)logreader_get_closed, NULL, + PyDoc_STR("True if the logreader's input file has already been closed.")}, + {NULL} + }; + static PyTypeObject LogReaderType = { PyObject_HEAD_INIT(NULL) *************** *** 1305,1309 **** logreader_methods, /* tp_methods */ logreader_members, /* tp_members */ ! 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ --- 1344,1348 ---- logreader_methods, /* tp_methods */ logreader_members, /* tp_members */ ! logreader_getsets, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ *************** *** 1341,1345 **** for (;;) { if ((c = fgetc(self->logfp)) == EOF) { ! eof_error(); break; } --- 1380,1384 ---- for (;;) { if ((c = fgetc(self->logfp)) == EOF) { ! eof_error(self); break; } *************** *** 1351,1355 **** if (err) { if (err == ERR_EOF) ! eof_error(); else PyErr_SetString(PyExc_RuntimeError, --- 1390,1394 ---- if (err) { if (err == ERR_EOF) ! eof_error(self); else PyErr_SetString(PyExc_RuntimeError, From jhylton@users.sourceforge.net Thu Jul 18 21:59:00 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 18 Jul 2002 13:59:00 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.90,2.91 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9904 Modified Files: cPickle.c Log Message: Fix indentation. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -d -r2.90 -r2.91 *** cPickle.c 17 Jul 2002 16:30:36 -0000 2.90 --- cPickle.c 18 Jul 2002 20:58:57 -0000 2.91 *************** *** 379,388 **** Py_BEGIN_ALLOW_THREADS ! nbyteswritten = fwrite(s, sizeof(char), n, self->fp); Py_END_ALLOW_THREADS ! if (nbyteswritten != (size_t)n) { ! PyErr_SetFromErrno(PyExc_IOError); ! return -1; ! } return n; --- 379,388 ---- Py_BEGIN_ALLOW_THREADS ! nbyteswritten = fwrite(s, sizeof(char), n, self->fp); Py_END_ALLOW_THREADS ! if (nbyteswritten != (size_t)n) { ! PyErr_SetFromErrno(PyExc_IOError); ! return -1; ! } return n; From gvanrossum@users.sourceforge.net Thu Jul 18 22:11:28 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 14:11:28 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.231,1.232 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14123 Modified Files: socketmodule.c Log Message: Silence warning about getdefaulttimeout in PyMethodDef. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.231 retrieving revision 1.232 diff -C2 -d -r1.231 -r1.232 *** socketmodule.c 18 Jul 2002 17:08:34 -0000 1.231 --- socketmodule.c 18 Jul 2002 21:11:26 -0000 1.232 *************** *** 2821,2825 **** {"getnameinfo", socket_getnameinfo, METH_VARARGS, getnameinfo_doc}, ! {"getdefaulttimeout", socket_getdefaulttimeout, METH_NOARGS, getdefaulttimeout_doc}, {"setdefaulttimeout", socket_setdefaulttimeout, --- 2821,2825 ---- {"getnameinfo", socket_getnameinfo, METH_VARARGS, getnameinfo_doc}, ! {"getdefaulttimeout", (PyCFunction)socket_getdefaulttimeout, METH_NOARGS, getdefaulttimeout_doc}, {"setdefaulttimeout", socket_setdefaulttimeout, From bwarsaw@users.sourceforge.net Thu Jul 18 22:29:19 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 18 Jul 2002 14:29:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv20152 Modified Files: __init__.py Log Message: Anthony Baxter's patch to expose the parser's `strict' flag in these convenience functions. Closes SF # 583188 (python project). Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 9 Jul 2002 02:13:10 -0000 1.9 --- __init__.py 18 Jul 2002 21:29:17 -0000 1.10 *************** *** 5,9 **** """ ! __version__ = '2.1' __all__ = ['Charset', --- 5,9 ---- """ ! __version__ = '2.2' __all__ = ['Charset', *************** *** 33,39 **** from email.Message import Message as _Message ! def message_from_string(s, _class=_Message): ! return _Parser(_class).parsestr(s) ! def message_from_file(fp, _class=_Message): ! return _Parser(_class).parse(fp) --- 33,39 ---- from email.Message import Message as _Message ! def message_from_string(s, _class=_Message, strict=1): ! return _Parser(_class, strict=strict).parsestr(s) ! def message_from_file(fp, _class=_Message, strict=1): ! return _Parser(_class, strict=strict).parse(fp) From tim_one@users.sourceforge.net Thu Jul 18 23:38:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 15:38:46 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.232,1.233 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12188/python/Modules Modified Files: socketmodule.c Log Message: A Python float is a C double; redeclare defaulttimeout as such; stops compiler wngs on Windows. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.232 retrieving revision 1.233 diff -C2 -d -r1.232 -r1.233 *** socketmodule.c 18 Jul 2002 21:11:26 -0000 1.232 --- socketmodule.c 18 Jul 2002 22:38:44 -0000 1.233 *************** *** 524,528 **** /* Initialize a new socket object. */ ! static float defaulttimeout = -1.0; /* Default timeout for new sockets */ static void --- 524,528 ---- /* Initialize a new socket object. */ ! static double defaulttimeout = -1.0; /* Default timeout for new sockets */ static void From jhylton@users.sourceforge.net Thu Jul 18 23:39:36 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 18 Jul 2002 15:39:36 -0700 Subject: [Python-checkins] python/dist/src configure,1.320,1.321 configure.in,1.330,1.331 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12728 Modified Files: configure configure.in Log Message: Define _XOPEN_SOURCE in configure and Python.h. This gets compilation of posixmodule.c to succeed on Tru64 and does no harm on Linux. We may need to undefine it on some platforms, but let's wait and see. Martin says: > I think it is generally the right thing to define _XOPEN_SOURCE on > Unix, providing a negative list of systems that cannot support this > setting (or preferably solving whatever problems remain). > > I'd put an (unconditional) AC_DEFINE into configure.in early on; it > *should* go into confdefs.h as configure proceeds, and thus be active > when other tests are performed. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.320 retrieving revision 1.321 diff -C2 -d -r1.320 -r1.321 *** configure 18 Jul 2002 20:25:43 -0000 1.320 --- configure 18 Jul 2002 22:39:32 -0000 1.321 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.329 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.330 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 1225,1228 **** --- 1225,1233 ---- SOVERSION=1.0 + + cat >>confdefs.h <<\_ACEOF + #define _XOPEN_SOURCE 500 + _ACEOF + # Arguments passed to configure. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.330 retrieving revision 1.331 diff -C2 -d -r1.330 -r1.331 *** configure.in 18 Jul 2002 20:25:46 -0000 1.330 --- configure.in 18 Jul 2002 22:39:34 -0000 1.331 *************** *** 21,24 **** --- 21,26 ---- SOVERSION=1.0 + AC_DEFINE(_XOPEN_SOURCE, 500) + # Arguments passed to configure. AC_SUBST(CONFIG_ARGS) From jhylton@users.sourceforge.net Thu Jul 18 23:39:36 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 18 Jul 2002 15:39:36 -0700 Subject: [Python-checkins] python/dist/src/Include Python.h,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv12728/Include Modified Files: Python.h Log Message: Define _XOPEN_SOURCE in configure and Python.h. This gets compilation of posixmodule.c to succeed on Tru64 and does no harm on Linux. We may need to undefine it on some platforms, but let's wait and see. Martin says: > I think it is generally the right thing to define _XOPEN_SOURCE on > Unix, providing a negative list of systems that cannot support this > setting (or preferably solving whatever problems remain). > > I'd put an (unconditional) AC_DEFINE into configure.in early on; it > *should* go into confdefs.h as configure proceeds, and thus be active > when other tests are performed. Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -d -r2.54 -r2.55 *** Python.h 12 Jul 2002 05:01:20 -0000 2.54 --- Python.h 18 Jul 2002 22:39:34 -0000 2.55 *************** *** 10,20 **** #endif - /* Forcing SUSv2 compatibility still produces problems on some - platforms, True64 and SGI IRIX being two of them, so for now the - define is switched off. */ - #if 0 #ifndef _XOPEN_SOURCE ! # define _XOPEN_SOURCE 500 ! #endif #endif --- 10,15 ---- #endif #ifndef _XOPEN_SOURCE ! # define _XOPEN_SOURCE 500 #endif From mhammond@users.sourceforge.net Fri Jul 19 00:06:19 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 16:06:19 -0700 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22297 Modified Files: codecs.c Log Message: Fix bug [ 549731 ] Unicode encoders appears to leak references. Python 2.2.1 bugfix candidate. Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** codecs.c 26 Sep 2000 05:46:01 -0000 2.13 --- codecs.c 18 Jul 2002 23:06:17 -0000 2.14 *************** *** 272,275 **** --- 272,276 ---- goto onError; v = PyTuple_GET_ITEM(codecs,0); + Py_DECREF(codecs); Py_INCREF(v); return v; *************** *** 288,291 **** --- 289,293 ---- goto onError; v = PyTuple_GET_ITEM(codecs,1); + Py_DECREF(codecs); Py_INCREF(v); return v; *************** *** 299,308 **** const char *errors) { ! PyObject *codecs; codecs = _PyCodec_Lookup(encoding); if (codecs == NULL) goto onError; ! return build_stream_codec(PyTuple_GET_ITEM(codecs,2),stream,errors); onError: --- 301,312 ---- const char *errors) { ! PyObject *codecs, *ret; codecs = _PyCodec_Lookup(encoding); if (codecs == NULL) goto onError; ! ret = build_stream_codec(PyTuple_GET_ITEM(codecs,2),stream,errors); ! Py_DECREF(codecs); ! return ret; onError: *************** *** 314,323 **** const char *errors) { ! PyObject *codecs; codecs = _PyCodec_Lookup(encoding); if (codecs == NULL) goto onError; ! return build_stream_codec(PyTuple_GET_ITEM(codecs,3),stream,errors); onError: --- 318,329 ---- const char *errors) { ! PyObject *codecs, *ret; codecs = _PyCodec_Lookup(encoding); if (codecs == NULL) goto onError; ! ret = build_stream_codec(PyTuple_GET_ITEM(codecs,3),stream,errors); ! Py_DECREF(codecs); ! return ret; onError: From bwarsaw@users.sourceforge.net Fri Jul 19 00:09:12 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 18 Jul 2002 16:09:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.15,1.16 Parser.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv23342/email Modified Files: Message.py Parser.py Log Message: Anthony Baxter's cleanup patch. Python project SF patch # 583190, quoting: in non-strict mode, messages don't require a blank line at the end with a missing end-terminator. A single newline is sufficient now. Handle trailing whitespace at the end of a boundary. Had to switch from using string.split() to re.split() Handle whitespace on the end of a parameter list for Content-type. Handle whitespace on the end of a plain content-type header. Specifically, get_type(): Strip the content type string. _get_params_preserve(): Strip the parameter names and values on both sides. _parsebody(): Lots of changes as described above, with some stylistic changes by Barry (who hopefully didn't screw things up ;). Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Message.py 9 Jul 2002 02:46:12 -0000 1.15 --- Message.py 18 Jul 2002 23:09:09 -0000 1.16 *************** *** 374,378 **** if value is missing: return failobj ! return paramre.split(value)[0].lower() def get_main_type(self, failobj=None): --- 374,378 ---- if value is missing: return failobj ! return paramre.split(value)[0].lower().strip() def get_main_type(self, failobj=None): *************** *** 429,437 **** try: name, val = p.split('=', 1) ! name = name.rstrip() ! val = val.lstrip() except ValueError: # Must have been a bare attribute ! name = p val = '' params.append((name, val)) --- 429,437 ---- try: name, val = p.split('=', 1) ! name = name.strip() ! val = val.strip() except ValueError: # Must have been a bare attribute ! name = p.strip() val = '' params.append((name, val)) Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Parser.py 9 Jul 2002 02:50:02 -0000 1.10 --- Parser.py 18 Jul 2002 23:09:09 -0000 1.11 *************** *** 125,141 **** preamble = epilogue = None # Split into subparts. The first boundary we're looking for won't ! # have the leading newline since we're at the start of the body ! # text. separator = '--' + boundary payload = fp.read() ! start = payload.find(separator) ! if start < 0: raise Errors.BoundaryError( "Couldn't find starting boundary: %s" % boundary) if start > 0: # there's some pre-MIME boundary preamble preamble = payload[0:start] # Find out what kind of line endings we're using ! start += len(separator) cre = re.compile('\r\n|\r|\n') mo = cre.search(payload, start) --- 125,147 ---- preamble = epilogue = None # Split into subparts. The first boundary we're looking for won't ! # always have a leading newline since we're at the start of the ! # body text, and there's not always a preamble before the first ! # boundary. separator = '--' + boundary payload = fp.read() ! # We use an RE here because boundaries can have trailing ! # whitespace. ! mo = re.search( ! r'(?P' + re.escape(separator) + r')(?P[ \t]*)', ! payload) ! if not mo: raise Errors.BoundaryError( "Couldn't find starting boundary: %s" % boundary) + start = mo.start() if start > 0: # there's some pre-MIME boundary preamble preamble = payload[0:start] # Find out what kind of line endings we're using ! start += len(mo.group('sep')) + len(mo.group('ws')) cre = re.compile('\r\n|\r|\n') mo = cre.search(payload, start) *************** *** 152,156 **** linesep = mo.group('sep') if mo.end() < len(payload): ! # there's some post-MIME boundary epilogue epilogue = payload[mo.end():] elif self._strict: --- 158,162 ---- linesep = mo.group('sep') if mo.end() < len(payload): ! # There's some post-MIME boundary epilogue epilogue = payload[mo.end():] elif self._strict: *************** *** 158,172 **** "Couldn't find terminating boundary: %s" % boundary) else: ! # handle the case of no trailing boundary. I hate mail clients. ! # check that it ends in a blank line ! endre = re.compile('(?P\r\n|\r|\n){2}$') ! mo = endre.search(payload) if not mo: ! raise Errors.BoundaryError( ! "Couldn't find terminating boundary, and no "+ ! "trailing empty line") ! else: ! linesep = mo.group('sep') ! terminator = len(payload) # We split the textual payload on the boundary separator, which # includes the trailing newline. If the container is a --- 164,178 ---- "Couldn't find terminating boundary: %s" % boundary) else: ! # Handle the case of no trailing boundary. Check that it ends ! # in a blank line. Some cases (spamspamspam) don't even have ! # that! ! mo = re.search('(?P\r\n|\r|\n){2}$', payload) if not mo: ! mo = re.search('(?P\r\n|\r|\n)$', payload) ! if not mo: ! raise Errors.BoundaryError( ! 'No terminating boundary and no trailing empty line') ! linesep = mo.group('sep') ! terminator = len(payload) # We split the textual payload on the boundary separator, which # includes the trailing newline. If the container is a *************** *** 175,180 **** # block of MIME headers, then an empty line followed by the # message headers. ! separator += linesep ! parts = payload[start:terminator].split(linesep + separator) for part in parts: if isdigest: --- 181,187 ---- # block of MIME headers, then an empty line followed by the # message headers. ! parts = re.split( ! linesep + re.escape(separator) + r'[ \t]*' + linesep, ! payload[start:terminator]) for part in parts: if isdigest: From tim_one@users.sourceforge.net Fri Jul 19 03:33:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 19:33:10 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.121,2.122 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12228/python/Objects Modified Files: listobject.c Log Message: Cleanup: Define one internal utility for reversing a list slice, and use that everywhere. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.121 retrieving revision 2.122 diff -C2 -d -r2.121 -r2.122 *** listobject.c 17 Jul 2002 16:30:38 -0000 2.121 --- listobject.c 19 Jul 2002 02:33:08 -0000 2.122 *************** *** 740,743 **** --- 740,759 ---- } + /* Reverse a slice of a list in place, from lo up to (exclusive) hi. */ + static void + reverse_slice(PyObject **lo, PyObject **hi) + { + assert(lo && hi); + + --hi; + while (lo < hi) { + PyObject *t = *lo; + *lo = *hi; + *hi = t; + ++lo; + --hi; + } + } + /* New quicksort implementation for arrays of object pointers. Thanks to discussions with Tim Peters. */ *************** *** 1027,1038 **** if (hi - r <= MAXMERGE) { /* Reverse the reversed prefix, then insert the tail */ ! PyObject **originalr = r; ! l = lo; ! do { ! --r; ! tmp = *l; *l = *r; *r = tmp; ! ++l; ! } while (l < r); ! return binarysort(lo, hi, originalr, compare); } --- 1043,1048 ---- if (hi - r <= MAXMERGE) { /* Reverse the reversed prefix, then insert the tail */ ! reverse_slice(lo, r); ! return binarysort(lo, hi, r, compare); } *************** *** 1322,1347 **** } - static void - _listreverse(PyListObject *self) - { - register PyObject **p, **q; - register PyObject *tmp; - - if (self->ob_size > 1) { - for (p = self->ob_item, q = self->ob_item + self->ob_size - 1; - p < q; - p++, q--) - { - tmp = *p; - *p = *q; - *q = tmp; - } - } - } - static PyObject * listreverse(PyListObject *self) { ! _listreverse(self); Py_INCREF(Py_None); return Py_None; --- 1332,1339 ---- } static PyObject * listreverse(PyListObject *self) { ! reverse_slice(self->ob_item, self->ob_item + self->ob_size); Py_INCREF(Py_None); return Py_None; *************** *** 1355,1359 **** return -1; } ! _listreverse((PyListObject *)v); return 0; } --- 1347,1351 ---- return -1; } ! listreverse((PyListObject *)v); return 0; } From tim_one@users.sourceforge.net Fri Jul 19 03:35:47 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 19:35:47 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.122,2.123 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12776/python/Objects Modified Files: listobject.c Log Message: Trimmed trailing whitespace. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.122 retrieving revision 2.123 diff -C2 -d -r2.122 -r2.123 *** listobject.c 19 Jul 2002 02:33:08 -0000 2.122 --- listobject.c 19 Jul 2002 02:35:45 -0000 2.123 *************** *** 15,19 **** unsigned int n2 = (unsigned int)n >> 5; ! /* Round up: * If n < 256, to a multiple of 8. * If n < 2048, to a multiple of 64. --- 15,19 ---- unsigned int n2 = (unsigned int)n >> 5; ! /* Round up: * If n < 256, to a multiple of 8. * If n < 2048, to a multiple of 64. *************** *** 302,306 **** goto Done; result = _PyString_Join(s, pieces); ! Py_DECREF(s); Done: --- 302,306 ---- goto Done; result = _PyString_Join(s, pieces); ! Py_DECREF(s); Done: *************** *** 599,603 **** old_value = a->ob_item[i]; a->ob_item[i] = v; ! Py_DECREF(old_value); return 0; } --- 599,603 ---- old_value = a->ob_item[i]; a->ob_item[i] = v; ! Py_DECREF(old_value); return 0; } *************** *** 929,933 **** We also play lots of low-level tricks to cut the number of compares. ! Very obscure: To avoid using extra memory, the PPs are stored in the array and shuffled around as partitioning proceeds. At the start of a --- 929,933 ---- We also play lots of low-level tricks to cut the number of compares. ! Very obscure: To avoid using extra memory, the PPs are stored in the array and shuffled around as partitioning proceeds. At the start of a *************** *** 1061,1065 **** extra still makes *sense*, but may be smaller than we would like (but the array has more than ~= 2**31 ! elements in this case!) */ } /* Now k == extra - 1 + CUTOFFBASE. The smallest value k can --- 1061,1065 ---- extra still makes *sense*, but may be smaller than we would like (but the array has more than ~= 2**31 ! elements in this case!) */ } /* Now k == extra - 1 + CUTOFFBASE. The smallest value k can *************** *** 1158,1162 **** [hi, hi+extra) contains the larger PPs. */ ! k = extra >>= 1; /* num PPs to move */ if (extraOnRight) { /* Swap the smaller PPs to the left end. --- 1158,1162 ---- [hi, hi+extra) contains the larger PPs. */ ! k = extra >>= 1; /* num PPs to move */ if (extraOnRight) { /* Swap the smaller PPs to the left end. *************** *** 1712,1716 **** if (!result) return NULL; ! for (cur = start, i = 0; i < slicelength; cur += step, i++) { it = PyList_GET_ITEM(self, cur); --- 1712,1716 ---- if (!result) return NULL; ! for (cur = start, i = 0; i < slicelength; cur += step, i++) { it = PyList_GET_ITEM(self, cur); *************** *** 1718,1722 **** PyList_SET_ITEM(result, i, it); } ! return result; } --- 1718,1722 ---- PyList_SET_ITEM(result, i, it); } ! return result; } *************** *** 1729,1733 **** } ! static int list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) { --- 1729,1733 ---- } ! static int list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) { *************** *** 1762,1766 **** PyObject **garbage, **it; int cur, i, j; ! if (slicelength <= 0) return 0; --- 1762,1766 ---- PyObject **garbage, **it; int cur, i, j; ! if (slicelength <= 0) return 0; *************** *** 1774,1779 **** garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); ! ! /* drawing pictures might help understand these for loops */ for (cur = start, i = 0; --- 1774,1779 ---- garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); ! ! /* drawing pictures might help understand these for loops */ for (cur = start, i = 0; *************** *** 1784,1788 **** for (j = 0; j < step; j++) { ! PyList_SET_ITEM(self, cur + j - i, PyList_GET_ITEM(self, cur + j + 1)); --- 1784,1788 ---- for (j = 0; j < step; j++) { ! PyList_SET_ITEM(self, cur + j - i, PyList_GET_ITEM(self, cur + j + 1)); *************** *** 1829,1836 **** /* protect against a[::-1] = a */ ! if (self == (PyListObject*)value) { value = list_slice((PyListObject*)value, 0, PyList_GET_SIZE(value)); ! } else { Py_INCREF(value); --- 1829,1836 ---- /* protect against a[::-1] = a */ ! if (self == (PyListObject*)value) { value = list_slice((PyListObject*)value, 0, PyList_GET_SIZE(value)); ! } else { Py_INCREF(value); *************** *** 1839,1847 **** garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); ! ! for (cur = start, i = 0; i < slicelength; cur += step, i++) { garbage[i] = PyList_GET_ITEM(self, cur); ! ins = PyList_GET_ITEM(value, i); Py_INCREF(ins); --- 1839,1847 ---- garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); ! ! for (cur = start, i = 0; i < slicelength; cur += step, i++) { garbage[i] = PyList_GET_ITEM(self, cur); ! ins = PyList_GET_ITEM(value, i); Py_INCREF(ins); *************** *** 1852,1864 **** Py_DECREF(garbage[i]); } ! PyMem_FREE(garbage); Py_DECREF(value); ! return 0; } ! } else { ! PyErr_SetString(PyExc_TypeError, "list indices must be integers"); return -1; --- 1852,1864 ---- Py_DECREF(garbage[i]); } ! PyMem_FREE(garbage); Py_DECREF(value); ! return 0; } ! } else { ! PyErr_SetString(PyExc_TypeError, "list indices must be integers"); return -1; From tim_one@users.sourceforge.net Fri Jul 19 04:30:59 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 20:30:59 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.123,2.124 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24947/python/Objects Modified Files: listobject.c Log Message: Cleanup yielding a small speed boost: before rich comparisons were introduced, list.sort() was rewritten to use only the "< or not " flavor of outcome, and the sorting code was left alone. This left things more obscure than they should be, and turns out it also cost measurable cycles. So: The old CMPERROR novelty is gone. docompare() is renamed to islt(), and now has the same return conditinos as PyObject_RichCompareBool. The SETK macro is renamed to ISLT, and is even weirder than before (don't complain unless you want to maintain the sort code ). Overall, this yields a 1-2% speedup in the usual (no explicit function passed to list.sort()) case when sorting arrays of floats (as sortperf.py does). The boost is higher for arrays of ints. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -d -r2.123 -r2.124 *** listobject.c 19 Jul 2002 02:35:45 -0000 2.123 --- listobject.c 19 Jul 2002 03:30:57 -0000 2.124 *************** *** 759,774 **** Thanks to discussions with Tim Peters. */ - /* CMPERROR is returned by our comparison function when an error - occurred. This is the largest negative integer (0x80000000 on a - 32-bit system). */ - #define CMPERROR ( (int) ((unsigned int)1 << (8*sizeof(int) - 1)) ) - /* Comparison function. Takes care of calling a user-supplied comparison function (any callable Python object). Calls the ! standard comparison function, PyObject_Compare(), if the user- ! supplied function is NULL. */ static int ! docompare(PyObject *x, PyObject *y, PyObject *compare) { PyObject *res; --- 759,770 ---- Thanks to discussions with Tim Peters. */ /* Comparison function. Takes care of calling a user-supplied comparison function (any callable Python object). Calls the ! standard comparison function, PyObject_RichCompareBool(), if the user- ! supplied function is NULL. ! Returns <0 on error, >0 if x < y, 0 if x >= y. */ static int ! islt(PyObject *x, PyObject *y, PyObject *compare) { PyObject *res; *************** *** 776,795 **** int i; ! if (compare == NULL) { ! /* NOTE: we rely on the fact here that the sorting algorithm ! only ever checks whether k<0, i.e., whether x 0) ! return 1; ! return 0; } --- 788,801 ---- Py_DECREF(args); if (res == NULL) ! return -1; if (!PyInt_Check(res)) { Py_DECREF(res); PyErr_SetString(PyExc_TypeError, "comparison function must return int"); ! return -1; } i = PyInt_AsLong(res); Py_DECREF(res); ! return i < 0; } *************** *** 851,856 **** #define STACKSIZE 60 ! ! #define SETK(X,Y) if ((k = docompare(X,Y,compare))==CMPERROR) goto fail /* binarysort is the best method for sorting small arrays: it does --- 836,845 ---- #define STACKSIZE 60 ! /* Compare X to Y via islt(). Goto "fail" if the comparison raises an ! error. Else "k" is set to true iff X. X and Y are PyObject*s. ! */ ! #define IFLT(X, Y) if ((k = islt(X, Y, compare)) < 0) goto fail; \ ! if (k) /* binarysort is the best method for sorting small arrays: it does *************** *** 858,865 **** elements. [lo, hi) is a contiguous slice of a list, and is sorted via ! binary insertion. On entry, must have lo <= start <= hi, and that [lo, start) is already sorted (pass start == lo if you don't know!). ! If docompare complains (returns CMPERROR) return -1, else 0. Even in case of error, the output slice will be some permutation of the input (nothing is lost or duplicated). --- 847,854 ---- elements. [lo, hi) is a contiguous slice of a list, and is sorted via ! binary insertion. This sort is stable. On entry, must have lo <= start <= hi, and that [lo, start) is already sorted (pass start == lo if you don't know!). ! If islt() complains return -1, else 0. Even in case of error, the output slice will be some permutation of the input (nothing is lost or duplicated). *************** *** 870,879 **** /* compare -- comparison function object, or NULL for default */ { - /* assert lo <= start <= hi - assert [lo, start) is sorted */ register int k; register PyObject **l, **p, **r; register PyObject *pivot; if (lo == start) ++start; --- 859,868 ---- /* compare -- comparison function object, or NULL for default */ { register int k; register PyObject **l, **p, **r; register PyObject *pivot; + assert(lo <= start && start <= hi); + /* assert [lo, start) is sorted */ if (lo == start) ++start; *************** *** 885,890 **** do { p = l + ((r - l) >> 1); ! SETK(pivot, *p); ! if (k < 0) r = p; else --- 874,878 ---- do { p = l + ((r - l) >> 1); ! IFLT(pivot, *p) r = p; else *************** *** 907,911 **** [lo, hi) is a contiguous slice of a list, to be sorted in place. On entry, must have lo <= hi, ! If docompare complains (returns CMPERROR) return -1, else 0. Even in case of error, the output slice will be some permutation of the input (nothing is lost or duplicated). --- 895,899 ---- [lo, hi) is a contiguous slice of a list, to be sorted in place. On entry, must have lo <= hi, ! If islt() complains return -1, else 0. Even in case of error, the output slice will be some permutation of the input (nothing is lost or duplicated). *************** *** 1024,1029 **** /* assert lo < hi */ for (r = lo+1; r < hi; ++r) { ! SETK(*r, *(r-1)); ! if (k < 0) break; } --- 1012,1016 ---- /* assert lo < hi */ for (r = lo+1; r < hi; ++r) { ! IFLT(*r, *(r-1)) break; } *************** *** 1037,1042 **** /* assert lo < hi */ for (r = lo+1; r < hi; ++r) { ! SETK(*(r-1), *r); ! if (k < 0) break; } --- 1024,1028 ---- /* assert lo < hi */ for (r = lo+1; r < hi; ++r) { ! IFLT(*(r-1), *r) break; } *************** *** 1193,1198 **** /* slide l right, looking for key >= pivot */ do { ! SETK(*l, pivot); ! if (k < 0) ++l; else --- 1179,1183 ---- /* slide l right, looking for key >= pivot */ do { ! IFLT(*l, pivot) ++l; else *************** *** 1203,1208 **** while (l < r) { register PyObject *rval = *r--; ! SETK(rval, pivot); ! if (k < 0) { /* swap and advance */ r[1] = *l; --- 1188,1192 ---- while (l < r) { register PyObject *rval = *r--; ! IFLT(rval, pivot) { /* swap and advance */ r[1] = *l; *************** *** 1220,1225 **** if (l == r) { ! SETK(*r, pivot); ! if (k < 0) ++l; else --- 1204,1208 ---- if (l == r) { ! IFLT(*r, pivot) ++l; else *************** *** 1250,1255 **** while (l < hi) { /* pivot <= *l known */ ! SETK(pivot, *l); ! if (k < 0) break; else --- 1233,1237 ---- while (l < hi) { /* pivot <= *l known */ ! IFLT(pivot, *l) break; else *************** *** 1291,1295 **** } ! #undef SETK static PyTypeObject immutable_list_type; --- 1273,1277 ---- } ! #undef IFLT static PyTypeObject immutable_list_type; From tim_one@users.sourceforge.net Fri Jul 19 05:04:18 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 21:04:18 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.124,2.125 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3413/python/Objects Modified Files: listobject.c Log Message: listreverse(): Don't call the new reverse_slice unless the list has something in it (else ob_item may be a NULL pointer). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -d -r2.124 -r2.125 *** listobject.c 19 Jul 2002 03:30:57 -0000 2.124 --- listobject.c 19 Jul 2002 04:04:16 -0000 2.125 *************** *** 1317,1321 **** listreverse(PyListObject *self) { ! reverse_slice(self->ob_item, self->ob_item + self->ob_size); Py_INCREF(Py_None); return Py_None; --- 1317,1322 ---- listreverse(PyListObject *self) { ! if (self->ob_size > 1) ! reverse_slice(self->ob_item, self->ob_item + self->ob_size); Py_INCREF(Py_None); return Py_None; From gvanrossum@users.sourceforge.net Fri Jul 19 05:25:09 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 18 Jul 2002 21:25:09 -0700 Subject: [Python-checkins] python/nondist/peps pep-0234.txt,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9563 Modified Files: pep-0234.txt Log Message: Replace Ping's value judgement by a more neutral explanation of why iterators need to support __iter__. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pep-0234.txt 18 Jul 2002 20:38:28 -0000 1.19 --- pep-0234.txt 19 Jul 2002 04:25:06 -0000 1.20 *************** *** 164,173 **** currently required to support both protocols. The semantics of iteration come only from protocol 2; protocol 1 is present to make ! iterators behave like sequences. But the analogy is weak -- unlike ! ordinary sequences, iterators are "sequences" that are destroyed ! by the act of looking at their elements. ! ! Consequently, whenever any Python programmer says "for x in y", ! he or she must be sure of whether this is going to destroy y. --- 164,169 ---- currently required to support both protocols. The semantics of iteration come only from protocol 2; protocol 1 is present to make ! iterators behave like sequences; in particular so that code ! receiving an iterator can use a for-loop over the iterator. From tim_one@users.sourceforge.net Fri Jul 19 07:12:35 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:12:35 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.125,2.126 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31227/python/Objects Modified Files: listobject.c Log Message: binarysort() cleanup: Documented the key invariants, explained why they imply this is a stable sort, and added some asserts. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -d -r2.125 -r2.126 *** listobject.c 19 Jul 2002 04:04:16 -0000 2.125 --- listobject.c 19 Jul 2002 06:12:32 -0000 2.126 *************** *** 872,875 **** --- 872,881 ---- r = start; pivot = *r; + /* Invariants: + * pivot >= all in [lo, l). + * pivot < all in [r, start). + * The second is vacuously true at the start. + */ + assert(l < r); do { p = l + ((r - l) >> 1); *************** *** 877,883 **** r = p; else ! l = p + 1; } while (l < r); ! /* Pivot should go at l -- slide over to make room. Caution: using memmove is much slower under MSVC 5; we're not usually moving many slots. */ --- 883,894 ---- r = p; else ! l = p+1; } while (l < r); ! assert(l == r); ! /* The invariants still hold, so pivot >= all in [lo, l) and ! pivot < all in [l, start), so pivot belongs at l. Note ! that if there are elements equal to pivot, l points to the ! first slot after them -- that's why this sort is stable. ! Slide over to make room. Caution: using memmove is much slower under MSVC 5; we're not usually moving many slots. */ From mhammond@users.sourceforge.net Fri Jul 19 07:31:26 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:31:26 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.331,1.332 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv8284 Modified Files: configure.in Log Message: Add description for _XOPEN_SOURCE_ - needed to allow autoheader to succeed. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.331 retrieving revision 1.332 diff -C2 -d -r1.331 -r1.332 *** configure.in 18 Jul 2002 22:39:34 -0000 1.331 --- configure.in 19 Jul 2002 06:31:24 -0000 1.332 *************** *** 21,25 **** SOVERSION=1.0 ! AC_DEFINE(_XOPEN_SOURCE, 500) # Arguments passed to configure. --- 21,25 ---- SOVERSION=1.0 ! AC_DEFINE(_XOPEN_SOURCE, 500, [Needed on Tru64 and does no harm on Linux]) # Arguments passed to configure. From mhammond@users.sourceforge.net Fri Jul 19 07:55:43 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:55:43 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.81,2.82 pyexpat.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15103/Modules Modified Files: _sre.c pyexpat.c Log Message: Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -d -r2.81 -r2.82 *** _sre.c 17 Jul 2002 16:30:35 -0000 2.81 --- _sre.c 19 Jul 2002 06:55:41 -0000 2.82 *************** *** 2980,2985 **** }; ! DL_EXPORT(void) ! init_sre(void) { PyObject* m; --- 2980,2984 ---- }; ! PyMODINIT_FUNC init_sre(void) { PyObject* m; Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** pyexpat.c 17 Jul 2002 16:49:03 -0000 2.69 --- pyexpat.c 19 Jul 2002 06:55:41 -0000 2.70 *************** *** 1584,1591 **** #endif ! void MODULE_INITFUNC(void); /* avoid compiler warnings */ ! DL_EXPORT(void) ! MODULE_INITFUNC(void) { PyObject *m, *d; --- 1584,1590 ---- #endif ! PyMODINIT_FUNC MODULE_INITFUNC(void); /* avoid compiler warnings */ ! PyMODINIT_FUNC MODULE_INITFUNC(void) { PyObject *m, *d; From mhammond@users.sourceforge.net Fri Jul 19 07:55:43 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:55:43 -0700 Subject: [Python-checkins] python/dist/src/Python thread.c,2.44,2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15103/Python Modified Files: thread.c Log Message: Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. Index: thread.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/thread.c,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** thread.c 25 Jun 2002 19:26:34 -0000 2.44 --- thread.c 19 Jul 2002 06:55:41 -0000 2.45 *************** *** 8,16 **** #include "Python.h" - /* pyconfig.h may or may not define DL_IMPORT */ - #ifndef DL_IMPORT /* declarations for DLL import/export */ - #define DL_IMPORT(RTYPE) RTYPE - #endif - #ifndef DONT_HAVE_STDIO_H #include --- 8,11 ---- From mhammond@users.sourceforge.net Fri Jul 19 07:55:44 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:55:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv15103/Doc/ext Modified Files: extending.tex Log Message: Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** extending.tex 22 Jun 2002 01:42:00 -0000 1.21 --- extending.tex 19 Jul 2002 06:55:41 -0000 1.22 *************** *** 213,217 **** \begin{verbatim} ! void initspam(void) { --- 213,217 ---- \begin{verbatim} ! PyMODINIT_FUNC initspam(void) { *************** *** 241,244 **** --- 241,245 ---- could cause a core dump or other unintended side effects. + We discuss the use of PyMODINIT_FUNC later in this sample. \section{Back to the Example *************** *** 340,344 **** \begin{verbatim} ! void initspam(void) { --- 341,345 ---- \begin{verbatim} ! PyMODINIT_FUNC initspam(void) { *************** *** 347,351 **** \end{verbatim} ! Note that for \Cpp, this method must be declared \code{extern "C"}. When the Python program imports module \module{spam} for the first --- 348,354 ---- \end{verbatim} ! Note that PyMODINIT_FUNC declares the function as \code{void} return type, ! declares any special linkage declarations required by the platform, and for ! \Cpp declares the function as \code{extern "C"}. When the Python program imports module \module{spam} for the first *************** *** 1264,1268 **** \begin{verbatim} ! void initspam(void) { --- 1267,1271 ---- \begin{verbatim} ! PyMODINIT_FUNC initspam(void) { *************** *** 1353,1357 **** \begin{verbatim} ! void initclient(void) { --- 1356,1360 ---- \begin{verbatim} ! PyMODINIT_FUNC initclient(void) { From mhammond@users.sourceforge.net Fri Jul 19 07:55:43 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:55:43 -0700 Subject: [Python-checkins] python/dist/src configure,1.321,1.322 pyconfig.h.in,1.42,1.43 configure.in,1.332,1.333 Makefile.pre.in,1.87,1.88 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv15103 Modified Files: configure pyconfig.h.in configure.in Makefile.pre.in Log Message: Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.321 retrieving revision 1.322 diff -C2 -d -r1.321 -r1.322 *** configure 18 Jul 2002 22:39:32 -0000 1.321 --- configure 19 Jul 2002 06:55:40 -0000 1.322 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.330 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.332 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 1226,1229 **** --- 1226,1230 ---- SOVERSION=1.0 + cat >>confdefs.h <<\_ACEOF #define _XOPEN_SOURCE 500 *************** *** 1348,1353 **** CC=mwcc without_gcc=yes ! OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma" ! CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'" LDFLAGS="$LDFLAGS -nodup" ;; --- 1349,1353 ---- CC=mwcc without_gcc=yes ! OPT="-O -export pragma" LDFLAGS="$LDFLAGS -nodup" ;; *************** *** 3108,3111 **** --- 3108,3116 ---- # Other platforms follow if test $enable_shared = "yes"; then + + cat >>confdefs.h <<\_ACEOF + #define Py_ENABLE_SHARED 1 + _ACEOF + case $ac_sys_system in BeOS*) *************** *** 8821,8825 **** *) CCSHARED="";; esac;; - CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";; atheos*) CCSHARED="-fPIC";; esac --- 8826,8829 ---- Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** pyconfig.h.in 14 Jun 2002 20:30:30 -0000 1.42 --- pyconfig.h.in 19 Jul 2002 06:55:40 -0000 1.43 *************** *** 12,19 **** #undef BAD_EXEC_PROTOTYPES - /* Define if your compiler botches static forward declarations (as it does on - SCI ODT 3.0) */ - #undef BAD_STATIC_FORWARD - /* Define this if you have BeOS threads. */ #undef BEOS_THREADS --- 12,15 ---- *************** *** 129,135 **** #undef HAVE_GAI_STRERROR - /* Define to 1 if you have the header file. */ - #undef HAVE_GDBM_NDBM_H - /* Define if you have the getaddrinfo function. */ #undef HAVE_GETADDRINFO --- 125,128 ---- *************** *** 273,279 **** #undef HAVE_NCURSES_H - /* Define to 1 if you have the header file. */ - #undef HAVE_NDBM_H - /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H --- 266,269 ---- *************** *** 354,360 **** #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 --- 344,347 ---- *************** *** 627,630 **** --- 614,620 ---- #undef Py_DEBUG + /* Defined if Python is built as a shared library. */ + #undef Py_ENABLE_SHARED + /* Define as the size of the unicode type. */ #undef Py_UNICODE_SIZE *************** *** 639,642 **** --- 629,635 ---- #undef SETPGRP_HAVE_ARG + /* Define to 1 if the `setpgrp' function takes no argument. */ + #undef SETPGRP_VOID + /* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS *************** *** 713,719 **** #undef WINDOW_HAS_FLAGS - /* Define if you want to compile in cycle garbage collection. */ - #undef WITH_CYCLE_GC - /* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry --- 706,709 ---- *************** *** 783,786 **** --- 773,779 ---- /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT + + /* Needed on Tru64 and does no harm on Linux */ + #undef _XOPEN_SOURCE /* Define to 1 if type `char' is unsigned and you are not using gcc. */ Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.332 retrieving revision 1.333 diff -C2 -d -r1.332 -r1.333 *** configure.in 19 Jul 2002 06:31:24 -0000 1.332 --- configure.in 19 Jul 2002 06:55:40 -0000 1.333 *************** *** 126,131 **** CC=mwcc without_gcc=yes ! OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma" ! CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'" LDFLAGS="$LDFLAGS -nodup" ;; --- 126,130 ---- CC=mwcc without_gcc=yes ! OPT="-O -export pragma" LDFLAGS="$LDFLAGS -nodup" ;; *************** *** 360,363 **** --- 359,363 ---- # Other platforms follow if test $enable_shared = "yes"; then + AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.]) case $ac_sys_system in BeOS*) *************** *** 949,953 **** *) CCSHARED="";; esac;; - CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";; atheos*) CCSHARED="-fPIC";; esac --- 949,952 ---- Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** Makefile.pre.in 17 Jul 2002 15:55:09 -0000 1.87 --- Makefile.pre.in 19 Jul 2002 06:55:40 -0000 1.88 *************** *** 66,70 **** CFLAGSFORSHARED=@CFLAGSFORSHARED@ # C flags used for building the interpreter object files ! PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) --- 66,70 ---- CFLAGSFORSHARED=@CFLAGSFORSHARED@ # C flags used for building the interpreter object files ! PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE *************** *** 421,428 **** Python/getplatform.o: $(srcdir)/Python/getplatform.c ! $(CC) -c $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c Python/importdl.o: $(srcdir)/Python/importdl.c ! $(CC) -c $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \ --- 421,428 ---- Python/getplatform.o: $(srcdir)/Python/getplatform.c ! $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c Python/importdl.o: $(srcdir)/Python/importdl.c ! $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \ From mhammond@users.sourceforge.net Fri Jul 19 07:55:43 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:55:43 -0700 Subject: [Python-checkins] python/dist/src/Include pyport.h,2.51,2.52 import.h,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv15103/Include Modified Files: pyport.h import.h Log Message: Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** pyport.h 3 Jul 2002 03:31:20 -0000 2.51 --- pyport.h 19 Jul 2002 06:55:40 -0000 2.52 *************** *** 380,396 **** #endif ! #ifndef __CYGWIN__ ! #ifndef DL_IMPORT /* declarations for DLL import */ ! #define DL_IMPORT(RTYPE) RTYPE #endif ! #else /* __CYGWIN__ */ ! #ifdef USE_DL_IMPORT ! #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE ! #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE ! #else /* !USE_DL_IMPORT */ ! #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE ! #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE ! #endif /* USE_DL_IMPORT */ ! #endif /* __CYGWIN__ */ /* If the fd manipulation macros aren't defined, --- 380,459 ---- #endif ! /* Declarations for symbol visibility. ! ! PyAPI_FUNC(type): Declares a public Python API function and return type ! PyAPI_DATA(type): Declares public Python data and its type ! PyMODINIT_FUNC: A Python module init function. If these functions are ! inside the Python core, they are private to the core. ! If in an extension module, it may be declared with ! external linkage depending on the platform. ! ! As a number of platforms support/require "__declspec(dllimport/dllexport)", ! we support a HAVE_DECLSPEC_DLL macro to save duplication. ! */ ! ! /* ! All windows ports, except cygwin, are handled in PC/pyconfig.h ! BeOS is only other autoconf platform requiring special linkage handling ! and both these use __declspec() ! */ ! #if defined(__CYGWIN__) || defined(__BEOS__) ! # define HAVE_DECLSPEC_DLL #endif ! ! #if defined(Py_ENABLE_SHARED) /* only get special linkage if built as shared */ ! # if defined(HAVE_DECLSPEC_DLL) ! # ifdef Py_BUILD_CORE ! # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE ! # define PyAPI_DATA(RTYPE) __declspec(dllexport) RTYPE ! /* module init functions inside the core need no external linkage */ ! # define PyMODINIT_FUNC void ! # else /* Py_BUILD_CORE */ ! /* Building an extension module, or an embedded situation */ ! /* public Python functions and data are imported */ ! # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE ! # define PyAPI_DATA(RTYPE) __declspec(dllimport) RTYPE ! /* module init functions outside the core must be exported */ ! # if defined(__cplusplus) ! # define PyMODINIT_FUNC extern "C" __declspec(dllexport) void ! # else /* __cplusplus */ ! # define PyMODINIT_FUNC __declspec(dllexport) void ! # endif /* __cplusplus */ ! # endif /* Py_BUILD_CORE */ ! # endif /* HAVE_DECLSPEC */ ! #endif /* Py_ENABLE_SHARED */ ! ! /* If no external linkage macros defined by now, create defaults */ ! #ifndef PyAPI_FUNC ! # define PyAPI_FUNC(RTYPE) RTYPE ! #endif ! #ifndef PyAPI_DATA ! # define PyAPI_DATA(RTYPE) RTYPE ! #endif ! #ifndef PyMODINIT_FUNC ! # if defined(__cplusplus) ! # define PyMODINIT_FUNC extern "C" void ! # else /* __cplusplus */ ! # define PyMODINIT_FUNC void ! # endif /* __cplusplus */ ! #endif ! ! /* Deprecated DL_IMPORT and DL_EXPORT macros */ ! #if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL) ! # if defined(Py_BUILD_CORE) ! # define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE ! # define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE ! # else ! # define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE ! # define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE ! # endif ! #endif ! #ifndef DL_EXPORT ! # define DL_EXPORT(RTYPE) RTYPE ! #endif ! #ifndef DL_IMPORT ! # define DL_IMPORT(RTYPE) RTYPE ! #endif ! /* End of deprecated DL_* macros */ /* If the fd manipulation macros aren't defined, *************** *** 457,469 **** */ #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." - #endif - - /* - * Rename some functions for the Borland compiler - */ - #ifdef __BORLANDC__ - # include - # define _chsize chsize - # define _setmode setmode #endif --- 520,523 ---- Index: import.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/import.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** import.h 1 Sep 2000 23:29:26 -0000 2.27 --- import.h 19 Jul 2002 06:55:41 -0000 2.28 *************** *** 8,27 **** #endif ! DL_IMPORT(long) PyImport_GetMagicNumber(void); ! DL_IMPORT(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co); ! DL_IMPORT(PyObject *) PyImport_ExecCodeModuleEx( char *name, PyObject *co, char *pathname); ! DL_IMPORT(PyObject *) PyImport_GetModuleDict(void); ! DL_IMPORT(PyObject *) PyImport_AddModule(char *name); ! DL_IMPORT(PyObject *) PyImport_ImportModule(char *name); ! DL_IMPORT(PyObject *) PyImport_ImportModuleEx( char *name, PyObject *globals, PyObject *locals, PyObject *fromlist); ! DL_IMPORT(PyObject *) PyImport_Import(PyObject *name); ! DL_IMPORT(PyObject *) PyImport_ReloadModule(PyObject *m); ! DL_IMPORT(void) PyImport_Cleanup(void); ! DL_IMPORT(int) PyImport_ImportFrozenModule(char *); ! extern DL_IMPORT(PyObject *)_PyImport_FindExtension(char *, char *); ! extern DL_IMPORT(PyObject *)_PyImport_FixupExtension(char *, char *); struct _inittab { --- 8,27 ---- #endif ! PyAPI_FUNC(long) PyImport_GetMagicNumber(void); ! PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co); ! PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( char *name, PyObject *co, char *pathname); ! PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); ! PyAPI_FUNC(PyObject *) PyImport_AddModule(char *name); ! PyAPI_FUNC(PyObject *) PyImport_ImportModule(char *name); ! PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx( char *name, PyObject *globals, PyObject *locals, PyObject *fromlist); ! PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); ! PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); ! PyAPI_FUNC(void) PyImport_Cleanup(void); ! PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); ! extern PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); ! extern PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); struct _inittab { *************** *** 30,37 **** }; ! extern DL_IMPORT(struct _inittab *) PyImport_Inittab; ! extern DL_IMPORT(int) PyImport_AppendInittab(char *name, void (*initfunc)(void)); ! extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab); struct _frozen { --- 30,37 ---- }; ! extern PyAPI_DATA(struct _inittab *) PyImport_Inittab; ! extern PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void)); ! extern PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); struct _frozen { *************** *** 44,48 **** collection of frozen modules: */ ! extern DL_IMPORT(struct _frozen *) PyImport_FrozenModules; #ifdef __cplusplus --- 44,48 ---- collection of frozen modules: */ ! extern PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; #ifdef __cplusplus From mhammond@users.sourceforge.net Fri Jul 19 07:55:43 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 18 Jul 2002 23:55:43 -0700 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.13,1.14 _winreg.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv15103/PC Modified Files: pyconfig.h _winreg.c Log Message: Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pyconfig.h 17 Jul 2002 15:32:40 -0000 1.13 --- pyconfig.h 19 Jul 2002 06:55:41 -0000 1.14 *************** *** 15,22 **** MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs) MS_WINDOWS - Code specific to Windows, but all versions. ! MS_COREDLL - Code if the Python core is built as a DLL. ! ! Note that the old defines "NT" and "WIN32" are still supported, but ! will soon be dropped. Also note that neither "_M_IX86" or "_MSC_VER" should be used for --- 15,19 ---- MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs) MS_WINDOWS - Code specific to Windows, but all versions. ! Py_ENABLE_SHARED - Code if the Python core is built as a DLL. Also note that neither "_M_IX86" or "_MSC_VER" should be used for *************** *** 24,35 **** compiler specific". Therefore, these should be very rare. - */ - /* - Some systems require special declarations for data items imported - or exported from dynamic link libraries. Note that the definition - of DL_IMPORT covers both cases. Define USE_DL_IMPORT for the client - of a DLL. Define USE_DL_EXPORT when making a DLL. */ --- 21,29 ---- compiler specific". Therefore, these should be very rare. + NOTE: The following symbols are deprecated: + NT, WIN32, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT + MS_CORE_DLL. */ *************** *** 41,50 **** --- 35,62 ---- #define HAVE_TMPFILE #define HAVE_TMPNAM + #define HAVE_CLOCK + #define HAVE_STRFTIME + #define HAVE_STRERROR #define DONT_HAVE_SIG_ALARM #define DONT_HAVE_SIG_PAUSE #define LONG_BIT 32 + #define WORD_BIT 32 #define PREFIX "" #define EXEC_PREFIX "" + #define MS_WIN32 /* only support win32 and greater. */ + #define MS_WINDOWS + #ifndef PYTHONPATH + # define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk" + #endif + #define NT_THREADS + #define WITH_THREAD + #ifndef NETSCAPE_PI + #define USE_SOCKET + #endif + + /* Compiler specific defines */ + + /* ------------------------------------------------------------------------*/ /* Microsoft C defines _MSC_VER */ #ifdef _MSC_VER *************** *** 61,69 **** #define MS_WIN64 #endif - #ifdef _WIN32 - #define NT /* NT is obsolete - please use MS_WIN32 instead */ - #define MS_WIN32 - #endif - #define MS_WINDOWS /* set the COMPILER */ --- 73,76 ---- *************** *** 88,184 **** #endif /* MS_WIN32 && !MS_WIN64 */ - #endif /* _MSC_VER */ - - #if defined(_MSC_VER) && _MSC_VER > 850 - /* Start of defines for MS_WIN32 using VC++ 2.0 and up */ - - /* For NT the Python core is in a DLL by default. Test the - standard macro MS_COREDLL to find out. If you have an exception - you must define MS_NO_COREDLL (do not test this macro) */ - #ifndef MS_NO_COREDLL - #define MS_COREDLL /* Python core is in a DLL */ - #ifndef USE_DL_EXPORT - #define USE_DL_IMPORT - #endif /* !USE_DL_EXPORT */ - #endif /* !MS_NO_COREDLL */ - - #define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk" typedef int pid_t; - #define WORD_BIT 32 - #pragma warning(disable:4113) #define hypot _hypot - #include - #define HAVE_CLOCK - #define HAVE_STRFTIME - #define HAVE_STRERROR - #define NT_THREADS - #define WITH_THREAD - #ifndef NETSCAPE_PI - #define USE_SOCKET - #endif - #ifdef USE_DL_IMPORT - #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE - #endif - #ifdef USE_DL_EXPORT - #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE - #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE - #endif ! #define HAVE_LONG_LONG 1 ! #define LONG_LONG __int64 ! #endif /* _MSC_VER && > 850 */ /* The Borland compiler defines __BORLANDC__ */ /* XXX These defines are likely incomplete, but should be easy to fix. */ #ifdef __BORLANDC__ #define COMPILER "[Borland]" - #define HAVE_CLOCK - #define HAVE_STRFTIME #ifdef _WIN32 - /* tested with BCC 5.5 (__BORLANDC__ >= 0x0550) */ - #define NT /* NT is obsolete - please use MS_WIN32 instead */ - #define MS_WIN32 - #define MS_WINDOWS - - /* For NT the Python core is in a DLL by default. Test the - standard macro MS_COREDLL to find out. If you have an exception - you must define MS_NO_COREDLL (do not test this macro) */ - #ifndef MS_NO_COREDLL - #define MS_COREDLL /* Python core is in a DLL */ - #ifndef USE_DL_EXPORT - #define USE_DL_IMPORT - #endif /* !USE_DL_EXPORT */ - #endif /* !MS_NO_COREDLL */ - #define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk" typedef int pid_t; - #define WORD_BIT 32 - #include - #define HAVE_STRERROR - #define NT_THREADS - #define WITH_THREAD - #ifndef NETSCAPE_PI - #define USE_SOCKET - #endif /* BCC55 seems to understand __declspec(dllimport), it is used in its ! own header files (winnt.h, ...) */ ! #ifdef USE_DL_IMPORT ! #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE ! #endif ! #ifdef USE_DL_EXPORT ! #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE ! #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE ! #endif ! ! #define HAVE_LONG_LONG 1 ! #define LONG_LONG __int64 #undef HAVE_SYS_UTIME_H #define HAVE_UTIME_H #define HAVE_DIRENT_H ! #define HAVE_CLOCK #else /* !_WIN32 */ --- 95,131 ---- #endif /* MS_WIN32 && !MS_WIN64 */ typedef int pid_t; #define hypot _hypot ! #endif /* _MSC_VER */ ! ! /* define some ANSI types that are not defined in earlier Win headers */ ! #if defined(_MSC_VER) && _MSC_VER >= 1200 ! /* This file only exists in VC 6.0 or higher */ ! #include ! #endif + /* ------------------------------------------------------------------------*/ /* The Borland compiler defines __BORLANDC__ */ /* XXX These defines are likely incomplete, but should be easy to fix. */ #ifdef __BORLANDC__ #define COMPILER "[Borland]" #ifdef _WIN32 /* tested with BCC 5.5 (__BORLANDC__ >= 0x0550) */ typedef int pid_t; /* BCC55 seems to understand __declspec(dllimport), it is used in its ! own header files (winnt.h, ...) - so we can do nothing and get the default*/ #undef HAVE_SYS_UTIME_H #define HAVE_UTIME_H #define HAVE_DIRENT_H ! ! /* rename a few functions for the Borland compiler */ ! #include ! #define _chsize chsize ! #define _setmode setmode #else /* !_WIN32 */ *************** *** 188,191 **** --- 135,139 ---- #endif /* BORLANDC */ + /* ------------------------------------------------------------------------*/ /* egcs/gnu-win32 defines __GNUC__ and _WIN32 */ #if defined(__GNUC__) && defined(_WIN32) *************** *** 200,294 **** #endif - #define NT /* NT is obsolete - please use MS_WIN32 instead */ - #define MS_WIN32 - #define MS_WINDOWS - - /* For NT the Python core is in a DLL by default. Test the - standard macro MS_COREDLL to find out. If you have an exception - you must define MS_NO_COREDLL (do not test this macro) */ - #ifndef MS_NO_COREDLL - #define MS_COREDLL /* Python core is in a DLL */ - #ifndef USE_DL_EXPORT - #define USE_DL_IMPORT - #endif /* !USE_DL_EXPORT */ - #endif /* !MS_NO_COREDLL */ - #define COMPILER "[gcc]" - #define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk" - #define WORD_BIT 32 #define hypot _hypot - #include - #define HAVE_CLOCK - #define HAVE_STRFTIME - #define HAVE_STRERROR - #define NT_THREADS - #define WITH_THREAD - #ifndef NETSCAPE_PI - #define USE_SOCKET - #endif - #ifdef USE_DL_IMPORT - #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE - #endif - #ifdef USE_DL_EXPORT - #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE - #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE - #endif - - #define HAVE_LONG_LONG 1 #define LONG_LONG long long #endif /* GNUC */ /* lcc-win32 defines __LCC__ */ - #if defined(__LCC__) /* XXX These defines are likely incomplete, but should be easy to fix. They should be complete enough to build extension modules. */ - #define NT /* NT is obsolete - please use MS_WIN32 instead */ - #define MS_WIN32 - #define MS_WINDOWS - - /* For NT the Python core is in a DLL by default. Test the - standard macro MS_COREDLL to find out. If you have an exception - you must define MS_NO_COREDLL (do not test this macro) */ - #ifndef MS_NO_COREDLL - #define MS_COREDLL /* Python core is in a DLL */ - #ifndef USE_DL_EXPORT - #define USE_DL_IMPORT - #endif /* !USE_DL_EXPORT */ - #endif /* !MS_NO_COREDLL */ - #define COMPILER "[lcc-win32]" - #define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk" typedef int pid_t; ! #define WORD_BIT 32 ! #include ! #define HAVE_CLOCK ! #define HAVE_STRFTIME ! #define HAVE_STRERROR ! #define NT_THREADS ! #define WITH_THREAD ! #ifndef NETSCAPE_PI ! #define USE_SOCKET ! #endif ! #ifdef USE_DL_IMPORT ! #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE ! #endif ! #ifdef USE_DL_EXPORT ! #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE ! #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE ! #endif - #define HAVE_LONG_LONG 1 - #define LONG_LONG __int64 #endif /* LCC */ /* End of compilers - finish up */ ! /* define some ANSI types that are not defined in earlier Win headers */ ! #if _MSC_VER >= 1200 /* This file only exists in VC 6.0 or higher */ ! #include #endif #if defined(MS_WIN64) /* maintain "win32" sys.platform for backward compatibility of Python code, --- 148,212 ---- #endif #define COMPILER "[gcc]" #define hypot _hypot #define LONG_LONG long long #endif /* GNUC */ + /* ------------------------------------------------------------------------*/ /* lcc-win32 defines __LCC__ */ #if defined(__LCC__) /* XXX These defines are likely incomplete, but should be easy to fix. They should be complete enough to build extension modules. */ #define COMPILER "[lcc-win32]" typedef int pid_t; ! /* __declspec() is supported here too - do nothing to get the defaults */ #endif /* LCC */ + /* ------------------------------------------------------------------------*/ /* End of compilers - finish up */ ! #ifndef NO_STDIO_H ! # include ! #endif ! ! /* 64 bit ints are usually spelt __int64 unless compiler has overridden */ ! #define HAVE_LONG_LONG 1 ! #ifndef LONG_LONG ! # define LONG_LONG __int64 #endif + /* For Windows the Python core is in a DLL by default. Test + Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ + #if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED) + # define Py_ENABLE_SHARED 1 /* standard symbol for shared library */ + # define MS_COREDLL /* deprecated old symbol */ + #endif /* !MS_NO_COREDLL && ... */ + + /* Deprecated USE_DL_EXPORT macro - please use Py_BUILD_CORE */ + #ifdef USE_DL_EXPORT + # define Py_BUILD_CORE + #endif /* USE_DL_EXPORT */ + + /* All windows compilers that use this header support __declspec */ + #define HAVE_DECLSPEC_DLL + + /* For an MSVC DLL, we can nominate the .lib files used by extensions */ + #ifdef MS_COREDLL + # ifndef Py_BUILD_CORE /* not building the core - must be an ext */ + # if defined(_MSC_VER) + /* So MSVC users need not specify the .lib file in + their Makefile (other compilers are generally + taken care of by distutils.) */ + # ifdef _DEBUG + # pragma comment(lib,"python23_d.lib") + # else + # pragma comment(lib,"python23.lib") + # endif /* _DEBUG */ + # endif /* _MSC_VER */ + # endif /* Py_BUILD_CORE */ + #endif /* MS_COREDLL */ + #if defined(MS_WIN64) /* maintain "win32" sys.platform for backward compatibility of Python code, *************** *** 322,342 **** #endif - - #ifdef MS_WIN32 - - #if !defined(USE_DL_EXPORT) && defined(_MSC_VER) - /* So nobody using MSVC needs to specify the .lib in their Makefile any - more (other compilers will still need to do so, but that's taken care - of by the Distutils, so it's not a problem). */ #ifdef _DEBUG ! #pragma comment(lib,"python23_d.lib") ! #else ! #pragma comment(lib,"python23.lib") #endif - #endif /* USE_DL_EXPORT */ ! #ifdef _DEBUG ! #define Py_DEBUG ! #endif #define SIZEOF_SHORT 2 --- 240,249 ---- #endif #ifdef _DEBUG ! # define Py_DEBUG #endif ! ! #ifdef MS_WIN32 #define SIZEOF_SHORT 2 Index: _winreg.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/_winreg.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _winreg.c 13 Jun 2002 20:33:01 -0000 1.10 --- _winreg.c 19 Jul 2002 06:55:41 -0000 1.11 *************** *** 1424,1428 **** #define ADD_KEY(val) inskey(d, #val, val) ! __declspec(dllexport) void init_winreg(void) { PyObject *m, *d; --- 1424,1428 ---- #define ADD_KEY(val) inskey(d, #val, val) ! PyMODINIT_FUNC init_winreg(void) { PyObject *m, *d; From tim_one@users.sourceforge.net Fri Jul 19 08:05:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 19 Jul 2002 00:05:46 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.126,2.127 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15855/python/Objects Modified Files: listobject.c Log Message: More sort cleanup: Moved the special cases from samplesortslice into listsort. If the former calls itself recursively, they're a waste of time, since it's called on a random permutation of a random subset of elements. OTOH, for exactly the same reason, they're an immeasurably small waste of time (the odds of finding exploitable order in a random permutation are ~= 0, so the special-case loops looking for order give up quickly). The point is more for conceptual clarity. Also changed some "assert comments" into real asserts; when this code was first written, Python.h didn't supply assert.h. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -d -r2.126 -r2.127 *** listobject.c 19 Jul 2002 06:12:32 -0000 2.126 --- listobject.c 19 Jul 2002 07:05:44 -0000 2.127 *************** *** 1006,1046 **** struct SamplesortStackNode stack[STACKSIZE]; ! /* assert lo <= hi */ n = hi - lo; ! ! /* ---------------------------------------------------------- ! * Special cases ! * --------------------------------------------------------*/ ! if (n < 2) ! return 0; ! ! /* Set r to the largest value such that [lo,r) is sorted. ! This catches the already-sorted case, the all-the-same ! case, and the appended-a-few-elements-to-a-sorted-list case. ! If the array is unsorted, we're very likely to get out of ! the loop fast, so the test is cheap if it doesn't pay off. ! */ ! /* assert lo < hi */ ! for (r = lo+1; r < hi; ++r) { ! IFLT(*r, *(r-1)) ! break; ! } ! /* [lo,r) is sorted, [r,hi) unknown. Get out cheap if there are ! few unknowns, or few elements in total. */ ! if (hi - r <= MAXMERGE || n < MINSIZE) ! return binarysort(lo, hi, r, compare); ! ! /* Check for the array already being reverse-sorted. Typical ! benchmark-driven silliness . */ ! /* assert lo < hi */ ! for (r = lo+1; r < hi; ++r) { ! IFLT(*(r-1), *r) ! break; ! } ! if (hi - r <= MAXMERGE) { ! /* Reverse the reversed prefix, then insert the tail */ ! reverse_slice(lo, r); ! return binarysort(lo, hi, r, compare); ! } /* ---------------------------------------------------------- --- 1006,1013 ---- struct SamplesortStackNode stack[STACKSIZE]; ! assert(lo <= hi); n = hi - lo; ! if (n < MINSIZE) ! return binarysort(lo, hi, lo, compare); /* ---------------------------------------------------------- *************** *** 1094,1098 **** * --------------------------------------------------------*/ for (;;) { ! /* assert lo <= hi, so n >= 0 */ n = hi - lo; --- 1061,1065 ---- * --------------------------------------------------------*/ for (;;) { ! assert(lo <= hi); n = hi - lo; *************** *** 1104,1109 **** if (n < MINPARTITIONSIZE || extra == 0) { if (n >= MINSIZE) { ! /* assert extra == 0 ! This is rare, since the average size of a final block is only about ln(original n). */ --- 1071,1076 ---- if (n < MINPARTITIONSIZE || extra == 0) { if (n >= MINSIZE) { ! assert(extra == 0); ! /* This is rare, since the average size of a final block is only about ln(original n). */ *************** *** 1185,1189 **** l = lo + 1; r = hi - 1; ! /* assert lo < l < r < hi (small n weeded out above) */ do { --- 1152,1156 ---- l = lo + 1; r = hi - 1; ! assert(lo < l && l < r && r < hi); do { *************** *** 1209,1215 **** } while (l < r); ! /* assert lo < r <= l < hi ! assert r == l or r+1 == l ! everything to the left of l is < pivot, and everything to the right of r is >= pivot */ --- 1176,1181 ---- } while (l < r); ! assert(lo < r && r <= l && l < hi); ! /* everything to the left of l is < pivot, and everything to the right of r is >= pivot */ *************** *** 1220,1230 **** --r; } ! /* assert lo <= r and r+1 == l and l <= hi ! assert r == lo or a[r] < pivot ! assert a[lo] is pivot ! assert l == hi or a[l] >= pivot ! Swap the pivot into "the middle", so we can henceforth ! ignore it. ! */ *lo = *r; *r = pivot; --- 1186,1195 ---- --r; } ! assert(lo <= r && r+1 == l && l <= hi); ! /* assert r == lo or a[r] < pivot */ ! assert(*lo == pivot); ! /* assert l == hi or a[l] >= pivot */ ! /* Swap the pivot into "the middle", so we can henceforth ! ignore it. */ *lo = *r; *r = pivot; *************** *** 1251,1261 **** } ! /* assert lo <= r < l <= hi ! Partitions are [lo, r) and [l, hi) */ ! ! /* push fattest first; remember we still have extra PPs to the left of the left chunk and to the right of the right chunk! */ ! /* assert top < STACKSIZE */ if (r - lo <= hi - l) { /* second is bigger */ --- 1216,1225 ---- } ! assert(lo <= r && r < l && l <= hi); ! /* Partitions are [lo, r) and [l, hi) ! :ush fattest first; remember we still have extra PPs to the left of the left chunk and to the right of the right chunk! */ ! assert(top < STACKSIZE); if (r - lo <= hi - l) { /* second is bigger */ *************** *** 1284,1289 **** } - #undef IFLT - static PyTypeObject immutable_list_type; --- 1248,1251 ---- *************** *** 1291,1296 **** listsort(PyListObject *self, PyObject *args) { ! int err; PyObject *compare = NULL; PyTypeObject *savetype; --- 1253,1259 ---- listsort(PyListObject *self, PyObject *args) { ! int k; PyObject *compare = NULL; + PyObject **hi, **p; PyTypeObject *savetype; *************** *** 1299,1313 **** return NULL; } savetype = self->ob_type; self->ob_type = &immutable_list_type; ! err = samplesortslice(self->ob_item, ! self->ob_item + self->ob_size, ! compare); ! self->ob_type = savetype; ! if (err < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; } int --- 1262,1321 ---- return NULL; } + savetype = self->ob_type; + if (self->ob_size < 2) { + k = 0; + goto done; + } + self->ob_type = &immutable_list_type; ! hi = self->ob_item + self->ob_size; ! ! /* Set p to the largest value such that [lo, p) is sorted. ! This catches the already-sorted case, the all-the-same ! case, and the appended-a-few-elements-to-a-sorted-list case. ! If the array is unsorted, we're very likely to get out of ! the loop fast, so the test is cheap if it doesn't pay off. ! */ ! for (p = self->ob_item + 1; p < hi; ++p) { ! IFLT(*p, *(p-1)) ! break; ! } ! /* [lo, p) is sorted, [p, hi) unknown. Get out cheap if there are ! few unknowns, or few elements in total. */ ! if (hi - p <= MAXMERGE || self->ob_size < MINSIZE) { ! k = binarysort(self->ob_item, hi, p, compare); ! goto done; ! } ! ! /* Check for the array already being reverse-sorted, or that with ! a few elements tacked on to the end. */ ! for (p = self->ob_item + 1; p < hi; ++p) { ! IFLT(*(p-1), *p) ! break; ! } ! /* [lo, p) is reverse-sorted, [p, hi) unknown. */ ! if (hi - p <= MAXMERGE) { ! /* Reverse the reversed prefix, then insert the tail */ ! reverse_slice(self->ob_item, p); ! k = binarysort(self->ob_item, hi, p, compare); ! goto done; ! } ! ! /* A large array without obvious pattern. */ ! k = samplesortslice(self->ob_item, hi, compare); ! ! done: /* The IFLT macro requires a label named "fail". */; ! fail: ! self->ob_type = savetype; ! if (k >= 0) { ! Py_INCREF(Py_None); ! return Py_None; ! } ! else return NULL; } + + #undef IFLT int From gvanrossum@users.sourceforge.net Fri Jul 19 13:45:02 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 05:45:02 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.233,1.234 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17312 Modified Files: socketmodule.c Log Message: Bail out early from internal_select() when socket file descriptor closed. Prevents core dump. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.233 retrieving revision 1.234 diff -C2 -d -r1.233 -r1.234 *** socketmodule.c 18 Jul 2002 22:38:44 -0000 1.233 --- socketmodule.c 19 Jul 2002 12:44:59 -0000 1.234 *************** *** 506,510 **** --- 506,515 ---- struct timeval tv; + /* Nothing to do unless we're in timeout mode (not non-blocking) */ if (s->sock_timeout <= 0.0) + return; + + /* Guard against closed socket */ + if (s->sock_fd < 0) return; From gvanrossum@users.sourceforge.net Fri Jul 19 13:46:49 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 05:46:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17856 Modified Files: test_socket.py Log Message: Add test for previous core dump when sending on closed socket with timeout. Added small sleeps to _testAccept() and _testRecv() in NonBlockingTCPTests, to reduce race conditions (I know, this is not the solution!) Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_socket.py 18 Jul 2002 17:08:35 -0000 1.40 --- test_socket.py 19 Jul 2002 12:46:46 -0000 1.41 *************** *** 326,330 **** self.assertRaises(TypeError, socket.setdefaulttimeout, "spam") ! # XXX The following three don't test module-level functionality... def testSockName(self): --- 326,330 ---- self.assertRaises(TypeError, socket.setdefaulttimeout, "spam") ! # XXX The following don't test module-level functionality... def testSockName(self): *************** *** 349,352 **** --- 349,359 ---- self.failIf(reuse == 0, "failed to set reuse mode") + def testSendAfterClose(self): + """testing send() after close() with timeout.""" + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.settimeout(1) + sock.close() + self.assertRaises(socket.error, sock.send, "spam") + class BasicTCPTest(SocketConnectedTest): *************** *** 487,490 **** --- 494,498 ---- def _testAccept(self): + time.sleep(0.1) self.cli.connect((HOST, PORT)) *************** *** 516,519 **** --- 524,528 ---- def _testRecv(self): self.cli.connect((HOST, PORT)) + time.sleep(0.1) self.cli.send(MSG) From mwh@users.sourceforge.net Fri Jul 19 16:48:58 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 19 Jul 2002 08:48:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv495/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Substantially flesh out extended slice section. I think this is probably done now. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** whatsnew23.tex 12 Jul 2002 20:24:42 -0000 1.35 --- whatsnew23.tex 19 Jul 2002 15:48:56 -0000 1.36 *************** *** 371,375 **** --- 371,458 ---- \end{verbatim} + as well as tuples and arrays. + + If you have a mutable sequence (i.e. a list or an array) you can + assign to or delete an extended slice, but there are some differences + in assignment to extended and regular slices. Assignment to a regular + slice can be used to change the length of the sequence: + + \begin{verbatim} + >>> a = range(3) + >>> a + [0, 1, 2] + >>> a[1:3] = [4, 5, 6] + >>> a + [0, 4, 5, 6] + \end{verbatim} + + but when assigning to an extended slice the list on the right hand + side of the statement must contain the same number of items as the + slice it is replacing: + + \begin{verbatim} + >>> a = range(4) + >>> a + [0, 1, 2, 3] + >>> a[::2] + [0, 2] + >>> a[::2] = range(0, -2, -1) + >>> a + [0, 1, -1, 3] + >>> a[::2] = range(3) + Traceback (most recent call last): + File "", line 1, in ? + ValueError: attempt to assign list of size 3 to extended slice of size 2 + \end{verbatim} + Deletion is more straightforward: + + \begin{verbatim} + >>> a = range(4) + >>> a[::2] + [0, 2] + >>> del a[::2] + >>> a + [1, 3] + \end{verbatim} + + One can also now pass slice objects to builtin sequences + \method{__getitem__} methods: + + \begin{verbatim} + >>> range(10).__getitem__(slice(0, 5, 2)) + [0, 2, 4] + \end{verbatim} + + or use them directly in subscripts: + + \begin{verbatim} + >>> range(10)[slice(0, 5, 2)] + [0, 2, 4] + \end{verbatim} + + To make implementing sequences that support extended slicing in Python + easier, slice ojects now have a method \method{indices} which given + the length of a sequence returns \code{(start, stop, step)} handling + omitted and out-of-bounds indices in a manner consistent with regular + slices (and this innocuous phrase hides a welter of confusing + details!). The method is intended to be used like this: + + \begin{verbatim} + class FakeSeq: + ... + def calc_item(self, i): + ... + def __getitem__(self, item): + if isinstance(item, slice): + return FakeSeq([self.calc_item(i) + in range(*item.indices(len(self)))]) + else: + return self.calc_item(i) + \end{verbatim} + + From this example you can also see that the builtin ``\var{slice}'' + object is now the type of slice objects, not a function (so is now + consistent with \var{int}, \var{str}, etc from 2.2). %====================================================================== From mwh@users.sourceforge.net Fri Jul 19 16:52:40 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 19 Jul 2002 08:52:40 -0700 Subject: [Python-checkins] python/dist/src/Objects sliceobject.c,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2465/Objects Modified Files: sliceobject.c Log Message: Silly typo. Not sure how that got in. Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** sliceobject.c 19 Jul 2002 15:47:06 -0000 2.16 --- sliceobject.c 19 Jul 2002 15:52:38 -0000 2.17 *************** *** 250,254 **** static PyMethodDef slice_methods[] = { ! {"indices", (PyCFuntion)slice_indices, METH_O, slice_indices_doc}, {NULL, NULL} --- 250,254 ---- static PyMethodDef slice_methods[] = { ! {"indices", (PyCFunction)slice_indices, METH_O, slice_indices_doc}, {NULL, NULL} From mwh@users.sourceforge.net Fri Jul 19 16:47:08 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 19 Jul 2002 08:47:08 -0700 Subject: [Python-checkins] python/dist/src/Objects sliceobject.c,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31521/Objects Modified Files: sliceobject.c Log Message: A few days ago, Guido said (in the thread "[Python-Dev] Python version of PySlice_GetIndicesEx"): > OK. Michael, if you want to check in indices(), go ahead. Then I did what was needed, but didn't check it in. Here it is. Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** sliceobject.c 14 Jun 2002 20:41:15 -0000 2.15 --- sliceobject.c 19 Jul 2002 15:47:06 -0000 2.16 *************** *** 222,225 **** --- 222,258 ---- }; + static PyObject* + slice_indices(PySliceObject* self, PyObject* len) + { + int ilen, start, stop, step, slicelength; + + ilen = PyInt_AsLong(len); + + if (ilen == -1 && PyErr_Occurred()) { + return NULL; + } + + if (PySlice_GetIndicesEx(self, ilen, &start, &stop, + &step, &slicelength) < 0) { + return NULL; + } + + return Py_BuildValue("(lll)", start, stop, step); + } + + PyDoc_STRVAR(slice_indices_doc, + "S.indices(len) -> (start, stop, stride)\n\ + \n\ + Assuming a sequence of length len, calculate the start and stop\n\ + indices, and the stride length of the extended slice described by\n\ + S. Out of bounds indices are clipped in a manner consistent with the\n\ + handling of normal slices."); + + static PyMethodDef slice_methods[] = { + {"indices", (PyCFuntion)slice_indices, + METH_O, slice_indices_doc}, + {NULL, NULL} + }; + static int slice_compare(PySliceObject *v, PySliceObject *w) *************** *** 272,276 **** 0, /* tp_iter */ 0, /* tp_iternext */ ! 0, /* tp_methods */ slice_members, /* tp_members */ 0, /* tp_getset */ --- 305,309 ---- 0, /* tp_iter */ 0, /* tp_iternext */ ! slice_methods, /* tp_methods */ slice_members, /* tp_members */ 0, /* tp_getset */ From mwh@users.sourceforge.net Fri Jul 19 16:47:09 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 19 Jul 2002 08:47:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_slice.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31521/Lib/test Added Files: test_slice.py Log Message: A few days ago, Guido said (in the thread "[Python-Dev] Python version of PySlice_GetIndicesEx"): > OK. Michael, if you want to check in indices(), go ahead. Then I did what was needed, but didn't check it in. Here it is. --- NEW FILE: test_slice.py --- # tests for slice objects; in particular the indices method. from test_support import vereq vereq(slice(None ).indices(10), (0, 10, 1)) vereq(slice(None, None, 2).indices(10), (0, 10, 2)) vereq(slice(1, None, 2).indices(10), (1, 10, 2)) vereq(slice(None, None, -1).indices(10), (9, -1, -1)) vereq(slice(None, None, -2).indices(10), (9, -1, -2)) vereq(slice(3, None, -2).indices(10), (3, -1, -2)) vereq(slice(-100, 100 ).indices(10), slice(None).indices(10)) vereq(slice(100, -100, -1).indices(10), slice(None, None, -1).indices(10)) vereq(slice(-100L, 100L, 2L).indices(10), (0, 10, 2)) From mwh@users.sourceforge.net Fri Jul 19 16:47:08 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 19 Jul 2002 08:47:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv31521/Doc/ref Modified Files: ref3.tex Log Message: A few days ago, Guido said (in the thread "[Python-Dev] Python version of PySlice_GetIndicesEx"): > OK. Michael, if you want to check in indices(), go ahead. Then I did what was needed, but didn't check it in. Here it is. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** ref3.tex 20 Jun 2002 06:12:37 -0000 1.92 --- ref3.tex 19 Jul 2002 15:47:06 -0000 1.93 *************** *** 893,896 **** --- 893,905 ---- \ttindex{step}} + Special method: \method{indices} takes an single integer argument + \var{length} and computes information about the extended slice that + the slice object would describe if applied to a sequence of + \var{length}. It returns a tuple of three integers; respectively + these are the \var{start} and \var{stop} indices and the \var{step} or + stride length of the slice. Missing or out-of-bounds indices are + handled in a manner consistent with regular slices. + \versionadded{2.3} + \end{description} % Internal types From gvanrossum@users.sourceforge.net Fri Jul 19 18:04:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 10:04:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,NONE,1.1 test_time.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2290/test Modified Files: test_time.py Added Files: test_strptime.py Log Message: Pure Python strptime implementation by Brett Cannon. See SF patch 474274. Also adds tests. --- NEW FILE: test_strptime.py --- """PyUnit testing against strptime >= 2.1.0.""" import sys sys.path.append('..') import unittest import time import locale import re import _strptime __version__ = (1,0,5) class LocaleTime_Tests(unittest.TestCase): """Contains all tests for _strptime.LocaleTime.""" def setUp(self): """Create time tuple based on current time.""" self.time_tuple = time.localtime() self.LT_ins = _strptime.LocaleTime() def compare_against_time(self, testing, directive, tuple_position, error_msg): """Helper method that tests testing against directive based on the tuple_position of time_tuple. Uses error_msg as error message. """ strftime_output = time.strftime(directive, self.time_tuple) comparison = testing[self.time_tuple[tuple_position]] self.failUnless(strftime_output in testing, "%s: not found in tuple" % error_msg) self.failUnless(comparison == strftime_output, "%s: position within tuple incorrect; %s != %s" % (error_msg, comparison, strftime_output)) def test_weekday(self): """Make sure that full and abbreviated weekday names are correct in both string and position with tuple. """ self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, "Testing of full weekday name failed") self.compare_against_time(self.LT_ins.a_weekday, '%a', 6, "Testing of abbreviated weekday name failed") def test_month(self): """Test full and abbreviated month names; both string and position within the tuple. """ self.compare_against_time(self.LT_ins.f_month, '%B', 1, "Testing against full month name failed") self.compare_against_time(self.LT_ins.a_month, '%b', 1, "Testing against abbreviated month name failed") def test_am_pm(self): """Make sure AM/PM representation done properly.""" strftime_output = time.strftime("%p", self.time_tuple) self.failUnless(strftime_output in self.LT_ins.am_pm, "AM/PM representation not in tuple") if self.time_tuple[3] < 12: position = 0 else: position = 1 self.failUnless(strftime_output == self.LT_ins.am_pm[position], "AM/PM representation in the wrong position within the tuple") def test_timezone(self): """Make sure timezone is correct.""" if time.strftime("%Z", self.time_tuple): self.compare_against_time(self.LT_ins.timezone, '%Z', 8, "Testing against timezone failed") def test_date_time(self): """Check that LC_date_time, LC_date, and LC_time are correct.""" strftime_output = time.strftime("%c", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, self.time_tuple), "LC_date_time incorrect") strftime_output = time.strftime("%x", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, self.time_tuple), "LC_date incorrect") strftime_output = time.strftime("%X", self.time_tuple) self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_time, self.time_tuple), "LC_time incorrect") def test_lang(self): """Make sure lang is set.""" self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], locale.getlocale(locale.LC_TIME)), "Setting of lang failed") def test_by_hand_input(self): """Test passed-in initialization value checks.""" self.failUnless(_strptime.LocaleTime(f_weekday=range(7)), "Argument size check for f_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(8)) self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(6)) self.failUnless(_strptime.LocaleTime(a_weekday=range(7)), "Argument size check for a_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, a_weekday=range(8)) self.assertRaises(TypeError, _strptime.LocaleTime, a_weekday=range(6)) self.failUnless(_strptime.LocaleTime(f_month=range(12)), "Argument size check for f_month failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_month=range(11)) self.assertRaises(TypeError, _strptime.LocaleTime, f_month=range(13)) self.failUnless(len(_strptime.LocaleTime(f_month=range(12)).f_month) == 13, "dummy value for f_month not added") self.failUnless(_strptime.LocaleTime(a_month=range(12)), "Argument size check for a_month failed") self.assertRaises(TypeError, _strptime.LocaleTime, a_month=range(11)) self.assertRaises(TypeError, _strptime.LocaleTime, a_month=range(13)) self.failUnless(len(_strptime.LocaleTime(a_month=range(12)).a_month) == 13, "dummy value for a_month not added") self.failUnless(_strptime.LocaleTime(am_pm=range(2)), "Argument size check for am_pm failed") self.assertRaises(TypeError, _strptime.LocaleTime, am_pm=range(1)) self.assertRaises(TypeError, _strptime.LocaleTime, am_pm=range(3)) self.failUnless(_strptime.LocaleTime(timezone=range(2)), "Argument size check for timezone failed") self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(1)) self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(3)) class TimeRETests(unittest.TestCase): """Tests for TimeRE.""" def setUp(self): """Construct generic TimeRE object.""" self.time_re = _strptime.TimeRE() self.locale_time = _strptime.LocaleTime() def test_getitem(self): """Make sure that __getitem__ works properly.""" self.failUnless(self.time_re['m'], "Fetching 'm' directive (built-in) failed") self.failUnless(self.time_re['b'], "Fetching 'b' directive (built w/ __tupleToRE) failed") for name in self.locale_time.a_month: self.failUnless(self.time_re['b'].find(name) != -1, "Not all abbreviated month names in regex") self.failUnless(self.time_re['c'], "Fetching 'c' directive (built w/ format) failed") self.failUnless(self.time_re['c'].find('%') == -1, "Conversion of 'c' directive failed; '%' found") self.assertRaises(KeyError, self.time_re.__getitem__, '1') def test_pattern(self): """Test TimeRE.pattern.""" pattern_string = self.time_re.pattern(r"%a %A %d") self.failUnless(pattern_string.find(self.locale_time.a_weekday[2]) != -1, "did not find abbreviated weekday in pattern string '%s'" % pattern_string) self.failUnless(pattern_string.find(self.locale_time.f_weekday[4]) != -1, "did not find full weekday in pattern string '%s'" % pattern_string) self.failUnless(pattern_string.find(self.time_re['d']) != -1, "did not find 'd' directive pattern string '%s'" % pattern_string) def test_compile(self): """Check that compiled regex is correct.""" found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) self.failUnless(found and found.group('A') == self.locale_time.f_weekday[6], "re object for '%A' failed") compiled = self.time_re.compile(r"%a %b") found = compiled.match("%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4])) self.failUnless(found, "Match failed with '%s' regex and '%s' string" % (compiled.pattern, "%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4]))) self.failUnless(found.group('a') == self.locale_time.a_weekday[4] and found.group('b') == self.locale_time.a_month[4], "re object couldn't find the abbreviated weekday month in '%s' using '%s'; group 'a' = '%s', group 'b' = %s'" % (found.string, found.re.pattern, found.group('a'), found.group('b'))) for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S','U','w','W','x','X','y','Y','Z','%'): compiled = self.time_re.compile("%%%s"% directive) found = compiled.match(time.strftime("%%%s" % directive)) self.failUnless(found, "Matching failed on '%s' using '%s' regex" % (time.strftime("%%%s" % directive), compiled.pattern)) class StrptimeTests(unittest.TestCase): """Tests for _strptime.strptime.""" def setUp(self): """Create testing time tuple.""" self.time_tuple = time.gmtime() def test_TypeError(self): """Make sure ValueError is raised when match fails.""" self.assertRaises(ValueError,_strptime.strptime, data_string="%d", format="%A") def test_returning_RE(self): """Make sure that an re can be returned.""" strp_output = _strptime.strptime(False, "%Y") self.failUnless(isinstance(strp_output, type(re.compile(''))), "re object not returned correctly") self.failUnless(_strptime.strptime("1999", strp_output), "Use or re object failed") bad_locale_time = _strptime.LocaleTime(lang="gibberish") self.assertRaises(TypeError, _strptime.strptime, data_string='1999', format=strp_output, locale_time=bad_locale_time) def helper(self, directive, position): """Helper fxn in testing.""" strf_output = time.strftime("%%%s" % directive, self.time_tuple) strp_output = _strptime.strptime(strf_output, "%%%s" % directive) self.failUnless(strp_output[position] == self.time_tuple[position], "testing of '%s' directive failed; '%s' -> %s != %s" % (directive, strf_output, strp_output[position], self.time_tuple[position])) def test_year(self): """Test that the year is handled properly.""" for directive in ('y', 'Y'): self.helper(directive, 0) def test_month(self): """Test for month directives.""" for directive in ('B', 'b', 'm'): self.helper(directive, 1) def test_day(self): """Test for day directives.""" self.helper('d', 2) def test_hour(self): """Test hour directives.""" self.helper('H', 3) strf_output = time.strftime("%I %p", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%I %p") self.failUnless(strp_output[3] == self.time_tuple[3], "testing of '%%I %%p' directive failed; '%s' -> %s != %s" % (strf_output, strp_output[3], self.time_tuple[3])) def test_minute(self): """Test minute directives.""" self.helper('M', 4) def test_second(self): """Test second directives.""" self.helper('S', 5) def test_weekday(self): """Test weekday directives.""" for directive in ('A', 'a', 'w'): self.helper(directive,6) def test_julian(self): """Test julian directives.""" self.helper('j', 7) def test_timezone(self): """Test timezone directives. When gmtime() is used with %Z, entire result of strftime() is empty. """ time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") self.failUnless(strp_output[8] == time_tuple[8], "timezone check failed; '%s' -> %s != %s" % (strf_output, strp_output[8], time_tuple[8])) def test_date_time(self): """*** Test %c directive. ***""" for position in range(6): self.helper('c', position) def test_date(self): """*** Test %x directive. ***""" for position in range(0,3): self.helper('x', position) def test_time(self): """*** Test %X directive. ***""" for position in range(3,6): self.helper('X', position) def test_percent(self): """Make sure % signs are handled properly.""" strf_output = time.strftime("%m %% %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%m %% %Y") self.failUnless(strp_output[0] == self.time_tuple[0] and strp_output[1] == self.time_tuple[1], "handling of percent sign failed") 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_julianday_trigger(self): """Make sure julianday is called.""" strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") self.failUnless(strp_output[7] == self.time_tuple[7], "strptime did not trigger julianday(); %s != %s" % (strp_output[7], 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_gregorian_trigger(self): """Test that gregorian() is triggered.""" strf_output = time.strftime("%j %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%j %Y") self.failUnless(strp_output[1] == self.time_tuple[1] and strp_output[2] == self.time_tuple[2], "gregorian() not triggered; month -- %s != %s, day -- %s != %s" % (strp_output[1], self.time_tuple[1], strp_output[2], self.time_tuple[2])) 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)) def test_dayofweek_trigger(self): """Make sure dayofweek() gets triggered.""" strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") self.failUnless(strp_output[6] == self.time_tuple[6], "triggering of dayofweek() failed; %s != %s" % (strp_output[6], self.time_tuple[6])) if __name__ == '__main__': unittest.main() Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_time.py 16 Apr 2002 12:37:55 -0000 1.9 --- test_time.py 19 Jul 2002 17:04:46 -0000 1.10 *************** *** 38,41 **** --- 38,53 ---- self.fail('conversion specifier: %r failed.' % format) + def test_strptime(self): + tt = time.gmtime(self.t) + for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', + 'j', 'm', 'M', 'p', 'S', + 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): + format = ' %' + directive + try: + time.strptime(time.strftime(format, tt), format) + except ValueError: + self.fail('conversion specifier: %r failed.' % format) + + def test_asctime(self): time.asctime(time.gmtime(self.t)) From gvanrossum@users.sourceforge.net Fri Jul 19 18:04:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 10:04:48 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2290 Added Files: _strptime.py Log Message: Pure Python strptime implementation by Brett Cannon. See SF patch 474274. Also adds tests. --- NEW FILE: _strptime.py --- """Strptime-related classes and functions. CLASSES: LocaleTime -- Discovers and/or stores locale-specific time information TimeRE -- Creates regexes for pattern matching string of text containing time information as is returned by time.strftime() 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 import locale import calendar from re import compile as re_compile from re import IGNORECASE from string import whitespace as whitespace_string __version__ = (2,1,5) __author__ = "Brett Cannon" __email__ = "drifty@bigfoot.com" __all__ = ['strptime'] class LocaleTime(object): """Stores and handles locale-specific information related to time. ATTRIBUTES (all read-only after instance creation! Instance variables that store the values have mangled names): f_weekday -- full weekday names (7-item list) a_weekday -- abbreviated weekday names (7-item list) f_month -- full weekday names (14-item list; dummy value in [0], which is added by code) a_month -- abbreviated weekday names (13-item list, dummy value in [0], which is added by code) am_pm -- AM/PM representation (2-item list) LC_date_time -- format string for date/time representation (string) LC_date -- format string for date representation (string) LC_time -- format string for time representation (string) timezone -- daylight- and non-daylight-savings timezone representation (3-item list; code tacks on blank item at end for possible lack of timezone such as UTC) lang -- Language used by instance (string) """ def __init__(self, f_weekday=None, a_weekday=None, f_month=None, a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None, timezone=None, lang=None): """Optionally set attributes with passed-in values.""" if f_weekday is None: self.__f_weekday = None elif len(f_weekday) == 7: self.__f_weekday = list(f_weekday) else: raise TypeError("full weekday names must be a 7-item sequence") if a_weekday is None: self.__a_weekday = None elif len(a_weekday) == 7: self.__a_weekday = list(a_weekday) else: raise TypeError( "abbreviated weekday names must be a 7-item sequence") if f_month is None: self.__f_month = None elif len(f_month) == 12: self.__f_month = self.__pad(f_month, True) else: raise TypeError("full month names must be a 12-item sequence") if a_month is None: self.__a_month = None elif len(a_month) == 12: self.__a_month = self.__pad(a_month, True) else: raise TypeError( "abbreviated month names must be a 12-item sequence") if am_pm is None: self.__am_pm = None elif len(am_pm) == 2: self.__am_pm = am_pm else: raise TypeError("AM/PM representation must be a 2-item sequence") self.__LC_date_time = LC_date_time self.__LC_time = LC_time self.__LC_date = LC_date self.__timezone = timezone if timezone: if len(timezone) != 2: raise TypeError("timezone names must contain 2 items") else: self.__timezone = self.__pad(timezone, False) self.__lang = lang def __pad(self, seq, front): """Add '' to seq to either front (is True), else the back.""" seq = list(seq) if front: seq.insert(0, '') else: seq.append('') return seq def __set_nothing(self, stuff): """Raise TypeError when trying to set an attribute.""" raise TypeError("attribute does not support assignment") def __get_f_weekday(self): """Fetch self.f_weekday.""" if not self.__f_weekday: self.__calc_weekday() return self.__f_weekday def __get_a_weekday(self): """Fetch self.a_weekday.""" if not self.__a_weekday: self.__calc_weekday() return self.__a_weekday f_weekday = property(__get_f_weekday, __set_nothing, doc="Full weekday names") a_weekday = property(__get_a_weekday, __set_nothing, doc="Abbreviated weekday names") def __get_f_month(self): """Fetch self.f_month.""" if not self.__f_month: self.__calc_month() return self.__f_month def __get_a_month(self): """Fetch self.a_month.""" if not self.__a_month: self.__calc_month() return self.__a_month f_month = property(__get_f_month, __set_nothing, doc="Full month names (dummy value at index 0)") a_month = property(__get_a_month, __set_nothing, doc="Abbreviated month names (dummy value at index 0)") def __get_am_pm(self): """Fetch self.am_pm.""" if not self.__am_pm: self.__calc_am_pm() return self.__am_pm am_pm = property(__get_am_pm, __set_nothing, doc="AM/PM representation") def __get_timezone(self): """Fetch self.timezone.""" if not self.__timezone: self.__calc_timezone() return self.__timezone timezone = property(__get_timezone, __set_nothing, doc="Timezone representation (dummy value at index 2)") def __get_LC_date_time(self): """Fetch self.LC_date_time.""" if not self.__LC_date_time: self.__calc_date_time() return self.__LC_date_time def __get_LC_date(self): """Fetch self.LC_date.""" if not self.__LC_date: self.__calc_date_time() return self.__LC_date def __get_LC_time(self): """Fetch self.LC_time.""" if not self.__LC_time: self.__calc_date_time() return self.__LC_time LC_date_time = property(__get_LC_date_time, __set_nothing, doc="Format string for locale's date/time representation ('%c' format)") LC_date = property(__get_LC_date, __set_nothing, doc="Format string for locale's date representation ('%x' format)") LC_time = property(__get_LC_time, __set_nothing, doc="Format string for locale's time representation ('%X' format)") def __get_lang(self): """Fetch self.lang.""" if not self.__lang: self.__calc_lang() return self.__lang lang = property(__get_lang, __set_nothing, doc="Language used for instance") def __calc_weekday(self): """Set self.__a_weekday and self.__f_weekday using the calendar module.""" a_weekday = [calendar.day_abbr[i] for i in range(7)] f_weekday = [calendar.day_name[i] for i in range(7)] if not self.__a_weekday: self.__a_weekday = a_weekday if not self.__f_weekday: self.__f_weekday = f_weekday def __calc_month(self): """Set self.__f_month and self.__a_month using the calendar module.""" a_month = [calendar.month_abbr[i] for i in range(13)] f_month = [calendar.month_name[i] for i in range(13)] if not self.__a_month: self.__a_month = a_month if not self.__f_month: self.__f_month = f_month def __calc_am_pm(self): """Set self.__am_pm by using time.strftime(). The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really that magical; just happened to have used it everywhere else where a static date was needed. """ am_pm = [] for hour in (01,22): time_tuple = time.struct_time((1999,3,17,hour,44,55,2,76,0)) am_pm.append(time.strftime("%p", time_tuple)) self.__am_pm = am_pm def __calc_date_time(self): """Set self.__date_time, self.__date, & self.__time by using time.strftime(). Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of overloaded numbers is minimized. The order in which searches for values within the format string is very important; it eliminates possible ambiguity for what something represents. """ time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0)) date_time = [None, None, None] date_time[0] = time.strftime("%c", time_tuple) date_time[1] = time.strftime("%x", time_tuple) date_time[2] = time.strftime("%X", time_tuple) for offset,directive in ((0,'%c'), (1,'%x'), (2,'%X')): current_format = date_time[offset] current_format = current_format.replace('%', '%%') current_format = current_format.replace(self.f_weekday[2], '%A') current_format = current_format.replace(self.f_month[3], '%B') current_format = current_format.replace(self.a_weekday[2], '%a') current_format = current_format.replace(self.a_month[3], '%b') current_format = current_format.replace(self.am_pm[1], '%p') current_format = current_format.replace(self.timezone[0], '%Z') current_format = current_format.replace(self.timezone[1], '%Z') current_format = current_format.replace('1999', '%Y') current_format = current_format.replace('99', '%y') current_format = current_format.replace('22', '%H') current_format = current_format.replace('44', '%M') current_format = current_format.replace('55', '%S') current_format = current_format.replace('76', '%j') current_format = current_format.replace('17', '%d') current_format = current_format.replace('03', '%m') current_format = current_format.replace('2', '%w') current_format = current_format.replace('10', '%I') time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0)) if time.strftime(directive, time_tuple).find('00'): U_W = '%U' else: U_W = '%W' date_time[offset] = current_format.replace('11', U_W) if not self.__LC_date_time: self.__LC_date_time = date_time[0] if not self.__LC_date: self.__LC_date = date_time[1] if not self.__LC_time: self.__LC_time = date_time[2] def __calc_timezone(self): """Set self.__timezone by using time.tzname. Empty string used for matching when timezone is not used/needed such as with UTC. """ self.__timezone = self.__pad(time.tzname, 0) def __calc_lang(self): """Set self.lang by using locale.getlocale() or locale.getdefaultlocale(). """ current_lang = locale.getlocale(locale.LC_TIME)[0] if current_lang: self.__lang = current_lang else: self.__lang = locale.getdefaultlocale()[0] class TimeRE(dict): """Handle conversion from format directives to regexes.""" def __init__(self, locale_time=LocaleTime()): """Initialize instance with non-locale regexes and store LocaleTime object.""" super(TimeRE,self).__init__({ 'd': r"(?P3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is #to make %c from ANSI #C work 'H': r"(?P2[0-3]|[0-1]\d|\d)", 'I': r"(?P0\d|1[0-2]|\d)", 'j': r"(?P(?:3[0-5]\d|6[0-6])|[0-2]\d\d|\d)", 'm': r"(?P0\d|1[0-2]|\d)", 'M': r"(?P[0-5]\d|\d)", 'S': r"(?P6[0-1]|[0-5]\d|\d)", 'U': r"(?P5[0-3]|[0-4]\d|\d)", 'w': r"(?P[0-6])", 'W': r"(?P5[0-3]|[0-4]\d|\d)", #Same as U 'y': r"(?P\d\d)", 'Y': r"(?P\d\d\d\d)"}) self.locale_time = locale_time def __getitem__(self, fetch): """Try to fetch regex; if it does not exist, construct it.""" try: return super(TimeRE,self).__getitem__(fetch) except KeyError: if fetch == 'A': self[fetch] = self.__seqToRE(self.locale_time.f_weekday, fetch) elif fetch == 'a': self[fetch] = self.__seqToRE(self.locale_time.a_weekday, fetch) elif fetch == 'B': self[fetch] = self.__seqToRE(self.locale_time.f_month[1:], fetch) elif fetch == 'b': self[fetch] = self.__seqToRE(self.locale_time.a_month[1:], fetch) elif fetch == 'c': self[fetch] = self.pattern(self.locale_time.LC_date_time) elif fetch == 'p': self[fetch] = self.__seqToRE(self.locale_time.am_pm, fetch) elif fetch == 'x': self[fetch] = self.pattern(self.locale_time.LC_date) elif fetch == 'X': self[fetch] = self.pattern(self.locale_time.LC_time) elif fetch == 'Z': self[fetch] = self.__seqToRE(self.locale_time.timezone, fetch) elif fetch == '%': return '%' return super(TimeRE,self).__getitem__(fetch) def __seqToRE(self, to_convert, directive): """Convert a list to a regex string for matching directive.""" def sorter(a, b): """Sort based on length. Done in case for some strange reason that names in the locale only differ by a suffix and thus want the name with the suffix to match first. """ try: a_length = len(a) except TypeError: a_length = 0 try: b_length = len(b) except TypeError: b_length = 0 return cmp(b_length, a_length) to_convert = to_convert[:] #Don't want to change value in-place. to_convert.sort(sorter) regex = '(?P<%s>' % directive for item in to_convert: regex = "%s(?:%s)|" % (regex, item) else: regex = regex[:-1] return '%s)' % regex def pattern(self, format): """Return re pattern for the format string.""" processed_format = '' for whitespace in whitespace_string: format = format.replace(whitespace, r'\s*') while format.find('%') != -1: directive_index = format.index('%')+1 processed_format = "%s%s%s" % (processed_format, format[:directive_index-1], self[format[directive_index]]) format = format[directive_index+1:] return "%s%s" % (processed_format, format) def compile(self, format): """Return a compiled re object for the format string.""" format = "(?#%s)%s" % (self.locale_time.lang,format) return re_compile(self.pattern(format), IGNORECASE) def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Convert data_string to a time struct based on the format string or re object; will return an re object for format if data_string is False. The object passed in for format may either be a re object compiled by strptime() or a format string. If False is passed in for data_string then an re object for format will be returned. The re object must be used with the same language as used to compile the re object. """ locale_time = LocaleTime() if isinstance(format, type(re_compile(''))): if format.pattern.find(locale_time.lang) == -1: raise TypeError("re object not created with same language as \ LocaleTime instance") else: compiled_re = format else: compiled_re = TimeRE(locale_time).compile(format) if data_string is False: return compiled_re else: found = compiled_re.match(data_string) if not found: raise ValueError("time data did not match format") year = month = day = hour = minute = second = weekday = julian = tz = -1 found_dict = found.groupdict() for group_key in found_dict.iterkeys(): if group_key in 'yY': if group_key is 'y': year = int("%s%s" % (time.strftime("%Y")[:-2], found_dict['y'])) else: year = int(found_dict['Y']) elif group_key in 'Bbm': if group_key is 'm': month = int(found_dict['m']) elif group_key is 'B': month = locale_time.f_month.index(found_dict['B']) else: month = locale_time.a_month.index(found_dict['b']) elif group_key is 'd': day = int(found_dict['d']) elif group_key in 'HI': if group_key is 'H': hour = int(found_dict['H']) else: hour = int(found_dict['I']) if found_dict.has_key('p'): if found_dict['p'] == locale_time.am_pm[1]: hour += 12 else: if hour is 12: hour = 0 elif group_key is 'M': minute = int(found_dict['M']) elif group_key is 'S': second = int(found_dict['S']) elif group_key in 'Aaw': if group_key is 'A': weekday = locale_time.f_weekday.index(found_dict['A']) elif group_key is 'a': weekday = locale_time.a_weekday.index(found_dict['a']) else: weekday = int(found_dict['w']) if weekday == 0: weekday = 6 else: weekday -= 1 elif group_key is 'j': julian = int(found_dict['j']) elif group_key is 'Z': if locale_time.timezone[0] == found_dict['Z']: tz = 0 elif locale_time.timezone[1] == found_dict['Z']: tz = 1 elif locale_time.timezone[2] == found_dict['Z']: tz = 0 if julian == -1 and year != -1 and month != -1 and day != -1: julian = julianday(year, month, day) if (month == -1 or day == -1) and julian != -1 and year != -1: year,month,day = gregorian(julian, year) if weekday == -1 and year != -1 and month != -1 and day != -1: weekday = dayofweek(year, month, day) return time.struct_time((year,month,day,hour,minute,second,weekday, julian,tz)) 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 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 a 3-item list containing the 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 From gvanrossum@users.sourceforge.net Fri Jul 19 18:06:49 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 10:06:49 -0700 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv3342 Modified Files: timemodule.c Log Message: Patch to call the Pure python strptime implementation if there's no C implementation. See SF patch 474274, by Brett Cannon. (As an experiment, I'm adding a line that #undefs HAVE_STRPTIME, so that you'll always get the Python version. This is so that it gets some good exercise. We should eventually delete that line.) Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -d -r2.129 -r2.130 *** timemodule.c 16 Jul 2002 01:29:19 -0000 2.129 --- timemodule.c 19 Jul 2002 17:06:47 -0000 2.130 *************** *** 413,416 **** --- 413,417 ---- #endif /* HAVE_STRFTIME */ + #undef HAVE_STRPTIME #ifdef HAVE_STRPTIME *************** *** 446,449 **** --- 447,466 ---- } + #endif /* HAVE_STRPTIME */ + + #ifndef HAVE_STRPTIME + + static PyObject * + time_strptime(PyObject *self, PyObject *args) + { + PyObject *strptime_module = PyImport_ImportModule("_strptime"); + + if (!strptime_module) + return NULL; + return PyObject_CallMethod(strptime_module, "strptime", "O", args); + } + + #endif /* !HAVE_STRPTIME */ + PyDoc_STRVAR(strptime_doc, "strptime(string, format) -> tuple\n\ *************** *** 451,455 **** Parse a string to a time tuple according to a format specification.\n\ See the library reference manual for formatting codes (same as strftime())."); ! #endif /* HAVE_STRPTIME */ static PyObject * --- 468,472 ---- Parse a string to a time tuple according to a format specification.\n\ See the library reference manual for formatting codes (same as strftime())."); ! static PyObject * *************** *** 554,560 **** {"strftime", time_strftime, METH_VARARGS, strftime_doc}, #endif - #ifdef HAVE_STRPTIME {"strptime", time_strptime, METH_VARARGS, strptime_doc}, - #endif {NULL, NULL} /* sentinel */ }; --- 571,575 ---- From gvanrossum@users.sourceforge.net Fri Jul 19 18:09:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 10:09:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5406 Modified Files: libtime.tex Log Message: Doc patch from SF 474274 (pure Python strptime by Brett Cannon). Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** libtime.tex 28 Nov 2001 07:26:15 -0000 1.48 --- libtime.tex 19 Jul 2002 17:09:36 -0000 1.49 *************** *** 282,292 **** values; the specific values are platform-dependent as the XPG standard does not provide sufficient information to constrain the result. - - \note{This function relies entirely on the underlying - platform's C library for the date parsing, and some of these libraries - are buggy. There's nothing to be done about this short of a new, - portable implementation of \cfunction{strptime()}.} - - Availability: Most modern \UNIX{} systems. \end{funcdesc} --- 282,285 ---- From barry@zope.com Fri Jul 19 18:13:40 2002 From: barry@zope.com (Barry A. Warsaw) Date: Fri, 19 Jul 2002 13:13:40 -0400 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.129,2.130 References: Message-ID: <15672.18628.831787.897474@anthem.wooz.org> >>>>> "gvanrossum" == writes: | Update of /cvsroot/python/python/dist/src/Modules | In directory usw-pr-cvs1:/tmp/cvs-serv3342 gvanrossum> Modified Files: timemodule.c Log Message: Patch to gvanrossum> call the Pure python strptime implementation if gvanrossum> there's no C implementation. See SF patch 474274, by gvanrossum> Brett Cannon. gvanrossum> (As an experiment, I'm adding a line that #undefs gvanrossum> HAVE_STRPTIME, so that you'll always get the Python gvanrossum> version. This is so that it gets some good exercise. gvanrossum> We should eventually delete that line.) I've noticed one breakage already I believe. On my systems (RH6.1 and RH7.3) time.daylight as disappeared. I don't think test_time.py actually tests this parameter, but test_email.py which is what's failing for me: -------------------- snip snip -------------------- test_email test test_email failed -- Traceback (most recent call last): File "./Lib/test/test_email.py", line 1450, in test_formatdate_localtime self.assertEqual( File "/home/barry/projects/python/Lib/email/Utils.py", line 193, in formatdate if time.daylight and now[-1]: AttributeError: 'module' object has no attribute 'daylight' -------------------- snip snip -------------------- % ./python Python 2.3a0 (#1, Jul 19 2002, 12:50:54) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time [17946 refs] >>> time.daylight Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'daylight' [17983 refs] >>> [17983 refs] [6651 refs] -------------------- snip snip -------------------- -Barry From fdrake@acm.org Fri Jul 19 18:32:52 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 19 Jul 2002 13:32:52 -0400 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.129,2.130 In-Reply-To: <15672.18628.831787.897474@anthem.wooz.org> References: <15672.18628.831787.897474@anthem.wooz.org> Message-ID: <15672.19780.327719.531514@grendel.zope.com> Barry A. Warsaw writes: > I don't think test_time.py actually tests this parameter, but > test_email.py which is what's failing for me: I see this as well, but test_time.py subsequently fails as well. Interestingly, test_strptime.py passes. grendel(.../trunk/release); ./python ../Lib/test/test_time.py test_asctime (__main__.TimeTestCase) ... ok test_clock (__main__.TimeTestCase) ... ok test_conversions (__main__.TimeTestCase) ... ok test_data_attributes (__main__.TimeTestCase) ... ERROR test_sleep (__main__.TimeTestCase) ... ok test_strftime (__main__.TimeTestCase) ... ok test_strptime (__main__.TimeTestCase) ... ERROR ====================================================================== ERROR: test_data_attributes (__main__.TimeTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "../Lib/test/test_time.py", line 12, in test_data_attributes time.altzone AttributeError: 'module' object has no attribute 'altzone' ====================================================================== ERROR: test_strptime (__main__.TimeTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "../Lib/test/test_time.py", line 47, in test_strptime time.strptime(time.strftime(format, tt), format) File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 389, in strptime compiled_re = TimeRE(locale_time).compile(format) File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 369, in compile return re_compile(self.pattern(format), IGNORECASE) File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 360, in pattern processed_format = "%s%s%s" % (processed_format, File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 314, in __getitem__ self[fetch] = self.pattern(self.locale_time.LC_date_time) File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 157, in __get_LC_date_time if not self.__LC_date_time: self.__calc_date_time() File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 234, in __calc_date_time current_format = current_format.replace(self.timezone[0], '%Z') File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 149, in __get_timezone if not self.__timezone: self.__calc_timezone() File "/home/fdrake/projects/python/trunk/Lib/_strptime.py", line 263, in __calc_timezone self.__timezone = self.__pad(time.tzname, 0) AttributeError: 'module' object has no attribute 'tzname' ---------------------------------------------------------------------- Ran 7 tests in 1.276s FAILED (errors=2) Traceback (most recent call last): File "../Lib/test/test_time.py", line 62, in ? test_main() File "../Lib/test/test_time.py", line 58, in test_main test_support.run_unittest(TimeTestCase) File "../Lib/test/test_support.py", line 190, in run_unittest run_suite(unittest.makeSuite(testclass), testclass) File "../Lib/test/test_support.py", line 184, in run_suite raise TestFailed(msg) test_support.TestFailed: errors occurred in __main__.TimeTestCase -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From nnorwitz@users.sourceforge.net Fri Jul 19 19:38:28 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 19 Jul 2002 11:38:28 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.188,1.189 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv4794/Misc Modified Files: ACKS Log Message: Pure Python strptime implementation by Brett Cannon. See SF patch 474274. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** ACKS 15 Jul 2002 16:13:06 -0000 1.188 --- ACKS 19 Jul 2002 18:38:25 -0000 1.189 *************** *** 75,78 **** --- 75,79 ---- Ralph Butler Daniel Calvelo + Brett Cannon Mike Carlton Luke Kenneth Casson Leighton From gvanrossum@users.sourceforge.net Fri Jul 19 20:23:58 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 12:23:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18080a Modified Files: test_socket.py Log Message: Remove a few lines that aren't used and cause problems on platforms where recvfrom() on a TCP stream returns None for the address. This should address the remaining problems on FreeBSD. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_socket.py 19 Jul 2002 12:46:46 -0000 1.41 --- test_socket.py 19 Jul 2002 19:23:54 -0000 1.42 *************** *** 382,387 **** """Testing large recvfrom() over TCP.""" msg, addr = self.cli_conn.recvfrom(1024) - hostname, port = addr - ##self.assertEqual(hostname, socket.gethostbyname('localhost')) self.assertEqual(msg, MSG) --- 382,385 ---- *************** *** 394,399 **** seg2, addr = self.cli_conn.recvfrom(1024) msg = seg1 + seg2 - hostname, port = addr - ##self.assertEqual(hostname, socket.gethostbyname('localhost')) self.assertEqual(msg, MSG) --- 392,395 ---- *************** *** 452,457 **** """Testing recvfrom() over UDP.""" msg, addr = self.serv.recvfrom(len(MSG)) - hostname, port = addr - ##self.assertEqual(hostname, socket.gethostbyname('localhost')) self.assertEqual(msg, MSG) --- 448,451 ---- From gvanrossum@users.sourceforge.net Fri Jul 19 20:32:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 12:32:32 -0700 Subject: [Python-checkins] python/dist/src configure,1.322,1.323 configure.in,1.333,1.334 pyconfig.h.in,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv20197 Modified Files: configure configure.in pyconfig.h.in Log Message: Alas, roll back the definition of _XOPEN_SOURCE. It breaks the tests for the time module, because somehow configure won't define the symbols HAVE_STRUCT_TM_TM_ZONE, HAVE_TM_ZONE, and HAVE_TZNAME in this case. I've got no time to research this further, so I leave it in Jeremy and Martin's capable hands to find a different solution for True64 (or to devise a way to get the time tests to succeed while defining _XOPEN_SOURCE). Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.322 retrieving revision 1.323 diff -C2 -d -r1.322 -r1.323 *** configure 19 Jul 2002 06:55:40 -0000 1.322 --- configure 19 Jul 2002 19:32:26 -0000 1.323 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.332 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.333 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 1225,1234 **** SOVERSION=1.0 - - - cat >>confdefs.h <<\_ACEOF - #define _XOPEN_SOURCE 500 - _ACEOF - # Arguments passed to configure. --- 1225,1228 ---- Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.333 retrieving revision 1.334 diff -C2 -d -r1.333 -r1.334 *** configure.in 19 Jul 2002 06:55:40 -0000 1.333 --- configure.in 19 Jul 2002 19:32:30 -0000 1.334 *************** *** 21,26 **** SOVERSION=1.0 - AC_DEFINE(_XOPEN_SOURCE, 500, [Needed on Tru64 and does no harm on Linux]) - # Arguments passed to configure. AC_SUBST(CONFIG_ARGS) --- 21,24 ---- Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** pyconfig.h.in 19 Jul 2002 06:55:40 -0000 1.43 --- pyconfig.h.in 19 Jul 2002 19:32:30 -0000 1.44 *************** *** 774,780 **** #undef _REENTRANT - /* Needed on Tru64 and does no harm on Linux */ - #undef _XOPEN_SOURCE - /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ --- 774,777 ---- From tim.one@comcast.net Fri Jul 19 21:06:24 2002 From: tim.one@comcast.net (Tim Peters) Date: Fri, 19 Jul 2002 16:06:24 -0400 Subject: [Python-checkins] python/dist/src configure,1.322,1.323 configure.in,1.333,1.334 pyconfig.h.in,1.43,1.44 In-Reply-To: Message-ID: [Guido] > Alas, roll back the definition of _XOPEN_SOURCE. It breaks the tests > for the time module, because somehow configure won't define the > symbols HAVE_STRUCT_TM_TM_ZONE, HAVE_TM_ZONE, and HAVE_TZNAME in this > case. I don't understand why this helps. Are you sure it does? Python.h still contains: #ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 500 #endif The configure changes were consequences of that change, IIRC. We surely shouldn't be defining this one way in Python.h and a different way in config, right? From barry@zope.com Fri Jul 19 21:21:28 2002 From: barry@zope.com (Barry A. Warsaw) Date: Fri, 19 Jul 2002 16:21:28 -0400 Subject: [Python-checkins] python/dist/src configure,1.322,1.323 configure.in,1.333,1.334 pyconfig.h.in,1.43,1.44 References: Message-ID: <15672.29896.336353.527442@anthem.wooz.org> >>>>> "TP" == Tim Peters writes: >> Alas, roll back the definition of _XOPEN_SOURCE. It breaks the >> tests for the time module, because somehow configure won't >> define the symbols HAVE_STRUCT_TM_TM_ZONE, HAVE_TM_ZONE, and >> HAVE_TZNAME in this case. TP> I don't understand why this helps. Are you sure it does? Works for me. Test failures are gone now. TP> Python.h still contains: | #ifndef _XOPEN_SOURCE | # define _XOPEN_SOURCE 500 | #endif Did you grep the source for "500"? :) -Barry From fdrake@users.sourceforge.net Fri Jul 19 23:03:06 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:03:06 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.70,2.71 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2176 Modified Files: pyexpat.c Log Message: Return NULL instead of 0 from function with a pointer return value. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** pyexpat.c 19 Jul 2002 06:55:41 -0000 2.70 --- pyexpat.c 19 Jul 2002 22:03:03 -0000 2.71 *************** *** 843,847 **** PyErr_SetString(PyExc_TypeError, "argument must have 'read' attribute"); ! return 0; } } --- 843,847 ---- PyErr_SetString(PyExc_TypeError, "argument must have 'read' attribute"); ! return NULL; } } From bwarsaw@users.sourceforge.net Fri Jul 19 23:11:28 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:11:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv4276/test Log Message: Directory /cvsroot/python/python/dist/src/Lib/email/test added to the repository From bwarsaw@users.sourceforge.net Fri Jul 19 23:11:42 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:11:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test/data - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory usw-pr-cvs1:/tmp/cvs-serv4353/data Log Message: Directory /cvsroot/python/python/dist/src/Lib/email/test/data added to the repository From fdrake@users.sourceforge.net Fri Jul 19 23:16:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:16:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_minidom,1.17,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv5775/output Removed Files: test_minidom Log Message: Follow PyXML: Remove all prints from successful tests. This means we can also drop the output file. --- test_minidom DELETED --- From fdrake@users.sourceforge.net Fri Jul 19 23:16:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:16:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_minidom.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5775 Modified Files: test_minidom.py Log Message: Follow PyXML: Remove all prints from successful tests. This means we can also drop the output file. Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** test_minidom.py 30 Jun 2002 15:05:00 -0000 1.32 --- test_minidom.py 19 Jul 2002 22:16:40 -0000 1.33 *************** *** 1,13 **** # test for xml.dom.minidom - from xml.dom.minidom import parse, Node, Document, parseString - from xml.dom import HierarchyRequestErr - import xml.parsers.expat - import os import sys import traceback from test_support import verbose if __name__ == "__main__": base = sys.argv[0] --- 1,15 ---- # test for xml.dom.minidom import os import sys import traceback + from test_support import verbose + import xml.dom + import xml.parsers.expat + + from xml.dom.minidom import parse, Node, Document, parseString + if __name__ == "__main__": base = sys.argv[0] *************** *** 18,24 **** def confirm(test, testname = "Test"): ! if test: ! print "Passed " + testname ! else: print "Failed " + testname raise Exception --- 20,24 ---- def confirm(test, testname = "Test"): ! if not test: print "Failed " + testname raise Exception *************** *** 138,142 **** try: dom.appendChild(text) ! except HierarchyRequestErr: pass else: print "dom.appendChild didn't raise HierarchyRequestErr" --- 138,142 ---- try: dom.appendChild(text) ! except xml.dom.HierarchyRequestErr: pass else: print "dom.appendChild didn't raise HierarchyRequestErr" *************** *** 144,153 **** dom.appendChild(elem) try: dom.insertBefore(text, elem) ! except HierarchyRequestErr: pass else: print "dom.appendChild didn't raise HierarchyRequestErr" try: dom.replaceChild(text, elem) ! except HierarchyRequestErr: pass else: print "dom.appendChild didn't raise HierarchyRequestErr" --- 144,153 ---- dom.appendChild(elem) try: dom.insertBefore(text, elem) ! except xml.dom.HierarchyRequestErr: pass else: print "dom.appendChild didn't raise HierarchyRequestErr" try: dom.replaceChild(text, elem) ! except xml.dom.HierarchyRequestErr: pass else: print "dom.appendChild didn't raise HierarchyRequestErr" *************** *** 155,164 **** nodemap = elem.attributes try: nodemap.setNamedItem(text) ! except HierarchyRequestErr: pass else: print "NamedNodeMap.setNamedItem didn't raise HierarchyRequestErr" try: nodemap.setNamedItemNS(text) ! except HierarchyRequestErr: pass else: print "NamedNodeMap.setNamedItemNS didn't raise HierarchyRequestErr" --- 155,164 ---- nodemap = elem.attributes try: nodemap.setNamedItem(text) ! except xml.dom.HierarchyRequestErr: pass else: print "NamedNodeMap.setNamedItem didn't raise HierarchyRequestErr" try: nodemap.setNamedItemNS(text) ! except xml.dom.HierarchyRequestErr: pass else: print "NamedNodeMap.setNamedItemNS didn't raise HierarchyRequestErr" *************** *** 389,394 **** try: doc.appendChild(elem) ! except HierarchyRequestErr: ! print "Caught expected exception when adding extra document element." else: print "Failed to catch expected exception when" \ --- 389,394 ---- try: doc.appendChild(elem) ! except xml.dom.HierarchyRequestErr: ! pass else: print "Failed to catch expected exception when" \ *************** *** 627,631 **** try: func() - print "Test Succeeded", name confirm(len(Node.allnodes) == 0, "assertion: len(Node.allnodes) == 0") --- 627,630 ---- *************** *** 651,658 **** for name in failed: print " " + name - print - else: - print "All tests succeeded" - - Node.debug = None # Delete debug output collected in a StringIO object - Node._debug = 0 # And reset debug mode --- 650,651 ---- From bwarsaw@users.sourceforge.net Fri Jul 19 23:21:05 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:21:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv7083/email Modified Files: Generator.py Log Message: _dispatch(): Use the new Message.get_content_type() method as hashed out on the mimelib-devel list. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Generator.py 11 Jul 2002 18:48:40 -0000 1.12 --- Generator.py 19 Jul 2002 22:21:02 -0000 1.13 *************** *** 124,133 **** # full MIME type, then dispatch to self._handle_(). If # that's missing too, then dispatch to self._writeBody(). ! ctype = msg.get_type() ! if ctype is None: ! # No Content-Type: header so use the default type, which must be ! # either text/plain or message/rfc822. ! ctype = msg.get_default_type() ! assert ctype in ('text/plain', 'message/rfc822') # We do have a Content-Type: header. main, sub = ctype.split('/') --- 124,128 ---- # full MIME type, then dispatch to self._handle_(). If # that's missing too, then dispatch to self._writeBody(). ! ctype = msg.get_content_type() # We do have a Content-Type: header. main, sub = ctype.split('/') From bwarsaw@users.sourceforge.net Fri Jul 19 23:21:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:21:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv7257/email Modified Files: Iterators.py Log Message: _structure(): Take an optional `fp' argument which would be the object to print>> the structure to. Defaults to sys.stdout. Index: Iterators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Iterators.py 11 Jul 2002 20:24:36 -0000 1.9 --- Iterators.py 19 Jul 2002 22:21:47 -0000 1.10 *************** *** 5,8 **** --- 5,10 ---- """ + import sys + try: from email._compat22 import body_line_iterator, typed_subpart_iterator *************** *** 13,21 **** ! def _structure(msg, level=0): """A handy debugging aid""" tab = ' ' * (level * 4) ! print tab + msg.get_type(msg.get_default_type()) if msg.is_multipart(): for subpart in msg.get_payload(): ! _structure(subpart, level+1) --- 15,25 ---- ! def _structure(msg, level=0, fp=None): """A handy debugging aid""" + if fp is None: + fp = sys.stdout tab = ' ' * (level * 4) ! print >> fp, tab + msg.get_type(msg.get_default_type()) if msg.is_multipart(): for subpart in msg.get_payload(): ! _structure(subpart, level+1, fp) From bwarsaw@users.sourceforge.net Fri Jul 19 23:24:57 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:24:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv8082/email Modified Files: Message.py Log Message: To better support default content types, fix an API wart, and preserve backwards compatibility, we're silently deprecating get_type(), get_subtype() and get_main_type(). We may eventually noisily deprecate these. For now, we'll just fix a bug in the splitting of the main and subtypes. get_content_type(), get_content_maintype(), get_content_subtype(): New methods which replace the above. These /always/ return a content type string and do not take a failobj, because an email message always at least has a default content type. set_default_type(): Someday there may be additional default content types, so don't hard code an assertion about the value of the ctype argument. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Message.py 18 Jul 2002 23:09:09 -0000 1.16 --- Message.py 19 Jul 2002 22:24:55 -0000 1.17 *************** *** 363,366 **** --- 363,371 ---- self._headers.append((_name, SEMISPACE.join(parts))) + # + # These methods are silently deprecated in favor of get_content_type() and + # friends (see below). They will be noisily deprecated in email 3.0. + # + def get_type(self, failobj=None): """Returns the message's content type. *************** *** 382,389 **** if ctype is missing: return failobj ! parts = ctype.split('/') ! if len(parts) > 0: ! return ctype.split('/')[0] ! return failobj def get_subtype(self, failobj=None): --- 387,393 ---- if ctype is missing: return failobj ! if ctype.count('/') <> 1: ! return failobj ! return ctype.split('/')[0] def get_subtype(self, failobj=None): *************** *** 393,400 **** if ctype is missing: return failobj ! parts = ctype.split('/') ! if len(parts) > 1: ! return ctype.split('/')[1] ! return failobj def get_default_type(self): --- 397,451 ---- if ctype is missing: return failobj ! if ctype.count('/') <> 1: ! return failobj ! return ctype.split('/')[1] ! ! # ! # Use these three methods instead of the three above. ! # ! ! def get_content_type(self): ! """Returns the message's content type. ! ! The returned string is coerced to lowercase and returned as a ingle ! string of the form `maintype/subtype'. If there was no Content-Type: ! header in the message, the default type as give by get_default_type() ! will be returned. Since messages always have a default type this will ! always return a value. ! ! The current state of RFC standards define a message's default type to ! be text/plain unless it appears inside a multipart/digest container, ! in which case it would be message/rfc822. ! """ ! missing = [] ! value = self.get('content-type', missing) ! if value is missing: ! # This should have no parameters ! return self.get_default_type() ! return paramre.split(value)[0].lower().strip() ! ! def get_content_maintype(self): ! """Returns the message's main content type. ! ! This is the `maintype' part of the string returned by ! get_content_type(). If no slash is found in the full content type, a ! ValueError is raised. ! """ ! ctype = self.get_content_type() ! if ctype.count('/') <> 1: ! raise ValueError, 'No maintype found in: %s' % ctype ! return ctype.split('/')[0] ! ! def get_content_subtype(self): ! """Returns the message's sub content type. ! ! This is the `subtype' part of the string returned by ! get_content_type(). If no slash is found in the full content type, a ! ValueError is raised. ! """ ! ctype = self.get_content_type() ! if ctype.count('/') <> 1: ! raise ValueError, 'No subtype found in: %s' % ctype ! return ctype.split('/')[1] def get_default_type(self): *************** *** 410,419 **** """Set the `default' content type. ! ctype must be either "text/plain" or "message/rfc822". The default ! content type is not stored in the Content-Type: header. """ - if ctype not in ('text/plain', 'message/rfc822'): - raise ValueError( - 'first arg must be either "text/plain" or "message/rfc822"') self._default_type = ctype --- 461,468 ---- """Set the `default' content type. ! ctype should be either "text/plain" or "message/rfc822", although this ! is not enforced. The default content type is not stored in the ! Content-Type: header. """ self._default_type = ctype From bwarsaw@users.sourceforge.net Fri Jul 19 23:25:36 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:25:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv8324/email Modified Files: Parser.py Log Message: Parser.__init__(): The consensus on the mimelib-devel list is that non-strict parsing should be the default. Make it so. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Parser.py 18 Jul 2002 23:09:09 -0000 1.11 --- Parser.py 19 Jul 2002 22:25:34 -0000 1.12 *************** *** 17,21 **** class Parser: ! def __init__(self, _class=Message.Message, strict=1): """Parser of RFC 2822 and MIME email messages. --- 17,21 ---- class Parser: ! def __init__(self, _class=Message.Message, strict=0): """Parser of RFC 2822 and MIME email messages. *************** *** 37,41 **** non-strict mode is used, the parser will try to make up for missing or erroneous boundaries and other peculiarities seen in the wild. ! Defaults to strict parsing. """ self._class = _class --- 37,41 ---- non-strict mode is used, the parser will try to make up for missing or erroneous boundaries and other peculiarities seen in the wild. ! Default is non-strict parsing. """ self._class = _class From bwarsaw@users.sourceforge.net Fri Jul 19 23:26:03 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:26:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv8450/email Modified Files: __init__.py Log Message: message_from_string(), message_from_file(): The consensus on the mimelib-devel list is that non-strict parsing should be the default. Make it so. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** __init__.py 18 Jul 2002 21:29:17 -0000 1.10 --- __init__.py 19 Jul 2002 22:26:01 -0000 1.11 *************** *** 33,39 **** from email.Message import Message as _Message ! def message_from_string(s, _class=_Message, strict=1): return _Parser(_class, strict=strict).parsestr(s) ! def message_from_file(fp, _class=_Message, strict=1): return _Parser(_class, strict=strict).parse(fp) --- 33,39 ---- from email.Message import Message as _Message ! def message_from_string(s, _class=_Message, strict=0): return _Parser(_class, strict=strict).parsestr(s) ! def message_from_file(fp, _class=_Message, strict=0): return _Parser(_class, strict=strict).parse(fp) From bwarsaw@users.sourceforge.net Fri Jul 19 23:29:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:29:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test __init__.py,NONE,1.1 test_email.py,NONE,1.1 test_email_codecs.py,NONE,1.1 test_email_torture.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv9248/email/test Added Files: __init__.py test_email.py test_email_codecs.py test_email_torture.py Log Message: The email package's tests live much better in a subpackage (i.e. email.test), so move the guts of them here from Lib/test. The latter directory will retain stubs to run the email.test tests using Python's standard regression test. test_email_torture.py is a torture tester which will not run under Python's test suite because I don't want to commit megs of data to that project (it will fail cleanly there). When run under the mimelib project it'll stress test the package with megs of message samples collected from various locations in the wild. --- NEW FILE: __init__.py --- # Copyright (C) 2002 Python Software Foundation # Author: barry@zope.com (Barry Warsaw) --- NEW FILE: test_email.py --- # 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 from types import StringType, ListType import warnings import email from email.Charset import Charset from email.Header import Header, decode_header, make_header from email.Parser import Parser, HeaderParser from email.Generator import Generator, DecodedGenerator [...2039 lines suppressed...] def _testclasses(): mod = sys.modules[__name__] return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] def suite(): suite = unittest.TestSuite() for testclass in _testclasses(): suite.addTest(unittest.makeSuite(testclass)) return suite def test_main(): for testclass in _testclasses(): run_unittest(testclass) if __name__ == '__main__': unittest.main(defaultTest='suite') --- NEW FILE: test_email_codecs.py --- # Copyright (C) 2002 Python Software Foundation # email package unit tests for (optional) Asian codecs import unittest from test.test_support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase from email.Charset import Charset from email.Header import Header, decode_header # See if we have the Japanese codecs package installed try: unicode('foo', 'japanese.iso-2022-jp') except LookupError: raise TestSkipped, 'Optional Japanese codecs not installed' class TestEmailAsianCodecs(TestEmailBase): def test_japanese_codecs(self): eq = self.ndiffAssertEqual j = Charset("euc-jp") g = Charset("iso-8859-1") h = Header("Hello World!") jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa' ghello = 'Gr\xfc\xdf Gott!' 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), ('\x1b$B%O%m!<%o!<%k%I!*\x1b(B', 'iso-2022-jp'), ('Gr\xfc\xdf Gott!', 'iso-8859-1')]) long = 'test-ja \xa4\xd8\xc5\xea\xb9\xc6\xa4\xb5\xa4\xec\xa4\xbf\xa5\xe1\xa1\xbc\xa5\xeb\xa4\xcf\xbb\xca\xb2\xf1\xbc\xd4\xa4\xce\xbe\xb5\xc7\xa7\xa4\xf2\xc2\xd4\xa4\xc3\xa4\xc6\xa4\xa4\xa4\xde\xa4\xb9' h = Header(long, j, header_name="Subject") # 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')]) def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestEmailAsianCodecs)) return suite def test_main(): run_unittest(TestEmailAsianCodecs) if __name__ == '__main__': unittest.main(defaultTest='suite') --- NEW FILE: test_email_torture.py --- # Copyright (C) 2002 Python Software Foundation # # A torture test of the email package. This should not be run as part of the # standard Python test suite since it requires several meg of email messages # collected in the wild. These source messages are not checked into the # Python distro, but are available as part of the standalone email package at # http://sf.net/projects/mimelib import sys import os import unittest from cStringIO import StringIO from types import ListType from test_email import TestEmailBase try: import test_support TestSkipped = test_support.TestSkipped except ImportError: test_support = None TestSkipped = ImportError import email from email import __file__ as testfile from email.Iterators import _structure def openfile(filename): from os.path import join, dirname, abspath path = abspath(join(dirname(testfile), os.pardir, 'moredata', filename)) return open(path) # Prevent this test from running in the Python distro try: openfile('crispin-torture.txt') except IOError: raise TestSkipped class TortureBase(TestEmailBase): def _msgobj(self, filename): fp = openfile(filename) try: msg = email.message_from_file(fp) finally: fp.close() return msg class TestCrispinTorture(TortureBase): # Mark Crispin's torture test from the SquirrelMail project def test_mondo_message(self): eq = self.assertEqual msg = self._msgobj('crispin-torture.txt') payload = msg.get_payload() eq(type(payload), ListType) eq(len(payload), 12) eq(msg.preamble, None) eq(msg.epilogue, '\n\n') # Probably the best way to verify the message is parsed correctly is to # dump its structure and compare it against the known structure. fp = StringIO() _structure(msg, fp=fp) eq(fp.getvalue(), """\ multipart/mixed text/plain message/rfc822 multipart/alternative text/plain multipart/mixed text/richtext application/andrew-inset message/rfc822 audio/basic audio/basic image/pbm message/rfc822 multipart/mixed multipart/mixed text/plain audio/x-sun multipart/mixed image/gif image/gif application/x-be2 application/atomicmail audio/x-sun message/rfc822 multipart/mixed text/plain image/pgm text/plain message/rfc822 multipart/mixed text/plain image/pbm message/rfc822 application/postscript image/gif message/rfc822 multipart/mixed audio/basic audio/basic message/rfc822 multipart/mixed application/postscript binary message/rfc822 multipart/mixed text/plain multipart/parallel image/gif audio/basic application/atomicmail message/rfc822 audio/x-sun """) def _testclasses(): mod = sys.modules[__name__] return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] def suite(): suite = unittest.TestSuite() for testclass in _testclasses(): suite.addTest(unittest.makeSuite(testclass)) return suite def test_main(): for testclass in _testclasses(): test_support.run_unittest(testclass) if __name__ == '__main__': unittest.main(defaultTest='suite') From bwarsaw@users.sourceforge.net Fri Jul 19 23:29:51 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:29:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test/data PyBanner048.gif,NONE,1.1 msg_01.txt,NONE,1.1 msg_02.txt,NONE,1.1 msg_03.txt,NONE,1.1 msg_04.txt,NONE,1.1 msg_05.txt,NONE,1.1 msg_06.txt,NONE,1.1 msg_07.txt,NONE,1.1 msg_08.txt,NONE,1.1 msg_09.txt,NONE,1.1 msg_10.txt,NONE,1.1 msg_11.txt,NONE,1.1 msg_12.txt,NONE,1.1 msg_13.txt,NONE,1.1 msg_14.txt,NONE,1.1 msg_15.txt,NONE,1.1 msg_16.txt,NONE,1.1 msg_17.txt,NONE,1.1 msg_18.txt,NONE,1.1 msg_19.txt,NONE,1.1 msg_20.txt,NONE,1.1 msg_21.txt,NONE,1.1 msg_22.txt,NONE,1.1 msg_23.txt,NONE,1.1 msg_24.txt,NONE,1.1 msg_25.txt,NONE,1.1 msg_26.txt,NONE,1.1 msg_27.txt,NONE,1.1 msg_28.txt,NONE,1.1 msg_29.txt,NONE,1.1 msg_30.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory usw-pr-cvs1:/tmp/cvs-serv9493/email/test/data Added Files: PyBanner048.gif msg_01.txt msg_02.txt msg_03.txt msg_04.txt msg_05.txt msg_06.txt msg_07.txt msg_08.txt msg_09.txt msg_10.txt msg_11.txt msg_12.txt msg_13.txt msg_14.txt msg_15.txt msg_16.txt msg_17.txt msg_18.txt msg_19.txt msg_20.txt msg_21.txt msg_22.txt msg_23.txt msg_24.txt msg_25.txt msg_26.txt msg_27.txt msg_28.txt msg_29.txt msg_30.txt Log Message: The email package's tests live much better in a subpackage (i.e. email.test), so move the guts of them here from Lib/test. The latter directory will retain stubs to run the email.test tests using Python's standard regression test. test_email_torture.py is a torture tester which will not run under Python's test suite because I don't want to commit megs of data to that project (it will fail cleanly there). When run under the mimelib project it'll stress test the package with megs of message samples collected from various locations in the wild. email/test/data is a copy of Lib/test/data. The fate of the latter is still undecided. --- NEW FILE: PyBanner048.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: msg_01.txt --- Return-Path: Delivered-To: bbb@zzz.org Received: by mail.zzz.org (Postfix, from userid 889) id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15090.61304.110929.45684@aaa.zzz.org> From: bbb@ddd.com (John X. Doe) To: bbb@zzz.org Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 Hi, Do you like this message? -Me --- NEW FILE: msg_02.txt --- MIME-version: 1.0 From: ppp-request@zzz.org Sender: ppp-admin@zzz.org To: ppp@zzz.org Subject: Ppp digest, Vol 1 #2 - 5 msgs Date: Fri, 20 Apr 2001 20:18:00 -0400 (EDT) X-Mailer: Mailman v2.0.4 X-Mailman-Version: 2.0.4 Content-Type: multipart/mixed; boundary="192.168.1.2.889.32614.987812255.500.21814" --192.168.1.2.889.32614.987812255.500.21814 Content-type: text/plain; charset=us-ascii Content-description: Masthead (Ppp digest, Vol 1 #2) Send Ppp mailing list submissions to ppp@zzz.org To subscribe or unsubscribe via the World Wide Web, visit http://www.zzz.org/mailman/listinfo/ppp or, via email, send a message with subject or body 'help' to ppp-request@zzz.org You can reach the person managing the list at ppp-admin@zzz.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Ppp digest..." --192.168.1.2.889.32614.987812255.500.21814 Content-type: text/plain; charset=us-ascii Content-description: Today's Topics (5 msgs) Today's Topics: 1. testing #1 (Barry A. Warsaw) 2. testing #2 (Barry A. Warsaw) 3. testing #3 (Barry A. Warsaw) 4. testing #4 (Barry A. Warsaw) 5. testing #5 (Barry A. Warsaw) --192.168.1.2.889.32614.987812255.500.21814 Content-Type: multipart/digest; boundary="__--__--" --__--__-- Message: 1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 20 Apr 2001 20:16:13 -0400 To: ppp@zzz.org From: barry@digicool.com (Barry A. Warsaw) Subject: [Ppp] testing #1 Precedence: bulk hello --__--__-- Message: 2 Date: Fri, 20 Apr 2001 20:16:21 -0400 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: ppp@zzz.org From: barry@digicool.com (Barry A. Warsaw) Precedence: bulk hello --__--__-- Message: 3 Date: Fri, 20 Apr 2001 20:16:25 -0400 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: ppp@zzz.org From: barry@digicool.com (Barry A. Warsaw) Subject: [Ppp] testing #3 Precedence: bulk hello --__--__-- Message: 4 Date: Fri, 20 Apr 2001 20:16:28 -0400 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: ppp@zzz.org From: barry@digicool.com (Barry A. Warsaw) Subject: [Ppp] testing #4 Precedence: bulk hello --__--__-- Message: 5 Date: Fri, 20 Apr 2001 20:16:32 -0400 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: ppp@zzz.org From: barry@digicool.com (Barry A. Warsaw) Subject: [Ppp] testing #5 Precedence: bulk hello --__--__---- --192.168.1.2.889.32614.987812255.500.21814 Content-type: text/plain; charset=us-ascii Content-description: Digest Footer _______________________________________________ Ppp mailing list Ppp@zzz.org http://www.zzz.org/mailman/listinfo/ppp --192.168.1.2.889.32614.987812255.500.21814-- End of Ppp Digest --- NEW FILE: msg_03.txt --- Return-Path: Delivered-To: bbb@zzz.org Received: by mail.zzz.org (Postfix, from userid 889) id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) Message-ID: <15090.61304.110929.45684@aaa.zzz.org> From: bbb@ddd.com (John X. Doe) To: bbb@zzz.org Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 Hi, Do you like this message? -Me --- NEW FILE: msg_04.txt --- Return-Path: Delivered-To: barry@python.org Received: by mail.python.org (Postfix, from userid 889) id C2BF0D37C6; Tue, 11 Sep 2001 00:05:05 -0400 (EDT) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="h90VIIIKmx" Content-Transfer-Encoding: 7bit Message-ID: <15261.36209.358846.118674@anthem.python.org> From: barry@python.org (Barry A. Warsaw) To: barry@python.org Subject: a simple multipart Date: Tue, 11 Sep 2001 00:05:05 -0400 X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid X-Attribution: BAW X-Oblique-Strategy: Make a door into a window --h90VIIIKmx Content-Type: text/plain Content-Disposition: inline; filename="msg.txt" Content-Transfer-Encoding: 7bit a simple kind of mirror to reflect upon our own --h90VIIIKmx Content-Type: text/plain Content-Disposition: inline; filename="msg.txt" Content-Transfer-Encoding: 7bit a simple kind of mirror to reflect upon our own --h90VIIIKmx-- --- NEW FILE: msg_05.txt --- From: foo Subject: bar To: baz MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; boundary="D1690A7AC1.996856090/mail.example.com" Message-Id: <20010803162810.0CA8AA7ACC@mail.example.com> This is a MIME-encapsulated message. --D1690A7AC1.996856090/mail.example.com Content-Type: text/plain Yadda yadda yadda --D1690A7AC1.996856090/mail.example.com Yadda yadda yadda --D1690A7AC1.996856090/mail.example.com Content-Type: message/rfc822 From: nobody@python.org Yadda yadda yadda --D1690A7AC1.996856090/mail.example.com-- --- NEW FILE: msg_06.txt --- Return-Path: Delivered-To: barry@python.org MIME-Version: 1.0 Content-Type: message/rfc822 Content-Description: forwarded message Content-Transfer-Encoding: 7bit Message-ID: <15265.9482.641338.555352@python.org> From: barry@zope.com (Barry A. Warsaw) Sender: barry@python.org To: barry@python.org Subject: forwarded message from Barry A. Warsaw Date: Thu, 13 Sep 2001 17:28:42 -0400 X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid X-Attribution: BAW X-Oblique-Strategy: Be dirty X-Url: http://barry.wooz.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-Path: Delivered-To: barry@python.org Message-ID: <15265.9468.713530.98441@python.org> From: barry@zope.com (Barry A. Warsaw) Sender: barry@python.org To: barry@python.org Subject: testing Date: Thu, 13 Sep 2001 17:28:28 -0400 X-Mailer: VM 6.95 under 21.4 (patch 4) "Artificial Intelligence" XEmacs Lucid X-Attribution: BAW X-Oblique-Strategy: Spectrum analysis X-Url: http://barry.wooz.org --- NEW FILE: msg_07.txt --- MIME-Version: 1.0 From: Barry To: Dingus Lovers Subject: Here is your dingus fish Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain; charset="us-ascii" Hi there, This is the dingus fish. --BOUNDARY Content-Type: image/gif; name="dingusfish.gif" Content-Transfer-Encoding: base64 content-disposition: attachment; filename="dingusfish.gif" R0lGODdhAAEAAfAAAP///wAAACwAAAAAAAEAAQAC/oSPqcvtD6OctNqLs968+w+G4kiW5omm6sq2 7gvH8kzX9o3n+s73/g8MCofEovGITGICTKbyCV0FDNOo9SqpQqpOrJfXzTQj2vD3TGtqL+NtGQ2f qTXmxzuOd7WXdcc9DyjU53ewFni4s0fGhdiYaEhGBelICTNoV1j5NUnFcrmUqemjNifJVWpaOqaI oFq3SspZsSraE7sHq3jr1MZqWvi662vxV4tD+pvKW6aLDOCLyur8PDwbanyDeq0N3DctbQYeLDvR RY6t95m6UB0d3mwIrV7e2VGNvjjffukeJp4w7F65KecGFsTHQGAygOrgrWs1jt28Rc88KESYcGLA /obvTkH6p+CinWJiJmIMqXGQwH/y4qk0SYjgQTczT3ajKZGfuI0uJ4kkVI/DT5s3/ejkxI0aT4Y+ YTYgWbImUaXk9nlLmnSh1qJiJFl0OpUqRK4oOy7NyRQtHWofhoYVxkwWXKUSn0YsS+fUV6lhqfYb 6ayd3Z5qQdG1B7bvQzaJjwUV2lixMUZ7JVsOlfjWVr/3NB/uFvnySBN6Dcb6rGwaRM3wsormw5cC M9NxWy/bWdufudCvy8bOAjXjVVwta/uO21sE5RHBCzNFXtgq9ORtH4eYjVP4Yryo026nvkFmCeyA B29efV6ravCMK5JwWd5897Qrx7ll38o6iHDZ/rXPR//feevhF4l7wjUGX3xq1eeRfM4RSJGBIV1D z1gKPkfWag3mVBVvva1RlX5bAJTPR/2YqNtw/FkIYYEi/pIZiAdpcxpoHtmnYYoZtvhUftzdx5ZX JSKDW405zkGcZzzGZ6KEv4FI224oDmijlEf+xp6MJK5ojY/ASeVUR+wsKRuJ+XFZ5o7ZeEime8t1 ouUsU6YjF5ZtUihhkGfCdFQLWQFJ3UXxmElfhQnR+eCdcDbkFZp6vTRmj56ApCihn5QGpaToNZmR n3NVSpZcQpZ2KEONusaiCsKAug0wkQbJSFO+PTSjneGxOuFjPlUk3ovWvdIerjUg9ZGIOtGq/qeX eCYrrCX+1UPsgTKGGRSbzd5q156d/gpfbJxe66eD5iQKrXj7RGgruGxs62qebBHUKS32CKluCiqZ qh+pmehmEb71noAUoe5e9Zm17S7773V10pjrtG4CmuurCV/n6zLK5turWNhqOvFXbjhZrMD0YhKe wR0zOyuvsh6MWrGoIuzvyWu5y1WIFAqmJselypxXh6dKLNOKEB98L88bS2rkNqqlKzCNJp9c0G0j Gzh0iRrCbHSXmPR643QS+4rWhgFmnSbSuXCjS0xAOWkU2UdLqyuUNfHSFdUouy3bm5i5GnDM3tG8 doJ4r5tqu3pPbRSVfvs8uJzeNXhp3n4j/tZ42SwH7eaWUUOjc3qFV9453UHTXZfcLH+OeNs5g36x lBnHvTm7EbMbLeuaLncao8vWCXimfo1o+843Ak6y4ChNeGntvAYvfLK4ezmoyNIbNCLTCXO9ZV3A E8/s88RczPzDwI4Ob7XZyl7+9Miban29h+tJZPrE21wgvBphDfrrfPdCTPKJD/y98L1rZwHcV6Jq Zab0metpuNIX/qAFPoz171WUaUb4HAhBSzHuHfjzHb3kha/2Cctis/ORArVHNYfFyYRH2pYIRzic isVOfPWD1b6mRTqpCRBozzof6UZVvFXRxWIr3GGrEviGYgyPMfahheiSaLs/9QeFu7oZ/ndSY8DD ya9x+uPed+7mxN2IzIISBOMLFYWVqC3Pew1T2nFuuCiwZS5/v6II10i4t1OJcUH2U9zxKodHsGGv Oa+zkvNUYUOa/TCCRutF9MzDwdlUMJADTCGSbDQ5OV4PTamDoPEi6Ecc/RF5RWwkcdSXvSOaDWSn I9LlvubFTQpuc6JKXLcKeb+xdbKRBnwREemXyjg6ME65aJiOuBgrktzykfPLJBKR9ClMavJ62/Ff BlNIyod9yX9wcSXexnXFpvkrbXk64xsx5Db7wXKP5fSgsvwIMM/9631VLBfkmtbHRXpqmtei52hG pUwSlo+BASQoeILDOBgREECxBBh5/iYmNsQ9dIv5+OI++QkqdsJPc3uykz5fkM+OraeekcQF7X4n B5S67za5U967PmooGQhUXfF7afXyCD7ONdRe17QogYjVx38uLwtrS6nhTnm15LQUnu9E2uK6CNI/ 1HOABj0ESwOjut4FEpFQpdNAm4K2LHnDWHNcmKB2ioKBogysVZtMO2nSxUdZ8Yk2kJc7URioLVI0 YgmtIwZj4LoeKemgnOnbUdGnzZ4Oa6scqiolBGqS6RgWNLu0RMhcaE6rhhU4hiuqFXPAG8fGwTPW FKeLMtdVmXLSs5YJGF/YeVm7rREMlY3UYE+yCxbaMXX8y15m5zVHq6GOKDMynzII/jdUHdyVqIy0 ifX2+r/EgtZcvRzSb72gU9ui87M2VecjKildW/aFqaYhKoryUjfB/g4qtyVuc60xFDGmCxwjW+qu zjuwl2GkOWn66+3QiiEctvd04OVvcCVzjgT7lrkvjVGKKHmmlDUKowSeikb5kK/mJReuWOxONx+s ULsl+Lqb0CVn0SrVyJ6wt4t6yTeSCafhPhAf0OXn6L60UMxiLolFAtmN35S2Ob1lZpQ1r/n0Qb5D oQ1zJiRVDgF8N3Q8TYfbi3DyWCy3lT1nxyBs6FT3S2GOzWRlxwKvlRP0RPJA9SjxEy0UoEnkA+M4 cnzLMJrBGWLFEaaUb5lvpqbq/loOaU5+DFuHPxo82/OZuM8FXG3oVNZhtWpMpb/0Xu5m/LfLhHZQ 7yuVI0MqZ7NE43imC8jH3IwGZlbPm0xkJYs7+2U48hXTsFSMqgGDvai0kLxyynKNT/waj+q1c1tz GjOpPBgdCSq3UKZxCSsqFIY+O6JbAWGWcV1pwqLyj5sGqCF1xb1F3varUWqrJv6cN3PrUXzijtfZ FshpBL3Xwr4GIPvU2N8EjrJgS1zl21rbXQMXeXc5jjFyrhpCzijSv/RQtyPSzHCFMhlME95fHglt pRsX+dfSQjUeHAlpWzJ5iOo79Ldnaxai6bXTcGO3fp07ri7HLEmXXPlYi8bv/qVxvNcdra6m7Rlb 6JBTb5fd66VhFRjGArh2n7R1rDW4P5NOT9K0I183T2scYkeZ3q/VFyLb09U9ajzXBS8Kgkhc4mBS kYY9cy3Vy9lUnuNJH8HGIclUilwnBtjUOH0gteGOZ4c/XNrhXLSYDyxfnD8z1pDy7rYRvDolhnbe UMzxCZUs40s6s7UIvBnLgc0+vKuOkIXeOrDymlp+Zxra4MZLBbVrqD/jTJ597pDmnw5c4+DbyB88 9Cg9DodYcSuMZT/114pptqc/EuTjRPvH/z5slzI3tluOEBBLqOXLOX+0I5929tO97wkvl/atCz+y xJrdwteW2FNW/NSmBP+f/maYtVs/bYyBC7Ox3jsYZHL05CIrBa/nS+b3bHfiYm4Ueil1YZZSgAUI fFZ1dxUmeA2oQRQ3RuGXNGLFV9/XbGFGPV6kfzk1TBBCd+izc7q1H+OHMJwmaBX2IQNYVAKHYepV SSGCe6CnbYHHETKGNe43EDvFgZr0gB/nVHPHZ80VV1ojOiI3XDvYIkl4ayo4bxQIgrFXWTvBI0nH VElWMuw2aLUWCRHHf8ymVCHjFlJnOSojfevCYyyyZDH0IcvHhrsnQ5O1OsWzONuVVKIxSxiFZ/tR fKDAf6xFTnw4O9Qig2VCfW2hJQrmMOuHW0W3dLQmCMO2ccdUd/xyfflH/olTiHZVdGwb8nIwRzSE J15jFlOJuBZBZ4CiyHyd2IFylFlB+HgHhYabhWOGwYO1ZH/Og1dtQlFMk352CGRSIFTapnWQEUtN l4zv8S0aaCFDyGCBqDUxZYpxGHX01y/JuH1xhn7TOCnNCI4eKDs5WGX4R425F4vF1o3BJ4vO0otq I3rimI7jJY1jISqnBxknCIvruF83mF5wN4X7qGLIhR8A2Vg0yFERSIXn9Vv3GHy3Vj/WIkKddlYi yIMv2I/VMjTLpW7pt05SWIZR0RPyxpB4SIUM9lBPGBl0GC7oSEEwRYLe4pJpZY2P0zbI1n+Oc44w qY3PUnmF0ixjVpDD/mJ9wpOBGTVgXlaCaZiPcIWK5NiKBIiPdGaQ0TWGvAiG7nMchdZb7Vgf8zNi MuMyzRdy/lePe9iC4TRx7WhhOQI/QiSVNAmAa2lT/piFbuh7ofJoYSZzrSZ1bvmWw3eN2nKUPVky uPN5/VRfohRd0VYZoqhKIlU6TXYhJxmPUIloAwc1bPmHEpaZYZORHNlXUJM07hATwHR8MJYqkwWR WaIezFhxSFlc8/Fq82hEnpeRozg3ULhhr9lAGtVEkCg5ZNRuuVleBPaZadhG0ZgkyPmDOTOKzViM YgOcpukKqQcbjAWS0IleQ2ROjdh6A+md1qWdBRSX7iSYgFRTtRmBpJioieXJiHfJiMGIR9fJOn8I MSfXYhspn4ooSa2mSAj4n+8Bmg03fBJZoPOJgsVZRxu1oOMRPXYYjdqjihFaEoZpXBREanuJoRI6 cibFinq4ngUKh/wQd/H5ofYCZ0HJXR62opZFaAT0iFIZo4DIiUojkjeqKiuoZirKo5Y1a7AWckGa BkuYoD5lpDK6eUs6CkDqpETwl1EqpfhJpVeKpVl6EgUAADs= --BOUNDARY-- --- NEW FILE: msg_08.txt --- MIME-Version: 1.0 From: Barry Warsaw To: Dingus Lovers Subject: Lyrics Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain; charset="us-ascii" --BOUNDARY Content-Type: text/html; charset="iso-8859-1" --BOUNDARY Content-Type: text/plain; charset="iso-8859-2" --BOUNDARY Content-Type: text/plain; charset="koi8-r" --BOUNDARY-- --- NEW FILE: msg_09.txt --- MIME-Version: 1.0 From: Barry Warsaw To: Dingus Lovers Subject: Lyrics Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain; charset="us-ascii" --BOUNDARY Content-Type: text/html; charset="iso-8859-1" --BOUNDARY Content-Type: text/plain --BOUNDARY Content-Type: text/plain; charset="koi8-r" --BOUNDARY-- --- NEW FILE: msg_10.txt --- MIME-Version: 1.0 From: Barry Warsaw To: Dingus Lovers Subject: Lyrics Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This is a 7bit encoded message. --BOUNDARY Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: Quoted-Printable =A1This is a Quoted Printable encoded message! --BOUNDARY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: Base64 VGhpcyBpcyBhIEJhc2U2NCBlbmNvZGVkIG1lc3NhZ2Uu --BOUNDARY Content-Type: text/plain; charset="iso-8859-1" This has no Content-Transfer-Encoding: header. --BOUNDARY-- --- NEW FILE: msg_11.txt --- Content-Type: message/rfc822 MIME-Version: 1.0 Subject: The enclosing message Subject: An enclosed message Here is the body of the message. --- NEW FILE: msg_12.txt --- MIME-Version: 1.0 From: Barry Warsaw To: Dingus Lovers Subject: Lyrics Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain; charset="us-ascii" --BOUNDARY Content-Type: text/html; charset="iso-8859-1" --BOUNDARY Content-Type: multipart/mixed; boundary="ANOTHER" --ANOTHER Content-Type: text/plain; charset="iso-8859-2" --ANOTHER Content-Type: text/plain; charset="iso-8859-3" --ANOTHER-- --BOUNDARY Content-Type: text/plain; charset="us-ascii" --BOUNDARY Content-Type: text/plain; charset="koi8-r" --BOUNDARY-- --- NEW FILE: msg_13.txt --- MIME-Version: 1.0 From: Barry To: Dingus Lovers Subject: Here is your dingus fish Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="OUTER" --OUTER Content-Type: text/plain; charset="us-ascii" A text/plain part --OUTER Content-Type: multipart/mixed; boundary=BOUNDARY --BOUNDARY Content-Type: text/plain; charset="us-ascii" Hi there, This is the dingus fish. --BOUNDARY Content-Type: image/gif; name="dingusfish.gif" Content-Transfer-Encoding: base64 content-disposition: attachment; filename="dingusfish.gif" R0lGODdhAAEAAfAAAP///wAAACwAAAAAAAEAAQAC/oSPqcvtD6OctNqLs968+w+G4kiW5omm6sq2 7gvH8kzX9o3n+s73/g8MCofEovGITGICTKbyCV0FDNOo9SqpQqpOrJfXzTQj2vD3TGtqL+NtGQ2f qTXmxzuOd7WXdcc9DyjU53ewFni4s0fGhdiYaEhGBelICTNoV1j5NUnFcrmUqemjNifJVWpaOqaI oFq3SspZsSraE7sHq3jr1MZqWvi662vxV4tD+pvKW6aLDOCLyur8PDwbanyDeq0N3DctbQYeLDvR RY6t95m6UB0d3mwIrV7e2VGNvjjffukeJp4w7F65KecGFsTHQGAygOrgrWs1jt28Rc88KESYcGLA /obvTkH6p+CinWJiJmIMqXGQwH/y4qk0SYjgQTczT3ajKZGfuI0uJ4kkVI/DT5s3/ejkxI0aT4Y+ YTYgWbImUaXk9nlLmnSh1qJiJFl0OpUqRK4oOy7NyRQtHWofhoYVxkwWXKUSn0YsS+fUV6lhqfYb 6ayd3Z5qQdG1B7bvQzaJjwUV2lixMUZ7JVsOlfjWVr/3NB/uFvnySBN6Dcb6rGwaRM3wsormw5cC M9NxWy/bWdufudCvy8bOAjXjVVwta/uO21sE5RHBCzNFXtgq9ORtH4eYjVP4Yryo026nvkFmCeyA B29efV6ravCMK5JwWd5897Qrx7ll38o6iHDZ/rXPR//feevhF4l7wjUGX3xq1eeRfM4RSJGBIV1D z1gKPkfWag3mVBVvva1RlX5bAJTPR/2YqNtw/FkIYYEi/pIZiAdpcxpoHtmnYYoZtvhUftzdx5ZX JSKDW405zkGcZzzGZ6KEv4FI224oDmijlEf+xp6MJK5ojY/ASeVUR+wsKRuJ+XFZ5o7ZeEime8t1 ouUsU6YjF5ZtUihhkGfCdFQLWQFJ3UXxmElfhQnR+eCdcDbkFZp6vTRmj56ApCihn5QGpaToNZmR n3NVSpZcQpZ2KEONusaiCsKAug0wkQbJSFO+PTSjneGxOuFjPlUk3ovWvdIerjUg9ZGIOtGq/qeX eCYrrCX+1UPsgTKGGRSbzd5q156d/gpfbJxe66eD5iQKrXj7RGgruGxs62qebBHUKS32CKluCiqZ qh+pmehmEb71noAUoe5e9Zm17S7773V10pjrtG4CmuurCV/n6zLK5turWNhqOvFXbjhZrMD0YhKe wR0zOyuvsh6MWrGoIuzvyWu5y1WIFAqmJselypxXh6dKLNOKEB98L88bS2rkNqqlKzCNJp9c0G0j Gzh0iRrCbHSXmPR643QS+4rWhgFmnSbSuXCjS0xAOWkU2UdLqyuUNfHSFdUouy3bm5i5GnDM3tG8 doJ4r5tqu3pPbRSVfvs8uJzeNXhp3n4j/tZ42SwH7eaWUUOjc3qFV9453UHTXZfcLH+OeNs5g36x lBnHvTm7EbMbLeuaLncao8vWCXimfo1o+843Ak6y4ChNeGntvAYvfLK4ezmoyNIbNCLTCXO9ZV3A E8/s88RczPzDwI4Ob7XZyl7+9Miban29h+tJZPrE21wgvBphDfrrfPdCTPKJD/y98L1rZwHcV6Jq Zab0metpuNIX/qAFPoz171WUaUb4HAhBSzHuHfjzHb3kha/2Cctis/ORArVHNYfFyYRH2pYIRzic isVOfPWD1b6mRTqpCRBozzof6UZVvFXRxWIr3GGrEviGYgyPMfahheiSaLs/9QeFu7oZ/ndSY8DD ya9x+uPed+7mxN2IzIISBOMLFYWVqC3Pew1T2nFuuCiwZS5/v6II10i4t1OJcUH2U9zxKodHsGGv Oa+zkvNUYUOa/TCCRutF9MzDwdlUMJADTCGSbDQ5OV4PTamDoPEi6Ecc/RF5RWwkcdSXvSOaDWSn I9LlvubFTQpuc6JKXLcKeb+xdbKRBnwREemXyjg6ME65aJiOuBgrktzykfPLJBKR9ClMavJ62/Ff BlNIyod9yX9wcSXexnXFpvkrbXk64xsx5Db7wXKP5fSgsvwIMM/9631VLBfkmtbHRXpqmtei52hG pUwSlo+BASQoeILDOBgREECxBBh5/iYmNsQ9dIv5+OI++QkqdsJPc3uykz5fkM+OraeekcQF7X4n B5S67za5U967PmooGQhUXfF7afXyCD7ONdRe17QogYjVx38uLwtrS6nhTnm15LQUnu9E2uK6CNI/ 1HOABj0ESwOjut4FEpFQpdNAm4K2LHnDWHNcmKB2ioKBogysVZtMO2nSxUdZ8Yk2kJc7URioLVI0 YgmtIwZj4LoeKemgnOnbUdGnzZ4Oa6scqiolBGqS6RgWNLu0RMhcaE6rhhU4hiuqFXPAG8fGwTPW FKeLMtdVmXLSs5YJGF/YeVm7rREMlY3UYE+yCxbaMXX8y15m5zVHq6GOKDMynzII/jdUHdyVqIy0 ifX2+r/EgtZcvRzSb72gU9ui87M2VecjKildW/aFqaYhKoryUjfB/g4qtyVuc60xFDGmCxwjW+qu zjuwl2GkOWn66+3QiiEctvd04OVvcCVzjgT7lrkvjVGKKHmmlDUKowSeikb5kK/mJReuWOxONx+s ULsl+Lqb0CVn0SrVyJ6wt4t6yTeSCafhPhAf0OXn6L60UMxiLolFAtmN35S2Ob1lZpQ1r/n0Qb5D oQ1zJiRVDgF8N3Q8TYfbi3DyWCy3lT1nxyBs6FT3S2GOzWRlxwKvlRP0RPJA9SjxEy0UoEnkA+M4 cnzLMJrBGWLFEaaUb5lvpqbq/loOaU5+DFuHPxo82/OZuM8FXG3oVNZhtWpMpb/0Xu5m/LfLhHZQ 7yuVI0MqZ7NE43imC8jH3IwGZlbPm0xkJYs7+2U48hXTsFSMqgGDvai0kLxyynKNT/waj+q1c1tz GjOpPBgdCSq3UKZxCSsqFIY+O6JbAWGWcV1pwqLyj5sGqCF1xb1F3varUWqrJv6cN3PrUXzijtfZ FshpBL3Xwr4GIPvU2N8EjrJgS1zl21rbXQMXeXc5jjFyrhpCzijSv/RQtyPSzHCFMhlME95fHglt pRsX+dfSQjUeHAlpWzJ5iOo79Ldnaxai6bXTcGO3fp07ri7HLEmXXPlYi8bv/qVxvNcdra6m7Rlb 6JBTb5fd66VhFRjGArh2n7R1rDW4P5NOT9K0I183T2scYkeZ3q/VFyLb09U9ajzXBS8Kgkhc4mBS kYY9cy3Vy9lUnuNJH8HGIclUilwnBtjUOH0gteGOZ4c/XNrhXLSYDyxfnD8z1pDy7rYRvDolhnbe UMzxCZUs40s6s7UIvBnLgc0+vKuOkIXeOrDymlp+Zxra4MZLBbVrqD/jTJ597pDmnw5c4+DbyB88 9Cg9DodYcSuMZT/114pptqc/EuTjRPvH/z5slzI3tluOEBBLqOXLOX+0I5929tO97wkvl/atCz+y xJrdwteW2FNW/NSmBP+f/maYtVs/bYyBC7Ox3jsYZHL05CIrBa/nS+b3bHfiYm4Ueil1YZZSgAUI fFZ1dxUmeA2oQRQ3RuGXNGLFV9/XbGFGPV6kfzk1TBBCd+izc7q1H+OHMJwmaBX2IQNYVAKHYepV SSGCe6CnbYHHETKGNe43EDvFgZr0gB/nVHPHZ80VV1ojOiI3XDvYIkl4ayo4bxQIgrFXWTvBI0nH VElWMuw2aLUWCRHHf8ymVCHjFlJnOSojfevCYyyyZDH0IcvHhrsnQ5O1OsWzONuVVKIxSxiFZ/tR fKDAf6xFTnw4O9Qig2VCfW2hJQrmMOuHW0W3dLQmCMO2ccdUd/xyfflH/olTiHZVdGwb8nIwRzSE J15jFlOJuBZBZ4CiyHyd2IFylFlB+HgHhYabhWOGwYO1ZH/Og1dtQlFMk352CGRSIFTapnWQEUtN l4zv8S0aaCFDyGCBqDUxZYpxGHX01y/JuH1xhn7TOCnNCI4eKDs5WGX4R425F4vF1o3BJ4vO0otq I3rimI7jJY1jISqnBxknCIvruF83mF5wN4X7qGLIhR8A2Vg0yFERSIXn9Vv3GHy3Vj/WIkKddlYi yIMv2I/VMjTLpW7pt05SWIZR0RPyxpB4SIUM9lBPGBl0GC7oSEEwRYLe4pJpZY2P0zbI1n+Oc44w qY3PUnmF0ixjVpDD/mJ9wpOBGTVgXlaCaZiPcIWK5NiKBIiPdGaQ0TWGvAiG7nMchdZb7Vgf8zNi MuMyzRdy/lePe9iC4TRx7WhhOQI/QiSVNAmAa2lT/piFbuh7ofJoYSZzrSZ1bvmWw3eN2nKUPVky uPN5/VRfohRd0VYZoqhKIlU6TXYhJxmPUIloAwc1bPmHEpaZYZORHNlXUJM07hATwHR8MJYqkwWR WaIezFhxSFlc8/Fq82hEnpeRozg3ULhhr9lAGtVEkCg5ZNRuuVleBPaZadhG0ZgkyPmDOTOKzViM YgOcpukKqQcbjAWS0IleQ2ROjdh6A+md1qWdBRSX7iSYgFRTtRmBpJioieXJiHfJiMGIR9fJOn8I MSfXYhspn4ooSa2mSAj4n+8Bmg03fBJZoPOJgsVZRxu1oOMRPXYYjdqjihFaEoZpXBREanuJoRI6 cibFinq4ngUKh/wQd/H5ofYCZ0HJXR62opZFaAT0iFIZo4DIiUojkjeqKiuoZirKo5Y1a7AWckGa BkuYoD5lpDK6eUs6CkDqpETwl1EqpfhJpVeKpVl6EgUAADs= --BOUNDARY-- --OUTER-- --- NEW FILE: msg_14.txt --- Return-Path: Delivered-To: bbb@zzz.org Received: by mail.zzz.org (Postfix, from userid 889) id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) MIME-Version: 1.0 Content-Type: text; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15090.61304.110929.45684@aaa.zzz.org> From: bbb@ddd.com (John X. Doe) To: bbb@zzz.org Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 Hi, I'm sorry but I'm using a drainbread ISP, which although big and wealthy can't seem to generate standard compliant email. :( This message has a Content-Type: header with no subtype. I hope you can still read it. -Me --- NEW FILE: msg_15.txt --- Return-Path: Received: from fepD.post.tele.dk (195.41.46.149) by mail.groupcare.dk (LSMTP for Windows NT v1.1b) with SMTP id <0.0014F8A2@mail.groupcare.dk>; Mon, 30 Apr 2001 12:17:50 +0200 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2106 Subject: XX From: xx@xx.dk To: XX Message-ID: Mime-version: 1.0 Content-type: multipart/mixed; boundary="MS_Mac_OE_3071477847_720252_MIME_Part" > Denne meddelelse er i MIME-format. Da dit postl¾sningsprogram ikke forstŒr dette format, kan del af eller hele meddelelsen v¾re ul¾selig. --MS_Mac_OE_3071477847_720252_MIME_Part Content-type: multipart/alternative; boundary="MS_Mac_OE_3071477847_720252_MIME_Part" --MS_Mac_OE_3071477847_720252_MIME_Part Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable Some removed test. --MS_Mac_OE_3071477847_720252_MIME_Part Content-type: text/html; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable Some removed HTML Some removed text. --MS_Mac_OE_3071477847_720252_MIME_Part-- --MS_Mac_OE_3071477847_720252_MIME_Part Content-type: image/gif; name="xx.gif"; x-mac-creator="6F676C65"; x-mac-type="47494666" Content-disposition: attachment Content-transfer-encoding: base64 Some removed base64 encoded chars. --MS_Mac_OE_3071477847_720252_MIME_Part-- --- NEW FILE: msg_16.txt --- Return-Path: <> Delivered-To: scr-admin@socal-raves.org Received: from cougar.noc.ucla.edu (cougar.noc.ucla.edu [169.232.10.18]) by babylon.socal-raves.org (Postfix) with ESMTP id CCC2C51B84 for ; Sun, 23 Sep 2001 20:13:54 -0700 (PDT) Received: from sims-ms-daemon by cougar.noc.ucla.edu (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) id <0GK500B01D0B8Y@cougar.noc.ucla.edu> for scr-admin@socal-raves.org; Sun, 23 Sep 2001 20:14:35 -0700 (PDT) Received: from cougar.noc.ucla.edu (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) id <0GK500B01D0B8X@cougar.noc.ucla.edu>; Sun, 23 Sep 2001 20:14:35 -0700 (PDT) Date: Sun, 23 Sep 2001 20:14:35 -0700 (PDT) From: Internet Mail Delivery Subject: Delivery Notification: Delivery has failed To: scr-admin@socal-raves.org Message-id: <0GK500B04D0B8X@cougar.noc.ucla.edu> MIME-version: 1.0 Sender: scr-owner@socal-raves.org Errors-To: scr-owner@socal-raves.org X-BeenThere: scr@socal-raves.org X-Mailman-Version: 2.1a3 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: SoCal-Raves List-Unsubscribe: , List-Archive: Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)" --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) Content-type: text/plain; charset=ISO-8859-1 This report relates to a message you sent with the following header fields: Message-id: <002001c144a6$8752e060$56104586@oxy.edu> Date: Sun, 23 Sep 2001 20:10:55 -0700 From: "Ian T. Henry" To: SoCal Raves Subject: [scr] yeah for Ians!! Your message cannot be delivered to the following recipients: Recipient address: jangel1@cougar.noc.ucla.edu Reason: recipient reached disk quota --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) Content-type: message/DELIVERY-STATUS Original-envelope-id: 0GK500B4HD0888@cougar.noc.ucla.edu Reporting-MTA: dns; cougar.noc.ucla.edu Action: failed Status: 5.0.0 (recipient reached disk quota) Original-recipient: rfc822;jangel1@cougar.noc.ucla.edu Final-recipient: rfc822;jangel1@cougar.noc.ucla.edu --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) Content-type: MESSAGE/RFC822 Return-path: scr-admin@socal-raves.org Received: from sims-ms-daemon by cougar.noc.ucla.edu (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) id <0GK500B01D0B8X@cougar.noc.ucla.edu>; Sun, 23 Sep 2001 20:14:35 -0700 (PDT) Received: from panther.noc.ucla.edu by cougar.noc.ucla.edu (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) with ESMTP id <0GK500B4GD0888@cougar.noc.ucla.edu> for jangel1@sims-ms-daemon; Sun, 23 Sep 2001 20:14:33 -0700 (PDT) Received: from babylon.socal-raves.org (ip-209-85-222-117.dreamhost.com [209.85.222.117]) by panther.noc.ucla.edu (8.9.1a/8.9.1) with ESMTP id UAA09793 for ; Sun, 23 Sep 2001 20:14:32 -0700 (PDT) Received: from babylon (localhost [127.0.0.1]) by babylon.socal-raves.org (Postfix) with ESMTP id D3B2951B70; Sun, 23 Sep 2001 20:13:47 -0700 (PDT) Received: by babylon.socal-raves.org (Postfix, from userid 60001) id A611F51B82; Sun, 23 Sep 2001 20:13:46 -0700 (PDT) Received: from tiger.cc.oxy.edu (tiger.cc.oxy.edu [134.69.3.112]) by babylon.socal-raves.org (Postfix) with ESMTP id ADA7351B70 for ; Sun, 23 Sep 2001 20:13:44 -0700 (PDT) Received: from ent (n16h86.dhcp.oxy.edu [134.69.16.86]) by tiger.cc.oxy.edu (8.8.8/8.8.8) with SMTP id UAA08100 for ; Sun, 23 Sep 2001 20:14:24 -0700 (PDT) Date: Sun, 23 Sep 2001 20:10:55 -0700 From: "Ian T. Henry" Subject: [scr] yeah for Ians!! Sender: scr-admin@socal-raves.org To: SoCal Raves Errors-to: scr-admin@socal-raves.org Message-id: <002001c144a6$8752e060$56104586@oxy.edu> MIME-version: 1.0 X-Mailer: Microsoft Outlook Express 5.50.4522.1200 Content-type: text/plain; charset=us-ascii Precedence: bulk Delivered-to: scr-post@babylon.socal-raves.org Delivered-to: scr@socal-raves.org X-Converted-To-Plain-Text: from multipart/alternative by demime 0.98e X-Converted-To-Plain-Text: Alternative section used was text/plain X-BeenThere: scr@socal-raves.org X-Mailman-Version: 2.1a3 List-Help: List-Post: List-Subscribe: , List-Id: SoCal-Raves List-Unsubscribe: , List-Archive: I always love to find more Ian's that are over 3 years old!! Ian _______________________________________________ For event info, list questions, or to unsubscribe, see http://www.socal-raves.org/ --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)-- --- NEW FILE: msg_17.txt --- MIME-Version: 1.0 From: Barry To: Dingus Lovers Subject: Here is your dingus fish Date: Fri, 20 Apr 2001 19:35:02 -0400 Content-Type: multipart/mixed; boundary="BOUNDARY" Hi there, This is the dingus fish. [Non-text (image/gif) part of message omitted, filename dingusfish.gif] --- NEW FILE: msg_18.txt --- Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" --- NEW FILE: msg_19.txt --- Send Ppp mailing list submissions to ppp@zzz.org To subscribe or unsubscribe via the World Wide Web, visit http://www.zzz.org/mailman/listinfo/ppp or, via email, send a message with subject or body 'help' to ppp-request@zzz.org You can reach the person managing the list at ppp-admin@zzz.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Ppp digest..." Today's Topics: 1. testing #1 (Barry A. Warsaw) 2. testing #2 (Barry A. Warsaw) 3. testing #3 (Barry A. Warsaw) 4. testing #4 (Barry A. Warsaw) 5. testing #5 (Barry A. Warsaw) hello hello hello hello hello _______________________________________________ Ppp mailing list Ppp@zzz.org http://www.zzz.org/mailman/listinfo/ppp --- NEW FILE: msg_20.txt --- Return-Path: Delivered-To: bbb@zzz.org Received: by mail.zzz.org (Postfix, from userid 889) id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15090.61304.110929.45684@aaa.zzz.org> From: bbb@ddd.com (John X. Doe) To: bbb@zzz.org Cc: ccc@zzz.org CC: ddd@zzz.org cc: eee@zzz.org Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 Hi, Do you like this message? -Me --- NEW FILE: msg_21.txt --- 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-- End of MIME message --- NEW FILE: msg_22.txt --- Mime-Version: 1.0 Message-Id: Date: Tue, 16 Oct 2001 13:59:25 +0300 To: a@example.com From: b@example.com Content-Type: multipart/mixed; boundary="============_-1208892523==_============" --============_-1208892523==_============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" Text text text. --============_-1208892523==_============ Content-Id: Content-Type: image/jpeg; name="wibble.JPG" ; x-mac-type="4A504547" ; x-mac-creator="474B4F4E" Content-Disposition: attachment; filename="wibble.JPG" Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAALCAXABIEBAREA g6bCjjw/pIZSjO6FWFpldjySOmCNrO7DBZibUXhTwtCixw+GtAijVdqxxaPp0aKvmGXa qrbBQvms0mAMeYS/3iTV1dG0hHaRNK01XblnWxtVdjkHLMIgTyqnk9VB7CrP2KzIINpa 4O7I+zxYO9WV8jZg71Zlb+8rMDkEirAVQFAUAKAFAAAUAYAUDgADgY6DjpRtXj5RxjHA 4wQRj0wQCMdCAewpaKKK/9k= --============_-1208892523==_============ Content-Id: Content-Type: image/jpeg; name="wibble2.JPG" ; x-mac-type="4A504547" ; x-mac-creator="474B4F4E" Content-Disposition: attachment; filename="wibble2.JPG" Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAALCAXABJ0BAREA /8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA W6NFJJBEkU10kKGTcWMDwxuU+0JHvk8qAtOpNwqSR0n8c3BlDyXHlqsUltHEiTvdXLxR 7vMiGDNJAJWkAMk8ZkCFp5G2oo5W++INrbQtNfTQxJAuXlupz9oS4d5Y1W+E2XlWZJJE Y7LWYQxTLE1zuMbfBPxw8X2fibVdIbSbI6nLZxX635t9TjtYreWR7WGKJTLJFFKSlozO 0ShxIXM43uC3/9k= --============_-1208892523==_============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" Text text text. --============_-1208892523==_============-- --- NEW FILE: msg_23.txt --- From: aperson@dom.ain Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY Content-Type: text/plain A message part --BOUNDARY-- --- NEW FILE: msg_24.txt --- Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: aperson@dom.ain From: bperson@dom.ain --BOUNDARY --BOUNDARY-- --- NEW FILE: msg_25.txt --- >From MAILER-DAEMON Fri Apr 06 16:46:09 2001 Received: from [204.245.199.98] (helo=zinfandel.lacita.com) by www.linux.org.uk with esmtp (Exim 3.13 #1) id 14lYR6-0008Iv-00 for linuxuser-admin@www.linux.org.uk; Fri, 06 Apr 2001 16:46:09 +0100 Received: from localhost (localhost) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with internal id JAB03225; Fri, 6 Apr 2001 09:23:06 -0800 (GMT-0800) Date: Fri, 6 Apr 2001 09:23:06 -0800 (GMT-0800) From: Mail Delivery Subsystem Subject: Returned mail: Too many hops 19 (17 max): from via [199.164.235.226], to Message-Id: <200104061723.JAB03225@zinfandel.lacita.com> To: To: postmaster@zinfandel.lacita.com MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; bo Auto-Submitted: auto-generated (failure) This is a MIME-encapsulated message --JAB03225.986577786/zinfandel.lacita.com The original message was received at Fri, 6 Apr 2001 09:23:03 -0800 (GMT-0800) from [199.164.235.226] ----- The following addresses have delivery notifications ----- (unrecoverable error) ----- Transcript of session follows ----- 554 Too many hops 19 (17 max): from via [199.164.235.226], to --JAB03225.986577786/zinfandel.lacita.com Content-Type: message/delivery-status Reporting-MTA: dns; zinfandel.lacita.com Received-From-MTA: dns; [199.164.235.226] Arrival-Date: Fri, 6 Apr 2001 09:23:03 -0800 (GMT-0800) Final-Recipient: rfc822; scoffman@wellpartner.com Action: failed Status: 5.4.6 Last-Attempt-Date: Fri, 6 Apr 2001 09:23:06 -0800 (GMT-0800) --JAB03225.986577786/zinfandel.lacita.com Content-Type: text/rfc822-headers Return-Path: linuxuser-admin@www.linux.org.uk Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03225 for ; Fri, 6 Apr 2001 09:23:03 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03221 for ; Fri, 6 Apr 2001 09:22:18 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03217 for ; Fri, 6 Apr 2001 09:21:37 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03213 for ; Fri, 6 Apr 2001 09:20:56 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03209 for ; Fri, 6 Apr 2001 09:20:15 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03205 for ; Fri, 6 Apr 2001 09:19:33 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03201 for ; Fri, 6 Apr 2001 09:18:52 -0800 (GMT-0800) Received: from zinfandel.lacita.com ([204.245.199.98]) by fo Received: from ns1.wellpartner.net ([199.164.235.226]) by zinfandel.lacita.com (8.7.3/8.6.10-MT4.00) with ESMTP id JAA03197 for ; Fri, 6 Apr 2001 09:17:54 -0800 (GMT-0800) Received: from www.linux.org.uk (parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by fo Received: from localhost.localdomain ([ by id Received: from [212.1.130.11] (helo=s1.uklinux.net ident=root) by id fo Received: from server (ppp-2-22.cvx4.telinco.net [212.1.149.22]) by fo From: Daniel James Organization: LinuxUser To: linuxuser@www.linux.org.uk X-Mailer: KMail [version 1.1.99] Content-Type: text/plain; c MIME-Version: 1.0 Message-Id: <01040616033903.00962@server> Content-Transfer-Encoding: 8bit Subject: [LinuxUser] bulletin no. 45 Sender: linuxuser-admin@www.linux.org.uk Errors-To: linuxuser-admin@www.linux.org.uk X-BeenThere: linuxuser@www.linux.org.uk X-Mailman-Version: 2.0.3 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , Date: Fri, 6 Apr 2001 16:03:39 +0100 --JAB03225.986577786/zinfandel.lacita.com-- --- NEW FILE: msg_26.txt --- Received: from xcar [192.168.0.2] by jeeves.wooster.local (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 Date: Sun, 12 May 2002 08:56:15 +0100 From: Father Time To: timbo@jeeves.wooster.local Subject: IMAP file test Message-ID: <6df65d354b.father.time@rpc.wooster.local> X-Organization: Home User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" Status: R X-UIDL: 319998302 This message is in MIME format which your mailer apparently does not support. You either require a newer version of your software which supports MIME, or a separate MIME decoding utility. Alternatively, ask the sender of this message to resend it in a different format. --1618492860--2051301190--113853680 Content-Type: text/plain; charset=us-ascii Simple email with attachment. --1618492860--2051301190--113853680 Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 Content-Disposition: attachment; filename="clock.bmp" Content-Transfer-Encoding: base64 Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// ////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// 8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA AAAAAAAIAAAAAAAAAIAAAAAA --1618492860--2051301190--113853680-- --- NEW FILE: msg_27.txt --- Return-Path: Received: by mail.dom.ain (Postfix, from userid 889) id B9D0AD35DB; Tue, 4 Jun 2002 21:46:59 -0400 (EDT) Message-ID: <15613.28051.707126.569693@dom.ain> Date: Tue, 4 Jun 2002 21:46:59 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: bug demonstration 12345678911234567892123456789312345678941234567895123456789612345678971234567898112345678911234567892123456789112345678911234567892123456789 more text From: aperson@dom.ain (Anne P. Erson) To: bperson@dom.ain (Barney P. Erson) test --- NEW FILE: msg_28.txt --- From: aperson@dom.ain MIME-Version: 1.0 Content-Type: multipart/digest; boundary=BOUNDARY --BOUNDARY Content-Type: message/rfc822 Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 1 --BOUNDARY Content-Type: message/rfc822 Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 2 --BOUNDARY-- --- NEW FILE: msg_29.txt --- Return-Path: Delivered-To: bbb@zzz.org Received: by mail.zzz.org (Postfix, from userid 889) id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; title*0*="us-ascii'en'This%20is%20even%20more%20"; title*1*="%2A%2A%2Afun%2A%2A%2A%20"; title*2="isn't it!" Content-Transfer-Encoding: 7bit Message-ID: <15090.61304.110929.45684@aaa.zzz.org> From: bbb@ddd.com (John X. Doe) To: bbb@zzz.org Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 Hi, Do you like this message? -Me --- NEW FILE: msg_30.txt --- From: aperson@dom.ain MIME-Version: 1.0 Content-Type: multipart/digest; boundary=BOUNDARY --BOUNDARY Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 1 --BOUNDARY Content-Type: text/plain; charset=us-ascii To: aa@bb.org From: cc@dd.org Subject: ee message 2 --BOUNDARY-- From bwarsaw@users.sourceforge.net Fri Jul 19 23:31:12 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:31:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.40,1.41 test_email_codecs.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9854/test Modified Files: test_email.py test_email_codecs.py Log Message: The email package's tests live much better in a subpackage (i.e. email.test), so move the guts of them here from Lib/test. The latter directory will retain stubs to run the email.test tests using Python's standard regression test. test_email_torture.py is a torture tester which will not run under Python's test suite because I don't want to commit megs of data to that project (it will fail cleanly there). When run under the mimelib project it'll stress test the package with megs of message samples collected from various locations in the wild. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_email.py 9 Jul 2002 16:36:36 -0000 1.40 --- test_email.py 19 Jul 2002 22:31:09 -0000 1.41 *************** *** 2,1988 **** # 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 [...1964 lines suppressed...] ! ! def suite(): ! suite = unittest.TestSuite() ! for testclass in _testclasses(): ! suite.addTest(unittest.makeSuite(testclass)) ! return suite ! ! ! def test_main(): ! for testclass in _testclasses(): ! test_support.run_unittest(testclass) --- 2,7 ---- # email package unit tests ! # The specific tests now live in Lib/email/test ! from email.test.test_email import * Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/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 28 Jun 2002 23:49:33 -0000 1.3 --- test_email_codecs.py 19 Jul 2002 22:31:10 -0000 1.4 *************** *** 2,67 **** # email package unit tests for (optional) Asian codecs ! import unittest ! import test_support ! from test_email import TestEmailBase ! ! from email.Charset import Charset ! from email.Header import Header, decode_header ! ! # See if we have the Japanese codecs package installed ! try: ! unicode('foo', 'japanese.iso-2022-jp') ! except LookupError: ! raise test_support.TestSkipped, 'Optional Japanese codecs not installed' ! ! ! ! class TestEmailAsianCodecs(TestEmailBase): ! def test_japanese_codecs(self): ! eq = self.ndiffAssertEqual ! j = Charset("euc-jp") ! g = Charset("iso-8859-1") ! h = Header("Hello World!") ! jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa' ! ghello = 'Gr\xfc\xdf Gott!' ! 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), ! ('\x1b$B%O%m!<%o!<%k%I!*\x1b(B', 'iso-2022-jp'), ! ('Gr\xfc\xdf Gott!', 'iso-8859-1')]) ! long = 'test-ja \xa4\xd8\xc5\xea\xb9\xc6\xa4\xb5\xa4\xec\xa4\xbf\xa5\xe1\xa1\xbc\xa5\xeb\xa4\xcf\xbb\xca\xb2\xf1\xbc\xd4\xa4\xce\xbe\xb5\xc7\xa7\xa4\xf2\xc2\xd4\xa4\xc3\xa4\xc6\xa4\xa4\xa4\xde\xa4\xb9' ! h = Header(long, j, header_name="Subject") ! # 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')]) ! ! ! ! def suite(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestEmailAsianCodecs)) ! return suite ! ! ! def test_main(): ! test_support.run_unittest(TestEmailAsianCodecs) --- 2,7 ---- # email package unit tests for (optional) Asian codecs ! # The specific tests now live in Lib/email/test ! from email.test.test_email_codecs import * From bwarsaw@users.sourceforge.net Fri Jul 19 23:44:15 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:44:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12945 Modified Files: test_email.py Log Message: Shut the test up and add a missing import Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_email.py 19 Jul 2002 22:31:09 -0000 1.41 --- test_email.py 19 Jul 2002 22:44:12 -0000 1.42 *************** *** 2,7 **** # email package unit tests # The specific tests now live in Lib/email/test ! from email.test.test_email import * --- 2,8 ---- # email package unit tests + import unittest # The specific tests now live in Lib/email/test ! from email.test.test_email import suite From bwarsaw@users.sourceforge.net Fri Jul 19 23:44:25 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 19 Jul 2002 15:44:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_email_codecs.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12983 Modified Files: test_email_codecs.py Log Message: Shut the test up and add a missing import Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email_codecs.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_email_codecs.py 19 Jul 2002 22:31:10 -0000 1.4 --- test_email_codecs.py 19 Jul 2002 22:44:23 -0000 1.5 *************** *** 2,7 **** # email package unit tests for (optional) Asian codecs # The specific tests now live in Lib/email/test ! from email.test.test_email_codecs import * --- 2,8 ---- # email package unit tests for (optional) Asian codecs + import unittest # The specific tests now live in Lib/email/test ! from email.test.test_email_codecs import suite From gvanrossum@users.sourceforge.net Sat Jul 20 01:36:41 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 17:36:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gettext.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26594 Modified Files: test_gettext.py Log Message: Move the setting of os.environ['LANGUAGE'] to setup(), and reset it to 'en' in teardown(). This way hopefully test_time.py won't fail. Index: test_gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gettext.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_gettext.py 28 Aug 2001 21:26:33 -0000 1.9 --- test_gettext.py 20 Jul 2002 00:36:38 -0000 1.10 *************** *** 8,12 **** # Test basic interface - os.environ['LANGUAGE'] = 'xx' print 'installing gettext' --- 8,11 ---- *************** *** 133,138 **** --- 132,139 ---- fp.write(base64.decodestring(GNU_MO_DATA)) fp.close() + os.environ['LANGUAGE'] = 'xx' def teardown(): + os.environ['LANGUAGE'] = 'en' os.unlink(MOFILE) os.removedirs(LOCALEDIR) From gvanrossum@users.sourceforge.net Sat Jul 20 01:38:03 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 19 Jul 2002 17:38:03 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv26740 Modified Files: _hotshot.c Log Message: unpack_string(): avoid a compiler warning (about a real bug!) by copying the result of fgetc() into an int variable before testing it for EOF. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** _hotshot.c 18 Jul 2002 19:11:44 -0000 1.23 --- _hotshot.c 20 Jul 2002 00:38:01 -0000 1.24 *************** *** 306,309 **** --- 306,310 ---- int len; int err; + int ch; char *buf; *************** *** 313,317 **** buf = malloc(len); for (i=0; i < len; i++) { ! if ((buf[i] = fgetc(self->logfp)) == EOF) { free(buf); return ERR_EOF; --- 314,320 ---- buf = malloc(len); for (i=0; i < len; i++) { ! ch = fgetc(self->logfp); ! buf[i] = ch; ! if (ch == EOF) { free(buf); return ERR_EOF; From nnorwitz@users.sourceforge.net Sat Jul 20 01:46:14 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 19 Jul 2002 17:46:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libimaplib.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27716/Doc/lib Modified Files: libimaplib.tex Log Message: add versionadded to doc Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** libimaplib.tex 17 Jun 2002 07:07:20 -0000 1.20 --- libimaplib.tex 20 Jul 2002 00:46:12 -0000 1.21 *************** *** 178,181 **** --- 178,182 ---- Get the \samp{quota} \var{root}'s resource usage and limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087. + \versionadded{2.3} \end{methoddesc} *************** *** 183,186 **** --- 184,188 ---- Get the list of \samp{quota} \samp{roots} for the named \var{mailbox}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. + \versionadded{2.3} \end{methoddesc} *************** *** 287,290 **** --- 289,293 ---- Set the \samp{quota} \var{root}'s resource \var{limits}. This method is part of the IMAP4 QUOTA extension defined in rfc2087. + \versionadded{2.3} \end{methoddesc} From tim_one@users.sourceforge.net Sat Jul 20 05:21:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 19 Jul 2002 21:21:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/test sortperf.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22393/python/lib/test Modified Files: sortperf.py Log Message: Added new test "3sort". This is sorted data but with 3 random exchanges. It's a little better than average for our sort. Index: sortperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/sortperf.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sortperf.py 18 Jul 2002 15:53:32 -0000 1.8 --- sortperf.py 20 Jul 2002 04:21:51 -0000 1.9 *************** *** 75,78 **** --- 75,79 ---- \sort: descending data /sort: ascending data + 3sort: ascending data but with 3 random exchanges ~sort: many duplicates =sort: all equal *************** *** 80,84 **** """ ! cases = ("*sort", "\\sort", "/sort", "~sort", "=sort", "!sort") fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) --- 81,85 ---- """ ! cases = ("*sort", "\\sort", "/sort", "3sort", "~sort", "=sort", "!sort") fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) *************** *** 92,95 **** --- 93,103 ---- doit(L) # \sort doit(L) # /sort + + # Do 3 random exchanges. + for dummy in range(3): + i1 = random.randrange(n) + i2 = random.randrange(n) + L[i1], L[i2] = L[i2], L[i1] + doit(L) # 3sort # Arrange for lots of duplicates. From loewis@users.sourceforge.net Sat Jul 20 09:51:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 20 Jul 2002 01:51:55 -0700 Subject: [Python-checkins] python/dist/src/Include Python.h,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17988/Include Modified Files: Python.h Log Message: Define _XOPEN_SOURCE and _GNU_SOURCE in pyconfig.h, to have them available in the configure tests already. Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** Python.h 18 Jul 2002 22:39:34 -0000 2.55 --- Python.h 20 Jul 2002 08:51:52 -0000 2.56 *************** *** 3,17 **** /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ - - /* Enable compiler features; switching on C lib defines doesn't work - here, because the symbols haven't necessarily been defined yet. */ - #ifndef _GNU_SOURCE - # define _GNU_SOURCE 1 - #endif - - #ifndef _XOPEN_SOURCE - # define _XOPEN_SOURCE 500 - #endif - /* Include nearly all Python header files */ --- 3,6 ---- From loewis@users.sourceforge.net Sat Jul 20 09:51:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 20 Jul 2002 01:51:55 -0700 Subject: [Python-checkins] python/dist/src configure,1.323,1.324 configure.in,1.334,1.335 pyconfig.h.in,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17988 Modified Files: configure configure.in pyconfig.h.in Log Message: Define _XOPEN_SOURCE and _GNU_SOURCE in pyconfig.h, to have them available in the configure tests already. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.323 retrieving revision 1.324 diff -C2 -d -r1.323 -r1.324 *** configure 19 Jul 2002 19:32:26 -0000 1.323 --- configure 20 Jul 2002 08:51:51 -0000 1.324 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.333 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.334 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 1225,1228 **** --- 1225,1245 ---- SOVERSION=1.0 + + # The later defininition of _XOPEN_SOURCE disables certain features + # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). + + cat >>confdefs.h <<\_ACEOF + #define _GNU_SOURCE 1 + _ACEOF + + + # The definition of _GNU_SOURCE potentially causes a change of the value + # of _XOPEN_SOURCE. So define it only conditionally. + + + cat >>confdefs.h <<\_ACEOF + #define _XOPEN_SOURCE 500 + _ACEOF + # Arguments passed to configure. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.334 retrieving revision 1.335 diff -C2 -d -r1.334 -r1.335 *** configure.in 19 Jul 2002 19:32:30 -0000 1.334 --- configure.in 20 Jul 2002 08:51:52 -0000 1.335 *************** *** 21,24 **** --- 21,37 ---- SOVERSION=1.0 + # The later defininition of _XOPEN_SOURCE disables certain features + # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). + AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) + + # The definition of _GNU_SOURCE potentially causes a change of the value + # of _XOPEN_SOURCE. So define it only conditionally. + AH_VERBATIM([_XOPEN_SOURCE], + [/* Define on UNIX to activate XPG/5 features. */ + #ifndef _XOPEN_SOURCE + # define _XOPEN_SOURCE 500 + #endif]) + AC_DEFINE(_XOPEN_SOURCE, 500) + # Arguments passed to configure. AC_SUBST(CONFIG_ARGS) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** pyconfig.h.in 19 Jul 2002 19:32:30 -0000 1.44 --- pyconfig.h.in 20 Jul 2002 08:51:52 -0000 1.45 *************** *** 755,758 **** --- 755,761 ---- #undef _FILE_OFFSET_BITS + /* Define on Linux to activate all library features */ + #undef _GNU_SOURCE + /* This must be defined on some systems to enable large file support. */ #undef _LARGEFILE_SOURCE *************** *** 773,776 **** --- 776,784 ---- /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT + + /* Define on UNIX to activate XPG/5 features. */ + #ifndef _XOPEN_SOURCE + # define _XOPEN_SOURCE 500 + #endif /* Define to 1 if type `char' is unsigned and you are not using gcc. */ From akuchling@users.sourceforge.net Sat Jul 20 12:31:33 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 20 Jul 2002 04:31:33 -0700 Subject: [Python-checkins] python/nondist/sandbox/parrot parrot-gen.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/parrot In directory usw-pr-cvs1:/tmp/cvs-serv18180 Modified Files: parrot-gen.py Log Message: Various old changes: * Use PMC registers instead of integer registers * Allow strings as well as integers * Add setline opcodes to the output; also, set filename in compiled code * Implement the 'pass' statement :) Use correct executable filename for Parrot 0.0.7 Index: parrot-gen.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrot/parrot-gen.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** parrot-gen.py 17 Dec 2001 13:42:31 -0000 1.3 --- parrot-gen.py 20 Jul 2002 11:31:31 -0000 1.4 *************** *** 27,34 **** from compiler.pycodegen import LocalNameFinder ! # List 31 of the 32 integer registers as being available FREE_REGISTERS = [] for i in range(1, 32): ! FREE_REGISTERS.append('I' + str(i)) # Global variable: maps local variable names to their assigned register --- 27,34 ---- from compiler.pycodegen import LocalNameFinder ! # List 31 of the 32 PMC registers as being available FREE_REGISTERS = [] for i in range(1, 32): ! FREE_REGISTERS.append('P' + str(i)) # Global variable: maps local variable names to their assigned register *************** *** 57,61 **** self.lines = [] self.symcount = 0 ! def add_line (self, line): """add_line(line:string) --- 57,62 ---- self.lines = [] self.symcount = 0 ! self._last_lineno = None ! def add_line (self, line): """add_line(line:string) *************** *** 64,68 **** and is indented properly. """ ! line = line.rstrip() + '\n' --- 65,69 ---- and is indented properly. """ ! line = line.rstrip() + '\n' *************** *** 80,88 **** self.add_line(line) ! # Visitor methods. Most of the def visitAssign (self, node): a_name = node.nodes[0].name reg = LOCAL_REGS[a_name] ! lines = compile_expr(node.expr, reg, FREE_REGISTERS) self.add_lines(lines) # XXX assign result to 'a_name.name' --- 81,98 ---- self.add_line(line) ! def set_lineno (self, node): ! if (node.lineno is not None and ! node.lineno != self._last_lineno): ! self._last_lineno = node.lineno ! return ['setline %i' % node.lineno] ! else: ! return [] ! ! # Visitor methods. Most of them are currently unimplemented. def visitAssign (self, node): a_name = node.nodes[0].name reg = LOCAL_REGS[a_name] ! lines = (self.set_lineno(node) + ! compile_expr(node.expr, reg, FREE_REGISTERS) ) self.add_lines(lines) # XXX assign result to 'a_name.name' *************** *** 97,102 **** sym2 = gensym() ! lines = (compile_expr(test_expr, 'I0', FREE_REGISTERS) + ! ["if I0, %s" % sym, "branch %s" % sym2, "%s:" % sym]) --- 107,113 ---- sym2 = gensym() ! lines = self.set_lineno(test_expr) ! lines += (compile_expr(test_expr, 'P0', FREE_REGISTERS) + ! ["if P0, %s" % sym, "branch %s" % sym2, "%s:" % sym]) *************** *** 112,118 **** lines = [] for n in node.nodes: ! lines += compile_expr(n, 'I0', FREE_REGISTERS) ! lines += ["print I0", 'print " "'] ! lines += ['print "\\n"'] self.add_lines(lines) --- 123,130 ---- lines = [] for n in node.nodes: ! lines.extend(self.set_lineno(n)) ! lines.extend(compile_expr(n, 'P0', FREE_REGISTERS)) ! lines.extend(["print P0", 'print " "']) ! lines.append('print "\\n"') self.add_lines(lines) *************** *** 168,172 **** ## assert 0, "not implemented" def visitDiscard(self, node): ! lines = compile_expr(node.expr, 'I0', FREE_REGISTERS) self.add_lines(lines) ## def visitEllipsis(self, node): --- 180,185 ---- ## assert 0, "not implemented" def visitDiscard(self, node): ! lines = (self.set_lineno(node) + ! compile_expr(node.expr, 'P0', FREE_REGISTERS) ) self.add_lines(lines) ## def visitEllipsis(self, node): *************** *** 223,228 **** ## def visitOr(self, node): ## assert 0, "not implemented" ! ## def visitPass(self, node): ! ## assert 0, "not implemented" ## def visitPower(self, node): ## assert 0, "not implemented" --- 236,242 ---- ## def visitOr(self, node): ## assert 0, "not implemented" ! def visitPass(self, node): ! self.add_lines(self.set_lineno(node)) ! self.add_lines(["noop"]) ## def visitPower(self, node): ## assert 0, "not implemented" *************** *** 258,269 **** def visitWhile(self, node): assert node.else_ is None, "while...else not supported" start = gensym() end = gensym() self.add_line("%s:" % start) ! self.add_lines(compile_expr(node.test, 'I0', FREE_REGISTERS)) ! self.add_line('EQ I0, 0, %s' % end) self.visit(node.body) ! self.add_line('BRANCH %s' % start) self.add_line("%s:" % end) --- 272,285 ---- def visitWhile(self, node): assert node.else_ is None, "while...else not supported" + self.add_lines(self.set_lineno(node)) start = gensym() end = gensym() self.add_line("%s:" % start) ! self.add_lines(self.set_lineno(node)) ! self.add_lines(compile_expr(node.test, 'P0', FREE_REGISTERS)) ! self.add_line('if P0, %s' % end) self.visit(node.body) ! self.add_line('branch %s' % start) self.add_line("%s:" % end) *************** *** 276,282 **** 'avail_registers' is a list of unused registers. XXX This handles registers really stupidly, and always leaves its ! result in I0; it should allocate registers more efficiently. XXX how to handle string constants, or constants of other types? """ --- 292,299 ---- 'avail_registers' is a list of unused registers. + self.add_lines(self.set_lineno(expr)) XXX This handles registers really stupidly, and always leaves its ! result in P0; it should allocate registers more efficiently. XXX how to handle string constants, or constants of other types? """ *************** *** 290,301 **** if isinstance(expr, ast.Const): ! assert type(expr.value) == types.IntType, "Only int type is supported" ! return ["set %s, %r" % (dest_register, expr.value)] elif isinstance(expr, ast.Name): reg = LOCAL_REGS[expr.name] ! temp = random.choice(FREE_REGISTERS) ! return ["set %s, 0" % temp, ! "add %s, %s, %s" % (dest_register, reg, temp)] elif (isinstance(expr, ast.Add) or --- 307,327 ---- if isinstance(expr, ast.Const): ! t = type(expr.value) ! assert t in [types.IntType, types.StringType, ! types.FloatType], \ ! "Unsupported type: %r" % t ! if t is types.StringType: ! return ["new %s, .PerlString" % dest_register, ! "set %s, %r" % (dest_register, expr.value) ! ] ! else: ! # A number of some sort ! return ["new %s, .PerlNum" % dest_register, ! "set %s, %r" % (dest_register, expr.value) ! ] elif isinstance(expr, ast.Name): reg = LOCAL_REGS[expr.name] ! return ["set %s, %s" % (dest_register, reg)] elif (isinstance(expr, ast.Add) or *************** *** 365,374 **** vtor = visitor.ASTVisitor() pv = ParrotVisitor() vtor.preorder(ast, pv) # Write the generated assembly code lines = ["main:\n"] + pv.lines + ["\tend\n"] output = open(output_name, 'w') ! output.writelines(lines) output.close() --- 391,409 ---- vtor = visitor.ASTVisitor() pv = ParrotVisitor() + + for line in ["main:", + 'setfile "%s"' % input_name, + 'setpackage "__main__"']: + pv.add_line(line) + + # Generate lines of assembly code vtor.preorder(ast, pv) + + pv.add_line('end') # Write the generated assembly code lines = ["main:\n"] + pv.lines + ["\tend\n"] output = open(output_name, 'w') ! output.writelines(pv.lines) output.close() *************** *** 403,411 **** if err: sys.exit(err) if do_run: ! err = os.system('%s/test_parrot %s' % (PARROT_SRC, bytecode_filename)) if err == 139: print 'Parrot interpreter dumped core' ! if err: sys.exit(err) if __name__ == '__main__': --- 438,447 ---- if err: sys.exit(err) if do_run: ! err = os.system('%s/parrot -t %s' % (PARROT_SRC, bytecode_filename)) if err == 139: print 'Parrot interpreter dumped core' ! if err: ! sys.exit(err) if __name__ == '__main__': From nnorwitz@users.sourceforge.net Sat Jul 20 21:35:15 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 20 Jul 2002 13:35:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_popen.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19202 Modified Files: test_popen.py Log Message: Get popen test to work even if python is not in the path Index: test_popen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_popen.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_popen.py 3 Apr 2002 01:47:00 -0000 1.1 --- test_popen.py 20 Jul 2002 20:35:13 -0000 1.2 *************** *** 16,20 **** # We can then eval() the result of this, and see what each argv was. def _do_test_commandline(cmdline, expected): ! cmd = 'python -c "import sys;print sys.argv" %s' % (cmdline,) data = popen(cmd).read() got = eval(data)[1:] # strip off argv[0] --- 16,20 ---- # 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] From akuchling@users.sourceforge.net Sun Jul 21 01:12:08 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 20 Jul 2002 17:12:08 -0700 Subject: [Python-checkins] python/nondist/sandbox/parrot parrot-gen.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/parrot In directory usw-pr-cvs1:/tmp/cvs-serv2641 Modified Files: parrot-gen.py Log Message: Partial implementation of 'def', 'return', and function calls Implement some more operators (**, <<, >>, 'and', 'or') Add -t option to trace generated code when running it Delete a bunch of visitor methods that will never be implemented because compile_expr() will handle them Parrot 0.0.7 includes an intermediate-code compiler called 'imcc', which will take care of register scheduling, calling conventions, and other annoying trivia for you. My plan is to now rework parrot-gen.py to output IMCC-format code, which should make the implementation easier. Once that's running, I'll think about implementing PythonString, PythonInt, &c. objects. Index: parrot-gen.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrot/parrot-gen.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** parrot-gen.py 20 Jul 2002 11:31:31 -0000 1.4 --- parrot-gen.py 21 Jul 2002 00:12:06 -0000 1.5 *************** *** 9,14 **** """ - # created 2001/09/21, AMK - __revision__ = "$Id$" --- 9,12 ---- *************** *** 19,22 **** --- 17,21 ---- -r Run Parrot assembler and interpreter on output -S Only produce assembly source code (.pasm file) + -t Use trace option when running generated code """ *************** *** 29,38 **** # List 31 of the 32 PMC registers as being available FREE_REGISTERS = [] ! for i in range(1, 32): FREE_REGISTERS.append('P' + str(i)) - # Global variable: maps local variable names to their assigned register - LOCAL_REGS = {} - symcount = 1 # Counter for symbols def gensym (): --- 28,34 ---- # List 31 of the 32 PMC registers as being available FREE_REGISTERS = [] ! for i in range(2, 32): FREE_REGISTERS.append('P' + str(i)) symcount = 1 # Counter for symbols def gensym (): *************** *** 51,62 **** Attributes: ! lines : list of strings, each one a line of output. """ def __init__ (self): self.lines = [] ! self.symcount = 0 self._last_lineno = None ! def add_line (self, line): """add_line(line:string) --- 47,68 ---- Attributes: ! lines : [string] ! A list of strings, each one a line of assembly source code. ! functions : [string] ! More lines of assembly source, containing the functions. """ def __init__ (self): self.lines = [] ! self.functions = [] ! self.symcount = 0 # Current number of symbol ! self.regcount = 0 # Current number of temp. register self._last_lineno = None ! ! def next_register (self, type='P'): ! reg = 'P%i' % self.regcount ! self.regcount += 1 ! return reg ! def add_line (self, line): """add_line(line:string) *************** *** 88,100 **** else: return [] # Visitor methods. Most of them are currently unimplemented. def visitAssign (self, node): a_name = node.nodes[0].name ! reg = LOCAL_REGS[a_name] lines = (self.set_lineno(node) + compile_expr(node.expr, reg, FREE_REGISTERS) ) self.add_lines(lines) ! # XXX assign result to 'a_name.name' def visitClass (self, node): --- 94,108 ---- else: return [] + # Visitor methods. Most of them are currently unimplemented. def visitAssign (self, node): a_name = node.nodes[0].name ! reg = 'P0'#self.next_register() lines = (self.set_lineno(node) + compile_expr(node.expr, reg, FREE_REGISTERS) ) self.add_lines(lines) ! self.add_line('store_global %s, "%s"' % (reg, a_name)) ! # XXX assign result to 'a_name' def visitClass (self, node): *************** *** 129,134 **** self.add_lines(lines) - ## def visitAnd(self, node): - ## assert 0, "not implemented" ## def visitAssAttr(self, node): ## assert 0, "not implemented" --- 137,140 ---- *************** *** 157,164 **** ## def visitBackquote(self, node): ## assert 0, "not implemented" - ## def visitBitand(self, node): - ## assert 0, "not implemented" - ## def visitBitor(self, node): - ## assert 0, "not implemented" ## def visitBitxor(self, node): ## assert 0, "not implemented" --- 163,166 ---- *************** *** 171,176 **** ## def visitCompare(self, node): ## assert 0, "not implemented" - ## def visitConst(self, node): - ## assert 0, "not implemented" ## def visitContinue(self, node): ## assert 0, "not implemented" --- 173,176 ---- *************** *** 193,200 **** ## def visitFrom(self, node): ## assert 0, "not implemented" ! ## def visitFunction(self, node): ! ## assert 0, "not implemented" ! ## def visitFunction(self, node): ! ## assert 0, "not implemented" ## def visitGetattr(self, node): ## assert 0, "not implemented" --- 193,210 ---- ## def visitFrom(self, node): ## assert 0, "not implemented" ! def visitFunction(self, node): ! symbol = gensym() ! self.add_lines(['set_addr I0, %s' % symbol, ! 'new P0, .Sub', ! 'set P0, I0', ! 'store_global P0, "%s"' % node.name]) ! ! # Generate code for the function body ! vtor = visitor.ASTVisitor() ! pv = ParrotVisitor() ! vtor.preorder(node.code, pv) ! self.functions += (['%s:' % symbol] + pv.lines + ['\t' 'ret'] + ! pv.functions) ! ## def visitGetattr(self, node): ## assert 0, "not implemented" *************** *** 207,212 **** def visitImport(self, node): assert 0, "not implemented" - ## def visitInvert(self, node): - ## assert 0, "not implemented" ## def visitKeyword(self, node): ## assert 0, "not implemented" --- 217,220 ---- *************** *** 215,220 **** ## def visitLambda(self, node): ## assert 0, "not implemented" - ## def visitLeftShift(self, node): - ## assert 0, "not implemented" ## def visitList(self, node): ## assert 0, "not implemented" --- 223,226 ---- *************** *** 228,250 **** ## pass ## #assert 0, "not implemented" - ## def visitMul(self, node): - ## assert 0, "not implemented" - ## def visitName(self, node): - ## assert 0, "not implemented" - ## def visitNot(self, node): - ## assert 0, "not implemented" - ## def visitOr(self, node): - ## assert 0, "not implemented" def visitPass(self, node): self.add_lines(self.set_lineno(node)) self.add_lines(["noop"]) - ## def visitPower(self, node): - ## assert 0, "not implemented" ## def visitRaise(self, node): ## assert 0, "not implemented" ! ## def visitReturn(self, node): ! ## assert 0, "not implemented" ! ## def visitRightShift(self, node): ! ## assert 0, "not implemented" ## def visitSlice(self, node, aug_flag=None): ## assert 0, "not implemented" --- 234,247 ---- ## pass ## #assert 0, "not implemented" def visitPass(self, node): self.add_lines(self.set_lineno(node)) self.add_lines(["noop"]) ## def visitRaise(self, node): ## assert 0, "not implemented" ! def visitReturn(self, node): ! lines = compile_expr(node.value, 'P0', FREE_REGISTERS[:]) ! self.add_lines(lines) ! # XXX should ensure None is returned here ! self.add_line('\t' 'ret') ## def visitSlice(self, node, aug_flag=None): ## assert 0, "not implemented" *************** *** 263,272 **** ## def visitTuple(self, node): ## assert 0, "not implemented" - ## def visitUnaryAdd(self, node): - ## assert 0, "not implemented" - ## def visitUnaryInvert(self, node): - ## assert 0, "not implemented" - ## def visitUnarySub(self, node): - ## assert 0, "not implemented" def visitWhile(self, node): --- 260,263 ---- *************** *** 298,301 **** --- 289,303 ---- XXX how to handle string constants, or constants of other types? """ + dict_lr = {ast.Add: "add", ast.Sub: "sub", + ast.Mul: "mul", ast.Div: "div", + ast.Mod: "mod", + ast.Power: "pow", + ast.RightShift: 'shr', ast.LeftShift: 'shl'} + dict_bool = {ast.And: 'and', ast.Or: 'or'} + + # XXX Parrot 0.0.7 seems to have a mysterious core-dumping bug + # with register P1. + if dest_register == 'P1': raise RuntimeError + # Copy avail_registers, because we'll be mutating it later avail_registers = avail_registers[:] *************** *** 322,338 **** elif isinstance(expr, ast.Name): ! reg = LOCAL_REGS[expr.name] ! return ["set %s, %s" % (dest_register, reg)] ! elif (isinstance(expr, ast.Add) or ! isinstance(expr, ast.Sub) or ! isinstance(expr, ast.Mul) or ! isinstance(expr, ast.Div) or ! isinstance(expr, ast.Mod) ! ): ! dict = {ast.Add: "add", ast.Sub: "sub", ! ast.Mul: "mul", ast.Div: "div", ! ast.Mod: "mod"} ! opcode = dict[expr.__class__] temp1 = random.choice(avail_registers) avail_registers.remove(temp1) --- 324,331 ---- elif isinstance(expr, ast.Name): ! return ['find_global %s, "%s"' % (dest_register, expr.name)] ! elif isinstance(expr, tuple(dict_lr.keys())): ! opcode = dict_lr[expr.__class__] temp1 = random.choice(avail_registers) avail_registers.remove(temp1) *************** *** 346,349 **** --- 339,355 ---- ) + elif isinstance(expr, tuple(dict_bool.keys())): + opcode = dict_bool[expr.__class__] + temp1 = random.choice(avail_registers) + avail_registers.remove(temp1) + lines = [] + lines += compile_expr(expr.nodes[0], dest_register, avail_registers) + for n in expr.nodes[1:-1]: + lines += compile_expr(n, temp1, avail_registers) + lines += ["%s %s, %s, %s" % (opcode, dest_register, dest_register, temp1)] + lines += compile_expr(expr.nodes[-1], temp1, avail_registers) + lines += ["%s %s, %s, %s" % (opcode, dest_register, dest_register, temp1)] + + elif isinstance(expr, ast.Compare): dict = {'<':'lt', '>':'gt', '==':'eq', *************** *** 370,373 **** --- 376,397 ---- "%s:" % sym2] + elif isinstance(expr, ast.CallFunc): + assert expr.args == [], 'Arguments not handled' + assert expr.star_args is None, '*args not handled' + assert expr.dstar_args is None, '**args not handled' + temp1 = random.choice(avail_registers) + assert isinstance(expr.node, ast.Name), \ + "can only call functions directly" + name = expr.node.name + lines = compile_expr(expr.node, temp1, avail_registers) + + # XXX fix case where dest_register == 'P0' + if dest_register != 'P0': + lines.append('save P0') + lines += ['find_global P0, "%s"' % name, + 'call'] + if dest_register != 'P0': + lines += ['add %s, P0, 0' % dest_register, 'restore P0'] + else: raise RuntimeError, "Unexpected node in expression: %r" % expr *************** *** 381,389 **** ## print ast ! # Determine locals and assign them to registers ! lnf = walk(ast, LocalNameFinder(), verbose=0) ! for name in lnf.getLocals().elements(): ! reg = LOCAL_REGS[name] = random.choice(FREE_REGISTERS) ! FREE_REGISTERS.remove(reg) ## print LOCAL_REGS --- 405,414 ---- ## print ast ! # Determine locals and assign them to registers ! # Disabled -- all variables are global for the moment ! ## lnf = walk(ast, LocalNameFinder(), verbose=0) ! ## for name in lnf.getLocals().elements(): ! ## reg = LOCAL_REGS[name] = random.choice(FREE_REGISTERS) ! ## FREE_REGISTERS.remove(reg) ## print LOCAL_REGS *************** *** 399,417 **** # Generate lines of assembly code vtor.preorder(ast, pv) ! ! pv.add_line('end') # Write the generated assembly code ! lines = ["main:\n"] + pv.lines + ["\tend\n"] output = open(output_name, 'w') ! output.writelines(pv.lines) output.close() def main(): ! opts, args = getopt.getopt(sys.argv[1:], 'hrS', ['help']) do_run = 0 do_assemble = 1 for opt, param in opts: if opt in ['-h', '--help']: --- 424,442 ---- # Generate lines of assembly code vtor.preorder(ast, pv) ! pv.add_line('\t' 'end') # Write the generated assembly code ! lines = pv.lines + pv.functions output = open(output_name, 'w') ! output.writelines(lines) output.close() def main(): ! opts, args = getopt.getopt(sys.argv[1:], 'hrSt', ['help']) do_run = 0 do_assemble = 1 + do_trace = 0 for opt, param in opts: if opt in ['-h', '--help']: *************** *** 422,425 **** --- 447,452 ---- elif opt == '-S': do_assemble = 0 + elif opt == '-t': + do_trace = 1 if len(args) != 1: *************** *** 438,443 **** if err: sys.exit(err) if do_run: ! err = os.system('%s/parrot -t %s' % (PARROT_SRC, ! bytecode_filename)) if err == 139: print 'Parrot interpreter dumped core' --- 465,474 ---- if err: sys.exit(err) if do_run: ! if do_trace: trace_opt = '-t' ! else: trace_opt = '' ! cmd_line = '%s/parrot %s %s' % (PARROT_SRC, trace_opt, ! bytecode_filename) ! print cmd_line ! err = os.system(cmd_line) if err == 139: print 'Parrot interpreter dumped core' From tim_one@users.sourceforge.net Sun Jul 21 07:06:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 20 Jul 2002 23:06:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email_codecs.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv3289/python/lib/email/test Modified Files: test_email_codecs.py Log Message: Changed import from from test.test_support import TestSkipped, run_unittest to from test_support import TestSkipped, run_unittest Otherwise, if the Japanese codecs aren't installed, regrtest doesn't believe the TestSkipped exception raised by this test matches the except (ImportError, test_support.TestSkipped), msg: it's looking for, and reports the skip as a crash failure instead of as a skipped test. I suppose this will make it harder to run this test outside of regrtest, but under the assumption only Barry does that, better to make it skip cleanly for everyone else. Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_codecs.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_email_codecs.py 19 Jul 2002 22:29:00 -0000 1.1 --- test_email_codecs.py 21 Jul 2002 06:06:30 -0000 1.2 *************** *** 3,7 **** import unittest ! from test.test_support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase --- 3,7 ---- import unittest ! from test_support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase From tim_one@users.sourceforge.net Sun Jul 21 18:37:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 21 Jul 2002 10:37:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test sortperf.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15348/lib/test Modified Files: sortperf.py Log Message: New test "+sort", tacking 10 random floats on to the end of a sorted array. Our samplesort special-cases the snot out of this, running about 12x faster than *sort. The experimental mergesort runs it about 8x faster than *sort without special-casing, but should really do better than that (when merging runs of different lengths, right now it only does something clever about finding where the second run begins in the first and where the first run ends in the second, and that's more of a temp-memory optimization). Index: sortperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/sortperf.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sortperf.py 20 Jul 2002 04:21:51 -0000 1.9 --- sortperf.py 21 Jul 2002 17:37:03 -0000 1.10 *************** *** 75,79 **** \sort: descending data /sort: ascending data ! 3sort: ascending data but with 3 random exchanges ~sort: many duplicates =sort: all equal --- 75,80 ---- \sort: descending data /sort: ascending data ! 3sort: ascending, then 3 random exchanges ! +sort: ascending, then 10 random at the end ~sort: many duplicates =sort: all equal *************** *** 81,85 **** """ ! cases = ("*sort", "\\sort", "/sort", "3sort", "~sort", "=sort", "!sort") fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) --- 82,86 ---- """ ! cases = tuple([ch + "sort" for ch in r"*\/3+~=!"]) fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) *************** *** 101,104 **** --- 102,110 ---- doit(L) # 3sort + # Replace the last 10 with random floats. + if n >= 10: + L[-10:] = [random.random() for dummy in range(10)] + doit(L) # +sort + # Arrange for lots of duplicates. if n > 4: *************** *** 118,125 **** # This one looks like [3, 2, 1, 0, 0, 1, 2, 3]. It was a bad case # for an older implementation of quicksort, which used the median ! # of the first, last and middle elements as the pivot. It's still ! # a worse-than-average case for samplesort, but on the order of a ! # measly 5% worse, not a quadratic-time disaster as it was with ! # quicksort. half = n // 2 L = range(half - 1, -1, -1) --- 124,128 ---- # This one looks like [3, 2, 1, 0, 0, 1, 2, 3]. It was a bad case # for an older implementation of quicksort, which used the median ! # of the first, last and middle elements as the pivot. half = n // 2 L = range(half - 1, -1, -1) From jackjansen@users.sourceforge.net Mon Jul 22 13:35:24 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 22 Jul 2002 05:35:24 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macimport.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv16522 Modified Files: macimport.c Log Message: Fixed potential refcount problems with interned strings, adapted comments, added a bit more trace output if verbose > 1. Index: macimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macimport.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** macimport.c 11 Apr 2002 20:48:14 -0000 1.15 --- macimport.c 22 Jul 2002 12:35:22 -0000 1.16 *************** *** 69,73 **** /* ! ** If we have interning find_module takes care of interning all ** sys.path components. We then keep a record of all sys.path ** components for which GetFInfo has failed (usually because the --- 69,73 ---- /* ! ** Find_module takes care of interning all ** sys.path components. We then keep a record of all sys.path ** components for which GetFInfo has failed (usually because the *************** *** 86,92 **** } if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) not_a_file[max_not_a_file++] = obj; ! /* doesn't exist or is folder */ return 0; } --- 86,96 ---- } if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { ! /* doesn't exist or is folder */ ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) { ! Py_INCREF(obj); not_a_file[max_not_a_file++] = obj; ! if (Py_VerboseFlag > 1) ! PySys_WriteStderr("# %s is not a file\n", filename); ! } return 0; } *************** *** 101,108 **** filerh = -1; } else { ! if ( FSpGetFInfo(&fss, &finfo) != noErr ) { ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) not_a_file[max_not_a_file++] = obj; ! /* doesn't exist or is folder */ return 0; } --- 105,116 ---- filerh = -1; } else { ! if ( FSpGetFInfo(&fss, &finfo) != noErr ) { ! /* doesn't exist or is folder */ ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) { ! Py_INCREF(obj); not_a_file[max_not_a_file++] = obj; ! if (Py_VerboseFlag > 1) ! PySys_WriteStderr("# %s is not a file\n", filename); ! } return 0; } *************** *** 115,118 **** --- 123,128 ---- if ( dataptr == NULL ) SetResLoad(0); + if (Py_VerboseFlag > 1) + PySys_WriteStderr("# Look for ('PYC ', %s) in %s\n", module, filename); h = Get1NamedResource(restype, Pstring(module)); SetResLoad(1); From jackjansen@users.sourceforge.net Mon Jul 22 13:32:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 22 Jul 2002 05:32:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts genpluginprojects.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv15273 Modified Files: genpluginprojects.py Log Message: Finally found out why te cf project sometimes worked and someimes didn't. Fixed it. Index: genpluginprojects.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genpluginprojects.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** genpluginprojects.py 26 Jun 2002 22:06:08 -0000 1.32 --- genpluginprojects.py 22 Jul 2002 12:32:31 -0000 1.33 *************** *** 199,203 **** libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") # Carbon Only? ! genpluginproject("carbon", "_CF", sources=[":cf:_CFmodule.c", ":cf:pycfbridge.c"], outputdir="::Lib:Carbon") genpluginproject("carbon", "_CarbonEvt", outputdir="::Lib:Carbon") genpluginproject("carbon", "hfsplus") --- 199,203 ---- libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") # Carbon Only? ! genpluginproject("carbon", "_CF", sources=["_CFmodule.c", "pycfbridge.c"], outputdir="::Lib:Carbon") genpluginproject("carbon", "_CarbonEvt", outputdir="::Lib:Carbon") genpluginproject("carbon", "hfsplus") From mhammond@users.sourceforge.net Mon Jul 22 13:53:19 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 22 Jul 2002 05:53:19 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.441,1.442 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22801 Modified Files: NEWS Log Message: Add note about DL_IMPORT deprecation. [ 583894 ] doc DL_IMPORT/DL_EXPORT changes Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.441 retrieving revision 1.442 diff -C2 -d -r1.441 -r1.442 *** NEWS 16 Jul 2002 01:32:30 -0000 1.441 --- NEWS 22 Jul 2002 12:53:16 -0000 1.442 *************** *** 6,9 **** --- 6,13 ---- Core and builtins + - The public Python C API will generally be declared using PyAPI_FUNC + and PyAPI_DATA macros, while Python extension module init functions + will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros + are deprecated. - Ctrl+C handling on Windows has been made more consistent with From nnorwitz@users.sourceforge.net Mon Jul 22 14:19:01 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 22 Jul 2002 06:19:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv32499/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: SF bug #583894, add doc for DL_IMPORT/DL_EXPORT deprecation Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** whatsnew23.tex 19 Jul 2002 15:48:56 -0000 1.36 --- whatsnew23.tex 22 Jul 2002 13:18:59 -0000 1.37 *************** *** 846,849 **** --- 846,854 ---- Palkovsky.) + \item The public Python C API will generally be declared using PyAPI_FUNC + and PyAPI_DATA macros, while Python extension module init functions + will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros + are deprecated. + \item The interpreter can be compiled without any docstrings for the built-in functions and modules by supplying From nnorwitz@users.sourceforge.net Mon Jul 22 14:21:15 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 22 Jul 2002 06:21:15 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.442,1.443 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv939/Misc Modified Files: NEWS Log Message: Move DL_IMPORT/DL_EXPORT to Build section, I think this is the correct place Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.442 retrieving revision 1.443 diff -C2 -d -r1.442 -r1.443 *** NEWS 22 Jul 2002 12:53:16 -0000 1.442 --- NEWS 22 Jul 2002 13:21:10 -0000 1.443 *************** *** 6,13 **** Core and builtins - - The public Python C API will generally be declared using PyAPI_FUNC - and PyAPI_DATA macros, while Python extension module init functions - will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros - are deprecated. - Ctrl+C handling on Windows has been made more consistent with --- 6,9 ---- *************** *** 308,311 **** --- 304,312 ---- Build + + - The public Python C API will generally be declared using PyAPI_FUNC + and PyAPI_DATA macros, while Python extension module init functions + will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros + are deprecated. - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or From mhammond@users.sourceforge.net Mon Jul 22 14:26:43 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 22 Jul 2002 06:26:43 -0700 Subject: [Python-checkins] python/dist/src/PC winsound.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv4049 Modified Files: winsound.c Log Message: Nuke the only DL_* in this directory. Index: winsound.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/winsound.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** winsound.c 13 Jun 2002 20:33:02 -0000 1.10 --- winsound.c 22 Jul 2002 13:26:41 -0000 1.11 *************** *** 196,200 **** #define ADD_DEFINE(tok) add_define(dict,#tok,tok) ! DL_EXPORT(void) initwinsound(void) { --- 196,200 ---- #define ADD_DEFINE(tok) add_define(dict,#tok,tok) ! PyMODINIT_FUNC initwinsound(void) { From mhammond@users.sourceforge.net Mon Jul 22 14:28:23 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 22 Jul 2002 06:28:23 -0700 Subject: [Python-checkins] python/dist/src/PC getpathp.c,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv4784 Modified Files: getpathp.c Log Message: Remove a strange single quote that didn't seem to upset the compilers! Index: getpathp.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/getpathp.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** getpathp.c 30 Jun 2002 15:26:10 -0000 1.27 --- getpathp.c 22 Jul 2002 13:28:21 -0000 1.28 *************** *** 357,361 **** PLUS Windows itself defines MAX_PATH as the same, but anyway... */ ! wprogpath[MAXPATHLEN]=_T('\0')'; if (GetModuleFileName(NULL, wprogpath, MAXPATHLEN)) { WideCharToMultiByte(CP_ACP, 0, --- 357,361 ---- PLUS Windows itself defines MAX_PATH as the same, but anyway... */ ! wprogpath[MAXPATHLEN]=_T('\0'); if (GetModuleFileName(NULL, wprogpath, MAXPATHLEN)) { WideCharToMultiByte(CP_ACP, 0, From akuchling@users.sourceforge.net Mon Jul 22 19:50:13 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 22 Jul 2002 11:50:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv25794 Modified Files: whatsnew23.tex Log Message: Rewrite a paragraph, and use correct mark-up Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** whatsnew23.tex 22 Jul 2002 13:18:59 -0000 1.37 --- whatsnew23.tex 22 Jul 2002 18:50:11 -0000 1.38 *************** *** 18,21 **** --- 18,23 ---- % Bug #580462: changes to GC API % + % Pure Python strptime implementation by Brett Cannon. See SF patch 474274. + % %\section{Introduction \label{intro}} *************** *** 837,841 **** \section{Build and C API Changes} ! Changes to Python's build process, and to the C API, include: \begin{itemize} --- 839,843 ---- \section{Build and C API Changes} ! Changes to Python's build process and to the C API include: \begin{itemize} *************** *** 846,853 **** Palkovsky.) ! \item The public Python C API will generally be declared using PyAPI_FUNC ! and PyAPI_DATA macros, while Python extension module init functions ! will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros ! are deprecated. \item The interpreter can be compiled without any docstrings for --- 848,857 ---- Palkovsky.) ! \item The \csimplemacro{DL_EXPORT} and \csimplemacro{DL_IMPORT} macros are now ! deprecated. Initialization functions for Python extension modules ! should now be declared using the new macro ! \csimplemacro{PyMODINIT_FUNC}, while the Python core will generally ! use the \csimplemacro{PyAPI_FUNC} and \csimplemacro{PyAPI_DATA} ! macros. \item The interpreter can be compiled without any docstrings for From akuchling@users.sourceforge.net Mon Jul 22 19:57:38 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 22 Jul 2002 11:57:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv28161 Modified Files: whatsnew23.tex Log Message: Sort changed modules into alphabetical order; no other changes Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** whatsnew23.tex 22 Jul 2002 18:50:11 -0000 1.38 --- whatsnew23.tex 22 Jul 2002 18:57:36 -0000 1.39 *************** *** 689,755 **** As usual, Python's standard modules had a number of enhancements and ! bug fixes. Here's a partial list; consult the \file{Misc/NEWS} file ! in the source tree, or the CVS logs, for a more complete list. \begin{itemize} ! \item The new \module{textwrap} module contains functions for wrapping ! strings containing paragraphs of text. The \function{wrap(\var{text}, ! \var{width})} function takes a string and returns a list containing ! the text split into lines of no more than the chosen width. The ! \function{fill(\var{text}, \var{width})} function returns a single ! string, reformatted to fit into lines no longer than the chosen width. ! (As you can guess, \function{fill()} is built on top of ! \function{wrap()}. For example: \begin{verbatim} ! >>> import textwrap ! >>> paragraph = "Not a whit, we defy augury: ... more text ..." ! >>> textwrap.wrap(paragraph, 60) ! ["Not a whit, we defy augury: there's a special providence in", ! "the fall of a sparrow. If it be now, 'tis not to come; if it", ! ...] ! >>> print textwrap.fill(paragraph, 35) ! Not a whit, we defy augury: there's ! a special providence in the fall of ! a sparrow. If it be now, 'tis not ! to come; if it be not to come, it ! will be now; if it be not now, yet ! it will come: the readiness is all. ! >>> \end{verbatim} ! The module also contains a \class{TextWrapper} class that actually ! implements the text wrapping strategy. Both the ! \class{TextWrapper} class and the \function{wrap()} and ! \function{fill()} functions support a number of additional keyword ! arguments for fine-tuning the formatting; consult the module's ! documentation for details. ! % XXX add a link to the module docs? ! (Contributed by Greg Ward.) ! ! \item Two new functions in the \module{math} module, ! \function{degrees(\var{rads})} and \function{radians(\var{degs})}, ! convert between radians and degrees. Other functions in the ! \module{math} module such as ! \function{math.sin()} and \function{math.cos()} have always required ! input values measured in radians. (Contributed by Raymond Hettinger.) ! ! \item Three new functions, \function{getpgid()}, \function{killpg()}, ! and \function{mknod()}, were added to the \module{posix} module that ! underlies the \module{os} module. (Contributed by Gustavo Niemeyer ! and Geert Jansen.) ! ! \item The \module{socket} module now supports timeouts. You ! can call the \method{settimeout(\var{t})} method on a socket object to ! set a timeout of \var{t} seconds. Subsequent socket operations that ! take longer than \var{t} seconds to complete will abort and raise a ! \exception{socket.error} exception. ! (The original timeout implementation was by Tim O'Malley. Michael ! Gilfix integrated it into the Python \module{socket} module, after the ! patch had undergone a lengthy review. After it was checked in, Guido ! van~Rossum rewrote parts of it. This is a good example of the free ! software development process.) \item The \module{getopt} module gained a new function, --- 689,731 ---- As usual, Python's standard modules had a number of enhancements and ! bug fixes. Here's a partial list of the most notable changes, sorted ! alphabetically by module name. Consult the ! \file{Misc/NEWS} file in the source tree for a more ! complete list of changes, or look through the CVS logs for all the ! details. \begin{itemize} ! \item The \module{array} module now supports arrays of Unicode ! characters using the \samp{u} format character. Arrays also now ! support using the \code{+=} assignment operator to add another array's ! contents, and the \code{*=} assignment operator to repeat an array. ! (Contributed by Jason Orendorff.) ! ! \item The Distutils \class{Extension} class now supports ! an extra constructor argument named \samp{depends} for listing ! additional source files that an extension depends on. This lets ! Distutils recompile the module if any of the dependency files are ! modified. For example, if \samp{sampmodule.c} includes the header ! file \file{sample.h}, you would create the \class{Extension} object like ! this: \begin{verbatim} ! ext = Extension("samp", ! sources=["sampmodule.c"], ! depends=["sample.h"]) \end{verbatim} ! Modifying \file{sample.h} would then cause the module to be recompiled. ! (Contributed by Jeremy Hylton.) ! \item Two new binary packagers were added to the Distutils. ! \code{bdist_pkgtool} builds \file{.pkg} files to use with Solaris ! \program{pkgtool}, and \code{bdist_sdux} builds \program{swinstall} ! packages for use on HP-UX. ! An abstract binary packager class, ! \module{distutils.command.bdist_packager}, was added; this may make it ! easier to write binary packaging commands. (Contributed by Mark ! Alexander.) \item The \module{getopt} module gained a new function, *************** *** 770,805 **** (Contributed by Peter \AA{strand}.) - \item Two new binary packagers were added to the Distutils. - \code{bdist_pkgtool} builds \file{.pkg} files to use with Solaris - \program{pkgtool}, and \code{bdist_sdux} builds \program{swinstall} - packages for use on HP-UX. - An abstract binary packager class, - \module{distutils.command.bdist_packager}, was added; this may make it - easier to write binary packaging commands. (Contributed by Mark - Alexander.) - - \item The Distutils \class{Extension} class now supports - an extra constructor argument named \samp{depends} for listing - additional source files that an extension depends on. This lets - Distutils recompile the module if any of the dependency files are - modified. For example, if \samp{sampmodule.c} includes the header - file \file{sample.h}, you would create the \class{Extension} object like - this: - - \begin{verbatim} - ext = Extension("samp", - sources=["sampmodule.c"], - depends=["sample.h"]) - \end{verbatim} - - Modifying \file{sample.h} would then cause the module to be recompiled. - (Contributed by Jeremy Hylton.) - - \item The \module{array} module now supports arrays of Unicode - characters using the \samp{u} format character. Arrays also now - support using the \code{+=} assignment operator to add another array's - contents, and the \code{*=} assignment operator to repeat an array. - (Contributed by Jason Orendorff.) - \item The \module{grp}, \module{pwd}, and \module{resource} modules now return enhanced tuples: --- 746,749 ---- *************** *** 812,815 **** --- 756,778 ---- \end{verbatim} + + \item Two new functions in the \module{math} module, + \function{degrees(\var{rads})} and \function{radians(\var{degs})}, + convert between radians and degrees. Other functions in the + \module{math} module such as + \function{math.sin()} and \function{math.cos()} have always required + input values measured in radians. (Contributed by Raymond Hettinger.) + + \item Three new functions, \function{getpgid()}, \function{killpg()}, + and \function{mknod()}, were added to the \module{posix} module that + underlies the \module{os} module. (Contributed by Gustavo Niemeyer + and Geert Jansen.) + + \item The parser objects provided by the \module{pyexpat} module + can now optionally buffer character data, resulting in fewer calls to + your character data handler and therefore faster performance. Setting + the parser object's \member{buffer_text} attribute to \constant{True} + will enable buffering. + \item The \module{readline} module also gained a number of new functions: \function{get_history_item()}, *************** *** 822,835 **** unavoidable race conditions. \item The DOM implementation in \module{xml.dom.minidom} can now generate XML output in a particular encoding, by specifying an optional encoding argument to the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. - - \item The parser objects provided by the \module{pyexpat} module - can now optionally buffer character data, resulting in fewer calls to - your character data handler and therefore faster performance. Setting - the parser object's \member{buffer_text} attribute to \constant{True} - will enable buffering. \end{itemize} --- 785,839 ---- unavoidable race conditions. + \item The \module{socket} module now supports timeouts. You + can call the \method{settimeout(\var{t})} method on a socket object to + set a timeout of \var{t} seconds. Subsequent socket operations that + take longer than \var{t} seconds to complete will abort and raise a + \exception{socket.error} exception. + + The original timeout implementation was by Tim O'Malley. Michael + Gilfix integrated it into the Python \module{socket} module, after the + patch had undergone a lengthy review. After it was checked in, Guido + van~Rossum rewrote parts of it. This is a good example of the free + software development process in action. + + \item The new \module{textwrap} module contains functions for wrapping + strings containing paragraphs of text. The \function{wrap(\var{text}, + \var{width})} function takes a string and returns a list containing + the text split into lines of no more than the chosen width. The + \function{fill(\var{text}, \var{width})} function returns a single + string, reformatted to fit into lines no longer than the chosen width. + (As you can guess, \function{fill()} is built on top of + \function{wrap()}. For example: + + \begin{verbatim} + >>> import textwrap + >>> paragraph = "Not a whit, we defy augury: ... more text ..." + >>> textwrap.wrap(paragraph, 60) + ["Not a whit, we defy augury: there's a special providence in", + "the fall of a sparrow. If it be now, 'tis not to come; if it", + ...] + >>> print textwrap.fill(paragraph, 35) + Not a whit, we defy augury: there's + a special providence in the fall of + a sparrow. If it be now, 'tis not + to come; if it be not to come, it + will be now; if it be not now, yet + it will come: the readiness is all. + >>> + \end{verbatim} + + The module also contains a \class{TextWrapper} class that actually + implements the text wrapping strategy. Both the + \class{TextWrapper} class and the \function{wrap()} and + \function{fill()} functions support a number of additional keyword + arguments for fine-tuning the formatting; consult the module's + documentation for details. + % XXX add a link to the module docs? + (Contributed by Greg Ward.) + \item The DOM implementation in \module{xml.dom.minidom} can now generate XML output in a particular encoding, by specifying an optional encoding argument to the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. \end{itemize} From akuchling@users.sourceforge.net Mon Jul 22 20:21:09 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 22 Jul 2002 12:21:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv2866 Modified Files: whatsnew23.tex Log Message: [Bug #580462] Mention changes to GC API Mention portable strptime() Move C-level sections farther down in the file Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** whatsnew23.tex 22 Jul 2002 18:57:36 -0000 1.39 --- whatsnew23.tex 22 Jul 2002 19:21:06 -0000 1.40 *************** *** 18,23 **** % Bug #580462: changes to GC API % - % Pure Python strptime implementation by Brett Cannon. See SF patch 474274. - % %\section{Introduction \label{intro}} --- 18,21 ---- *************** *** 604,689 **** %====================================================================== - \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}} - - An experimental feature added to Python 2.1 was a specialized object - allocator called pymalloc, written by Vladimir Marangozov. Pymalloc - was intended to be faster than the system \cfunction{malloc()} and have - less memory overhead for typical allocation patterns 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 - enabled by default; you'll have to supply - \longprogramopt{without-pymalloc} to disable it. - - This change is transparent to code written in Python; however, - pymalloc may expose bugs in C extensions. Authors of C extension - modules should test their code with the object allocator enabled, - because some incorrect code may cause core dumps at runtime. There - are a bunch of memory allocation functions in Python's C API that have - previously been just aliases for the C library's \cfunction{malloc()} - and \cfunction{free()}, meaning that if you accidentally called - mismatched functions, the error wouldn't be noticeable. When the - object allocator is enabled, these functions aren't aliases of - \cfunction{malloc()} and \cfunction{free()} any more, and calling the - wrong function to free memory may get you a core dump. For example, - if memory was allocated using \cfunction{PyObject_Malloc()}, it has to - be freed using \cfunction{PyObject_Free()}, not \cfunction{free()}. A - few modules included with Python fell afoul of this and had to be - fixed; doubtless there are more third-party modules that will have the - same problem. - - As part of this change, the confusing multiple interfaces for - allocating memory have been consolidated down into two API families. - Memory allocated with one family must not be manipulated with - functions from the other family. - - There is another family of functions specifically for allocating - Python \emph{objects} (as opposed to memory). - - \begin{itemize} - \item To allocate and free an undistinguished chunk of memory use - the ``raw memory'' family: \cfunction{PyMem_Malloc()}, - \cfunction{PyMem_Realloc()}, and \cfunction{PyMem_Free()}. - - \item The ``object memory'' family is the interface to the pymalloc - facility described above and is biased towards a large number of - ``small'' allocations: \cfunction{PyObject_Malloc}, - \cfunction{PyObject_Realloc}, and \cfunction{PyObject_Free}. - - \item To allocate and free Python objects, use the ``object'' family - \cfunction{PyObject_New()}, \cfunction{PyObject_NewVar()}, and - \cfunction{PyObject_Del()}. - \end{itemize} - - Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides - debugging features to catch memory overwrites and doubled frees in - both extension modules and in the interpreter itself. To enable this - support, turn on the Python interpreter's debugging code by running - \program{configure} with \longprogramopt{with-pydebug}. - - To aid extension writers, a header file \file{Misc/pymemcompat.h} is - distributed with the source to Python 2.3 that allows Python - extensions to use the 2.3 interfaces to memory allocation and compile - against any version of Python since 1.5.2. You would copy the file - from Python's source distribution and bundle it with the source of - your extension. - - \begin{seealso} - - \seeurl{http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Objects/obmalloc.c} - {For the full details of the pymalloc implementation, see - the comments at the top of the file \file{Objects/obmalloc.c} in the - Python source code. The above link points to the file within the - SourceForge CVS browser.} - - \end{seealso} - - - %====================================================================== \section{New and Improved Modules} --- 602,605 ---- *************** *** 832,835 **** --- 748,758 ---- (Contributed by Greg Ward.) + \item The \module{time} module's \function{strptime()} function has + long been an annoyance because it uses the platform C library's + \function{strptime()} implementation, and different platforms + sometimes have odd bugs. Brett Cannon contributed a portable + implementation that's written in pure Python, which should behave + identically on all platforms. + \item The DOM implementation in \module{xml.dom.minidom} can now generate XML output in a *************** *** 840,843 **** --- 763,848 ---- + %====================================================================== + \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}} + + An experimental feature added to Python 2.1 was a specialized object + allocator called pymalloc, written by Vladimir Marangozov. Pymalloc + was intended to be faster than the system \cfunction{malloc()} and have + less memory overhead for typical allocation patterns 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 + enabled by default; you'll have to supply + \longprogramopt{without-pymalloc} to disable it. + + This change is transparent to code written in Python; however, + pymalloc may expose bugs in C extensions. Authors of C extension + modules should test their code with the object allocator enabled, + because some incorrect code may cause core dumps at runtime. There + are a bunch of memory allocation functions in Python's C API that have + previously been just aliases for the C library's \cfunction{malloc()} + and \cfunction{free()}, meaning that if you accidentally called + mismatched functions, the error wouldn't be noticeable. When the + object allocator is enabled, these functions aren't aliases of + \cfunction{malloc()} and \cfunction{free()} any more, and calling the + wrong function to free memory may get you a core dump. For example, + if memory was allocated using \cfunction{PyObject_Malloc()}, it has to + be freed using \cfunction{PyObject_Free()}, not \cfunction{free()}. A + few modules included with Python fell afoul of this and had to be + fixed; doubtless there are more third-party modules that will have the + same problem. + + As part of this change, the confusing multiple interfaces for + allocating memory have been consolidated down into two API families. + Memory allocated with one family must not be manipulated with + functions from the other family. + + There is another family of functions specifically for allocating + Python \emph{objects} (as opposed to memory). + + \begin{itemize} + \item To allocate and free an undistinguished chunk of memory use + the ``raw memory'' family: \cfunction{PyMem_Malloc()}, + \cfunction{PyMem_Realloc()}, and \cfunction{PyMem_Free()}. + + \item The ``object memory'' family is the interface to the pymalloc + facility described above and is biased towards a large number of + ``small'' allocations: \cfunction{PyObject_Malloc}, + \cfunction{PyObject_Realloc}, and \cfunction{PyObject_Free}. + + \item To allocate and free Python objects, use the ``object'' family + \cfunction{PyObject_New()}, \cfunction{PyObject_NewVar()}, and + \cfunction{PyObject_Del()}. + \end{itemize} + + Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides + debugging features to catch memory overwrites and doubled frees in + both extension modules and in the interpreter itself. To enable this + support, turn on the Python interpreter's debugging code by running + \program{configure} with \longprogramopt{with-pydebug}. + + To aid extension writers, a header file \file{Misc/pymemcompat.h} is + distributed with the source to Python 2.3 that allows Python + extensions to use the 2.3 interfaces to memory allocation and compile + against any version of Python since 1.5.2. You would copy the file + from Python's source distribution and bundle it with the source of + your extension. + + \begin{seealso} + + \seeurl{http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Objects/obmalloc.c} + {For the full details of the pymalloc implementation, see + the comments at the top of the file \file{Objects/obmalloc.c} in the + Python source code. The above link points to the file within the + SourceForge CVS browser.} + + \end{seealso} + + % ====================================================================== \section{Build and C API Changes} *************** *** 846,849 **** --- 851,881 ---- \begin{itemize} + + \item The C-level interface to the garbage collector has been changed, + to make it easier to write extension types that support garbage + collection, and to make it easier to debug misuses of the functions. + Various functions have slightly different semantics, so a bunch of + functions had to be renamed. Extensions that use the old API will + still compile but will \emph{not} participate in garbage collection, + so updating them for 2.3 should be considered fairly high priority. + + To upgrade an extension module to the new API, perform the following + steps: + + \begin{itemize} + + \item Rename \cfunction{Py_TPFLAGS_GC} to \cfunction{PyTPFLAGS_HAVE_GC}. + + \item Use \cfunction{PyObject_GC_New} or \cfunction{PyObject_GC_NewVar} to + allocate objects, and \cfunction{PyObject_GC_Del} to deallocate them. + + \item Rename \cfunction{PyObject_GC_Init} to \cfunction{PyObject_GC_Track} and + \cfunction{PyObject_GC_Fini} to \cfunction{PyObject_GC_UnTrack}. + + \item Remove \cfunction{PyGC_HEAD_SIZE} from object size calculations. + + \item Remove calls to \cfunction{PyObject_AS_GC} and \cfunction{PyObject_FROM_GC}. + + \end{itemize} \item Python can now optionally be built as a shared library From bwarsaw@users.sourceforge.net Mon Jul 22 21:45:10 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 22 Jul 2002 13:45:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0295.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv29263 Added Files: pep-0295.txt Log Message: PEP 295, Interpretation of multiline string constants, Koltsov --- NEW FILE: pep-0295.txt --- PEP: 295 Title: Interpretation of multiline string constants Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/07/22 20:45:07 $ Author: yozh@mx1.ru (Stepan Koltsov) Status: Draft Type: Standards Track Created: 22-Jul-2002 Python-Version: 3.0 Post-History: Abstract This PEP describes an interpretation of multiline string constants for Python. It suggests stripping spaces after newlines and stripping a newline if it is first character after an opening quotation. Rationale This PEP proposes an interpretation of multiline string constants in Python. Currently, the value of string constant is all the text between quotations, maybe with escape sequences substituted, e.g.: def f(): """ la-la-la limona, banana """ def g(): return "This is \ string" print repr(f.__doc__) print repr(g()) prints: '\n\tla-la-la\n\tlimona, banana\n\t' 'This is \tstring' This PEP suggest two things - ignore the first character after opening quotation, if it is newline - second: ignore in string constants all spaces and tabs up to first non-whitespace character, but no more then current indentation. After applying this, previous program will print: 'la-la-la\nlimona, banana\n' 'This is string' To get this result, previous programs could be rewritten for current Python as (note, this gives the same result with new strings meaning): def f(): """\ la-la-la limona, banana """ def g(): "This is \ string" Or stripping can be done with library routines at runtime (as pydoc does), but this decreases program readability. Implementation I'll say nothing about CPython, Jython or Python.NET. In original Python, there is no info about the current indentation (in spaces) at compile time, so space and tab stripping should be done at parse time. Currently no flags can be passed to the parser in program text (like from __future__ import xxx). I suggest enabling or disabling of this feature at Python compile time depending of CPP flag Py_PARSE_MULTILINE_STRINGS. Alternatives New interpretation of string constants can be implemented with flags 'i' and 'o' to string constants, like i""" SELECT * FROM car WHERE model = 'i525' """ is in new style, o"""SELECT * FROM employee WHERE birth < 1982 """ is in old style, and """ SELECT employee.name, car.name, car.price FROM employee, car WHERE employee.salary * 36 > car.price """ is in new style after Python-x.y.z and in old style otherwise. Also this feature can be disabled if string is raw, i.e. if flag 'r' specified. Copyright This document has been placed in the Public Domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Jul 22 21:45:26 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 22 Jul 2002 13:45:26 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.196,1.197 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv29338 Modified Files: pep-0000.txt Log Message: Added PEP 295, Interpretation of multiline string constants, Koltsov Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.196 retrieving revision 1.197 diff -C2 -d -r1.196 -r1.197 *** pep-0000.txt 15 Jul 2002 18:37:26 -0000 1.196 --- pep-0000.txt 22 Jul 2002 20:45:24 -0000 1.197 *************** *** 101,104 **** --- 101,105 ---- S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh + S 295 Interpretation of multiline string constants Koltsov Finished PEPs (done, implemented in CVS) *************** *** 280,283 **** --- 281,285 ---- S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh + S 295 Interpretation of multiline string constants Koltsov SR 666 Reject Foolish Indentation Creighton *************** *** 320,323 **** --- 322,326 ---- Hylton, Jeremy jeremy@zope.com Jansen, Jack jack@cwi.nl + Koltsov, Stepan yozh@mx1.ru Kuchling, Andrew akuchlin@mems-exchange.org Lemburg, Marc-Andre mal@lemburg.com From bwarsaw@users.sourceforge.net Mon Jul 22 22:03:37 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 22 Jul 2002 14:03:37 -0700 Subject: [Python-checkins] python/nondist/peps pep-0296.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2609 Added Files: pep-0296.txt Log Message: PEP 296, The Buffer Problem, Gilbert --- NEW FILE: pep-0296.txt --- PEP: 296 Title: The Buffer Problem Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/07/22 21:03:34 $ Author: xscottg at yahoo.com (Scott Gilbert) Status: Draft Type: Standards Track Created: 12-Jul-2002 Python-Version: 2.3 Post-History: Abstract This PEP proposes the creation of a new standard type and builtin constructor called 'bytes'. The bytes object is an efficiently stored array of bytes with some additional characteristics that set it apart from several implementations that are similar. Rationale Python currently has many objects that implement something akin to the bytes object of this proposal. For instance the standard string, buffer, array, and mmap objects are all very similar in some regards to the bytes object. Additionally, several significant third party extensions have created similar objects to try and fill similar needs. Frustratingly, each of these objects is too narrow in scope and is missing critical features to make it applicable to a wider category of problems. Specification The bytes object has the following important characteristics: 1. Efficient underlying array storage via the standard C type "unsigned char". This allows fine grain control over how much memory is allocated. With the alignment restrictions designated in the next item, it is trivial for low level extensions to cast the pointer to a different type as needed. Also, since the object is implemented as an array of bytes, it is possible to pass the bytes object to the extensive library of routines already in the standard library that presently work with strings. For instance, the bytes object in conjunction with the struct module could be used to provide a complete replacement for the array module using only Python script. If an unusual platform comes to light, one where there isn't a native unsigned 8 bit type, the object will do its best to represent itself at the Python script level as though it were an array of 8 bit unsigned values. It is doubtful whether many extensions would handle this correctly, but Python script could be portable in these cases. 2. Alignment of the allocated byte array is whatever is promised by the platform implementation of malloc. A bytes object created from an extension can be supplied that provides any arbitrary alignment as the extension author sees fit. This alignment restriction should allow the bytes object to be used as storage for all standard C types - including PyComplex objects or other structs of standard C type types. Further alignment restrictions can be provided by extensions as necessary. 3. The bytes object implements a subset of the sequence operations provided by string/array objects, but with slightly different semantics in some cases. In particular, a slice always returns a new bytes object, but the underlying memory is shared between the two objects. This type of slice behavior has been called creating a "view". Additionally, repetition and concatenation are undefined for bytes objects and will raise an exception. As these objects are likely to find use in high performance applications, one motivation for the decision to use view slicing is that copying between bytes objects should be very efficient and not require the creation of temporary objects. The following code illustrates this: # create two 10 Meg bytes objects b1 = bytes(10000000) b2 = bytes(10000000) # copy from part of one to another with out creating a 1 Meg temporary b1[2000000:3000000] = b2[4000000:5000000] Slice assignment where the rvalue is not the same length as the lvalue will raise an exception. However, slice assignment will work correctly with overlapping slices (typically implemented with memmove). 4. The bytes object will be recognized as a native type by the pickle and cPickle modules for efficient serialization. (In truth, this is the only requirement that can't be implemented via a third party extension.) Partial solutions to address the need to serialize the data stored in a bytes-like object without creating a temporary copy of the data into a string have been implemented in the past. The tofile and fromfile methods of the array object are good examples of this. The bytes object will support these methods too. However, pickling is useful in other situations - such as in the shelve module, or implementing RPC of Python objects, and requiring the end user to use two different serialization mechanisms to get an efficient transfer of data is undesirable. XXX: Will try to implement pickling of the new bytes object in such a way that previous versions of Python will unpickle it as a string object. When unpickling, the bytes object will be created from memory allocated from Python (via malloc). As such, it will lose any additional properties that an extension supplied pointer might have provided (special alignment, or special types of memory). XXX: Will try to make it so that C subclasses of bytes type can supply the memory that will be unpickled into. For instance, a derived class called PageAlignedBytes would unpickle to memory that is also page aligned. On any platform where an int is 32 bits (most of them), it is currently impossible to create a string with a length larger than can be represented in 31 bits. As such, pickling to a string will raise an exception when the operation is not possible. At least on platforms supporting large files (many of them), pickling large bytes objects to files should be possible via repeated calls to the file.write() method. 5. The bytes type supports the PyBufferProcs interface, but a bytes object provides the additional guarantee that the pointer will not be deallocated or reallocated as long as a reference to the bytes object is held. This implies that a bytes object is not resizable once it is created, but allows the global interpreter lock (GIL) to be released while a separate thread manipulates the memory pointed to if the PyBytes_Check(...) test passes. This characteristic of the bytes object allows it to be used in situations such as asynchronous file I/O or on multiprocessor machines where the pointer obtained by PyBufferProcs will be used independently of the global interpreter lock. Knowing that the pointer can not be reallocated or freed after the GIL is released gives extension authors the capability to get true concurrency and make use of additional processors for long running computations on the pointer. 6. In C/C++ extensions, the bytes object can be created from a supplied pointer and destructor function to free the memory when the reference count goes to zero. The special implementation of slicing for the bytes object allows multiple bytes objects to refer to the same pointer/destructor. As such, a refcount will be kept on the actual pointer/destructor. This refcount is separate from the refcount typically associated with Python objects. XXX: It may be desirable to expose the inner refcounted object as an actual Python object. If a good use case arises, it should be possible for this to be implemented later with no loss to backwards compatibility. 7. It is also possible to signify the bytes object as readonly, in this case it isn't actually mutable, but does provide the other features of a bytes object. 8. The bytes object keeps track of the length of its data with a Python LONG_LONG type. Even though the current definition for PyBufferProcs restricts the length to be the size of an int, this PEP does not propose to make any changes there. Instead, extensions can work around this limit by making an explicit PyBytes_Check(...) call, and if that succeeds they can make a PyBytes_GetReadBuffer(...) or PyBytes_GetWriteBuffer call to get the pointer and full length of the object as a LONG_LONG. The bytes object will raise an exception if the standard PyBufferProcs mechanism is used and the size of the bytes object is greater than can be represented by an integer. From Python scripting, the bytes object will be subscriptable with longs so the 32 bit int limit can be avoided. There is still a problem with the len() function as it is PyObject_Size() and this returns an int as well. As a workaround, the bytes object will provide a .length() method that will return a long. 9. The bytes object can be constructed at the Python scripting level by passing an int/long to the bytes constructor with the number of bytes to allocate. For example: b = bytes(100000) # alloc 100K bytes The constructor can also take another bytes object. This will be useful for the implementation of unpickling, and in converting a read-write bytes object into a read-only one. An optional second argument will be used to designate creation of a readonly bytes object. 10. From the C API, the bytes object can be allocated using any of the following signatures: PyObject* PyBytes_FromLength(LONG_LONG len, int readonly); PyObject* PyBytes_FromPointer(void* ptr, LONG_LONG len, int readonly void (*dest)(void *ptr, void *user), void* user); In the PyBytes_FromPointer(...) function, if the dest function pointer is passed in as NULL, it will not be called. This should only be used for creating bytes objects from statically allocated space. The user pointer has been called a closure in other places. It is a pointer that the user can use for whatever purposes. It will be passed to the destructor function on cleanup and can be useful for a number of things. If the user pointer is not needed, NULL should be passed instead. 11. The bytes type will be a new style class as that seems to be where all standard Python types are headed. Contrast to existing types The most common way to work around the lack of a bytes object has been to simply use a string object in its place. Binary files, the struct/array modules, and several other examples exist of this. Putting aside the style issue that these uses typically have nothing to do with text strings, there is the real problem that strings are not mutable, so direct manipulation of the data returned in these cases is not possible. Also, numerous optimizations in the string module (such as caching the hash value or interning the pointers) mean that extension authors are on very thin ice if they try to break the rules with the string object. The buffer object seems like it was intended to address the purpose that the bytes object is trying fulfill, but several shortcomings in its implementation [1] have made it less useful in many common cases. The buffer object made a different choice for its slicing behavior (it returns new strings instead of buffers for slicing and other operations), and it doesn't make many of the promises on alignment or being able to release the GIL that the bytes object does. Also in regards to the buffer object, it is not possible to simply replace the buffer object with the bytes object and maintain backwards compatibility. The buffer object provides a mechanism to take the PyBufferProcs supplied pointer of another object and present it as its own. Since the behavior of the other object can not be guaranteed to follow the same set of strict rules that a bytes object does, it can't be used in places that a bytes object could. The array module supports the creation of an array of bytes, but it does not provide a C API for supplying pointers and destructors to extension supplied memory. This makes it unusable for constructing objects out of shared memory, or memory that has special alignment or locking for things like DMA transfers. Also, the array object does not currently pickle. Finally since the array object allows its contents to grow, via the extend method, the pointer can be changed if the GIL is not held while using it. Creating a buffer object from an array object has the same problem of leaving an invalid pointer when the array object is resized. The mmap object caters to its particular niche, but does not attempt to solve a wider class of problems. Finally, any third party extension can not implement pickling without creating a temporary object of a standard python type. For example in the Numeric community, it is unpleasant that a large array can't pickle without creating a large binary string to duplicate the array data. Backward Compatibility The only possibility for backwards compatibility problems that the author is aware of are in previous versions of Python that try to unpickle data containing the new bytes type. Reference Implementation XXX: Actual implementation is in progress, but changes are still possible as this PEP gets further review. The following new files will be added to the Python baseline: Include/bytesobject.h # C interface Objects/bytesobject.c # C implementation Lib/test/test_bytes.py # unit testing Doc/lib/libbytes.tex # documentation The following files will also be modified: Include/Python.h # adding bytesmodule.h include file Python/bltinmodule.c # adding the bytes type object Modules/cPickle.c # adding bytes to the standard types Lib/pickle.py # adding bytes to the standard types It is possible that several other modules could be cleaned up and implemented in terms of the bytes object. The mmap module comes to mind first, but as noted above it would be possible to reimplement the array module as a pure Python module. While it is attractive that this PEP could actually reduce the amount of source code by some amount, the author feels that this could cause unnecessary risk for breaking existing applications and should be avoided at this time. Additional Notes/Comments - Guido van Rossum wondered whether it would make sense to be able to create a bytes object from a mmap object. The mmap object appears to support the requirements necessary to provide memory for a bytes object. (It doesn't resize, and the pointer is valid for the lifetime of the object.) As such, a method could be added to the mmap module such that a bytes object could be created directly from a mmap object. An initial stab at how this would be implemented would be to use the PyBytes_FromPointer() function described above and pass the mmap_object as the user pointer. The destructor function would decref the mmap_object for cleanup. - Todd Miller notes that it may be useful to have two new functions: PyObject_AsLargeReadBuffer() and PyObject_AsLargeWriteBuffer that are similar to PyObject_AsReadBuffer() and PyObject_AsWriteBuffer(), but support getting a LONG_LONG length in addition to the void* pointer. These functions would allow extension authors to work transparently with bytes object (that support LONG_LONG lengths) and most other buffer like objects (which only support int lengths). These functions could be in lieu of, or in addition to, creating a specific PyByte_GetReadBuffer() and PyBytes_GetWriteBuffer() functions. XXX: The author thinks this is very a good idea as it paves the way for other objects to eventually support large (64 bit) pointers, and it should only affect abstract.c and abstract.h. Should this be added above? - It was generally agreed that abusing the segment count of the PyBufferProcs interface is not a good hack to work around the 31 bit limitation of the length. If you don't know what this means, then you're in good company. Most code in the Python baseline, and presumably in many third party extensions, punt when the segment count is not 1. References [1] The buffer interface http://mail.python.org/pipermail/python-dev/2000-October/009974.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Jul 22 22:04:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 22 Jul 2002 14:04:02 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.197,1.198 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2758 Modified Files: pep-0000.txt Log Message: PEP 296, The Buffer Problem, Gilbert Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.197 retrieving revision 1.198 diff -C2 -d -r1.197 -r1.198 *** pep-0000.txt 22 Jul 2002 20:45:24 -0000 1.197 --- pep-0000.txt 22 Jul 2002 21:04:00 -0000 1.198 *************** *** 102,105 **** --- 102,106 ---- S 294 Type Names in the types Module Tirosh S 295 Interpretation of multiline string constants Koltsov + S 296 The Buffer Problem Gilbert Finished PEPs (done, implemented in CVS) *************** *** 282,285 **** --- 283,287 ---- S 294 Type Names in the types Module Tirosh S 295 Interpretation of multiline string constants Koltsov + S 296 The Buffer Problem Gilbert SR 666 Reject Foolish Indentation Creighton *************** *** 314,317 **** --- 316,320 ---- Faassen, Martijn faassen@infrae.com Giacometti, Frédéric B. fred@arakne.com + Gilbert, Scott xscottg at yahoo.com Goodger, David goodger@users.sourceforge.net Griffin, Grant g2@iowegian.com From nnorwitz@users.sourceforge.net Tue Jul 23 03:53:00 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 22 Jul 2002 19:53:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.162,1.163 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv2852/Lib/lib-tk Modified Files: Tkinter.py Log Message: SF patch #581396, Canvas "select_item" always returns None Return the selected item, if there is any. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** Tkinter.py 23 Apr 2002 13:27:24 -0000 1.162 --- Tkinter.py 23 Jul 2002 02:52:58 -0000 1.163 *************** *** 2104,2108 **** def select_item(self): """Return the item which has the selection.""" ! self.tk.call(self._w, 'select', 'item') def select_to(self, tagOrId, index): """Set the variable end of a selection in item TAGORID to INDEX.""" --- 2104,2108 ---- def select_item(self): """Return the item which has the selection.""" ! return self.tk.call(self._w, 'select', 'item') or None def select_to(self, tagOrId, index): """Set the variable end of a selection in item TAGORID to INDEX.""" From nnorwitz@users.sourceforge.net Tue Jul 23 03:55:16 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 22 Jul 2002 19:55:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.160,1.160.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv3556/Lib/lib-tk Modified Files: Tag: release22-maint Tkinter.py Log Message: SF patch #581396, Canvas "select_item" always returns None Return the selected item, if there is any. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.160 retrieving revision 1.160.10.1 diff -C2 -d -r1.160 -r1.160.10.1 *** Tkinter.py 13 Oct 2001 09:33:51 -0000 1.160 --- Tkinter.py 23 Jul 2002 02:55:14 -0000 1.160.10.1 *************** *** 2096,2100 **** def select_item(self): """Return the item which has the selection.""" ! self.tk.call(self._w, 'select', 'item') def select_to(self, tagOrId, index): """Set the variable end of a selection in item TAGORID to INDEX.""" --- 2096,2100 ---- def select_item(self): """Return the item which has the selection.""" ! return self.tk.call(self._w, 'select', 'item') or None def select_to(self, tagOrId, index): """Set the variable end of a selection in item TAGORID to INDEX.""" From gvanrossum@users.sourceforge.net Tue Jul 23 04:32:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 22 Jul 2002 20:32:13 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.443,1.444 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10737 Modified Files: NEWS Log Message: Add news about strptime and socket.setdefaulttimeout(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.443 retrieving revision 1.444 diff -C2 -d -r1.443 -r1.444 *** NEWS 22 Jul 2002 13:21:10 -0000 1.443 --- NEWS 23 Jul 2002 03:32:08 -0000 1.444 *************** *** 144,147 **** --- 144,150 ---- Extension modules + - The strptime function in the time module is now always available (a + Python implementation is used when the C library doesn't define it). + - The 'new' module is no longer an extension, but a Python module that only exists for backwards compatibility. Its contents are no longer *************** *** 198,202 **** a float expressing seconds, subsequent operations raise an exception if they cannot be completed within T seconds. To disable timeout ! mode, use s.settimeout(None). - getopt.gnu_getopt was added. This supports GNU-style option --- 201,207 ---- a float expressing seconds, subsequent operations raise an exception if they cannot be completed within T seconds. To disable timeout ! mode, use s.settimeout(None). There's also a module function, ! socket.setdefaulttimeout(T), which sets the default for all sockets ! created henceforth. - getopt.gnu_getopt was added. This supports GNU-style option From neal@metaslash.com Tue Jul 23 04:38:19 2002 From: neal@metaslash.com (Neal Norwitz) Date: Mon, 22 Jul 2002 23:38:19 -0400 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.443,1.444 References: Message-ID: <3D3CCFAB.FF64237D@metaslash.com> gvanrossum@users.sourceforge.net wrote: > > Modified Files: > NEWS > Log Message: > Add news about strptime and socket.setdefaulttimeout(). Should PEP 42 remove the ref to strptime? Neal From gvanrossum@users.sourceforge.net Tue Jul 23 04:44:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 22 Jul 2002 20:44:38 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.444,1.445 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12934 Modified Files: NEWS Log Message: News about StopIteration as a "sink state". Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.444 retrieving revision 1.445 diff -C2 -d -r1.444 -r1.445 *** NEWS 23 Jul 2002 03:32:08 -0000 1.444 --- NEWS 23 Jul 2002 03:44:35 -0000 1.445 *************** *** 7,10 **** --- 7,18 ---- Core and builtins + - All standard iterators now ensure that, once StopIteration has been + raised, all future calls to next() on the same iterator will also + raise StopIteration. There used to be various counterexamples to + this behavior, which could caused confusion or subtle program + breakage, without any benefits. (Note that this is still an + iterator's responsibility; the iterator framework does not enforce + this.) + - Ctrl+C handling on Windows has been made more consistent with other platforms. KeyboardInterrupt can now reliably be caught, From guido@python.org Tue Jul 23 04:54:23 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 22 Jul 2002 23:54:23 -0400 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.443,1.444 References: <3D3CCFAB.FF64237D@metaslash.com> Message-ID: <01e501c231fc$a344a620$5800a8c0@guido> > Should PEP 42 remove the ref to strptime? Sure go ahead. Maybe you can see if other wishes have been fulfulled by now? (Or think of some that you can easily grant? :-) --Guido van Rossum (home page: http://www.python.org/~guido/) From bwarsaw@users.sourceforge.net Tue Jul 23 05:29:56 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 22 Jul 2002 21:29:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv20667 Modified Files: Header.py Log Message: make_header(): Watch out for charset is None, which decode_header() will return as the charset if implicit us-ascii is used. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Header.py 9 Jul 2002 16:33:47 -0000 1.8 --- Header.py 23 Jul 2002 04:29:54 -0000 1.9 *************** *** 56,60 **** if not ecre.search(header): return [(header, None)] - decoded = [] dec = '' --- 56,59 ---- *************** *** 64,68 **** decoded.append((line, None)) continue - parts = ecre.split(line) while parts: --- 63,66 ---- *************** *** 109,113 **** continuation_ws=continuation_ws) for s, charset in decoded_seq: ! if not isinstance(charset, Charset): charset = Charset(charset) h.append(s, charset) --- 107,112 ---- continuation_ws=continuation_ws) for s, charset in decoded_seq: ! # None means us-ascii but we can simply pass it on to h.append() ! if charset is not None and not isinstance(charset, Charset): charset = Charset(charset) h.append(s, charset) From bwarsaw@users.sourceforge.net Tue Jul 23 07:08:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 22 Jul 2002 23:08:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Header.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv10572 Modified Files: Header.py Log Message: append(): Bite the bullet and let charset be the string name of a character set, which we'll convert to a Charset instance. Sigh. Index: Header.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Header.py 23 Jul 2002 04:29:54 -0000 1.9 --- Header.py 23 Jul 2002 06:08:10 -0000 1.10 *************** *** 189,198 **** """Append string s with Charset charset to the MIME header. ! charset defaults to the one given in the class constructor. If ! charset is given, it should be an instance of Charset (not a character ! set name string!). """ if charset is None: charset = self._charset self._chunks.append((s, charset)) --- 189,201 ---- """Append string s with Charset charset to the MIME header. ! If charset is given, it should be a Charset instance, or the name of a ! character set (which will be converted to a Charset instance). A ! value of None (the default) means charset is the one given in the ! class constructor. """ if charset is None: charset = self._charset + elif not isinstance(charset, Charset): + charset = Charset(charset) self._chunks.append((s, charset)) From mhammond@users.sourceforge.net Tue Jul 23 07:31:17 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 22 Jul 2002 23:31:17 -0700 Subject: [Python-checkins] python/dist/src/Modules bsddbmodule.c,1.36,1.37 mmapmodule.c,2.39,2.40 parsermodule.c,2.71,2.72 selectmodule.c,2.66,2.67 socketmodule.c,1.234,1.235 unicodedata.c,2.18,2.19 zlibmodule.c,2.64,2.65 _testcapimodule.c,1.16,1.17 _tkinter.c,1.126,1.127 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14945/Modules Modified Files: bsddbmodule.c mmapmodule.c parsermodule.c selectmodule.c socketmodule.c unicodedata.c zlibmodule.c _testcapimodule.c _tkinter.c Log Message: Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." link command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error. Index: bsddbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bsddbmodule.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** bsddbmodule.c 17 Jul 2002 16:30:36 -0000 1.36 --- bsddbmodule.c 23 Jul 2002 06:31:12 -0000 1.37 *************** *** 842,846 **** }; ! DL_EXPORT(void) initbsddb(void) { PyObject *m, *d; --- 842,846 ---- }; ! PyMODINIT_FUNC initbsddb(void) { PyObject *m, *d; Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** mmapmodule.c 30 Jun 2002 15:26:09 -0000 2.39 --- mmapmodule.c 23 Jul 2002 06:31:13 -0000 2.40 *************** *** 1052,1056 **** }; ! DL_EXPORT(void) initmmap(void) { --- 1052,1056 ---- }; ! PyMODINIT_FUNC initmmap(void) { Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.71 retrieving revision 2.72 diff -C2 -d -r2.71 -r2.72 *** parsermodule.c 17 Jul 2002 16:30:37 -0000 2.71 --- parsermodule.c 23 Jul 2002 06:31:13 -0000 2.72 *************** *** 2853,2859 **** ! DL_EXPORT(void) initparser(void); /* supply a prototype */ ! DL_EXPORT(void) initparser(void) { --- 2853,2859 ---- ! PyMODINIT_FUNC initparser(void); /* supply a prototype */ ! PyMODINIT_FUNC initparser(void) { Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** selectmodule.c 17 Jul 2002 16:49:03 -0000 2.66 --- selectmodule.c 23 Jul 2002 06:31:13 -0000 2.67 *************** *** 636,640 **** On Windows, only sockets are supported; on Unix, all file descriptors."); ! DL_EXPORT(void) initselect(void) { --- 636,640 ---- On Windows, only sockets are supported; on Unix, all file descriptors."); ! PyMODINIT_FUNC initselect(void) { Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** socketmodule.c 19 Jul 2002 12:44:59 -0000 1.234 --- socketmodule.c 23 Jul 2002 06:31:13 -0000 1.235 *************** *** 531,535 **** static double defaulttimeout = -1.0; /* Default timeout for new sockets */ ! static void init_sockobject(PySocketSockObject *s, SOCKET_T fd, int family, int type, int proto) --- 531,535 ---- static double defaulttimeout = -1.0; /* Default timeout for new sockets */ ! PyMODINIT_FUNC init_sockobject(PySocketSockObject *s, SOCKET_T fd, int family, int type, int proto) Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** unicodedata.c 13 Jun 2002 20:32:53 -0000 2.18 --- unicodedata.c 23 Jul 2002 06:31:14 -0000 2.19 *************** *** 461,465 **** PyDoc_STRVAR(unicodedata_docstring, "unicode character database"); ! DL_EXPORT(void) initunicodedata(void) { --- 461,465 ---- PyDoc_STRVAR(unicodedata_docstring, "unicode character database"); ! PyMODINIT_FUNC initunicodedata(void) { Index: zlibmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -d -r2.64 -r2.65 *** zlibmodule.c 17 Jul 2002 16:49:03 -0000 2.64 --- zlibmodule.c 23 Jul 2002 06:31:14 -0000 2.65 *************** *** 835,839 **** "objects support decompress() and flush()."); ! DL_EXPORT(void) PyInit_zlib(void) { --- 835,839 ---- "objects support decompress() and flush()."); ! PyMODINIT_FUNC PyInit_zlib(void) { Index: _testcapimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _testcapimodule.c 1 Apr 2002 14:28:58 -0000 1.16 --- _testcapimodule.c 23 Jul 2002 06:31:14 -0000 1.17 *************** *** 377,381 **** }; ! DL_EXPORT(void) init_testcapi(void) { --- 377,381 ---- }; ! PyMODINIT_FUNC init_testcapi(void) { Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** _tkinter.c 17 Jul 2002 16:30:35 -0000 1.126 --- _tkinter.c 23 Jul 2002 06:31:14 -0000 1.127 *************** *** 2110,2114 **** ! DL_EXPORT(void) init_tkinter(void) { --- 2110,2114 ---- ! PyMODINIT_FUNC init_tkinter(void) { From mhammond@users.sourceforge.net Tue Jul 23 07:31:17 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 22 Jul 2002 23:31:17 -0700 Subject: [Python-checkins] python/dist/src/PCbuild bsddb.dsp,1.14,1.15 mmap.dsp,1.8,1.9 parser.dsp,1.13,1.14 pyexpat.dsp,1.9,1.10 select.dsp,1.4,1.5 unicodedata.dsp,1.7,1.8 winsound.dsp,1.7,1.8 zlib.dsp,1.16,1.17 _socket.dsp,1.4,1.5 _sre.dsp,1.7,1.8 _symtable.dsp,1.3,1.4 _testcapi.dsp,1.2,1.3 _tkinter.dsp,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv14945/PCbuild Modified Files: bsddb.dsp mmap.dsp parser.dsp pyexpat.dsp select.dsp unicodedata.dsp winsound.dsp zlib.dsp _socket.dsp _sre.dsp _symtable.dsp _testcapi.dsp _tkinter.dsp Log Message: Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." link command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error. Index: bsddb.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/bsddb.dsp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** bsddb.dsp 10 Jul 2002 06:22:10 -0000 1.14 --- bsddb.dsp 23 Jul 2002 06:31:14 -0000 1.15 *************** *** 5,9 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=bsddb - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 5,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=bsddb - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 14,18 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "bsddb.mak" CFG="bsddb - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "bsddb.mak" CFG="bsddb - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 55,60 **** 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 ..\..\bsddb\port\win32\db.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./bsddb.pyd" /export:initbsddb ! # SUBTRACT LINK32 /verbose /pdb:none !ELSEIF "$(CFG)" == "bsddb - Win32 Debug" --- 55,60 ---- 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 ..\..\bsddb\port\win32\db.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./bsddb.pyd" ! # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "bsddb - Win32 Debug" *************** *** 83,88 **** 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 ..\..\bsddb\port\win32\db.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"MSVCRT" /out:"./bsddb_d.pyd" /pdbtype:sept /export:initbsddb ! # SUBTRACT LINK32 /verbose /pdb:none !ENDIF --- 83,88 ---- 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 ..\..\bsddb\port\win32\db.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"MSVCRT" /out:"./bsddb_d.pyd" /pdbtype:sept ! # SUBTRACT LINK32 /pdb:none !ENDIF Index: mmap.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/mmap.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mmap.dsp 11 Jan 2001 22:46:45 -0000 1.8 --- mmap.dsp 23 Jul 2002 06:31:15 -0000 1.9 *************** *** 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 /dll /machine:I386 ! # ADD 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 /base:"0x1e1F0000" /dll /machine:I386 /out:"./mmap.pyd" /export:initmmap # 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 /dll /machine:I386 ! # ADD 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 /base:"0x1e1F0000" /dll /machine:I386 /out:"./mmap.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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1e1F0000" /dll /debug /machine:I386 /out:"./mmap_d.pyd" /pdbtype:sept /export:initmmap # 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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1e1F0000" /dll /debug /machine:I386 /out:"./mmap_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: parser.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/parser.dsp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** parser.dsp 10 Jul 2002 06:22:10 -0000 1.13 --- parser.dsp 23 Jul 2002 06:31:15 -0000 1.14 *************** *** 5,9 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=parser - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 5,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=parser - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 14,18 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "parser.mak" CFG="parser - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "parser.mak" CFG="parser - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 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:"0x1e1A0000" /subsystem:windows /dll /debug /machine:I386 /out:"./parser.pyd" /export:initparser # 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:"0x1e1A0000" /subsystem:windows /dll /debug /machine:I386 /out:"./parser.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:"0x1e1A0000" /subsystem:windows /dll /debug /machine:I386 /out:"./parser_d.pyd" /pdbtype:sept /export:initparser # 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:"0x1e1A0000" /subsystem:windows /dll /debug /machine:I386 /out:"./parser_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: pyexpat.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pyexpat.dsp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pyexpat.dsp 10 Jul 2002 06:22:10 -0000 1.9 --- pyexpat.dsp 23 Jul 2002 06:31:15 -0000 1.10 *************** *** 5,9 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=pyexpat - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 5,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=pyexpat - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 14,18 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "pyexpat.mak" CFG="pyexpat - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "pyexpat.mak" CFG="pyexpat - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 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:"0x1D100000" /subsystem:windows /dll /debug /machine:I386 /out:"./pyexpat.pyd" /export:initpyexpat # 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:"0x1D100000" /subsystem:windows /dll /debug /machine:I386 /out:"./pyexpat.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:"0x1D100000" /subsystem:windows /dll /debug /machine:I386 /out:"./pyexpat_d.pyd" /pdbtype:sept /export:initpyexpat # 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:"0x1D100000" /subsystem:windows /dll /debug /machine:I386 /out:"./pyexpat_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: select.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/select.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** select.dsp 13 Aug 2000 22:59:26 -0000 1.4 --- select.dsp 23 Jul 2002 06:31:15 -0000 1.5 *************** *** 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 wsock32.lib /nologo /base:"0x1D110000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./select.pyd" /export:initselect # 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 wsock32.lib /nologo /base:"0x1D110000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./select.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 wsock32.lib /nologo /base:"0x1D110000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"msvcrt" /out:"./select_d.pyd" /pdbtype:sept /export:initselect # 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 wsock32.lib /nologo /base:"0x1D110000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"msvcrt" /out:"./select_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: unicodedata.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/unicodedata.dsp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** unicodedata.dsp 21 Jan 2001 23:49:56 -0000 1.7 --- unicodedata.dsp 23 Jul 2002 06:31:15 -0000 1.8 *************** *** 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 /dll /machine:I386 ! # ADD 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 /base:"0x1D120000" /dll /machine:I386 /out:"./unicodedata.pyd" /export:initunicodedata # 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 /dll /machine:I386 ! # ADD 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 /base:"0x1D120000" /dll /machine:I386 /out:"./unicodedata.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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1D120000" /dll /debug /machine:I386 /out:"./unicodedata_d.pyd" /pdbtype:sept /export:initunicodedata # 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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1D120000" /dll /debug /machine:I386 /out:"./unicodedata_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: winsound.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/winsound.dsp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** winsound.dsp 6 Sep 2001 06:39:39 -0000 1.7 --- winsound.dsp 23 Jul 2002 06:31:15 -0000 1.8 *************** *** 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 /dll /machine:I386 ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.pyd" /export:initwinsound # 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 /dll /machine:I386 ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /machine:I386 /out:"./winsound.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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept /export:initwinsound # 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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib winmm.lib /nologo /base:"0x1D160000" /dll /debug /machine:I386 /out:"./winsound_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: zlib.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/zlib.dsp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** zlib.dsp 13 Mar 2002 21:51:55 -0000 1.16 --- zlib.dsp 23 Jul 2002 06:31:15 -0000 1.17 *************** *** 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 ..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib.pyd" /export:initzlib # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool --- 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 ..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib.pyd" # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool *************** *** 88,92 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib_d.pyd" /pdbtype:sept /export:initzlib # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool --- 88,92 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool Index: _socket.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_socket.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _socket.dsp 13 Aug 2000 22:59:26 -0000 1.4 --- _socket.dsp 23 Jul 2002 06:31:15 -0000 1.5 *************** *** 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 wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd" /export:init_socket # 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 wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.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 wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept /export:init_socket # 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 wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: _sre.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_sre.dsp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _sre.dsp 10 Jul 2002 06:22:10 -0000 1.7 --- _sre.dsp 23 Jul 2002 06:31:15 -0000 1.8 *************** *** 5,9 **** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=_sre - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 5,9 ---- # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 ! CFG=_sre - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 14,18 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "_sre.mak" CFG="_sre - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "_sre.mak" CFG="_sre - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: *************** *** 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:"0x1e1e0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sre.pyd" /export:init_sre # 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:"0x1e1e0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sre.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:"0x1e1e0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sre_d.pyd" /pdbtype:sept /export:init_sre # 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:"0x1e1e0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sre_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: _symtable.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_symtable.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _symtable.dsp 6 Sep 2001 06:39:39 -0000 1.3 --- _symtable.dsp 23 Jul 2002 06:31:15 -0000 1.4 *************** *** 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 /dll /machine:I386 ! # ADD 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 /base:"0x1e100000" /dll /machine:I386 /out:"./_symtable.pyd" /export:init_symtable # 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 /dll /machine:I386 ! # ADD 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 /base:"0x1e100000" /dll /machine:I386 /out:"./_symtable.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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1e100000" /dll /debug /machine:I386 /out:"./_symtable_d.pyd" /pdbtype:sept /export:init_symtable # 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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1e100000" /dll /debug /machine:I386 /out:"./_symtable_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: _testcapi.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_testcapi.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _testcapi.dsp 14 Feb 2001 09:43:47 -0000 1.2 --- _testcapi.dsp 23 Jul 2002 06:31:15 -0000 1.3 *************** *** 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 /dll /machine:I386 ! # ADD 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 /base:"0x1e1F0000" /dll /machine:I386 /out:"./_testcapi.pyd" /export:init_testcapi # 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 /dll /machine:I386 ! # ADD 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 /base:"0x1e1F0000" /dll /machine:I386 /out:"./_testcapi.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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1e1F0000" /dll /debug /machine:I386 /out:"./_testcapi_d.pyd" /pdbtype:sept /export:init_testcapi # 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 /dll /debug /machine:I386 /pdbtype:sept ! # ADD 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 /base:"0x1e1F0000" /dll /debug /machine:I386 /out:"./_testcapi_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: _tkinter.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_tkinter.dsp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _tkinter.dsp 10 Jul 2002 06:22:10 -0000 1.19 --- _tkinter.dsp 23 Jul 2002 06:31:15 -0000 1.20 *************** *** 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 /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\tcl\lib\tk83.lib ..\..\tcl\lib\tcl83.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" /export:init_tkinter # 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 /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\tcl\lib\tk83.lib ..\..\tcl\lib\tcl83.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" # 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 /machine:I386 ! # ADD LINK32 ..\..\tcl\lib\tk83.lib ..\..\tcl\lib\tcl83.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" /export:init_tkinter # 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 /machine:I386 ! # ADD LINK32 ..\..\tcl\lib\tk83.lib ..\..\tcl\lib\tcl83.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none From lemburg@users.sourceforge.net Tue Jul 23 16:14:08 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Tue, 23 Jul 2002 08:14:08 -0700 Subject: [Python-checkins] python/nondist/peps pep-0297.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14458 Added Files: pep-0297.txt Log Message: First version of the PEP. --- NEW FILE: pep-0297.txt --- (This appears to be a binary file; contents omitted.) From bwarsaw@users.sourceforge.net Tue Jul 23 20:04:14 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:04:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/data PyBanner048.gif,1.1,NONE msg_01.txt,1.1,NONE msg_02.txt,1.1,NONE msg_03.txt,1.1,NONE msg_04.txt,1.1,NONE msg_05.txt,1.1,NONE msg_06.txt,1.1,NONE msg_07.txt,1.1,NONE msg_08.txt,1.1,NONE msg_09.txt,1.1,NONE msg_10.txt,1.1,NONE msg_11.txt,1.1,NONE msg_12.txt,1.1,NONE msg_13.txt,1.1,NONE msg_14.txt,1.1,NONE msg_15.txt,1.1,NONE msg_16.txt,1.1,NONE msg_17.txt,1.1,NONE msg_18.txt,1.1,NONE msg_19.txt,1.1,NONE msg_20.txt,1.1,NONE msg_21.txt,1.1,NONE msg_22.txt,1.1,NONE msg_23.txt,1.1,NONE msg_24.txt,1.1,NONE msg_25.txt,1.1,NONE msg_26.txt,1.1,NONE msg_27.txt,1.1,NONE msg_28.txt,1.1,NONE msg_29.txt,1.1,NONE msg_30.txt,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/data In directory usw-pr-cvs1:/tmp/cvs-serv26271/Lib/test/data Removed Files: PyBanner048.gif msg_01.txt msg_02.txt msg_03.txt msg_04.txt msg_05.txt msg_06.txt msg_07.txt msg_08.txt msg_09.txt msg_10.txt msg_11.txt msg_12.txt msg_13.txt msg_14.txt msg_15.txt msg_16.txt msg_17.txt msg_18.txt msg_19.txt msg_20.txt msg_21.txt msg_22.txt msg_23.txt msg_24.txt msg_25.txt msg_26.txt msg_27.txt msg_28.txt msg_29.txt msg_30.txt Log Message: Get rid of relative imports in all unittests. Now anything that imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :) --- PyBanner048.gif DELETED --- --- msg_01.txt DELETED --- --- msg_02.txt DELETED --- --- msg_03.txt DELETED --- --- msg_04.txt DELETED --- --- msg_05.txt DELETED --- --- msg_06.txt DELETED --- --- msg_07.txt DELETED --- --- msg_08.txt DELETED --- --- msg_09.txt DELETED --- --- msg_10.txt DELETED --- --- msg_11.txt DELETED --- --- msg_12.txt DELETED --- --- msg_13.txt DELETED --- --- msg_14.txt DELETED --- --- msg_15.txt DELETED --- --- msg_16.txt DELETED --- --- msg_17.txt DELETED --- --- msg_18.txt DELETED --- --- msg_19.txt DELETED --- --- msg_20.txt DELETED --- --- msg_21.txt DELETED --- --- msg_22.txt DELETED --- --- msg_23.txt DELETED --- --- msg_24.txt DELETED --- --- msg_25.txt DELETED --- --- msg_26.txt DELETED --- --- msg_27.txt DELETED --- --- msg_28.txt DELETED --- --- msg_29.txt DELETED --- --- msg_30.txt DELETED --- From bwarsaw@users.sourceforge.net Tue Jul 23 20:04:16 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:04:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.1,1.2 test_email_codecs.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv26271/Lib/email/test Modified Files: test_email.py test_email_codecs.py Log Message: Get rid of relative imports in all unittests. Now anything that imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :) Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_email.py 19 Jul 2002 22:29:00 -0000 1.1 --- test_email.py 23 Jul 2002 19:03:42 -0000 1.2 *************** *** 33,37 **** from test.test_support import findfile, run_unittest ! from test.test_support import __file__ as test_support_file --- 33,37 ---- from test.test_support import findfile, run_unittest ! from email.test import __file__ as landmark *************** *** 46,50 **** def openfile(filename): ! path = os.path.join(os.path.dirname(test_support_file), 'data', filename) return open(path) --- 46,50 ---- def openfile(filename): ! path = os.path.join(os.path.dirname(landmark), 'data', filename) return open(path) Index: test_email_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_codecs.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_email_codecs.py 21 Jul 2002 06:06:30 -0000 1.2 --- test_email_codecs.py 23 Jul 2002 19:03:42 -0000 1.3 *************** *** 3,7 **** import unittest ! from test_support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase --- 3,7 ---- import unittest ! from test.test_support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase From bwarsaw@users.sourceforge.net Tue Jul 23 20:05:18 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:05:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test README,1.13,1.14 regrtest.py,1.90,1.91 test_StringIO.py,1.13,1.14 test___future__.py,1.4,1.5 test_anydbm.py,1.1,1.2 test_array.py,1.16,1.17 test_audioop.py,1.10,1.11 test_base64.py,1.2,1.3 test_binhex.py,1.12,1.13 test_binop.py,1.6,1.7 test_bool.py,1.6,1.7 test_calendar.py,1.3,1.4 test_call.py,1.2,1.3 test_capi.py,1.3,1.4 test_cmath.py,1.6,1.7 test_codecs.py,1.2,1.3 test_codeop.py,1.3,1.4 test_commands.py,1.5,1.6 test_compile.py,1.11,1.12 test_cookie.py,1.11,1.12 test_copy_reg.py,1.3,1.4 test_cpickle.py,1.11,1.12 test_crypt.py,1.6,1.7 test_curses.py,1.1,1.2 test_dbm.py,1.7,1.8 test_descr.py,1.148,1.149 test_descrtut.py,1.13,1.14 test_difflib.py,1.4,1.5 test_dircache.py,1.4,1.5 test_dl.py,1.11,1.12 test_doctest.py,1.4,1.5 test_doctest2.py,1.3,1.4 test_dospath.py,1.5,1.6 test_dumbdbm.py,1.6,1.7 test_enumerate.py,1.2,1.3 test_errno.py,1.7,1.8 test_fcntl.py,1.23,1.24 test_fileinput.py,1.1,1.2 test_fnmatch.py,1.3,1.4 test_format.py,1.13,1.14 test_fpformat.py,1.4,1.5 test_future.py,1.4,1.5 test_gc.py,1.17,1.18 test_gdbm.py,1.8,1.9 test_generators.py,1.35,1.36 test_getopt.py,1.5,1.6 test_glob.py,1.3,1.4 test_grp.py,1.9,1.10 test_hash.py,1.5,1.6 test_hmac.py,1.4,1.5 test_hotshot.py,1.9,1.10 test_htmllib.py,1.1,1.2 test_htmlparser.py,1.8,1.9 test_imageop.py,1.12,1.13 test_imgfile.py,1.11,1.12 test_import.py,1.16,1.17 test_inspect.py,1.7,1.8 test_isinstance.py,1.3,1.4 test_iter.py,1.25,1.26 test_largefile.py,1.14,1.15 test_linuxaudiodev.py,1.7,1.8 test_locale.py,1.3,1.4 test_long.py,1.16,1.17 test_long_future.py,1.4,1.5 test_mailbox.py,1.8,1.9 test_marshal.py,1.1,1.2 test_math.py,1.15,1.16 test_mhlib.py,1.7,1.8 test_mimetools.py,1.2,1.3 test_mimetypes.py,1.4,1.5 test_minidom.py,1.33,1.34 test_mmap.py,1.22,1.23 test_module.py,1.2,1.3 test_mpz.py,1.3,1.4 test_mutants.py,1.6,1.7 test_netrc.py,1.2,1.3 test_new.py,1.15,1.16 test_nis.py,1.11,1.12 test_ntpath.py,1.15,1.16 test_opcodes.py,1.10,1.11 test_openpty.py,1.6,1.7 test_operator.py,1.8,1.9 test_os.py,1.11,1.12 test_parser.py,1.11,1.12 test_pickle.py,1.9,1.10 test_pkg.py,1.14,1.15 test_pkgimport.py,1.5,1.6 test_poll.py,1.5,1.6 test_popen.py,1.2,1.3 test_popen2.py,1.6,1.7 test_pow.py,1.14,1.15 test_pprint.py,1.8,1.9 test_profilehooks.py,1.8,1.9 test_pty.py,1.14,1.15 test_pwd.py,1.11,1.12 test_pyclbr.py,1.11,1.12 test_pyexpat.py,1.12,1.13 test_queue.py,1.1,1.2 test_quopri.py,1.6,1.7 test_random.py,1.1,1.2 test_re.py,1.31,1.32 test_regex.py,1.11,1.12 test_repr.py,1.13,1.14 test_resource.py,1.1,1.2 test_rfc822.py,1.18,1.19 test_rgbimg.py,1.13,1.14 test_richcmp.py,1.6,1.7 test_robotparser.py,1.2,1.3 test_sax.py,1.19,1.20 test_scope.py,1.26,1.27 test_select.py,1.14,1.15 test_sgmllib.py,1.2,1.3 test_sha.py,1.3,1.4 test_signal.py,1.11,1.12 test_slice.py,1.1,1.2 test_socket.py,1.42,1.43 test_socket_ssl.py,1.4,1.5 test_socketserver.py,1.6,1.7 test_softspace.py,1.1,1.2 test_sre.py,1.35,1.36 test_strftime.py,1.26,1.27 test_string.py,1.17,1.18 test_strop.py,1.16,1.17 test_struct.py,1.14,1.15 test_structseq.py,1.3,1.4 test_sunaudiodev.py,1.10,1.11 test_sundry.py,1.10,1.11 test_symtable.py,1.3,1.4 test_syntax.py,1.1,1.2 test_thread.py,1.10,1.11 test_threaded_import.py,1.5,1.6 test_threadedtempfile.py,1.3,1.4 test_threading.py,1.2,1.3 test_time.py,1.10,1.11 test_timeout.py,1.6,1.7 test_timing.py,1.3,1.4 test_tokenize.py,1.6,1.7 test_traceback.py,1.4,1.5 test_types.py,1.35,1.36 test_ucn.py,1.8,1.9 test_unary.py,1.5,1.6 test_unicode.py,1.58,1.59 test_unicode_file.py,1.4,1.5 test_unicodedata.py,1.5,1.6 test_univnewlines.py,1.3,1.4 test_unpack.py,1.5,1.6 test_urllib.py,1.8,1.9 test_urllib2.py,1.6,1.7 test_urlparse.py,1.5,1.6 test_userdict.py,1.5,1.6 test_userlist.py,1.5,1.6 test_userstring.py,1.6,1.7 test_uu.py,1.3,1.4 test_wave.py,1.2,1.3 test_weakref.py,1.19,1.20 test_winreg.py,1.10,1.11 test_xmllib.py,1.10,1.11 test_xmlrpc.py,1.2,1.3 test_xreadline.py,1.3,1.4 test_zipfile.py,1.8,1.9 test_zlib.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26271/Lib/test Modified Files: README regrtest.py test_StringIO.py test___future__.py test_anydbm.py test_array.py test_audioop.py test_base64.py test_binhex.py test_binop.py test_bool.py test_calendar.py test_call.py test_capi.py test_cmath.py test_codecs.py test_codeop.py test_commands.py test_compile.py test_cookie.py test_copy_reg.py test_cpickle.py test_crypt.py test_curses.py test_dbm.py test_descr.py test_descrtut.py test_difflib.py test_dircache.py test_dl.py test_doctest.py test_doctest2.py test_dospath.py test_dumbdbm.py test_enumerate.py test_errno.py test_fcntl.py test_fileinput.py test_fnmatch.py test_format.py test_fpformat.py test_future.py test_gc.py test_gdbm.py test_generators.py test_getopt.py test_glob.py test_grp.py test_hash.py test_hmac.py test_hotshot.py test_htmllib.py test_htmlparser.py test_imageop.py test_imgfile.py test_import.py test_inspect.py test_isinstance.py test_iter.py test_largefile.py test_linuxaudiodev.py test_locale.py test_long.py test_long_future.py test_mailbox.py test_marshal.py test_math.py test_mhlib.py test_mimetools.py test_mimetypes.py test_minidom.py test_mmap.py test_module.py test_mpz.py test_mutants.py test_netrc.py test_new.py test_nis.py test_ntpath.py test_opcodes.py test_openpty.py test_operator.py test_os.py test_parser.py test_pickle.py test_pkg.py test_pkgimport.py test_poll.py test_popen.py test_popen2.py test_pow.py test_pprint.py test_profilehooks.py test_pty.py test_pwd.py test_pyclbr.py test_pyexpat.py test_queue.py test_quopri.py test_random.py test_re.py test_regex.py test_repr.py test_resource.py test_rfc822.py test_rgbimg.py test_richcmp.py test_robotparser.py test_sax.py test_scope.py test_select.py test_sgmllib.py test_sha.py test_signal.py test_slice.py test_socket.py test_socket_ssl.py test_socketserver.py test_softspace.py test_sre.py test_strftime.py test_string.py test_strop.py test_struct.py test_structseq.py test_sunaudiodev.py test_sundry.py test_symtable.py test_syntax.py test_thread.py test_threaded_import.py test_threadedtempfile.py test_threading.py test_time.py test_timeout.py test_timing.py test_tokenize.py test_traceback.py test_types.py test_ucn.py test_unary.py test_unicode.py test_unicode_file.py test_unicodedata.py test_univnewlines.py test_unpack.py test_urllib.py test_urllib2.py test_urlparse.py test_userdict.py test_userlist.py test_userstring.py test_uu.py test_wave.py test_weakref.py test_winreg.py test_xmllib.py test_xmlrpc.py test_xreadline.py test_zipfile.py test_zlib.py Log Message: Get rid of relative imports in all unittests. Now anything that imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :) Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** README 23 Apr 2002 21:39:00 -0000 1.13 --- README 23 Jul 2002 19:03:42 -0000 1.14 *************** *** 53,57 **** import unittest ! import test_support class MyTestCase1(unittest.TestCase): --- 53,57 ---- import unittest ! from test import test_support class MyTestCase1(unittest.TestCase): *************** *** 249,253 **** * If your test case detects a failure, raise TestFailed (found in ! test_support). * Import everything you'll need as early as possible. --- 249,253 ---- * If your test case detects a failure, raise TestFailed (found in ! test.test_support). * Import everything you'll need as early as possible. *************** *** 276,281 **** Miscellaneous ! There is a test_support module you can import from your test case. It ! provides the following useful objects: * TestFailed - raise this exception when your regression test detects a --- 276,289 ---- Miscellaneous ! There is a test_support module in the test package you can import from ! your test case. Import this module using either ! ! import test.test_support ! ! or ! ! from test import test_support ! ! test_support provides the following useful objects: * TestFailed - raise this exception when your regression test detects a *************** *** 318,343 **** numbers when you expect them to only be approximately equal withing a fuzz factor (test_support.FUZZ, which defaults to 1e-6). - - NOTE: Always import something from test_support like so: - - from test_support import verbose - - or like so: - - import test_support - ... use test_support.verbose in the code ... - - Never import anything from test_support like this: - - from test.test_support import verbose - - "test" is a package already, so can refer to modules it contains without - "test." qualification. If you do an explicit "test.xxx" qualification, that - can fool Python into believing test.xxx is a module distinct from the xxx - in the current package, and you can end up importing two distinct copies of - xxx. This is especially bad if xxx=test_support, as regrtest.py can (and - routinely does) overwrite its "verbose" and "use_large_resources" - attributes: if you get a second copy of test_support loaded, it may not - have the same values for those as regrtest intended. --- 326,329 ---- Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** regrtest.py 17 Jul 2002 15:56:55 -0000 1.90 --- regrtest.py 23 Jul 2002 19:03:43 -0000 1.91 *************** *** 65,70 **** import StringIO ! import test_support ! RESOURCE_NAMES = ('curses', 'largefile', 'network') --- 65,69 ---- import StringIO ! from test import test_support RESOURCE_NAMES = ('curses', 'largefile', 'network') Index: test_StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_StringIO.py 13 May 2002 09:42:16 -0000 1.13 --- test_StringIO.py 23 Jul 2002 19:03:43 -0000 1.14 *************** *** 5,9 **** import cStringIO import types ! import test_support --- 5,9 ---- import cStringIO import types ! from test import test_support Index: test___future__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___future__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test___future__.py 18 Aug 2001 20:18:49 -0000 1.4 --- test___future__.py 23 Jul 2002 19:03:43 -0000 1.5 *************** *** 1,4 **** #! /usr/bin/env python ! from test_support import verbose, verify from types import TupleType, StringType, IntType import __future__ --- 1,4 ---- #! /usr/bin/env python ! from test.test_support import verbose, verify from types import TupleType, StringType, IntType import __future__ Index: test_anydbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_anydbm.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_anydbm.py 18 Mar 2002 03:00:37 -0000 1.1 --- test_anydbm.py 23 Jul 2002 19:03:43 -0000 1.2 *************** *** 5,13 **** import os - import test_support import unittest import anydbm import tempfile import glob _fname = tempfile.mktemp() --- 5,13 ---- import os import unittest import anydbm import tempfile import glob + from test import test_support _fname = tempfile.mktemp() Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_array.py 19 Jun 2002 15:44:15 -0000 1.16 --- test_array.py 23 Jul 2002 19:03:43 -0000 1.17 *************** *** 4,8 **** """ import array ! from test_support import verbose, TESTFN, unlink, TestFailed,\ have_unicode, vereq --- 4,8 ---- """ import array ! from test.test_support import verbose, TESTFN, unlink, TestFailed,\ have_unicode, vereq Index: test_audioop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_audioop.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_audioop.py 4 Sep 2001 19:14:14 -0000 1.10 --- test_audioop.py 23 Jul 2002 19:03:44 -0000 1.11 *************** *** 1,5 **** # Test audioop. import audioop ! from test_support import verbose def gendata1(): --- 1,5 ---- # Test audioop. import audioop ! from test.test_support import verbose def gendata1(): Index: test_base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_base64.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_base64.py 23 May 2002 15:15:30 -0000 1.2 --- test_base64.py 23 Jul 2002 19:03:45 -0000 1.3 *************** *** 1,4 **** import unittest ! import test_support import base64 from binascii import Error as binascii_error --- 1,4 ---- import unittest ! from test import test_support import base64 from binascii import Error as binascii_error Index: test_binhex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binhex.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_binhex.py 20 Sep 2001 21:33:42 -0000 1.12 --- test_binhex.py 23 Jul 2002 19:03:45 -0000 1.13 *************** *** 8,13 **** import os import tempfile - import test_support import unittest --- 8,13 ---- import os import tempfile import unittest + from test import test_support Index: test_binop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binop.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_binop.py 20 Sep 2001 21:33:42 -0000 1.6 --- test_binop.py 23 Jul 2002 19:03:45 -0000 1.7 *************** *** 1,6 **** """Tests for binary operators on subtypes of built-in types.""" - import test_support import unittest def gcd(a, b): --- 1,6 ---- """Tests for binary operators on subtypes of built-in types.""" import unittest + from test import test_support def gcd(a, b): Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_bool.py 11 Jun 2002 10:55:09 -0000 1.6 --- test_bool.py 23 Jul 2002 19:03:45 -0000 1.7 *************** *** 1,5 **** # Test properties of bool promised by PEP 285 ! from test_support import verbose, TestFailed, TESTFN, vereq, have_unicode import os --- 1,5 ---- # Test properties of bool promised by PEP 285 ! from test.test_support import verbose, TestFailed, TESTFN, vereq, have_unicode import os Index: test_calendar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_calendar.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_calendar.py 23 Mar 2002 03:26:53 -0000 1.3 --- test_calendar.py 23 Jul 2002 19:03:45 -0000 1.4 *************** *** 2,6 **** import unittest ! from test_support import run_unittest --- 2,6 ---- import unittest ! from test.test_support import run_unittest Index: test_call.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_call.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_call.py 20 Sep 2001 21:33:42 -0000 1.2 --- test_call.py 23 Jul 2002 19:03:45 -0000 1.3 *************** *** 1,4 **** import unittest ! from test_support import run_unittest # The test cases here cover several paths through the function calling --- 1,4 ---- import unittest ! from test.test_support import run_unittest # The test cases here cover several paths through the function calling Index: test_capi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_capi.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_capi.py 13 Apr 2001 17:03:04 -0000 1.3 --- test_capi.py 23 Jul 2002 19:03:45 -0000 1.4 *************** *** 3,7 **** import sys ! import test_support import _testcapi --- 3,7 ---- import sys ! from test import test_support import _testcapi Index: test_cmath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cmath.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_cmath.py 17 Jan 2001 21:51:35 -0000 1.6 --- test_cmath.py 23 Jul 2002 19:03:46 -0000 1.7 *************** *** 4,8 **** """ import cmath ! from test_support import verbose testdict = {'acos' : 1.0, --- 4,8 ---- """ import cmath ! from test.test_support import verbose testdict = {'acos' : 1.0, Index: test_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_codecs.py 20 Sep 2001 21:33:42 -0000 1.2 --- test_codecs.py 23 Jul 2002 19:03:46 -0000 1.3 *************** *** 1,3 **** ! import test_support,unittest import codecs import StringIO --- 1,4 ---- ! from test import test_support ! import unittest import codecs import StringIO Index: test_codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeop.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_codeop.py 20 Sep 2001 21:33:42 -0000 1.3 --- test_codeop.py 23 Jul 2002 19:03:46 -0000 1.4 *************** *** 4,8 **** """ import unittest ! from test_support import run_unittest from codeop import compile_command --- 4,8 ---- """ import unittest ! from test.test_support import run_unittest from codeop import compile_command Index: test_commands.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_commands.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_commands.py 6 Jun 2002 09:52:49 -0000 1.5 --- test_commands.py 23 Jul 2002 19:03:46 -0000 1.6 *************** *** 6,10 **** import os, tempfile, re ! from test_support import TestSkipped, run_unittest from commands import * --- 6,10 ---- import os, tempfile, re ! from test.test_support import TestSkipped, run_unittest from commands import * Index: test_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_compile.py 9 Jul 2002 09:23:26 -0000 1.11 --- test_compile.py 23 Jul 2002 19:03:46 -0000 1.12 *************** *** 1,3 **** ! from test_support import verbose, TestFailed if verbose: --- 1,3 ---- ! from test.test_support import verbose, TestFailed if verbose: Index: test_cookie.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cookie.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_cookie.py 9 Sep 2001 06:12:01 -0000 1.11 --- test_cookie.py 23 Jul 2002 19:03:46 -0000 1.12 *************** *** 1,5 **** # Simple test suite for Cookie.py ! from test_support import verify, verbose, run_doctest import Cookie --- 1,5 ---- # Simple test suite for Cookie.py ! from test.test_support import verify, verbose, run_doctest import Cookie Index: test_copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy_reg.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_copy_reg.py 20 Sep 2001 21:33:42 -0000 1.3 --- test_copy_reg.py 23 Jul 2002 19:03:46 -0000 1.4 *************** *** 1,5 **** import copy_reg - import test_support import unittest --- 1,5 ---- import copy_reg import unittest + from test import test_support Index: test_cpickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cpickle.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_cpickle.py 21 Dec 2001 20:04:22 -0000 1.11 --- test_cpickle.py 23 Jul 2002 19:03:46 -0000 1.12 *************** *** 1,7 **** import cPickle - import test_support import unittest from cStringIO import StringIO from pickletester import AbstractPickleTests, AbstractPickleModuleTests class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): --- 1,7 ---- import cPickle import unittest from cStringIO import StringIO from pickletester import AbstractPickleTests, AbstractPickleModuleTests + from test import test_support class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): Index: test_crypt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_crypt.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_crypt.py 18 Jan 2001 02:22:22 -0000 1.6 --- test_crypt.py 23 Jul 2002 19:03:47 -0000 1.7 *************** *** 4,8 **** """ ! from test_support import verify, verbose import crypt --- 4,8 ---- """ ! from test.test_support import verify, verbose import crypt Index: test_curses.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_curses.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_curses.py 22 Oct 2001 15:26:09 -0000 1.1 --- test_curses.py 23 Jul 2002 19:03:47 -0000 1.2 *************** *** 15,19 **** # option. If not available, nothing after this line will be executed. ! import test_support test_support.requires('curses') --- 15,19 ---- # option. If not available, nothing after this line will be executed. ! from test import test_support test_support.requires('curses') Index: test_dbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dbm.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_dbm.py 22 Mar 2001 00:39:45 -0000 1.7 --- test_dbm.py 23 Jul 2002 19:03:47 -0000 1.8 *************** *** 5,9 **** import dbm from dbm import error ! from test_support import verbose, verify filename = '/tmp/delete_me' --- 5,9 ---- import dbm from dbm import error ! from test.test_support import verbose, verify filename = '/tmp/delete_me' Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** test_descr.py 11 Jul 2002 18:39:56 -0000 1.148 --- test_descr.py 23 Jul 2002 19:03:47 -0000 1.149 *************** *** 1,5 **** # Test enhancements related to descriptors and new-style classes ! from test_support import verify, vereq, verbose, TestFailed, TESTFN from copy import deepcopy import warnings --- 1,5 ---- # Test enhancements related to descriptors and new-style classes ! from test.test_support import verify, vereq, verbose, TestFailed, TESTFN from copy import deepcopy import warnings Index: test_descrtut.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descrtut.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_descrtut.py 31 May 2002 21:40:38 -0000 1.13 --- test_descrtut.py 23 Jul 2002 19:03:48 -0000 1.14 *************** *** 9,13 **** # deterministic. ! from test_support import sortdict import pprint --- 9,13 ---- # deterministic. ! from test.test_support import sortdict import pprint *************** *** 495,500 **** # business is used the name can change depending on how the test is # invoked. ! import test_support, test.test_descrtut ! test_support.run_doctest(test.test_descrtut, verbose) # This part isn't needed for regrtest, but for running the test directly. --- 495,500 ---- # business is used the name can change depending on how the test is # invoked. ! from test import test_support, test_descrtut ! test_support.run_doctest(test_descrtut, verbose) # This part isn't needed for regrtest, but for running the test directly. Index: test_difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_difflib.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_difflib.py 9 Sep 2001 06:12:01 -0000 1.4 --- test_difflib.py 23 Jul 2002 19:03:48 -0000 1.5 *************** *** 1,2 **** ! import difflib, test_support test_support.run_doctest(difflib) --- 1,3 ---- ! import difflib ! from test import test_support test_support.run_doctest(difflib) Index: test_dircache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dircache.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_dircache.py 20 Sep 2001 21:33:42 -0000 1.4 --- test_dircache.py 23 Jul 2002 19:03:50 -0000 1.5 *************** *** 5,9 **** import unittest ! from test_support import run_unittest, TESTFN import dircache, os, time, sys --- 5,9 ---- import unittest ! from test.test_support import run_unittest, TESTFN import dircache, os, time, sys Index: test_dl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dl.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_dl.py 27 Feb 2001 20:54:23 -0000 1.11 --- test_dl.py 23 Jul 2002 19:03:50 -0000 1.12 *************** *** 5,9 **** import dl ! from test_support import verbose,TestSkipped sharedlibs = [ --- 5,9 ---- import dl ! from test.test_support import verbose,TestSkipped sharedlibs = [ Index: test_doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_doctest.py 18 Sep 2001 02:26:39 -0000 1.4 --- test_doctest.py 23 Jul 2002 19:03:50 -0000 1.5 *************** *** 1,2 **** ! import doctest, test_support test_support.run_doctest(doctest) --- 1,3 ---- ! import doctest ! from test import test_support test_support.run_doctest(doctest) Index: test_doctest2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest2.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_doctest2.py 4 Oct 2001 05:27:00 -0000 1.3 --- test_doctest2.py 23 Jul 2002 19:03:50 -0000 1.4 *************** *** 6,10 **** """ ! import test_support class C(object): --- 6,10 ---- """ ! from test import test_support class C(object): Index: test_dospath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dospath.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_dospath.py 20 Sep 2001 21:33:42 -0000 1.5 --- test_dospath.py 23 Jul 2002 19:03:50 -0000 1.6 *************** *** 1,5 **** import dospath - import test_support import unittest --- 1,5 ---- import dospath import unittest + from test import test_support Index: test_dumbdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dumbdbm.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_dumbdbm.py 17 Mar 2002 23:03:42 -0000 1.6 --- test_dumbdbm.py 23 Jul 2002 19:03:50 -0000 1.7 *************** *** 5,12 **** import os - import test_support import unittest import dumbdbm import tempfile _fname = tempfile.mktemp() --- 5,12 ---- import os import unittest import dumbdbm import tempfile + from test import test_support _fname = tempfile.mktemp() Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_enumerate.py 20 Jun 2002 14:52:37 -0000 1.2 --- test_enumerate.py 23 Jul 2002 19:03:50 -0000 1.3 *************** *** 1,5 **** import unittest ! import test_support seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] --- 1,5 ---- import unittest ! from test import test_support seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] Index: test_errno.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_errno.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_errno.py 17 Jan 2001 21:51:35 -0000 1.7 --- test_errno.py 23 Jul 2002 19:03:51 -0000 1.8 *************** *** 5,9 **** import errno ! from test_support import verbose errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV', --- 5,9 ---- import errno ! from test.test_support import verbose errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV', Index: test_fcntl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fcntl.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_fcntl.py 11 Jun 2002 06:22:30 -0000 1.23 --- test_fcntl.py 23 Jul 2002 19:03:51 -0000 1.24 *************** *** 7,11 **** import fcntl import os, sys ! from test_support import verbose, TESTFN filename = TESTFN --- 7,11 ---- import fcntl import os, sys ! from test.test_support import verbose, TESTFN filename = TESTFN Index: test_fileinput.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fileinput.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_fileinput.py 11 Jul 2001 22:21:17 -0000 1.1 --- test_fileinput.py 23 Jul 2002 19:03:52 -0000 1.2 *************** *** 4,8 **** ''' ! from test_support import verify, verbose, TESTFN import sys, os, re from StringIO import StringIO --- 4,8 ---- ''' ! from test.test_support import verify, verbose, TESTFN import sys, os, re from StringIO import StringIO Index: test_fnmatch.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fnmatch.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_fnmatch.py 20 Sep 2001 21:33:42 -0000 1.3 --- test_fnmatch.py 23 Jul 2002 19:03:53 -0000 1.4 *************** *** 1,5 **** """Test cases for the fnmatch module.""" ! import test_support import unittest --- 1,5 ---- """Test cases for the fnmatch module.""" ! from test import test_support import unittest Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_format.py 17 Aug 2001 22:08:34 -0000 1.13 --- test_format.py 23 Jul 2002 19:03:53 -0000 1.14 *************** *** 1,3 **** ! from test_support import verbose, have_unicode import sys --- 1,3 ---- ! from test.test_support import verbose, have_unicode import sys Index: test_fpformat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fpformat.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_fpformat.py 20 Sep 2001 21:33:42 -0000 1.4 --- test_fpformat.py 23 Jul 2002 19:03:53 -0000 1.5 *************** *** 3,7 **** Nick Mathewson ''' ! from test_support import run_unittest import unittest from fpformat import fix, sci, NotANumber --- 3,7 ---- Nick Mathewson ''' ! from test.test_support import run_unittest import unittest from fpformat import fix, sci, NotANumber Index: test_future.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_future.py 20 Aug 2001 20:33:42 -0000 1.4 --- test_future.py 23 Jul 2002 19:03:53 -0000 1.5 *************** *** 1,5 **** # Test various flavors of legal and illegal future statements ! from test_support import unload import re --- 1,5 ---- # Test various flavors of legal and illegal future statements ! from test.test_support import unload import re Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_gc.py 11 Jul 2002 19:07:45 -0000 1.17 --- test_gc.py 23 Jul 2002 19:03:53 -0000 1.18 *************** *** 1,3 **** ! from test_support import verify, verbose, TestFailed import sys import gc --- 1,3 ---- ! from test.test_support import verify, verbose, TestFailed import sys import gc Index: test_gdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gdbm.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_gdbm.py 22 Mar 2001 00:40:23 -0000 1.8 --- test_gdbm.py 23 Jul 2002 19:03:53 -0000 1.9 *************** *** 6,10 **** import gdbm from gdbm import error ! from test_support import verbose, verify, TestFailed filename= '/tmp/delete_me' --- 6,10 ---- import gdbm from gdbm import error ! from test.test_support import verbose, verify, TestFailed filename= '/tmp/delete_me' Index: test_generators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_generators.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_generators.py 16 Jul 2002 21:35:23 -0000 1.35 --- test_generators.py 23 Jul 2002 19:03:54 -0000 1.36 *************** *** 484,487 **** --- 484,488 ---- A->G B->G C->G D->G E->G F->G G->G H->G I->G J->G K->G L->G M->G """ + # Emacs turd ' # Fun tests (for sufficiently warped notions of "fun"). *************** *** 1371,1375 **** # so this works as expected in both ways of running regrtest. def test_main(verbose=None): ! import doctest, test_support, test_generators if 0: # change to 1 to run forever (to check for leaks) while 1: --- 1372,1377 ---- # so this works as expected in both ways of running regrtest. def test_main(verbose=None): ! import doctest ! from test import test_support, test_generators if 0: # change to 1 to run forever (to check for leaks) while 1: Index: test_getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_getopt.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_getopt.py 6 Jun 2002 10:58:36 -0000 1.5 --- test_getopt.py 23 Jul 2002 19:03:54 -0000 1.6 *************** *** 4,8 **** import getopt from getopt import GetoptError ! from test_support import verify, verbose import os --- 4,8 ---- import getopt from getopt import GetoptError ! from test.test_support import verify, verbose import os Index: test_glob.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_glob.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_glob.py 20 Sep 2001 21:33:42 -0000 1.3 --- test_glob.py 23 Jul 2002 19:03:54 -0000 1.4 *************** *** 1,4 **** import unittest ! from test_support import run_unittest, TESTFN import glob import os --- 1,4 ---- import unittest ! from test.test_support import run_unittest, TESTFN import glob import os Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_grp.py 20 Sep 2001 21:33:42 -0000 1.9 --- test_grp.py 23 Jul 2002 19:03:54 -0000 1.10 *************** *** 4,9 **** import grp - import test_support import unittest --- 4,9 ---- import grp import unittest + from test import test_support Index: test_hash.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hash.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_hash.py 20 Sep 2001 21:33:42 -0000 1.5 --- test_hash.py 23 Jul 2002 19:03:54 -0000 1.6 *************** *** 3,8 **** # - import test_support import unittest --- 3,8 ---- # import unittest + from test import test_support Index: test_hmac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hmac.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_hmac.py 1 Apr 2002 19:00:50 -0000 1.4 --- test_hmac.py 23 Jul 2002 19:03:54 -0000 1.5 *************** *** 1,5 **** import hmac import unittest ! import test_support class TestVectorsTestCase(unittest.TestCase): --- 1,5 ---- import hmac import unittest ! from test import test_support class TestVectorsTestCase(unittest.TestCase): Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_hotshot.py 18 Jul 2002 14:54:28 -0000 1.9 --- test_hotshot.py 23 Jul 2002 19:03:54 -0000 1.10 *************** *** 5,9 **** import unittest ! import test_support from hotshot.log import ENTER, EXIT, LINE --- 5,9 ---- import unittest ! from test import test_support from hotshot.log import ENTER, EXIT, LINE Index: test_htmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmllib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_htmllib.py 4 Oct 2001 20:05:10 -0000 1.1 --- test_htmllib.py 23 Jul 2002 19:03:54 -0000 1.2 *************** *** 3,7 **** import unittest ! import test_support --- 3,7 ---- import unittest ! from test import test_support Index: test_htmlparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmlparser.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_htmlparser.py 3 Dec 2001 16:44:09 -0000 1.8 --- test_htmlparser.py 23 Jul 2002 19:03:54 -0000 1.9 *************** *** 4,9 **** import pprint import sys - import test_support import unittest --- 4,9 ---- import pprint import sys import unittest + from test import test_support Index: test_imageop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imageop.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_imageop.py 24 Oct 2001 20:32:02 -0000 1.12 --- test_imageop.py 23 Jul 2002 19:03:54 -0000 1.13 *************** *** 6,10 **** """ ! from test_support import verbose, unlink import imageop, uu, os --- 6,10 ---- """ ! from test.test_support import verbose, unlink import imageop, uu, os Index: test_imgfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imgfile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_imgfile.py 9 Feb 2001 17:05:53 -0000 1.11 --- test_imgfile.py 23 Jul 2002 19:03:54 -0000 1.12 *************** *** 5,9 **** """ ! from test_support import verbose, unlink, findfile import imgfile, uu, os --- 5,9 ---- """ ! from test.test_support import verbose, unlink, findfile import imgfile, uu, os Index: test_import.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_import.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_import.py 8 Jul 2002 10:07:25 -0000 1.16 --- test_import.py 23 Jul 2002 19:03:55 -0000 1.17 *************** *** 1,3 **** ! from test_support import TESTFN, TestFailed import os --- 1,3 ---- ! from test.test_support import TESTFN, TestFailed import os Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_inspect.py 15 Oct 2001 22:52:25 -0000 1.7 --- test_inspect.py 23 Jul 2002 19:03:55 -0000 1.8 *************** *** 63,67 **** # getargvalues, formatargspec, formatargvalues, currentframe, stack, trace ! from test_support import TestFailed, TESTFN import sys, imp, os, string --- 63,67 ---- # getargvalues, formatargspec, formatargvalues, currentframe, stack, trace ! from test.test_support import TestFailed, TESTFN import sys, imp, os, string Index: test_isinstance.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_isinstance.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_isinstance.py 23 May 2002 15:15:30 -0000 1.3 --- test_isinstance.py 23 Jul 2002 19:03:55 -0000 1.4 *************** *** 4,8 **** import unittest ! import test_support --- 4,8 ---- import unittest ! from test import test_support Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_iter.py 16 Jul 2002 21:48:11 -0000 1.25 --- test_iter.py 23 Jul 2002 19:03:55 -0000 1.26 *************** *** 2,6 **** import unittest ! from test_support import run_unittest, TESTFN, unlink, have_unicode # Test result of triple loop (too big to inline) --- 2,6 ---- import unittest ! from test.test_support import run_unittest, TESTFN, unlink, have_unicode # Test result of triple loop (too big to inline) Index: test_largefile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_largefile.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_largefile.py 12 Mar 2002 03:04:44 -0000 1.14 --- test_largefile.py 23 Jul 2002 19:03:55 -0000 1.15 *************** *** 6,10 **** #---------------------------------------------------------------------- ! import test_support import os, struct, stat, sys --- 6,10 ---- #---------------------------------------------------------------------- ! from test import test_support import os, struct, stat, sys Index: test_linuxaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_linuxaudiodev.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_linuxaudiodev.py 23 Apr 2002 02:20:46 -0000 1.7 --- test_linuxaudiodev.py 23 Jul 2002 19:03:56 -0000 1.8 *************** *** 1,3 **** ! from test_support import verbose, findfile, TestFailed, TestSkipped import errno --- 1,3 ---- ! from test.test_support import verbose, findfile, TestFailed, TestSkipped import errno Index: test_locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_locale.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_locale.py 2 May 2001 05:54:44 -0000 1.3 --- test_locale.py 23 Jul 2002 19:03:56 -0000 1.4 *************** *** 1,3 **** ! from test_support import verbose import locale import sys --- 1,3 ---- ! from test.test_support import verbose import locale import sys Index: test_long.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_long.py 1 Apr 2002 19:01:39 -0000 1.16 --- test_long.py 23 Jul 2002 19:03:56 -0000 1.17 *************** *** 1,3 **** ! from test_support import verify, verbose, TestFailed, fcmp from string import join from random import random, randint --- 1,3 ---- ! from test.test_support import verify, verbose, TestFailed, fcmp from string import join from random import random, randint Index: test_long_future.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long_future.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_long_future.py 7 Sep 2001 00:47:00 -0000 1.4 --- test_long_future.py 23 Jul 2002 19:03:56 -0000 1.5 *************** *** 4,8 **** # trick just part of test_long into using future division. ! from test_support import TestFailed, verify, verbose def test_true_division(): --- 4,8 ---- # trick just part of test_long into using future division. ! from test.test_support import TestFailed, verify, verbose def test_true_division(): Index: test_mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mailbox.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_mailbox.py 24 Oct 2001 20:32:02 -0000 1.8 --- test_mailbox.py 23 Jul 2002 19:03:56 -0000 1.9 *************** *** 1,7 **** import mailbox import os - import test_support import time import unittest # cleanup earlier tests --- 1,7 ---- import mailbox import os import time import unittest + from test import test_support # cleanup earlier tests Index: test_marshal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_marshal.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_marshal.py 29 Aug 2001 02:28:41 -0000 1.1 --- test_marshal.py 23 Jul 2002 19:03:57 -0000 1.2 *************** *** 1,3 **** ! from test_support import TestFailed import marshal import sys --- 1,3 ---- ! from test.test_support import TestFailed import marshal import sys Index: test_math.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_math.py 23 May 2002 15:15:30 -0000 1.15 --- test_math.py 23 Jul 2002 19:03:57 -0000 1.16 *************** *** 2,6 **** # XXXX Should not do tests around zero only ! from test_support import * seps='1e-05' --- 2,6 ---- # XXXX Should not do tests around zero only ! from test.test_support import * seps='1e-05' Index: test_mhlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mhlib.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_mhlib.py 11 Jun 2002 06:22:30 -0000 1.7 --- test_mhlib.py 23 Jul 2002 19:03:57 -0000 1.8 *************** *** 8,12 **** import unittest ! from test_support import run_unittest, TESTFN, TestSkipped import os, StringIO import sys --- 8,12 ---- import unittest ! from test.test_support import run_unittest, TESTFN, TestSkipped import os, StringIO import sys Index: test_mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mimetools.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_mimetools.py 20 Jul 2001 18:54:44 -0000 1.2 --- test_mimetools.py 23 Jul 2002 19:03:57 -0000 1.3 *************** *** 1,3 **** ! from test_support import TestFailed import mimetools --- 1,3 ---- ! from test.test_support import TestFailed import mimetools Index: test_mimetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mimetypes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_mimetypes.py 30 Oct 2001 05:56:40 -0000 1.4 --- test_mimetypes.py 23 Jul 2002 19:03:57 -0000 1.5 *************** *** 3,7 **** import unittest ! import test_support # Tell it we don't know about external files: --- 3,7 ---- import unittest ! from test import test_support # Tell it we don't know about external files: Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** test_minidom.py 19 Jul 2002 22:16:40 -0000 1.33 --- test_minidom.py 23 Jul 2002 19:03:57 -0000 1.34 *************** *** 5,9 **** import traceback ! from test_support import verbose import xml.dom --- 5,9 ---- import traceback ! from test.test_support import verbose import xml.dom Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_mmap.py 23 Apr 2002 23:07:28 -0000 1.22 --- test_mmap.py 23 Jul 2002 19:03:57 -0000 1.23 *************** *** 1,3 **** ! from test_support import verify, vereq, TESTFN import mmap import os, re --- 1,3 ---- ! from test.test_support import verify, vereq, TESTFN import mmap import os, re Index: test_module.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_module.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_module.py 4 Jun 2002 06:06:54 -0000 1.2 --- test_module.py 23 Jul 2002 19:03:57 -0000 1.3 *************** *** 1,5 **** # Test the module type ! from test_support import verify, vereq, verbose, TestFailed import sys --- 1,5 ---- # Test the module type ! from test.test_support import verify, vereq, verbose, TestFailed import sys Index: test_mpz.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mpz.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_mpz.py 16 Apr 2002 01:38:40 -0000 1.3 --- test_mpz.py 23 Jul 2002 19:03:57 -0000 1.4 *************** *** 1,5 **** import mpz ! from test_support import vereq, TestFailed def check_conversion(num): --- 1,5 ---- import mpz ! from test.test_support import vereq, TestFailed def check_conversion(num): Index: test_mutants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mutants.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_mutants.py 3 Jun 2001 04:54:32 -0000 1.6 --- test_mutants.py 23 Jul 2002 19:03:57 -0000 1.7 *************** *** 1,3 **** ! from test_support import verbose, TESTFN import random import os --- 1,3 ---- ! from test.test_support import verbose, TESTFN import random import os Index: test_netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_netrc.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_netrc.py 16 Apr 2002 01:38:40 -0000 1.2 --- test_netrc.py 23 Jul 2002 19:03:57 -0000 1.3 *************** *** 1,4 **** ! import netrc, os, tempfile, test_support, unittest TEST_NETRC = """ --- 1,5 ---- ! import netrc, os, tempfile, unittest ! from test import test_support TEST_NETRC = """ Index: test_new.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_new.py 11 Jul 2002 18:30:27 -0000 1.15 --- test_new.py 23 Jul 2002 19:03:58 -0000 1.16 *************** *** 1,3 **** ! from test_support import verbose, verify import sys import new --- 1,3 ---- ! from test.test_support import verbose, verify import sys import new Index: test_nis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_nis.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_nis.py 17 Jan 2001 21:51:35 -0000 1.11 --- test_nis.py 23 Jul 2002 19:03:58 -0000 1.12 *************** *** 1,3 **** ! from test_support import verbose, TestFailed, TestSkipped import nis --- 1,3 ---- ! from test.test_support import verbose, TestFailed, TestSkipped import nis Index: test_ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ntpath.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_ntpath.py 15 Jan 2002 03:46:43 -0000 1.15 --- test_ntpath.py 23 Jul 2002 19:03:58 -0000 1.16 *************** *** 1,4 **** import ntpath ! from test_support import verbose, TestFailed import os --- 1,4 ---- import ntpath ! from test.test_support import verbose, TestFailed import os Index: test_opcodes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_opcodes.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_opcodes.py 29 Jan 2001 06:21:17 -0000 1.10 --- test_opcodes.py 23 Jul 2002 19:03:58 -0000 1.11 *************** *** 1,5 **** # Python test set -- part 2, opcodes ! from test_support import * --- 1,5 ---- # Python test set -- part 2, opcodes ! from test.test_support import * Index: test_openpty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_openpty.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_openpty.py 17 Jan 2001 21:51:35 -0000 1.6 --- test_openpty.py 23 Jul 2002 19:03:58 -0000 1.7 *************** *** 2,6 **** import os ! from test_support import verbose, TestFailed, TestSkipped try: --- 2,6 ---- import os ! from test.test_support import verbose, TestFailed, TestSkipped try: Index: test_operator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operator.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_operator.py 20 Sep 2001 21:33:42 -0000 1.8 --- test_operator.py 23 Jul 2002 19:03:58 -0000 1.9 *************** *** 2,6 **** import unittest ! import test_support --- 2,6 ---- import unittest ! from test import test_support Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_os.py 11 Jun 2002 06:22:30 -0000 1.11 --- test_os.py 23 Jul 2002 19:03:58 -0000 1.12 *************** *** 10,14 **** warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) ! from test_support import TESTFN, run_unittest class TemporaryFileTests(unittest.TestCase): --- 10,14 ---- warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) ! from test.test_support import TESTFN, run_unittest class TemporaryFileTests(unittest.TestCase): Index: test_parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_parser.py 1 Apr 2002 00:28:59 -0000 1.11 --- test_parser.py 23 Jul 2002 19:03:58 -0000 1.12 *************** *** 1,5 **** import parser - import test_support import unittest # --- 1,5 ---- import parser import unittest + from test import test_support # Index: test_pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pickle.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_pickle.py 19 Dec 2001 16:42:15 -0000 1.9 --- test_pickle.py 23 Jul 2002 19:03:58 -0000 1.10 *************** *** 1,7 **** import pickle - import test_support import unittest from cStringIO import StringIO from pickletester import AbstractPickleTests, AbstractPickleModuleTests class PickleTests(AbstractPickleTests, AbstractPickleModuleTests): --- 1,7 ---- import pickle import unittest from cStringIO import StringIO from pickletester import AbstractPickleTests, AbstractPickleModuleTests + from test import test_support class PickleTests(AbstractPickleTests, AbstractPickleModuleTests): Index: test_pkg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkg.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_pkg.py 24 Oct 2001 20:32:02 -0000 1.14 --- test_pkg.py 23 Jul 2002 19:03:58 -0000 1.15 *************** *** 4,8 **** from os import mkdir, rmdir, extsep # Can't test if these fail del mkdir, rmdir ! from test_support import verify, verbose, TestFailed # Helpers to create and destroy hierarchies. --- 4,8 ---- from os import mkdir, rmdir, extsep # Can't test if these fail del mkdir, rmdir ! from test.test_support import verify, verbose, TestFailed # Helpers to create and destroy hierarchies. Index: test_pkgimport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkgimport.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_pkgimport.py 24 Oct 2001 20:32:02 -0000 1.5 --- test_pkgimport.py 23 Jul 2002 19:03:58 -0000 1.6 *************** *** 1,5 **** import os, sys, string, random, tempfile, unittest ! from test_support import run_unittest class TestImport(unittest.TestCase): --- 1,5 ---- import os, sys, string, random, tempfile, unittest ! from test.test_support import run_unittest class TestImport(unittest.TestCase): Index: test_poll.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_poll.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_poll.py 17 Jan 2001 19:11:13 -0000 1.5 --- test_poll.py 23 Jul 2002 19:03:58 -0000 1.6 *************** *** 2,6 **** import sys, os, select, random ! from test_support import verify, verbose, TestSkipped, TESTFN try: --- 2,6 ---- import sys, os, select, random ! from test.test_support import verify, verbose, TestSkipped, TESTFN try: Index: test_popen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_popen.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_popen.py 20 Jul 2002 20:35:13 -0000 1.2 --- test_popen.py 23 Jul 2002 19:03:58 -0000 1.3 *************** *** 7,11 **** import os import sys ! from test_support import TestSkipped from os import popen --- 7,11 ---- import os import sys ! from test.test_support import TestSkipped from os import popen Index: test_popen2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_popen2.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_popen2.py 11 Jun 2002 06:22:30 -0000 1.6 --- test_popen2.py 23 Jul 2002 19:03:58 -0000 1.7 *************** *** 6,10 **** import os import sys ! from test_support import TestSkipped # popen2 contains its own testing routine --- 6,10 ---- import os import sys ! from test.test_support import TestSkipped # popen2 contains its own testing routine Index: test_pow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pow.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_pow.py 1 Apr 2002 19:01:39 -0000 1.14 --- test_pow.py 23 Jul 2002 19:03:58 -0000 1.15 *************** *** 1,4 **** import sys ! import test_support --- 1,4 ---- import sys ! from test import test_support Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_pprint.py 2 Apr 2002 05:08:35 -0000 1.8 --- test_pprint.py 23 Jul 2002 19:03:59 -0000 1.9 *************** *** 1,6 **** import pprint import unittest ! ! import test_support try: --- 1,5 ---- import pprint import unittest ! from test import test_support try: Index: test_profilehooks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profilehooks.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_profilehooks.py 1 Apr 2002 00:28:59 -0000 1.8 --- test_profilehooks.py 23 Jul 2002 19:03:59 -0000 1.9 *************** *** 1,9 **** - from test_support import TestFailed - import pprint import sys import unittest ! import test_support --- 1,7 ---- import pprint import sys import unittest ! from test import test_support *************** *** 330,336 **** def capture_events(callable, p=None): ! try: sys.setprofile() ! except TypeError: pass ! else: raise TestFailed, 'sys.setprofile() did not raise TypeError' if p is None: --- 328,338 ---- def capture_events(callable, p=None): ! try: ! sys.setprofile() ! except TypeError: ! pass ! else: ! raise test_support.TestFailed( ! 'sys.setprofile() did not raise TypeError') if p is None: Index: test_pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_pty.py 11 Sep 2001 14:24:35 -0000 1.14 --- test_pty.py 23 Jul 2002 19:03:59 -0000 1.15 *************** *** 1,4 **** import pty, os, sys ! from test_support import verbose, TestFailed, TestSkipped TEST_STRING_1 = "I wish to buy a fish license.\n" --- 1,4 ---- import pty, os, sys ! from test.test_support import verbose, TestFailed, TestSkipped TEST_STRING_1 = "I wish to buy a fish license.\n" Index: test_pwd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_pwd.py 9 Feb 2001 11:53:49 -0000 1.11 --- test_pwd.py 23 Jul 2002 19:03:59 -0000 1.12 *************** *** 1,3 **** ! from test_support import verbose import pwd --- 1,3 ---- ! from test.test_support import verbose import pwd Index: test_pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyclbr.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_pyclbr.py 12 Jul 2002 15:54:37 -0000 1.11 --- test_pyclbr.py 23 Jul 2002 19:03:59 -0000 1.12 *************** *** 3,7 **** Nick Mathewson ''' ! from test_support import run_unittest import unittest, sys from types import ClassType, FunctionType, MethodType --- 3,7 ---- Nick Mathewson ''' ! from test.test_support import run_unittest import unittest, sys from types import ClassType, FunctionType, MethodType Index: test_pyexpat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyexpat.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_pyexpat.py 28 Jun 2002 22:56:48 -0000 1.12 --- test_pyexpat.py 23 Jul 2002 19:03:59 -0000 1.13 *************** *** 7,11 **** from xml.parsers import expat ! from test_support import sortdict, TestFailed class Outputter: --- 7,11 ---- from xml.parsers import expat ! from test.test_support import sortdict, TestFailed class Outputter: Index: test_queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_queue.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_queue.py 19 Apr 2002 00:11:32 -0000 1.1 --- test_queue.py 23 Jul 2002 19:03:59 -0000 1.2 *************** *** 6,10 **** import time ! from test_support import verify, TestFailed, verbose queue_size = 5 --- 6,10 ---- import time ! from test.test_support import verify, TestFailed, verbose queue_size = 5 Index: test_quopri.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_quopri.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_quopri.py 30 Sep 2001 20:32:10 -0000 1.6 --- test_quopri.py 23 Jul 2002 19:03:59 -0000 1.7 *************** *** 1,3 **** ! import test_support import unittest --- 1,3 ---- ! from test import test_support import unittest Index: test_random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_random.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_random.py 5 May 2002 20:39:59 -0000 1.1 --- test_random.py 23 Jul 2002 19:03:59 -0000 1.2 *************** *** 1,3 **** ! import test_support import random --- 1,3 ---- ! from test import test_support import random Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** test_re.py 10 Aug 2001 14:49:58 -0000 1.31 --- test_re.py 23 Jul 2002 19:03:59 -0000 1.32 *************** *** 2,6 **** sys.path = ['.'] + sys.path ! from test_support import verify, verbose, TestFailed import re import sys, os, traceback --- 2,6 ---- sys.path = ['.'] + sys.path ! from test.test_support import verify, verbose, TestFailed import re import sys, os, traceback Index: test_regex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_regex.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_regex.py 16 Apr 2002 01:27:44 -0000 1.11 --- test_regex.py 23 Jul 2002 19:03:59 -0000 1.12 *************** *** 1,3 **** ! from test_support import verbose, sortdict import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", --- 1,3 ---- ! from test.test_support import verbose, sortdict import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", Index: test_repr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_repr.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_repr.py 2 May 2002 18:40:31 -0000 1.13 --- test_repr.py 23 Jul 2002 19:04:00 -0000 1.14 *************** *** 8,12 **** import unittest ! from test_support import run_unittest from repr import repr as r # Don't shadow builtin repr --- 8,12 ---- import unittest ! from test.test_support import run_unittest from repr import repr as r # Don't shadow builtin repr Index: test_resource.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_resource.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_resource.py 23 Apr 2002 20:21:21 -0000 1.1 --- test_resource.py 23 Jul 2002 19:04:00 -0000 1.2 *************** *** 2,6 **** import resource ! from test_support import TESTFN # This test is checking a few specific problem spots. RLIMIT_FSIZE --- 2,6 ---- import resource ! from test.test_support import TESTFN # This test is checking a few specific problem spots. RLIMIT_FSIZE Index: test_rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_rfc822.py 5 Jun 2002 19:07:39 -0000 1.18 --- test_rfc822.py 23 Jul 2002 19:04:00 -0000 1.19 *************** *** 1,6 **** import rfc822 import sys - import test_support import unittest try: --- 1,6 ---- import rfc822 import sys import unittest + from test import test_support try: Index: test_rgbimg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rgbimg.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_rgbimg.py 24 Oct 2001 20:32:02 -0000 1.13 --- test_rgbimg.py 23 Jul 2002 19:04:00 -0000 1.14 *************** *** 3,7 **** import rgbimg, os, uu ! from test_support import verbose, unlink, findfile class error(Exception): --- 3,7 ---- import rgbimg, os, uu ! from test.test_support import verbose, unlink, findfile class error(Exception): Index: test_richcmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_richcmp.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_richcmp.py 8 May 2001 04:38:29 -0000 1.6 --- test_richcmp.py 23 Jul 2002 19:04:00 -0000 1.7 *************** *** 1,5 **** # Tests for rich comparisons ! from test_support import TestFailed, verify, verbose class Number: --- 1,5 ---- # Tests for rich comparisons ! from test.test_support import TestFailed, verify, verbose class Number: Index: test_robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_robotparser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_robotparser.py 16 Apr 2002 01:38:40 -0000 1.2 --- test_robotparser.py 23 Jul 2002 19:04:00 -0000 1.3 *************** *** 1,3 **** ! import unittest, StringIO, robotparser, test_support class RobotTestCase(unittest.TestCase): --- 1,4 ---- ! import unittest, StringIO, robotparser ! from test import test_support class RobotTestCase(unittest.TestCase): Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_sax.py 24 Oct 2001 20:32:02 -0000 1.19 --- test_sax.py 23 Jul 2002 19:04:00 -0000 1.20 *************** *** 13,17 **** from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from cStringIO import StringIO ! from test_support import verify, verbose, TestFailed, findfile import os --- 13,17 ---- from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from cStringIO import StringIO ! from test.test_support import verify, verbose, TestFailed, findfile import os Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_scope.py 20 Apr 2002 04:51:36 -0000 1.26 --- test_scope.py 23 Jul 2002 19:04:00 -0000 1.27 *************** *** 1,3 **** ! from test_support import verify, TestFailed, check_syntax import warnings --- 1,3 ---- ! from test.test_support import verify, TestFailed, check_syntax import warnings Index: test_select.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_select.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_select.py 13 Jun 2002 22:23:47 -0000 1.14 --- test_select.py 23 Jul 2002 19:04:00 -0000 1.15 *************** *** 1,4 **** # Testing select module ! from test_support import verbose import select import os --- 1,4 ---- # Testing select module ! from test.test_support import verbose import select import os Index: test_sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sgmllib.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_sgmllib.py 24 Sep 2001 20:22:09 -0000 1.2 --- test_sgmllib.py 23 Jul 2002 19:04:01 -0000 1.3 *************** *** 1,6 **** import pprint import sgmllib - import test_support import unittest --- 1,6 ---- import pprint import sgmllib import unittest + from test import test_support Index: test_sha.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sha.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_sha.py 20 Sep 2001 21:33:42 -0000 1.3 --- test_sha.py 23 Jul 2002 19:04:01 -0000 1.4 *************** *** 6,11 **** import sha - import test_support import unittest --- 6,11 ---- import sha import unittest + from test import test_support Index: test_signal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_signal.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_signal.py 16 Jul 2002 21:35:23 -0000 1.11 --- test_signal.py 23 Jul 2002 19:04:01 -0000 1.12 *************** *** 1,4 **** # Test the signal module ! from test_support import verbose, TestSkipped, TestFailed import signal import os, sys, time --- 1,4 ---- # Test the signal module ! from test.test_support import verbose, TestSkipped, TestFailed import signal import os, sys, time Index: test_slice.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_slice.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_slice.py 19 Jul 2002 15:47:06 -0000 1.1 --- test_slice.py 23 Jul 2002 19:04:02 -0000 1.2 *************** *** 1,5 **** # tests for slice objects; in particular the indices method. ! from test_support import vereq vereq(slice(None ).indices(10), (0, 10, 1)) --- 1,5 ---- # tests for slice objects; in particular the indices method. ! from test.test_support import vereq vereq(slice(None ).indices(10), (0, 10, 1)) Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_socket.py 19 Jul 2002 19:23:54 -0000 1.42 --- test_socket.py 23 Jul 2002 19:04:02 -0000 1.43 *************** *** 2,6 **** import unittest ! import test_support import socket --- 2,6 ---- import unittest ! from test import test_support import socket Index: test_socket_ssl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket_ssl.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_socket_ssl.py 18 Oct 2001 21:57:37 -0000 1.4 --- test_socket_ssl.py 23 Jul 2002 19:04:02 -0000 1.5 *************** *** 1,5 **** # Test just the SSL support in the socket module, in a moderately bogus way. ! import test_support # Optionally test SSL support. This currently requires the 'network' resource --- 1,5 ---- # Test just the SSL support in the socket module, in a moderately bogus way. ! from test import test_support # Optionally test SSL support. This currently requires the 'network' resource Index: test_socketserver.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socketserver.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_socketserver.py 29 Oct 2001 07:18:02 -0000 1.6 --- test_socketserver.py 23 Jul 2002 19:04:03 -0000 1.7 *************** *** 1,6 **** # Test suite for SocketServer.py ! import test_support ! from test_support import verbose, verify, TESTFN, TestSkipped test_support.requires('network') --- 1,6 ---- # Test suite for SocketServer.py ! from test import test_support ! from test.test_support import verbose, verify, TESTFN, TestSkipped test_support.requires('network') Index: test_softspace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_softspace.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_softspace.py 24 Mar 2002 19:25:00 -0000 1.1 --- test_softspace.py 23 Jul 2002 19:04:03 -0000 1.2 *************** *** 1,3 **** ! import test_support import StringIO --- 1,3 ---- ! from test import test_support import StringIO Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_sre.py 9 Dec 2001 16:13:15 -0000 1.35 --- test_sre.py 23 Jul 2002 19:04:03 -0000 1.36 *************** *** 7,11 **** sys.path=['.']+sys.path ! from test_support import verbose, TestFailed, have_unicode import sre import sys, os, string, traceback --- 7,11 ---- sys.path=['.']+sys.path ! from test.test_support import verbose, TestFailed, have_unicode import sre import sys, os, string, traceback Index: test_strftime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_strftime.py 4 Sep 2001 19:14:14 -0000 1.26 --- test_strftime.py 23 Jul 2002 19:04:03 -0000 1.27 *************** *** 4,8 **** import time, calendar, sys, os, re ! from test_support import verbose def main(): --- 4,8 ---- import time, calendar, sys, os, re ! from test.test_support import verbose def main(): Index: test_string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_string.py 23 May 2002 15:15:30 -0000 1.17 --- test_string.py 23 Jul 2002 19:04:04 -0000 1.18 *************** *** 1,4 **** ! from test_support import verbose, TestSkipped ! import string_tests import string, sys --- 1,4 ---- ! from test.test_support import verbose, TestSkipped ! from test import string_tests import string, sys Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_strop.py 16 Apr 2002 01:27:44 -0000 1.16 --- test_strop.py 23 Jul 2002 19:04:04 -0000 1.17 *************** *** 4,9 **** r'test_strop|unittest') import strop - import test_support import unittest --- 4,9 ---- r'test_strop|unittest') import strop import unittest + from test import test_support Index: test_struct.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_struct.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_struct.py 15 Sep 2001 02:35:15 -0000 1.14 --- test_struct.py 23 Jul 2002 19:04:04 -0000 1.15 *************** *** 1,3 **** ! from test_support import TestFailed, verbose, verify import struct ## import pdb --- 1,3 ---- ! from test.test_support import TestFailed, verbose, verify import struct ## import pdb Index: test_structseq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_structseq.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_structseq.py 6 Mar 2002 17:18:15 -0000 1.3 --- test_structseq.py 23 Jul 2002 19:04:04 -0000 1.4 *************** *** 1,3 **** ! from test_support import vereq import time --- 1,3 ---- ! from test.test_support import vereq import time Index: test_sunaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sunaudiodev.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_sunaudiodev.py 14 Apr 2001 03:10:12 -0000 1.10 --- test_sunaudiodev.py 23 Jul 2002 19:04:05 -0000 1.11 *************** *** 1,3 **** ! from test_support import verbose, findfile, TestFailed, TestSkipped import sunaudiodev import os --- 1,3 ---- ! from test.test_support import verbose, findfile, TestFailed, TestSkipped import sunaudiodev import os Index: test_sundry.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_sundry.py 16 Apr 2002 01:27:44 -0000 1.10 --- test_sundry.py 23 Jul 2002 19:04:05 -0000 1.11 *************** *** 9,13 **** DeprecationWarning, 'pre$') ! from test_support import verbose import BaseHTTPServer --- 9,13 ---- DeprecationWarning, 'pre$') ! from test.test_support import verbose import BaseHTTPServer Index: test_symtable.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_symtable.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_symtable.py 15 Feb 2001 23:56:39 -0000 1.3 --- test_symtable.py 23 Jul 2002 19:04:05 -0000 1.4 *************** *** 1,3 **** ! from test_support import verify import _symtable --- 1,3 ---- ! from test.test_support import verify import _symtable Index: test_syntax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_syntax.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_syntax.py 31 May 2002 14:08:29 -0000 1.1 --- test_syntax.py 23 Jul 2002 19:04:06 -0000 1.2 *************** *** 2,6 **** import unittest ! import test_support class SyntaxTestCase(unittest.TestCase): --- 2,6 ---- import unittest ! from test import test_support class SyntaxTestCase(unittest.TestCase): Index: test_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_thread.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_thread.py 16 Feb 2002 07:26:27 -0000 1.10 --- test_thread.py 23 Jul 2002 19:04:06 -0000 1.11 *************** *** 3,7 **** # Create a bunch of threads, let each do some work, wait until all are done ! from test_support import verbose import random import thread --- 3,7 ---- # Create a bunch of threads, let each do some work, wait until all are done ! from test.test_support import verbose import random import thread Index: test_threaded_import.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threaded_import.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_threaded_import.py 16 Feb 2002 07:26:27 -0000 1.5 --- test_threaded_import.py 23 Jul 2002 19:04:06 -0000 1.6 *************** *** 7,11 **** import thread ! from test_support import verbose, TestSkipped critical_section = thread.allocate_lock() --- 7,11 ---- import thread ! from test.test_support import verbose, TestSkipped critical_section = thread.allocate_lock() Index: test_threadedtempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threadedtempfile.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_threadedtempfile.py 14 Apr 2001 14:35:43 -0000 1.3 --- test_threadedtempfile.py 23 Jul 2002 19:04:06 -0000 1.4 *************** *** 23,27 **** import thread # If this fails, we can't test this module import threading ! from test_support import TestFailed import StringIO from traceback import print_exc --- 23,27 ---- import thread # If this fails, we can't test this module import threading ! from test.test_support import TestFailed import StringIO from traceback import print_exc Index: test_threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threading.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_threading.py 20 Aug 2001 21:45:19 -0000 1.2 --- test_threading.py 23 Jul 2002 19:04:06 -0000 1.3 *************** *** 3,7 **** # Create a bunch of threads, let each do some work, wait until all are done ! from test_support import verbose import random import threading --- 3,7 ---- # Create a bunch of threads, let each do some work, wait until all are done ! from test.test_support import verbose import random import threading Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_time.py 19 Jul 2002 17:04:46 -0000 1.10 --- test_time.py 23 Jul 2002 19:04:06 -0000 1.11 *************** *** 1,3 **** ! import test_support import time import unittest --- 1,3 ---- ! from test import test_support import time import unittest Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_timeout.py 13 Jun 2002 20:24:17 -0000 1.6 --- test_timeout.py 23 Jul 2002 19:04:06 -0000 1.7 *************** *** 2,6 **** import unittest ! import test_support import time --- 2,6 ---- import unittest ! from test import test_support import time Index: test_timing.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timing.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_timing.py 17 Jan 2001 21:51:36 -0000 1.3 --- test_timing.py 23 Jul 2002 19:04:07 -0000 1.4 *************** *** 1,3 **** ! from test_support import verbose import timing --- 1,3 ---- ! from test.test_support import verbose import timing Index: test_tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tokenize.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_tokenize.py 24 Oct 2001 20:32:03 -0000 1.6 --- test_tokenize.py 23 Jul 2002 19:04:08 -0000 1.7 *************** *** 1,3 **** ! from test_support import verbose, findfile import tokenize, os, sys --- 1,3 ---- ! from test.test_support import verbose, findfile import tokenize, os, sys Index: test_traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_traceback.py 20 Sep 2001 21:33:42 -0000 1.4 --- test_traceback.py 23 Jul 2002 19:04:08 -0000 1.5 *************** *** 2,6 **** import unittest ! from test_support import run_unittest import traceback --- 2,6 ---- import unittest ! from test.test_support import run_unittest import traceback Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_types.py 16 Jul 2002 21:35:23 -0000 1.35 --- test_types.py 23 Jul 2002 19:04:08 -0000 1.36 *************** *** 1,5 **** # Python test set -- part 6, built-in types ! from test_support import * print '6. Built-in types' --- 1,5 ---- # Python test set -- part 6, built-in types ! from test.test_support import * print '6. Built-in types' Index: test_ucn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_ucn.py 24 Jan 2001 07:59:11 -0000 1.8 --- test_ucn.py 23 Jul 2002 19:04:08 -0000 1.9 *************** *** 7,11 **** """#" ! from test_support import verify, verbose print 'Testing General Unicode Character Name, and case insensitivity...', --- 7,11 ---- """#" ! from test.test_support import verify, verbose print 'Testing General Unicode Character Name, and case insensitivity...', Index: test_unary.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unary.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_unary.py 20 May 2002 14:24:53 -0000 1.5 --- test_unary.py 23 Jul 2002 19:04:08 -0000 1.6 *************** *** 2,6 **** import unittest ! from test_support import run_unittest, have_unicode class UnaryOpTestCase(unittest.TestCase): --- 2,6 ---- import unittest ! from test.test_support import run_unittest, have_unicode class UnaryOpTestCase(unittest.TestCase): Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** test_unicode.py 23 May 2002 15:15:30 -0000 1.58 --- test_unicode.py 23 Jul 2002 19:04:08 -0000 1.59 *************** *** 6,10 **** """#" ! from test_support import verify, verbose, TestFailed import sys, string --- 6,10 ---- """#" ! from test.test_support import verify, verbose, TestFailed import sys, string Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_unicode_file.py 15 Jan 2002 21:25:51 -0000 1.4 --- test_unicode_file.py 23 Jul 2002 19:04:08 -0000 1.5 *************** *** 4,10 **** import os, glob ! from test_support import verify, TestSkipped, TESTFN_UNICODE try: ! from test_support import TESTFN_ENCODING oldlocale = None except ImportError: --- 4,10 ---- import os, glob ! from test.test_support import verify, TestSkipped, TESTFN_UNICODE try: ! from test.test_support import TESTFN_ENCODING oldlocale = None except ImportError: Index: test_unicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicodedata.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_unicodedata.py 17 Jan 2001 19:11:13 -0000 1.5 --- test_unicodedata.py 23 Jul 2002 19:04:08 -0000 1.6 *************** *** 6,10 **** """#" ! from test_support import verify, verbose import sha --- 6,10 ---- """#" ! from test.test_support import verify, verbose import sha Index: test_univnewlines.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_univnewlines.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_univnewlines.py 21 Apr 2002 06:12:02 -0000 1.3 --- test_univnewlines.py 23 Jul 2002 19:04:08 -0000 1.4 *************** *** 1,7 **** # Tests universal newline support for both reading and parsing files. import unittest - import test_support import os import sys if not hasattr(sys.stdin, 'newlines'): --- 1,7 ---- # Tests universal newline support for both reading and parsing files. import unittest import os import sys + from test import test_support if not hasattr(sys.stdin, 'newlines'): Index: test_unpack.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unpack.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_unpack.py 12 Dec 2000 23:11:42 -0000 1.5 --- test_unpack.py 23 Jul 2002 19:04:08 -0000 1.6 *************** *** 1,3 **** ! from test_support import * t = (1, 2, 3) --- 1,3 ---- ! from test.test_support import * t = (1, 2, 3) Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_urllib.py 28 Jan 2001 21:12:22 -0000 1.8 --- test_urllib.py 23 Jul 2002 19:04:09 -0000 1.9 *************** *** 1,4 **** # Minimal test of the quote function ! from test_support import verify, verbose import urllib --- 1,4 ---- # Minimal test of the quote function ! from test.test_support import verify, verbose import urllib Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_urllib2.py 24 Oct 2001 20:32:03 -0000 1.6 --- test_urllib2.py 23 Jul 2002 19:04:09 -0000 1.7 *************** *** 1,3 **** ! from test_support import verify import urllib2 import os --- 1,3 ---- ! from test.test_support import verify import urllib2 import os Index: test_urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urlparse.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_urlparse.py 16 Apr 2002 01:38:40 -0000 1.5 --- test_urlparse.py 23 Jul 2002 19:04:09 -0000 1.6 *************** *** 1,5 **** #! /usr/bin/env python ! import test_support import unittest import urlparse --- 1,5 ---- #! /usr/bin/env python ! from test import test_support import unittest import urlparse Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_userdict.py 5 Nov 2001 17:41:48 -0000 1.5 --- test_userdict.py 23 Jul 2002 19:04:09 -0000 1.6 *************** *** 1,5 **** # Check every path through every method of UserDict ! from test_support import verify, verbose from UserDict import UserDict, IterableUserDict --- 1,5 ---- # Check every path through every method of UserDict ! from test.test_support import verify, verbose from UserDict import UserDict, IterableUserDict Index: test_userlist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userlist.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_userlist.py 17 Jan 2001 21:51:36 -0000 1.5 --- test_userlist.py 23 Jul 2002 19:04:09 -0000 1.6 *************** *** 2,6 **** from UserList import UserList ! from test_support import TestFailed # Use check instead of assert so -O doesn't render the --- 2,6 ---- from UserList import UserList ! from test.test_support import TestFailed # Use check instead of assert so -O doesn't render the Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_userstring.py 12 Apr 2002 16:25:39 -0000 1.6 --- test_userstring.py 23 Jul 2002 19:04:09 -0000 1.7 *************** *** 1,6 **** #!/usr/bin/env python import sys ! from test_support import verbose ! import string_tests # UserString is a wrapper around the native builtin string type. # UserString instances should behave similar to builtin string objects. --- 1,6 ---- #!/usr/bin/env python import sys ! from test.test_support import verbose ! from test import string_tests # UserString is a wrapper around the native builtin string type. # UserString instances should behave similar to builtin string objects. Index: test_uu.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_uu.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_uu.py 17 Aug 2001 20:00:11 -0000 1.3 --- test_uu.py 23 Jul 2002 19:04:09 -0000 1.4 *************** *** 4,8 **** """ ! from test_support import verify, TestFailed, verbose, TESTFN import sys, os import uu --- 4,8 ---- """ ! from test.test_support import verify, TestFailed, verbose, TESTFN import sys, os import uu Index: test_wave.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_wave.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_wave.py 19 Dec 2000 06:32:57 -0000 1.2 --- test_wave.py 23 Jul 2002 19:04:09 -0000 1.3 *************** *** 1,3 **** ! from test_support import TestFailed import os, tempfile import wave --- 1,3 ---- ! from test.test_support import TestFailed import os, tempfile import wave Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_weakref.py 10 Jun 2002 20:00:14 -0000 1.19 --- test_weakref.py 23 Jul 2002 19:04:09 -0000 1.20 *************** *** 4,8 **** import weakref ! import test_support --- 4,8 ---- import weakref ! from test import test_support Index: test_winreg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winreg.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_winreg.py 17 Aug 2001 18:39:24 -0000 1.10 --- test_winreg.py 23 Jul 2002 19:04:09 -0000 1.11 *************** *** 5,9 **** import os, sys ! from test_support import verify, have_unicode test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me" --- 5,9 ---- import os, sys ! from test.test_support import verify, have_unicode test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me" Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_xmllib.py 16 Apr 2002 01:27:44 -0000 1.10 --- test_xmllib.py 23 Jul 2002 19:04:09 -0000 1.11 *************** *** 18,22 **** DeprecationWarning, r'xmllib$') ! import test_support import unittest import xmllib --- 18,22 ---- DeprecationWarning, r'xmllib$') ! from test import test_support import unittest import xmllib Index: test_xmlrpc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmlrpc.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_xmlrpc.py 19 Oct 2001 16:06:52 -0000 1.2 --- test_xmlrpc.py 23 Jul 2002 19:04:09 -0000 1.3 *************** *** 1,6 **** import sys - import test_support import unittest import xmlrpclib alist = [{'astring': 'foo@bar.baz.spam', --- 1,6 ---- import sys import unittest import xmlrpclib + from test import test_support alist = [{'astring': 'foo@bar.baz.spam', Index: test_xreadline.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xreadline.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_xreadline.py 18 Jan 2001 02:22:22 -0000 1.3 --- test_xreadline.py 23 Jul 2002 19:04:09 -0000 1.4 *************** *** 1,3 **** ! from test_support import verbose class XReader: --- 1,3 ---- ! from test.test_support import verbose class XReader: Index: test_zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipfile.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_zipfile.py 24 Oct 2001 20:32:03 -0000 1.8 --- test_zipfile.py 23 Jul 2002 19:04:09 -0000 1.9 *************** *** 1,5 **** import zlib # implied prerequisite import zipfile, os, StringIO, tempfile ! from test_support import TestFailed srcname = "junk9630"+os.extsep+"tmp" --- 1,5 ---- import zlib # implied prerequisite import zipfile, os, StringIO, tempfile ! from test.test_support import TestFailed srcname = "junk9630"+os.extsep+"tmp" Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_zlib.py 19 Apr 2002 14:36:57 -0000 1.17 --- test_zlib.py 23 Jul 2002 19:04:09 -0000 1.18 *************** *** 1,6 **** import zlib - from test_support import TestFailed import sys import imp try: --- 1,6 ---- import zlib import sys import imp + from test.test_support import TestFailed try: From bwarsaw@users.sourceforge.net Tue Jul 23 20:13:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:13:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test README,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30748 Modified Files: README Log Message: A few updates about how/where to import test_support from. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** README 23 Jul 2002 19:03:42 -0000 1.14 --- README 23 Jul 2002 19:13:45 -0000 1.15 *************** *** 86,90 **** provides a convenient example: ! import difflib, test_support test_support.run_doctest(difflib) --- 86,91 ---- provides a convenient example: ! import difflib ! from test import test_support test_support.run_doctest(difflib) *************** *** 102,107 **** def test_main(verbose=None): ! import test_support, test.test_descrtut ! test_support.run_doctest(test.test_descrtut, verbose) if __name__ == "__main__": --- 103,108 ---- def test_main(verbose=None): ! from test import test_support, test_descrtut ! test_support.run_doctest(test_descrtut, verbose) if __name__ == "__main__": *************** *** 276,280 **** Miscellaneous ! There is a test_support module in the test package you can import from your test case. Import this module using either --- 277,281 ---- Miscellaneous ! There is a test_support module in the test package you can import for your test case. Import this module using either From bwarsaw@users.sourceforge.net Tue Jul 23 20:22:39 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:22:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_fork1.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1652 Modified Files: test_fork1.py Log Message: Oops, missed an import of test_support. Index: test_fork1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fork1.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_fork1.py 11 Apr 2001 20:58:20 -0000 1.9 --- test_fork1.py 23 Jul 2002 19:22:37 -0000 1.10 *************** *** 12,16 **** import os, sys, time, thread ! from test_support import verify, verbose, TestSkipped try: --- 12,16 ---- import os, sys, time, thread ! from test.test_support import verify, verbose, TestSkipped try: From bwarsaw@users.sourceforge.net Tue Jul 23 20:23:24 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:23:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1902 Modified Files: test_bsddb.py Log Message: Oops, missed an import of test_support. Index: test_bsddb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_bsddb.py 23 Apr 2002 02:11:03 -0000 1.10 --- test_bsddb.py 23 Jul 2002 19:23:22 -0000 1.11 *************** *** 7,11 **** import dbhash # Just so we know it's imported import tempfile ! from test_support import verbose, verify def test(openmethod, what, ondisk=1): --- 7,11 ---- import dbhash # Just so we know it's imported import tempfile ! from test.test_support import verbose, verify def test(openmethod, what, ondisk=1): From nnorwitz@users.sourceforge.net Tue Jul 23 20:39:57 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:39:57 -0700 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.60,1.61 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv7447 Modified Files: pep-0042.txt Log Message: strptime is now implemented Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** pep-0042.txt 11 Jul 2002 18:11:32 -0000 1.60 --- pep-0042.txt 23 Jul 2002 19:39:54 -0000 1.61 *************** *** 141,154 **** http://www.python.org/sf/215126 - - Add a portable implementation of time.strptime() that works in - clearly defined ways on all platforms. - - http://www.python.org/sf/215146 - http://www.python.org/sf/212244 - - Possible solution: - - http://www.python.org/sf/474274 - - rfc822.py should be more lenient than the spec in the types of address fields it parses. Specifically, an invalid address of --- 141,144 ---- From nnorwitz@users.sourceforge.net Tue Jul 23 20:41:40 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:41:40 -0700 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.61,1.62 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8104 Modified Files: pep-0042.txt Log Message: Fix reference for urllib proxies. Hasn't this been implemented? Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** pep-0042.txt 23 Jul 2002 19:39:54 -0000 1.61 --- pep-0042.txt 23 Jul 2002 19:41:36 -0000 1.62 *************** *** 97,101 **** - The urllib module should support proxies which require ! authenication. See SourceForge bug #110619 for information: http://www.python.org/sf/210619 --- 97,101 ---- - The urllib module should support proxies which require ! authenication. See SourceForge bug #210619 for information: http://www.python.org/sf/210619 From bwarsaw@users.sourceforge.net Tue Jul 23 20:46:38 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:46:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv9630 Modified Files: test_email.py Log Message: Added a couple of more tests for Header charset handling. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_email.py 23 Jul 2002 19:03:42 -0000 1.2 --- test_email.py 23 Jul 2002 19:46:35 -0000 1.3 *************** *** 2044,2048 **** --- 2044,2063 ---- eq(h.encode(), hstr) + def test_us_ascii_header(self): + eq = self.assertEqual + s = 'hello' + x = decode_header(s) + eq(x, [('hello', None)]) + h = make_header(x) + eq(s, h.encode()) + def test_string_charset(self): + eq = self.assertEqual + h = Header() + h.append('hello', 'iso-8859-1') + eq(h, '=?iso-8859-1?q?hello?=') + + + # Test RFC 2231 header parameters decoding class TestRFC2231(TestEmailBase): From tim_one@users.sourceforge.net Tue Jul 23 20:56:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 23 Jul 2002 12:56:32 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv12701/python/PCbuild Modified Files: python20.wse Log Message: Taught the Windows installer about changes in the structure of the email package, and the loss of the test/data directory. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** python20.wse 16 Apr 2002 20:48:01 -0000 1.102 --- python20.wse 23 Jul 2002 19:56:30 -0000 1.103 *************** *** 1908,1911 **** --- 1908,1929 ---- Flags=0000000000000010 end + item: Install File + Source=..\lib\email\test\*.py + Destination=%MAINDIR%\Lib\email\test + Description=email tests + Flags=0000000000000010 + end + item: Install File + Source=..\lib\email\test\data\*.txt + Destination=%MAINDIR%\Lib\email\test\data + Description=email test data + Flags=0000000000000010 + end + item: Install File + Source=..\lib\email\test\data\*.gif + Destination=%MAINDIR%\Lib\email\test\data + Description=email test data + Flags=0000000000000010 + end item: Remark end *************** *** 2231,2242 **** Source=..\lib\test\*.out Destination=%MAINDIR%\Lib\test - Description=Python Test files - Flags=0000000000000010 - end - item: Remark - end - item: Install File - Source=..\lib\test\data\*.* - Destination=%MAINDIR%\Lib\test\data Description=Python Test files Flags=0000000000000010 --- 2249,2252 ---- From bwarsaw@users.sourceforge.net Tue Jul 23 21:36:00 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 23 Jul 2002 13:36:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email_torture.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv25979/email/test Modified Files: test_email_torture.py Log Message: Use full package paths in imports. Index: test_email_torture.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email_torture.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_email_torture.py 19 Jul 2002 22:29:00 -0000 1.1 --- test_email_torture.py 23 Jul 2002 20:35:58 -0000 1.2 *************** *** 12,23 **** from cStringIO import StringIO from types import ListType - from test_email import TestEmailBase ! try: ! import test_support ! TestSkipped = test_support.TestSkipped ! except ImportError: ! test_support = None ! TestSkipped = ImportError import email --- 12,18 ---- from cStringIO import StringIO from types import ListType ! from email.test.test_email import TestEmailBase ! from test.test_support import TestSkipped import email From gvanrossum@users.sourceforge.net Wed Jul 24 02:49:18 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 23 Jul 2002 18:49:18 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle ReplaceDialog.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv9150 Modified Files: ReplaceDialog.py Log Message: The test for re.engine was misfiring because re.engine is no longer defined and the default was "pre" instead of "sre". Give up on 1.5.2 compatibility, hardcode the sre solution. However, this XXX comment still applies, AFAIK: # XXX This code depends on internals of the regular expression # engine! There's no standard API to do a substitution when you # have already found the match. One should be added. Index: ReplaceDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ReplaceDialog.py 4 Apr 2002 22:55:58 -0000 1.5 --- ReplaceDialog.py 24 Jul 2002 01:49:16 -0000 1.6 *************** *** 7,10 **** --- 7,11 ---- import SearchEngine from SearchDialogBase import SearchDialogBase + import sre_parse def replace(text): *************** *** 159,173 **** # engine! There's no standard API to do a substitution when you # have already found the match. One should be added. ! # The solution here is designed to be backwards compatible ! # with previous Python versions, e.g. 1.5.2. ! # XXX This dynamic test should be done only once. ! if getattr(re, "engine", "pre") == "pre": ! return re.pcre_expand(m, template) ! else: # sre ! # XXX This import should be avoidable... ! import sre_parse ! # XXX This parses the template over and over... ! ptemplate = sre_parse.parse_template(template, m.re) ! return sre_parse.expand_template(ptemplate, m) def show_hit(self, first, last): --- 160,166 ---- # engine! There's no standard API to do a substitution when you # have already found the match. One should be added. ! # XXX This parses the template over and over... ! ptemplate = sre_parse.parse_template(template, m.re) ! return sre_parse.expand_template(ptemplate, m) def show_hit(self, first, last): From jhylton@users.sourceforge.net Wed Jul 24 16:32:27 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 24 Jul 2002 08:32:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7138 Modified Files: libos.tex Log Message: Flesh out description of getlogin() and recommend against using it. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** libos.tex 2 Jul 2002 21:03:49 -0000 1.91 --- libos.tex 24 Jul 2002 15:32:25 -0000 1.92 *************** *** 140,145 **** \begin{funcdesc}{getlogin}{} ! Return the actual login name for the current process, even if there ! are multiple login names which map to the same user id. Availability: \UNIX. \end{funcdesc} --- 140,146 ---- \begin{funcdesc}{getlogin}{} ! Return the name of the user logged in on the controlling terminal of ! the process. For most purposes, it is more useful to use the ! environment variable \envvar{LOGNAME} to find out who the user is. Availability: \UNIX. \end{funcdesc} From gvanrossum@users.sourceforge.net Wed Jul 24 20:13:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 24 Jul 2002 12:13:10 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle ReplaceDialog.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv8087 Modified Files: ReplaceDialog.py Log Message: Get rid of _expand() altogether - the match object supports m.expand(). Index: ReplaceDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ReplaceDialog.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ReplaceDialog.py 24 Jul 2002 01:49:16 -0000 1.6 --- ReplaceDialog.py 24 Jul 2002 19:13:08 -0000 1.7 *************** *** 7,11 **** import SearchEngine from SearchDialogBase import SearchDialogBase - import sre_parse def replace(text): --- 7,10 ---- *************** *** 92,96 **** chars = text.get("%d.0" % line, "%d.0" % (line+1)) orig = m.group() ! new = self._expand(m, repl) i, j = m.span() first = "%d.%d" % (line, i) --- 91,95 ---- chars = text.get("%d.0" % line, "%d.0" % (line+1)) orig = m.group() ! new = m.expand(repl) i, j = m.span() first = "%d.%d" % (line, i) *************** *** 144,148 **** if not prog: return False ! new = self._expand(m, self.replvar.get()) text.mark_set("insert", first) text.undo_block_start() --- 143,147 ---- if not prog: return False ! new = m.expand(self.replvar.get()) text.mark_set("insert", first) text.undo_block_start() *************** *** 155,166 **** self.ok = 0 return True - - def _expand(self, m, template): - # XXX This code depends on internals of the regular expression - # engine! There's no standard API to do a substitution when you - # have already found the match. One should be added. - # XXX This parses the template over and over... - ptemplate = sre_parse.parse_template(template, m.re) - return sre_parse.expand_template(ptemplate, m) def show_hit(self, first, last): --- 154,157 ---- From montanaro@users.sourceforge.net Thu Jul 25 07:18:44 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 24 Jul 2002 23:18:44 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.247,2.248 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv16894 Modified Files: compile.c Log Message: remove spurious SET_LINENO from com_list_for and com_list_if. All they do is slow things down unnecessarily and make tracing much more verbose. Something like def f(n): return [i for i in range(n) if i%2] should have at most two SET_LINENO instructions, not four. When tracing, the current line number should be printed once, not 2*n+1 times. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.247 retrieving revision 2.248 diff -C2 -d -r2.247 -r2.248 *** compile.c 20 Jun 2002 22:23:14 -0000 2.247 --- compile.c 25 Jul 2002 06:18:42 -0000 2.248 *************** *** 1377,1381 **** com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; - com_addoparg(c, SET_LINENO, n->n_lineno); com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); --- 1377,1380 ---- *************** *** 1396,1400 **** int a = 0; /* list_iter: 'if' test [list_iter] */ - com_addoparg(c, SET_LINENO, n->n_lineno); com_node(c, CHILD(n, 1)); com_addfwref(c, JUMP_IF_FALSE, &a); --- 1395,1398 ---- From doerwalter@users.sourceforge.net Thu Jul 25 14:23:31 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 25 Jul 2002 06:23:31 -0700 Subject: [Python-checkins] python/nondist/peps pep-0293.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1734 Modified Files: pep-0293.txt Log Message: Update the PEP to the current state of the patch. Index: pep-0293.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0293.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0293.txt 9 Jul 2002 18:35:04 -0000 1.3 --- pep-0293.txt 25 Jul 2002 13:23:29 -0000 1.4 *************** *** 311,315 **** i.e. (3) is 180 times slower than (1). ! Codecs must be stateless, because as soon as a callback is registered it is available globally and can be called by multiple encode() calls. To be able to use stateful callbacks, the errors --- 311,315 ---- i.e. (3) is 180 times slower than (1). ! Callbacks must be stateless, because as soon as a callback is registered it is available globally and can be called by multiple encode() calls. To be able to use stateful callbacks, the errors *************** *** 350,362 **** A sample implementation is available as SourceForge patch #432401 ! [2]. The current version of this patch differs from the ! specification in the following way: ! * The error information is passed from the codec to the callback ! not as an exception object, but as a tuple, which has an ! additional entry state, which can be used for additional ! information the codec might want to pass to the callback. ! * There are two separate registries (one for ! encoding/translating and one for decoding) The class codecs.StreamReaderWriter uses the errors parameter for --- 350,363 ---- A sample implementation is available as SourceForge patch #432401 ! [2] including a script for testing the speed of various ! string/encoding/error combinations and a test script. ! Currently the new exception classes are old style Python ! classes. This means that accessing attributes results ! in a dict lookup. The C API is implemented in a way ! that makes it possible to switch to new style classes ! behind the scene, if Exception (and UnicodeError) will ! be changed to new style classes implemented in C for ! improved performance. The class codecs.StreamReaderWriter uses the errors parameter for From doerwalter@users.sourceforge.net Thu Jul 25 14:30:30 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 25 Jul 2002 06:30:30 -0700 Subject: [Python-checkins] python/nondist/peps pep-0293.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4556 Modified Files: pep-0293.txt Log Message: Add another compatiblity issue: illegal "errors" values will raise a different exception. Index: pep-0293.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0293.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0293.txt 25 Jul 2002 13:23:29 -0000 1.4 --- pep-0293.txt 25 Jul 2002 13:30:28 -0000 1.5 *************** *** 390,393 **** --- 390,396 ---- should not be a problem in practice. + Illegal values for the errors argument raised ValueError before, + now they will raise LookupError. + References From jhylton@users.sourceforge.net Thu Jul 25 16:37:26 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 25 Jul 2002 08:37:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20419 Modified Files: test_socket.py Log Message: Remove test that was none too picky about whether attributes exist. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** test_socket.py 23 Jul 2002 19:04:02 -0000 1.43 --- test_socket.py 25 Jul 2002 15:37:23 -0000 1.44 *************** *** 217,261 **** socket.SO_REUSEADDR - def testNonCrucialConstants(self): - """Testing for existance of non-crucial constants.""" - for const in ( - "AF_UNIX", - - "SO_DEBUG", "SO_ACCEPTCONN", "SO_REUSEADDR", "SO_KEEPALIVE", - "SO_DONTROUTE", "SO_BROADCAST", "SO_USELOOPBACK", "SO_LINGER", - "SO_OOBINLINE", "SO_REUSEPORT", "SO_SNDBUF", "SO_RCVBUF", - "SO_SNDLOWAT", "SO_RCVLOWAT", "SO_SNDTIMEO", "SO_RCVTIMEO", - "SO_ERROR", "SO_TYPE", "SOMAXCONN", - - "MSG_OOB", "MSG_PEEK", "MSG_DONTROUTE", "MSG_EOR", - "MSG_TRUNC", "MSG_CTRUNC", "MSG_WAITALL", "MSG_BTAG", - "MSG_ETAG", - - "SOL_SOCKET", - - "IPPROTO_IP", "IPPROTO_ICMP", "IPPROTO_IGMP", - "IPPROTO_GGP", "IPPROTO_TCP", "IPPROTO_EGP", - "IPPROTO_PUP", "IPPROTO_UDP", "IPPROTO_IDP", - "IPPROTO_HELLO", "IPPROTO_ND", "IPPROTO_TP", - "IPPROTO_XTP", "IPPROTO_EON", "IPPROTO_BIP", - "IPPROTO_RAW", "IPPROTO_MAX", - - "IPPORT_RESERVED", "IPPORT_USERRESERVED", - - "INADDR_ANY", "INADDR_BROADCAST", "INADDR_LOOPBACK", - "INADDR_UNSPEC_GROUP", "INADDR_ALLHOSTS_GROUP", - "INADDR_MAX_LOCAL_GROUP", "INADDR_NONE", - - "IP_OPTIONS", "IP_HDRINCL", "IP_TOS", "IP_TTL", - "IP_RECVOPTS", "IP_RECVRETOPTS", "IP_RECVDSTADDR", - "IP_RETOPTS", "IP_MULTICAST_IF", "IP_MULTICAST_TTL", - "IP_MULTICAST_LOOP", "IP_ADD_MEMBERSHIP", - "IP_DROP_MEMBERSHIP", - ): - try: - getattr(socket, const) - except AttributeError: - pass - def testHostnameRes(self): """Testing hostname resolution mechanisms.""" --- 217,220 ---- From jhylton@users.sourceforge.net Thu Jul 25 17:01:15 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:01:15 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.235,1.236 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29556/Modules Modified Files: socketmodule.c Log Message: Extended socket.htonl and ntohl to accept longs. Fixes SF bug #568322. The code should raise an OverflowError if the long is > 32 bits, even on platforms where sizeof(long) > 4. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.235 retrieving revision 1.236 diff -C2 -d -r1.235 -r1.236 *** socketmodule.c 23 Jul 2002 06:31:13 -0000 1.235 --- socketmodule.c 25 Jul 2002 16:01:12 -0000 1.236 *************** *** 2470,2482 **** static PyObject * ! socket_ntohl(PyObject *self, PyObject *args) { ! int x1, x2; ! if (!PyArg_ParseTuple(args, "i:ntohl", &x1)) { ! return NULL; } ! x2 = ntohl(x1); ! return PyInt_FromLong(x2); } --- 2470,2501 ---- static PyObject * ! socket_ntohl(PyObject *self, PyObject *arg) { ! unsigned long x; ! if (PyInt_Check(arg)) { ! x = PyInt_AS_LONG(arg); } ! else if (PyLong_Check(arg)) { ! x = PyLong_AsUnsignedLong(arg); ! #if SIZEOF_LONG > 4 ! { ! unsigned long y; ! /* only want the trailing 32 bits */ ! y = x & 0xFFFFFFFFUL; ! if (y ^ x) ! return PyErr_Format(PyExc_OverflowError, ! "long int larger than 32 bits"); ! x = y; ! } ! #endif ! } ! else ! return PyErr_Format(PyExc_TypeError, ! "expected int/long, %s found", ! arg->ob_type->tp_name); ! if (x == (unsigned long) -1 && PyErr_Occurred()) ! return NULL; ! return PyInt_FromLong(ntohl(x)); } *************** *** 2490,2494 **** socket_htons(PyObject *self, PyObject *args) { ! int x1, x2; if (!PyArg_ParseTuple(args, "i:htons", &x1)) { --- 2509,2513 ---- socket_htons(PyObject *self, PyObject *args) { ! unsigned long x1, x2; if (!PyArg_ParseTuple(args, "i:htons", &x1)) { *************** *** 2506,2518 **** static PyObject * ! socket_htonl(PyObject *self, PyObject *args) { ! int x1, x2; ! if (!PyArg_ParseTuple(args, "i:htonl", &x1)) { ! return NULL; } ! x2 = htonl(x1); ! return PyInt_FromLong(x2); } --- 2525,2556 ---- static PyObject * ! socket_htonl(PyObject *self, PyObject *arg) { ! unsigned long x; ! if (PyInt_Check(arg)) { ! x = PyInt_AS_LONG(arg); } ! else if (PyLong_Check(arg)) { ! x = PyLong_AsUnsignedLong(arg); ! #if SIZEOF_LONG > 4 ! { ! unsigned long y; ! /* only want the trailing 32 bits */ ! y = x & 0xFFFFFFFFUL; ! if (y ^ x) ! return PyErr_Format(PyExc_OverflowError, ! "long int larger than 32 bits"); ! x = y; ! } ! #endif ! } ! else ! return PyErr_Format(PyExc_TypeError, ! "expected int/long, %s found", ! arg->ob_type->tp_name); ! if (x == (unsigned long) -1 && PyErr_Occurred()) ! return NULL; ! return PyInt_FromLong(htonl(x)); } *************** *** 2813,2821 **** METH_VARARGS, ntohs_doc}, {"ntohl", socket_ntohl, ! METH_VARARGS, ntohl_doc}, {"htons", socket_htons, METH_VARARGS, htons_doc}, {"htonl", socket_htonl, ! METH_VARARGS, htonl_doc}, {"inet_aton", socket_inet_aton, METH_VARARGS, inet_aton_doc}, --- 2851,2859 ---- METH_VARARGS, ntohs_doc}, {"ntohl", socket_ntohl, ! METH_O, ntohl_doc}, {"htons", socket_htons, METH_VARARGS, htons_doc}, {"htonl", socket_htonl, ! METH_O, htonl_doc}, {"inet_aton", socket_inet_aton, METH_VARARGS, inet_aton_doc}, From jhylton@users.sourceforge.net Thu Jul 25 17:01:14 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:01:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29556/Lib/test Modified Files: test_socket.py Log Message: Extended socket.htonl and ntohl to accept longs. Fixes SF bug #568322. The code should raise an OverflowError if the long is > 32 bits, even on platforms where sizeof(long) > 4. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_socket.py 25 Jul 2002 15:37:23 -0000 1.44 --- test_socket.py 25 Jul 2002 16:01:11 -0000 1.45 *************** *** 248,251 **** --- 248,262 ---- pass + def testNtoH(self): + def twice(f): + def g(x): + return f(f(x)) + return g + for i in (0, 1, 0xffff0000, 2L, (2**32L) - 1): + self.assertEqual(i, twice(socket.htonl)(i)) + self.assertEqual(i, twice(socket.ntohl)(i)) + self.assertRaises(OverflowError, socket.htonl, 2L**34) + self.assertRaises(OverflowError, socket.ntohl, 2L**34) + def testGetServByName(self): """Testing getservbyname().""" From montanaro@users.sourceforge.net Thu Jul 25 17:09:37 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:09:37 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts trace.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv338 Modified Files: trace.py Log Message: * runctx - fix a couple typos * globaltrace_lt - handle case where inspect.getmodulename doesn't return anything useful * localtrace_trace - handle case where inspect.getframeinfo doesn't return any context info I think both of the last two are caused by exec'd or eval'd code Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** trace.py 28 Nov 2001 19:41:45 -0000 1.6 --- trace.py 25 Jul 2002 16:09:35 -0000 1.7 *************** *** 501,507 **** if locals is None: locals = {} if not self.donothing: ! sys.settrace(gself.lobaltrace) try: ! exec cmd in dict, dict finally: if not self.donothing: --- 501,507 ---- if locals is None: locals = {} if not self.donothing: ! sys.settrace(self.globaltrace) try: ! exec cmd in globals, locals finally: if not self.donothing: *************** *** 541,554 **** if filename: modulename = inspect.getmodulename(filename) ! ignore_it = self.ignore.names(filename, modulename) ! # if DEBUG_MODE and not self.blabbed.has_key((filename, modulename,)): ! # self.blabbed[(filename, modulename,)] = None ! # print "%s.globaltrace(frame: %s, why: %s, arg: %s, filename: %s, modulename: %s, ignore_it: %s\n" % (self, frame, why, arg, filename, modulename, ignore_it,) ! if not ignore_it: ! if self.trace: ! print " --- modulename: %s, funcname: %s" % (modulename, funcname,) ! # if DEBUG_MODE: ! # print "%s.globaltrace(frame: %s, why: %s, arg: %s, filename: %s, modulename: %s, ignore_it: %s -- about to localtrace\n" % (self, frame, why, arg, filename, modulename, ignore_it,) ! return self.localtrace else: # XXX why no filename? --- 541,555 ---- if filename: modulename = inspect.getmodulename(filename) ! if modulename is not None: ! ignore_it = self.ignore.names(filename, modulename) ! # if DEBUG_MODE and not self.blabbed.has_key((filename, modulename,)): ! # self.blabbed[(filename, modulename,)] = None ! # print "%s.globaltrace(frame: %s, why: %s, arg: %s, filename: %s, modulename: %s, ignore_it: %s\n" % (self, frame, why, arg, filename, modulename, ignore_it,) ! if not ignore_it: ! if self.trace: ! print " --- modulename: %s, funcname: %s" % (modulename, funcname,) ! # if DEBUG_MODE: ! # print "%s.globaltrace(frame: %s, why: %s, arg: %s, filename: %s, modulename: %s, ignore_it: %s -- about to localtrace\n" % (self, frame, why, arg, filename, modulename, ignore_it,) ! return self.localtrace else: # XXX why no filename? *************** *** 587,595 **** # Using setdefault faster than two separate lines? --Zooko 2001-10-14 bname = self.pathtobasename.setdefault(filename, os.path.basename(filename)) ! try: ! print "%s(%d): %s" % (bname, lineno, context[lineindex],), ! except IndexError: ! # Uh.. sometimes getframeinfo gives me a context of length 1 and a lineindex of -2. Oh well. ! pass return self.localtrace --- 588,599 ---- # Using setdefault faster than two separate lines? --Zooko 2001-10-14 bname = self.pathtobasename.setdefault(filename, os.path.basename(filename)) ! if context is not None: ! try: ! print "%s(%d): %s" % (bname, lineno, context[lineindex],), ! except IndexError: ! # Uh.. sometimes getframeinfo gives me a context of length 1 and a lineindex of -2. Oh well. ! pass ! else: ! print "%s(???): ???" % bname return self.localtrace From montanaro@users.sourceforge.net Thu Jul 25 17:10:40 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:10:40 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv765 Modified Files: httplib.py Log Message: typo Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** httplib.py 16 Jul 2002 21:41:43 -0000 1.62 --- httplib.py 25 Jul 2002 16:10:38 -0000 1.63 *************** *** 204,208 **** # strict: If true, raise BadStatusLine if the status line can't be # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prvents clients from talking to HTTP/0.9 # servers. Note that a response with a sufficiently corrupted # status line will look like an HTTP/0.9 response. --- 204,208 ---- # strict: If true, raise BadStatusLine if the status line can't be # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is ! # false because it prevents clients from talking to HTTP/0.9 # servers. Note that a response with a sufficiently corrupted # status line will look like an HTTP/0.9 response. From fdrake@users.sourceforge.net Thu Jul 25 17:23:23 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:23:23 -0700 Subject: [Python-checkins] python/dist/src/Demo/embed Makefile,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/embed In directory usw-pr-cvs1:/tmp/cvs-serv5482 Modified Files: Makefile Log Message: - Make number in comment match the targets in that section of the Makefile. - Update the Python version number so we're using the library built from the current working sources. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/embed/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 17 Nov 2001 06:28:08 -0000 1.11 --- Makefile 25 Jul 2002 16:23:21 -0000 1.12 *************** *** 11,15 **** # Python version ! VERSION= 2.2 # Compiler flags --- 11,15 ---- # Python version ! VERSION= 2.3 # Compiler flags *************** *** 29,33 **** ALLLIBS= $(LIBPYTHON) $(MODLIBS) $(LIBS) $(SYSLIBS) ! # Build the demo application all: demo loop importexc demo: demo.o --- 29,33 ---- ALLLIBS= $(LIBPYTHON) $(MODLIBS) $(LIBS) $(SYSLIBS) ! # Build the demo applications all: demo loop importexc demo: demo.o From jhylton@users.sourceforge.net Thu Jul 25 17:06:17 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:06:17 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.161,2.162 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31608 Modified Files: typeobject.c Log Message: Complain if __len__() returns < 0, just like classic classes. Fixes SF bug #575773. Bug fix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.161 retrieving revision 2.162 diff -C2 -d -r2.161 -r2.162 *** typeobject.c 17 Jul 2002 16:30:38 -0000 2.161 --- typeobject.c 25 Jul 2002 16:06:15 -0000 2.162 *************** *** 2973,2976 **** --- 2973,2981 ---- len = (int)PyInt_AsLong(res); Py_DECREF(res); + if (len < 0) { + PyErr_SetString(PyExc_ValueError, + "__len__() should return >= 0"); + return -1; + } return len; } From jhylton@users.sourceforge.net Thu Jul 25 17:37:53 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:37:53 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.236,1.237 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10163 Modified Files: socketmodule.c Log Message: Put checks for error returns in the right place. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.236 retrieving revision 1.237 diff -C2 -d -r1.236 -r1.237 *** socketmodule.c 25 Jul 2002 16:01:12 -0000 1.236 --- socketmodule.c 25 Jul 2002 16:37:51 -0000 1.237 *************** *** 2476,2482 **** --- 2476,2486 ---- if (PyInt_Check(arg)) { x = PyInt_AS_LONG(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; } else if (PyLong_Check(arg)) { x = PyLong_AsUnsignedLong(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; #if SIZEOF_LONG > 4 { *************** *** 2531,2537 **** --- 2535,2545 ---- if (PyInt_Check(arg)) { x = PyInt_AS_LONG(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; } else if (PyLong_Check(arg)) { x = PyLong_AsUnsignedLong(arg); + if (x == (unsigned long) -1 && PyErr_Occurred()) + return NULL; #if SIZEOF_LONG > 4 { *************** *** 2550,2555 **** "expected int/long, %s found", arg->ob_type->tp_name); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; return PyInt_FromLong(htonl(x)); } --- 2558,2561 ---- From jhylton@users.sourceforge.net Thu Jul 25 17:43:32 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 25 Jul 2002 09:43:32 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.162,2.163 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12096 Modified Files: typeobject.c Log Message: Don't be so hasty. If PyInt_AsLong() raises an error, don't set ValueError. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.162 retrieving revision 2.163 diff -C2 -d -r2.162 -r2.163 *** typeobject.c 25 Jul 2002 16:06:15 -0000 2.162 --- typeobject.c 25 Jul 2002 16:43:29 -0000 2.163 *************** *** 2973,2976 **** --- 2973,2978 ---- len = (int)PyInt_AsLong(res); Py_DECREF(res); + if (len == -1 && PyErr_Occurred()) + return -1; if (len < 0) { PyErr_SetString(PyExc_ValueError, From fdrake@users.sourceforge.net Thu Jul 25 21:13:06 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 25 Jul 2002 13:13:06 -0700 Subject: [Python-checkins] python/dist/src/Lib site.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14682 Modified Files: site.py Log Message: Add an XXX comment and a pointer to a full bug report. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** site.py 1 Jun 2002 14:18:46 -0000 1.43 --- site.py 25 Jul 2002 20:13:03 -0000 1.44 *************** *** 93,96 **** --- 93,98 ---- # Append ./build/lib. in case we're running in the build dir # (especially for Guido :-) + # XXX This should not be part of site.py, since it is needed even when + # using the -S option for Python. See http://www.python.org/sf/586680 if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules": from distutils.util import get_platform From fdrake@users.sourceforge.net Thu Jul 25 21:40:31 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 25 Jul 2002 13:40:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_minidom.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23616 Modified Files: test_minidom.py Log Message: Remove duplicate checks of the Node.allnodes variable. Index: test_minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** test_minidom.py 23 Jul 2002 19:03:57 -0000 1.34 --- test_minidom.py 25 Jul 2002 20:40:28 -0000 1.35 *************** *** 354,358 **** confirm(string1.find("slash:abc") != -1) dom.unlink() - confirm(len(Node.allnodes) == 0) def testAttributeRepr(): --- 354,357 ---- *************** *** 362,366 **** confirm(str(node) == repr(node)) dom.unlink() - confirm(len(Node.allnodes) == 0) def testTextNodeRepr(): pass --- 361,364 ---- *************** *** 372,376 **** dom.unlink() confirm(str == domstr) - confirm(len(Node.allnodes) == 0) def testProcessingInstruction(): pass --- 370,373 ---- From fdrake@users.sourceforge.net Thu Jul 25 22:11:44 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 25 Jul 2002 14:11:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtraceback.tex,1.14,1.14.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv621/lib Modified Files: Tag: release22-maint libtraceback.tex Log Message: Small clarifications when referring to the sys.exc_* variables so that readers are not given the wrong impression that they should be using those on a regualar basis. This closes SF bug #585598. Index: libtraceback.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtraceback.tex,v retrieving revision 1.14 retrieving revision 1.14.22.1 diff -C2 -d -r1.14 -r1.14.22.1 *** libtraceback.tex 14 Feb 2001 03:20:18 -0000 1.14 --- libtraceback.tex 25 Jul 2002 21:11:41 -0000 1.14.22.1 *************** *** 9,17 **** stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful ! when you want to print stack traces under program control, e.g. in a ``wrapper'' around the interpreter. ! The module uses traceback objects --- this is the object type ! that is stored in the variables \code{sys.exc_traceback} and \code{sys.last_traceback} and returned as the third item from \function{sys.exc_info()}. --- 9,17 ---- stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful ! when you want to print stack traces under program control, such as in a ``wrapper'' around the interpreter. ! The module uses traceback objects --- this is the object type that is ! stored in the variables \code{sys.exc_traceback} (deprecated) and \code{sys.last_traceback} and returned as the third item from \function{sys.exc_info()}. *************** *** 36,55 **** header \samp{Traceback (most recent call last):}; (2) it prints the exception \var{type} and \var{value} after the stack trace; (3) if ! \var{type} is \exception{SyntaxError} and \var{value} has the appropriate ! format, it prints the line where the syntax error occurred with a ! caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} ! This is a shorthand for `\code{print_exception(sys.exc_type,} ! \code{sys.exc_value,} \code{sys.exc_traceback,} \var{limit}\code{,} ! \var{file}\code{)}'. (In fact, it uses \code{sys.exc_info()} to ! retrieve the same information in a thread-safe way.) \end{funcdesc} \begin{funcdesc}{print_last}{\optional{limit\optional{, file}}} ! This is a shorthand for `\code{print_exception(sys.last_type,} ! \code{sys.last_value,} \code{sys.last_traceback,} \var{limit}\code{,} ! \var{file}\code{)}'. \end{funcdesc} --- 36,55 ---- header \samp{Traceback (most recent call last):}; (2) it prints the exception \var{type} and \var{value} after the stack trace; (3) if ! \var{type} is \exception{SyntaxError} and \var{value} has the ! appropriate format, it prints the line where the syntax error occurred ! with a caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} ! This is a shorthand for \code{print_exception(sys.exc_type, ! sys.exc_value, sys.exc_traceback, \var{limit}, \var{file})}. (In ! fact, it uses \function{sys.exc_info()} to retrieve the same ! information in a thread-safe way instead of using the deprecated ! variables.) \end{funcdesc} \begin{funcdesc}{print_last}{\optional{limit\optional{, file}}} ! This is a shorthand for \code{print_exception(sys.last_type, ! sys.last_value, sys.last_traceback, \var{limit}, \var{file})}. \end{funcdesc} *************** *** 94,99 **** \code{sys.last_value}. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; ! however, for \code{SyntaxError} exceptions, it contains several lines ! that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. --- 94,99 ---- \code{sys.last_value}. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; ! however, for \exception{SyntaxError} exceptions, it contains several ! lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. From fdrake@users.sourceforge.net Thu Jul 25 22:11:26 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 25 Jul 2002 14:11:26 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtraceback.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv528/lib Modified Files: libtraceback.tex Log Message: Small clarifications when referring to the sys.exc_* variables so that readers are not given the wrong impression that they should be using those on a regualar basis. This closes SF bug #585598. Index: libtraceback.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtraceback.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libtraceback.tex 14 Feb 2001 03:20:18 -0000 1.14 --- libtraceback.tex 25 Jul 2002 21:11:23 -0000 1.15 *************** *** 9,17 **** stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful ! when you want to print stack traces under program control, e.g. in a ``wrapper'' around the interpreter. ! The module uses traceback objects --- this is the object type ! that is stored in the variables \code{sys.exc_traceback} and \code{sys.last_traceback} and returned as the third item from \function{sys.exc_info()}. --- 9,17 ---- stack traces of Python programs. It exactly mimics the behavior of the Python interpreter when it prints a stack trace. This is useful ! when you want to print stack traces under program control, such as in a ``wrapper'' around the interpreter. ! The module uses traceback objects --- this is the object type that is ! stored in the variables \code{sys.exc_traceback} (deprecated) and \code{sys.last_traceback} and returned as the third item from \function{sys.exc_info()}. *************** *** 36,55 **** header \samp{Traceback (most recent call last):}; (2) it prints the exception \var{type} and \var{value} after the stack trace; (3) if ! \var{type} is \exception{SyntaxError} and \var{value} has the appropriate ! format, it prints the line where the syntax error occurred with a ! caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} ! This is a shorthand for `\code{print_exception(sys.exc_type,} ! \code{sys.exc_value,} \code{sys.exc_traceback,} \var{limit}\code{,} ! \var{file}\code{)}'. (In fact, it uses \code{sys.exc_info()} to ! retrieve the same information in a thread-safe way.) \end{funcdesc} \begin{funcdesc}{print_last}{\optional{limit\optional{, file}}} ! This is a shorthand for `\code{print_exception(sys.last_type,} ! \code{sys.last_value,} \code{sys.last_traceback,} \var{limit}\code{,} ! \var{file}\code{)}'. \end{funcdesc} --- 36,55 ---- header \samp{Traceback (most recent call last):}; (2) it prints the exception \var{type} and \var{value} after the stack trace; (3) if ! \var{type} is \exception{SyntaxError} and \var{value} has the ! appropriate format, it prints the line where the syntax error occurred ! with a caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} ! This is a shorthand for \code{print_exception(sys.exc_type, ! sys.exc_value, sys.exc_traceback, \var{limit}, \var{file})}. (In ! fact, it uses \function{sys.exc_info()} to retrieve the same ! information in a thread-safe way instead of using the deprecated ! variables.) \end{funcdesc} \begin{funcdesc}{print_last}{\optional{limit\optional{, file}}} ! This is a shorthand for \code{print_exception(sys.last_type, ! sys.last_value, sys.last_traceback, \var{limit}, \var{file})}. \end{funcdesc} *************** *** 94,99 **** \code{sys.last_value}. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; ! however, for \code{SyntaxError} exceptions, it contains several lines ! that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. --- 94,99 ---- \code{sys.last_value}. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; ! however, for \exception{SyntaxError} exceptions, it contains several ! lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. From fdrake@users.sourceforge.net Fri Jul 26 16:42:01 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 26 Jul 2002 08:42:01 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.18.16.4,1.18.16.5 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv26262 Modified Files: Tag: release22-maint LICENSE Log Message: Better yet, make it the same as the equivalent changes already made to the version on the trunk. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.18.16.4 retrieving revision 1.18.16.5 diff -C2 -d -r1.18.16.4 -r1.18.16.5 *** LICENSE 26 Jul 2002 15:38:39 -0000 1.18.16.4 --- LICENSE 26 Jul 2002 15:41:59 -0000 1.18.16.5 *************** *** 14,23 **** In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations, now Zope ! Corporation (see http://www.zope.com/). In 2001, the Python Software Foundation (PSF, see http://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related ! Intellectual Property. Zope Corporation is a sponsoring member of the ! PSF. All Python releases are Open Source (see http://www.opensource.org for --- 14,23 ---- In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations (now Zope ! Corporation, see http://www.zope.com). In 2001, the Python Software Foundation (PSF, see http://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related ! Intellectual Property. Zope Corporation is a sponsoring member of ! the PSF. All Python releases are Open Source (see http://www.opensource.org for From fdrake@users.sourceforge.net Fri Jul 26 16:38:42 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 26 Jul 2002 08:38:42 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.18.16.3,1.18.16.4 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv24966 Modified Files: Tag: release22-maint LICENSE Log Message: Update references to Digital Creations. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.18.16.3 retrieving revision 1.18.16.4 diff -C2 -d -r1.18.16.3 -r1.18.16.4 *** LICENSE 8 Apr 2002 21:37:07 -0000 1.18.16.3 --- LICENSE 26 Jul 2002 15:38:39 -0000 1.18.16.4 *************** *** 14,22 **** In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations (see ! http://www.digicool.com). In 2001, the Python Software Foundation ! (PSF, see http://www.python.org/psf/) was formed, a non-profit ! organization created specifically to own Python-related Intellectual ! Property. Digital Creations is a sponsoring member of the PSF. All Python releases are Open Source (see http://www.opensource.org for --- 14,23 ---- In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same ! year, the PythonLabs team moved to Digital Creations, now Zope ! Corporation (see http://www.zope.com/). In 2001, the Python Software ! Foundation (PSF, see http://www.python.org/psf/) was formed, a ! non-profit organization created specifically to own Python-related ! Intellectual Property. Zope Corporation is a sponsoring member of the ! PSF. All Python releases are Open Source (see http://www.opensource.org for From jackjansen@users.sourceforge.net Fri Jul 26 12:34:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 26 Jul 2002 04:34:51 -0700 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13606 Modified Files: getopt.py Log Message: Use os.environ.get() in stead of os.getenv() (which is platform-dependent). Index: getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getopt.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** getopt.py 16 Jul 2002 21:35:23 -0000 1.21 --- getopt.py 26 Jul 2002 11:34:49 -0000 1.22 *************** *** 118,122 **** shortopts = shortopts[1:] all_options_first = True ! elif os.getenv("POSIXLY_CORRECT"): all_options_first = True else: --- 118,122 ---- shortopts = shortopts[1:] all_options_first = True ! elif os.environ.get("POSIXLY_CORRECT"): all_options_first = True else: From jackjansen@users.sourceforge.net Fri Jul 26 12:33:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 26 Jul 2002 04:33:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13357 Modified Files: test_atexit.py Log Message: Reorganized so the test is skipped if os.popen() doesn't exist (in stead of failing). Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_atexit.py 17 Jul 2002 00:34:26 -0000 1.6 --- test_atexit.py 26 Jul 2002 11:33:49 -0000 1.7 *************** *** 2,6 **** from test_support import TESTFN, vereq import atexit ! import os import sys --- 2,6 ---- from test_support import TESTFN, vereq import atexit ! from os import popen, unlink import sys *************** *** 24,28 **** f.close() ! p = os.popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() --- 24,28 ---- f.close() ! p = popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() *************** *** 52,56 **** f.close() ! p = os.popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() --- 52,56 ---- f.close() ! p = popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() *************** *** 60,62 **** """) ! os.unlink(fname) --- 60,62 ---- """) ! unlink(fname) From jackjansen@users.sourceforge.net Fri Jul 26 12:32:05 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 26 Jul 2002 04:32:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib ic.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13009 Modified Files: ic.py Log Message: Added a __contains__ method. Index: ic.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/ic.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ic.py 25 Aug 2001 12:05:18 -0000 1.5 --- ic.py 26 Jul 2002 11:32:03 -0000 1.6 *************** *** 177,180 **** --- 177,183 ---- def has_key(self, key): + return self.__contains__(key) + + def __contains__(self, key): try: dummy = self.ic.ICFindPrefHandle(key, self.h) From montanaro@users.sourceforge.net Fri Jul 26 17:22:48 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 26 Jul 2002 09:22:48 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.156,2.157 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8194 Modified Files: unicodeobject.c Log Message: tighten up the unicode object's docstring a tad Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.156 retrieving revision 2.157 diff -C2 -d -r2.156 -r2.157 *** unicodeobject.c 17 Jul 2002 16:30:38 -0000 2.156 --- unicodeobject.c 26 Jul 2002 16:22:46 -0000 2.157 *************** *** 5852,5857 **** \n\ Create a new Unicode object from the given encoded string.\n\ ! encoding defaults to the current default string encoding and \n\ ! errors, defining the error handling, to 'strict'."); PyTypeObject PyUnicode_Type = { --- 5852,5857 ---- \n\ Create a new Unicode object from the given encoded string.\n\ ! encoding defaults to the current default string encoding.\n\ ! errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'."); PyTypeObject PyUnicode_Type = { From guido@python.org Fri Jul 26 21:46:46 2002 From: guido@python.org (Guido van Rossum) Date: Fri, 26 Jul 2002 16:46:46 -0400 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.21,1.22 In-Reply-To: Your message of "Fri, 26 Jul 2002 04:34:51 PDT." References: Message-ID: <200207262046.g6QKkkj23905@pcp02138704pcs.reston01.va.comcast.net> > Use os.environ.get() in stead of os.getenv() (which is platform-dependent). Really? That wasn't intended! What are the differences? --Guido van Rossum (home page: http://www.python.org/~guido/) From pierslauder@users.sourceforge.net Sat Jul 27 01:38:32 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Fri, 26 Jul 2002 17:38:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7244/dist/src/Lib/test Modified Files: test_imaplib.py Log Message: remove o/s dependancy from test Index: test_imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imaplib.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_imaplib.py 17 Jun 2002 07:06:24 -0000 1.3 --- test_imaplib.py 27 Jul 2002 00:38:30 -0000 1.4 *************** *** 2,11 **** import time ! timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), ! '"18-May-2033 05:33:20 +0200"', '"18-May-2033 13:33:20 +1000"'] ! check = timevalues[2] for t in timevalues: ! if check <> imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t)): print 'incorrect result when converting', `t` --- 2,12 ---- import time ! # Can't use time.time() values, as they are O/S specific ! timevalues = [(2033, 5, 18, 3, 33, 20, 2, 138, 0), '"18-May-2033 13:33:20 +1000"'] for t in timevalues: ! t1 = imaplib.Time2Internaldate(t) ! t2 = imaplib.Time2Internaldate(imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t))) ! if t1 <> t2: print 'incorrect result when converting', `t` From pierslauder@users.sourceforge.net Sat Jul 27 01:38:32 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Fri, 26 Jul 2002 17:38:32 -0700 Subject: [Python-checkins] python/dist/src/Lib smtplib.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7244/dist/src/Lib Modified Files: smtplib.py Log Message: remove o/s dependancy from test Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** smtplib.py 3 Jun 2002 15:58:32 -0000 1.58 --- smtplib.py 27 Jul 2002 00:38:30 -0000 1.59 *************** *** 47,50 **** --- 47,51 ---- import base64 import hmac + from email.base64MIME import encode as encode_base64 __all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException", *************** *** 56,59 **** --- 57,62 ---- CRLF="\r\n" + OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I) + # Exception classes used by this module. class SMTPException(Exception): *************** *** 400,403 **** --- 403,419 ---- del resp[0] for each in resp: + # To be able to communicate with as many SMTP servers as possible, + # we have to take the old-style auth advertisement into account, + # because: + # 1) Else our SMTP feature parser gets confused. + # 2) There are some servers that only advertise the auth methods we + # support using the old style. + auth_match = OLDSTYLE_AUTH.match(each) + if auth_match: + # This doesn't remove duplicates, but that's no problem + self.esmtp_features["auth"] = self.esmtp_features.get("auth", "") \ + + " " + auth_match.groups(0)[0] + continue + # RFC 1869 requires a space between ehlo keyword and parameters. # It's actually stricter, in that only spaces are allowed between *************** *** 408,412 **** feature=m.group("feature").lower() params=m.string[m.end("feature"):].strip() ! self.esmtp_features[feature]=params return (code,msg) --- 424,432 ---- feature=m.group("feature").lower() params=m.string[m.end("feature"):].strip() ! if feature == "auth": ! self.esmtp_features[feature] = self.esmtp_features.get(feature, "") \ ! + " " + params ! else: ! self.esmtp_features[feature]=params return (code,msg) *************** *** 507,518 **** challenge = base64.decodestring(challenge) response = user + " " + hmac.HMAC(password, challenge).hexdigest() ! return base64.encodestring(response)[:-1] def encode_plain(user, password): ! return base64.encodestring("%s\0%s\0%s" % ! (user, user, password))[:-1] AUTH_PLAIN = "PLAIN" AUTH_CRAM_MD5 = "CRAM-MD5" if self.helo_resp is None and self.ehlo_resp is None: --- 527,539 ---- challenge = base64.decodestring(challenge) response = user + " " + hmac.HMAC(password, challenge).hexdigest() ! return encode_base64(response, eol="") def encode_plain(user, password): ! return encode_base64("%s\0%s\0%s" % (user, user, password), eol="") ! AUTH_PLAIN = "PLAIN" AUTH_CRAM_MD5 = "CRAM-MD5" + AUTH_LOGIN = "LOGIN" if self.helo_resp is None and self.ehlo_resp is None: *************** *** 531,536 **** # less preferred methods. Except for the purpose of testing the weaker # ones, we prefer stronger methods like CRAM-MD5: ! preferred_auths = [AUTH_CRAM_MD5, AUTH_PLAIN] ! #preferred_auths = [AUTH_PLAIN, AUTH_CRAM_MD5] # Determine the authentication method we'll use --- 552,556 ---- # less preferred methods. Except for the purpose of testing the weaker # ones, we prefer stronger methods like CRAM-MD5: ! preferred_auths = [AUTH_CRAM_MD5, AUTH_PLAIN, AUTH_LOGIN] # Determine the authentication method we'll use *************** *** 540,544 **** authmethod = method break - if self.debuglevel > 0: print "AuthMethod:", authmethod if authmethod == AUTH_CRAM_MD5: --- 560,563 ---- *************** *** 551,554 **** --- 570,579 ---- (code, resp) = self.docmd("AUTH", AUTH_PLAIN + " " + encode_plain(user, password)) + elif authmethod == AUTH_LOGIN: + (code, resp) = self.docmd("AUTH", + "%s %s" % (AUTH_LOGIN, encode_base64(user, eol=""))) + if code != 334: + raise SMTPAuthenticationError(code, resp) + (code, resp) = self.docmd(encode_base64(user, eol="")) elif authmethod is None: raise SMTPException("No suitable authentication method found.") From pierslauder@users.sourceforge.net Sat Jul 27 08:08:41 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Sat, 27 Jul 2002 00:08:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10795/dist/src/Lib/test Modified Files: test_imaplib.py Log Message: remove redundant code Index: test_imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imaplib.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_imaplib.py 27 Jul 2002 00:38:30 -0000 1.4 --- test_imaplib.py 27 Jul 2002 07:08:38 -0000 1.5 *************** *** 8,12 **** for t in timevalues: t1 = imaplib.Time2Internaldate(t) ! t2 = imaplib.Time2Internaldate(imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t))) if t1 <> t2: print 'incorrect result when converting', `t` --- 8,12 ---- for t in timevalues: t1 = imaplib.Time2Internaldate(t) ! t2 = imaplib.Time2Internaldate(imaplib.Internaldate2tuple('INTERNALDATE ' + t1)) if t1 <> t2: print 'incorrect result when converting', `t` From pierslauder@users.sourceforge.net Sat Jul 27 08:10:16 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Sat, 27 Jul 2002 00:10:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11329/dist/src/Lib/test Modified Files: test_imaplib.py Log Message: remove redundant import Index: test_imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imaplib.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_imaplib.py 27 Jul 2002 07:08:38 -0000 1.5 --- test_imaplib.py 27 Jul 2002 07:10:14 -0000 1.6 *************** *** 1,4 **** import imaplib - import time # Can't use time.time() values, as they are O/S specific --- 1,3 ---- From loewis@users.sourceforge.net Sun Jul 28 10:42:59 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 02:42:59 -0700 Subject: [Python-checkins] python/dist/src/Lib pty.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15076 Modified Files: pty.py Log Message: Patch #581705: Catch OSError, termios.error in spawn. 2.2 bugfix candidate. Index: pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pty.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pty.py 29 May 2001 06:06:54 -0000 1.11 --- pty.py 28 Jul 2002 09:42:57 -0000 1.12 *************** *** 155,162 **** if pid == CHILD: apply(os.execlp, (argv[0],) + argv) ! mode = tty.tcgetattr(STDIN_FILENO) ! tty.setraw(STDIN_FILENO) try: _copy(master_fd, master_read, stdin_read) ! except IOError: ! tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) --- 155,167 ---- if pid == CHILD: apply(os.execlp, (argv[0],) + argv) ! try: ! mode = tty.tcgetattr(STDIN_FILENO) ! tty.setraw(STDIN_FILENO) ! restore = 1 ! except tty.error: # This is the same as termios.error ! restore = 0 try: _copy(master_fd, master_read, stdin_read) ! except (IOError, OSError): ! if restore: ! tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) From loewis@users.sourceforge.net Sun Jul 28 10:57:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 02:57:47 -0700 Subject: [Python-checkins] python/dist/src/Modules _ssl.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17327 Modified Files: _ssl.c Log Message: Patch #575827: allow threads inside SSL creation. Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _ssl.c 17 Jul 2002 16:30:35 -0000 1.6 --- _ssl.c 28 Jul 2002 09:57:45 -0000 1.7 *************** *** 187,191 **** --- 187,193 ---- } + Py_BEGIN_ALLOW_THREADS self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ + Py_END_ALLOW_THREADS if (self->ctx == NULL) { errstr = "SSL_CTX_new error"; *************** *** 194,205 **** if (key_file) { ! if (SSL_CTX_use_PrivateKey_file(self->ctx, key_file, ! SSL_FILETYPE_PEM) < 1) { errstr = "SSL_CTX_use_PrivateKey_file error"; goto fail; } ! if (SSL_CTX_use_certificate_chain_file(self->ctx, ! cert_file) < 1) { errstr = "SSL_CTX_use_certificate_chain_file error"; goto fail; --- 196,213 ---- if (key_file) { ! Py_BEGIN_ALLOW_THREADS ! ret = SSL_CTX_use_PrivateKey_file(self->ctx, key_file, ! SSL_FILETYPE_PEM); ! Py_END_ALLOW_THREADS ! if (ret < 1) { errstr = "SSL_CTX_use_PrivateKey_file error"; goto fail; } ! Py_BEGIN_ALLOW_THREADS ! ret = SSL_CTX_use_certificate_chain_file(self->ctx, ! cert_file); ! Py_END_ALLOW_THREADS ! if (ret < 1) { errstr = "SSL_CTX_use_certificate_chain_file error"; goto fail; *************** *** 207,219 **** --- 215,232 ---- } + Py_BEGIN_ALLOW_THREADS SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL); /* set verify lvl */ self->ssl = SSL_new(self->ctx); /* New ssl struct */ + Py_END_ALLOW_THREADS SSL_set_fd(self->ssl, Sock->sock_fd); /* Set the socket for SSL */ + Py_BEGIN_ALLOW_THREADS SSL_set_connect_state(self->ssl); + /* Actually negotiate SSL connection */ /* XXX If SSL_connect() returns 0, it's also a failure. */ ret = SSL_connect(self->ssl); + Py_END_ALLOW_THREADS if (ret <= 0) { PySSL_SetError(self, ret); *************** *** 222,225 **** --- 235,239 ---- self->ssl->debug = 1; + Py_BEGIN_ALLOW_THREADS if ((self->server_cert = SSL_get_peer_certificate(self->ssl))) { X509_NAME_oneline(X509_get_subject_name(self->server_cert), *************** *** 228,231 **** --- 242,246 ---- self->issuer, X509_NAME_MAXLEN); } + Py_END_ALLOW_THREADS self->Socket = Sock; Py_INCREF(self->Socket); From loewis@users.sourceforge.net Sun Jul 28 11:21:33 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:21:33 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.93.6.4,2.93.6.5 stringobject.c,2.147.6.5,2.147.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20756/Objects Modified Files: Tag: release22-maint abstract.c stringobject.c Log Message: Patch #554716: Use __va_copy where available. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.93.6.4 retrieving revision 2.93.6.5 diff -C2 -d -r2.93.6.4 -r2.93.6.5 *** abstract.c 18 Apr 2002 04:40:05 -0000 2.93.6.4 --- abstract.c 28 Jul 2002 10:21:30 -0000 2.93.6.5 *************** *** 1794,1798 **** --- 1794,1802 ---- memcpy(countva, va, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(countva, va); + #else countva = va; + #endif #endif Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.5 retrieving revision 2.147.6.6 diff -C2 -d -r2.147.6.5 -r2.147.6.6 *** stringobject.c 13 May 2002 09:11:44 -0000 2.147.6.5 --- stringobject.c 28 Jul 2002 10:21:31 -0000 2.147.6.6 *************** *** 175,179 **** --- 175,183 ---- memcpy(count, vargs, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(count, vargs); + #else count = vargs; + #endif #endif /* step 1: figure out how large a buffer we need */ From loewis@users.sourceforge.net Sun Jul 28 11:21:33 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:21:33 -0700 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.90,2.90.6.1 modsupport.c,2.58.16.1,2.58.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv20756/Python Modified Files: Tag: release22-maint getargs.c modsupport.c Log Message: Patch #554716: Use __va_copy where available. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.90 retrieving revision 2.90.6.1 diff -C2 -d -r2.90 -r2.90.6.1 *** getargs.c 3 Dec 2001 00:43:33 -0000 2.90 --- getargs.c 28 Jul 2002 10:21:31 -0000 2.90.6.1 *************** *** 62,66 **** --- 62,70 ---- memcpy(lva, va, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(lva, va); + #else lva = va; + #endif #endif Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.58.16.1 retrieving revision 2.58.16.2 diff -C2 -d -r2.58.16.1 -r2.58.16.2 *** modsupport.c 17 Jun 2002 17:16:34 -0000 2.58.16.1 --- modsupport.c 28 Jul 2002 10:21:31 -0000 2.58.16.2 *************** *** 412,416 **** --- 412,420 ---- memcpy(lva, va, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(lva, va); + #else lva = va; + #endif #endif From loewis@users.sourceforge.net Sun Jul 28 11:23:29 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:23:29 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.103,2.104 stringobject.c,2.170,2.171 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20999/Objects Modified Files: abstract.c stringobject.c Log Message: Patch #554716: Use __va_copy where available. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.103 retrieving revision 2.104 diff -C2 -d -r2.103 -r2.104 *** abstract.c 6 Jun 2002 15:45:38 -0000 2.103 --- abstract.c 28 Jul 2002 10:23:27 -0000 2.104 *************** *** 1794,1798 **** --- 1794,1802 ---- memcpy(countva, va, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(countva, va); + #else countva = va; + #endif #endif Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.170 retrieving revision 2.171 diff -C2 -d -r2.170 -r2.171 *** stringobject.c 17 Jul 2002 16:30:38 -0000 2.170 --- stringobject.c 28 Jul 2002 10:23:27 -0000 2.171 *************** *** 157,161 **** --- 157,165 ---- memcpy(count, vargs, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(count, vargs); + #else count = vargs; + #endif #endif /* step 1: figure out how large a buffer we need */ From loewis@users.sourceforge.net Sun Jul 28 11:23:29 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:23:29 -0700 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.92,2.93 modsupport.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv20999/Python Modified Files: getargs.c modsupport.c Log Message: Patch #554716: Use __va_copy where available. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -d -r2.92 -r2.93 *** getargs.c 4 Apr 2002 16:22:30 -0000 2.92 --- getargs.c 28 Jul 2002 10:23:27 -0000 2.93 *************** *** 62,66 **** --- 62,70 ---- memcpy(lva, va, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(lva, va); + #else lva = va; + #endif #endif Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** modsupport.c 17 Jun 2002 17:16:57 -0000 2.60 --- modsupport.c 28 Jul 2002 10:23:27 -0000 2.61 *************** *** 419,423 **** --- 419,427 ---- memcpy(lva, va, sizeof(va_list)); #else + #ifdef __va_copy + __va_copy(lva, va); + #else lva = va; + #endif #endif From loewis@users.sourceforge.net Sun Jul 28 11:34:10 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:34:10 -0700 Subject: [Python-checkins] python/dist/src/Misc python.man,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22720/Misc Modified Files: python.man Log Message: Patch #552812: Better description in "python -h" for -u. Index: python.man =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python.man,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** python.man 9 May 2002 14:33:18 -0000 1.24 --- python.man 28 Jul 2002 10:34:08 -0000 1.25 *************** *** 139,143 **** .TP .B \-u ! Force stdin, stdout and stderr to be totally unbuffered. .TP .B \-v --- 139,147 ---- .TP .B \-u ! Force stdin, stdout and stderr to be totally unbuffered. Note that ! there is internal buffering in xreadlines(), readlines() and file-object ! iterators ("for line in sys.stdin") which is not influenced by this ! option. To work around this, you will want to use "sys.stdin.readline()" ! inside a "while 1:" loop. .TP .B \-v From loewis@users.sourceforge.net Sun Jul 28 11:34:10 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:34:10 -0700 Subject: [Python-checkins] python/dist/src/Modules main.c,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22720/Modules Modified Files: main.c Log Message: Patch #552812: Better description in "python -h" for -u. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** main.c 3 Mar 2002 02:59:16 -0000 1.64 --- main.c 28 Jul 2002 10:34:08 -0000 1.65 *************** *** 63,66 **** --- 63,67 ---- -t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\ + see man page for details on internal buffering relating to "-u"\n\ "; static char *usage_3 = "\ From loewis@users.sourceforge.net Sun Jul 28 11:49:40 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 03:49:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_rpm.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv25601/Lib/distutils/command Modified Files: bdist_rpm.py Log Message: Patch #543498: Use License: field instead of Copyright:. Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** bdist_rpm.py 4 Jun 2002 20:14:43 -0000 1.29 --- bdist_rpm.py 28 Jul 2002 10:49:37 -0000 1.30 *************** *** 349,353 **** spec_file.extend([ ! 'Copyright: ' + self.distribution.get_license(), 'Group: ' + self.group, 'BuildRoot: %{_tmppath}/%{name}-buildroot', --- 349,353 ---- spec_file.extend([ ! 'License: ' + self.distribution.get_license(), 'Group: ' + self.group, 'BuildRoot: %{_tmppath}/%{name}-buildroot', From loewis@users.sourceforge.net Sun Jul 28 12:31:36 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 04:31:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv32292/Lib/encodings Modified Files: __init__.py Log Message: Patch #571603: Refer to encodings package explicitly. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 11 Feb 2002 17:43:46 -0000 1.8 --- __init__.py 28 Jul 2002 11:31:33 -0000 1.9 *************** *** 60,64 **** modname = aliases.aliases.get(modname, modname) try: ! mod = __import__(modname, globals(), locals(), _import_tail) except ImportError,why: mod = None --- 60,64 ---- modname = aliases.aliases.get(modname, modname) try: ! mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) except ImportError,why: mod = None From loewis@users.sourceforge.net Sun Jul 28 12:33:20 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 04:33:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.6,1.6.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv32638/Lib/encodings Modified Files: Tag: release22-maint __init__.py Log Message: Patch #571603: Refer to encodings package explicitly. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.6 retrieving revision 1.6.12.1 diff -C2 -d -r1.6 -r1.6.12.1 *** __init__.py 19 Sep 2001 11:52:07 -0000 1.6 --- __init__.py 28 Jul 2002 11:33:18 -0000 1.6.12.1 *************** *** 49,53 **** modname = aliases.aliases.get(modname,modname) try: ! mod = __import__(modname,globals(),locals(),'*') except ImportError,why: # cache misses --- 49,53 ---- modname = aliases.aliases.get(modname,modname) try: ! mod = __import__('encodings.'+modname,globals(),locals(),'*') except ImportError,why: # cache misses From nnorwitz@users.sourceforge.net Sun Jul 28 14:53:07 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 06:53:07 -0700 Subject: [Python-checkins] python/dist/src/Modules main.c,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2045/Modules Modified Files: main.c Log Message: Fix last checkin, can't use " inside a string Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** main.c 28 Jul 2002 10:34:08 -0000 1.65 --- main.c 28 Jul 2002 13:53:05 -0000 1.66 *************** *** 63,67 **** -t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\ ! see man page for details on internal buffering relating to "-u"\n\ "; static char *usage_3 = "\ --- 63,67 ---- -t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\ ! see man page for details on internal buffering relating to '-u'\n\ "; static char *usage_3 = "\ From nnorwitz@users.sourceforge.net Sun Jul 28 14:55:22 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 06:55:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv2435/Doc/api Modified Files: abstract.tex Log Message: Fix SF bug 587012, doc mentions inexistent builtin unistr Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** abstract.tex 14 Jun 2002 14:35:56 -0000 1.17 --- abstract.tex 28 Jul 2002 13:55:20 -0000 1.18 *************** *** 167,172 **** the Unicode string representation on success, \NULL{} on failure. This is the equivalent of the Python expression ! \samp{unistr(\var{o})}. Called by the ! \function{unistr()}\bifuncindex{unistr} built-in function. \end{cfuncdesc} --- 167,172 ---- the Unicode string representation on success, \NULL{} on failure. This is the equivalent of the Python expression ! \samp{unicode(\var{o})}. Called by the ! \function{unicode()}\bifuncindex{unicode} built-in function. \end{cfuncdesc} From nnorwitz@users.sourceforge.net Sun Jul 28 14:56:22 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 06:56:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.8.6.5,1.8.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv2693/Doc/api Modified Files: Tag: release22-maint abstract.tex Log Message: Fix SF bug 587012, doc mentions inexistent builtin unistr Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.8.6.5 retrieving revision 1.8.6.6 diff -C2 -d -r1.8.6.5 -r1.8.6.6 *** abstract.tex 14 Jun 2002 14:36:23 -0000 1.8.6.5 --- abstract.tex 28 Jul 2002 13:56:20 -0000 1.8.6.6 *************** *** 167,172 **** the Unicode string representation on success, \NULL{} on failure. This is the equivalent of the Python expression ! \samp{unistr(\var{o})}. Called by the ! \function{unistr()}\bifuncindex{unistr} built-in function. \end{cfuncdesc} --- 167,172 ---- the Unicode string representation on success, \NULL{} on failure. This is the equivalent of the Python expression ! \samp{unicode(\var{o})}. Called by the ! \function{unicode()}\bifuncindex{unicode} built-in function. \end{cfuncdesc} From nnorwitz@users.sourceforge.net Sun Jul 28 16:12:13 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 08:12:13 -0700 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.67,2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20169/Modules Modified Files: selectmodule.c Log Message: SF patch #577031, remove PyArg_Parse() since it's deprecated Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** selectmodule.c 23 Jul 2002 06:31:13 -0000 2.67 --- selectmodule.c 28 Jul 2002 15:12:10 -0000 2.68 *************** *** 209,213 **** if (tout == Py_None) tvp = (struct timeval *)0; ! else if (!PyArg_Parse(tout, "d", &timeout)) { PyErr_SetString(PyExc_TypeError, "timeout must be a float or None"); --- 209,213 ---- if (tout == Py_None) tvp = (struct timeval *)0; ! else if (!PyNumber_Check(tout)) { PyErr_SetString(PyExc_TypeError, "timeout must be a float or None"); *************** *** 215,218 **** --- 215,223 ---- } else { + tout = PyNumber_Float(tout); + if (!tout) + return NULL; + timeout = PyFloat_AS_DOUBLE(tout); + Py_DECREF(tout); if (timeout > (double)LONG_MAX) { PyErr_SetString(PyExc_OverflowError, *************** *** 451,458 **** if (tout == NULL || tout == Py_None) timeout = -1; ! else if (!PyArg_Parse(tout, "i", &timeout)) { PyErr_SetString(PyExc_TypeError, "timeout must be an integer or None"); return NULL; } --- 456,470 ---- if (tout == NULL || tout == Py_None) timeout = -1; ! else if (!PyNumber_Check(tout)) { PyErr_SetString(PyExc_TypeError, "timeout must be an integer or None"); return NULL; + } + else { + tout = PyNumber_Int(tout); + if (!tout) + return NULL; + timeout = PyInt_AS_LONG(tout); + Py_DECREF(tout); } From nnorwitz@users.sourceforge.net Sun Jul 28 16:19:49 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 08:19:49 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.171,2.172 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21685/Objects Modified Files: stringobject.c Log Message: SF patch #577031, remove PyArg_Parse() since it's deprecated Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.171 retrieving revision 2.172 diff -C2 -d -r2.171 -r2.172 *** stringobject.c 28 Jul 2002 10:23:27 -0000 2.171 --- stringobject.c 28 Jul 2002 15:19:47 -0000 2.172 *************** *** 3121,3126 **** char fmt[20]; double x; ! if (!PyArg_Parse(v, "d;float argument required", &x)) return -1; if (prec < 0) prec = 6; --- 3121,3129 ---- char fmt[20]; double x; ! v = PyNumber_Float(v); ! if (!v) return -1; + x = PyFloat_AS_DOUBLE(v); + Py_DECREF(v); if (prec < 0) prec = 6; *************** *** 3297,3302 **** long x; ! if (!PyArg_Parse(v, "l;int argument required", &x)) return -1; if (prec < 0) prec = 1; --- 3300,3308 ---- long x; ! v = PyNumber_Int(v); ! if (!v) return -1; + x = PyInt_AS_LONG(v); + Py_DECREF(v); if (prec < 0) prec = 1; From nnorwitz@users.sourceforge.net Sun Jul 28 16:23:26 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 08:23:26 -0700 Subject: [Python-checkins] python/dist/src/Modules glmodule.c,2.9,2.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22262/Modules Modified Files: glmodule.c Log Message: SF patch #577031, remove PyArg_NoArgs() since it's deprecated Explicitly use METH_OLDARGS Index: glmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/glmodule.c,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** glmodule.c 1 Sep 2000 23:29:26 -0000 2.9 --- glmodule.c 28 Jul 2002 15:23:23 -0000 2.10 *************** *** 442,451 **** static PyObject * ! endpick_select(PyObject *args, long (*func)()) { PyObject *v, *w; int i, nhits, n; - if (!PyArg_NoArgs(args)) - return NULL; if (pickbuffer == NULL) { PyErr_SetString(PyExc_RuntimeError, --- 442,449 ---- static PyObject * ! endpick_select(long (*func)()) { PyObject *v, *w; int i, nhits, n; if (pickbuffer == NULL) { PyErr_SetString(PyExc_RuntimeError, *************** *** 488,494 **** } ! static PyObject *gl_endpick(PyObject *self, PyObject *args) { ! return endpick_select(args, endpick); } --- 486,492 ---- } ! static PyObject *gl_endpick(PyObject *self) { ! return endpick_select(endpick); } *************** *** 498,504 **** } ! static PyObject *gl_endselect(PyObject *self, PyObject *args) { ! return endpick_select(args, endselect); } --- 496,502 ---- } ! static PyObject *gl_endselect(PyObject *self) { ! return endpick_select(endselect); } *************** *** 7189,7624 **** static struct PyMethodDef gl_methods[] = { ! {"qread", gl_qread}, ! {"varray", gl_varray}, ! {"nvarray", gl_nvarray}, ! {"vnarray", gl_vnarray}, ! {"nurbssurface", gl_nurbssurface}, ! {"nurbscurve", gl_nurbscurve}, ! {"pwlcurve", gl_pwlcurve}, ! {"pick", gl_pick}, ! {"endpick", gl_endpick}, ! {"gselect", gl_gselect}, ! {"endselect", gl_endselect}, ! {"getmatrix", gl_getmatrix}, ! {"altgetmatrix", gl_altgetmatrix}, ! {"lrectwrite", gl_lrectwrite}, ! {"lrectread", gl_lrectread}, ! {"readdisplay", gl_readdisplay}, ! {"packrect", gl_packrect}, ! {"unpackrect", gl_unpackrect}, ! {"gversion", gl_gversion}, ! {"clear", gl_clear}, ! {"getshade", gl_getshade}, ! {"devport", gl_devport}, ! {"rdr2i", gl_rdr2i}, ! {"rectfs", gl_rectfs}, ! {"rects", gl_rects}, ! {"rmv2i", gl_rmv2i}, ! {"noport", gl_noport}, ! {"popviewport", gl_popviewport}, ! {"clearhitcode", gl_clearhitcode}, ! {"closeobj", gl_closeobj}, ! {"cursoff", gl_cursoff}, ! {"curson", gl_curson}, ! {"doublebuffer", gl_doublebuffer}, ! {"finish", gl_finish}, ! {"gconfig", gl_gconfig}, ! {"ginit", gl_ginit}, ! {"greset", gl_greset}, ! {"multimap", gl_multimap}, ! {"onemap", gl_onemap}, ! {"popattributes", gl_popattributes}, ! {"popmatrix", gl_popmatrix}, ! {"pushattributes", gl_pushattributes}, ! {"pushmatrix", gl_pushmatrix}, ! {"pushviewport", gl_pushviewport}, ! {"qreset", gl_qreset}, ! {"RGBmode", gl_RGBmode}, ! {"singlebuffer", gl_singlebuffer}, ! {"swapbuffers", gl_swapbuffers}, ! {"gsync", gl_gsync}, ! {"gflush", gl_gflush}, ! {"tpon", gl_tpon}, ! {"tpoff", gl_tpoff}, ! {"clkon", gl_clkon}, ! {"clkoff", gl_clkoff}, ! {"ringbell", gl_ringbell}, ! {"gbegin", gl_gbegin}, ! {"textinit", gl_textinit}, ! {"initnames", gl_initnames}, ! {"pclos", gl_pclos}, ! {"popname", gl_popname}, ! {"spclos", gl_spclos}, ! {"zclear", gl_zclear}, ! {"screenspace", gl_screenspace}, ! {"reshapeviewport", gl_reshapeviewport}, ! {"winpush", gl_winpush}, ! {"winpop", gl_winpop}, ! {"foreground", gl_foreground}, ! {"endfullscrn", gl_endfullscrn}, ! {"endpupmode", gl_endpupmode}, ! {"fullscrn", gl_fullscrn}, ! {"pupmode", gl_pupmode}, ! {"winconstraints", gl_winconstraints}, ! {"pagecolor", gl_pagecolor}, ! {"textcolor", gl_textcolor}, ! {"color", gl_color}, ! {"curveit", gl_curveit}, ! {"font", gl_font}, ! {"linewidth", gl_linewidth}, ! {"setlinestyle", gl_setlinestyle}, ! {"setmap", gl_setmap}, ! {"swapinterval", gl_swapinterval}, ! {"writemask", gl_writemask}, ! {"textwritemask", gl_textwritemask}, ! {"qdevice", gl_qdevice}, ! {"unqdevice", gl_unqdevice}, ! {"curvebasis", gl_curvebasis}, ! {"curveprecision", gl_curveprecision}, ! {"loadname", gl_loadname}, ! {"passthrough", gl_passthrough}, ! {"pushname", gl_pushname}, ! {"setmonitor", gl_setmonitor}, ! {"setshade", gl_setshade}, ! {"setpattern", gl_setpattern}, ! {"pagewritemask", gl_pagewritemask}, ! {"callobj", gl_callobj}, ! {"delobj", gl_delobj}, ! {"editobj", gl_editobj}, ! {"makeobj", gl_makeobj}, ! {"maketag", gl_maketag}, ! {"chunksize", gl_chunksize}, ! {"compactify", gl_compactify}, ! {"deltag", gl_deltag}, ! {"lsrepeat", gl_lsrepeat}, ! {"objinsert", gl_objinsert}, ! {"objreplace", gl_objreplace}, ! {"winclose", gl_winclose}, ! {"blanktime", gl_blanktime}, ! {"freepup", gl_freepup}, ! {"backbuffer", gl_backbuffer}, ! {"frontbuffer", gl_frontbuffer}, ! {"lsbackup", gl_lsbackup}, ! {"resetls", gl_resetls}, ! {"lampon", gl_lampon}, ! {"lampoff", gl_lampoff}, ! {"setbell", gl_setbell}, ! {"blankscreen", gl_blankscreen}, ! {"depthcue", gl_depthcue}, ! {"zbuffer", gl_zbuffer}, ! {"backface", gl_backface}, ! {"cmov2i", gl_cmov2i}, ! {"draw2i", gl_draw2i}, ! {"move2i", gl_move2i}, ! {"pnt2i", gl_pnt2i}, ! {"patchbasis", gl_patchbasis}, ! {"patchprecision", gl_patchprecision}, ! {"pdr2i", gl_pdr2i}, ! {"pmv2i", gl_pmv2i}, ! {"rpdr2i", gl_rpdr2i}, ! {"rpmv2i", gl_rpmv2i}, ! {"xfpt2i", gl_xfpt2i}, ! {"objdelete", gl_objdelete}, ! {"patchcurves", gl_patchcurves}, ! {"minsize", gl_minsize}, ! {"maxsize", gl_maxsize}, ! {"keepaspect", gl_keepaspect}, ! {"prefsize", gl_prefsize}, ! {"stepunit", gl_stepunit}, ! {"fudge", gl_fudge}, ! {"winmove", gl_winmove}, ! {"attachcursor", gl_attachcursor}, ! {"deflinestyle", gl_deflinestyle}, ! {"noise", gl_noise}, ! {"picksize", gl_picksize}, ! {"qenter", gl_qenter}, ! {"setdepth", gl_setdepth}, ! {"cmov2s", gl_cmov2s}, ! {"draw2s", gl_draw2s}, ! {"move2s", gl_move2s}, ! {"pdr2s", gl_pdr2s}, ! {"pmv2s", gl_pmv2s}, ! {"pnt2s", gl_pnt2s}, ! {"rdr2s", gl_rdr2s}, ! {"rmv2s", gl_rmv2s}, ! {"rpdr2s", gl_rpdr2s}, ! {"rpmv2s", gl_rpmv2s}, ! {"xfpt2s", gl_xfpt2s}, ! {"cmov2", gl_cmov2}, ! {"draw2", gl_draw2}, ! {"move2", gl_move2}, ! {"pnt2", gl_pnt2}, ! {"pdr2", gl_pdr2}, ! {"pmv2", gl_pmv2}, ! {"rdr2", gl_rdr2}, ! {"rmv2", gl_rmv2}, ! {"rpdr2", gl_rpdr2}, ! {"rpmv2", gl_rpmv2}, ! {"xfpt2", gl_xfpt2}, ! {"loadmatrix", gl_loadmatrix}, ! {"multmatrix", gl_multmatrix}, ! {"crv", gl_crv}, ! {"rcrv", gl_rcrv}, ! {"addtopup", gl_addtopup}, ! {"charstr", gl_charstr}, ! {"getport", gl_getport}, ! {"strwidth", gl_strwidth}, ! {"winopen", gl_winopen}, ! {"wintitle", gl_wintitle}, ! {"polf", gl_polf}, ! {"polf2", gl_polf2}, ! {"poly", gl_poly}, ! {"poly2", gl_poly2}, ! {"crvn", gl_crvn}, ! {"rcrvn", gl_rcrvn}, ! {"polf2i", gl_polf2i}, ! {"polfi", gl_polfi}, ! {"poly2i", gl_poly2i}, ! {"polyi", gl_polyi}, ! {"polf2s", gl_polf2s}, ! {"polfs", gl_polfs}, ! {"polys", gl_polys}, ! {"poly2s", gl_poly2s}, ! {"defcursor", gl_defcursor}, ! {"writepixels", gl_writepixels}, ! {"defbasis", gl_defbasis}, ! {"gewrite", gl_gewrite}, ! {"rotate", gl_rotate}, ! {"rot", gl_rot}, ! {"circfi", gl_circfi}, ! {"circi", gl_circi}, ! {"cmovi", gl_cmovi}, ! {"drawi", gl_drawi}, ! {"movei", gl_movei}, ! {"pnti", gl_pnti}, ! {"newtag", gl_newtag}, ! {"pdri", gl_pdri}, ! {"pmvi", gl_pmvi}, ! {"rdri", gl_rdri}, ! {"rmvi", gl_rmvi}, ! {"rpdri", gl_rpdri}, ! {"rpmvi", gl_rpmvi}, ! {"xfpti", gl_xfpti}, ! {"circ", gl_circ}, ! {"circf", gl_circf}, ! {"cmov", gl_cmov}, ! {"draw", gl_draw}, ! {"move", gl_move}, ! {"pnt", gl_pnt}, ! {"scale", gl_scale}, ! {"translate", gl_translate}, ! {"pdr", gl_pdr}, ! {"pmv", gl_pmv}, ! {"rdr", gl_rdr}, ! {"rmv", gl_rmv}, ! {"rpdr", gl_rpdr}, ! {"rpmv", gl_rpmv}, ! {"xfpt", gl_xfpt}, ! {"RGBcolor", gl_RGBcolor}, ! {"RGBwritemask", gl_RGBwritemask}, ! {"setcursor", gl_setcursor}, ! {"tie", gl_tie}, ! {"circfs", gl_circfs}, ! {"circs", gl_circs}, ! {"cmovs", gl_cmovs}, ! {"draws", gl_draws}, ! {"moves", gl_moves}, ! {"pdrs", gl_pdrs}, ! {"pmvs", gl_pmvs}, ! {"pnts", gl_pnts}, ! {"rdrs", gl_rdrs}, ! {"rmvs", gl_rmvs}, ! {"rpdrs", gl_rpdrs}, ! {"rpmvs", gl_rpmvs}, ! {"xfpts", gl_xfpts}, ! {"curorigin", gl_curorigin}, ! {"cyclemap", gl_cyclemap}, ! {"patch", gl_patch}, ! {"splf", gl_splf}, ! {"splf2", gl_splf2}, ! {"splfi", gl_splfi}, ! {"splf2i", gl_splf2i}, ! {"splfs", gl_splfs}, ! {"splf2s", gl_splf2s}, ! {"rpatch", gl_rpatch}, ! {"ortho2", gl_ortho2}, ! {"rect", gl_rect}, ! {"rectf", gl_rectf}, ! {"xfpt4", gl_xfpt4}, ! {"textport", gl_textport}, ! {"mapcolor", gl_mapcolor}, ! {"scrmask", gl_scrmask}, ! {"setvaluator", gl_setvaluator}, ! {"viewport", gl_viewport}, ! {"shaderange", gl_shaderange}, ! {"xfpt4s", gl_xfpt4s}, ! {"rectfi", gl_rectfi}, ! {"recti", gl_recti}, ! {"xfpt4i", gl_xfpt4i}, ! {"prefposition", gl_prefposition}, ! {"arc", gl_arc}, ! {"arcf", gl_arcf}, ! {"arcfi", gl_arcfi}, ! {"arci", gl_arci}, ! {"bbox2", gl_bbox2}, ! {"bbox2i", gl_bbox2i}, ! {"bbox2s", gl_bbox2s}, ! {"blink", gl_blink}, ! {"ortho", gl_ortho}, ! {"window", gl_window}, ! {"lookat", gl_lookat}, ! {"perspective", gl_perspective}, ! {"polarview", gl_polarview}, ! {"arcfs", gl_arcfs}, ! {"arcs", gl_arcs}, ! {"rectcopy", gl_rectcopy}, ! {"RGBcursor", gl_RGBcursor}, ! {"getbutton", gl_getbutton}, ! {"getcmmode", gl_getcmmode}, ! {"getlsbackup", gl_getlsbackup}, ! {"getresetls", gl_getresetls}, ! {"getdcm", gl_getdcm}, ! {"getzbuffer", gl_getzbuffer}, ! {"ismex", gl_ismex}, ! {"isobj", gl_isobj}, ! {"isqueued", gl_isqueued}, ! {"istag", gl_istag}, ! {"genobj", gl_genobj}, ! {"gentag", gl_gentag}, ! {"getbuffer", gl_getbuffer}, ! {"getcolor", gl_getcolor}, ! {"getdisplaymode", gl_getdisplaymode}, ! {"getfont", gl_getfont}, ! {"getheight", gl_getheight}, ! {"gethitcode", gl_gethitcode}, ! {"getlstyle", gl_getlstyle}, ! {"getlwidth", gl_getlwidth}, ! {"getmap", gl_getmap}, ! {"getplanes", gl_getplanes}, ! {"getwritemask", gl_getwritemask}, ! {"qtest", gl_qtest}, ! {"getlsrepeat", gl_getlsrepeat}, ! {"getmonitor", gl_getmonitor}, ! {"getopenobj", gl_getopenobj}, ! {"getpattern", gl_getpattern}, ! {"winget", gl_winget}, ! {"winattach", gl_winattach}, ! {"getothermonitor", gl_getothermonitor}, ! {"newpup", gl_newpup}, ! {"getvaluator", gl_getvaluator}, ! {"winset", gl_winset}, ! {"dopup", gl_dopup}, ! {"getdepth", gl_getdepth}, ! {"getcpos", gl_getcpos}, ! {"getsize", gl_getsize}, ! {"getorigin", gl_getorigin}, ! {"getviewport", gl_getviewport}, ! {"gettp", gl_gettp}, ! {"getgpos", gl_getgpos}, ! {"winposition", gl_winposition}, ! {"gRGBcolor", gl_gRGBcolor}, ! {"gRGBmask", gl_gRGBmask}, ! {"getscrmask", gl_getscrmask}, ! {"getmcolor", gl_getmcolor}, ! {"mapw", gl_mapw}, ! {"mapw2", gl_mapw2}, ! {"getcursor", gl_getcursor}, ! {"cmode", gl_cmode}, ! {"concave", gl_concave}, ! {"curstype", gl_curstype}, ! {"drawmode", gl_drawmode}, ! {"gammaramp", gl_gammaramp}, ! {"getbackface", gl_getbackface}, ! {"getdescender", gl_getdescender}, ! {"getdrawmode", gl_getdrawmode}, ! {"getmmode", gl_getmmode}, ! {"getsm", gl_getsm}, ! {"getvideo", gl_getvideo}, ! {"imakebackground", gl_imakebackground}, ! {"lmbind", gl_lmbind}, ! {"lmdef", gl_lmdef}, ! {"mmode", gl_mmode}, ! {"normal", gl_normal}, ! {"overlay", gl_overlay}, ! {"RGBrange", gl_RGBrange}, ! {"setvideo", gl_setvideo}, ! {"shademodel", gl_shademodel}, ! {"underlay", gl_underlay}, ! {"bgnclosedline", gl_bgnclosedline}, ! {"bgnline", gl_bgnline}, ! {"bgnpoint", gl_bgnpoint}, ! {"bgnpolygon", gl_bgnpolygon}, ! {"bgnsurface", gl_bgnsurface}, ! {"bgntmesh", gl_bgntmesh}, ! {"bgntrim", gl_bgntrim}, ! {"endclosedline", gl_endclosedline}, ! {"endline", gl_endline}, ! {"endpoint", gl_endpoint}, ! {"endpolygon", gl_endpolygon}, ! {"endsurface", gl_endsurface}, ! {"endtmesh", gl_endtmesh}, ! {"endtrim", gl_endtrim}, ! {"blendfunction", gl_blendfunction}, ! {"c3f", gl_c3f}, ! {"c3i", gl_c3i}, ! {"c3s", gl_c3s}, ! {"c4f", gl_c4f}, ! {"c4i", gl_c4i}, ! {"c4s", gl_c4s}, ! {"colorf", gl_colorf}, ! {"cpack", gl_cpack}, ! {"czclear", gl_czclear}, ! {"dglclose", gl_dglclose}, ! {"dglopen", gl_dglopen}, ! {"getgdesc", gl_getgdesc}, ! {"getnurbsproperty", gl_getnurbsproperty}, ! {"glcompat", gl_glcompat}, ! {"iconsize", gl_iconsize}, ! {"icontitle", gl_icontitle}, ! {"lRGBrange", gl_lRGBrange}, ! {"linesmooth", gl_linesmooth}, ! {"lmcolor", gl_lmcolor}, ! {"logicop", gl_logicop}, ! {"lsetdepth", gl_lsetdepth}, ! {"lshaderange", gl_lshaderange}, ! {"n3f", gl_n3f}, ! {"noborder", gl_noborder}, ! {"pntsmooth", gl_pntsmooth}, ! {"readsource", gl_readsource}, ! {"rectzoom", gl_rectzoom}, ! {"sbox", gl_sbox}, ! {"sboxi", gl_sboxi}, ! {"sboxs", gl_sboxs}, ! {"sboxf", gl_sboxf}, ! {"sboxfi", gl_sboxfi}, ! {"sboxfs", gl_sboxfs}, ! {"setnurbsproperty", gl_setnurbsproperty}, ! {"setpup", gl_setpup}, ! {"smoothline", gl_smoothline}, ! {"subpixel", gl_subpixel}, ! {"swaptmesh", gl_swaptmesh}, ! {"swinopen", gl_swinopen}, ! {"v2f", gl_v2f}, ! {"v2i", gl_v2i}, ! {"v2s", gl_v2s}, ! {"v3f", gl_v3f}, ! {"v3i", gl_v3i}, ! {"v3s", gl_v3s}, ! {"v4f", gl_v4f}, ! {"v4i", gl_v4i}, ! {"v4s", gl_v4s}, ! {"videocmd", gl_videocmd}, ! {"windepth", gl_windepth}, ! {"wmpack", gl_wmpack}, ! {"zdraw", gl_zdraw}, ! {"zfunction", gl_zfunction}, ! {"zsource", gl_zsource}, ! {"zwritemask", gl_zwritemask}, ! {"v2d", gl_v2d}, ! {"v3d", gl_v3d}, ! {"v4d", gl_v4d}, ! {"pixmode", gl_pixmode}, ! {"qgetfd", gl_qgetfd}, ! {"dither", gl_dither}, {NULL, NULL} /* Sentinel */ }; --- 7187,7622 ---- static struct PyMethodDef gl_methods[] = { ! {"qread", gl_qread, METH_OLDARGS}, ! {"varray", gl_varray, METH_OLDARGS}, ! {"nvarray", gl_nvarray, METH_OLDARGS}, ! {"vnarray", gl_vnarray, METH_OLDARGS}, ! {"nurbssurface", gl_nurbssurface, METH_OLDARGS}, ! {"nurbscurve", gl_nurbscurve, METH_OLDARGS}, ! {"pwlcurve", gl_pwlcurve, METH_OLDARGS}, ! {"pick", gl_pick, METH_OLDARGS}, ! {"endpick", gl_endpick, METH_NOARGS}, ! {"gselect", gl_gselect, METH_OLDARGS}, ! {"endselect", gl_endselect, METH_NOARGS}, ! {"getmatrix", gl_getmatrix, METH_OLDARGS}, ! {"altgetmatrix", gl_altgetmatrix, METH_OLDARGS}, ! {"lrectwrite", gl_lrectwrite, METH_OLDARGS}, ! {"lrectread", gl_lrectread, METH_OLDARGS}, ! {"readdisplay", gl_readdisplay, METH_OLDARGS}, ! {"packrect", gl_packrect, METH_OLDARGS}, ! {"unpackrect", gl_unpackrect, METH_OLDARGS}, ! {"gversion", gl_gversion, METH_OLDARGS}, ! {"clear", gl_clear, METH_OLDARGS}, ! {"getshade", gl_getshade, METH_OLDARGS}, ! {"devport", gl_devport, METH_OLDARGS}, ! {"rdr2i", gl_rdr2i, METH_OLDARGS}, ! {"rectfs", gl_rectfs, METH_OLDARGS}, ! {"rects", gl_rects, METH_OLDARGS}, ! {"rmv2i", gl_rmv2i, METH_OLDARGS}, ! {"noport", gl_noport, METH_OLDARGS}, ! {"popviewport", gl_popviewport, METH_OLDARGS}, ! {"clearhitcode", gl_clearhitcode, METH_OLDARGS}, ! {"closeobj", gl_closeobj, METH_OLDARGS}, ! {"cursoff", gl_cursoff, METH_OLDARGS}, ! {"curson", gl_curson, METH_OLDARGS}, ! {"doublebuffer", gl_doublebuffer, METH_OLDARGS}, ! {"finish", gl_finish, METH_OLDARGS}, ! {"gconfig", gl_gconfig, METH_OLDARGS}, ! {"ginit", gl_ginit, METH_OLDARGS}, ! {"greset", gl_greset, METH_OLDARGS}, ! {"multimap", gl_multimap, METH_OLDARGS}, ! {"onemap", gl_onemap, METH_OLDARGS}, ! {"popattributes", gl_popattributes, METH_OLDARGS}, ! {"popmatrix", gl_popmatrix, METH_OLDARGS}, ! {"pushattributes", gl_pushattributes,METH_OLDARGS}, ! {"pushmatrix", gl_pushmatrix, METH_OLDARGS}, ! {"pushviewport", gl_pushviewport, METH_OLDARGS}, ! {"qreset", gl_qreset, METH_OLDARGS}, ! {"RGBmode", gl_RGBmode, METH_OLDARGS}, ! {"singlebuffer", gl_singlebuffer, METH_OLDARGS}, ! {"swapbuffers", gl_swapbuffers, METH_OLDARGS}, ! {"gsync", gl_gsync, METH_OLDARGS}, ! {"gflush", gl_gflush, METH_OLDARGS}, ! {"tpon", gl_tpon, METH_OLDARGS}, ! {"tpoff", gl_tpoff, METH_OLDARGS}, ! {"clkon", gl_clkon, METH_OLDARGS}, ! {"clkoff", gl_clkoff, METH_OLDARGS}, ! {"ringbell", gl_ringbell, METH_OLDARGS}, ! {"gbegin", gl_gbegin, METH_OLDARGS}, ! {"textinit", gl_textinit, METH_OLDARGS}, ! {"initnames", gl_initnames, METH_OLDARGS}, ! {"pclos", gl_pclos, METH_OLDARGS}, ! {"popname", gl_popname, METH_OLDARGS}, ! {"spclos", gl_spclos, METH_OLDARGS}, ! {"zclear", gl_zclear, METH_OLDARGS}, ! {"screenspace", gl_screenspace, METH_OLDARGS}, ! {"reshapeviewport", gl_reshapeviewport, METH_OLDARGS}, ! {"winpush", gl_winpush, METH_OLDARGS}, ! {"winpop", gl_winpop, METH_OLDARGS}, ! {"foreground", gl_foreground, METH_OLDARGS}, ! {"endfullscrn", gl_endfullscrn, METH_OLDARGS}, ! {"endpupmode", gl_endpupmode, METH_OLDARGS}, ! {"fullscrn", gl_fullscrn, METH_OLDARGS}, ! {"pupmode", gl_pupmode, METH_OLDARGS}, ! {"winconstraints", gl_winconstraints, METH_OLDARGS}, ! {"pagecolor", gl_pagecolor, METH_OLDARGS}, ! {"textcolor", gl_textcolor, METH_OLDARGS}, ! {"color", gl_color, METH_OLDARGS}, ! {"curveit", gl_curveit, METH_OLDARGS}, ! {"font", gl_font, METH_OLDARGS}, ! {"linewidth", gl_linewidth, METH_OLDARGS}, ! {"setlinestyle", gl_setlinestyle, METH_OLDARGS}, ! {"setmap", gl_setmap, METH_OLDARGS}, ! {"swapinterval", gl_swapinterval, METH_OLDARGS}, ! {"writemask", gl_writemask, METH_OLDARGS}, ! {"textwritemask", gl_textwritemask, METH_OLDARGS}, ! {"qdevice", gl_qdevice, METH_OLDARGS}, ! {"unqdevice", gl_unqdevice, METH_OLDARGS}, ! {"curvebasis", gl_curvebasis, METH_OLDARGS}, ! {"curveprecision", gl_curveprecision,METH_OLDARGS}, ! {"loadname", gl_loadname, METH_OLDARGS}, ! {"passthrough", gl_passthrough, METH_OLDARGS}, ! {"pushname", gl_pushname, METH_OLDARGS}, ! {"setmonitor", gl_setmonitor, METH_OLDARGS}, ! {"setshade", gl_setshade, METH_OLDARGS}, ! {"setpattern", gl_setpattern, METH_OLDARGS}, ! {"pagewritemask", gl_pagewritemask, METH_OLDARGS}, ! {"callobj", gl_callobj, METH_OLDARGS}, ! {"delobj", gl_delobj, METH_OLDARGS}, ! {"editobj", gl_editobj, METH_OLDARGS}, ! {"makeobj", gl_makeobj, METH_OLDARGS}, ! {"maketag", gl_maketag, METH_OLDARGS}, ! {"chunksize", gl_chunksize, METH_OLDARGS}, ! {"compactify", gl_compactify, METH_OLDARGS}, ! {"deltag", gl_deltag, METH_OLDARGS}, ! {"lsrepeat", gl_lsrepeat, METH_OLDARGS}, ! {"objinsert", gl_objinsert, METH_OLDARGS}, ! {"objreplace", gl_objreplace, METH_OLDARGS}, ! {"winclose", gl_winclose, METH_OLDARGS}, ! {"blanktime", gl_blanktime, METH_OLDARGS}, ! {"freepup", gl_freepup, METH_OLDARGS}, ! {"backbuffer", gl_backbuffer, METH_OLDARGS}, ! {"frontbuffer", gl_frontbuffer, METH_OLDARGS}, ! {"lsbackup", gl_lsbackup, METH_OLDARGS}, ! {"resetls", gl_resetls, METH_OLDARGS}, ! {"lampon", gl_lampon, METH_OLDARGS}, ! {"lampoff", gl_lampoff, METH_OLDARGS}, ! {"setbell", gl_setbell, METH_OLDARGS}, ! {"blankscreen", gl_blankscreen, METH_OLDARGS}, ! {"depthcue", gl_depthcue, METH_OLDARGS}, ! {"zbuffer", gl_zbuffer, METH_OLDARGS}, ! {"backface", gl_backface, METH_OLDARGS}, ! {"cmov2i", gl_cmov2i, METH_OLDARGS}, ! {"draw2i", gl_draw2i, METH_OLDARGS}, ! {"move2i", gl_move2i, METH_OLDARGS}, ! {"pnt2i", gl_pnt2i, METH_OLDARGS}, ! {"patchbasis", gl_patchbasis, METH_OLDARGS}, ! {"patchprecision", gl_patchprecision, METH_OLDARGS}, ! {"pdr2i", gl_pdr2i, METH_OLDARGS}, ! {"pmv2i", gl_pmv2i, METH_OLDARGS}, ! {"rpdr2i", gl_rpdr2i, METH_OLDARGS}, ! {"rpmv2i", gl_rpmv2i, METH_OLDARGS}, ! {"xfpt2i", gl_xfpt2i, METH_OLDARGS}, ! {"objdelete", gl_objdelete, METH_OLDARGS}, ! {"patchcurves", gl_patchcurves, METH_OLDARGS}, ! {"minsize", gl_minsize, METH_OLDARGS}, ! {"maxsize", gl_maxsize, METH_OLDARGS}, ! {"keepaspect", gl_keepaspect, METH_OLDARGS}, ! {"prefsize", gl_prefsize, METH_OLDARGS}, ! {"stepunit", gl_stepunit, METH_OLDARGS}, ! {"fudge", gl_fudge, METH_OLDARGS}, ! {"winmove", gl_winmove, METH_OLDARGS}, ! {"attachcursor", gl_attachcursor, METH_OLDARGS}, ! {"deflinestyle", gl_deflinestyle, METH_OLDARGS}, ! {"noise", gl_noise, METH_OLDARGS}, ! {"picksize", gl_picksize, METH_OLDARGS}, ! {"qenter", gl_qenter, METH_OLDARGS}, ! {"setdepth", gl_setdepth, METH_OLDARGS}, ! {"cmov2s", gl_cmov2s, METH_OLDARGS}, ! {"draw2s", gl_draw2s, METH_OLDARGS}, ! {"move2s", gl_move2s, METH_OLDARGS}, ! {"pdr2s", gl_pdr2s, METH_OLDARGS}, ! {"pmv2s", gl_pmv2s, METH_OLDARGS}, ! {"pnt2s", gl_pnt2s, METH_OLDARGS}, ! {"rdr2s", gl_rdr2s, METH_OLDARGS}, ! {"rmv2s", gl_rmv2s, METH_OLDARGS}, ! {"rpdr2s", gl_rpdr2s, METH_OLDARGS}, ! {"rpmv2s", gl_rpmv2s, METH_OLDARGS}, ! {"xfpt2s", gl_xfpt2s, METH_OLDARGS}, ! {"cmov2", gl_cmov2, METH_OLDARGS}, ! {"draw2", gl_draw2, METH_OLDARGS}, ! {"move2", gl_move2, METH_OLDARGS}, ! {"pnt2", gl_pnt2, METH_OLDARGS}, ! {"pdr2", gl_pdr2, METH_OLDARGS}, ! {"pmv2", gl_pmv2, METH_OLDARGS}, ! {"rdr2", gl_rdr2, METH_OLDARGS}, ! {"rmv2", gl_rmv2, METH_OLDARGS}, ! {"rpdr2", gl_rpdr2, METH_OLDARGS}, ! {"rpmv2", gl_rpmv2, METH_OLDARGS}, ! {"xfpt2", gl_xfpt2, METH_OLDARGS}, ! {"loadmatrix", gl_loadmatrix, METH_OLDARGS}, ! {"multmatrix", gl_multmatrix, METH_OLDARGS}, ! {"crv", gl_crv, METH_OLDARGS}, ! {"rcrv", gl_rcrv, METH_OLDARGS}, ! {"addtopup", gl_addtopup, METH_OLDARGS}, ! {"charstr", gl_charstr, METH_OLDARGS}, ! {"getport", gl_getport, METH_OLDARGS}, ! {"strwidth", gl_strwidth, METH_OLDARGS}, ! {"winopen", gl_winopen, METH_OLDARGS}, ! {"wintitle", gl_wintitle, METH_OLDARGS}, ! {"polf", gl_polf, METH_OLDARGS}, ! {"polf2", gl_polf2, METH_OLDARGS}, ! {"poly", gl_poly, METH_OLDARGS}, ! {"poly2", gl_poly2, METH_OLDARGS}, ! {"crvn", gl_crvn, METH_OLDARGS}, ! {"rcrvn", gl_rcrvn, METH_OLDARGS}, ! {"polf2i", gl_polf2i, METH_OLDARGS}, ! {"polfi", gl_polfi, METH_OLDARGS}, ! {"poly2i", gl_poly2i, METH_OLDARGS}, ! {"polyi", gl_polyi, METH_OLDARGS}, ! {"polf2s", gl_polf2s, METH_OLDARGS}, ! {"polfs", gl_polfs, METH_OLDARGS}, ! {"polys", gl_polys, METH_OLDARGS}, ! {"poly2s", gl_poly2s, METH_OLDARGS}, ! {"defcursor", gl_defcursor, METH_OLDARGS}, ! {"writepixels", gl_writepixels, METH_OLDARGS}, ! {"defbasis", gl_defbasis, METH_OLDARGS}, ! {"gewrite", gl_gewrite, METH_OLDARGS}, ! {"rotate", gl_rotate, METH_OLDARGS}, ! {"rot", gl_rot, METH_OLDARGS}, ! {"circfi", gl_circfi, METH_OLDARGS}, ! {"circi", gl_circi, METH_OLDARGS}, ! {"cmovi", gl_cmovi, METH_OLDARGS}, ! {"drawi", gl_drawi, METH_OLDARGS}, ! {"movei", gl_movei, METH_OLDARGS}, ! {"pnti", gl_pnti, METH_OLDARGS}, ! {"newtag", gl_newtag, METH_OLDARGS}, ! {"pdri", gl_pdri, METH_OLDARGS}, ! {"pmvi", gl_pmvi, METH_OLDARGS}, ! {"rdri", gl_rdri, METH_OLDARGS}, ! {"rmvi", gl_rmvi, METH_OLDARGS}, ! {"rpdri", gl_rpdri, METH_OLDARGS}, ! {"rpmvi", gl_rpmvi, METH_OLDARGS}, ! {"xfpti", gl_xfpti, METH_OLDARGS}, ! {"circ", gl_circ, METH_OLDARGS}, ! {"circf", gl_circf, METH_OLDARGS}, ! {"cmov", gl_cmov, METH_OLDARGS}, ! {"draw", gl_draw, METH_OLDARGS}, ! {"move", gl_move, METH_OLDARGS}, ! {"pnt", gl_pnt, METH_OLDARGS}, ! {"scale", gl_scale, METH_OLDARGS}, ! {"translate", gl_translate, METH_OLDARGS}, ! {"pdr", gl_pdr, METH_OLDARGS}, ! {"pmv", gl_pmv, METH_OLDARGS}, ! {"rdr", gl_rdr, METH_OLDARGS}, ! {"rmv", gl_rmv, METH_OLDARGS}, ! {"rpdr", gl_rpdr, METH_OLDARGS}, ! {"rpmv", gl_rpmv, METH_OLDARGS}, ! {"xfpt", gl_xfpt, METH_OLDARGS}, ! {"RGBcolor", gl_RGBcolor, METH_OLDARGS}, ! {"RGBwritemask", gl_RGBwritemask, METH_OLDARGS}, ! {"setcursor", gl_setcursor, METH_OLDARGS}, ! {"tie", gl_tie, METH_OLDARGS}, ! {"circfs", gl_circfs, METH_OLDARGS}, ! {"circs", gl_circs, METH_OLDARGS}, ! {"cmovs", gl_cmovs, METH_OLDARGS}, ! {"draws", gl_draws, METH_OLDARGS}, ! {"moves", gl_moves, METH_OLDARGS}, ! {"pdrs", gl_pdrs, METH_OLDARGS}, ! {"pmvs", gl_pmvs, METH_OLDARGS}, ! {"pnts", gl_pnts, METH_OLDARGS}, ! {"rdrs", gl_rdrs, METH_OLDARGS}, ! {"rmvs", gl_rmvs, METH_OLDARGS}, ! {"rpdrs", gl_rpdrs, METH_OLDARGS}, ! {"rpmvs", gl_rpmvs, METH_OLDARGS}, ! {"xfpts", gl_xfpts, METH_OLDARGS}, ! {"curorigin", gl_curorigin, METH_OLDARGS}, ! {"cyclemap", gl_cyclemap, METH_OLDARGS}, ! {"patch", gl_patch, METH_OLDARGS}, ! {"splf", gl_splf, METH_OLDARGS}, ! {"splf2", gl_splf2, METH_OLDARGS}, ! {"splfi", gl_splfi, METH_OLDARGS}, ! {"splf2i", gl_splf2i, METH_OLDARGS}, ! {"splfs", gl_splfs, METH_OLDARGS}, ! {"splf2s", gl_splf2s, METH_OLDARGS}, ! {"rpatch", gl_rpatch, METH_OLDARGS}, ! {"ortho2", gl_ortho2, METH_OLDARGS}, ! {"rect", gl_rect, METH_OLDARGS}, ! {"rectf", gl_rectf, METH_OLDARGS}, ! {"xfpt4", gl_xfpt4, METH_OLDARGS}, ! {"textport", gl_textport, METH_OLDARGS}, ! {"mapcolor", gl_mapcolor, METH_OLDARGS}, ! {"scrmask", gl_scrmask, METH_OLDARGS}, ! {"setvaluator", gl_setvaluator, METH_OLDARGS}, ! {"viewport", gl_viewport, METH_OLDARGS}, ! {"shaderange", gl_shaderange, METH_OLDARGS}, ! {"xfpt4s", gl_xfpt4s, METH_OLDARGS}, ! {"rectfi", gl_rectfi, METH_OLDARGS}, ! {"recti", gl_recti, METH_OLDARGS}, ! {"xfpt4i", gl_xfpt4i, METH_OLDARGS}, ! {"prefposition", gl_prefposition, METH_OLDARGS}, ! {"arc", gl_arc, METH_OLDARGS}, ! {"arcf", gl_arcf, METH_OLDARGS}, ! {"arcfi", gl_arcfi, METH_OLDARGS}, ! {"arci", gl_arci, METH_OLDARGS}, ! {"bbox2", gl_bbox2, METH_OLDARGS}, ! {"bbox2i", gl_bbox2i, METH_OLDARGS}, ! {"bbox2s", gl_bbox2s, METH_OLDARGS}, ! {"blink", gl_blink, METH_OLDARGS}, ! {"ortho", gl_ortho, METH_OLDARGS}, ! {"window", gl_window, METH_OLDARGS}, ! {"lookat", gl_lookat, METH_OLDARGS}, ! {"perspective", gl_perspective, METH_OLDARGS}, ! {"polarview", gl_polarview, METH_OLDARGS}, ! {"arcfs", gl_arcfs, METH_OLDARGS}, ! {"arcs", gl_arcs, METH_OLDARGS}, ! {"rectcopy", gl_rectcopy, METH_OLDARGS}, ! {"RGBcursor", gl_RGBcursor, METH_OLDARGS}, ! {"getbutton", gl_getbutton, METH_OLDARGS}, ! {"getcmmode", gl_getcmmode, METH_OLDARGS}, ! {"getlsbackup", gl_getlsbackup, METH_OLDARGS}, ! {"getresetls", gl_getresetls, METH_OLDARGS}, ! {"getdcm", gl_getdcm, METH_OLDARGS}, ! {"getzbuffer", gl_getzbuffer, METH_OLDARGS}, ! {"ismex", gl_ismex, METH_OLDARGS}, ! {"isobj", gl_isobj, METH_OLDARGS}, ! {"isqueued", gl_isqueued, METH_OLDARGS}, ! {"istag", gl_istag, METH_OLDARGS}, ! {"genobj", gl_genobj, METH_OLDARGS}, ! {"gentag", gl_gentag, METH_OLDARGS}, ! {"getbuffer", gl_getbuffer, METH_OLDARGS}, ! {"getcolor", gl_getcolor, METH_OLDARGS}, ! {"getdisplaymode", gl_getdisplaymode, METH_OLDARGS}, ! {"getfont", gl_getfont, METH_OLDARGS}, ! {"getheight", gl_getheight, METH_OLDARGS}, ! {"gethitcode", gl_gethitcode, METH_OLDARGS}, ! {"getlstyle", gl_getlstyle, METH_OLDARGS}, ! {"getlwidth", gl_getlwidth, METH_OLDARGS}, ! {"getmap", gl_getmap, METH_OLDARGS}, ! {"getplanes", gl_getplanes, METH_OLDARGS}, ! {"getwritemask", gl_getwritemask, METH_OLDARGS}, ! {"qtest", gl_qtest, METH_OLDARGS}, ! {"getlsrepeat", gl_getlsrepeat, METH_OLDARGS}, ! {"getmonitor", gl_getmonitor, METH_OLDARGS}, ! {"getopenobj", gl_getopenobj, METH_OLDARGS}, ! {"getpattern", gl_getpattern, METH_OLDARGS}, ! {"winget", gl_winget, METH_OLDARGS}, ! {"winattach", gl_winattach, METH_OLDARGS}, ! {"getothermonitor", gl_getothermonitor, METH_OLDARGS}, ! {"newpup", gl_newpup, METH_OLDARGS}, ! {"getvaluator", gl_getvaluator, METH_OLDARGS}, ! {"winset", gl_winset, METH_OLDARGS}, ! {"dopup", gl_dopup, METH_OLDARGS}, ! {"getdepth", gl_getdepth, METH_OLDARGS}, ! {"getcpos", gl_getcpos, METH_OLDARGS}, ! {"getsize", gl_getsize, METH_OLDARGS}, ! {"getorigin", gl_getorigin, METH_OLDARGS}, ! {"getviewport", gl_getviewport, METH_OLDARGS}, ! {"gettp", gl_gettp, METH_OLDARGS}, ! {"getgpos", gl_getgpos, METH_OLDARGS}, ! {"winposition", gl_winposition, METH_OLDARGS}, ! {"gRGBcolor", gl_gRGBcolor, METH_OLDARGS}, ! {"gRGBmask", gl_gRGBmask, METH_OLDARGS}, ! {"getscrmask", gl_getscrmask, METH_OLDARGS}, ! {"getmcolor", gl_getmcolor, METH_OLDARGS}, ! {"mapw", gl_mapw, METH_OLDARGS}, ! {"mapw2", gl_mapw2, METH_OLDARGS}, ! {"getcursor", gl_getcursor, METH_OLDARGS}, ! {"cmode", gl_cmode, METH_OLDARGS}, ! {"concave", gl_concave, METH_OLDARGS}, ! {"curstype", gl_curstype, METH_OLDARGS}, ! {"drawmode", gl_drawmode, METH_OLDARGS}, ! {"gammaramp", gl_gammaramp, METH_OLDARGS}, ! {"getbackface", gl_getbackface, METH_OLDARGS}, ! {"getdescender", gl_getdescender, METH_OLDARGS}, ! {"getdrawmode", gl_getdrawmode, METH_OLDARGS}, ! {"getmmode", gl_getmmode, METH_OLDARGS}, ! {"getsm", gl_getsm, METH_OLDARGS}, ! {"getvideo", gl_getvideo, METH_OLDARGS}, ! {"imakebackground", gl_imakebackground, METH_OLDARGS}, ! {"lmbind", gl_lmbind, METH_OLDARGS}, ! {"lmdef", gl_lmdef, METH_OLDARGS}, ! {"mmode", gl_mmode, METH_OLDARGS}, ! {"normal", gl_normal, METH_OLDARGS}, ! {"overlay", gl_overlay, METH_OLDARGS}, ! {"RGBrange", gl_RGBrange, METH_OLDARGS}, ! {"setvideo", gl_setvideo, METH_OLDARGS}, ! {"shademodel", gl_shademodel, METH_OLDARGS}, ! {"underlay", gl_underlay, METH_OLDARGS}, ! {"bgnclosedline", gl_bgnclosedline, METH_OLDARGS}, ! {"bgnline", gl_bgnline, METH_OLDARGS}, ! {"bgnpoint", gl_bgnpoint, METH_OLDARGS}, ! {"bgnpolygon", gl_bgnpolygon, METH_OLDARGS}, ! {"bgnsurface", gl_bgnsurface, METH_OLDARGS}, ! {"bgntmesh", gl_bgntmesh, METH_OLDARGS}, ! {"bgntrim", gl_bgntrim, METH_OLDARGS}, ! {"endclosedline", gl_endclosedline, METH_OLDARGS}, ! {"endline", gl_endline, METH_OLDARGS}, ! {"endpoint", gl_endpoint, METH_OLDARGS}, ! {"endpolygon", gl_endpolygon, METH_OLDARGS}, ! {"endsurface", gl_endsurface, METH_OLDARGS}, ! {"endtmesh", gl_endtmesh, METH_OLDARGS}, ! {"endtrim", gl_endtrim, METH_OLDARGS}, ! {"blendfunction", gl_blendfunction, METH_OLDARGS}, ! {"c3f", gl_c3f, METH_OLDARGS}, ! {"c3i", gl_c3i, METH_OLDARGS}, ! {"c3s", gl_c3s, METH_OLDARGS}, ! {"c4f", gl_c4f, METH_OLDARGS}, ! {"c4i", gl_c4i, METH_OLDARGS}, ! {"c4s", gl_c4s, METH_OLDARGS}, ! {"colorf", gl_colorf, METH_OLDARGS}, ! {"cpack", gl_cpack, METH_OLDARGS}, ! {"czclear", gl_czclear, METH_OLDARGS}, ! {"dglclose", gl_dglclose, METH_OLDARGS}, ! {"dglopen", gl_dglopen, METH_OLDARGS}, ! {"getgdesc", gl_getgdesc, METH_OLDARGS}, ! {"getnurbsproperty", gl_getnurbsproperty, METH_OLDARGS}, ! {"glcompat", gl_glcompat, METH_OLDARGS}, ! {"iconsize", gl_iconsize, METH_OLDARGS}, ! {"icontitle", gl_icontitle, METH_OLDARGS}, ! {"lRGBrange", gl_lRGBrange, METH_OLDARGS}, ! {"linesmooth", gl_linesmooth, METH_OLDARGS}, ! {"lmcolor", gl_lmcolor, METH_OLDARGS}, ! {"logicop", gl_logicop, METH_OLDARGS}, ! {"lsetdepth", gl_lsetdepth, METH_OLDARGS}, ! {"lshaderange", gl_lshaderange, METH_OLDARGS}, ! {"n3f", gl_n3f, METH_OLDARGS}, ! {"noborder", gl_noborder, METH_OLDARGS}, ! {"pntsmooth", gl_pntsmooth, METH_OLDARGS}, ! {"readsource", gl_readsource, METH_OLDARGS}, ! {"rectzoom", gl_rectzoom, METH_OLDARGS}, ! {"sbox", gl_sbox, METH_OLDARGS}, ! {"sboxi", gl_sboxi, METH_OLDARGS}, ! {"sboxs", gl_sboxs, METH_OLDARGS}, ! {"sboxf", gl_sboxf, METH_OLDARGS}, ! {"sboxfi", gl_sboxfi, METH_OLDARGS}, ! {"sboxfs", gl_sboxfs, METH_OLDARGS}, ! {"setnurbsproperty", gl_setnurbsproperty, METH_OLDARGS}, ! {"setpup", gl_setpup, METH_OLDARGS}, ! {"smoothline", gl_smoothline, METH_OLDARGS}, ! {"subpixel", gl_subpixel, METH_OLDARGS}, ! {"swaptmesh", gl_swaptmesh, METH_OLDARGS}, ! {"swinopen", gl_swinopen, METH_OLDARGS}, ! {"v2f", gl_v2f, METH_OLDARGS}, ! {"v2i", gl_v2i, METH_OLDARGS}, ! {"v2s", gl_v2s, METH_OLDARGS}, ! {"v3f", gl_v3f, METH_OLDARGS}, ! {"v3i", gl_v3i, METH_OLDARGS}, ! {"v3s", gl_v3s, METH_OLDARGS}, ! {"v4f", gl_v4f, METH_OLDARGS}, ! {"v4i", gl_v4i, METH_OLDARGS}, ! {"v4s", gl_v4s, METH_OLDARGS}, ! {"videocmd", gl_videocmd, METH_OLDARGS}, ! {"windepth", gl_windepth, METH_OLDARGS}, ! {"wmpack", gl_wmpack, METH_OLDARGS}, ! {"zdraw", gl_zdraw, METH_OLDARGS}, ! {"zfunction", gl_zfunction, METH_OLDARGS}, ! {"zsource", gl_zsource, METH_OLDARGS}, ! {"zwritemask", gl_zwritemask, METH_OLDARGS}, ! {"v2d", gl_v2d, METH_OLDARGS}, ! {"v3d", gl_v3d, METH_OLDARGS}, ! {"v4d", gl_v4d, METH_OLDARGS}, ! {"pixmode", gl_pixmode, METH_OLDARGS}, ! {"qgetfd", gl_qgetfd, METH_OLDARGS}, ! {"dither", gl_dither, METH_OLDARGS}, {NULL, NULL} /* Sentinel */ }; From loewis@users.sourceforge.net Sun Jul 28 17:10:33 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:10:33 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.237,1.238 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31576/Modules Modified Files: socketmodule.c Log Message: Pass length of result structure into setipaddr. Fixes bug #565747. Committed to 2.2 branch. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.237 retrieving revision 1.238 diff -C2 -d -r1.237 -r1.238 *** socketmodule.c 25 Jul 2002 16:37:51 -0000 1.237 --- socketmodule.c 28 Jul 2002 16:10:31 -0000 1.238 *************** *** 587,591 **** static int ! setipaddr(char *name, struct sockaddr *addr_ret, int af) { struct addrinfo hints, *res; --- 587,591 ---- static int ! setipaddr(char *name, struct sockaddr *addr_ret, size_t addr_ret_size, int af) { struct addrinfo hints, *res; *************** *** 625,629 **** return -1; } ! memcpy(addr_ret, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); return siz; --- 625,631 ---- return -1; } ! if (res->ai_addrlen < addr_ret_size) ! addr_ret_size = res->ai_addrlen; ! memcpy(addr_ret, res->ai_addr, addr_ret_size); freeaddrinfo(res); return siz; *************** *** 660,664 **** return -1; } ! memcpy((char *) addr_ret, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); switch (addr_ret->sa_family) { --- 662,668 ---- return -1; } ! if (res->ai_addrlen < addr_ret_size) ! addr_ret_size = res->ai_addrlen; ! memcpy((char *) addr_ret, res->ai_addr, addr_ret_size); freeaddrinfo(res); switch (addr_ret->sa_family) { *************** *** 844,848 **** if (!PyArg_ParseTuple(args, "si:getsockaddrarg", &host, &port)) return 0; ! if (setipaddr(host, (struct sockaddr *)addr, AF_INET) < 0) return 0; addr->sin_family = AF_INET; --- 848,852 ---- if (!PyArg_ParseTuple(args, "si:getsockaddrarg", &host, &port)) return 0; ! if (setipaddr(host, (struct sockaddr *)addr, sizeof(*addr), AF_INET) < 0) return 0; addr->sin_family = AF_INET; *************** *** 865,869 **** return 0; } ! if (setipaddr(host, (struct sockaddr *)addr, AF_INET6) < 0) return 0; addr->sin6_family = s->sock_family; --- 869,873 ---- return 0; } ! if (setipaddr(host, (struct sockaddr *)addr, sizeof(*addr), AF_INET6) < 0) return 0; addr->sin6_family = s->sock_family; *************** *** 2047,2051 **** if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addrbuf, AF_INET) < 0) return NULL; return makeipaddr((struct sockaddr *)&addrbuf, --- 2051,2055 ---- if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addrbuf, sizeof(addrbuf), AF_INET) < 0) return NULL; return makeipaddr((struct sockaddr *)&addrbuf, *************** *** 2220,2224 **** if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addr, PF_INET) < 0) return NULL; Py_BEGIN_ALLOW_THREADS --- 2224,2228 ---- if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addr, sizeof(addr), PF_INET) < 0) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 2296,2300 **** return NULL; af = PF_UNSPEC; ! if (setipaddr(ip_num, sa, af) < 0) return NULL; af = sa->sa_family; --- 2300,2304 ---- return NULL; af = PF_UNSPEC; ! if (setipaddr(ip_num, sa, sizeof(addr), af) < 0) return NULL; af = sa->sa_family; From loewis@users.sourceforge.net Sun Jul 28 17:11:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:11:27 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.200.6.6,1.200.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31815 Modified Files: Tag: release22-maint socketmodule.c Log Message: Pass length of result structure into setipaddr. Fixes bug #565747. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.200.6.6 retrieving revision 1.200.6.7 diff -C2 -d -r1.200.6.6 -r1.200.6.7 *** socketmodule.c 6 Jun 2002 20:11:15 -0000 1.200.6.6 --- socketmodule.c 28 Jul 2002 16:11:25 -0000 1.200.6.7 *************** *** 584,588 **** static int ! setipaddr(char* name, struct sockaddr * addr_ret, int af) { struct addrinfo hints, *res; --- 584,588 ---- static int ! setipaddr(char* name, struct sockaddr * addr_ret, size_t addr_ret_size, int af) { struct addrinfo hints, *res; *************** *** 622,626 **** return -1; } ! memcpy(addr_ret, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); return siz; --- 622,628 ---- return -1; } ! if (res->ai_addrlen < addr_ret_size) ! addr_ret_size = res->ai_addrlen; ! memcpy(addr_ret, res->ai_addr, addr_ret_size); freeaddrinfo(res); return siz; *************** *** 657,661 **** return -1; } ! memcpy((char *) addr_ret, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); switch (addr_ret->sa_family) { --- 659,665 ---- return -1; } ! if (res->ai_addrlen < addr_ret_size) ! addr_ret_size = res->ai_addrlen; ! memcpy((char *) addr_ret, res->ai_addr, addr_ret_size); freeaddrinfo(res); switch (addr_ret->sa_family) { *************** *** 832,836 **** if (!PyArg_ParseTuple(args, "si:getsockaddrarg", &host, &port)) return 0; ! if (setipaddr(host, (struct sockaddr *)addr, AF_INET) < 0) return 0; addr->sin_family = AF_INET; --- 836,840 ---- if (!PyArg_ParseTuple(args, "si:getsockaddrarg", &host, &port)) return 0; ! if (setipaddr(host, (struct sockaddr *)addr, sizeof(*addr), AF_INET) < 0) return 0; addr->sin_family = AF_INET; *************** *** 853,857 **** return 0; } ! if (setipaddr(host, (struct sockaddr *)addr, AF_INET6) < 0) return 0; addr->sin6_family = s->sock_family; --- 857,861 ---- return 0; } ! if (setipaddr(host, (struct sockaddr *)addr, sizeof(*addr), AF_INET6) < 0) return 0; addr->sin6_family = s->sock_family; *************** *** 1962,1966 **** if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addrbuf, AF_INET) < 0) return NULL; return makeipaddr((struct sockaddr *)&addrbuf, --- 1966,1970 ---- if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addrbuf, sizeof(addrbuf), AF_INET) < 0) return NULL; return makeipaddr((struct sockaddr *)&addrbuf, *************** *** 2111,2115 **** if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addr, PF_INET) < 0) return NULL; Py_BEGIN_ALLOW_THREADS --- 2115,2119 ---- if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name)) return NULL; ! if (setipaddr(name, (struct sockaddr *)&addr, sizeof(addr), PF_INET) < 0) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 2183,2187 **** return NULL; af = PF_UNSPEC; ! if (setipaddr(ip_num, sa, af) < 0) return NULL; af = sa->sa_family; --- 2187,2191 ---- return NULL; af = PF_UNSPEC; ! if (setipaddr(ip_num, sa, sizeof(addr), af) < 0) return NULL; af = sa->sa_family; From loewis@users.sourceforge.net Sun Jul 28 17:33:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:33:47 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.244,2.245 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv3899/Modules Modified Files: posixmodule.c Log Message: Patch #573770: Implement lchown. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.244 retrieving revision 2.245 diff -C2 -d -r2.244 -r2.245 *** posixmodule.c 15 Jul 2002 16:10:55 -0000 2.244 --- posixmodule.c 28 Jul 2002 16:33:45 -0000 2.245 *************** *** 931,934 **** --- 931,961 ---- #endif /* HAVE_CHOWN */ + #ifdef HAVE_LCHOWN + PyDoc_STRVAR(posix_lchown__doc__, + "lchown(path, uid, gid)\n\n\ + Change the owner and group id of path to the numeric uid and gid.\n\ + This function will not follow symbolic links."); + + static PyObject * + posix_lchown(PyObject *self, PyObject *args) + { + char *path = NULL; + int uid, gid; + int res; + if (!PyArg_ParseTuple(args, "etii:lchown", + Py_FileSystemDefaultEncoding, &path, + &uid, &gid)) + return NULL; + Py_BEGIN_ALLOW_THREADS + res = lchown(path, (uid_t) uid, (gid_t) gid); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(path); + PyMem_Free(path); + Py_INCREF(Py_None); + return Py_None; + } + #endif /* HAVE_LCHOWN */ + #ifdef HAVE_GETCWD *************** *** 6226,6229 **** --- 6253,6259 ---- {"chown", posix_chown, METH_VARARGS, posix_chown__doc__}, #endif /* HAVE_CHOWN */ + #ifdef HAVE_LCHOWN + {"lchown", posix_lchown, METH_VARARGS, posix_lchown__doc__}, + #endif /* HAVE_LCHOWN */ #ifdef HAVE_CHROOT {"chroot", posix_chroot, METH_VARARGS, posix_chroot__doc__}, From loewis@users.sourceforge.net Sun Jul 28 17:33:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:33:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3899/Doc/lib Modified Files: libos.tex Log Message: Patch #573770: Implement lchown. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** libos.tex 24 Jul 2002 15:32:25 -0000 1.92 --- libos.tex 28 Jul 2002 16:33:45 -0000 1.93 *************** *** 642,645 **** --- 642,652 ---- \end{funcdesc} + \begin{funcdesc}{lchown}{path, uid, gid} + Change the owner and group id of \var{path} to the numeric \var{uid} + and gid. This function will not follow symbolic links. + Availability: \UNIX. + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{link}{src, dst} Create a hard link pointing to \var{src} named \var{dst}. From loewis@users.sourceforge.net Sun Jul 28 17:33:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:33:47 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.445,1.446 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv3899/Misc Modified Files: NEWS Log Message: Patch #573770: Implement lchown. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.445 retrieving revision 1.446 diff -C2 -d -r1.445 -r1.446 *** NEWS 23 Jul 2002 03:44:35 -0000 1.445 --- NEWS 28 Jul 2002 16:33:45 -0000 1.446 *************** *** 163,168 **** written to disk. ! - posix.killpg, posix.mknod, and posix.getpgid have been added where ! available. - The locale module now exposes the C library's gettext interface. --- 163,168 ---- written to disk. ! - posix.lchown, posix.killpg, posix.mknod, and posix.getpgid have been ! added where available. - The locale module now exposes the C library's gettext interface. *************** *** 340,344 **** new type. ! - Accoring to Annex F of the current C standard, The Standard C macro HUGE_VAL and its float and long double analogs, --- 340,344 ---- new type. ! - According to Annex F of the current C standard, The Standard C macro HUGE_VAL and its float and long double analogs, From loewis@users.sourceforge.net Sun Jul 28 17:33:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:33:47 -0700 Subject: [Python-checkins] python/dist/src configure,1.324,1.325 configure.in,1.335,1.336 pyconfig.h.in,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv3899 Modified Files: configure configure.in pyconfig.h.in Log Message: Patch #573770: Implement lchown. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.324 retrieving revision 1.325 diff -C2 -d -r1.324 -r1.325 *** configure 20 Jul 2002 08:51:51 -0000 1.324 --- configure 28 Jul 2002 16:33:42 -0000 1.325 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.334 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.335 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 11439,11447 **** for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ ! nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ --- 11439,11448 ---- + for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg lchown link lstat mkfifo mknod mktime \ ! mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.335 retrieving revision 1.336 diff -C2 -d -r1.335 -r1.336 *** configure.in 20 Jul 2002 08:51:52 -0000 1.335 --- configure.in 28 Jul 2002 16:33:45 -0000 1.336 *************** *** 1620,1625 **** fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \ ! nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ --- 1620,1625 ---- fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg lchown link lstat mkfifo mknod mktime \ ! mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** pyconfig.h.in 20 Jul 2002 08:51:52 -0000 1.45 --- pyconfig.h.in 28 Jul 2002 16:33:45 -0000 1.46 *************** *** 212,215 **** --- 212,218 ---- #undef HAVE_LARGEFILE_SUPPORT + /* Define to 1 if you have the `lchown' function. */ + #undef HAVE_LCHOWN + /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL From loewis@users.sourceforge.net Sun Jul 28 17:35:59 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:35:59 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.127,2.128 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4637 Modified Files: listobject.c Log Message: Patch #574867: Correct list.extend docstring. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -d -r2.127 -r2.128 *** listobject.c 19 Jul 2002 07:05:44 -0000 2.127 --- listobject.c 28 Jul 2002 16:35:57 -0000 2.128 *************** *** 1632,1636 **** "L.append(object) -- append object to end"); PyDoc_STRVAR(extend_doc, ! "L.extend(list) -- extend list by appending list elements"); PyDoc_STRVAR(insert_doc, "L.insert(index, object) -- insert object before index"); --- 1632,1636 ---- "L.append(object) -- append object to end"); PyDoc_STRVAR(extend_doc, ! "L.extend(sequence) -- extend list by appending sequence elements"); PyDoc_STRVAR(insert_doc, "L.insert(index, object) -- insert object before index"); From neal@metaslash.com Sun Jul 28 17:39:26 2002 From: neal@metaslash.com (Neal Norwitz) Date: Sun, 28 Jul 2002 12:39:26 -0400 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.244,2.245 References: Message-ID: <3D441E3E.21A84F55@metaslash.com> loewis@users.sourceforge.net wrote: > + if (!PyArg_ParseTuple(args, "etii:lchown", > + Py_FileSystemDefaultEncoding, &path, > + &uid, &gid)) > + return NULL; > + Py_BEGIN_ALLOW_THREADS > + res = lchown(path, (uid_t) uid, (gid_t) gid); > + Py_END_ALLOW_THREADS > + if (res < 0) > + return posix_error_with_allocated_filename(path); > + PyMem_Free(path); Is this a memory leak (of path) if res < 0 ? Neal From nnorwitz@users.sourceforge.net Sun Jul 28 17:44:25 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:44:25 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.172,2.173 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6096/Objects Modified Files: stringobject.c Log Message: Fix the problem of not raising a TypeError exception when doing: '%g' % '1' '%d' % '1' Add a test for these conditions Fix the test so that if not exception is raise, this is a failure Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.172 retrieving revision 2.173 diff -C2 -d -r2.172 -r2.173 *** stringobject.c 28 Jul 2002 15:19:47 -0000 2.172 --- stringobject.c 28 Jul 2002 16:44:23 -0000 2.173 *************** *** 3121,3129 **** char fmt[20]; double x; ! v = PyNumber_Float(v); ! if (!v) return -1; ! x = PyFloat_AS_DOUBLE(v); ! Py_DECREF(v); if (prec < 0) prec = 6; --- 3121,3129 ---- char fmt[20]; double x; ! x = PyFloat_AsDouble(v); ! if (x == -1.0 && PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, "float argument required"); return -1; ! } if (prec < 0) prec = 6; *************** *** 3300,3308 **** long x; ! v = PyNumber_Int(v); ! if (!v) return -1; ! x = PyInt_AS_LONG(v); ! Py_DECREF(v); if (prec < 0) prec = 1; --- 3300,3308 ---- long x; ! x = PyInt_AsLong(v); ! if (x == -1 && PyErr_Occurred()) { ! PyErr_SetString(PyExc_TypeError, "int argument required"); return -1; ! } if (prec < 0) prec = 1; From nnorwitz@users.sourceforge.net Sun Jul 28 17:44:26 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:44:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_format.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6096/Lib/test Modified Files: test_format.py Log Message: Fix the problem of not raising a TypeError exception when doing: '%g' % '1' '%d' % '1' Add a test for these conditions Fix the test so that if not exception is raise, this is a failure Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_format.py 23 Jul 2002 19:03:53 -0000 1.14 --- test_format.py 28 Jul 2002 16:44:23 -0000 1.15 *************** *** 1,3 **** ! from test.test_support import verbose, have_unicode import sys --- 1,3 ---- ! from test.test_support import verbose, have_unicode, TestFailed import sys *************** *** 211,214 **** --- 211,216 ---- print 'Unexpected exception' raise + else: + raise TestFailed, 'did not get expected exception: %s' % excmsg test_exc('abc %a', 1, ValueError, *************** *** 217,218 **** --- 219,224 ---- test_exc(unicode('abc %\u3000','raw-unicode-escape'), 1, ValueError, "unsupported format character '?' (0x3000) at index 5") + + test_exc('%d', '1', TypeError, "int argument required") + test_exc('%g', '1', TypeError, "float argument required") + From loewis@users.sourceforge.net Sun Jul 28 17:52:03 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 28 Jul 2002 09:52:03 -0700 Subject: [Python-checkins] python/dist/src/Lib smtplib.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8223 Modified Files: smtplib.py Log Message: Patch #586999: Fix multiline string in sendmail example. Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** smtplib.py 27 Jul 2002 00:38:30 -0000 1.59 --- smtplib.py 28 Jul 2002 16:52:01 -0000 1.60 *************** *** 642,646 **** >>> s=smtplib.SMTP("localhost") >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"] ! >>> msg = ''' ... From: Me@my.org ... Subject: testin'... --- 642,646 ---- >>> s=smtplib.SMTP("localhost") >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"] ! >>> msg = '''\\ ... From: Me@my.org ... Subject: testin'... From neal@metaslash.com Sun Jul 28 17:57:52 2002 From: neal@metaslash.com (Neal Norwitz) Date: Sun, 28 Jul 2002 12:57:52 -0400 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.8,1.9 References: Message-ID: <3D442290.982F9DA0@metaslash.com> loewis@users.sourceforge.net wrote: > > *** 60,64 **** > modname = aliases.aliases.get(modname, modname) > try: > ! mod = __import__(modname, globals(), locals(), _import_tail) > except ImportError,why: > mod = None > --- 60,64 ---- > modname = aliases.aliases.get(modname, modname) > try: > ! mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) > except ImportError,why: > mod = None This change breaks test_charmapcodec: crashed -- exceptions.LookupError: unknown encoding Neal From neal@metaslash.com Sun Jul 28 18:00:44 2002 From: neal@metaslash.com (Neal Norwitz) Date: Sun, 28 Jul 2002 13:00:44 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.3,1.4 References: Message-ID: <3D44233C.91BDB99@metaslash.com> pierslauder@users.sourceforge.net wrote: > > *** 2,11 **** > import time > > ! timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), > ! '"18-May-2033 05:33:20 +0200"', '"18-May-2033 13:33:20 +1000"'] > > ! check = timevalues[2] > > for t in timevalues: > ! if check <> imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t)): > print 'incorrect result when converting', `t` > --- 2,12 ---- > import time > > ! # Can't use time.time() values, as they are O/S specific > > ! timevalues = [(2033, 5, 18, 3, 33, 20, 2, 138, 0), '"18-May-2033 13:33:20 +1000"'] > > for t in timevalues: > ! t1 = imaplib.Time2Internaldate(t) > ! t2 = imaplib.Time2Internaldate(imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t))) > ! if t1 <> t2: > print 'incorrect result when converting', `t` This change broke the test: test test_imaplib produced unexpected output: *** lines 2-3 of actual output doesn't appear in expected output after line 1: + incorrect result when converting (2033, 5, 18, 3, 33, 20, 2, 138, 0) + incorrect result when converting '"18-May-2033 13:33:20 +1000"' Neal From gvanrossum@users.sourceforge.net Sun Jul 28 20:04:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 28 Jul 2002 12:04:10 -0700 Subject: [Python-checkins] python/dist/src/Lib re.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12246 Modified Files: re.py Log Message: Add 'engine' back. IDLE used this, others might have copied it from there. Index: re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/re.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** re.py 16 Apr 2002 01:38:39 -0000 1.43 --- re.py 28 Jul 2002 19:04:07 -0000 1.44 *************** *** 17,20 **** --- 17,22 ---- # + engine = "sre" # Some apps might use this undocumented variable + from sre import * from sre import __all__ From akuchling@users.sourceforge.net Sun Jul 28 21:29:06 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun, 28 Jul 2002 13:29:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv882 Modified Files: whatsnew23.tex Log Message: Add posix.lchown() Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** whatsnew23.tex 22 Jul 2002 19:21:06 -0000 1.40 --- whatsnew23.tex 28 Jul 2002 20:29:03 -0000 1.41 *************** *** 680,685 **** input values measured in radians. (Contributed by Raymond Hettinger.) ! \item Three new functions, \function{getpgid()}, \function{killpg()}, ! and \function{mknod()}, were added to the \module{posix} module that underlies the \module{os} module. (Contributed by Gustavo Niemeyer and Geert Jansen.) --- 680,684 ---- input values measured in radians. (Contributed by Raymond Hettinger.) ! \item Four new functions, \function{getpgid()}, \function{killpg()}, \function{lchown()}, and \function{mknod()}, were added to the \module{posix} module that underlies the \module{os} module. (Contributed by Gustavo Niemeyer and Geert Jansen.) From Jack.Jansen@oratrix.com Sun Jul 28 22:20:29 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Sun, 28 Jul 2002 23:20:29 +0200 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.21,1.22 In-Reply-To: <200207262046.g6QKkkj23905@pcp02138704pcs.reston01.va.comcast.net> Message-ID: On vrijdag, juli 26, 2002, at 10:46 , Guido van Rossum wrote: >> Use os.environ.get() in stead of os.getenv() (which is >> platform-dependent). > > Really? That wasn't intended! What are the differences? The manual states that os.getenv() exists on Posix and Windows. For os.environ no such statement is made. And indeed the mac module has os.environ (even though the contents are rather boring) and no os.getenv(). -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From guido@python.org Sun Jul 28 22:57:47 2002 From: guido@python.org (Guido van Rossum) Date: Sun, 28 Jul 2002 17:57:47 -0400 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.21,1.22 In-Reply-To: Your message of "Sun, 28 Jul 2002 23:20:29 +0200." References: Message-ID: <200207282157.g6SLvlT24571@pcp02138704pcs.reston01.va.comcast.net> > >> Use os.environ.get() in stead of os.getenv() (which is > >> platform-dependent). > > > > Really? That wasn't intended! What are the differences? > > The manual states that os.getenv() exists on Posix and Windows. > For os.environ no such statement is made. And indeed the mac > module has os.environ (even though the contents are rather > boring) and no os.getenv(). Hm. That sounds like a bug. There's code in os.py like this: try: putenv except NameError: pass else: ...Here os.environ is redefined so changes are propagated... def getenv(key, default=None): return environ.get(key, default) __all__.append("getenv") If this doesn't define getenv for you, it must mean you don't have putenv? It looks like the definition of getenv (which could be simplified to "getenv = environ.get" BTW) ought to be outside the try/except/else block. --Guido van Rossum (home page: http://www.python.org/~guido/) From loewis@informatik.hu-berlin.de Mon Jul 29 08:56:27 2002 From: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-1?q?L=F6wis?=) Date: 29 Jul 2002 09:56:27 +0200 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.244,2.245 In-Reply-To: <3D441E3E.21A84F55@metaslash.com> References: <3D441E3E.21A84F55@metaslash.com> Message-ID: Neal Norwitz writes: > > + if (!PyArg_ParseTuple(args, "etii:lchown", > > + Py_FileSystemDefaultEncoding, &path, > > + &uid, &gid)) > > + return NULL; > > + Py_BEGIN_ALLOW_THREADS > > + res = lchown(path, (uid_t) uid, (gid_t) gid); > > + Py_END_ALLOW_THREADS > > + if (res < 0) > > + return posix_error_with_allocated_filename(path); > > + PyMem_Free(path); > > Is this a memory leak (of path) if res < 0 ? No, since posix_error_with_allocated_filename releases path. Regards, Martin From Jack.Jansen@oratrix.com Mon Jul 29 09:33:15 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Mon, 29 Jul 2002 10:33:15 +0200 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.21,1.22 In-Reply-To: <200207282157.g6SLvlT24571@pcp02138704pcs.reston01.va.comcast.net> Message-ID: On Sunday, July 28, 2002, at 11:57 , Guido van Rossum wrote: > Hm. That sounds like a bug. There's code in os.py like this: > > try: > putenv > except NameError: > pass > else: > ...Here os.environ is redefined so changes are propagated... > > def getenv(key, default=None): > return environ.get(key, default) > __all__.append("getenv") > > If this doesn't define getenv for you, it must mean you don't have > putenv? Correct. The environment isn't going to go anywhere for MacPython, it's purely a convenience for use within Python, to forestall lots of special case code. > It looks like the definition of getenv (which could be simplified to > "getenv = environ.get" BTW) ought to be outside the try/except/else > block. Alternatively os.py could grow code like if sys.platform == 'mac': def putenv(name, value): environ[name] = value -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From theller@users.sourceforge.net Mon Jul 29 13:11:21 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 29 Jul 2002 05:11:21 -0700 Subject: [Python-checkins] distutils/misc wininst.exe,1.13,1.14 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv4238/misc Modified Files: wininst.exe Log Message: Recompiled the exe and updated bdist_wininst.py. Index: wininst.exe =================================================================== RCS file: /cvsroot/python/distutils/misc/wininst.exe,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 Binary files /tmp/cvsMotiBq and /tmp/cvsecn9cJ differ From mhammond@users.sourceforge.net Mon Jul 29 14:42:20 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 29 Jul 2002 06:42:20 -0700 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1122/Python Modified Files: exceptions.c Log Message: Excise DL_IMPORT/EXPORT from object.h, and related files. This patch also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido. Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** exceptions.c 13 Jun 2002 20:33:02 -0000 1.32 --- exceptions.c 29 Jul 2002 13:42:14 -0000 1.33 *************** *** 1051,1055 **** ! DL_EXPORT(void) _PyExc_Init(void) { --- 1051,1055 ---- ! void _PyExc_Init(void) { *************** *** 1147,1151 **** ! DL_EXPORT(void) _PyExc_Fini(void) { --- 1147,1151 ---- ! void _PyExc_Fini(void) { From mhammond@users.sourceforge.net Mon Jul 29 14:42:42 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 29 Jul 2002 06:42:42 -0700 Subject: [Python-checkins] python/dist/src/Include import.h,2.28,2.29 object.h,2.108,2.109 pydebug.h,2.20,2.21 pyport.h,2.52,2.53 pythonrun.h,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1122/Include Modified Files: import.h object.h pydebug.h pyport.h pythonrun.h Log Message: Excise DL_IMPORT/EXPORT from object.h, and related files. This patch also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido. Index: import.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/import.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** import.h 19 Jul 2002 06:55:41 -0000 2.28 --- import.h 29 Jul 2002 13:41:59 -0000 2.29 *************** *** 22,27 **** PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); ! extern PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); ! extern PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); struct _inittab { --- 22,27 ---- PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); ! PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); ! PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); struct _inittab { *************** *** 30,37 **** }; ! extern PyAPI_DATA(struct _inittab *) PyImport_Inittab; ! extern PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void)); ! extern PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); struct _frozen { --- 30,37 ---- }; ! PyAPI_DATA(struct _inittab *) PyImport_Inittab; ! PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void)); ! PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); struct _frozen { *************** *** 44,48 **** collection of frozen modules: */ ! extern PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; #ifdef __cplusplus --- 44,48 ---- collection of frozen modules: */ ! PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; #ifdef __cplusplus Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.108 retrieving revision 2.109 diff -C2 -d -r2.108 -r2.109 *** object.h 17 Jul 2002 16:30:34 -0000 2.108 --- object.h 29 Jul 2002 13:42:00 -0000 2.109 *************** *** 328,377 **** /* Generic type check */ ! extern DL_IMPORT(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); #define PyObject_TypeCheck(ob, tp) \ ((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp))) ! extern DL_IMPORT(PyTypeObject) PyType_Type; /* built-in 'type' */ ! extern DL_IMPORT(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ ! extern DL_IMPORT(PyTypeObject) PySuper_Type; /* built-in 'super' */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) #define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type) ! extern DL_IMPORT(int) PyType_Ready(PyTypeObject *); ! extern DL_IMPORT(PyObject *) PyType_GenericAlloc(PyTypeObject *, int); ! extern DL_IMPORT(PyObject *) PyType_GenericNew(PyTypeObject *, PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); /* Generic operations on objects */ ! extern DL_IMPORT(int) PyObject_Print(PyObject *, FILE *, int); ! extern DL_IMPORT(void) _PyObject_Dump(PyObject *); ! extern DL_IMPORT(PyObject *) PyObject_Repr(PyObject *); ! extern DL_IMPORT(PyObject *) PyObject_Str(PyObject *); #ifdef Py_USING_UNICODE ! extern DL_IMPORT(PyObject *) PyObject_Unicode(PyObject *); #endif ! extern DL_IMPORT(int) PyObject_Compare(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); ! extern DL_IMPORT(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); ! extern DL_IMPORT(PyObject *) PyObject_GetAttrString(PyObject *, char *); ! extern DL_IMPORT(int) PyObject_SetAttrString(PyObject *, char *, PyObject *); ! extern DL_IMPORT(int) PyObject_HasAttrString(PyObject *, char *); ! extern DL_IMPORT(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); ! extern DL_IMPORT(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); ! extern DL_IMPORT(int) PyObject_HasAttr(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject **) _PyObject_GetDictPtr(PyObject *); ! extern DL_IMPORT(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); ! extern DL_IMPORT(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); ! extern DL_IMPORT(long) PyObject_Hash(PyObject *); ! extern DL_IMPORT(int) PyObject_IsTrue(PyObject *); ! extern DL_IMPORT(int) PyObject_Not(PyObject *); ! extern DL_IMPORT(int) PyCallable_Check(PyObject *); ! extern DL_IMPORT(int) PyNumber_Coerce(PyObject **, PyObject **); ! extern DL_IMPORT(int) PyNumber_CoerceEx(PyObject **, PyObject **); ! extern DL_IMPORT(void) PyObject_ClearWeakRefs(PyObject *); /* A slot function whose address we need to compare */ --- 328,377 ---- /* Generic type check */ ! PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); #define PyObject_TypeCheck(ob, tp) \ ((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp))) ! PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ ! PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ ! PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) #define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type) ! PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); ! PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, int); ! PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); /* Generic operations on objects */ ! PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); ! PyAPI_FUNC(void) _PyObject_Dump(PyObject *); ! PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); ! PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); #ifdef Py_USING_UNICODE ! PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *); #endif ! PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); ! PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); ! PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, char *); ! PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, char *, PyObject *); ! PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, char *); ! PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); ! PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); ! PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); ! PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); ! PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); ! PyAPI_FUNC(long) PyObject_Hash(PyObject *); ! PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); ! PyAPI_FUNC(int) PyObject_Not(PyObject *); ! PyAPI_FUNC(int) PyCallable_Check(PyObject *); ! PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **); ! PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **); ! PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); /* A slot function whose address we need to compare */ *************** *** 384,397 **** no current locals, NULL is returned, and PyErr_Occurred() is false. */ ! extern DL_IMPORT(PyObject *) PyObject_Dir(PyObject *); /* Helpers for printing recursive container types */ ! extern DL_IMPORT(int) Py_ReprEnter(PyObject *); ! extern DL_IMPORT(void) Py_ReprLeave(PyObject *); /* Helpers for hash functions */ ! extern DL_IMPORT(long) _Py_HashDouble(double); ! extern DL_IMPORT(long) _Py_HashPointer(void*); /* Helper for passing objects to printf and the like */ --- 384,397 ---- no current locals, NULL is returned, and PyErr_Occurred() is false. */ ! PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); /* Helpers for printing recursive container types */ ! PyAPI_FUNC(int) Py_ReprEnter(PyObject *); ! PyAPI_FUNC(void) Py_ReprLeave(PyObject *); /* Helpers for hash functions */ ! PyAPI_FUNC(long) _Py_HashDouble(double); ! PyAPI_FUNC(long) _Py_HashPointer(void*); /* Helper for passing objects to printf and the like */ *************** *** 522,527 **** */ #ifdef Py_REF_DEBUG ! extern DL_IMPORT(long) _Py_RefTotal; ! extern DL_IMPORT(void) _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op); #define _Py_INC_REFTOTAL _Py_RefTotal++ --- 522,527 ---- */ #ifdef Py_REF_DEBUG ! PyAPI_DATA(long) _Py_RefTotal; ! PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, int lineno, PyObject *op); #define _Py_INC_REFTOTAL _Py_RefTotal++ *************** *** 541,545 **** #ifdef COUNT_ALLOCS ! extern DL_IMPORT(void) inc_count(PyTypeObject *); #define _Py_INC_TPALLOCS(OP) inc_count((OP)->ob_type) #define _Py_INC_TPFREES(OP) (OP)->ob_type->tp_frees++ --- 541,545 ---- #ifdef COUNT_ALLOCS ! PyAPI_FUNC(void) inc_count(PyTypeObject *); #define _Py_INC_TPALLOCS(OP) inc_count((OP)->ob_type) #define _Py_INC_TPFREES(OP) (OP)->ob_type->tp_frees++ *************** *** 555,563 **** #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ ! extern DL_IMPORT(void) _Py_NewReference(PyObject *); ! extern DL_IMPORT(void) _Py_ForgetReference(PyObject *); ! extern DL_IMPORT(void) _Py_Dealloc(PyObject *); ! extern DL_IMPORT(void) _Py_PrintReferences(FILE *); ! extern DL_IMPORT(void) _Py_ResetReferences(void); #else --- 555,563 ---- #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ ! PyAPI_FUNC(void) _Py_NewReference(PyObject *); ! PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); ! PyAPI_FUNC(void) _Py_Dealloc(PyObject *); ! PyAPI_FUNC(void) _Py_PrintReferences(FILE *); ! PyAPI_FUNC(void) _Py_ResetReferences(void); #else *************** *** 598,602 **** Don't forget to apply Py_INCREF() when returning this value!!! */ ! extern DL_IMPORT(PyObject) _Py_NoneStruct; /* Don't use this directly */ #define Py_None (&_Py_NoneStruct) --- 598,602 ---- Don't forget to apply Py_INCREF() when returning this value!!! */ ! PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ #define Py_None (&_Py_NoneStruct) *************** *** 605,609 **** not implemented for a given type combination. */ ! extern DL_IMPORT(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ #define Py_NotImplemented (&_Py_NotImplementedStruct) --- 605,609 ---- not implemented for a given type combination. */ ! PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ #define Py_NotImplemented (&_Py_NotImplementedStruct) *************** *** 721,728 **** */ ! extern DL_IMPORT(void) _PyTrash_deposit_object(PyObject*); ! extern DL_IMPORT(void) _PyTrash_destroy_chain(void); ! extern DL_IMPORT(int) _PyTrash_delete_nesting; ! extern DL_IMPORT(PyObject *) _PyTrash_delete_later; #define PyTrash_UNWIND_LEVEL 50 --- 721,728 ---- */ ! PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); ! PyAPI_FUNC(void) _PyTrash_destroy_chain(void); ! PyAPI_DATA(int) _PyTrash_delete_nesting; ! PyAPI_DATA(PyObject *) _PyTrash_delete_later; #define PyTrash_UNWIND_LEVEL 50 Index: pydebug.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pydebug.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** pydebug.h 9 Jul 2002 02:57:01 -0000 2.20 --- pydebug.h 29 Jul 2002 13:42:04 -0000 2.21 *************** *** 6,24 **** #endif ! extern DL_IMPORT(int) Py_DebugFlag; ! extern DL_IMPORT(int) Py_VerboseFlag; ! extern DL_IMPORT(int) Py_InteractiveFlag; ! extern DL_IMPORT(int) Py_OptimizeFlag; ! extern DL_IMPORT(int) Py_NoSiteFlag; ! extern DL_IMPORT(int) Py_UseClassExceptionsFlag; ! extern DL_IMPORT(int) Py_FrozenFlag; ! extern DL_IMPORT(int) Py_TabcheckFlag; ! extern DL_IMPORT(int) Py_UnicodeFlag; ! extern DL_IMPORT(int) Py_IgnoreEnvironmentFlag; ! extern DL_IMPORT(int) Py_DivisionWarningFlag; /* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed, on the command line, and is used in 2.2 by ceval.c to make all "/" divisions true divisions (which they will be in 2.3). */ ! extern DL_IMPORT(int) _Py_QnewFlag; /* this is a wrapper around getenv() that pays attention to --- 6,24 ---- #endif ! PyAPI_DATA(int) Py_DebugFlag; ! PyAPI_DATA(int) Py_VerboseFlag; ! PyAPI_DATA(int) Py_InteractiveFlag; ! PyAPI_DATA(int) Py_OptimizeFlag; ! PyAPI_DATA(int) Py_NoSiteFlag; ! PyAPI_DATA(int) Py_UseClassExceptionsFlag; ! PyAPI_DATA(int) Py_FrozenFlag; ! PyAPI_DATA(int) Py_TabcheckFlag; ! PyAPI_DATA(int) Py_UnicodeFlag; ! PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; ! PyAPI_DATA(int) Py_DivisionWarningFlag; /* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed, on the command line, and is used in 2.2 by ceval.c to make all "/" divisions true divisions (which they will be in 2.3). */ ! PyAPI_DATA(int) _Py_QnewFlag; /* this is a wrapper around getenv() that pays attention to *************** *** 27,31 **** #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) ! DL_IMPORT(void) Py_FatalError(const char *message); #ifdef __cplusplus --- 27,31 ---- #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) ! PyAPI_FUNC(void) Py_FatalError(const char *message); #ifdef __cplusplus Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** pyport.h 19 Jul 2002 06:55:40 -0000 2.52 --- pyport.h 29 Jul 2002 13:42:04 -0000 2.53 *************** *** 406,410 **** # ifdef Py_BUILD_CORE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE ! # define PyAPI_DATA(RTYPE) __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ # define PyMODINIT_FUNC void --- 406,410 ---- # ifdef Py_BUILD_CORE # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE ! # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ # define PyMODINIT_FUNC void *************** *** 413,417 **** /* public Python functions and data are imported */ # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE ! # define PyAPI_DATA(RTYPE) __declspec(dllimport) RTYPE /* module init functions outside the core must be exported */ # if defined(__cplusplus) --- 413,417 ---- /* public Python functions and data are imported */ # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE ! # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE /* module init functions outside the core must be exported */ # if defined(__cplusplus) *************** *** 429,433 **** #endif #ifndef PyAPI_DATA ! # define PyAPI_DATA(RTYPE) RTYPE #endif #ifndef PyMODINIT_FUNC --- 429,433 ---- #endif #ifndef PyAPI_DATA ! # define PyAPI_DATA(RTYPE) extern RTYPE #endif #ifndef PyMODINIT_FUNC Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** pythonrun.h 9 Jul 2002 09:23:26 -0000 2.50 --- pythonrun.h 29 Jul 2002 13:42:06 -0000 2.51 *************** *** 80,94 **** /* In getpath.c */ ! DL_IMPORT(char *) Py_GetProgramFullPath(void); ! DL_IMPORT(char *) Py_GetPrefix(void); ! DL_IMPORT(char *) Py_GetExecPrefix(void); ! DL_IMPORT(char *) Py_GetPath(void); /* In their own files */ ! DL_IMPORT(const char *) Py_GetVersion(void); ! DL_IMPORT(const char *) Py_GetPlatform(void); ! DL_IMPORT(const char *) Py_GetCopyright(void); ! DL_IMPORT(const char *) Py_GetCompiler(void); ! DL_IMPORT(const char *) Py_GetBuildInfo(void); /* Internal -- various one-time initializations */ --- 80,94 ---- /* In getpath.c */ ! PyAPI_FUNC(char *) Py_GetProgramFullPath(void); ! PyAPI_FUNC(char *) Py_GetPrefix(void); ! PyAPI_FUNC(char *) Py_GetExecPrefix(void); ! PyAPI_FUNC(char *) Py_GetPath(void); /* In their own files */ ! PyAPI_FUNC(const char *) Py_GetVersion(void); ! PyAPI_FUNC(const char *) Py_GetPlatform(void); ! PyAPI_FUNC(const char *) Py_GetCopyright(void); ! PyAPI_FUNC(const char *) Py_GetCompiler(void); ! PyAPI_FUNC(const char *) Py_GetBuildInfo(void); /* Internal -- various one-time initializations */ *************** *** 96,112 **** DL_IMPORT(PyObject *) _PySys_Init(void); DL_IMPORT(void) _PyImport_Init(void); ! DL_IMPORT(void) _PyExc_Init(void); /* Various internal finalizers */ ! DL_IMPORT(void) _PyExc_Fini(void); ! DL_IMPORT(void) _PyImport_Fini(void); ! DL_IMPORT(void) PyMethod_Fini(void); ! DL_IMPORT(void) PyFrame_Fini(void); ! DL_IMPORT(void) PyCFunction_Fini(void); ! DL_IMPORT(void) PyTuple_Fini(void); ! DL_IMPORT(void) PyString_Fini(void); ! DL_IMPORT(void) PyInt_Fini(void); ! DL_IMPORT(void) PyFloat_Fini(void); ! DL_IMPORT(void) PyOS_FiniInterrupts(void); /* Stuff with no proper home (yet) */ --- 96,112 ---- DL_IMPORT(PyObject *) _PySys_Init(void); DL_IMPORT(void) _PyImport_Init(void); ! PyAPI_FUNC(void) _PyExc_Init(void); /* Various internal finalizers */ ! PyAPI_FUNC(void) _PyExc_Fini(void); ! PyAPI_FUNC(void) _PyImport_Fini(void); ! PyAPI_FUNC(void) PyMethod_Fini(void); ! PyAPI_FUNC(void) PyFrame_Fini(void); ! PyAPI_FUNC(void) PyCFunction_Fini(void); ! PyAPI_FUNC(void) PyTuple_Fini(void); ! PyAPI_FUNC(void) PyString_Fini(void); ! PyAPI_FUNC(void) PyInt_Fini(void); ! PyAPI_FUNC(void) PyFloat_Fini(void); ! PyAPI_FUNC(void) PyOS_FiniInterrupts(void); /* Stuff with no proper home (yet) */ From mhammond@users.sourceforge.net Mon Jul 29 14:42:46 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 29 Jul 2002 06:42:46 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1122/Objects Modified Files: object.c Log Message: Excise DL_IMPORT/EXPORT from object.h, and related files. This patch also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** object.c 11 Jul 2002 06:23:50 -0000 2.186 --- object.c 29 Jul 2002 13:42:08 -0000 2.187 *************** *** 9,16 **** #ifdef Py_REF_DEBUG ! DL_IMPORT(long) _Py_RefTotal; #endif ! DL_IMPORT(int) Py_DivisionWarningFlag; /* Object allocation routines used by NEWOBJ and NEWVAROBJ macros. --- 9,16 ---- #ifdef Py_REF_DEBUG ! long _Py_RefTotal; #endif ! int Py_DivisionWarningFlag; /* Object allocation routines used by NEWOBJ and NEWVAROBJ macros. From theller@users.sourceforge.net Mon Jul 29 13:11:21 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 29 Jul 2002 05:11:21 -0700 Subject: [Python-checkins] distutils/distutils/command bdist_wininst.py,1.33,1.34 Message-ID: Update of /cvsroot/python/distutils/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv4238/distutils/command Modified Files: bdist_wininst.py Log Message: Recompiled the exe and updated bdist_wininst.py. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/command/bdist_wininst.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** bdist_wininst.py 4 Jun 2002 20:55:10 -0000 1.33 --- bdist_wininst.py 29 Jul 2002 12:11:18 -0000 1.34 *************** *** 262,275 **** EXEDATA = """\ TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAA+AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1v ! ZGUuDQ0KJAAAAAAAAAA/1p0ge7fzc3u383N7t/NzAKv/c3m383MUqPlzcLfzc/ir/XN5t/NzFKj3 ! c3m383N7t/NzdLfzc3u38nPzt/NzGajgc3C383N9lPlzebfzc7yx9XN6t/NzUmljaHu383MAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAABQRQAATAEDAIRxcjwAAAAAAAAAAOAADwELAQYAAFAAAAAQAAAA ! oAAA0PMAAACwAAAAAAEAAABAAAAQAAAAAgAABAAAAAAAAAAEAAAAAAAAAAAQAQAABAAAAAAAAAIA ! AAAAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAADABAQCgAQAAAAABADABAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVQWDAAAAAAAKAAAAAQAAAA ! AAAAAAQAAAAAAAAAAAAAAAAAAIAAAOBVUFgxAAAAAABQAAAAsAAAAEYAAAAEAAAAAAAAAAAAAAAA ! AABAAADgLnJzcmMAAAAAEAAAAAABAAAEAAAASgAAAAAAAAAAAAAAAAAAQAAAwAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --- 262,275 ---- EXEDATA = """\ TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAA8AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1v ! ZGUuDQ0KJAAAAAAAAAAtOHsRaVkVQmlZFUJpWRVCEkUZQmpZFUIGRh9CYlkVQupFG0JrWRVCBkYR ! QmtZFUJpWRVCZlkVQmlZFELjWRVCC0YGQmRZFUJveh9Ca1kVQq5fE0JoWRVCUmljaGlZFUIAAAAA ! AAAAAAAAAAAAAAAAUEUAAEwBAwAQIUU9AAAAAAAAAADgAA8BCwEGAABQAAAAEAAAALAAAJAFAQAA ! wAAAABABAAAAQAAAEAAAAAIAAAQAAAAAAAAABAAAAAAAAAAAIAEAAAQAAAAAAAACAAAAAAAQAAAQ ! AAAAABAAABAAAAAAAAAQAAAAAAAAAAAAAAAwEQEA5AEAAAAQAQAwAQAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVUFgwAAAAAACwAAAAEAAAAAAAAAAEAAAA ! AAAAAAAAAAAAAACAAADgVVBYMQAAAAAAUAAAAMAAAABIAAAABAAAAAAAAAAAAAAAAAAAQAAA4C5y ! c3JjAAAAABAAAAAQAQAABAAAAEwAAAAAAAAAAAAAAAAAAEAAAMAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA *************** *** 278,615 **** IHBhY2tlZCB3aXRoIHRoZSBVUFggZXhlY3V0YWJsZSBwYWNrZXIgaHR0cDovL3VweC50c3gub3Jn ICQKACRJZDogVVBYIDEuMDEgQ29weXJpZ2h0IChDKSAxOTk2LTIwMDAgdGhlIFVQWCBUZWFtLiBB ! bGwgUmlnaHRzIFJlc2VydmVkLiAkCgBVUFghDAkCCqI5dyI/g8/W3dgAAMlDAAAA0AAAJgEA1//b ! //9TVVaLdCQUhfZXdH2LbCQci3wMgD4AdHBqXFb/5vZv/xVMcUAAi/BZHVl0X4AmAFcRzHD9v/n+ ! 2IP7/3Unag/IhcB1E4XtdA9XaBCA/d/+vw1qBf/Vg8QM6wdXagEJWVn2wxB1HGi3ABOyna0ALcQp Dcb3/3/7BlxGdYssWF9eXVvDVYvsg+wMU1ZXiz2oLe/uf3cz9rs5wDl1CHUHx0UIAQxWaIBMsf9v bxFWVlMFDP/Xg/j/iUX8D4WIY26+vZmsEQN1GyEg/3UQ6Bf/b7s31wBopw+EA0HrsR9QdAmPbduz ! UI/rL1wgGOpTDGoCrM2W7f9VIPDALmcQZronYy91JS67aFTH6Xbf891TAes7B1kO8yR0Cq3QHvkT ! A41F9G4GAgx7n4UYQrB9/BIDvO7NNEjQNBR1CQvYlgbTfTN/DlZqBFYQ1BD7GlyE2HyJfg9hOIKz ! 3drmPOsmpSsCUyq8+b5tW1OnCCWLBDvGdRcnEMKGNuEoco4KM8BsC+3/5FvJOIN9EAhTi10IaUOS ! druwffI4k8jdUOjIU4JFsnzb3AwvUMgIFEBqAcz+c7ftGF4G2CVoqFEq8VCJXdS/sLDtLSos1xw7 ! dGn/dChQaO72+b6QmBlLBCtMjnQTGnOd+5YNfIsEyYr2IR8byFn3Kdw6Lh9kQ+2w0VoDxUUSPsgP ! 3ea+U5d8GY1e8KQUxuPO8GHOgewo4auLVRBExv/tf4tMAvqNXALqV5/gK0MMK8GD6BaLG//L7f/P ! gTtQSwUGiX3o8GsCg2UUAGaDewoA/5v77g+OYA7rCYtN7D/M6ItEESqNNBEDttkubzP6gT4BAjA6 ! gT8Lv3Wf7QMEPC7BLpSJMQPKD79WbY/dth4I9AZOIAwcA1UV0W370rwITxyJwVcaA9CbEBYjNP72 ! 6I1EAipF3I2F2P6baZShezdgC47dgLwF1w9cMseY4VkYaLATHYhPFz4bMyvtoGX4hoQFtrRhexFS ! 5PaDOMA+Cn5jL9vwDfzw/zBSUAp19J8ls9QN1kgPEMoAds79Dy38/0X4g8AILzU9dcixzs3eq0ca ! UGU0aFgzwwbysgywBXitsO4bbpp0SqZmi0YMUAQOQ2uuseF2ueRQVCyrR/4a3EclIicbCBt2FFEw ! z/bbDdxKAfqZGNLu7WPbmRjJFXlQKUMKUEPt9tzGagbBGLwPtRQ5Aqnguu4PjE1h6ZFw+7qmgLnH ! fjTIjRzIlv9zBNSoZr+524g3XxrwJvQDyCvYGZvkEBaz/HYQKt4ugXAAL1mNTwT72/aKCID5MwUE ! L3UCQEtT9naGpSA3W+A6oQQsbjxel3jrA+quXCQE8X/fGgcRO4TJdAs6A8YAXEB177ZvdJzILFxW ! +VaJdewC8NyWZVno9Pz4VSxyx7p0qU19CylQgoAHBm6QrUtF6FBT8OwDHGZrmuDk3CVEpTs8PBfG ! CLckYEGKubmt5lJsyHQB7rgH74ZMslo0MN+NVfhSQM623WjYIIsI1BEfECFnP0O9GVFQGggGeTIy ! 5Bz4gTnSjIzd13QYH+wsCFgDt83o63Ic8HTB6B9sz8nI8ETYUjz0PCdjg/QcJMQ1joZrLqLU/QTg ! cr83zlaB4BsnVOaNlZZmbHsb7lI2GBa8Dg7PZv6BBCC+zNzWuiYrUCMiCGUIkGzBLBswJ7Qo4Msg ! sPpeREAMD3QXY7s22XMUAi7wceoIx9gLrRaJaMBXUBTsEP9m28DYSV0MDNxqCplZ9/kzyUNrs+Vo ! YIJRAB6T/lb32ToJULlEPTAFUO9utgba1xreFBVAvoCjtAWO4ZChWVD/DwEJprsLxx08GP/TaHTy ! 3tcO7DhwIwoBFdOpZ850D9VfNJ+e5Huj0TCdpp/CEADaLHXftrgABgA9nOFOlpS4LcPWgQkQW/+s ! DIbvFkypeVchCPChNLgTxbtNHdIU6WhyImgBBAD/STv3JsBVBvxxNAk8xwQkQLY711xoDKkA8Gz5 ! 6PhxOt6wNjX0aRoPA+ZgDf9B1mgApaP9DKC2etfbyAAEX6xe6yckgXgIOD3XlfiuGQh+cB3R7q+Z ! 73Rc6CnVgz0sp9T4bFtYQgg0dTke22uvKwMpzH/FHUCL4QYX+FAKjUgOr1FSiFFWRrLBvWdIozAs ! ViRyDdJwwl78EN7w1KCwRYjD1yjWrIlWg9ZuBUtvP6VG4630ESvQK016TO3A3+ArVfAQUpkrwtH4 ! mBVkhNkGYccNhcTo+uVWIoN8An4GuOhtw/x9bFeuDggCDH0FuLgTuAwRIVfoIJ6LhLkL0DcXuIHk ! TlfZ5QK0JCALux92E4stfy3CAPQrSLYVdrfpDEUuKL/+C2Y7xxR+tNvNAMHoEB6EAU62DQohIQ0R ! z84QC7g7ZnjVu/B/OlNoZoBXVtkMB1nb0A0ZvBYBnenaAEZIixnVwtALbFiJABB0ElfuYLtY8khv ! aIYZi8N01xp07zSAPWWxU9zGfZjOJeOEgyZMFRyhjeFmIWk3fFHPJjlkbENAKSBAsVs4QOtKEBdq ! EHg+dK9QHknYwx38A8aC0c1JX9NDw4iwkHNBu8S1TuOvpazoKEGRvyyi+nXINrZo76PTCPAgCNJF ! wj/3CrWRwCI4f3h21nqD3XYYaJl4uz4ONSXbbCuFU18p9I5MN8iKQEBw0xRk7AhvWlAeibFgeCql ! SiToR4LfJluM2xwgbN0CdR//YmasvTUhBSLYrmi27hBEEDAQDGjrwNqyV0DrzZc7FNrS0/abDY2D ! jzUkulnwCih3Et0Sb3R8BBdAERMYW75g3RP/dwQTHA4KWUzHSxbx8OtLySzCB+OQ/Tv0M/9XV6ew ! 4TQ7aP4tA691BGFNuLWr6yADV2AfddrlKoH5gcRU7U8snf6B3AIm+FMz23dggbbjGQAC8RyEKb38 ! G9pIR1wccCEHNrgOceImTLRTAH/+RZjH9sSBZoc5srAMJ4fWWSAx9R88rcJHU9DgJkU/EwvcINg7 ! wy/VOBg/jcz2auxNmFHy0os2nHg2F+hTUC9I//SD1tZWLfbDEGSrAe5pnm1w1xzoKfj+yGZnay1l ! YuzHe5GszSCqxjROzLK1c/D9ABbwAHVu9sYIEB8bLLVZXcCG3TfoaJp09xj8sYJ7YPKEG6BYErca ! uHhG/Vu3BBDlBuQlDBDUoeGarp+qdi3xArFNIQgNW27B19kkKnIE1euwCaYzECjbHf0e5+zsGCAi ! ZhTr7Gm2wXahEMolwwFFhBzWCevR9RofMZiwJGi7qpj2ciWshFELj4DhR/5CeMiLhItACD0xEZLc ! 9rh0LT2u2kZh72YJI1idlD271anZGBi/9s01DAYo5Z6RmLgfCnbZICMVQTVXVxxKScfOoBQVLYtX ! oMVrvL2qjFjFbWISBX96XY0ixi/3+ygAtQVko1VnAsmv5hImw3y/qzdAot6NTt2jMEq77hdoaELe ! BPfN9UJUDomrdBBw4RG58BRq+51VjtwQ1zx4VT2UnSVWyZtIO2g4ozaYo9aF9iqyRlZDIZs6YNRd ! vQQQL9z2gknWWByldO117miMhQhUeAf3CWxzspngLgpY+CgnzUlI/Dj0TbXcDYQ1KPdAxEqWt1vw ! O950Q5V0PgT4dDn8bcBHDbCTL+Mre7cEC8s5b2ArD5XBiVuxG6NtVQLTE/ywEYTyVm/NKMEU+IvG ! C4PI/5necitnUAGhXwlG1wytanIaR00GMYNH4f8EQev2D7fBweAQgn6jgzDGY7u3l1MX12yX7NNW ! vRZWVRBBFIuxiMSlQi1WkQDzG27xn5f32BvAg+BMwGOPGP8gyTvcNv8FzCBopIX3A9xHm/+UJHQv ! KnQEJmG32AHtKjRonCyUC7A0LCwDvRKJEtyyGYCILMDBvX3SEYt2BJR1hItSs8I7qzf99gDU2+iB ! zdZbjhAA/NMMwo3Ud+tt7MQIkX1GdsGnBukAm3R7rJvbsgJeIQ+F/qEktoOFzxPima4IhhN2TmE4 ! 4GheGYBWJePwyByyUGe+luzVLldpEKg52MoP082Ti6zIFAb73GbHGWowG6yGQCByBloE+xrYVXOK ! 7jzkTviG7DvoQRUu6yPMCIPgeUdBR5wEXh/+dTbEjV+wO2Hd65Z9dppZwaGETNjrG1fUBUxiKUdY ! 8Qj/jCPwMJN2vYkGaTBGu0UQRgQDIl5+CzeWfN1WOWK+CnQ1aK2jF4JNCFD+dQXWQzhLmRUHYJjE ! GE26CG3kt1zMJMR2uQaIHSigHb4W7J0r8KQSVhtmQy5J5BB6IIZMHSIbIQAx1NfaLP28AV50JHQ9 ! IQcMt9v4AnQ4asSoLWgwBFNvrZE42NsGFAQHdc1ipYbYxwUq8+t+PnBSrpVq4FGuHBYN2ND4GJtX ! MwckuIZmqbvk1kMfCjJ35h7fGwnIViKUM6Jx69sBYxxZ4sFWor8GzIAinyXc/nLk2IdDs53BDdRJ ! eKOqO9KRiSYfnJhxD8wtzAbTBWKkLTgdIp0bBWMplNFitWeYFyRGLF8sDHMNfzART0h80NpcqEQ/ ! dt8ok8UpB9SdpRkwMN5hFYQ1n40ZzGYcYSL78AIDs3jH71asnRVKBUFcUACMmp09MdUUXRsTh0TK ! nshgX/2DhJ0F+33wAXUcPYxIwtHMAY0K0yCMBsKEejhWNnekhj0YQImALIdqWWwJy/wYLxRpbpgN ! yAxXHrZo/IbmkjwQsPiGVC42iQXM/P/sCc3ZyMbIkOzBjEA1D2B/h/4DaMyGpRxAvh3ZgL28F6pW ! plYgBoaVonkb4NYlm4UUEVbQTALNJ3iShoTvAZMABFfw1dxwGZngo8f6zBKmew2JPQ8pv+bcC7N0 ! U0SIALe3o0aN3NAe9JwTYnUeNgn4DOxlGeTZpKwQkIiIZIg1O1cMhY7E6utoxgaNGFEHcTdgbUSI ! kRArG4VTfhjjs9S4DbTasEfBQL+KsdCeKFFOagwGyY0CLVSSSWiIM9zgDaE1uiBQbinGSAYZDFj7 ! sa/j0H/nd3JnFBkVbvaK0w7bnzbo2aDuVHz4eB1u15496B1qAmCtGjCKWyI2i1deeYCsf7RkCxBV ! 14oKcg/3WqZ9kDdVIzpDOAU3S+5sM9oYnZGoNxRnOdj7GGMrhEIogKQ9Ji3CFycxUCx1kgSiu+KH ! Ww4y01s963d00SJGpCYfFYzcMnI6pSehHq25RaowuBNM/dg2EsNRe1YvACpCCPdoX1A+oQIj5AQA ! WAmdQA4YdIlO3SV0NmAK8GTsFUjSnHQn6Aow/CDQQzZ09JoQifyI5UaLjHn4ibzRAMgysmwI8Mjs ! v4wsI8votvyt9CNbIbOkoxCc+Oks9CyTxgiLLDfQTXGJHcA7/qMRdHmANuGVtj8EdPtyw4IW7iXa ! WT6LYGjkE7/fAoZS0ueIB/zgbfhUH3QXMhiBEBWmrWuAXAhWCfTAD22lnhBV8EME7PboMDA6rFM7 ! FAAYjEBjVwySViFB7HVyNfxRBeCF5LkhhIn0EdCkSMsbbpJWfCc26l50pnNZrcILd3B0vGoLWc+N ! fcRcLL1B7fOrBlnwq6slZLRtbAOhDKsakBOMG8q3HC1jCFYbwDAAANpa8dQvQsguHNzW3g45XQMb ! 2B4YBwZcYXjozGtm1vROxu5M5ysSbCDAGUAZ9MnJk0tteB74Odp5cm6kJ58jNkfd23+MNFx8mAAF ! lL/dspmrBayMf5Agm3W0vuq2bAK8qA+kBAoklayIUFzE3dNWMFzgtrjJcB69d8EGeBm2Vbu8UFO+ ! 1+5hwySK7xyKwdcYEGpbe67dA5I+HjVuE0HasiU4VXYUKA7abNgroycjPcEm2yurKAh75Ns4wS1s ! CXCJFdU7IWPbZKIU6JS2RfuWHLkKaPDYiVtAFdAwtxnQaMQEGTbZDnz6aPMytMNciENPulCjZaEb ! 7eo9zsDWpDE6wdm+YY4xW3QHUBNoUgf4JgwPNGOrvW3V5AAQGlYaV3RvLyq1Kk6YoMbe/kL9ZoP/ ! AnZhC3VOikgBQAgwfEr9X17eBDN+Hm50DHJ1O0DGBg1G6zM5an2LBgMKRk9PfmX7SUcbp1EXoDwK ! dQUfA/9m+E+IBu0G6wWIDkZAT+qReLtSmTJrgCaoGRQMkIQo2jbVx0dufMFWRNgD3EMXQBlcjg1L ! 5OADAH/KfUycQaFSFmgb8BjmDARMnti7ZFshCtWqUGbjJQB8LNA1ZncXNVgZOI7QwMin99jvDAMW ! bCyKClZz0UYH2IzcrcYRZs01KmjlBAst+9mgleKumQTwagMKCat2pggGDHLNz5LJVY+s8aQELF6N ! MIdBOTRpbmekfqD9sGNNBnuMEazNNR2INV4SitlyJDPxnju/lBBJEcHe7G1SeOAQRR2FYz0X6QdF ! akQlhImR4qheVsWCILrmRmo5dtSeThxQbrPbC4y3U1NEKlNmtpONFk3YKohDj4SXuyOeAPFc1moP ! tkid7QS0CnINtPdtI1s4uOws2AjWLDCEdzYTdDUjgUhsfodMcWpbJbiW7lu1hduFQ2pdUw34/wAH ! pV88gCcAR0WiQ5ZqfWEDgDAqCKNDAalTJsWzQrrJcwhwCGldjpJDhj0tBHjRRkotOmHuVi8hfXUC ! uqFADvTzwP9GgzgBfhAPvgZq0qRZ6xEd/84sSogViwmKBEGD4Aiv0BkI7KRWwF5PkExY8hR0FBNi ! ufwgEjPbWTvDEUBQI1DZRbpvO/MfI6x4uvS2iB5GRyChkvzevFEHnYQtjFN/8MyK5MDo9PSfJDXJ ! wcilayRTUxlNxhYpDCTbGb1amADwp3TqKGSgGQP66VZJDuQQ/FY1QRrkktbWCGooRqap+BnvAXII ! tUn7V2D5CHr/fk+InDUqOJ0FX3QaUzoiDNlpubin/DfwMDSJWLP+1laFhYp8HAhLwfXB1FfAQ13s ! wFMS7BqoCksJ/GyMnGGzsMA9PQwwjHYEgTv0jCUeVB4DG27DIZjMzWx1Fh8+As2aPFONTCc3aigr ! 8BbZ83Ao+3ULAiJwmLndGSXP5csF5r6aPBY0kbOQORRGgNlbHyNZHeFePmKPjhWENesaxmzIgZMW ! GpgIpV5ay07rxEFHBSSD3gBSosNbi78KiQSPQTtNKAl8G4MKm2myfYPDKFNXs0SvjcYwdSAzrYVV ! E6oJrmAzXCTBusYj6Ls3nzxMPKhbEKEIlhyMrQVJaCKLJpE/XSw+gtOP+F5PjrV4eIBBgmxFAu4G ! pLutoZVfHv8wUw8NbKxgzzOLGNBByFj48PtH9jvHdUUuId+7G//CddjQtHMmo35jxYhCMpKgpa1A ! mK0v5roWCA4sspmxMfxetDmwRkCJeJxenpEDEI+i9Otlfw7kwCmICCC760LkU3JgIXQhJesg4edA ! DmAHIi9Zu8iFQmH4bceN0f77zmCMoGhMBYYUEUsJKdrVlQ78gpmpVP06XwMSb2W2GmgMi6cULPnN ! 3OsbFh8c6IoS32A000AW1BZq8oSgtQtdH5fQwyeUrjC7BQzAWT1xiKXDgb6brVZfJnriNKxoTlUo ! 001x6BNZo3PYDmjcib2g1bO063vy7kFox/MpUIuCoyiA6WuLdxAc4uthUygO1ynWvhIQ3AwwDn3F ! iWg6I7opP7kO1/5hTB9AdBxqBsBn1+rpwpAwWWio7wU8goHRUDSaIiI0AuJRT9Q5ak0EVZcIgG3R ! E4wEqDCDxCtE6SBclr2UDOIAH4FW/bAdxBOtNRulBOSogSAR10MwsFiqps4I84iFwP03i1UIGjdM ! A/G3F70rQRACDIPoIoE5t30XsHGNNBAIw4c+elY0Eq3mJrMLt1qMrwBOFCbg/0aGDYvWK1YEK9GJ ! Fcy1sVvBK0YWELtX/gy3JAC/gIkBK34EFrF0d87ozhb+/JucVlKhqdkhFhbnjT+5pjobmBs2IHbI ! gWAFrSLy0ioO4W5Bu3QuFxRBT/AgouakwjhsjLTrsPTtoj+GDUZGzABPM9Iv29/+O8JWdDOLSFLK ! dCyJUBQCCBiLcW3jUv8M994b9lKD5oyJMcQcICqciN0UUUYvrNC2YZ8jtvS40QiQAHgDGordCJ86 ! i0a2ZqGBczMeJCw9FG7ZNeoNCoU/PcwIHi3dRm8aKFBRmCQNxwBAHwHMAFTpViK25qs4UveKAQ22 ! fy3sBjrBhudifCQYOArcRuxdHIl0O/d1Cj9Vidb0LWQgiX4Y1gpgOG6Nb2JP6n4oOX4kiw4kcCJc ! Y2eBahhohCfp2uajJ4mGPvxMJP3uL/wQiXgUi1YXz4l6DH0MtPfZx0AMAf7r3v54+Qh8WQQPf1Qf ! uBHT4IlKEO3/wtZS11E32hvSUPfSgeIgTmXrItynUoUwLBnYQU8texH/Vjl6FHUPg25ks+7wDoyf ! C1YbyROWjPBfuPppEHGArSrPU1UQyQRFd4vQhXYK+QOhPjdRWC6A8ANUI6v6BL/av++q+wGVw0u9 ! BcHj+4lcGd4F3x6JCMgND4fEdCSNcD9GsxUeGQS2PYhJHnxrO9qJDeZBiy8Fiw6KEYW/8W0cBDUW ! EASD4Q9CgArmBef+iRZ0FccADVXdbBhsjcbtu0t566Iii1AQwekowQhdHUwO7HYYJFgZK26er7WO ! FwW9BBFIM8k1fdsVjmYIQHaLXhyJUga80fa4ib0fAxOJKkMEwe69/0uPA8H39YXSdCHHA1aU0fjk ! 6WLdX0Bo9sEgDTub2yWBYykHJvWj5Ygc2HjaMNzY91bBZqRp/XUYowJVaTBDIfNaLIVjNrttbQKS ! IgFPaQJzoEhLwaUzjUi1Uh62js25EkRUDPkL2AxnXvLNOeMILQJjt+ZeMOTt4UrcweHZ2nONGEgL ! 5Ek0CbUbvi74UVaDSEKJBltXKIw6HBSQgUg34uSSAfsQA8qJSDkKvi4ZkosIC4Q35mZLNj85SDRD ! hGUOEjbr5ciBYDYzWekoIdtACKRoAm7Zpvp1CYvHmsIIp2cstINzcmpjpBZQB9idyUduxwEDORZp ! uCWESE83igobUMiRs2Xh0T5WAgSEySQHDtIgEkbYIYkosyHbhYSQH3hOMPMGlpHsNbj4O2mzgmEa ! LBhwANsKy2YlagD9DENuyZbkASn9BnK7/WI4C6c7TB48AxQ+Zts0zU6NyBQ/F5Vl0zTbAj0DN3Gr ! TD9AEniZWFt/4HB78dNX+Xo8iUPY2kKt9dsEDwQFNnijtVO+60coUq1XYNdbB8p1BnUNPldRu/GO ! bOpHbCjH8gFGNAKtBYFtMA447lEIunAFnyB0DuS50JCs7dYfYEcwwMPfcw3oK/xtagpkY0p8UaIg ! xVD23+H4Qg7IDk8oaKBJFDjgCswaX9kwK10wl3pXKIyQBugeY/HDckBTHzoHzWAoKB+fK1HCGjh3 ! Hi6iNtYtoEECPgPYHkNitvCJXiy8OMgE6GUvFkSqAIPsQGvRfZw4U284XPu4tcbWKUOyaxJILks0 ! 2+KbC5AQMFY7yLdUClxb/l0VRHMFK8FI6wUsBx7w5/IFjAOD+AkZDIWMTUBEDuB/2BiD/QNzPL6+ ! 4XoyMJYNxuRIig/H7u//2xRMlIvRi83T4oPFCGML8kcxVXvvuok4iS9yzusEN6/f1AK/wgeLyNHo ! tQGbiUsYd5E9C9x0Y7SD7QMZAc2DTe+/HAfB7gPT7ivpP7MxHkEW2iagSIZSjbCEjQ2f2N0NMFEO ! OFLOTnwkXLfr6HUhNPjhUQ8sUhCg+0CJ3hA/fBSJsefMV66171xYcZADi5kGYRQD8dYd3vj9WBTO ! IHMsQMO5dan6+qAGP0wG91y2LE/2fEAnAKmJC23y1JGLzoLhB/5b4F1y6hAz0a+iOO2LwTvFB+nW ! 3voEiWxcSyYBi4kDuW2JYelM0he8Kq4dNtHHHAWFnRZ8GvGubvhEO9Z1I7+Leyi0GYvXO7tQ+K6x ! FXMHK8JIV2Qr8nMKXXdsiTV1Z7RMQUgEtdLBhf5TNBhOB23WfbFHMGrWo0w6MXuOtuErykn/SywH ! BD5VPsjId3UgYvfW8k6LzrizTW7Ci8ikXrCw0DBMCwXJdtY0dG+dwjvBBcE+FEQw0P0ShSSBAvOl ! i8otHNsdHr/fAyvQ86TaXCVEA1Ku3WjbDUtdFfArDBZrwdCZiXgcKQFoXQgjBJtkGMgHKuRAHmOW ! DnM4Mj5kjKsOktIl/z+yxeboJcggmB+HHXfHQt8G1tA84AiB+qAFsHUUNxPyBS0FfR8356JvRo2E ! CAKKdwNIKPPZOEv5UGEMjQWzgPnGDkgOx0MISgMbTWPv6wiucVOSCBEK5+lCo4NiLXNoWTIwmUp+ ! vjQGA5noiLQsCE6xi/zB9mMDRksMxQSRYQge5gqtCAOGamdymCZ7P+wwuBOhyHMhPDTHmyu81zFp ! NaA3IHKlL22n33AaJG9DEI1TUbQ5Q4NSNFfx41DsSsHZUUeMRfCFIcJCts37COYFTxYMH75l0DTi ! Hzc1An078XZdD4N70lk76HMzW3s/HuNKOwXr+vlKITT3Xpj29PkHu3Ssufou+c2LyciguebaO/gU ! I8bmVMEBjeY0dtvdVoO0VRCXNHMbySthwbW26tEMRYQSinF+tx2uQKQ3NuAjErnNdAMSj8cXAfKD ! 6BLNWSsP+0vuJPgLH8ALO+lzO5ngBA6sWyAfMJ3pnWuPRsnsfHdVi9Zeo98MjakjziYOFGKnxnut ! 1JAb1xU/ncsIHOGMCh4D0DuUe71bKoepddMqLtQosTkQ6ZnwgpOFby7mFQ3aHYr86wIA7eHbS6gM ! QUiZj/x19XeJXpeJAwl6goWYFRod6LZAJCZRUKbr2IyZ3wksJFESUjwV/DVcNjs/UUIFILJRwHhr ! zxSywzxrZQkHQAYPTOydND3OJB8VTCTa7KPJChkIJTTPd9v3NOA9nzwgKxx5UHnuGAKkToRXBAQP ! sC1kBilID3OL1sICXms8MJfYfN3qYgTQK504A1ZM0GoOXujOTe5rdOpr51G8SbF7V6KZZ0B0Vl22 ! gIsXZ1QAHSeZQaLwTT4NIxikiUPBsSnMIRiB+VoJidIAOJhLsiwAoZ3Pi+22XtsmaJqW2umVTFEE ! WnOvd4XaF7CQsNshl6EzBjDD4DNtHNpRXGH9yzM5N3t0GOi5VTnyMtgPv+TXav0r0cMD6lBOS8v2 ! ZFdMjTGLaTlR0BZhcw0rAWaS6i8VmyWQ7VJROkOFMrW37Ftqx0EYyINLRhDmfqxASEhRiXkERkQm ! HDjCGBFLIOizswiu0azyhKeEJLA3CBVSyMZnwMV7VMrEAM6g0InPOUEEk4rcM7i32PcD7oNRT9FL ! MCUQWLhFPoQFQxOfz55q/FAaCiEQlHmQpCi8Q0qMzysjgRRIjhidh1E2e/11BlulTx2DLbJRqDrX ! ImhbRoRklBR8nmtVxgi7kSAcuKxS3VAGNXAvIc3PiNr+Q6yQSYH9X4V0LgQkTBALJByw7BhShD6k ! sEcoCTtnKyVvXEhQUqYH7vB6vQxApmbnQR5ZTuhQVlN0S1PRdDd9hDb3oXvoIDcuiVYEbEuVv39Q ! K9WLbgjjbn0+OEC+lWYIGBa+R8YxQy6Lx0xWVcVNtgatY0NLVkLSSyGZO50wISAdmKCXyCQwhA0Y ! kVOsfTUhT7D+RUPRU9hrSCpD/zRBctlsS6RCA6DLQ3pEbJbL5WFFsEdXTL4CTQGbZbeYJ7ZBGJlI ! BrikmBvvDKLAAS5Fa1ZXGKdwpShHWGndXqNcgItYRigYDQMc4PwYCFdj6ZBqLLBPt7ueATdi7911 ! CuzCDHfvYoHHXPnbD4bvEVWB+3fxe8ewFZnDcgW4CCvYgg+MobdoxR+t6MHt22EQiuxdFOIWg8Yb ! rFbxA/kIQw455PLz9A455JD19vf4OeSQQ/n6++SQQw78/f7BBts5/wNNvGRtnasqn7kVFhJGu9sW ! tRNIWMENufHy9/Fq230bTL8IizX39+uLW8XW3fWHEzFdF1s+X35MgsMLwQiflQhQLYSyCW5VNlDx ! Lg3UHwh0UwTDD1VLqtEfHKE33BVqNBmKT6NFiFAQ0BuBd1oMiEgRdQAAD4cBdw9IGMPfFH8gYWjh ! FXbOA0ZL0FgwkvBWyNputbC5aAzBDDTBfvZpmnDFvBDCRiwHAwr0wYkzTTrfoY1fcf4GbEhXTz0c ! 7Qi00BqdzhAKCv5g5KySbChGeiyJfgJbuVo7jCkrIqW21dJ7rfmFiQZldCtUS9xVl5RWUo4BG3Yi ! TRFPVRB3T9xWMrun6sijfhy4SCJcZ7qdKA1ArjUayOc/ozByW73R/6V0E0n32RvJGQKDwe9NEn3u ! F2E//WZjEL+NFUu1ErZFskUrHlZvWPhzREBcBLqKXTwXDrXtMACX3Avwso7P0+DQAMcId+3n3AvI ! NnngLEE/CixyvKr7zkauhfgjIAhfIxhbVshJGNkU0/o1wqPouG7BRSv4IvEWXECKAcUWi0mP0WOm ! 2ZUIBq+oEHSxVqK7u+AProuvBSLbbZN0HwJAr0XDqCAHhpw5aOMnHwc+c0jngtpCGq9IGxaw99x5 ! 0OfYmZOP5Ai+iwRMrbX2vrlNBAPIzq2RsNTb2sx0cgPX00AY9UgwGJpFzGVeSxhFcpYDRAPSMAlk ! DEQEhQg3C4bwUmUMjQzBiAHyACFB2ALIIYcMDAwFhwIUGG9+A27AsQFrFdV1A8Irc6Ym9TdA1h/t ! Gl4h2iOWsVoBqsTzo9SFlywtQWmzfY51IT4wO8ERe3BSqVQtKQz7COLUEWHrD39nhqRJlDYUUoVy ! YiRDZmQ8DG1iN9jJDV1jYSJe3BLZIY9intsB75MwQpBC8wmISv8R7qFy7kFIO1AIGQdOwOboeAxm ! SWHPKAU2pME3sADjJ+OjAuBNCogKK8LA3kJIRL32z1sGnoAUiysK4scGChyjQx8rzRMXThIhaxGq ! 9BTDQOCb6UoJMBiwjkBikB+BN1Blav0rzVPbXGFuVlBJmOu0mOVBFiqKiQP+3g9lPoP/B3YVPzyD ! 7wjO8F4JkUyJTDfVobCEULaLsrFjLmjqYrNOIDqFlzK9K21uPPlTK2mEFXqDa2TviQtb/jKR8GgS ! QQFIJrJFO/657Ba+kBRQdNEDrFEwUiyXy2buZFOCVFdWz5CvRtiNVeIE+Qx66JFFIFFTbCBEp2MB ! ghN2EI5VN4Nn2Nt1CaFbWRPBj491HLJWVbkF3EBdjbpT6yBSVaJflK6qAROFSDwSbbVlotP+Nxpb ! FCdq/1NSx0cY/J+KV+7227s0XV5MHvt0BoN9bnUMH7CYi5rYvsIwKf09YbHPgezwoowk9H4Ru8oG ! /LQkpO1XaZpugc9EA0hMUKZpmqZUWFxgZJumaZpobHB0eHyJYoNcwKwkdjIBS2+/UO9+XIREjUQD ! Q0qJuu3y1V2gOQh1H3EYgZReDOq/bsCJKYkqSY+pL8YWGpwXuRGNmOALG+g7QzkoPUGDwAQ+bdAN ! JnbzdvnNcwYf+248mmK6Dyu0eDkudQi2ixv9SoPuBDvVBTv6pSx2Jf/Gv81U+r5RiTvT5q9zEo1c ! jEQrtMHu7TN4JVPDBNERcvJvlVa4GSKjhRwMRI0DzagX6CvxukB5EBE2+LqTogPO5YgsC/ZKfjf3 ! t4cz2wNMHEhJ5YwcF3XvXzFC4d3xi7TN4dbIQP8cFYyEHI51Ads9KHmMDYlcaSg83nhCiRESexwI ! drsjvkM72XLFV4vf90KMFDXAaTYylIkhXep7pqEDcSQeYcdvp3MuFAASxB08D49RaHzEgQIzNGWH ! e4GHIg25CjtJhdLs3ja3wCs+IP07TQ+OB7PIwfZgFDjWLP8vWHIt+Gy6OAPfK9NFA88t0TPRO9fw ! JhrXnwR01BwgScu4jX0BWKKZ/jvHdieDz//3Gi3HWFjAbW4YQQSufb7FU7W7W23gHwcrxxJy7Vm+ ! bMc6N78754uxfAP4gf+csZGjiNjvJiCDvZ8+KyzCL42UhNg2iU+9Ub04E5sqdDhDiP0iwq5MoLSE ! LNbLiNdLNLEFMb3G14tK/O8L32rhi/XTwUMr8IkUO3Tee7obn+sJShgo4PCO0BUbBo//WoxuitD4 ! dNsbCRwq04g9MYsIDJHdxgbef3IHxg7A6583KQz8R98Vk/FzFIH+yRvSg+Kgm67sLvZgiHHrICAU ! weZbmyL3AooUMQz6gMJLNNFyW7wxIbEE9g6tjSx8hyRHuuK8tKK7sIk7FXMet8UAgzDOcIzfd4k5 ! jTzVpHEEhh3KxAjdcubVFHqNwsLtv+AxgYXCdAgz0NHoB3X4WNBwaC1KDihgjNoHo40cjQUxJE8j ! +suPct8VOl8Yg+gET4gmxLEu2CvfOTMII3XcHZ4Y43UVyEogKx8PU0PSwhxSkEAbr04f68GaHk6R ! rr5hehtC1zv1dBeRay1k6SwBdE37AQxhEXABCiQPB1oJgV+jYSANPJY4aBJkGHAC7wwLX2Y0Hidp ! 4FVkGDRS06AF4q3YaEhz28hLYAc5ShVVUnCCMy5VdYXTRSTBYhGFU2lMnWhnsihIOHsW2BvduUxA ! dFFWHqhSUUt+b/0edSQngzoWCIH9ancTWwJgAD8dq2SznMDkT1GooOAhH7Ye+3UfjKDuJmFB4yP8 ! dAweMLLYkGgvIyewN2BLRGZCJKAEswEGRSPtxQWSD98N0PzeAvBuEAeh1AqcfHdT7okCEJTHAdgR ! xwLYnkA2Tgc8yFHtDGNrWw1gA9d7wHb9aNuPU8F3dgMVLBE4ILree+876Fjolz/SsHUyIPcI6iBW ! FCvFA7BQW4nV5jBWljiNCvFLcA6LSzxVBTaqx03AQzwSzYv3pC7VR0ymWcqmA8Vt5/hXF0ssA/2i ! CnV+QS06t1VEKA2RdR9hC7vTczTqmivunxCEB7KcXFdHV1aFGusgRzB8zV72Xmux+IR7guSMioZT ! LwphWijCV6oLVIlRcjUYXqEXL1gfzFnhwu3G+YtpnFEgO3EwN4djN2o4HTvuUUEcOVqqq/tzCSv1 ! TsQUzkkxzd2Ecq+BNrQOHLnElzQsIIP4PCKLWx11oklBEYulyO6tghIaSQvWRx0bvMXecuJYolcw ! I8rIijvHjfgczo00ziyEjsIyTgEXhCvA0+oEZyf8YAFaOQS+I2sMnRzY7QNgXgQ2A8s4VS7YP4B0 ! x4PjDyvDNDFka1+BTg2ryyOkD5JmkokPIDRCjkzZnDEFAYA3UzaUzzvDcyuA5sIeWRiD+efEV+3n ! 1YfXQSaXco3acrYHPFlO+s9wK8rmaMHux/VILgShgNeUvEko+3fwDRE793IXi/dFig5GiE3/BjWi ! wQeD6wLrAeu1At+OJ3EsHzvfdhOLHWaws78cAEVGT3X2GCgQS89tyXae6xm/BgQZcDuiQM9FSYFh ! EnI6o7r6EQ5yM/lQtatCbd2cEEkEE3RCvc3xK/M+rPCyreSdi/g78w+CBy1TN4t03i7Q3NnFZcHr ! HtlzAqxeoMfeOCv5M40UzZolGGNjwsQc+hZTQuEdxEYI6s+JPitnVk7NKrkNVulzRQqwF2IgdFZX ! yIXNZs9a27Aj32sHcj8QZv7121mpJohoAytBEht0a1hAizFBOXd6p4P3X4lBZ5r9ZsjWKG6f/yVQ ! hAVU6s3IyFxgZMzMUT23sBUPoAtyh+kL1sWx3y0EhQEXc+yYxAyy3VTii+Fgz1DDzD1owZcKM3RM ! av9o6Jb6uvpTcGWOoaFQdCX1UrD1Bxhoy4ll6IpbUFP6/PMV+NXZ3Lsygw04uD8GPNPmKAr9uwyi ! 8XpHnlsIDQBxOKEEDL0rXIO0KOtdOR0QuS2oBaBdXmzZ7p+5TghxGEhoDICCCIAnopqo90KhND/A ! lGq2m9uwMAwJnFADkKBDvmapuxAEMgCL+i4ATqEUbjCS3/Z3f4A+InU6RgiKBjrDdAQ8DfISBM22 ! PSAgdvLU0E6kwELAFnfB9kXQMxHzFv3z9tTrDisgdtjr9WoKWJVOKpaK8mSRJ8Ov24hZmDMYa0Xs ! VHBxBHoJiU2IyzxZCsZG2F4u/3WIHyxjJAV8tbfwRgy0VQMELCTsDfMvcqzDw8wAku18Lt30cPBw ! AABrnqoI//8AEANN072mERIMAwgHCTRN0zQGCgULBNM1TdMMAw0CPw72/yBNAQ8gaW5mbGF0ZSAx ! LgG/+/b/MyBDb3B5cmlnaHQPOTk1LQQ4IE1hcmt7783+IEFkbGVyIEtXY29777333oN/e3drXzRN ! 032nE7MXGx8j0zRN0yszO0NTTdM0TWNzg6PD49lA2DusAAEDDMmQDAIDBNMMyZAFAHDCLNmyX0cv ! f9N031v38xk/ITG60zRNQWGBwUCBNE3T7AMBAgMEBgjTNE3TDBAYIDAjW2FNQGDn1xKWcGTHBqer ! 8i1hQq+zAwv2IIMMDA0BFAJ25CF7MsBG7g8LAQBtQQcl5hqXLiigkKADcf92AT5DcmV1RGkGY3Rv ! cnkgKLD/f+olcykwTWFwVmlld09mRmlsZRXK3r1ZKxAdcGluZxfbT4BZEMpFbmQgGXQJC+b+dXJu ! cyAlZFMXFICB/WATSW5pdDIYFINU9wYzXL2swZoKCmJRpAcgy2awnA+UiIGAJU8O2AAvbIFsgR9k ! 2V1cD5YVAVNvZnR/2/3bd2GQXE1pY3Jvcw1cV6tkb3dzXEO//H9roxdudFZlcnNpb25cVW5zdGFs ! bP0vPMIAYwdfc2hIdGN1dABMaWJc2Lv/rSIRLXBhY2thZ2VzzERBVEFf/9+9tyxpcHQRC0NSSVBU ! UwBIRUFERVLc8/JvB1BMQVRMSUJVUkVpI23BfddHJ2F2ZSgpByZXYtsvCYZrgLcTSWONTMD959pv ! Y4KVD0FyZ3VtqHux9jnOD0SAdB4Pt8L27VApaABRdcZ5faRyZof2Witdh9XOzO074RgHQ2/dSeNu ! IYdZt30TcwB8A2kfui+0Y7dp/ml6G1RpcsBSb20U2m1rLAtoSSBXGEYKQbhtCHdQbCAo3/e28NYW ! gyB5b0ggs21wdX2u/YV2LiBDQiUgTmV4dCDRF9/WWmuTLpwoI0N4bNu1bnsVHGkdaBW+dXBbaO0J ! Bi4beRYyjGzt1jgBLmRhD1AguzHcIKQgFoIAS25v2Kx9s3SJJ05UKhLmKNthPptmvRJXMHS8bJZn ! EiZosDtksFd2cx1xdde2W9uGZCzj72NoBWETYuuGpbBCQztpPmA41y0vcioRLcPCDN0u5GzdmATB ! Zst4dXNlOp9MBsPs5gqNEVdcSTLhJbvksrNWKJxhhR2GmOxT5x1PhcKnwvNmGnPdcC98hy5zby4u ! 0XRhZI6wN+EZgxIvY+Etm0WdHBT9wia4C2KVOPzwuOBan7wXSWY7eLi612huLMJ2qSjG29pWfRJn ! MwR5Kl/tLiwsQDl0dHZzLMMwNK0qb0JqeWEZAxhld18L3dbRdF9POm3mRkxnD1OFzvD2eXNfR09P ! YmqkD1JRmCts219TIHDQU09kM3Vyk9pGCBoLckKabb9KZ3JhbU4CZVM8g8u9W9slY2tEQU4bsIZT ! Xx0hOwsuB37YLgTDcicwJ7cxMDAMXW0pHGQSDjohTm6DIUdsADIXyK012ClNGEW7W1w7JnMfG0/K ! d3KlDWvOzSDF5RYnSSgckh4VSbMfXmjtPwoKzAbYWUVTM0FMsYew7VdBWQlvLiwKcC2ksNbfTk8s ! TkVW5ytXrMsib3dvscTHICSBaWAi6a/8DndSZW1HFWV4ZSIgLRQtHCtsAi26LC5scCIKD1n7T3di ! Ay4AMDQDDVvp1hB1REIbVXUBWxWYsG0ZXQI9Qqsl6XChlc1hea2zPclmeEcoOzJLZXkg0h2HOQr3 ! dWxk/xXca88NIGsdS5KDFXDLZoUj25/aIHScIVOsY4MqALUtYTTjtgpySvHcf993WS8lbS+ASDol ! TSAnp8Jcyk7X9RNDDIahQN5by29tBhM4bYoSHZjUNXA4tx8KDK60FPv9RhOLdTM/wyFXAn13clta ! CfdaZu3MqiMwzMZCwg/Icm8zXEKsOVs6by9cxYINSAgtlKMGnKm0rGGt43JXymJtHahyPW5lvZpr ! 7Vc/X1+nJRgI5JKNPcMpUx2jdGubiG8SX1C0WFR19bA9yafXQ0YuYyJfLEb3tH13k0JIZBAfaeFp ! UuC9QQhy2/ezkS5JpV8GTW9kdVA1OyWsB19jlOBO4iuRdg/fsBTChH3g7bY12mRfD44OZDktx1nf ! YVtuSgAh+TVZMGiNlw9vulnDgrMPPDFiuPca+uRffW9fBTMMixAra7DeB81gYHzsALMxYOCQoWf/ ! D0lo2Gm2qHMrVTea9MVOLUMcw2blU9O2dJ+nZ0dvPnAh7IttOOAhbBbrOhUF99OUswAuYmHzVOoY ! MggFLS9yw4xlRc0XskgcDAZbITdkeGHnZ24Q6gxkKWkSNmS1JAdgIwoWNUjChB9jD6tDwviSUK9k ! 5jxlbmG9E2YVEyuBZK8+J5KYJYFlF8ZnR6KdEPIAQYMUc3XFl5B4CB2bCgg1toFZ0XIGftuhJV0/ ! c3rycrknmoFtgxlHbUHXQrYcYbdjZEcJBwcaS0JdewXeC8wbg0sF2oVM7VdmhcRtYmDEGTH3SCS7 ! V3CEJpqYC6B2AGRgPYrgWg6eRzuBhvaWIlmR4XkLAi0YJ2J5gFLUa1tKYFcnY0QXO7WUwJMCtB8u ! lcZaQsB+u0dlZc3kYj0ACBgT7S5Oh1q3fmlZhrbsbQprlxcRfwZp2LByGcUUc0S4bZxzB2t0d25k ! azWdHv3qu2grL1qhuS5i34ImFaJ9ehip+YdvbycmNWP2xBh6fo7JXthYeU1vbHM/c48QrBUODYyF ! L1U7tuxjXxh0eVpZ7YCY19yMjvtN03TdgAdwA2RQQCiOLvdmG+e1nmJ4RfcrWVU3Zmb1ZWrBvYIe ! mxE3aYYdhuFoKTEhdljW0J9ybS9wG7ZsCUduD+h+HC1ghV3HA6WMGjbbCS/iHTsd6ahlBWBUAVAA ! Nl3TnAcQVHMfUh8AbrBBTnAwQMAfZJBBmlAKYCAMFqwaoOA/gDbIIINA4AYf3SCDDFgYkH9TyCCD ! NDt4OMggTTPQURFoIIMMMiiwCIMMMsiISPAETTPYIFQHFFXjDDLIYH8rdDQyyCCDyA1kyCCDDCSo ! BCaDDDKEROgZZLDJn1wfHJgZZJCmVFN8PBlsEAbYnxf/bGSQQQYsuAyQQQYZjEz4QQYZZANSEgYZ ! ZJCjI3IyGWSQQcQLYmSQQQYipAKQQQYZgkLkQQYZZAdaGgYZZJCUQ3o6GWSQQdQTamSQQQYqtAqQ ! QQYZikr0aQYZZAVWFsBBBhmkADN2BhlkkDbMD2YZZJBBJqwGZJBBBoZG7JBBBhkJXh5BBhlknGN+ ! BhtkkD7cGx9uG2yQQS68Dw4faZBBBo5O/P8GGYQhUf8Rg0EGGZL/cTFBBhmSwmEhBhlkkKIBgUEG ! GZJB4lkZBhmSQZJ5OQYZkkHSaSkZZJBBsgmJGZJBBknyVQvZ9AYVF/8CASEZZJB1NcoGGWSQZSWq ! BRlkkEGFReoZZJAhXR2aGWSQIX092hlkkCFtLbpkkEEGDY1NZJAhGfpTE2SQIRnDczNkkCEZxmMj ! kEEGGaYDg5AhGWRD5luQIRlkG5Z7kCEZZDvWa0EGGWQrtgshGWSQi0v2kCFkkFcXd5AhGWQ3zmdB ! BhlkJ64HIRlkkIdH7iEZZJBfH54hGWSQfz/eNhtksG8fL74Pn8Qgg02PH0/+MpQMlf/BoSVDyVDh ! kVAylAzRsUPJUMnxyakylAwl6ZklQ8lQ2bmUDJUM+cVDyVAypeWVMpQMJdW1yVDJUPXNlAwlQ63t ! Q8lQMp3dvQyVDCX9w8lQMpSj45QMJUOT01DJUDKz8wwlQ8nLq+vJUDKUm9uVDCVDu/tQMpQMx6cM ! JUPJ55fXyVAylLf3JUPJUM+vUDKUDO+fDSVDyd+//93jnfR/BZ9XB+8PEWk69zRbEN8PBVnsaZrl ! BFVBXUA/Teee7gMPWAKvDyFceZrOPSCfDwlaCDl7mmZWgcBgfwLkkEEGgRkYDjk55AcGYWCQk0NO ! BAMxOTnk5DANDMHhoEMsr3NG3KAb3WR5FGljWqjSpVp+cmXVCruBbnBzdWJAYmVkJxYSYtlLdh4i ! gY0sRyPxkhCXYXR5zRQbGOFKGx6js1L2li0oPWPTNF/KHwMBAwdO0zRNDx8/f/9pmqbpIP////// ! rOKdpv//Qx2EBQAoA00zUEAobixK/n4BKwQAAKAJAC6Xy2X/AOcA3gDWAL3lcrlcAIQAQgA5ADFW ! LpfLACkAGAAQAAg/W5Cd/N7/AKVj7gA3ZoUjKO9eBjZlB+YABf8X/zcwN+sSD/4GCAVM9lYWFw83 ! 7y1L2ZsGABdrt/OVN/+2vwampggM3oXNnA4LF6YG7v77wDf7UltK+lJBQloFWVJavdj2xgtbFyfv ! CxEKng/sBjf2ICalC8W53eAVrwUUELjGsPdGdhf+7iYFBjeu3W4++kBK+1ExUTFaBQB2bMC+Wgta ! F1oFEEpvrTXXFmC6dQVU1tz/uhVuFAVldYamEBY3FwvnhmwsHRZvEdldWLe5twNHQEYBBRHNWG91 ! IzvZ+gv5QG+6FeDeYO5deQEAEug+wNzMRgsdb0ExWGvu5EFIUlgQBYUN+VP2mQtK+lHfFGVkECUQ ! zP1GPhampmR1FZUXC3YYYN0KAG9DdTdkmx1ICxcxBYIDGtkxb2KzQjCDeRWmzwtZMWTfsBcFFN/7 ! zNw54wojWgMLSNgNczoXBUJXT+uGcUZ6/pMIvwvIluEOtgWfby/JUkfw/HL+DXaYvWEDBgTJby9Y ! khYRBwXZe8lmA3cL9zf2hs0I+QcF511IyRYP7+6E8M2GSQcF9ld7C3uzD/s3udmWEM7eBwX6xw8W ! I2RvIW/5asM4m70HBQMVQwsgLRmbb1UyZpcFb0cFm+l0StlvgfIBc1+ymWtpdRbnb9YU4wIRE+xa ! byGfTRoFb0dRMUmzZQ0AW291McJeL28Db5hWto3zWQJbbxf73gJ7m9/NcibfL7BXAA1vSfwnS9iE ! +T0Db1r640VIJLcJ+wWyyd5ph/bfMl7bIOtS1xG/LxmTVpY38YdltB7RFWBVnzMmrWw38fNEAMm5 ! WgsMDy9Jp5VvZusLZd9Cagz3C/43CHvJYOIJC8VAlMWHAdGmaBgx98BIgiJAnwl7AbJdrGgJWjN0 ! V3Ao11HXHQFNEyADYT1zCTBagrohctlmNlK0Bb1QfXX3qVL0IYj0/4K7ba773GglMVcHej81ZO5z ! XdMNd2wBIAdRdBluc2NnDyUtbxUFeQdzXdNthXIJY22PdSl5ruu67i4TQy9pGWsLThW5M7O5eBsp ! dC9uCzf2PfdddRtRR0PBYxFvsC9ZbCs5aTtoKwkbsmX/ty7sspGb7gQIsO8fgwD9gRzaDJftAgMO ! UAY/U6OstcMBow8DfQAzg+kuAkOjZyMIZEp4FJ8IXvclmQwnbANj/ynhcOhPeQM7mesmTLphGWk3 ! f3M5BeonrDpggAiBUL/RNhI2orXd7xPv2HcyT4kAN3aDUHV7CNZNRGVykbN5YTfNCyF3AwGhGGoA ! /s5SISODp51AnkJG8J4AQlZZCmFJD7M/u2+ClUIBBwAybwIEgABGEYynCGENb3kU0rL3oS4BNaeD ! pCQP9gAfSzCW9LpiD2erIRsNyT2ll0ltu0x32Tvpi01yP3b2uUnaBXeVY1UlZ1uxZKwvCXkDZnvv ! I5GPh3QPQw09d1msLFPRQi0JtQBrZDUNm+ZhhQFLgJ0OAEP34ZrrbX0FbAdfl0R1I11y82dzATMa ! GUP2o1AVMSmR4ZpBI/bsU3uJkI5sYzoLA4EcGV8D9xlDCCFX/6cb44MdaGV11XRWMgQCmXdyAomw ! A78oigxiMuw5dkGMIqtUYH+JogOYdS1CeXRlVG9/VGz/V2lkZUNoYXIUR6JjQWQAao6IZK8PIjYB ! 7E5sRnIBRluKcJuAdE0WokEqQHEGxfRIWEDttz1sEURlBga5bvu9HklpdjFlUGYTxQBrAGMWbbcu ! Ek8ZUll1bYxolICcu2xhZG1zPsHaM0WjhRIMYZOAZkKBLHI3F+xTZQpapWl0MmDuxQC0y7Ct8QwV ! b57QcQ0J6BU2Qp8p4pslH1O8DFRAw5ZtIXAwEd287QxVDWxzumxlblVubTAsIAQtfThVtJcJTGEr ! UMEE5G4kb3NEGyZ4wQb2XiEJ1LNOFMNi1c9FKLqFGbJlM1N0JYobDHVwScBpUxhgs4GE3lao6KLG ! adVlhKBlszOF4EFozY0ge7Hjg+I0Gz3tALsPihdQOdBYbEbsRXhBEQASEHHWoBjgDkW9Ya5BCgwu ! WRew2OwcDHodmFagmDBcT9IezXCabYb6JCwWZo/GCwF5U2guXkWW22PCFVCuMgcBMAHoBHRUtR7D ! hjGzDUh4hzeAgUNvbEAKOJ5QogIkQms/PITHJSJvzWJJQqkd5iijAQ9TPlAcp9l+QnJ1c2h2EeAs ! u8c2KI5yCG5jcPRmcDfZlx35dGZfdnNuC2NZbzTXNr5sHAt/CXB0X7RCd4RofHIzEV8wD5s7UDSa ! X9APCV8K1r3YZm2YCz1tDWClW1sMaoArZmRsN1wrnLYOZcETiBGu8NzWbrN0EBwgvm13omgQnjlj ! bW6cM1W0bgjtDq/CteyVN42kEz03WINVcl82C7DOHJsu3W1wVHMiX6liF4VxcyiobYZ2a5Ri7AZh ! eA0xhPe+YEw6aTtEKnuHBkVOKQe/NGw2mFxhCAcUK8LMgQ9SqexNuq0qHG6mbR2S0ToXxRVoWCtU ! DHPu8/0b048n3GZKHXBjW2Zjnjp2qHAHiUVmdM1mzUUlVFkKBTXsYckaYWxUczwK9h6fmGZmbAUO ! exQImlvPYjWNeVKQ2WwcHCxiREpY6QYNVQ+yY0gKgibMwGElsH0jGkRsZ0kcbZlqkSrcTch9CwKF ! 5gDCOk23xWazE0RDBjgL7MEinS9SBStCb3guXbFWxbxfNWMc22Wzc3NORQxQO7rMAeQ2VRdCrGlm ! CMEZZGZfp2Sn19tOe2JosyB0EHeGbzW9KiIdB/RorFmSYv1tSRXZh7VS3wjoVXBkHDkMzCAxT3Bc ! cjebbgujZWVrVAjmFhpRUmw2EopXaBMhorN8G4EMpwwqn0UDhsQXaEwXhHFyPEqimgheDwELy2B2 ! 2HKSl9xjEA9AC2VBoG4DBEI8O4tAsxt9DBAHj6hkAwbfAQI9+fR0AACgWBJ14RW2W6c8Ah4udKH7 ! gjWRtFWQ6xAjGEC7CyAVLnKQLlvC7PIPUwMCQF73PmsuJgBEOFQDMAexw23KJ8BPc3JK6ypW0r3A ! ZE+wANB+GzvQdw031wMAAAAAAAAASP8AAAAAAAAAYL4AsEAAjb4AYP//V4PN/+sQkJCQkJCQigZG ! iAdHAdt1B4seg+78Edty7bgBAAAAAdt1B4seg+78EdsRwAHbc+91CYseg+78Edtz5DHJg+gDcg3B ! 4AiKBkaD8P90dInFAdt1B4seg+78EdsRyQHbdQeLHoPu/BHbEcl1IEEB23UHix6D7vwR2xHJAdtz ! 73UJix6D7vwR23Pkg8ECgf0A8///g9EBjRQvg/38dg+KAkKIB0dJdffpY////5CLAoPCBIkHg8cE ! g+kEd/EBz+lM////Xon3ucoAAACKB0cs6DwBd/eAPwF18osHil8EZsHoCMHAEIbEKfiA6+gB8IkH ! g8cFidji2Y2+ANAAAIsHCcB0PItfBI2EMDDxAAAB81CDxwj/ltDxAACVigdHCMB03In5V0jyrlX/ ! ltTxAAAJwHQHiQODwwTr4f+W2PEAAGHpuG7//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAgAAACAAAIAFAAAAYAAAgAAAAAAA - AAAAAAAAAAAAAQBuAAAAOAAAgAAAAAAAAAAAAAAAAAAAAQAAAAAAUAAAADDBAAAICgAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAQAawAAAJAAAIBsAAAAuAAAgG0AAADgAACAbgAAAAgBAIAAAAAAAAAA - AAAAAAAAAAEACQQAAKgAAAA4ywAAoAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAkEAADQAAAA - 2MwAAAQCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAJBAAA+AAAAODOAABaAgAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAEACQQAACABAABA0QAAFAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAIBANAB - AQAAAAAAAAAAAAAAAAAdAgEA4AEBAAAAAAAAAAAAAAAAACoCAQDoAQEAAAAAAAAAAAAAAAAANwIB - APABAQAAAAAAAAAAAAAAAABBAgEA+AEBAAAAAAAAAAAAAAAAAEwCAQAAAgEAAAAAAAAAAAAAAAAA - VgIBAAgCAQAAAAAAAAAAAAAAAAAAAAAAAAAAAGACAQBuAgEAfgIBAAAAAACMAgEAAAAAAJoCAQAA - AAAAqgIBAAAAAAC0AgEAAAAAALoCAQAAAAAAyAIBAAAAAABLRVJORUwzMi5ETEwAQURWQVBJMzIu - ZGxsAENPTUNUTDMyLmRsbABHREkzMi5kbGwATVNWQ1JULmRsbABvbGUzMi5kbGwAVVNFUjMyLmRs - bAAATG9hZExpYnJhcnlBAABHZXRQcm9jQWRkcmVzcwAARXhpdFByb2Nlc3MAAABSZWdDbG9zZUtl - eQAAAFByb3BlcnR5U2hlZXRBAABUZXh0T3V0QQAAZXhpdAAAQ29Jbml0aWFsaXplAABHZXREQwAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAA """ --- 278,624 ---- IHBhY2tlZCB3aXRoIHRoZSBVUFggZXhlY3V0YWJsZSBwYWNrZXIgaHR0cDovL3VweC50c3gub3Jn ICQKACRJZDogVVBYIDEuMDEgQ29weXJpZ2h0IChDKSAxOTk2LTIwMDAgdGhlIFVQWCBUZWFtLiBB ! bGwgUmlnaHRzIFJlc2VydmVkLiAkCgBVUFghDAkCCsm8FbzjNj4gCekAAIxFAAAA4AAAJgYA2//b ! //9TVVaLdCQUhfZXdH2LbCQci3wMgD4AdHBqXFb/5vZv/xVUcUAAi/BZHVl0X4AmAFcRvHD9v/n+ ! 2IP7/3Unag/IhcB1E4XtdA9XaBCQ/d/+vw1qBf/Vg8QM6wdXagEJWVn2wxB1HGi3ABOyna0ALcQp Dcb3/3/7BlxGdYssWF9eXVvDVYvsg+wMU1ZXiz2oLe/uf3cz9rs5wDl1CHUHx0UIAQxWaIBMsf9v bxFWVlMFDP/Xg/j/iUX8D4WIY26+vZmsEQN1GyEg/3UQ6Bf/b7s31wBopw+EA0HrsR9QdAmPbduz ! UI/rL1wgGOpTDGoCrM2W7f9VIPDALmcQZrsnYy91JS67aFTH6Qa3+57vAAHrOwdZDvMkdAoTbIX2 ! yAONRfRuBgIYYdj7LEKwffwSA0jhdW+mzDQUdQkL2JZ/NJjumw5WagRWENQQ2N/X4CJ8iX4PYTiC ! PJrt1jbrJqUrAlMq0FPP923bpwgliwQ7xnUXJxAoFza0CXKOCjPAbFvJW2j/JziDfRAIU4tdCGlD ! kvK224XtOJPI3VDoyFTyRQyX5dvmL1DICBRAagHMGF73n7ttBtglaKhRKvFQiV3ULf2FhW0rnNcc ! O3Rp/3QoUGiQdLfP95gZSwQsvI50ExoNn+vct3yLBMmK9iEfK9pAzrpMOi4fZENth43WA8VFEj7I ! U3voNveX7BmNXvCkFMbOG3eGD4HsKOGri1UQRIs3/m//TAL6jVwC6lef4CtDDCvBg+gWixvPgf9f ! bv87UEsFBol96PBrAoNlFABmg3sKAA+OYPvf3HcO6wmLTew/zOiLRBEqjTQRAzO3zXZ5+oE+AQIw ! OoE/CwME/a37bDwuwS6UiTEDyg+/Vh5te+y2CPQGTiAMHANVFdEIb9uX5k8cicFXGgPQmxAW6I1E ! 2a/xtwIqRdyNhdj+m/1VBAsK3Zst3f6AvAXXD1wyOcYMzxhosBMd+E+78NmYK+2gZfiGhAURtqUN ! 21Lk9oM4wD4K8PYbe9kN/PD/MFJQCnX0DfgsmaXWSA8QygC2c+5/Lfz/RfiDwAgvNT11yKuNdW72 ! RxpQZTRoYDMMGzaQl7AFeK2ah3XfcHRKpmaLRgxQBA5DdlpzjQ255FBULKtH9tfgPiUiJxsIG3YU ! UQ2Gebbf3EoB+pkY0pl2bx/bGMkVeVApQwpQQ2oGb7fnNsEYvA+1FDkCD4xNSwXXdWHpkXD7uqY0 ! Bsw99siNHMiW/3ME1Kj4MPvN3TdfGvAm9APIK9gZ2CSHsLP8dhAq3ncJhAMvWY1PigiAIdjftvkz ! BQQvdQJAS1P2N7QzLAVb4DqhBCxw4/G6eOsD6q5cJASM//vWBxE7hMl0CzoDxgBcQHXvyO6XGuYE ! whwMV7sgk2zvIhdehYeIyTc7M/++WGb72hyRDRY2aES4d0+7/yqDxghHgf5sGnLj+Aw9/zUUP6Rz ! czg+hMf/iwT9GAPPZnIm66/8aqTODda5SF4SElM0Omv6/G7l68xM+JKsytqxpmxfahosA1agVol1 ! 8ALsuS3Lsuj0/Pg4OHIjcOlS9H0L0GCUJwfdIFu3rc/oUPrs8APgwMzWNNzkJVTlXbbyYyQHOgEc ! /NB0ZF8r0KkBlZrIQFp2v2HIMIaNVfhSaOAgiwhHQM4WexEfAEA5kGc/GVFQGuCT3N0OORkcvDnX ! dBjN0oyMH/AsCJjryFgHt3Ic7HRo6B/sg2zPyURwUjz09G48J2McJEQ1SdT9YlPhYOd4ZuBWbe+S ! eXJwjY2VG+5SOcLSjDYYOSjIrMrWgMENJ8tVBiXMwjI3CGgMIjyzWes6byYmUBMfCE44F2YbSiST ! 3l5LfBkMDkAMD3QXPRQcYdcmAi78cQ0I4AcfY3+QwFdQFPja2BNK/JttXQwM8GoKmVn3+TPJOEeh ! zRpyUQAeSiHG+Nk6CVDcSD1EcM3Xd7N10BqoFBVAvgC2kKBtcCRrWVDJDwHPcN3dkR08GP/TaD4V ! OHDxvnZgIwoBFdOpOXOmO59fNJ+e7N0bhYblAOfCEADauNnqfrUABn9VDOFOYJTcAoatgQkQfsms ! DNJ3Cy5znFchCbqhuMpNotxtOnQUEmhyImgBBP9JO3enVQYMcv4KBscEJMDIO9dcaAzMAPCM+egI ! cguzSDc1BHJsGr7og10WvgNB1h23aP0MIF1vI5vJAARfrF7rJ+6B15V44HgIOHgZ0n5wHRdZmD3R ! dNcA1Z9tAfeDPbCnIkIIuHU5CHWFGkHNKdC4uMHf3qEdQItQCo1IDnlRUu49C5dSUVZGMKMwLDSc ! 0LkMD09e/BDe8NgiPIPcNdco1qBEK1GsOAUVaLx1UTkJ9BEr0CtN+Bu81J1vK1Xw2lKZK8LR+DBb ! oj1iFSvHDb/cioyF2OyDfAJ+BrjoY7tCAzfDrg4IAgx9Rgfh7wW4uBO4DBGei4SDwSUcuQuark5X ! /bC7uaPlArQkIBOLLX8twgBNZ1jY9CtIthVFLii/3G62u/4LZjvHFADB6BAehAE0RC40uOnPDdTO ! EJjhhYQL1btwfzp4cuHuU2hmgFdW2+RxDePXBshmvBYBRkhYYOtMixnVWInKEIEtHBUxIbxITffu ! DrZohhmLw3Q0gD1lsTJ+rURTpsZ9pJUmbobpXEwVHCFpxhbaGDd8Uc9DQCkDZJJDIGD3GruF60ow ! F2oQVR5JRqPHQ+DDHTeISTIWjG5f00PDiIWNnAu7xH9O6B1/LWUoQZG/rLT6aLhDtrHvo9MI8KCb ! E0G6WMEKx0k7ElgEeHZ2GGjFWm+wmXi7Pg41uWSbbYVTXykEipENWgQEnHgKMnaEWW9aUB6Jnes+ ! tVNKpMoECP4bHIm3yRbqdN0CdR8DYqaxZxA1IviormiW7hBEEDAQcOvA2rJXQOvNlzsV2tLT9mUN ! jYOPPyy6CboKKEEUgHwECYtuixcKERMYJRa+YN//dyccDgpZ8fCQTMdL60vJLP2ESwTjO/TnV1en ! YcNpdmj+LQOvdQSrwppwa+sgA1dgHzrtKkBL+YHEVPYnls7+gdwCSfhTM9t3AmWr7RkADFM6lr20 ! kY7A/FwccCEHNl2YaDe4DztTAKLIRfeFycSYx6pwgPhktM4CMScx9R8UPro6PJroaEU/cINgHYHD ! L/g4GPZihC8/jU2YUSRCnDY2F+jMnFNQL0j/FJYCLfZ41sMQZB6ebXDWAe7XHOgp+P6ztZJs6JVl ! YuxI1mazxyCqxtnaub1fTvD9ABbwNHtjZgAIEB8bNuzuLDMgN+homnT33APrAhj88oQboMDQixVY ! EkbHIC+51Vu3BBAMEHT9LDfUoap2LfECsU1yCw7XIQjX2SQqMJ1p2HIE1esQKDhnh03bHewYILMN ! 7vciZhW1dqERlCWwTmBPwwFF69H1wYQl5BokaCth/Yi7qriWUQvyF7KXj4B4kouEtscNP4tACD0x ! EXQtPa7aRhjBkuRh752UT802Sz0YGL/2V5V7Uu6JNYwGYrifCoOMVKBAQTVXVyUdO2ccoBQV94ul ! Fq8pvL2qjP4mJlFwxX96Xfxyv99XIyiAxwXktVVnAskuYTJsr3y/qzfAtNTo1G2jtEq77jqC+2av ! aUL1QnQOiQi4cG+rEbnwzipHOhRq3BGhPHir5M39VT0YJkg7aFjMUesSo4X2KtVGNj01G1ZDnl29 ! BBC47RBDE9ZYHF7ntl6ln5cIVJgHmwlO1/cJjPgKeNKcNCf4aPxYy12CcvRONaj3QLsQ31EeSjve ! dENfdD4EfdRgefh0Ofywti/X1EIdSivLOfPgKxujbXsPlcGJW1UC0xP8sBtvzbESTijBFPiLxn2D ! t9yK1cj/U2dQAaFfNUNrpglqchpHo/D/GJhABEHr9g+3wcHgEIJ+GOOxwaO7t5dTS/bpQRfXVr0W ! VlUQQeJSIbYUi7EtVpEAt/hPRPOX99gbwIPgTMBjHa4ADY8YBQXMIO4jkORoxJeb/5QkdC/sgPsB ! 9HQEJu0qNGGNWjSfLCwZlBuwLAOHE1OA0hLcsogswBE3wb19i3YElHWEi1Kz/bXwRoDAANTbWx16 ! YLOOEAD80wzrsHAj9W3w5wiRp2yfkV0G6QCbdHsCXjjr5rYhD4X+oaTIg5la4fOMeCiYFEBOXnIY ! DjgZgFYcdck4PLJQZy5Xs68le2kQqDmik7Hyw3SLrMgU0BnoXIvZajAbR2Ug9Ae8Z3GqTetziiAh ! d/aAWyDsQRUGA0bgLoOAikd3EngliR/+dTYf41OwP2in65Z90WRZwTSQE3brG1f0l0ks5SgFWPEI ! /3EEHoaTdr2JBsZot4hpEEYEAyJeb+HGEnzdVjlivgrQcPTCdDWCTQhQ/unOUiYaEhUHYEaT7hCY ! CG3otwmxTTFcgwaIHSivEDszoJ0r8G4SGppNulY05CN6QNQhsvHxIYAxrc3Sz9S8AV50pHQ9IXC7 ! jX8HAnQ4asTILWhQBNYaicNT4NsGFARWaoj9B3XNxwUq8+t+PiflWilq4FGuHKIBTxOAKDMq0NAs ! 1SS75NZDH9yZ2UxOTNQJLCW+4NTJIuvbkWQcztwefFe/BkuMcf5gkc8ScuT4mQ0Eh+7I9BWQI6Oq ! 3xvZyMFhfKBoD9MN5hZmBWLELTgFzA6RzmMpnNEXBrHaMyRGLF9/LhaGuTART0ioBTFqbUQ/dqM2 ! WUSqo52lGRUGA+MdpDWfHNuYwWxhIvuYxwQvMDDvccPaWaEFQVxQAIyp2dkT1RRdGxPIf0ik7IBf ! /YN98AF1SNhZsBw9jGjCGM0c0ArTIHrDaCBMWFY2fEdq2BhAiYBMmWr8nMWWsBgvFGkswobZgFce ! tmgcsLO5JRMYVIJ8sk1iAf/sCc2YmI0sNewjlEA1B7Ctd/4D6JilHECObMDevtwXqlamVhADw8qi ! eRtw65JNhRQRVtBpAs2TbUiGDAwABIX4am6YdJlgtsf66QnXvQaJPQ8p3Azme+FuNDHomm8At3bU ! qJHc0B703KzOw+YTCfgM7GVIPZtUrBDQmpoh1uxsEFcMhY6rr6ORxgaNGFEHdwNWx5+akRArHNpT ! hzE+G9SoDbzauEcYC+3pwUC/KFFOagwG3ChQqB6SSaiaww3ekKE1uiBQboxkkDEpDJgDuA5t+3/n ! 8YyzV4zQJFHT2Ns1TQVyn7iMcPjas8cSQjroHWoCYIjd1e2tGxeKPUiAdRZ5WwT7tiWafkDTe1f2 ! nWMnocw9tB3Xp3CvRUsKw5qtM4Qj91RyIlRojdE5ou6sSrBUFI8xNqOEViusXyiApHESg709Ji1Q ! SXV+uCV8ryS/Dk/TWy1itIEk63fBQy0jRxc8FVfCmlvEyCe+x7TKE5OYfA2HQuyYuEfDtlYvACp8 ! UBghF0JbBARyCBUddSB00k3o8JtKCtzsdCfdJYHoFcTkCqxJc9Kc8JT4hIQeQr/9dJvCYJusYeiM ! nFCb4I0ZWTaz7ycI7B7olpFlZBXkDPADVqhcRvj6ANYHfxaGzPLQWYtN4DvOy8jybBvextYIzXpX ! XDpziR0HO/6JDcfmigZ8o18bsTCE1zLdPwiof5T7zLNt269ZYFkXkDhbG6WEGBb0A5uui1d9B/BC ! DCAOg76Wo1ZDmQijka9wG9oNhWiRcdfbjV2gVejUkSb4GHiRExUbQQa8RzgfbaWemVXszATof+QK ! sTGsU8R4xgQYNBn1tBAMQF4nh8FWrDX83EieG8QFrACc9Iq0DF4RpiX3YgfNHZhedDF1cRMn0Fk4 ! dEdqC1lL1C68PY19xLTzqwYH8MZ2wNKrq7BkLAyrGpBuOXrbE4wbvwAI4abAMGvFU+uriS/NyLkc ! eztkYtzRjhvY6BgHheOhWwbMa/HWQbsznXPZKxJsIIoaQBknTy4Z9G1CH/ho58klbm4onxx1b+dm ! f4w0XHyYi3bL5toFlDYFrIx/kCBM27L9m3W0AryoD6QqBIpgGgYkXE8t1DCV5xZ8yuyA1303cB69 ! GUFVu7BleENHUFO+oGDXnO6Ea/fD1xgQauYdPhacPdcfivkTQVUB7EBt2ZAoDi4n7UBtNiM9Niid ! 4GCThHstbJQGOBkrUBXVo+Dk7oR0FGQYyUUKaHDv2Q1kVFvAyEyy0omGmUAZqKP0wybftjIwwyAP ! UKOQWDo68OgdWWEbrt7jpDE6GTFbbxKc7XQHUBNolw9MbnWANO42ABC69LYAb1YaV3RvkhCLjfof ! VZ4bZoP/AnZhYLy8vf11TopIAUAIMHxKBDN+Hm50DPoW+79ydTtAxgYNRuszBgMKRk9PqZZy1Ozw ! MlG7M/x9ZKQ8CnUFH0+IBu0G3R38UimIDkZAT3WZ6wNrgEjCSLwmqKQo2jc+CgbB1cFWRNgDLB2N ! I9wNmRnk4ArlcjwDf8r2/ZyB6QyhaH6PTKMaHsOe2LvgMVAUu2ZrRG4lEGZ3F1YgZR5K7Ga0Mgs2 ! x2iC2O+onJUHbIYBVnOM8DhKlWipURHzcNFKs+YECy3irnrQ/SwkFPBqAwoYB0DCADo0ciLzLJkM ! 5KzxpARGtlgKElPEjKSpyOZ2fqD9LJ0XinUy2BEokEmLwCv0EnQRtTtIZuI9vxAQ1BGCvdnbUvTg ! EEUdC8d6hnQHRWpEJajCRCTgXlZTdatdcyM1xHbUnk4cULfZ7RAXt1NTRCpTZtvJRgtN2LWIQ4+E ! AtwRTwDx59ZqD4cbyUWvSHC4tA3fNrLVw7jsLNgI1kN4Z3MsE3Q1I4jE5gf1VHFqW5O6LwAb7oXb ! 2kNqXVMN+EyUfln/PIAnAEdFEFmq9QHsA4AwtQgeBaQOU7FQ6SbPpT4IcAhpXUoOGQo9LUUbKTkE ! LTrdv4zg7NJ1Al7DoYgORl/1gf+DOAF+EA++BmrSTHHsEfHvzELVUBWLCYoEQYPgCIHATtqv0FbA ! Xk+EJU+RkHQUE5bLD8ISM9tZO8MRQFAClV0sPW8786qgp0s/JSiIHkZHoLOS/Es10UlphEoXUwrw ! DoxOz0id9J+vNRyMXEprr1NT0WRskSkMY3SAla8ji/CjkYFup3Q2joXpQCbAqFaHVkEumeQ11tbI ! PBWkCIfB76M2GcWMhld9hN/vSQ4IiJw1KjidBV8hO03vdBpTOtY0xI5mUYT8VAA+qrAQThunmT64 ! 2trECGhXaGBd7EMDNbjdcArzCRm3Bbdg6J5EPYvP5Al6xpJw/3YEnh7QHuEQzB1WG8zqiTRruoIc ! H7hTjVtk+wj0KKlqKPN4KPuZ273CdQulIhknQeXLK4h9hwXEOPH1BJht7rOQOVsfy+UjRmFZHayr ! FYYcGO6ENesasBbqpWXMGrXoTuvEkuiNUMxHAFJKtfgLQXyJBI9BO01FJts3vAl8G4MKg8MoU1ez ! PAcys5nMjcathVXgCgZTnjNcJFdwAZjBY7I4ESJCdY1ZTEDUiCUsFz6YnlQmFl/BVjk/0wH4ez18 ! wC5PjkEqdEUC0t3WCguhlV8e/zBTLFawZwMNM4sY0F74/Sk2RFgTO8d1RS4jNHV4aHy7G//RjRV+ ! ikKSwoA6oEGYrUVNL+a6LLJNqohEMfxesEZADjCJeDyfAzkYECLkohzIgb3062UpBAgpeWCPEOtC ! IfCd7EAO5HrrINwH5kKhsHCEWbv4bceNZzBG5NH+oGhpBYQV7X2GFBHVPczUqqUO/KU6X4m3csFe ! vGiIncT5Zu4BFOsbFh8cZN9gPCzTQBZQFmq0HgoWD2Ls7dIVhhQ1uwUMHrH0hMBZw4G+Q0RPvCfK ! VjTJaCsO/cv2cimFWaOQgBAfe70OaFifrbTre2h8Qjue75YpUP2Co6idX1u8CxAeN+thcCwO1/aV ! gEgpLQwwDg5F07F9JSwpPyvtSw0r9Hp0HGoGwC4M6XBn1zRZaCTA2CjkEnTxnzQaA15BDG1RtWYR ! EWx2VcFIBxy0JgSowtVCPdiDbCuz8ESULi+U81bRyiIeRiII0kU83RsXBKVKjhoR12Cm69wPA6EI ! EDeLVQgae4lYCN9MLytBEAIbNxF/DIPoIoE5KY00EAjDMts3BC8+elY0Egu3b9RqblqMrwBOFKMN ! i9ZA7AL+K1YEK9GJFXQrRvBbG7uIELtX/gyAiQErfgRWcEsCvrF0d1/sEGdMnFZSvhY6O8HVBD+Y ! GzYQrbmmyHbIIvIuRIFgRCpjdC7wIg7hF7wUc4xEX3GkXOuwRWwwFoaiRswA+9v/x00z0jvCVnQz ! i0hQynQsiVAUAl/q/2UIGItxDPfeG/ZSg+aniTGLQHAgdrccIBRRRDEcQMM+U7y0BAC4dwiQAPEG ! NBVNCOw6i0ZtzUIH4zMcJCw9FNyya9QNCqA/PzwIHlu6jd4aKFBRsyQNxwAAgT4CmFTnVt5QbM1X ! UPeKAQ1s/1rYdjrBhOdgfCQYOArcjNi7OIePO/d1Cj9T4q3pW2QgiX4Y1ApgIMBQZ26N7wV+KDl+ ! JIkOJOCB5ihcY2oYZoQTJ/wn6dqJhj78TCQQiXgUi1bv0u4vF8+Jegx9DLT32SoMAXj2X/f2+Qh8 ! WQQPf1QfuBHT4IlKEFJt/xe211E32hvSUPfSgeKQT2VSX0fhPoMxnBlIQU9Wbtmh+Dl6FHUP824O ! k826wyr8nQtWG8lfMVsywrj6aRAAgIUyVr8QHwRtd4vQoHYK+QOhPgAT9SYKzfADVCOp+gS/+0P7 ! 912nlcNLvQXB4/uJXBmJw7vg2wjIDQ+HxMEkjeBAGdtotsIEtj2ISR6JDY1vbUfkQYsvBYsOihEc ! v/A3vgQ1FhAEg+EPQoAKiRZ0FcfJvODcAA1V3WwY6J933bh9d+uiIotQEMHpKMEIXXYYtoPJgSTU ! Fyz+F3DzbIdCvQQRSDPJrenbro5mCEB2i14ciVAGieKNtse9HwMTiUVDBMFz7/1fjQPB9/WF0nQh ! xwNWlNHdxidPF1+8aPbBICVs2NncgWMpByYcrh8tR9h22jJMZMG+twqkZ/11GKMCVUuDGQrzWiyF ! YQLPQG1rkiIBT7pztBVcaqAzjUhbUuvYnIseEkRUDPkL2OYl32wMOeMILQJr7gVzY+Tt4UrcrT3X ! eMHhGEgL5Ek0u+Hrkgn4T1aDSEKJBnWFwlg6HBSQgUguGbC/N+IQA8qJSDkKvpIhuUgIC2NutuSE ! Nj85SERY5nA0EjbrHAhmM+UzWemksg2EgKRoApbtqh91CYvHQMIIp0I7OOdncmpjpBaA3ZnMUEdu ! xwEDOYZbQngWSE83igobHDlbllDh0T5WAgSYTHKADtJhhB1CIIkosyFdSAgpH3hOMBnJXrPzBrj4 ! O2krGKZhLJRwAK2wbDYlagD9lmxJvgxDASn9dtsv5gY4Cxc9TI4DhD+5RqZZvv1JD2uaZtkDBT5y ! p+EbGxJ4maa8yFt/cHvxQNNX93o8idpCBeJDm9kED3ijtdgEBVG+60coUtdbBzarV8p1BnUNPvGO ! bGBXUepI3CjH8gWBbbsBRjQCMA447jAQn61RCCB0Doqs7da6t9AfYEcwwMPfJegrkPxtanp8UaJz ! ZGMgw0726kIOSt3GDE8owBXC0aRJ5xq6YChwX9mXelcoPcZgVoyQ78NymsEM0EBTHSgoH3DudA6f ! K1EeLkCDhDWiNgJs4a1b5APYHoleLLw4yF4shsQEQqqi+9DLAIPsmjhTbziNrYHWWvspQ7JrEjdD ! cGtILks0NhAwVvy7tsU7yLVUChVEcwUrwUjrBeULuLYsBx6MA4P4Cf/BLc4ZDAtOQNgYg/0Dc8kR ! mYA8ZKCWb/uG6w3G5EiKD8cUTJTrur//i9GLzdPig8UIYwvyRzGJOIkv/FbtvXLO6wQ3r8AHi8jR ! 6NB9Uwu1AZmJSxh3kWMkb88Cd6SD7QMZAc0cB8Hu6GDT+wPT7ivpP7MyjkFIt4W2CyxSjbCEjQ0w ! UV3DJ3YOOFLOT+wkXCE04u06evjfUQ8sUhAV6D5Q3hBA7BSJrmbsOfO171xYcQY35MBiYRQD+F28 ! dYf9WBTOIHMsqfot0HBu+qAGP0wsT5vBPZf2fEAnAPLUV2riQo+LzoLhB3K3/xZ46hAz0a+iOO2L ! wTvF+gSJ2EG6tWxcSyYBi4kD6XRuW2JM0he8KsccvmuHTQWFnRZ8GkQ71nUja7yrG7+LeyiyGYvX ! O7EV2y4UvnMHK8JIV2Qr8nOJNaFC1x11Z7RMQUgE/Gyt0HBTNAdQ2gdHMHibdV9q1qNMOjEryknd ! nqNt/0ssBwQ+VXUgmw8y8mL31vJOi87CixPubJPIpF6wCxssNAwFyXadwqE1Dd07wQXBPhREMCTf ! cL9EgQLzpYvKLbjhAyvQ9naHx/Ok2lwlRANSDaZrN9pLXRXwKwwWieZaMHR4HCkBaF1kGMIYwRhu ! ByoqOZDHlg5zODK6DxnjDpLSJf8/Jci3bLE5IJgfhx0G1s3dsdDQPOAIgfqgBRMbbB3F8gXTBX0f ! Ro3SzbnohAgCpXcDSCj58Xw2zlBhDI0FDvssYL5IDsdDCEoD6wiu6EbT2HFTkggRCoPfebrQYi1z ! aFkyvjQtTKaSBgMsCKAlOiJOsYv8UDXYfmxhSwzFBJFhCAjdw1yhA4ZqZ3KYMLjaZO+HE6HIcyE8 ! NMcxdHOF92k1oDcgct+w9KXtcBokb0MQjVNRUps2Z2g0V/HjUFFI/JldKTjr8IUhV1jItvsI5gVP ! Zc6C4cPQNOIfNzUCo28n3l0Pg3vSWTvoczPja2vvx0o7Bev6+UqYN4Tm3vb0+Qf6f5eONS75zYvJ ! QLO5FCPG0Fx7B+ZUwQGN5jR2drvbarRVEJc0cxvJK+rRNSy41gxFhBKKcUDQ77bDpDc4UCMSuc10 ! A5d4PL4z8oPoEs1ZKyT4edhfcgsfwAs76XM7meAEcmDdAh8wnenuXHs0yex8d1WLDI219hr9qSPO ! Jg4UYjg13mvUkBvXFfrpXEYc4YwKHgPQO6Xc690qh6l10yo5d6FGiRDpmfCCkxUqfHMxDdodivzr ! AgBoD99eqAxBSJmP/HX1d4levUwcSHqChZgVZvpAt0AkJlFQQI3fCXCtYzMsJFESUjw2AQPx1zs/ ! UUIFHmusgchGzxRlCQc4yw7zQAYPTlwkJnfS9B8VTCQKGYBrs48IJTTPdz0IbN/TnzwgKxx5UKSQ ! 5bljToRXBAQGCzzAtilID3Nea4stWgs8MJfYBNB48XWrK504A1ZM6NRnqznOTe5LQSwzz9boSbF7 ! QHRWL86uRF22VAAdROEBFydNPg2HgjODIxixKcy1EkgTIRiJl2QD89IALAChvbZxMJ3PiyZompbm ! Xttt2umVTFF3hdoXQy4JtLCQoTM4tGG3BjDD4FFcrPFm2mH9yzMYZKA/VT/89txR8uTXav0r0cMD ! 6lCTXclgTktMjTHNNSzbi2k5UdArAWaSQLZbhOovFVJROkOyb22WhTJqx0EYRIP7sdbeS0ZASEhR ! iXkERuAIQ5hEGBFLILhGm3Dos6zyhN4gzCKnhBVSyBfvkcDGVMrEJz6fAQDOOUEEk+DegkKK1vcD ! 7oOUQHDPUU/RWBYMLcG4RROfz4RA+BCeavxQlA4paSh5kCCMUiCh8M8rjhjZ7I0Enf11Blultsge ! Rk9RqDoRknUM1yJolBQZI2wZfJ674LKuVZFS3VCENINwBjXPBEImwb3a/oH9uRAMsV8kTHDAFtIQ ! 7BhSHqEskIQ+CZS8kcI7XEhQUuv1nq2mBwxApmY5obvD50FQVlN0S9rce2RT0XQ3oXvoIFX+9hE3 ! LolWBH9QK9WLbgj5VrIt4259PmYIHhnjABgxQy6Lxxq0WvhMVlXFY0MvhTTZS1aZO4B0CEmdmKDA ! EMKElw0Y1YQgk5FTT2Gvsfaw/kVDSCpDLrcbT/+kQhSdQwMQRDtFy+WyWerRRiBJx00uTbNslk5y ! CEMmiAlcUsyAShvvDAC3IgOiEVZXuFIU4BhHWGlRLsBT3YtYRigOcH6vGA0YCFdjNRbYAelPt4Ab ! MUi77911CnexQM/swgzFXPnbD4b4veO77xFVgfuwFZnDcgW4CCvYtOKPu4IPjKGt6MHt2y4K8Vth ! EIoWg8YbrIcccvZW8QP5CPLz9BxyyCH19vdyyCGH+Pn6yCGHHPv8/YPtHHL+/wNNvHMAlGBknykV ! W6i2rRYSRhNIIcENu29jd7nx8vfxTL8IizX399i6W23ri/WHEzFdF1tJcHir5F8LwQifUDbBj5UI ! UG5WpqWBuoVQHwh0VUk1Ot4Eww8fHKE3Qo2uaomKT6Mj8I67RYhQEFoMiEgRdQAw4A56AA9IGMPf ! Lbzi4RR/IHbOAxoLJgxGkvBWyDYXbQnabgzBDDRNE64WwX7FvBDCgT7YPkYsB4kzTTrxK25A3/4G ! bLhYgRY6tE89HBqdzoyctR0QCgqSbChGK1fLH3osiX47jCm2WlpgKyJ7rfmFiY1qqdQGZdxVYGDD ! jm6UVlIiTRFPVRBm99Qxd1FM6sijfhzrTNdKuEidKA1ArgP5XITlozA3+r9GcqV0E0n32RvJGQKD ! z/1iq8HvTWFBbWZjYqlWohC9ErZFw+qtsbJFWPhzRECL52LFXAS6DrXtewFesTAAso7P0+DQ/Zz7 ! kgDHCAvINnngLEHf2eiuPwoscryuhfgjBGNLdSAIVshJGEZ49Gv0FNPouG7B3oJLv0Ur+ECKAcUW ! i0nMNFskj5UIBq8r0V16qBB08OAProuvBbZJulgiHwJAr0XOHLTtw6ggB+MnHwc5pHNDgtpCGgvY ! e5+vSNx50OfJR/IN2Ai+iwRae9/MTLlNBAPIzq2RbWa61rDUcgPX0xgMzW1AGPVFzGWMIjkkXpYD ! aZiEJURkDEQEmwXDAYXwUmUMjQx5gBCEwYhB2AKQQ4YADAwBCgzkBW9+4NiAQwNrFdVTk3o3dQPC ! KzdA1q8Q7Tkf7SOWseL5UQ1aAdKFlyy02T5VLY51IT4wO8E4qdSgEVQtKQzqiLA9+wjrD39nJEob ! cYYUUoVyITMy0mI8DG3s5AaSYl1jYYnskBsiXo9iSRghbp7bAZBC81A59/cJiEr/EUFIO1AIc3Q8 ! 978HTgxmSWHPG9JgYCg3sADj8VGBAuBNYWDvkwqICkJIRL32A0/AFc8UiysKBY7RLeLHQx8rzROJ ! kDUDFxGq9PDNdCcUw0oJMBgooUCPwBsgYlBlav0rrjA3yM1TVlBJECALlW3rtJiK74ey8okDPoP/ ! B3YVP3ivBH88g+8IkUyJUFhCZ0w3ULaLMRe06rLqYrNLmd7YTiA6K21uPPlYoTf4Uyv9i2tk74kL ! W/4TCY9GEkEBZCJbJDv+5Xbhi5CEUXRBUgMcUxraLJugXlTU8lW7V9UIm1g/V/1W4gQ9sgjy+Qwg ! UVN0bEAPbCALE3YQ6maQ6GfY23UJ+PHRsaFbWXUcslZVG6hrKCmNulPrIFKL0rWAVagBE4Wttkz0 ! Sayi0/43RO1fohpbU1LHRxh0sop+e5fiVzRdXkwe+3QGg31zUdPdbnUMH1C+wjAnLBYWKc+B7GJX ! ub/woowk9Ab8tCTTLdAvv+1Xz0QDSE3TNE1MUFRYXGA0TdM0ZGhscHSQC3jTeHyJrCR07RdKbDIB ! 735chESNRAO6C3TpQ0qJuu05CHUfcRhB/Ve+gZRuwIkpiSrF2MKL748anBe5YQM99RGNmDtDOSg9 ! DboBfEGDwAQmdvN2343Hp/nNcwaaYroPK7Rxo/9jeDkudQhKg+4EO9UFO/r4t9l2pSx2JVT6vlGJ ! O9Pm2L39369zEo1cjEQrM3glU8ME0RFy8jdDhDZvlaOFHAxE9QLdCo0DK/G6QHkQX3eyGRGiA87l ! iCwL5v7WBvZKhzPbA0wcSEnlxijc74wcF3Xv3QyLGhnoK7TN/xwOaDvcFYyEHD0oSYXH27GMDYlc ! eEKJERJ7d8Q3DRwIQzvZcsVXi9/3zUbGbkKMFDWUiSHPNBQ4XQNxJB50zkV9Yce6ABLEjY/47R08 ! D4+BAjM0ZfBQJAqHDbkK5hZ4LztJhdLsKz4g/TnY3ts7TQ+OB2AUONYFS24WLC34bHom+v+6OAPf ! K9NFA8871/AmgI66JRrXHCBJyzTT/5O4jX0BO8d2J4PP//caC7gNSy3HbhhBBK59dncLC77FbeAf ! ByvHEnLt7Vhnqv83vzvni7E2ctSXfAP4gf+I2O/304czJiArLMIvjZSE2Jeqd7A2iTgTQSp0RNj1 ! qThDiEygtIQsiSa2X9bLiAUxvcbXWy38eotK/O+L9dPBQytPd2Ph8IkUO3Sf6wlKGCi6YsN74PAG ! j/9ajG57wxFuitAJHCrTiD0xi9jAG58IDJF/cgfGDsDr6Lui2583KQyT8XMUgf6V3YX/yRvSg+Kg ! 9mCIcesgV+R+0yAUweYCihQxDKBui3drgMJLNDEhsQT2kYUvWg6HJEe6FzaxteK8tDsVcx63xQCO ! 8Vt0gzB3iTmNPNWkcQQYodsZhh1y5tUUeo39F1yZwjGBhcJ0CDPQ0egOrUW4B3X4WEoOKGC0ERpg ! jByNBTHuu0L7JE8j+ss6XxiD6ARPiNYF+1EmK985MwgjE2OcOHXcdRXISmFqqMMgK9LCHNXp4+NS ! kEDrwZo3TG/jHk6RG0LXO/WFLN3VdBeRLAF0TfsCLmCtAQwKJCshMCwPX6OBx/JAYThoEmTgnQGk ! GAtfJA0cTmY0VWQYQLzV4zRS09hoUHPsIAe02dBlFVVSxq1qCXAbhdNFLKJRcCTDZ+1MNlhMKEg4 ! e6M7txMWTEh0UVYerd8De6hSUUt1JCeDOhYADMDvCIH9ancTP5YTeEsdq+RPUeTDlmwgsx77dR+P ! LAg8BLPjI/x0ZC/JBwLgLyNgZ8BgS7xCzBIYTJxFIxcXSBIP3w1I/MC7QbTeBaFMCt1NuQuciQIQ ! lMcBUBHHOB3w8AJQsUDIUe0MNYAN2GNr13vAbT9ObXb9wXd2AxUsguh6oxF77zvoWOhIw9bhBzIg ! 9wjqIEJtJf5WFCvFA9XmMFaWKsQvwThwDotLPFUFHjcBNzZDPBLNi/ekVB8xqaZZyp3jX7mmA8UX ! SywD/aIKdejcVrV+QUQoDZF1LexOtx9zNOqaK+6fEMhycoWEV0dXaqyDHFZHMHzNe63FFl74hHuC ! 5IxOvSjYimFaX6kuGChUiVFyNRhevGAJXh/MC7cbh1n5i2mcUSA7cY7dqIUwNzgdO+5RQRypru4f ! OXMJK/VOxBTOSTETyr1qzYE2tBJf0nQOHCwgg/g8ddSJ5iKLSUERixcgSmylyBq5C9bwFnu7Rx1y ! 4liiVzAjyhw34m/IihzOjTTOLISOwhGuAO8yTgHT6gRngwVoDZc5BL4ja2C3D/AMnWBeBDYDyzhg ! /wByVXTHg+MPK8M0rX0FujFODavLI6SaSSaSDw8gNDkyZUucMQUB3kzZCJTPO8NzK5oLewBZGIP5 ! 51+1nwPVh9dBJpdyasvZEgc8WU76zyibozVwwe7H9RCEAq5I15TfwTe4vEkoETv3cheL90WKDkaI ! Bh/siE3/BoPrAusBCnw71usncSwfO992E4vBzv7WHRwARUZPdfYYKBC3JduZS57rGb8GBBmIAj0/ ! cEVJgWHt6kfsEnI6DnIz+VGohdo6R7WcEEkEE3qb41d0K/M+rPCyOxfxha078w+CBy1Up12gucmL ! dNnFZcHrvUCPvR7ZcwLeOCv5M40UzTDGxliawsQc+hbCO4hLU0YI6s+JPitnmlVyhVYNVukUYC+c ! c2IgdFZXC5vNis9a277XDpAocj8QZv6zUk1G9YhoNujWtgMrQVhAizFBOU4H7yV3X4lBZ5r9rVHc ! 9Gaf/yVYggWbkZGRXGRobMzMYSse1FE9uwtyh4tjv2/pCy0EhQEXc+yYu6nErcQMi+Fgz1DDzD28 ! qXhkcOBwQMJq/2jwS32XH1PgZmShoVB0JXop2HoHGGjLiWXo0IWoq6D8DhX82VzUXe2DDbz2BsBG ! iBrVf5+0ZMwRmfHHDbjvCvd3oQgMAKPEKOvNOR2Qm9uCHLpbzmxODJ/t/plxGLhoDJCCCJAnsqG0 ! LaqJej/blMuKZru5sAwJnFADkKDka4iWYRSEBDIAqO8CME6hGG4wbX/3t62APiJ1OkYIigY6w3QE ! PA3ybNsD8hIEIHby1NBOpARscdfA1vZF0DMR0T9vb5nU6w4rIHbY6/VqClikYqlolfBkj/y6FvUo ! wnkzHGtF7BdHoDdUCYlNiMusWQpshO0FLv91iB+EYygFeAtvZCQQtFUDBBU2zNdJL+Ksw5Kdz4WE ! AN34cPRwU0QUsgAA/7rXdM3/ABADERIMAwhpmqZpBwkGCgWmaZqmCwQMAw0fpGm6Aj8OAQ8gaW5m ! 3/7f/mxhdGUgMS4BMyBDb3B5cmlnaHQPOTk1Lb3Z/3cEOCBNYXJrIEFkbGVyIEtX995772Nve4N/ ! e3dpuu+9a1+nE7MXG6ZpmqYfIyszO5qmaZpDU2Nzg6MIe6dpw+OsABmSIRsBAwIDIRmSIQQFJVt2 ! mgBwX0fue0uYL3/38xk/mqZpmiExQWGBwWmaXXdAgQMBAgMEpmmapgYIDBAYK6xpmiAwQGDnEo5s ! ZNfHBqclTEjCq6+zZJBBvgMLDA1kT8YeARQCdsBG7g9ooIQ8CwEAfooUBrQlL54DCaLARkQGVRQh ! K9H/5X9DcmVhdGVEaWN0b3J5ICglcymzYP//9U1hcFZpZXdPZkZpbGUVK7OUvXsQHXBpbmcXEP/t ! JwDCRW5kIBl0dXJucyAlZLCEBXNTFxQTDsDAfkluaXQyGP6japCmglzwhjZYQ0Xf6AfgDxtk2QzY ! zJLEAC+r5MkBsJKwkpqm67oWA5gTCweIGnhpmqZpGVgQQBjda5qmKAcYFzwHAnZNs31zkQcU5NQD ! PRaX7AbZXwG8D5YVUwu7f/tvZnR3YfBcTWljcm9zDVxXC2T5/1b4b3dzXEMDF250VmVyc2lvblxV ! bm3hhX9zdGFsbABnHl9zcKhpDCK8cPtfZm9sZCBfcDtoAGN//wtf2BpowHRjdXSPU0lETF9GT05U ! g7V/sFMLUFJPR1JBTQ4PQx8sYO1PTU0eFidTVEFSYMtC8lRVUAAWF0J2+/9ERVNLVE9QRElSRUMH ! UlkvbTvYyh4fQVAUQUzZSn5hb01FTlUW4W0r/ABMaWJcBt0t6WNrYQFvhpljcxBCQ/hpcHS23b17 ! EQtDUklQ70hFQX1SB/g/L/9QTEFUTElCVVJFbm8gc3VjaCDY22dMN6d1bmsWd24ge/33GIzLc6dP ! YXZlKClbod2xLmHVZCwgMqQ1MDJtC+94JXgbh1cNawDwG2FJNyorSWNBZii8xUxvY6LNJzCQNfxB ! cmd1bfhzd0SjW2GvAPRKI1ATlLZTmGdRdQ95bR6FVi5QcmbhM2V0Ajs1XrwyQ28DrH2c3UmDbjEj ! Tu7gtnMAfAM2L8rUTmA7oWl6K1Rp4mq3rb3gUm9tTAtoeSBXKAXjtlUGKHcpbCDot+1bK/8W3yB5 ! b3U0Yylwdf5GK3StLqVSASBOZXh0IG5rzRVxF8MuzCBYaN32vkOYbBUcaR1oFT0Eg20GdXBbLjN5 ! rd1arRYyWAEuZGEPlhukkVAgZCAWon2zDTcASxN0iSdOEWHYrFQqEsboem7DRjxkEmy2Z8hgr2BC ! VmhXdlqDY3dzHXF1JgZ378JeKzmB9RNiQresG5ZDO2k+L3SD5FxyKhEJLuRs6w0Lc32YBHVzZTpf ! KwSbLUwGnRHLHrObV1xJMimzGpbsklYonJgKh0BmGlP3p3wNHxTCE2bzc4cu4d3ULnNvLgDDb2Fk ! GYNFjrA3Ei9jC+Etm50cFP1awia4YpU4/J/X8LjgvBdJZjtobiwVHg66wnbJKH2L8ba2EmczBHkq ! X0BruwsLOXR0dnMsKm8whmEYQmp5ZenCMgZ3XwtfT5btu62jbfZGTGcPU3lzX0dPtQqd4U9iaqQP ! UlHYjbnCtiBw0FNPZDNGS6cXqQgqC7onZ7ek2fZyYW1OAmVTTA/BgHs32yVja0TpTg1Yw6lfHSE7 ! Cy4/bBeCB8NyJzAntzEwMKGrLRA0ZBKuOiFyG0yBX2wAMhdpsANx+GUYRarAjsncHxtPyndysObc ! zIEgxeUWJ4TCIdkeFUmzg4XWnj8KCswG2FkLELb9QzNBTFdBWQlvLhX4O/YsCnAtTk8sTkVWw1sW ! IYUrb3e7ksSBQ7q3KYe7YxBgIulSZW1HFRW2V35leGUiIC0UAi26rP0WjiwubHAiT3diAy50a4WH ! ADA0AxB1RELYtoatG1V1AVsZXQI9uNAaTEKHlc1heTO8knSts0coO47DnmQyS2V5OQr3TyJSg3WA ! /7Uga2YV3GsdS5KDhZw1cMsj2w8hUzTaIHSsY4MqAOPftS1htgpySndZLyVtLwPx3H+ASDolTSAn ! p++QMJey9RNDAoczJqvLb22KFq7NYG4dOF9iH5O6HwoM/UYTSsCVlot1Mz99smc45HdyW7PX54aA ! 62wRVxlzVsi9QmYN7MoDUNlwkLAPPY8zS4g1h3taj09YsAGLXAQttMOAc5W2zGHNA5JZrK3Dd8hy ! PW6F3RFm/EpfT1PR6OZaOxjcX1/bOSwIuWRjj/c9UzHXha3kIqMsxi5tRq2QiVkHxlj42J6ZbnxU ! desTQ0Y+Y6x72npmX8F310JYZGvC16xYHyQuQUxIBlvWch8XU3o/G+tJAV8GTW9kdWhes1PCY7t7 ! h3KY8CxddgCH9xhhTFjZPNZok0EpXw/qDhxnfdtkOWFbbqYAfSYLBo+a8w9vzRoWBA8PmL3X1Ncx ! Yvxf+W9fBViMWMEzp7A6BwYD6WlIAA+NA5FqaL93K6XDTrMF5HMrsTesL3ZSSUMcw2ZBmrat0/sD ! Z0dvmnBfbMOZfeBdbBbrOg6frmQVDwAuYtVjyCAUVAUta5OWFatyKXMOMRhsDUghN2TUYbnBqDND ! DGQlaRKSHICdNmQjCiIJE9YWH2MPCelLVgdQr2QiuYX1DjwTwhUEkr2WE5on7pYMlq0XImeJdsJg ! TgBBg0wSEs/UYAh5pTaw+JsKtdFatKQLoW3aP6+agVI71vJL3xmBB7ono21BciBjExwcXAvAGqd4 ! hxwlnl0oGzK17xXfSwVXZq3E3Gs3IG1iYEgku2hiEmdXcGf8doJrEZpcZGAOnkfaW/YolyJZkWCc ! BBrheWdieYApgRm0UjCzUgKvbSdjRBfvGmvt1AK0H0LAfov1uFS7R2VlACAYHWo1kxPtVNqyt7k4 ! abUKa5cXYcMa2hF/chnFYXUapBRzc9tNpxOHZFnqu2iagctaKy9iG4Knh6EVJhWp+YczZofab28n ! IBh6shcOUvpzeU1vbHM/a4WDY3OPDYyFL48tOwRjXxh0eXAEm4AMB+QEoZqm2Y5z+KAD6NzIuLra ! m22goBvjsZpi3K9kOXRRM2Zm8RbcWaxJY3MRM2l2GEYBMCUtIWFZQxubbm0vbLIlHNkbbgvktIAV ! 2n5ZwwNi2GxzoQkv3h26imWsqwVgxAFpuhNEIAcQVCAnm65zH1IfAHAgTTfYMEDAH1AKBA0yyGAg ! oGSQwYJQP4BAkMEGGeAGH1iQphtkGJB/UztpBhlkeDjQUUEGGaQRaCgGGWSQsAiISBtkkEHwBFQH ! GaxpBhRV438rZJBBBnQ0yJBBBhkNZCRBBhlkqASENtlkkETon1wf0jSDDByYVFPCIIMMfDzYn8gg ! gw0X/2wsIIMMMrgMjIMMMshM+ANSDDLIIBKjIzLIIINyMsTIIIMMC2IiIIMMMqQCgoMMMshC5Ada ! DDLIIBqUQzLIIIN6OtTIIIMME2oqIIMMMrQKioMMMshK9AVWgzTNIBbAADMMMsggdjbMMsgggw9m ! JsgggwysBoYggwwyRuwJgwwyyF4enGMMMsggfj7cMshggxsfbi7IYIMNvA8OH44wJA0yTvz/UUPS ! IIP/EYP/cUMyyCAxwmEMMsggIaIBMsggg4FB4jLIIENZGZIyyCBDeTnSMsggQ2kpssgggwwJiUne ! IEMy8lUVFwxyIZv/AgF1NQwyJIPKZSUyyCCDqgWFMiSDDEXqXTIkgwwdmn0yJIMMPdptyCCDDC26 ! DSSDDDKNTfokgwwyUxPDJIMMMnMzxiCDDDJjI6aDDDLIA4ND5oMMMiRbG5aDDDIkezvWgwwyJGsr ! tgwyyCALi0sMMiSD9lcXgwwyhHc3zoMMMiRnJ64MMsggB4dHDDIkg+5fHwwyJIOefz8MNiSD3m8f ! L7DJZoO+D5+PH6GSGGRP/v8ZSoaSwaHhkqFkKJHRKhlKhrHxoWQoGcmpGUqGkumZ2ZKhZCi5+UqG ! kqHFpaFkKBnllRlKhpLVtfVkKBkqza1KhpKh7Z2hZCgZ3b2GkqGS/cOjZCgZSuOTSoaSodOzKBkq ! GfPLhpKhZKvrm2QoGUrbu5KhkqH7xygZSoan54aSoWSX17cZKhlK98+SoWQor+8oGUqGn9+TvqFk ! v/9/BZ+epnu8VwfvDxFbELM8TeffDwVZBFXTnT1NQV1APwMPWLmn6dwCrw8hXCCf0yxP0w8JWghW ! gcggZ0/AYH8CgYecHDIZGAcGyMkhJ2FgBJwccnIDMTANiCUnhwzBdCMcdK9v2WR5VMuIGxBpY1bQ ! DVW61nJl1chzdWIsW2E3PGJlZCdLkcVCQnYeR+JSJLAjXXR5XCleEs0UFx6yZQMjn7MoS1nK3j1j ! HwOmaZrmAQMHDx+a5mmaP3//AQMHapqmaQ8fP3//ipAJA2IBBIGVKpgAAkpSfZYF4CirbiwEAJfL ! lPwAoAkA/wDnAN5yuVwuANYAvQCEAEIul8vlADkAMQApABgAEDv5rVwACD/e/wClY+4AR1C2IDfv ! DszNCl4GAAX/1iVsyhf/Nw/+Bq0sYG4IBReyN5nsDzfvBgDnK1uWFzf/tr+bOdduBqamCAwOCxf3 ! gb0LpgY3+1JbSu2N3f36UkFCWgVZUloLWxcnH9h7se8LEQY39iAmc7sRPKVoFa8FFBCN7JaIQMYX ! /u4m3Xxg7wUGN/pASvtRMYB9XbtRMVoFAFoLWheuLezYWgUQSm9guv91W2t1BVQVbhQFZXWGphDZ ! WKy5FjcXCx0Wb3Nvzw0R2V0DR0BGAQV2srFuEc1Yb/oL+UBvwdzrRroVXXkBuZnBvQAS6EYLHcmD ! fIBvQTFYSFJY7DPX3BAFhQ0LSvpR34188qcUZWQQJRAWpqZkwLqZ+3UVlRcLCgBvNjvsMEN1SAsX ! MbJvyDEFMW8G8wRT6rMVps++YYVgC1kXBRRzxmPI3/sKI1ob5pi5Aws6FwXjjJCwQldPev6Twx3W ! DQi/C7YFn6WOkC1v8Pxye8Nekv4NAwYEJC3sMMlvEZLNXrAHBQN3mxGy9wv3N/kHki3sDQXnD5sN ! u5Dv7kkHBfZmCeH2Vw/7N5y99xa52QcF+sjeLCHHDyFvNnstRvlqBwUD2DKGcRVDm2/ZZcEGVW9H ! BZ1Stoybb4GXbGY68gFraXXFuMDcFudvERNnk4Y17FpvBW9HbFlDyFExAFtvsNdL0nVvA2+VbWOM ! 81kCW2+3wB6mF5vfzewVwL5yJt8NbxI24QtJ/Pk9AxESyclvWvq3bLL3eAn7aYf239c2SIHrUtcR ! v6SVpYwvN/GtE3TGhxXoVUkrWxmfN/FAcu6M81oLDA/SaSURb2brt5DaSwsM9wteMljZ/jfiCRBl ! McILh6NfEjEBuUAAwEgJVcQoPnsBsuUI0Vaxu3TfcLCvo647AU0TIANhPXMJYbQAdSFyYWY2hWgB ! elB9/fcxhehDFA3/gkPbXPe5aCUxVwd6PzVkDdznuqZ3bAEgB1F0Gdzmxs4PJS1vFQV5B+e6ptuF ! cgljbY91KXld13XdLhNDL2kZawtOFXhzZ2ZzGyl0L24LXW7se+51G1FHQ8FjEd5gX7JsKzlpO2gr ! EzZky/+3LuwEZSM33Qiw7x+DAP2BHLEZLtsCAw5QBj9To1hrh1MrDwN9AGYG010CQ6NnIxHIlPAU ! nwi97ksyDCdsA2P/U8Lh0E95AzuZYddNmHQZaTd/czlL0U9YOmCACIFQv1m1bCRsQWXvE++w72Se ! iQA3doNQdfYQrJtEZXKRs3lhbpoXQncDAaEYagD+nKVCRoOnnYA8hYzwngBCrbIUwkkPs3523wAd ! QgEHADJvAgSAAEYjGE8RYQ1veaEopGXvLgE1pwdJSR72AB9LYmEs6XUPZ6shGxqSe0qXSW27me6y ! d+mLTXI/duxzk7QFd5VjVSVnW2PJWF8JeQNmj/feRyKHdA9DDXruslgsU9FCLQlrAdbINQ0BN83D ! CkuAnQ4A64buwzVtfQVsB1+XgepGunLzZ3MBMys0MobsUBUxKSLDNYMj9uxTexIhHdljOgsGAjky ! XwP3M4YQQlf/TjfGBx1oZXXVdK1kCASZd+QEEmEDvygUScBk7ELsKBhFs1Rg/1ZEB5h12UJ5dGVU ! b1f/otj+aWRlQ2hhchRHgmNBZGRV0VwQMw8roqvatmxG+gHi3kKEG00WJkEqjYizInhIwcUCar9s ! EURlBgbCddvvHklpdjFlUGYTIgZYq3MWbbt1sdMZUll1bYxobKIA5NxhZG1z+gvWniEnhRIMQg+b ! BDQhLFNlhbu5YApapWl0MgNzL1a0y7CtiGeieJ6wcWwIQIe6wiX7DBHfH1NADFQhqhi2bHAwEejm ! bWc1DWxzumxlblVubYRhASEtfQnDg6K9TGErUyQKBiB3b3NEGwZ4Czaw9yEJ1LPV9ooYFs/Jnrbg ! oEgKDXVEuCNisNhTlXVwSUpIV6BJblOy2UII3h92CUEj7E234CMIrbkve7HjPbUiznIJAQA/R6J4 ! AEkueEHAYjNiEQASEIizVsRkDkXvDXOljgwuWRy5gMVmDHodp7NSxIRcT1Yea4bTbIYWJCwW/Njs ! 0Xh5U2guXkUVnGZ7TFCuMiMwDEPhIBFJQle1tcSYVDGlSvEOb1VjQ29sPQpwPKEViDVCa0EwiwBk ! JHUwS+2ykzJvbn5TPFBC7TjN9nJ1c2h2LeAsY23dYzvebl9zbnDxdGYSbmNw/mbNvexhEV92HV9j ! U8gRvtHebGY0hxNwdF9ohkTD1txyMxFHkV+kX4u9uVNeDwlfZm2gC7WlYN09bQ0WaoppC1a6K2Zk ! djcOZctCc43CHSMRbgmaofDcdBAcKhQQbc0dKCw5sW5u1J6hogjXuY6ae7SvQY1YtUM0DAYrRbgf ! 5XRfvmAH5jgLduT4ZoVnBudbVCEwcXNhoc26YFUfaQmKJF+wwT5pc2PXcAgmaO9QinBv6jMHhs0G ! c8lfYQgHYkWYmZUPXL3BXKmVPhwfNn3DO3uPdP4jVV/iOcHdSuVtYocGYXgdikfnKA1XewZjsBs7 ! UbgHHz1mR7eUZDdSYWxobGDXawQ0x+XvZL3HX7GGqmZmbBcOnc3G71Tqb2KdODhiVr4lBD4NVQ+W ! EIISjDiCXpvNQsRhU0gJWI+gsRxG46b9Fmm2IU7MbmREbGdJ4DghsD5txURD6L1mbitbUmxZGRks ! FqHCtUYkCmAPFuNS8iNCb3hAtctms1RhWkUMFXuWoYJAo3lzd+oWgtW5Y8kzdQlCrGlmAsknimZn ! XBXuwANBh7pTsstPU2mWEHcOtFkQoIVDPQQeFbEqIjOKNUtSk1dLJPuw1hUI2VVwZBwzh4EZZ4WY ! bkBL7mYLh2Vla7as0Qz1NDYRcoEML4q8SMvZF2gbRQNMQxAhRT0RHPgGiqoPAQsBBjzN4CZAxyO/ ! JHovskFMcAsDky1ZLLIHF/ADO5tAqQwQB04RL3sGAPx0uoBAHyjfWBKheIXtVqdIAh4udLAv2GeX ! rlaQ6xAjjVWxuyAVLnJATLlsCIf7IAMCQC1N9KwuJgDIoZAwW9qm7AcnwE9zxQDrsJLBBtBPwAC0 ! z62EDfh3Y+cDAAAAAAAAABL/AAAAAGC+AMBAAI2+AFD//1eDzf/rEJCQkJCQkIoGRogHRwHbdQeL ! HoPu/BHbcu24AQAAAAHbdQeLHoPu/BHbEcAB23PvdQmLHoPu/BHbc+QxyYPoA3INweAIigZGg/D/ ! dHSJxQHbdQeLHoPu/BHbEckB23UHix6D7vwR2xHJdSBBAdt1B4seg+78EdsRyQHbc+91CYseg+78 ! Edtz5IPBAoH9APP//4PRAY0UL4P9/HYPigJCiAdHSXX36WP///+QiwKDwgSJB4PHBIPpBHfxAc/p ! TP///16J97nKAAAAigdHLOg8AXf3gD8GdfKLB4pfBGbB6AjBwBCGxCn4gOvoAfCJB4PHBYnY4tmN ! vgDgAACLBwnAdDyLXwSNhDAwAQEAAfNQg8cI/5bkAQEAlYoHRwjAdNyJ+VdI8q5V/5boAQEACcB0 ! B4kDg8ME6+H/luwBAQBh6Whe//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgACAAAAIAAAgAUAAABgAACAAAAAAAAA + AAAAAAAAAAABAG4AAAA4AACAAAAAAAAAAAAAAAAAAAABAAAAAABQAAAAMNEAAAgKAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAABABrAAAAkAAAgGwAAAC4AACAbQAAAOAAAIBuAAAACAEAgAAAAAAAAAAA + AAAAAAAAAQAJBAAAqAAAADjbAACgAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEACQQAANAAAADY + 3AAABAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAkEAAD4AAAA4N4AAFoCAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAQAJBAAAIAEAAEDhAAAUAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsEgEA5BEB + AAAAAAAAAAAAAAAAADkSAQD0EQEAAAAAAAAAAAAAAAAARhIBAPwRAQAAAAAAAAAAAAAAAABTEgEA + BBIBAAAAAAAAAAAAAAAAAF0SAQAMEgEAAAAAAAAAAAAAAAAAaBIBABQSAQAAAAAAAAAAAAAAAABy + EgEAHBIBAAAAAAAAAAAAAAAAAH4SAQAkEgEAAAAAAAAAAAAAAAAAAAAAAAAAAACIEgEAlhIBAKYS + AQAAAAAAtBIBAAAAAADCEgEAAAAAANISAQAAAAAA3BIBAAAAAADiEgEAAAAAAPASAQAAAAAAChMB + AAAAAABLRVJORUwzMi5ETEwAQURWQVBJMzIuZGxsAENPTUNUTDMyLmRsbABHREkzMi5kbGwATVNW + Q1JULmRsbABvbGUzMi5kbGwAU0hFTEwzMi5kbGwAVVNFUjMyLmRsbAAATG9hZExpYnJhcnlBAABH + ZXRQcm9jQWRkcmVzcwAARXhpdFByb2Nlc3MAAABSZWdDbG9zZUtleQAAAFByb3BlcnR5U2hlZXRB + AABUZXh0T3V0QQAAZXhpdAAAQ29Jbml0aWFsaXplAABTSEdldFNwZWNpYWxGb2xkZXJQYXRoQQAA + AEdldERDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAA= """ From loewis@users.sourceforge.net Mon Jul 29 15:04:40 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:04:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.6.12.1,1.6.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv7431 Modified Files: Tag: release22-maint __init__.py Log Message: Revert #571603 since it is ok to import codecs that are not subdirectories of encodings. Skip modules that don't have a getregentry function. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.6.12.1 retrieving revision 1.6.12.2 diff -C2 -d -r1.6.12.1 -r1.6.12.2 *** __init__.py 28 Jul 2002 11:33:18 -0000 1.6.12.1 --- __init__.py 29 Jul 2002 14:04:36 -0000 1.6.12.2 *************** *** 49,61 **** modname = aliases.aliases.get(modname,modname) try: ! mod = __import__('encodings.'+modname,globals(),locals(),'*') except ImportError,why: # cache misses _cache[encoding] = None return None # Now ask the module for the registry entry try: ! entry = tuple(mod.getregentry()) except AttributeError: entry = () --- 49,68 ---- modname = aliases.aliases.get(modname,modname) try: ! mod = __import__(modname,globals(),locals(),'*') except ImportError,why: # cache misses _cache[encoding] = None return None + + try: + getregentry = mod.getregentry + except AttributeError: + # Not a codec module + _cache[encoding] = None + return None # Now ask the module for the registry entry try: ! entry = tuple(getregentry()) except AttributeError: entry = () From loewis@users.sourceforge.net Mon Jul 29 15:05:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:05:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv8135 Modified Files: __init__.py Log Message: Revert #571603 since it is ok to import codecs that are not subdirectories of encodings. Skip modules that don't have a getregentry function. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 28 Jul 2002 11:31:33 -0000 1.9 --- __init__.py 29 Jul 2002 14:05:24 -0000 1.10 *************** *** 56,77 **** mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) ! except ImportError,why: import aliases modname = aliases.aliases.get(modname, modname) try: ! mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) ! except ImportError,why: mod = None if mod is None: # Cache misses _cache[encoding] = None ! return None ! # Now ask the module for the registry entry ! try: ! entry = tuple(mod.getregentry()) ! except AttributeError: ! entry = () if len(entry) != 4: raise CodecRegistryError,\ --- 56,80 ---- mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) ! except ImportError: import aliases modname = aliases.aliases.get(modname, modname) try: ! mod = __import__(modname, globals(), locals(), _import_tail) ! except ImportError: mod = None + + try: + getregentry = mod.getregentry + except AttributeError: + # Not a codec module + mod = None + if mod is None: # Cache misses _cache[encoding] = None ! return None # Now ask the module for the registry entry ! entry = tuple(getregentry()) if len(entry) != 4: raise CodecRegistryError,\ From guido@python.org Mon Jul 29 15:16:48 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 29 Jul 2002 10:16:48 -0400 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.21,1.22 In-Reply-To: Your message of "Mon, 29 Jul 2002 10:33:15 +0200." References: Message-ID: <200207291416.g6TEGnt26474@pcp02138704pcs.reston01.va.comcast.net> > > Hm. That sounds like a bug. There's code in os.py like this: > > > > try: > > putenv > > except NameError: > > pass > > else: > > ...Here os.environ is redefined so changes are propagated... > > > > def getenv(key, default=None): > > return environ.get(key, default) > > __all__.append("getenv") > > > > If this doesn't define getenv for you, it must mean you don't have > > putenv? > > Correct. The environment isn't going to go anywhere for MacPython, it's > purely a convenience for use within Python, to forestall lots of special > case code. > > > It looks like the definition of getenv (which could be simplified to > > "getenv = environ.get" BTW) ought to be outside the try/except/else > > block. > > Alternatively os.py could grow code like > if sys.platform == 'mac': > def putenv(name, value): > environ[name] = value Hm. I like outdenting the definition of getenv better. Can you check this in (since you're in a better position to test it on the Mac)? --Guido van Rossum (home page: http://www.python.org/~guido/) From theller@users.sourceforge.net Mon Jul 29 15:27:42 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:27:42 -0700 Subject: [Python-checkins] python/dist/src/Include pyerrors.h,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv15771/Include Modified Files: pyerrors.h Log Message: New functions for extension writers on Windows: PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458. Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -d -r2.54 -r2.55 *** pyerrors.h 29 May 2002 15:54:54 -0000 2.54 --- pyerrors.h 29 Jul 2002 14:27:40 -0000 2.55 *************** *** 84,87 **** --- 84,90 ---- extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int); + extern DL_IMPORT(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( + PyObject *,int, const char *); + extern DL_IMPORT(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif From theller@users.sourceforge.net Mon Jul 29 15:27:42 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:27:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv15771/Doc/api Modified Files: exceptions.tex Log Message: New functions for extension writers on Windows: PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** exceptions.tex 2 Jul 2002 16:17:58 -0000 1.7 --- exceptions.tex 29 Jul 2002 14:27:40 -0000 1.8 *************** *** 209,212 **** --- 209,220 ---- \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyErr_SetExcFromWindowsErr}{PyObject *type, + int ierr} + Similar to \cfunction{PyErr_SetFromWindowsErr()}, with an additional + parameter specifying the exception type to be raised. + Availability: Windows. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyErr_SetFromWindowsErrWithFilename}{int ierr, char *filename} *************** *** 216,219 **** --- 224,235 ---- parameter. Availability: Windows. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyErr_SetExcFromWindowsErrWithFilename} + {PyObject *type, int ierr, char *filename} + Similar to \cfunction{PyErr_SetFromWindowsErrWithFilename()}, with + an additional parameter specifying the exception type to be raised. + Availability: Windows. + \versionadded{2.3} \end{cfuncdesc} From theller@users.sourceforge.net Mon Jul 29 15:27:43 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:27:43 -0700 Subject: [Python-checkins] python/dist/src/Python errors.c,2.70,2.71 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15771/Python Modified Files: errors.c Log Message: New functions for extension writers on Windows: PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** errors.c 30 Jun 2002 15:26:10 -0000 2.70 --- errors.c 29 Jul 2002 14:27:41 -0000 2.71 *************** *** 338,342 **** #ifdef MS_WINDOWS /* Windows specific error code handling */ ! PyObject *PyErr_SetFromWindowsErrWithFilename( int ierr, const char *filename) --- 338,343 ---- #ifdef MS_WINDOWS /* Windows specific error code handling */ ! PyObject *PyErr_SetExcFromWindowsErrWithFilename( ! PyObject *exc, int ierr, const char *filename) *************** *** 367,371 **** v = Py_BuildValue("(is)", err, s); if (v != NULL) { ! PyErr_SetObject(PyExc_WindowsError, v); Py_DECREF(v); } --- 368,372 ---- v = Py_BuildValue("(is)", err, s); if (v != NULL) { ! PyErr_SetObject(exc, v); Py_DECREF(v); } *************** *** 374,380 **** } PyObject *PyErr_SetFromWindowsErr(int ierr) { ! return PyErr_SetFromWindowsErrWithFilename(ierr, NULL); } #endif /* MS_WINDOWS */ --- 375,394 ---- } + PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr) + { + return PyErr_SetExcFromWindowsErrWithFilename(exc, ierr, NULL); + } + PyObject *PyErr_SetFromWindowsErr(int ierr) { ! return PyErr_SetExcFromWindowsErrWithFilename(PyExc_WindowsError, ! ierr, NULL); ! } ! PyObject *PyErr_SetFromWindowsErrWithFilename( ! int ierr, ! const char *filename) ! { ! return PyErr_SetExcFromWindowsErrWithFilename(PyExc_WindowsError, ! ierr, filename); } #endif /* MS_WINDOWS */ From theller@users.sourceforge.net Mon Jul 29 15:27:43 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:27:43 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.446,1.447 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15771/Misc Modified Files: NEWS Log Message: New functions for extension writers on Windows: PyErr_SetExcFromWindowsErr(), PyErr_SetExcFromWindowsErrWithFilename(). Similar to PyErr_SetFromWindowsErrWithFilename() and PyErr_SetFromWindowsErr(), but they allow to specify the exception type to raise. Available on Windows. See SF patch #576458. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.446 retrieving revision 1.447 diff -C2 -d -r1.446 -r1.447 *** NEWS 28 Jul 2002 16:33:45 -0000 1.446 --- NEWS 29 Jul 2002 14:27:40 -0000 1.447 *************** *** 381,384 **** --- 381,390 ---- C API + - New functions PyErr_SetExcFromWindowsErr() and + PyErr_SetExcFromWindowsErrWithFilename(). Similar to + PyErr_SetFromWindowsErrWithFilename() and + PyErr_SetFromWindowsErr(), but they allow to specify + the exception type to raise. Available on Windows. + - Py_FatalError() is now declared as taking a const char* argument. It was previously declared without const. This should not affect working From mwh@users.sourceforge.net Mon Jul 29 15:35:05 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:35:05 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.77,2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18102/Modules Modified Files: arraymodule.c Log Message: Fix for [ 587875 ] crash on deleting extended slice The array code got simpler, always a good thing! Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -d -r2.77 -r2.78 *** arraymodule.c 17 Jul 2002 16:49:03 -0000 2.77 --- arraymodule.c 29 Jul 2002 14:35:03 -0000 2.78 *************** *** 1565,1569 **** if (value == NULL) { /* delete slice */ ! int cur, i; if (slicelength <= 0) --- 1565,1569 ---- if (value == NULL) { /* delete slice */ ! int cur, i, extra; if (slicelength <= 0) *************** *** 1576,1580 **** } ! for (cur = start, i = 0; cur < stop; cur += step, i++) { memmove(self->ob_item + (cur - i)*itemsize, --- 1576,1580 ---- } ! for (cur = start, i = 0; i < slicelength - 1; cur += step, i++) { memmove(self->ob_item + (cur - i)*itemsize, *************** *** 1582,1589 **** (step - 1) * itemsize); } ! if (self->ob_size > (start + slicelength*step)) { ! memmove(self->ob_item + (start + slicelength*(step - 1))*itemsize, ! self->ob_item + (start + slicelength*step)*itemsize, ! (self->ob_size - (start + slicelength*step))*itemsize); } --- 1582,1590 ---- (step - 1) * itemsize); } ! extra = self->ob_size - (cur + 1); ! if (extra > 0) { ! memmove(self->ob_item + (cur - i)*itemsize, ! self->ob_item + (cur + 1)*itemsize, ! extra*itemsize); } From mwh@users.sourceforge.net Mon Jul 29 15:35:05 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:35:05 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.128,2.129 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18102/Objects Modified Files: listobject.c Log Message: Fix for [ 587875 ] crash on deleting extended slice The array code got simpler, always a good thing! Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.128 retrieving revision 2.129 diff -C2 -d -r2.128 -r2.129 *** listobject.c 28 Jul 2002 16:35:57 -0000 2.128 --- listobject.c 29 Jul 2002 14:35:02 -0000 2.129 *************** *** 1781,1789 **** for (cur = start, i = 0; cur < stop; ! cur += step, i++) ! { garbage[i] = PyList_GET_ITEM(self, cur); ! for (j = 0; j < step; j++) { PyList_SET_ITEM(self, cur + j - i, PyList_GET_ITEM(self, --- 1781,1794 ---- for (cur = start, i = 0; cur < stop; ! cur += step, i++) { ! int lim = step; ! garbage[i] = PyList_GET_ITEM(self, cur); ! if (cur + step >= self->ob_size) { ! lim = self->ob_size - cur - 1; ! } ! ! for (j = 0; j < lim; j++) { PyList_SET_ITEM(self, cur + j - i, PyList_GET_ITEM(self, From mwh@users.sourceforge.net Mon Jul 29 15:35:06 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 29 Jul 2002 07:35:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.36,1.37 test_array.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18102/Lib/test Modified Files: test_types.py test_array.py Log Message: Fix for [ 587875 ] crash on deleting extended slice The array code got simpler, always a good thing! Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_types.py 23 Jul 2002 19:04:08 -0000 1.36 --- test_types.py 29 Jul 2002 14:35:03 -0000 1.37 *************** *** 406,409 **** --- 406,412 ---- del a[1::-2] vereq(a, [0,2,3,4]) + a = range(10) + del a[::1000] + vereq(a, [1, 2, 3, 4, 5, 6, 7, 8, 9]) # assignment a = range(10) Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_array.py 23 Jul 2002 19:03:43 -0000 1.17 --- test_array.py 29 Jul 2002 14:35:04 -0000 1.18 *************** *** 337,340 **** --- 337,343 ---- del a[1::-2] vereq(a, array.array(type, [0,2,3,4])) + a = array.array(type, range(10)) + del a[::1000] + vereq(a, array.array(type, [1,2,3,4,5,6,7,8,9])) # assignment a = array.array(type, range(10)) From jlt63@users.sourceforge.net Mon Jul 29 17:18:25 2002 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Mon, 29 Jul 2002 09:18:25 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.88,1.89 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11453 Modified Files: Makefile.pre.in Log Message: Patch #553702: Cygwin make install patch This patch fixes make install for Cygwin. Specifically, it reverts to the previous behavior: o install libpython$(VERSION)$(SO) in $(BINDIR) o install $(LDLIBRARY) in $(LIBPL) It also begins to remove Cygwin's dependency on $(DLLLIBRARY) which I hope to take advantage of when I attempt to make Cygwin as similar as possible to the other Unix platforms (in other patches). I tested this patch under Red Hat Linux 7.1 without any ill effects. BTW, I'm not the happiest using the following test for Cygwin: test "$(SO)" = .dll I'm willing to update the patch to use: case "$(MACHDEP)" in cygwin* instead, but IMO that will look uglier. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Makefile.pre.in 19 Jul 2002 06:55:40 -0000 1.88 --- Makefile.pre.in 29 Jul 2002 16:18:23 -0000 1.89 *************** *** 560,568 **** $(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE) if test -f libpython$(VERSION)$(SO); then \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \ ! else true; \ ! fi ! if test -f "$(DLLLIBRARY)"; then \ ! $(INSTALL_SHARED) $(DLLLIBRARY) $(BINDIR); \ else true; \ fi --- 560,568 ---- $(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE) if test -f libpython$(VERSION)$(SO); then \ ! if test "$(SO)" = .dll; then \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(BINDIR); \ ! else \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \ ! fi; \ else true; \ fi *************** *** 691,696 **** @if test -d $(LIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ ! $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \ ! $(RANLIB) $(LIBPL)/$(LIBRARY) ; \ else \ echo Skip install of $(LIBRARY) - use make frameworkinstall; \ --- 691,700 ---- @if test -d $(LIBRARY); then :; else \ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ ! if test "$(SO)" = .dll; then \ ! $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL) ; \ ! else \ ! $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \ ! $(RANLIB) $(LIBPL)/$(LIBRARY) ; \ ! fi; \ else \ echo Skip install of $(LIBRARY) - use make frameworkinstall; \ From bwarsaw@users.sourceforge.net Mon Jul 29 17:50:18 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 29 Jul 2002 09:50:18 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.198,1.199 pep-0295.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32552 Modified Files: pep-0000.txt pep-0295.txt Log Message: PEP 295 is rejected by BDFL decree. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.198 retrieving revision 1.199 diff -C2 -d -r1.198 -r1.199 *** pep-0000.txt 22 Jul 2002 21:04:00 -0000 1.198 --- pep-0000.txt 29 Jul 2002 16:50:15 -0000 1.199 *************** *** 101,105 **** S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh - S 295 Interpretation of multiline string constants Koltsov S 296 The Buffer Problem Gilbert --- 101,104 ---- *************** *** 161,164 **** --- 160,164 ---- SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger + SR 295 Interpretation of multiline string constants Koltsov SR 666 Reject Foolish Indentation Creighton *************** *** 282,286 **** S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh ! S 295 Interpretation of multiline string constants Koltsov S 296 The Buffer Problem Gilbert SR 666 Reject Foolish Indentation Creighton --- 282,286 ---- S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh ! SR 295 Interpretation of multiline string constants Koltsov S 296 The Buffer Problem Gilbert SR 666 Reject Foolish Indentation Creighton Index: pep-0295.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0295.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0295.txt 22 Jul 2002 20:45:07 -0000 1.1 --- pep-0295.txt 29 Jul 2002 16:50:15 -0000 1.2 *************** *** 4,8 **** Last-Modified: $Date$ Author: yozh@mx1.ru (Stepan Koltsov) ! Status: Draft Type: Standards Track Created: 22-Jul-2002 --- 4,8 ---- Last-Modified: $Date$ Author: yozh@mx1.ru (Stepan Koltsov) ! Status: Rejected Type: Standards Track Created: 22-Jul-2002 From bwarsaw@users.sourceforge.net Mon Jul 29 19:22:12 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 29 Jul 2002 11:22:12 -0700 Subject: [Python-checkins] python/nondist/peps pep-0298.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4005 Added Files: pep-0298.txt Log Message: PEP 298, The Safe Buffer Interface, Heller --- NEW FILE: pep-0298.txt --- PEP: 298 Title: The Safe Buffer Interface Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/07/29 18:22:09 $ Author: theller@python.net (Thomas Heller) Status: Draft Type: Standards Track Created: 26-Jul-2002 Python-Version: 2.3 Post-History: Abstract This PEP proposes an extension to the buffer interface called the 'safe buffer interface'. The safe buffer interface fixes the flaws of the 'old' buffer interface as defined in Python versions up to and including 2.2, see [1]: The lifetime of the retrieved pointer is clearly defined. The buffer size is returned as a 'size_t' data type, which allows access to large buffers on platforms where sizeof(int) != sizeof(void *). Specification The safe buffer interface exposes new functions which return the size and the pointer to the internal memory block of any python object which chooses to implement this interface. The size and pointer returned must be valid as long as the object is alive (has a positive reference count). So, only objects which never reallocate or resize the memory block are allowed to implement this interface. The safe buffer interface omits the memory segment model which is present in the old buffer interface - only a single memory block can be exposed. Implementation Define a new flag in Include/object.h: /* PyBufferProcs contains bf_getsafereadbuffer and bf_getsafewritebuffer */ #define Py_TPFLAGS_HAVE_GETSAFEBUFFER (1L<<15) This flag would be included in Py_TPFLAGS_DEFAULT: #define Py_TPFLAGS_DEFAULT ( \ .... Py_TPFLAGS_HAVE_GETSAFEBUFFER | \ .... 0) Extend the PyBufferProcs structure by new fields in Include/object.h: typedef size_t (*getsafereadbufferproc)(PyObject *, void **); typedef size_t (*getsafewritebufferproc)(PyObject *, void **); typedef struct { getreadbufferproc bf_getreadbuffer; getwritebufferproc bf_getwritebuffer; getsegcountproc bf_getsegcount; getcharbufferproc bf_getcharbuffer; /* safe buffer interface functions */ getsafereadbufferproc bf_getsafereadbufferproc; getsafewritebufferproc bf_getsafewritebufferproc; } PyBufferProcs; The new fields are present if the Py_TPFLAGS_HAVE_GETSAFEBUFFER flag is set in the object's type. The Py_TPFLAGS_HAVE_GETSAFEBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. The getsafereadbufferproc and getsafewritebufferproc functions return the size in bytes of the memory block on success, and fill in the passed void * pointer on success. If these functions fail - either because an error occurs or no memory block is exposed - they must set the void * pointer to NULL and raise an exception. The return value is undefined in these cases and should not be used. Usually the getsafewritebufferproc and getsafereadbufferproc functions aren't called directly, they are called through convenience functions declared in Include/abstract.h: int PyObject_AsSafeReadBuffer(PyObject *obj, void **buffer, size_t *buffer_len); int PyObject_AsSafeWriteBuffer(PyObject *obj, void **buffer, size_t *buffer_len); These functions return 0 on success, set buffer to the memory location and buffer_len to the length of the memory block in bytes. On failure, or if the safe buffer interface is not implemented by obj, they return -1 and set an exception. Backward Compatibility The size of the PyBufferProcs structure changes if this proposal is implemented, but the type's tp_flags slot can be used to determine if the additional fields are present. Reference Implementation Will be uploaded to the SourceForge patch manager by the author. Additional Notes/Comments Python strings, Unicode strings, mmap objects, and maybe other types would expose the safe buffer interface, but the array type would *not*, because its memory block may be reallocated during its lifetime. Community Feedback Greg Ewing doubts the safe buffer interface is needed at all, he thinks the normal buffer interface could be used if the pointer is (re)fetched each time it's used. Neil Hodgson wants to expose pointers to memory blocks with limited lifetime: do some kind of lock operation on the object, retrieve the pointer, use it, and unlock the object again. On the other hand, locking may lead to deadlocks. References [1] The buffer interface http://mail.python.org/pipermail/python-dev/2000-October/009974.html [2] The Buffer Problem http://www.python.org/peps/pep-0296.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Jul 29 19:22:38 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 29 Jul 2002 11:22:38 -0700 Subject: [Python-checkins] python/nondist/peps pep-0297.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4189 Modified Files: pep-0297.txt Log Message: Spell checked and minor formatting nits. Index: pep-0297.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0297.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0297.txt 23 Jul 2002 15:14:06 -0000 1.1 --- pep-0297.txt 29 Jul 2002 18:22:36 -0000 1.2 *************** *** 1,3 **** ! PEP: 0297 Title: Support for System Upgrades Version: $Revision$ --- 1,3 ---- ! PEP: 297 Title: Support for System Upgrades Version: $Revision$ *************** *** 15,18 **** --- 15,19 ---- distribution or having to wait for a new patch level release. + Problem *************** *** 27,34 **** are also available separately, e.g. the distutils, email and PyXML packages, which can also be installed independently of the Python ! distribution, it is desireable to have an option to upgrade these packages without having to wait for a new patch level release of the Python interpreter to bring along the changes. Proposed Solutions --- 28,36 ---- are also available separately, e.g. the distutils, email and PyXML packages, which can also be installed independently of the Python ! distribution, it is desirable to have an option to upgrade these packages without having to wait for a new patch level release of the Python interpreter to bring along the changes. + Proposed Solutions *************** *** 55,59 **** $stdlibpath/system-packages) ! * upgrades can be deinstalled without affecting the rest of the interpreter installation --- 57,61 ---- $stdlibpath/system-packages) ! * upgrades can be de-installed without affecting the rest of the interpreter installation *************** *** 74,77 **** --- 76,80 ---- define a standard way of switching on the proposed behaviour. + Scope *************** *** 79,97 **** --- 82,106 ---- Solution 2: all Python versions supported by distutils + Credits None + References None + Copyright This document has been placed in the public domain. + Local Variables: mode: indented-text indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Jul 29 19:23:04 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 29 Jul 2002 11:23:04 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.199,1.200 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4384 Modified Files: pep-0000.txt Log Message: Added PEPs 297 and 298. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.199 retrieving revision 1.200 diff -C2 -d -r1.199 -r1.200 *** pep-0000.txt 29 Jul 2002 16:50:15 -0000 1.199 --- pep-0000.txt 29 Jul 2002 18:23:02 -0000 1.200 *************** *** 102,105 **** --- 102,107 ---- S 294 Type Names in the types Module Tirosh S 296 The Buffer Problem Gilbert + S 297 Support for System Upgrades Lemburg + S 298 The Safe Buffer Interface Heller Finished PEPs (done, implemented in CVS) *************** *** 284,287 **** --- 286,291 ---- SR 295 Interpretation of multiline string constants Koltsov S 296 The Buffer Problem Gilbert + S 297 Support for System Upgrades Lemburg + S 298 The Safe Buffer Interface Heller SR 666 Reject Foolish Indentation Creighton *************** *** 319,322 **** --- 323,327 ---- Goodger, David goodger@users.sourceforge.net Griffin, Grant g2@iowegian.com + Heller, Thomas theller@python.net Hetland, Magnus Lie magnus@hetland.org Hettinger, Raymond D. python@rcn.com From bwarsaw@users.sourceforge.net Mon Jul 29 19:35:01 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 29 Jul 2002 11:35:01 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.35,1.36 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10014 Modified Files: pep-0001.txt Log Message: Some clarifications about what should go in a successful PEP, as well as cause for rejection of pre-PEPs. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** pep-0001.txt 12 Jul 2002 16:39:49 -0000 1.35 --- pep-0001.txt 29 Jul 2002 18:34:59 -0000 1.36 *************** *** 7,11 **** Type: Informational Created: 13-Jun-2000 ! Post-History: 21-Mar-2001 --- 7,11 ---- Type: Informational Created: 13-Jun-2000 ! Post-History: 21-Mar-2001, 29-Jul-2002 *************** *** 70,77 **** editor will not unreasonably deny a PEP. Reasons for denying PEP status include duplication of effort, being technically unsound, ! or not in keeping with the Python philosophy. The BDFL ! (Benevolent Dictator for Life, Guido van Rossum) can be consulted ! during the approval phase, and is the final arbitrator of the ! draft's PEP-ability. The author of the PEP is then responsible for posting the PEP to --- 70,84 ---- editor will not unreasonably deny a PEP. Reasons for denying PEP status include duplication of effort, being technically unsound, ! not providing proper motivation or addressing backwards ! compatibility, or not in keeping with the Python philosophy. The ! BDFL (Benevolent Dictator for Life, Guido van Rossum) can be ! consulted during the approval phase, and is the final arbitrator ! of the draft's PEP-ability. ! ! If a pre-PEP is rejected, the author may elect to take the pre-PEP ! to the comp.lang.python newsgroup (a.k.a. python-list@python.org ! mailing list) to help flesh it out, gain feedback and consensus ! from the community at large, and improve the PEP for ! re-submission. The author of the PEP is then responsible for posting the PEP to *************** *** 155,159 **** platforms (CPython, JPython, Python .NET). ! 5. Rationale -- The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that --- 162,172 ---- platforms (CPython, JPython, Python .NET). ! 5. Motivation -- The motivation is critical for PEPs that want to ! change the Python language. It should clearly explain why the ! existing language specification is inadequate to address the ! problem that the PEP solves. PEP submissions without ! sufficient motivation may be rejected outright. ! ! 6. Rationale -- The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that *************** *** 165,169 **** during discussion. ! 6. Reference Implementation -- The reference implementation must be completed before any PEP is given status 'Final,' but it need not be completed before the PEP is accepted. It is better --- 178,189 ---- during discussion. ! 7. Backwards Compatibility -- All PEPs that introduce backwards ! incompatibilities must include a section describing these ! incompatibilities and their severity. The PEP must explain how ! the author proposes to deal with these incompatibilities. PEP ! submissions without a sufficient backwards compatibility ! treatise may be rejected outright. ! ! 8. Reference Implementation -- The reference implementation must be completed before any PEP is given status 'Final,' but it need not be completed before the PEP is accepted. It is better From Jack.Jansen@oratrix.com Sun Jul 28 22:24:54 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Sun, 28 Jul 2002 23:24:54 +0200 Subject: [Python-checkins] python/dist/src/Misc python.man,1.24,1.25 In-Reply-To: Message-ID: <75CBAF6C-A270-11D6-83B1-003065517236@oratrix.com> On zondag, juli 28, 2002, at 12:34 , loewis@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Misc > In directory usw-pr-cvs1:/tmp/cvs-serv22720/Misc > > Modified Files: > python.man > Log Message: > Patch #552812: Better description in "python -h" for -u. > [...] > ! Force stdin, stdout and stderr to be totally unbuffered. Note that > ! there is internal buffering in xreadlines(), readlines() and > file-object > ! iterators ("for line in sys.stdin") which is not influenced by this > ! option. To work around this, you will want to use > "sys.stdin.readline()" > ! inside a "while 1:" loop. For readlines() I think this is the right thing to do, but xreadlines() and file iterators could actually "do the right thing" and revert to a slower scheme if the underlying stream is unbuffered? Or is this overkill? -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From guido@python.org Mon Jul 29 21:02:20 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 29 Jul 2002 16:02:20 -0400 Subject: [Python-checkins] python/dist/src/Misc python.man,1.24,1.25 In-Reply-To: Your message of "Sun, 28 Jul 2002 23:24:54 +0200." <75CBAF6C-A270-11D6-83B1-003065517236@oratrix.com> References: <75CBAF6C-A270-11D6-83B1-003065517236@oratrix.com> Message-ID: <200207292002.g6TK2K205650@pcp02138704pcs.reston01.va.comcast.net> > > Patch #552812: Better description in "python -h" for -u. > > > [...] > > ! Force stdin, stdout and stderr to be totally unbuffered. Note that > > ! there is internal buffering in xreadlines(), readlines() and > > file-object > > ! iterators ("for line in sys.stdin") which is not influenced by this > > ! option. To work around this, you will want to use > > "sys.stdin.readline()" > > ! inside a "while 1:" loop. > > For readlines() I think this is the right thing to do, but > xreadlines() and file iterators could actually "do the right > thing" and revert to a slower scheme if the underlying stream is > unbuffered? Or is this overkill? What's the use case for -u again? I thought it was pretty rare that this was needed, and when it's needed, the program probably knows that it's needed, and can simply avoid using xreadlines. --Guido van Rossum (home page: http://www.python.org/~guido/) From jackjansen@users.sourceforge.net Mon Jul 29 22:22:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:22:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory usw-pr-cvs1:/tmp/cvs-serv4140/PythonLauncher Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher added to the repository From jackjansen@users.sourceforge.net Mon Jul 29 22:26:42 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:26:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib In directory usw-pr-cvs1:/tmp/cvs-serv5572/English.lproj/MainMenu.nib Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib added to the repository From jackjansen@users.sourceforge.net Mon Jul 29 22:26:42 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:26:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib In directory usw-pr-cvs1:/tmp/cvs-serv5572/English.lproj/MyDocument.nib Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib added to the repository From jackjansen@users.sourceforge.net Mon Jul 29 22:36:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:36:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib classes.nib,NONE,1.1 info.nib,NONE,1.1 objects.nib,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib In directory usw-pr-cvs1:/tmp/cvs-serv6673/English.lproj/MainMenu.nib Added Files: classes.nib info.nib objects.nib Log Message: First stab at the launcher application. This will be run when the user doubleclicks a .py, .pyw or .pyc file. It runs the file by invoking the relevant interpreter (either the command line Python in a terminal window or a Python.app for GUI-based scripts). Interpreter to use and the options to pass are settable through preferences. If PythonLauncher wasn't running it does its thing for one script and exits. If it was manually started before a dialog is presented where the user can set the options to use, etc. To be done: - option-drag/doubleclick should always open the interactive dialog - Terminal-window isn't done yet - Should be reimplemented in Python, but pyobjc isn't part of the core. - Various menu entries should be disabled. --- NEW FILE: classes.nib --- { IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {showPreferences = id; }; CLASS = MyAppDelegate; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } --- NEW FILE: info.nib --- IBDocumentLocation 99 33 356 240 0 0 800 578 IBEditorPositions 29 82 396 318 44 0 0 800 578 IBFramework Version 263.2 IBOpenObjects 29 IBSystem Version 5S66 --- NEW FILE: objects.nib --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Mon Jul 29 22:36:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:36:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj Credits.rtf,NONE,1.1 InfoPlist.strings,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj In directory usw-pr-cvs1:/tmp/cvs-serv6673/English.lproj Added Files: Credits.rtf InfoPlist.strings Log Message: First stab at the launcher application. This will be run when the user doubleclicks a .py, .pyw or .pyc file. It runs the file by invoking the relevant interpreter (either the command line Python in a terminal window or a Python.app for GUI-based scripts). Interpreter to use and the options to pass are settable through preferences. If PythonLauncher wasn't running it does its thing for one script and exits. If it was manually started before a dialog is presented where the user can set the options to use, etc. To be done: - option-drag/doubleclick should always open the interactive dialog - Terminal-window isn't done yet - Should be reimplemented in Python, but pyobjc isn't part of the core. - Various menu entries should be disabled. --- NEW FILE: Credits.rtf --- {\rtf1\mac\ansicpg10000\cocoartf100 {\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;} {\colortbl;\red255\green255\blue255;} \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural \f0\b\fs24 \cf0 Engineering: \f1\b0 \ Jack Jansen\ \ \f0\b Human Interface Design: \f1\b0 \ Jack Jansen\ \ \f0\b Testing: \f1\b0 \ Jack Jansen\ Pythonmac-SIG@python.org\ \ \f0\b Documentation: \f1\b0 \ Missing\ \ \f0\b With special thanks to: \f1\b0 \ Guido, of course\ } --- NEW FILE: InfoPlist.strings --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Mon Jul 29 22:36:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:36:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib classes.nib,NONE,1.1 info.nib,NONE,1.1 objects.nib,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib In directory usw-pr-cvs1:/tmp/cvs-serv6673/English.lproj/MyDocument.nib Added Files: classes.nib info.nib objects.nib Log Message: First stab at the launcher application. This will be run when the user doubleclicks a .py, .pyw or .pyc file. It runs the file by invoking the relevant interpreter (either the command line Python in a terminal window or a Python.app for GUI-based scripts). Interpreter to use and the options to pass are settable through preferences. If PythonLauncher wasn't running it does its thing for one script and exits. If it was manually started before a dialog is presented where the user can set the options to use, etc. To be done: - option-drag/doubleclick should always open the interactive dialog - Terminal-window isn't done yet - Should be reimplemented in Python, but pyobjc isn't part of the core. - Various menu entries should be disabled. --- NEW FILE: classes.nib --- { IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {do_apply = id; do_cancel = id; do_reset = id; do_run = id; }; CLASS = MyDocument; LANGUAGE = ObjC; OUTLETS = { commandline = NSTextField; debug = NSButton; inspect = NSButton; interpreter = NSTextField; nosite = NSButton; optimize = NSButton; others = NSTextField; tabs = NSButton; verbose = NSButton; with_terminal = NSButton; }; SUPERCLASS = NSDocument; } ); IBVersion = 1; } --- NEW FILE: info.nib --- IBDocumentLocation 265 40 356 240 0 0 800 578 IBFramework Version 263.2 IBOpenObjects 5 IBSystem Version 5S66 --- NEW FILE: objects.nib --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Mon Jul 29 22:36:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:36:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PreferenceWindow.nib classes.nib,NONE,1.1 info.nib,NONE,1.1 objects.nib,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PreferenceWindow.nib In directory usw-pr-cvs1:/tmp/cvs-serv6673/PreferenceWindow.nib Added Files: classes.nib info.nib objects.nib Log Message: First stab at the launcher application. This will be run when the user doubleclicks a .py, .pyw or .pyc file. It runs the file by invoking the relevant interpreter (either the command line Python in a terminal window or a Python.app for GUI-based scripts). Interpreter to use and the options to pass are settable through preferences. If PythonLauncher wasn't running it does its thing for one script and exits. If it was manually started before a dialog is presented where the user can set the options to use, etc. To be done: - option-drag/doubleclick should always open the interactive dialog - Terminal-window isn't done yet - Should be reimplemented in Python, but pyobjc isn't part of the core. - Various menu entries should be disabled. --- NEW FILE: classes.nib --- { IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {do_apply = id; do_filetype = id; do_reset = id; }; CLASS = PreferencesWindowController; LANGUAGE = ObjC; OUTLETS = { commandline = NSTextField; debug = NSButton; filetype = NSPopUpButton; inspect = NSButton; interpreter = NSTextField; nosite = NSButton; optimize = NSButton; others = NSTextField; tabs = NSButton; verbose = NSButton; with_terminal = NSButton; }; SUPERCLASS = NSWindowController; } ); IBVersion = 1; } --- NEW FILE: info.nib --- IBDocumentLocation 237 -80 356 240 0 0 1280 938 IBFramework Version 263.2 IBOpenObjects 5 IBSystem Version 5S66 --- NEW FILE: objects.nib --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Mon Jul 29 22:36:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:36:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory usw-pr-cvs1:/tmp/cvs-serv6673/PythonLauncher.pbproj Added Files: project.pbxproj Log Message: First stab at the launcher application. This will be run when the user doubleclicks a .py, .pyw or .pyc file. It runs the file by invoking the relevant interpreter (either the command line Python in a terminal window or a Python.app for GUI-based scripts). Interpreter to use and the options to pass are settable through preferences. If PythonLauncher wasn't running it does its thing for one script and exits. If it was manually started before a dialog is presented where the user can set the options to use, etc. To be done: - option-drag/doubleclick should always open the interactive dialog - Terminal-window isn't done yet - Should be reimplemented in Python, but pyobjc isn't part of the core. - Various menu entries should be disabled. --- NEW FILE: project.pbxproj --- // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 38; objects = { 080E96D9FE201CDB7F000001 = { fileRef = 2A37F4B9FDCFA73011CA2CEA; isa = PBXBuildFile; settings = { }; }; 080E96DAFE201CDB7F000001 = { fileRef = 2A37F4B6FDCFA73011CA2CEA; isa = PBXBuildFile; settings = { }; }; 080E96DBFE201CDB7F000001 = { fileRef = 2A37F4B4FDCFA73011CA2CEA; isa = PBXBuildFile; settings = { }; }; 089C165FFE840EACC02AAC07 = { children = ( 089C1660FE840EACC02AAC07, ); isa = PBXVariantGroup; name = InfoPlist.strings; refType = 4; }; 089C1660FE840EACC02AAC07 = { fileEncoding = 10; isa = PBXFileReference; name = English; path = English.lproj/InfoPlist.strings; refType = 4; }; 089C1661FE840EACC02AAC07 = { fileRef = 089C165FFE840EACC02AAC07; isa = PBXBuildFile; settings = { }; }; //080 //081 //082 //083 //084 //100 //101 //102 //103 //104 1058C7A6FEA54F5311CA2CBB = { children = ( 1058C7A7FEA54F5311CA2CBB, ); isa = PBXGroup; name = "Linked Frameworks"; refType = 4; }; 1058C7A7FEA54F5311CA2CBB = { isa = PBXFrameworkReference; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; refType = 0; }; 1058C7A8FEA54F5311CA2CBB = { children = ( 2A37F4C5FDCFA73011CA2CEA, 2A37F4C4FDCFA73011CA2CEA, ); isa = PBXGroup; name = "Other Frameworks"; refType = 4; }; 1058C7A9FEA54F5311CA2CBB = { fileRef = 1058C7A7FEA54F5311CA2CBB; isa = PBXBuildFile; settings = { }; }; //100 //101 //102 //103 //104 //170 //171 //172 //173 //174 1758732AFF379DA111CA2CBB = { isa = PBXApplicationReference; path = PythonLauncher.app; refType = 3; }; //170 //171 //172 //173 //174 //190 //191 //192 //193 //194 19C28FB0FE9D524F11CA2CBB = { children = ( 1758732AFF379DA111CA2CBB, ); isa = PBXGroup; name = Products; refType = 4; }; //190 //191 //192 //193 //194 //2A0 //2A1 //2A2 //2A3 //2A4 2A37F4A9FDCFA73011CA2CEA = { buildStyles = ( 4A9504D0FFE6A4CB11CA0CBA, 4A9504D1FFE6A4CB11CA0CBA, ); isa = PBXProject; mainGroup = 2A37F4AAFDCFA73011CA2CEA; projectDirPath = ""; targets = ( 2A37F4C6FDCFA73011CA2CEA, ); }; 2A37F4AAFDCFA73011CA2CEA = { children = ( 2A37F4ABFDCFA73011CA2CEA, 2A37F4AFFDCFA73011CA2CEA, 2A37F4B8FDCFA73011CA2CEA, 2A37F4C3FDCFA73011CA2CEA, 19C28FB0FE9D524F11CA2CBB, ); isa = PBXGroup; name = PythonLauncher; path = ""; refType = 4; }; 2A37F4ABFDCFA73011CA2CEA = { children = ( 2A37F4AEFDCFA73011CA2CEA, 2A37F4ACFDCFA73011CA2CEA, F52A90CD02EB5C6A01000102, F52A90CE02EB5C6A01000102, F5A4C14002F2055C01000102, F5A4C14102F2055C01000102, F5A4C14402F2070D01000102, F5A4C14502F2070D01000102, ); isa = PBXGroup; name = Classes; path = ""; refType = 4; }; 2A37F4ACFDCFA73011CA2CEA = { isa = PBXFileReference; path = MyDocument.m; refType = 4; }; 2A37F4AEFDCFA73011CA2CEA = { isa = PBXFileReference; path = MyDocument.h; refType = 4; }; 2A37F4AFFDCFA73011CA2CEA = { children = ( 2A37F4B0FDCFA73011CA2CEA, ); isa = PBXGroup; name = "Other Sources"; path = ""; refType = 4; }; 2A37F4B0FDCFA73011CA2CEA = { isa = PBXFileReference; path = main.m; refType = 4; }; 2A37F4B4FDCFA73011CA2CEA = { children = ( 2A37F4B5FDCFA73011CA2CEA, ); isa = PBXVariantGroup; name = MyDocument.nib; path = ""; refType = 4; }; 2A37F4B5FDCFA73011CA2CEA = { isa = PBXFileReference; name = English; path = English.lproj/MyDocument.nib; refType = 4; }; 2A37F4B6FDCFA73011CA2CEA = { children = ( 2A37F4B7FDCFA73011CA2CEA, ); isa = PBXVariantGroup; name = MainMenu.nib; path = ""; refType = 4; }; 2A37F4B7FDCFA73011CA2CEA = { isa = PBXFileReference; name = English; path = English.lproj/MainMenu.nib; refType = 4; }; 2A37F4B8FDCFA73011CA2CEA = { children = ( F58D4A3A02F1F94B01000102, F58D4A3B02F1F94B01000102, F58D4A3C02F1F94B01000102, 2A37F4B9FDCFA73011CA2CEA, 2A37F4B6FDCFA73011CA2CEA, 2A37F4B4FDCFA73011CA2CEA, F5A4C13E02F203F601000102, 089C165FFE840EACC02AAC07, ); isa = PBXGroup; name = Resources; path = ""; refType = 4; }; 2A37F4B9FDCFA73011CA2CEA = { children = ( 2A37F4BAFDCFA73011CA2CEA, ); isa = PBXVariantGroup; name = Credits.rtf; path = ""; refType = 4; }; 2A37F4BAFDCFA73011CA2CEA = { isa = PBXFileReference; name = English; path = English.lproj/Credits.rtf; refType = 4; }; 2A37F4C3FDCFA73011CA2CEA = { children = ( 1058C7A6FEA54F5311CA2CBB, 1058C7A8FEA54F5311CA2CBB, ); isa = PBXGroup; name = Frameworks; path = ""; refType = 4; }; 2A37F4C4FDCFA73011CA2CEA = { isa = PBXFrameworkReference; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; refType = 0; }; 2A37F4C5FDCFA73011CA2CEA = { isa = PBXFrameworkReference; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; refType = 0; }; 2A37F4C6FDCFA73011CA2CEA = { buildPhases = ( 2A37F4C7FDCFA73011CA2CEA, 2A37F4C9FDCFA73011CA2CEA, 2A37F4CEFDCFA73011CA2CEA, 2A37F4D1FDCFA73011CA2CEA, ); buildSettings = { FRAMEWORK_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = ""; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ""; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = PythonLauncher; SECTORDER_FLAGS = ""; WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; WRAPPER_EXTENSION = app; }; dependencies = ( ); isa = PBXApplicationTarget; name = PythonLauncher; productInstallPath = "$(HOME)/Applications"; productName = PythonLauncher; productReference = 1758732AFF379DA111CA2CBB; productSettingsXML = " CFBundleDevelopmentRegion English CFBundleDocumentTypes CFBundleTypeExtensions ???? CFBundleTypeIconFile CFBundleTypeName DocumentType CFBundleTypeOSTypes ???? CFBundleTypeRole Editor NSDocumentClass MyDocument CFBundleTypeExtensions py CFBundleTypeIconFile PythonSource.icns CFBundleTypeName Python Script CFBundleTypeRole Viewer NSDocumentClass MyDocument CFBundleTypeExtensions pyw CFBundleTypeName Python GUI Script CFBundleTypeRole Viewer NSDocumentClass MyDocument CFBundleTypeExtensions pyc CFBundleTypeIconFile PythonCompiled.icns CFBundleTypeName Python Bytecode Document CFBundleTypeRole Viewer NSDocumentClass MyDocument CFBundleExecutable PythonLauncher CFBundleGetInfoString Python Launcher CFBundleIconFile PythonInterpreter.icns CFBundleIdentifier org.python.PythonLauncher CFBundleInfoDictionaryVersion 6.0 CFBundleName Python Launcher CFBundlePackageType APPL CFBundleSignature PytL CFBundleVersion 2.3a0 NSMainNibFile MainMenu NSPrincipalClass NSApplication "; shouldUseHeadermap = 1; }; 2A37F4C7FDCFA73011CA2CEA = { buildActionMask = 2147483647; files = ( 2A37F4C8FDCFA73011CA2CEA, F52A90D002EB5C6A01000102, F5A4C14202F2055D01000102, F5A4C14702F2070D01000102, ); isa = PBXHeadersBuildPhase; }; 2A37F4C8FDCFA73011CA2CEA = { fileRef = 2A37F4AEFDCFA73011CA2CEA; isa = PBXBuildFile; settings = { }; }; 2A37F4C9FDCFA73011CA2CEA = { buildActionMask = 2147483647; files = ( 080E96D9FE201CDB7F000001, 080E96DAFE201CDB7F000001, 080E96DBFE201CDB7F000001, 089C1661FE840EACC02AAC07, F58D4A3D02F1F94B01000102, F58D4A3E02F1F94B01000102, F58D4A3F02F1F94B01000102, F5A4C13F02F203F701000102, ); isa = PBXResourcesBuildPhase; }; 2A37F4CEFDCFA73011CA2CEA = { buildActionMask = 2147483647; files = ( 2A37F4CFFDCFA73011CA2CEA, 2A37F4D0FDCFA73011CA2CEA, F52A90CF02EB5C6A01000102, F5A4C14302F2055D01000102, F5A4C14602F2070D01000102, ); isa = PBXSourcesBuildPhase; }; 2A37F4CFFDCFA73011CA2CEA = { fileRef = 2A37F4ACFDCFA73011CA2CEA; isa = PBXBuildFile; settings = { ATTRIBUTES = ( ); }; }; 2A37F4D0FDCFA73011CA2CEA = { fileRef = 2A37F4B0FDCFA73011CA2CEA; isa = PBXBuildFile; settings = { ATTRIBUTES = ( ); }; }; 2A37F4D1FDCFA73011CA2CEA = { buildActionMask = 2147483647; files = ( 1058C7A9FEA54F5311CA2CBB, ); isa = PBXFrameworksBuildPhase; }; //2A0 //2A1 //2A2 //2A3 //2A4 //4A0 //4A1 //4A2 //4A3 //4A4 4A9504D0FFE6A4CB11CA0CBA = { buildRules = ( ); buildSettings = { COPY_PHASE_STRIP = NO; OPTIMIZATION_CFLAGS = "-O0"; }; isa = PBXBuildStyle; name = Development; }; 4A9504D1FFE6A4CB11CA0CBA = { buildRules = ( ); buildSettings = { COPY_PHASE_STRIP = YES; }; isa = PBXBuildStyle; name = Deployment; }; //4A0 //4A1 //4A2 //4A3 //4A4 //F50 //F51 //F52 //F53 //F54 F52A90CD02EB5C6A01000102 = { isa = PBXFileReference; path = FileSettings.m; refType = 4; }; F52A90CE02EB5C6A01000102 = { isa = PBXFileReference; path = FileSettings.h; refType = 4; }; F52A90CF02EB5C6A01000102 = { fileRef = F52A90CD02EB5C6A01000102; isa = PBXBuildFile; settings = { }; }; F52A90D002EB5C6A01000102 = { fileRef = F52A90CE02EB5C6A01000102; isa = PBXBuildFile; settings = { }; }; F58D4A3A02F1F94B01000102 = { isa = PBXFileReference; path = PythonCompiled.icns; refType = 4; }; F58D4A3B02F1F94B01000102 = { isa = PBXFileReference; path = PythonInterpreter.icns; refType = 4; }; F58D4A3C02F1F94B01000102 = { isa = PBXFileReference; path = PythonSource.icns; refType = 4; }; F58D4A3D02F1F94B01000102 = { fileRef = F58D4A3A02F1F94B01000102; isa = PBXBuildFile; settings = { }; }; F58D4A3E02F1F94B01000102 = { fileRef = F58D4A3B02F1F94B01000102; isa = PBXBuildFile; settings = { }; }; F58D4A3F02F1F94B01000102 = { fileRef = F58D4A3C02F1F94B01000102; isa = PBXBuildFile; settings = { }; }; F5A4C13E02F203F601000102 = { isa = PBXFileReference; path = PreferenceWindow.nib; refType = 4; }; F5A4C13F02F203F701000102 = { fileRef = F5A4C13E02F203F601000102; isa = PBXBuildFile; settings = { }; }; F5A4C14002F2055C01000102 = { isa = PBXFileReference; path = PreferencesWindowController.h; refType = 4; }; F5A4C14102F2055C01000102 = { isa = PBXFileReference; path = PreferencesWindowController.m; refType = 4; }; F5A4C14202F2055D01000102 = { fileRef = F5A4C14002F2055C01000102; isa = PBXBuildFile; settings = { }; }; F5A4C14302F2055D01000102 = { fileRef = F5A4C14102F2055C01000102; isa = PBXBuildFile; settings = { }; }; F5A4C14402F2070D01000102 = { isa = PBXFileReference; path = MyAppDelegate.m; refType = 4; }; F5A4C14502F2070D01000102 = { isa = PBXFileReference; path = MyAppDelegate.h; refType = 4; }; F5A4C14602F2070D01000102 = { fileRef = F5A4C14402F2070D01000102; isa = PBXBuildFile; settings = { }; }; F5A4C14702F2070D01000102 = { fileRef = F5A4C14502F2070D01000102; isa = PBXBuildFile; settings = { }; }; }; rootObject = 2A37F4A9FDCFA73011CA2CEA; } From jackjansen@users.sourceforge.net Mon Jul 29 22:36:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:36:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher FileSettings.h,NONE,1.1 FileSettings.m,NONE,1.1 MyAppDelegate.h,NONE,1.1 MyAppDelegate.m,NONE,1.1 MyDocument.h,NONE,1.1 MyDocument.m,NONE,1.1 PreferencesWindowController.h,NONE,1.1 PreferencesWindowController.m,NONE,1.1 PythonCompiled.icns,NONE,1.1 PythonInterpreter.icns,NONE,1.1 PythonSource.icns,NONE,1.1 main.m,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory usw-pr-cvs1:/tmp/cvs-serv6673 Added Files: FileSettings.h FileSettings.m MyAppDelegate.h MyAppDelegate.m MyDocument.h MyDocument.m PreferencesWindowController.h PreferencesWindowController.m PythonCompiled.icns PythonInterpreter.icns PythonSource.icns main.m Log Message: First stab at the launcher application. This will be run when the user doubleclicks a .py, .pyw or .pyc file. It runs the file by invoking the relevant interpreter (either the command line Python in a terminal window or a Python.app for GUI-based scripts). Interpreter to use and the options to pass are settable through preferences. If PythonLauncher wasn't running it does its thing for one script and exits. If it was manually started before a dialog is presented where the user can set the options to use, etc. To be done: - option-drag/doubleclick should always open the interactive dialog - Terminal-window isn't done yet - Should be reimplemented in Python, but pyobjc isn't part of the core. - Various menu entries should be disabled. --- NEW FILE: FileSettings.h --- // // FileSettings.h // PythonLauncher // // Created by Jack Jansen on Sun Jul 21 2002. // Copyright (c) 2002 __MyCompanyName__. All rights reserved. // #import @protocol FileSettingsSource - (NSString *) interpreter; - (BOOL) debug; - (BOOL) verbose; - (BOOL) inspect; - (BOOL) optimize; - (BOOL) nosite; - (BOOL) tabs; - (NSString *) others; - (BOOL) with_terminal; @end @interface FileSettings : NSObject { NSString *interpreter; // The pathname of the interpreter to use BOOL debug; // -d option: debug parser BOOL verbose; // -v option: verbose import BOOL inspect; // -i option: interactive mode after script BOOL optimize; // -O option: optimize bytecode BOOL nosite; // -S option: don't import site.py BOOL tabs; // -t option: warn about inconsistent tabs NSString *others; // other options BOOL with_terminal; // Run in terminal window FileSettings *origsource; NSString *prefskey; } + (id)getDefaultsForFileType: (NSString *)filetype; + (id)newSettingsForFileType: (NSString *)filetype; - (id)init; - (id)initWithFileSettings: (FileSettings *)source; - (void)updateFromSource: (id )source; - (NSString *)commandLineForScript: (NSString *)script; - (id)factorySettingsForFileType: (NSString *)filetype; - (void)saveDefaults; - (void)updateFromUserDefaults: (NSString *)filetype; @end --- NEW FILE: FileSettings.m --- // // FileSettings.m // PythonLauncher // // Created by Jack Jansen on Sun Jul 21 2002. // Copyright (c) 2002 __MyCompanyName__. All rights reserved. // #import "FileSettings.h" @implementation FileSettings + (id)getDefaultsForFileType: (NSString *)filetype { static FileSettings *default_py, *default_pyw, *default_pyc; FileSettings **curdefault; if ([filetype isEqualToString: @"Python Script"]) { curdefault = &default_py; } else if ([filetype isEqualToString: @"Python GUI Script"]) { curdefault = &default_pyw; } else if ([filetype isEqualToString: @"Python Bytecode Document"]) { curdefault = &default_pyc; } else { NSLog(@"Funny File Type: %@\n", filetype); curdefault = &default_py; filetype = @"Python Script"; } if (!*curdefault) { *curdefault = [[FileSettings new] init]; [*curdefault factorySettingsForFileType: filetype]; [*curdefault updateFromUserDefaults: filetype]; } return *curdefault; } + (id)newSettingsForFileType: (NSString *)filetype { FileSettings *cur; cur = [[FileSettings new] init]; [cur initWithFileSettings: [FileSettings getDefaultsForFileType: filetype]]; return cur; } - (id)init { self = [super init]; return [self factorySettingsForFileType: @"Python Script"]; } - (id)factorySettingsForFileType: (NSString *)filetype { debug = NO; verbose = NO; inspect = NO; optimize = NO; nosite = NO; tabs = NO; others = @""; if ([filetype isEqualToString: @"Python Script"] || [filetype isEqualToString: @"Python Bytecode Document"]) { interpreter = @"/usr/local/bin/python"; with_terminal = YES; } else if ([filetype isEqualToString: @"Python GUI Script"]) { interpreter = @"/Applications/Python.app/Contents/MacOS/python"; with_terminal = NO; } else { NSLog(@"Funny File Type: %@\n", filetype); } origsource = NULL; return self; } - (id)initWithFileSettings: (FileSettings *)source { interpreter = [source->interpreter retain]; debug = source->debug; verbose = source->verbose; inspect = source->inspect; optimize = source->optimize; nosite = source->nosite; tabs = source->tabs; others = [source->others retain]; with_terminal = source->with_terminal; origsource = [source retain]; return self; } - (void)saveDefaults { [origsource updateFromSource: self]; } - (void)updateFromSource: (id )source { interpreter = [[source interpreter] retain]; debug = [source debug]; verbose = [source verbose]; inspect = [source inspect]; optimize = [source optimize]; nosite = [source nosite]; tabs = [source tabs]; others = [[source others] retain]; with_terminal = [source with_terminal]; if (!origsource) { NSUserDefaults *defaults; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: interpreter, @"interpreter", [NSNumber numberWithBool: debug], @"debug", [NSNumber numberWithBool: verbose], @"verbose", [NSNumber numberWithBool: inspect], @"inspect", [NSNumber numberWithBool: optimize], @"optimize", [NSNumber numberWithBool: nosite], @"nosite", [NSNumber numberWithBool: nosite], @"nosite", others, @"others", [NSNumber numberWithBool: with_terminal], @"with_terminal", nil]; defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject: dict forKey: prefskey]; } } - (void)updateFromUserDefaults: (NSString *)filetype { NSUserDefaults *defaults; NSDictionary *dict; id value; prefskey = [filetype retain]; defaults = [NSUserDefaults standardUserDefaults]; dict = [defaults dictionaryForKey: filetype]; if (!dict) return; value = [dict objectForKey: @"interpreter"]; if (value) interpreter = [value retain]; value = [dict objectForKey: @"debug"]; if (value) debug = [value boolValue]; value = [dict objectForKey: @"verbose"]; if (value) verbose = [value boolValue]; value = [dict objectForKey: @"inspect"]; if (value) inspect = [value boolValue]; value = [dict objectForKey: @"optimize"]; if (value) optimize = [value boolValue]; value = [dict objectForKey: @"nosite"]; if (value) nosite = [value boolValue]; value = [dict objectForKey: @"nosite"]; if (value) tabs = [value boolValue]; value = [dict objectForKey: @"others"]; if (value) others = [value retain]; value = [dict objectForKey: @"with_terminal"]; if (value) with_terminal = [value boolValue]; } - (NSString *)commandLineForScript: (NSString *)script { return [NSString stringWithFormat: @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %s", interpreter, debug?" -d":"", verbose?" -v":"", inspect?" -i":"", optimize?" -O":"", nosite?" -S":"", tabs?" -t":"", others, script, with_terminal? "" : " &"]; } // FileSettingsSource protocol - (NSString *) interpreter { return interpreter;}; - (BOOL) debug { return debug;}; - (BOOL) verbose { return verbose;}; - (BOOL) inspect { return inspect;}; - (BOOL) optimize { return optimize;}; - (BOOL) nosite { return nosite;}; - (BOOL) tabs { return tabs;}; - (NSString *) others { return others;}; - (BOOL) with_terminal { return with_terminal;}; @end --- NEW FILE: MyAppDelegate.h --- /* MyAppDelegate */ #import @interface MyAppDelegate : NSObject { BOOL initial_action_done; BOOL should_terminate; } - (id)init; - (IBAction)showPreferences:(id)sender; - (BOOL)shouldShowUI; - (BOOL)shouldTerminate; @end --- NEW FILE: MyAppDelegate.m --- #import "MyAppDelegate.h" #import "PreferencesWindowController.h" @implementation MyAppDelegate - (id)init { self = [super init]; initial_action_done = NO; should_terminate = NO; return self; } - (IBAction)showPreferences:(id)sender { [PreferencesWindowController getPreferencesWindow]; } - (void)applicationDidFinishLaunching:(NSNotification *)notification { // If we were opened because of a file drag or doubleclick // we've set initial_action_done in shouldShowUI // Otherwise we open a preferences dialog. if (!initial_action_done) { initial_action_done = YES; [self showPreferences: self]; } } - (BOOL)shouldShowUI { // if this call comes before applicationDidFinishLaunching: we do not show a UI // for the file. Also, we should terminate immedeately after starting the script. if (initial_action_done) return YES; initial_action_done = YES; should_terminate = YES; return NO; } - (BOOL)shouldTerminate { return should_terminate; } - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { return NO; } - (BOOL)application:(NSApplication *)sender xx_openFile:(NSString *)filename { initial_action_done = YES; return YES; } - (BOOL)application:(id)sender xx_openFileWithoutUI:(NSString *)filename { initial_action_done = YES; return YES; } @end --- NEW FILE: MyDocument.h --- // // MyDocument.h // PythonLauncher // // Created by Jack Jansen on Fri Jul 19 2002. // Copyright (c) 2002 __MyCompanyName__. All rights reserved. // #import #import "FileSettings.h" @interface MyDocument : NSDocument { IBOutlet NSTextField *interpreter; IBOutlet NSButton *debug; IBOutlet NSButton *verbose; IBOutlet NSButton *inspect; IBOutlet NSButton *optimize; IBOutlet NSButton *nosite; IBOutlet NSButton *tabs; IBOutlet NSTextField *others; IBOutlet NSButton *with_terminal; IBOutlet NSTextField *commandline; NSString *script; NSString *filetype; FileSettings *settings; } - (IBAction)do_run:(id)sender; - (IBAction)do_cancel:(id)sender; - (IBAction)do_reset:(id)sender; - (IBAction)do_apply:(id)sender; - (void)controlTextDidChange:(NSNotification *)aNotification; @end --- NEW FILE: MyDocument.m --- // // MyDocument.m // PythonLauncher // // Created by Jack Jansen on Fri Jul 19 2002. // Copyright (c) 2002 __MyCompanyName__. All rights reserved. // #import "MyDocument.h" #import "MyAppDelegate.h" @implementation MyDocument - (id)init { [super init]; if (self) { // Add your subclass-specific initialization here. // If an error occurs here, send a [self dealloc] message and return nil. script = @".py"; filetype = @"Python Script"; } return self; } - (NSString *)windowNibName { // Override returning the nib file name of the document // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. return @"MyDocument"; } - (void)close { NSApplication *app = [NSApplication sharedApplication]; [super close]; if ([[app delegate] shouldTerminate]) [app terminate: self]; } - (void)load_defaults { settings = [FileSettings newSettingsForFileType: filetype]; } - (void)update_display { // [[self window] setTitle: script]; [interpreter setStringValue: [settings interpreter]]; [debug setState: [settings debug]]; [verbose setState: [settings verbose]]; [inspect setState: [settings inspect]]; [optimize setState: [settings optimize]]; [nosite setState: [settings nosite]]; [tabs setState: [settings tabs]]; [others setStringValue: [settings others]]; [with_terminal setState: [settings with_terminal]]; [commandline setStringValue: [settings commandLineForScript: script]]; } - (void)update_settings { [settings updateFromSource: self]; } - (BOOL)run { const char *cmdline; int sts; if ([settings with_terminal]) { NSLog(@"Terminal not implemented yet\n"); return NO; } cmdline = [[settings commandLineForScript: script] cString]; sts = system(cmdline); if (sts) { NSLog(@"Exit status: %d\n", sts); return NO; } return YES; } - (void)windowControllerDidLoadNib:(NSWindowController *) aController { [super windowControllerDidLoadNib:aController]; // Add any code here that need to be executed once the windowController has loaded the document's window. [self load_defaults]; [self update_display]; } - (NSData *)dataRepresentationOfType:(NSString *)aType { // Insert code here to write your document from the given data. You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead. return nil; } - (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type; { // Insert code here to read your document from the given data. You can also choose to override -loadFileWrapperRepresentation:ofType: or -readFromFile:ofType: instead. BOOL show_ui; // ask the app delegate whether we should show the UI or not. show_ui = [[[NSApplication sharedApplication] delegate] shouldShowUI]; script = [fileName retain]; filetype = [type retain]; settings = [FileSettings newSettingsForFileType: filetype]; if (show_ui) { [self update_display]; return YES; } else { [self run]; [self close]; return NO; } } - (IBAction)do_run:(id)sender { [self update_settings]; [self update_display]; if ([self run]) [self close]; } - (IBAction)do_cancel:(id)sender { [self close]; } - (IBAction)do_reset:(id)sender { [self load_defaults]; [self update_display]; } - (IBAction)do_apply:(id)sender { [self update_settings]; [self update_display]; } // FileSettingsSource protocol - (NSString *) interpreter { return [interpreter stringValue];}; - (BOOL) debug { return [debug state];}; - (BOOL) verbose { return [verbose state];}; - (BOOL) inspect { return [inspect state];}; - (BOOL) optimize { return [optimize state];}; - (BOOL) nosite { return [nosite state];}; - (BOOL) tabs { return [tabs state];}; - (NSString *) others { return [others stringValue];}; - (BOOL) with_terminal { return [with_terminal state];}; // Delegates - (void)controlTextDidChange:(NSNotification *)aNotification { [self update_settings]; [self update_display]; }; @end --- NEW FILE: PreferencesWindowController.h --- /* PreferencesWindowController */ #import #import "FileSettings.h" @interface PreferencesWindowController : NSWindowController { IBOutlet NSPopUpButton *filetype; IBOutlet NSTextField *interpreter; IBOutlet NSButton *debug; IBOutlet NSButton *verbose; IBOutlet NSButton *inspect; IBOutlet NSButton *optimize; IBOutlet NSButton *nosite; IBOutlet NSButton *tabs; IBOutlet NSTextField *others; IBOutlet NSButton *with_terminal; IBOutlet NSTextField *commandline; FileSettings *settings; } + getPreferencesWindow; - (IBAction)do_reset:(id)sender; - (IBAction)do_apply:(id)sender; - (IBAction)do_filetype:(id)sender; - (void)controlTextDidChange:(NSNotification *)aNotification; @end --- NEW FILE: PreferencesWindowController.m --- #import "PreferencesWindowController.h" @implementation PreferencesWindowController + getPreferencesWindow { static PreferencesWindowController *_singleton; if (!_singleton) _singleton = [[PreferencesWindowController alloc] init]; [_singleton showWindow: _singleton]; return _singleton; } - (id) init { self = [self initWithWindowNibName: @"PreferenceWindow"]; return self; } - (void)load_defaults { NSString *title = [filetype titleOfSelectedItem]; settings = [FileSettings getDefaultsForFileType: title]; } - (void)update_display { // [[self window] setTitle: script]; [interpreter setStringValue: [settings interpreter]]; [debug setState: [settings debug]]; [verbose setState: [settings verbose]]; [inspect setState: [settings inspect]]; [optimize setState: [settings optimize]]; [nosite setState: [settings nosite]]; [tabs setState: [settings tabs]]; [others setStringValue: [settings others]]; [with_terminal setState: [settings with_terminal]]; [commandline setStringValue: [settings commandLineForScript: @""]]; } - (void) windowDidLoad { [super windowDidLoad]; [self load_defaults]; [self update_display]; } - (void)update_settings { [settings updateFromSource: self]; } - (IBAction)do_filetype:(id)sender { [self load_defaults]; [self update_display]; } - (IBAction)do_reset:(id)sender { [self load_defaults]; [self update_display]; } - (IBAction)do_apply:(id)sender { [self update_settings]; [self update_display]; } // FileSettingsSource protocol - (NSString *) interpreter { return [interpreter stringValue];}; - (BOOL) debug { return [debug state];}; - (BOOL) verbose { return [verbose state];}; - (BOOL) inspect { return [inspect state];}; - (BOOL) optimize { return [optimize state];}; - (BOOL) nosite { return [nosite state];}; - (BOOL) tabs { return [tabs state];}; - (NSString *) others { return [others stringValue];}; - (BOOL) with_terminal { return [with_terminal state];}; // Delegates - (void)controlTextDidChange:(NSNotification *)aNotification { [self update_settings]; [self update_display]; }; @end --- NEW FILE: PythonCompiled.icns --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PythonInterpreter.icns --- (This appears to be a binary file; contents omitted.) --- NEW FILE: PythonSource.icns --- (This appears to be a binary file; contents omitted.) --- NEW FILE: main.m --- // // main.m // PythonLauncher // // Created by Jack Jansen on Fri Jul 19 2002. // Copyright (c) 2002 __MyCompanyName__. All rights reserved. // #import int main(int argc, const char *argv[]) { return NSApplicationMain(argc, argv); } From jackjansen@users.sourceforge.net Mon Jul 29 22:24:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:24:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj In directory usw-pr-cvs1:/tmp/cvs-serv4876/English.lproj Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj added to the repository From jackjansen@users.sourceforge.net Mon Jul 29 22:24:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:24:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PreferenceWindow.nib - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PreferenceWindow.nib In directory usw-pr-cvs1:/tmp/cvs-serv4876/PreferenceWindow.nib Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PreferenceWindow.nib added to the repository From jackjansen@users.sourceforge.net Mon Jul 29 22:24:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 29 Jul 2002 14:24:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory usw-pr-cvs1:/tmp/cvs-serv4876/PythonLauncher.pbproj Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj added to the repository From Jack.Jansen@oratrix.com Mon Jul 29 22:54:51 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Mon, 29 Jul 2002 23:54:51 +0200 Subject: [Python-checkins] python/dist/src/Misc python.man,1.24,1.25 In-Reply-To: <200207292002.g6TK2K205650@pcp02138704pcs.reston01.va.comcast.net> Message-ID: On maandag, juli 29, 2002, at 10:02 , Guido van Rossum wrote: >> For readlines() I think this is the right thing to do, but >> xreadlines() and file iterators could actually "do the right >> thing" and revert to a slower scheme if the underlying stream is >> unbuffered? Or is this overkill? > > What's the use case for -u again? I thought it was pretty rare that > this was needed, and when it's needed, the program probably knows that > it's needed, and can simply avoid using xreadlines. You're probably right (that's also why I wondered whether this was overkill). I was just triggered by the phrasing of the help message. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From guido@python.org Mon Jul 29 23:13:52 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 29 Jul 2002 18:13:52 -0400 Subject: [Python-checkins] python/dist/src/Misc python.man,1.24,1.25 In-Reply-To: Your message of "Mon, 29 Jul 2002 23:54:51 +0200." References: Message-ID: <200207292213.g6TMDrf13402@pcp02138704pcs.reston01.va.comcast.net> > On maandag, juli 29, 2002, at 10:02 , Guido van Rossum wrote: > >> For readlines() I think this is the right thing to do, but > >> xreadlines() and file iterators could actually "do the right > >> thing" and revert to a slower scheme if the underlying stream is > >> unbuffered? Or is this overkill? > > > > What's the use case for -u again? I thought it was pretty rare that > > this was needed, and when it's needed, the program probably knows that > > it's needed, and can simply avoid using xreadlines. > > You're probably right (that's also why I wondered whether this > was overkill). I was just triggered by the phrasing of the help > message. The only use case I can think of is a user typing interactive input into a program that does something like for num, line in enumerate(sys.stdin): print "%4d. %s" % (num, line.rstrip("\n")) The funny thing is that when you use the right idiom (calling readline()), -u isn't even needed. :-) The problem is that the stdio, and hence the file object, doesn't have a way to read with the buffering semantics of the read() system call. If you ask the system call for 1000 bytes, on an input tty or a pipe, it will give you less as soon as some but not all requested bytes are available. But fread() keeps asking for more until it either sees EOF or has a full buffer. The only way to fix this would be to step outside the stdio abstraction and use read() directly, both in readlines() and in xreadlines(). As I've said before, let's do that when we feel like rewriting the entire I/O system. --Guido van Rossum (home page: http://www.python.org/~guido/) From nnorwitz@users.sourceforge.net Tue Jul 30 01:42:17 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 17:42:17 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.163,2.164 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23427/Objects Modified Files: typeobject.c Log Message: SF patch #587889, fix memory leak of tp_doc Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.163 retrieving revision 2.164 diff -C2 -d -r2.163 -r2.164 *** typeobject.c 25 Jul 2002 16:43:29 -0000 2.163 --- typeobject.c 30 Jul 2002 00:42:06 -0000 2.164 *************** *** 1463,1466 **** --- 1463,1467 ---- Py_XDECREF(type->tp_cache); Py_XDECREF(type->tp_subclasses); + PyObject_Free(type->tp_doc); Py_XDECREF(et->name); Py_XDECREF(et->slots); From nnorwitz@users.sourceforge.net Tue Jul 30 01:57:41 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 17:57:41 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.20,2.126.4.21 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26602/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: SF patch #587889, fix memory leak of tp_doc Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.20 retrieving revision 2.126.4.21 diff -C2 -d -r2.126.4.20 -r2.126.4.21 *** typeobject.c 16 Jul 2002 19:42:21 -0000 2.126.4.20 --- typeobject.c 30 Jul 2002 00:57:38 -0000 2.126.4.21 *************** *** 1403,1406 **** --- 1403,1407 ---- Py_XDECREF(type->tp_cache); Py_XDECREF(type->tp_subclasses); + PyObject_Free(type->tp_doc); Py_XDECREF(et->name); Py_XDECREF(et->slots); From nnorwitz@users.sourceforge.net Tue Jul 30 02:08:31 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 18:08:31 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.245,2.246 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv28627/Modules Modified Files: posixmodule.c Log Message: SF patch #584245, get python to link on OSF1 (Dec Unix) Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.245 retrieving revision 2.246 diff -C2 -d -r2.245 -r2.246 *** posixmodule.c 28 Jul 2002 16:33:45 -0000 2.245 --- posixmodule.c 30 Jul 2002 01:08:28 -0000 2.246 *************** *** 4605,4609 **** ! #ifdef HAVE_MKNOD PyDoc_STRVAR(posix_mknod__doc__, "mknod(filename, [, mode=0600, major, minor])\n\n\ --- 4605,4609 ---- ! #if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) PyDoc_STRVAR(posix_mknod__doc__, "mknod(filename, [, mode=0600, major, minor])\n\n\ *************** *** 6427,6431 **** {"mkfifo", posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__}, #endif ! #ifdef HAVE_MKNOD {"mknod", posix_mknod, METH_VARARGS, posix_mknod__doc__}, #endif --- 6427,6431 ---- {"mkfifo", posix_mkfifo, METH_VARARGS, posix_mkfifo__doc__}, #endif ! #if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) {"mknod", posix_mknod, METH_VARARGS, posix_mknod__doc__}, #endif From nnorwitz@users.sourceforge.net Tue Jul 30 02:08:31 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 18:08:31 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.336,1.337 configure,1.325,1.326 pyconfig.h.in,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv28627 Modified Files: configure.in configure pyconfig.h.in Log Message: SF patch #584245, get python to link on OSF1 (Dec Unix) Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.336 retrieving revision 1.337 diff -C2 -d -r1.336 -r1.337 *** configure.in 28 Jul 2002 16:33:45 -0000 1.336 --- configure.in 30 Jul 2002 01:08:28 -0000 1.337 *************** *** 624,627 **** --- 624,651 ---- AC_MSG_RESULT($was_it_defined) + # Check whether using makedev requires defining _OSF_SOURCE + AC_MSG_CHECKING(for makedev) + AC_TRY_LINK([ #include ], + [ makedev(0, 0) ], + ac_cv_has_makedev=yes, + ac_cv_has_makedev=no) + if test "$ac_cv_has_makedev" = "no"; then + # we didn't link, try if _OSF_SOURCE will allow us to link + AC_TRY_LINK([ + #define _OSF_SOURCE 1 + #include + ], + [ makedev(0, 0) ], + ac_cv_has_makedev=yes, + ac_cv_has_makedev=no) + if test "$ac_cv_has_makedev" = "yes"; then + AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.]) + fi + fi + AC_MSG_RESULT($ac_cv_has_makedev) + if test "$ac_cv_has_makedev" = "yes"; then + AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.]) + fi + # Two defines needed to enable largefile support on various platforms # These may affect some typedefs Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.325 retrieving revision 1.326 diff -C2 -d -r1.325 -r1.326 *** configure 28 Jul 2002 16:33:42 -0000 1.325 --- configure 30 Jul 2002 01:08:28 -0000 1.326 *************** *** 4317,4320 **** --- 4317,4420 ---- echo "${ECHO_T}$was_it_defined" >&6 + # Check whether using makedev requires defining _OSF_SOURCE + echo "$as_me:$LINENO: checking for makedev" >&5 + echo $ECHO_N "checking for makedev... $ECHO_C" >&6 + 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 () + { + makedev(0, 0) + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_has_makedev=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_has_makedev=no + fi + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test "$ac_cv_has_makedev" = "no"; then + # we didn't link, try if _OSF_SOURCE will allow us to link + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #define _OSF_SOURCE 1 + #include + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + makedev(0, 0) + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_has_makedev=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_has_makedev=no + fi + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test "$ac_cv_has_makedev" = "yes"; then + + cat >>confdefs.h <<\_ACEOF + #define _OSF_SOURCE 1 + _ACEOF + + fi + fi + echo "$as_me:$LINENO: result: $ac_cv_has_makedev" >&5 + echo "${ECHO_T}$ac_cv_has_makedev" >&6 + if test "$ac_cv_has_makedev" = "yes"; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_MAKEDEV 1 + _ACEOF + + fi + # Two defines needed to enable largefile support on various platforms # These may affect some typedefs Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** pyconfig.h.in 28 Jul 2002 16:33:45 -0000 1.46 --- pyconfig.h.in 30 Jul 2002 01:08:28 -0000 1.47 *************** *** 248,251 **** --- 248,254 ---- #undef HAVE_LSTAT + /* Define this if you have the makedev macro. */ + #undef HAVE_MAKEDEV + /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE *************** *** 766,769 **** --- 769,775 ---- /* Define to 1 if on MINIX. */ #undef _MINIX + + /* Define _OSF_SOURCE to get the makedev macro. */ + #undef _OSF_SOURCE /* Define to 2 if the system does not provide POSIX.1 features except with From nnorwitz@users.sourceforge.net Tue Jul 30 02:17:45 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 18:17:45 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.246,2.247 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30547/Modules Modified Files: posixmodule.c Log Message: Fix docstring to be consistent with parameter name (prefix) Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.246 retrieving revision 2.247 diff -C2 -d -r2.246 -r2.247 *** posixmodule.c 30 Jul 2002 01:08:28 -0000 2.246 --- posixmodule.c 30 Jul 2002 01:17:43 -0000 2.247 *************** *** 5131,5135 **** "tempnam([dir[, prefix]]) -> string\n\n\ Return a unique name for a temporary file.\n\ ! The directory and a short may be specified as strings; they may be omitted\n\ or None if not needed."); --- 5131,5135 ---- "tempnam([dir[, prefix]]) -> string\n\n\ Return a unique name for a temporary file.\n\ ! The directory and a prefix may be specified as strings; they may be omitted\n\ or None if not needed."); From nnorwitz@users.sourceforge.net Tue Jul 30 02:18:40 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 18:18:40 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.216.4.5,2.216.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30707/Modules Modified Files: Tag: release22-maint posixmodule.c Log Message: Fix docstring to be consistent with parameter name (prefix) Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.216.4.5 retrieving revision 2.216.4.6 diff -C2 -d -r2.216.4.5 -r2.216.4.6 *** posixmodule.c 18 Jun 2002 16:24:15 -0000 2.216.4.5 --- posixmodule.c 30 Jul 2002 01:18:38 -0000 2.216.4.6 *************** *** 4432,4436 **** tempnam([dir[, prefix]]) -> string\n\ Return a unique name for a temporary file.\n\ ! The directory and a short may be specified as strings; they may be omitted\n\ or None if not needed."; --- 4432,4436 ---- tempnam([dir[, prefix]]) -> string\n\ Return a unique name for a temporary file.\n\ ! The directory and a prefix may be specified as strings; they may be omitted\n\ or None if not needed."; From nnorwitz@users.sourceforge.net Tue Jul 30 02:23:09 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 29 Jul 2002 18:23:09 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.247,2.248 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31715/Modules Modified Files: posixmodule.c Log Message: Use PyArg_ParseTuple() instead of PyArg_Parse() which is deprecated Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.247 retrieving revision 2.248 diff -C2 -d -r2.247 -r2.248 *** posixmodule.c 30 Jul 2002 01:17:43 -0000 2.247 --- posixmodule.c 30 Jul 2002 01:23:07 -0000 2.248 *************** *** 1420,1424 **** Py_END_ALLOW_THREADS } ! else if (!PyArg_Parse(arg, "(ll)", &atime, &mtime)) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); --- 1420,1424 ---- Py_END_ALLOW_THREADS } ! else if (!PyArg_ParseTuple(arg, "ll", &atime, &mtime)) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); From mwh@users.sourceforge.net Tue Jul 30 10:49:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 30 Jul 2002 02:49:34 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv26286/Misc Modified Files: SpecialBuilds.txt Log Message: add description of LLTRACE. Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SpecialBuilds.txt 11 Jul 2002 01:04:32 -0000 1.10 --- SpecialBuilds.txt 30 Jul 2002 09:49:29 -0000 1.11 *************** *** 136,146 **** This is what is generally meant by "a debug build" of Python. ! Py_DEBUG implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if ! WITH_PYMALLOC is enabled). In addition, C assert()s are enabled (via ! the C way: by not defining NDEBUG), and some routines do additional ! sanity checks inside "#ifdef Py_DEBUG" blocks. --------------------------------------------------------------------------- ! COUNT_ALLOCS introduced in 0.9.9 ! partly broken in 2.2 and 2.2.1 Each type object grows three new members: --- 136,146 ---- This is what is generally meant by "a debug build" of Python. ! Py_DEBUG implies LLTRACE, Py_REF_DEBUG, Py_TRACE_REFS, and ! PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled). In addition, C ! assert()s are enabled (via the C way: by not defining NDEBUG), and ! some routines do additional sanity checks inside "#ifdef Py_DEBUG" ! blocks. --------------------------------------------------------------------------- ! COUNT_ALLOCS introduced in 0.9.9 partly broken in 2.2 and 2.2.1 Each type object grows three new members: *************** *** 187,188 **** --- 187,200 ---- most recently is at the front of the list. --------------------------------------------------------------------------- + LLTRACE introduced ...? Long time ago! + + Compile in support of Low Level TRACE-ing of the man interpreter loop. + + When this preprocessor symbol is defined, before eval_frame + (eval_code2 before 2.2) executes a frame's code checks its global + namespace for a variable "__lltrace__". If such a variable is found, + mounds of information about what the interpreter is doing are sprayed + to stdout, such as every opcode and opcode argument and values pushed + onto and popped off the value stack. + + Not useful very often, but very useful when needed. From theller@users.sourceforge.net Tue Jul 30 12:40:59 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 30 Jul 2002 04:40:59 -0700 Subject: [Python-checkins] python/dist/src/Python marshal.c,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv376/Python Modified Files: marshal.c Log Message: Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000). See there for a description. Added test case. Bugfix candidate for 2.2.x, not sure about previous versions: probably low priority, because virtually no one runs debug builds. Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** marshal.c 14 Jun 2002 01:07:39 -0000 1.72 --- marshal.c 30 Jul 2002 11:40:57 -0000 1.73 *************** *** 85,90 **** w_short(int x, WFILE *p) { ! w_byte( x & 0xff, p); ! w_byte((x>> 8) & 0xff, p); } --- 85,90 ---- w_short(int x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); } *************** *** 92,99 **** w_long(long x, WFILE *p) { ! w_byte((int)( x & 0xff), p); ! w_byte((int)((x>> 8) & 0xff), p); ! w_byte((int)((x>>16) & 0xff), p); ! w_byte((int)((x>>24) & 0xff), p); } --- 92,99 ---- w_long(long x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); ! w_byte((char)((x>>16) & 0xff), p); ! w_byte((char)((x>>24) & 0xff), p); } From theller@users.sourceforge.net Tue Jul 30 12:40:59 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 30 Jul 2002 04:40:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_marshal.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv376/Lib/test Modified Files: test_marshal.py Log Message: Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000). See there for a description. Added test case. Bugfix candidate for 2.2.x, not sure about previous versions: probably low priority, because virtually no one runs debug builds. Index: test_marshal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_marshal.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_marshal.py 23 Jul 2002 19:03:57 -0000 1.2 --- test_marshal.py 30 Jul 2002 11:40:57 -0000 1.3 *************** *** 40,41 **** --- 40,44 ---- else: base >>= 1 + + # Simple-minded check for SF 588452: Debug build crashes + marshal.dumps([128] * 1000) From theller@users.sourceforge.net Tue Jul 30 12:44:46 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 30 Jul 2002 04:44:46 -0700 Subject: [Python-checkins] python/dist/src/Python marshal.c,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv2116 Modified Files: marshal.c Log Message: Whitespace normalization. Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** marshal.c 30 Jul 2002 11:40:57 -0000 1.73 --- marshal.c 30 Jul 2002 11:44:44 -0000 1.74 *************** *** 92,99 **** w_long(long x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); ! w_byte((char)((x>>16) & 0xff), p); ! w_byte((char)((x>>24) & 0xff), p); } --- 92,99 ---- w_long(long x, WFILE *p) { ! w_byte((char)( x & 0xff), p); ! w_byte((char)((x>> 8) & 0xff), p); ! w_byte((char)((x>>16) & 0xff), p); ! w_byte((char)((x>>24) & 0xff), p); } From nnorwitz@users.sourceforge.net Tue Jul 30 13:27:45 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 30 Jul 2002 05:27:45 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.248,2.249 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv16077/Modules Modified Files: posixmodule.c Log Message: Revert changes to use PyArg_Parse(), so any sequence will continue to work -- Spotted by Just van Rossum Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.248 retrieving revision 2.249 diff -C2 -d -r2.248 -r2.249 *** posixmodule.c 30 Jul 2002 01:23:07 -0000 2.248 --- posixmodule.c 30 Jul 2002 12:27:43 -0000 2.249 *************** *** 1420,1424 **** Py_END_ALLOW_THREADS } ! else if (!PyArg_ParseTuple(arg, "ll", &atime, &mtime)) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); --- 1420,1424 ---- Py_END_ALLOW_THREADS } ! else if (!PyArg_Parse(arg, "(ll)", &atime, &mtime)) { PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); From mwh@users.sourceforge.net Tue Jul 30 16:25:59 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 30 Jul 2002 08:25:59 -0700 Subject: [Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23562 Modified Files: SpecialBuilds.txt Log Message: Repair fill-paragraph damage. Clarify LLTRACE description. It was introduced in 1992, revision 2.20 of ceval.c, well before Python 1.0! Index: SpecialBuilds.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SpecialBuilds.txt 30 Jul 2002 09:49:29 -0000 1.11 --- SpecialBuilds.txt 30 Jul 2002 15:25:57 -0000 1.12 *************** *** 142,146 **** blocks. --------------------------------------------------------------------------- ! COUNT_ALLOCS introduced in 0.9.9 partly broken in 2.2 and 2.2.1 Each type object grows three new members: --- 142,147 ---- blocks. --------------------------------------------------------------------------- ! COUNT_ALLOCS introduced in 0.9.9 ! partly broken in 2.2 and 2.2.1 Each type object grows three new members: *************** *** 187,200 **** most recently is at the front of the list. --------------------------------------------------------------------------- ! LLTRACE introduced ...? Long time ago! ! Compile in support of Low Level TRACE-ing of the man interpreter loop. When this preprocessor symbol is defined, before eval_frame ! (eval_code2 before 2.2) executes a frame's code checks its global ! namespace for a variable "__lltrace__". If such a variable is found, ! mounds of information about what the interpreter is doing are sprayed ! to stdout, such as every opcode and opcode argument and values pushed ! onto and popped off the value stack. Not useful very often, but very useful when needed. --- 188,201 ---- most recently is at the front of the list. --------------------------------------------------------------------------- ! LLTRACE introduced well before 1.0 ! Compile in support of Low Level TRACE-ing of the main interpreter loop. When this preprocessor symbol is defined, before eval_frame ! (eval_code2 before 2.2) executes a frame's code it checks the frame's ! global namespace for a variable "__lltrace__". If such a variable is ! found, mounds of information about what the interpreter is doing are ! sprayed to stdout, such as every opcode and opcode argument and values ! pushed onto and popped off the value stack. Not useful very often, but very useful when needed. From bwarsaw@users.sourceforge.net Tue Jul 30 17:17:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 09:17:13 -0700 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11177 Modified Files: pep2html.py Log Message: Note! Python 2.2 is now required (you need the email package). fixfile(): Modify the Author: and Discussions-To: header handling for the new required format. Since this uses Python 2.2's email package, it should normalize either old style or new style addresses to the new style for the web page. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** pep2html.py 28 May 2002 15:46:24 -0000 1.37 --- pep2html.py 30 Jul 2002 16:17:11 -0000 1.38 *************** *** 32,35 **** --- 32,37 ---- """ + # Requires Python 2.2 + import sys import os *************** *** 41,44 **** --- 43,47 ---- import random import time + from email.Utils import parseaddr PROGRAM = sys.argv[0] *************** *** 65,68 **** --- 68,72 ---- EMPTYSTRING = '' SPACE = ' ' + COMMASPACE = ', ' *************** *** 188,204 **** if k.lower() in ('author', 'discussions-to'): mailtos = [] ! for addr in v.split(): ! if '@' in addr: if k.lower() == 'discussions-to': m = linkemail(addr, pep) else: m = fixemail(addr, pep) ! mailtos.append(m) ! elif addr.startswith('http:'): mailtos.append( ! '%s' % (addr, addr)) else: ! mailtos.append(addr) ! v = SPACE.join(mailtos) elif k.lower() in ('replaces', 'replaced-by'): otherpeps = '' --- 192,211 ---- if k.lower() in ('author', 'discussions-to'): mailtos = [] ! for part in re.split(',\s*', v): ! print 'part:', part ! if '@' in part: ! realname, addr = parseaddr(part) if k.lower() == 'discussions-to': m = linkemail(addr, pep) else: m = fixemail(addr, pep) ! mailtos.append('%s <%s>' % (realname, m)) ! elif part.startswith('http:'): mailtos.append( ! '%s' % (part, part)) else: ! mailtos.append(part) ! print 'mailtos:', mailtos ! v = COMMASPACE.join(mailtos) elif k.lower() in ('replaces', 'replaced-by'): otherpeps = '' From bwarsaw@users.sourceforge.net Tue Jul 30 17:23:17 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 09:23:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.200,1.201 pep-0001.txt,1.36,1.37 pep-0009.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13497 Modified Files: pep-0000.txt pep-0001.txt pep-0009.txt Log Message: Based on feedback inspired by Francois Pinard, we're changing the format of the Author: header to be "Random J. User " Update PEP 1 style guidelines. Updated PEP 9 template. Updated PEP 0 as an example. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -d -r1.200 -r1.201 *** pep-0000.txt 29 Jul 2002 18:23:02 -0000 1.200 --- pep-0000.txt 30 Jul 2002 16:23:15 -0000 1.201 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: barry@zope.com (Barry A. Warsaw) Status: Active Type: Informational --- 3,7 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Barry A. Warsaw Status: Active Type: Informational Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** pep-0001.txt 29 Jul 2002 18:34:59 -0000 1.36 --- pep-0001.txt 30 Jul 2002 16:23:15 -0000 1.37 *************** *** 224,232 **** * Replaced-By: ! The Author: header lists the names and optionally, the email addresses of all the authors/owners of the PEP. The format of the ! author entry should be ! address@dom.ain (Random J. User) if the email address is included, and just --- 224,232 ---- * Replaced-By: ! The Author: header lists the names, and optionally the email addresses of all the authors/owners of the PEP. The format of the ! author entry must be ! Random J. User if the email address is included, and just *************** *** 234,241 **** Random J. User ! if the address is not given. If there are multiple authors, each ! should be on a separate line following RFC 822 continuation line ! conventions. Note that personal email addresses in PEPs will be ! obscured as a defense against spam harvesters. Standards track PEPs must have a Python-Version: header which --- 234,246 ---- Random J. User ! if the address is not given. For historical reasons the format ! "address@dom.ain (Random J. User)" may appear in a PEP, however ! new PEPs must use the mandated format above, and it is acceptable ! to change this format when PEPs are updated. ! ! If there are multiple authors, each should be on a separate line ! following RFC 2822 continuation line conventions. Note that ! personal email addresses in PEPs will be obscured as a defense ! against spam harvesters. Standards track PEPs must have a Python-Version: header which Index: pep-0009.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0009.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0009.txt 1 Apr 2002 15:59:19 -0000 1.7 --- pep-0009.txt 30 Jul 2002 16:23:15 -0000 1.8 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: barry@zope.com (Barry A. Warsaw) Status: Active Type: Informational --- 3,7 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Barry A. Warsaw Status: Active Type: Informational *************** *** 54,62 **** care of those when we check your PEP into CVS. ! - Change the Author: header to include your email address and ! name. Be sure to follow the format carefully: your email ! address must appear first, and it must not be contained in ! angle brackets. Your full name must appear second and it ! must appear in parentheses. - If there is a mailing list for discussion of your new feature, --- 54,62 ---- care of those when we check your PEP into CVS. ! - Change the Author: header to include your name, and optionally ! your email address. Be sure to follow the format carefully: ! your name must appear first, and it must not be contained in ! parentheses. Your email address may appear second (it can also ! be omitted) and if it appears, it must appear in angle brackets. - If there is a mailing list for discussion of your new feature, From bwarsaw@users.sourceforge.net Tue Jul 30 17:25:20 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 09:25:20 -0700 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14254 Modified Files: pep2html.py Log Message: Oops, get rid of debugging prints. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** pep2html.py 30 Jul 2002 16:17:11 -0000 1.38 --- pep2html.py 30 Jul 2002 16:25:17 -0000 1.39 *************** *** 193,197 **** mailtos = [] for part in re.split(',\s*', v): - print 'part:', part if '@' in part: realname, addr = parseaddr(part) --- 193,196 ---- *************** *** 206,210 **** else: mailtos.append(part) - print 'mailtos:', mailtos v = COMMASPACE.join(mailtos) elif k.lower() in ('replaces', 'replaced-by'): --- 205,208 ---- From theller@users.sourceforge.net Tue Jul 30 17:41:07 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 30 Jul 2002 09:41:07 -0700 Subject: [Python-checkins] python/nondist/peps pep-0298.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19526 Modified Files: pep-0298.txt Log Message: Rename the 'safe buffer interface' to 'fixed buffer interface', and give Scott Gilert credit for it. Change the author line to the new style. Small other changes. Barry, can you run pep2html on it, and change the PEP index to the new name? Index: pep-0298.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0298.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0298.txt 29 Jul 2002 18:22:09 -0000 1.1 --- pep-0298.txt 30 Jul 2002 16:41:04 -0000 1.2 *************** *** 1,7 **** PEP: 298 ! Title: The Safe Buffer Interface Version: $Revision$ Last-Modified: $Date$ ! Author: theller@python.net (Thomas Heller) Status: Draft Type: Standards Track --- 1,7 ---- PEP: 298 ! Title: The Fixed Buffer Interface Version: $Revision$ Last-Modified: $Date$ ! Author: Thomas Heller Status: Draft Type: Standards Track *************** *** 14,20 **** This PEP proposes an extension to the buffer interface called the ! 'safe buffer interface'. ! The safe buffer interface fixes the flaws of the 'old' buffer interface as defined in Python versions up to and including 2.2, see [1]: --- 14,20 ---- This PEP proposes an extension to the buffer interface called the ! 'fixed buffer interface'. ! The fixed buffer interface fixes the flaws of the 'old' buffer interface as defined in Python versions up to and including 2.2, see [1]: *************** *** 29,33 **** Specification ! The safe buffer interface exposes new functions which return the size and the pointer to the internal memory block of any python object which chooses to implement this interface. --- 29,33 ---- Specification ! The fixed buffer interface exposes new functions which return the size and the pointer to the internal memory block of any python object which chooses to implement this interface. *************** *** 38,42 **** implement this interface. ! The safe buffer interface omits the memory segment model which is present in the old buffer interface - only a single memory block can be exposed. --- 38,42 ---- implement this interface. ! The fixed buffer interface omits the memory segment model which is present in the old buffer interface - only a single memory block can be exposed. *************** *** 47,53 **** Define a new flag in Include/object.h: ! /* PyBufferProcs contains bf_getsafereadbuffer ! and bf_getsafewritebuffer */ ! #define Py_TPFLAGS_HAVE_GETSAFEBUFFER (1L<<15) --- 47,53 ---- Define a new flag in Include/object.h: ! /* PyBufferProcs contains bf_getfixedreadbuffer ! and bf_getfixedwritebuffer */ ! #define Py_TPFLAGS_HAVE_GETFIXEDBUFFER (1L<<15) *************** *** 56,60 **** #define Py_TPFLAGS_DEFAULT ( \ .... ! Py_TPFLAGS_HAVE_GETSAFEBUFFER | \ .... 0) --- 56,60 ---- #define Py_TPFLAGS_DEFAULT ( \ .... ! Py_TPFLAGS_HAVE_GETFIXEDBUFFER | \ .... 0) *************** *** 64,69 **** Include/object.h: ! typedef size_t (*getsafereadbufferproc)(PyObject *, void **); ! typedef size_t (*getsafewritebufferproc)(PyObject *, void **); typedef struct { --- 64,69 ---- Include/object.h: ! typedef size_t (*getfixedreadbufferproc)(PyObject *, void **); ! typedef size_t (*getfixedwritebufferproc)(PyObject *, void **); typedef struct { *************** *** 72,88 **** getsegcountproc bf_getsegcount; getcharbufferproc bf_getcharbuffer; ! /* safe buffer interface functions */ ! getsafereadbufferproc bf_getsafereadbufferproc; ! getsafewritebufferproc bf_getsafewritebufferproc; } PyBufferProcs; ! The new fields are present if the Py_TPFLAGS_HAVE_GETSAFEBUFFER flag is set in the object's type. ! The Py_TPFLAGS_HAVE_GETSAFEBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. ! The getsafereadbufferproc and getsafewritebufferproc functions return the size in bytes of the memory block on success, and fill in the passed void * pointer on success. If these functions fail --- 72,88 ---- getsegcountproc bf_getsegcount; getcharbufferproc bf_getcharbuffer; ! /* fixed buffer interface functions */ ! getfixedreadbufferproc bf_getfixedreadbufferproc; ! getfixedwritebufferproc bf_getfixedwritebufferproc; } PyBufferProcs; ! The new fields are present if the Py_TPFLAGS_HAVE_GETFIXEDBUFFER flag is set in the object's type. ! The Py_TPFLAGS_HAVE_GETFIXEDBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. ! The getfixedreadbufferproc and getfixedwritebufferproc functions return the size in bytes of the memory block on success, and fill in the passed void * pointer on success. If these functions fail *************** *** 92,104 **** used. ! Usually the getsafewritebufferproc and getsafereadbufferproc functions aren't called directly, they are called through convenience functions declared in Include/abstract.h: ! int PyObject_AsSafeReadBuffer(PyObject *obj, void **buffer, size_t *buffer_len); ! int PyObject_AsSafeWriteBuffer(PyObject *obj, void **buffer, size_t *buffer_len); --- 92,104 ---- used. ! Usually the getfixedwritebufferproc and getfixedreadbufferproc functions aren't called directly, they are called through convenience functions declared in Include/abstract.h: ! int PyObject_AsFixedReadBuffer(PyObject *obj, void **buffer, size_t *buffer_len); ! int PyObject_AsFixedWriteBuffer(PyObject *obj, void **buffer, size_t *buffer_len); *************** *** 106,110 **** These functions return 0 on success, set buffer to the memory location and buffer_len to the length of the memory block in ! bytes. On failure, or if the safe buffer interface is not implemented by obj, they return -1 and set an exception. --- 106,110 ---- These functions return 0 on success, set buffer to the memory location and buffer_len to the length of the memory block in ! bytes. On failure, or if the fixed buffer interface is not implemented by obj, they return -1 and set an exception. *************** *** 125,129 **** Python strings, Unicode strings, mmap objects, and maybe other ! types would expose the safe buffer interface, but the array type would *not*, because its memory block may be reallocated during its lifetime. --- 125,129 ---- Python strings, Unicode strings, mmap objects, and maybe other ! types would expose the fixed buffer interface, but the array type would *not*, because its memory block may be reallocated during its lifetime. *************** *** 132,143 **** Community Feedback ! Greg Ewing doubts the safe buffer interface is needed at all, he thinks the normal buffer interface could be used if the pointer is ! (re)fetched each time it's used. Neil Hodgson wants to expose pointers to memory blocks with limited lifetime: do some kind of lock operation on the object, ! retrieve the pointer, use it, and unlock the object again. On the ! other hand, locking may lead to deadlocks. --- 132,152 ---- Community Feedback ! Greg Ewing doubts the fixed buffer interface is needed at all, he thinks the normal buffer interface could be used if the pointer is ! (re)fetched each time it's used. This seems to be dangerous, ! because even innocent looking calls to the Python API like ! Py_DECREF() may trigger execution of arbitrary Python code. Neil Hodgson wants to expose pointers to memory blocks with limited lifetime: do some kind of lock operation on the object, ! retrieve the pointer, use it, and unlock the object again. While ! the author sees the need for this, it cannot be addressed by this ! proposal. Beeing required to call a function after not using the ! pointer received by the getfixedbufferprocs seems too error prone. ! ! ! Credits ! ! Scott Gilbert came up with the name 'fixed buffer interface'. From theller@users.sourceforge.net Tue Jul 30 17:52:56 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 30 Jul 2002 09:52:56 -0700 Subject: [Python-checkins] python/nondist/peps pep-0298.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv23567 Modified Files: pep-0298.txt Log Message: Oops, forgotten words. Index: pep-0298.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0298.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0298.txt 30 Jul 2002 16:41:04 -0000 1.2 --- pep-0298.txt 30 Jul 2002 16:52:53 -0000 1.3 *************** *** 143,147 **** the author sees the need for this, it cannot be addressed by this proposal. Beeing required to call a function after not using the ! pointer received by the getfixedbufferprocs seems too error prone. --- 143,148 ---- the author sees the need for this, it cannot be addressed by this proposal. Beeing required to call a function after not using the ! pointer received by the getfixedbufferprocs any more seems too ! error prone. From bwarsaw@users.sourceforge.net Tue Jul 30 18:04:41 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 10:04:41 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.201,1.202 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28240 Modified Files: pep-0000.txt Log Message: Changed the name of PEP 298. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.201 retrieving revision 1.202 diff -C2 -d -r1.201 -r1.202 *** pep-0000.txt 30 Jul 2002 16:23:15 -0000 1.201 --- pep-0000.txt 30 Jul 2002 17:04:39 -0000 1.202 *************** *** 103,107 **** S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Safe Buffer Interface Heller Finished PEPs (done, implemented in CVS) --- 103,107 ---- S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Fixed Buffer Interface Heller Finished PEPs (done, implemented in CVS) *************** *** 287,291 **** S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Safe Buffer Interface Heller SR 666 Reject Foolish Indentation Creighton --- 287,291 ---- S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Fixed Buffer Interface Heller SR 666 Reject Foolish Indentation Creighton From barry@python.org Tue Jul 30 18:04:59 2002 From: barry@python.org (Barry A. Warsaw) Date: Tue, 30 Jul 2002 13:04:59 -0400 Subject: [Python-checkins] python/nondist/peps pep-0298.txt,1.1,1.2 References: Message-ID: <15686.51003.717082.848683@anthem.wooz.org> theller> Barry, can you run pep2html on it, and change the PEP theller> index to the new name? Done. -Barry From fdrake@users.sourceforge.net Tue Jul 30 18:52:07 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 30 Jul 2002 10:52:07 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.73.6.7,1.73.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14709 Modified Files: Tag: release22-maint libre.tex Log Message: SF patch #581414: info reader bug The "Matching vs. Searching" Info node is unreachable from the Info program (but is fine in Emacs's Info mode). This patch seems to fix it. This is the only occurrence where the info reader fails, so probably it could be addressed in the python docs as a workaround. Forwarded the report to the info maintainer. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.73.6.7 retrieving revision 1.73.6.8 diff -C2 -d -r1.73.6.7 -r1.73.6.8 *** libre.tex 22 Jun 2002 01:07:50 -0000 1.73.6.7 --- libre.tex 30 Jul 2002 17:52:05 -0000 1.73.6.8 *************** *** 390,394 **** ! \subsection{Matching vs. Searching \label{matching-searching}} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 390,396 ---- ! % Note the lack of a period in the section title; it causes problems ! % with readers of the GNU info version. See http://www.python.org/sf/581414. ! \subsection{Matching vs Searching \label{matching-searching}} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} From fdrake@users.sourceforge.net Tue Jul 30 18:51:22 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 30 Jul 2002 10:51:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14337 Modified Files: libre.tex Log Message: SF patch #581414: info reader bug The "Matching vs. Searching" Info node is unreachable from the Info program (but is fine in Emacs's Info mode). This patch seems to fix it. This is the only occurrence where the info reader fails, so probably it could be addressed in the python docs as a workaround. Forwarded the report to the info maintainer. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** libre.tex 22 Jun 2002 01:07:37 -0000 1.84 --- libre.tex 30 Jul 2002 17:51:20 -0000 1.85 *************** *** 379,383 **** ! \subsection{Matching vs. Searching \label{matching-searching}} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 379,385 ---- ! % Note the lack of a period in the section title; it causes problems ! % with readers of the GNU info version. See http://www.python.org/sf/581414. ! \subsection{Matching vs Searching \label{matching-searching}} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} From gvanrossum@users.sourceforge.net Tue Jul 30 20:06:55 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 30 Jul 2002 12:06:55 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.89,1.90 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12866 Modified Files: Makefile.pre.in Log Message: Get rid of the DEFS variable. The only thing this was used for was to pass -DHAVE_CONFIG_H to CC, and that symbol isn't used any more. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Makefile.pre.in 29 Jul 2002 16:18:23 -0000 1.89 --- Makefile.pre.in 30 Jul 2002 19:06:51 -0000 1.90 *************** *** 55,61 **** # Compiler options OPT= @OPT@ - DEFS= @DEFS@ CFLAGS= $(OPT) ! CPPFLAGS= -I. -I$(srcdir)/Include $(DEFS) LDFLAGS= @LDFLAGS@ LDLAST= @LDLAST@ --- 55,60 ---- # Compiler options OPT= @OPT@ CFLAGS= $(OPT) ! CPPFLAGS= -I. -I$(srcdir)/Include LDFLAGS= @LDFLAGS@ LDLAST= @LDLAST@ From loewis@users.sourceforge.net Tue Jul 30 21:20:00 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 30 Jul 2002 13:20:00 -0700 Subject: [Python-checkins] python/dist/src configure,1.326,1.327 configure.in,1.337,1.338 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7806 Modified Files: configure configure.in Log Message: Shared libraries also work on GNU/Hurd. Suggested by Matthias Klose. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.326 retrieving revision 1.327 diff -C2 -d -r1.326 -r1.327 *** configure 30 Jul 2002 01:08:28 -0000 1.326 --- configure 30 Jul 2002 20:19:56 -0000 1.327 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.335 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.337 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 3137,3141 **** RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' --- 3137,3141 ---- RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*|GNU*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.337 retrieving revision 1.338 diff -C2 -d -r1.337 -r1.338 *** configure.in 30 Jul 2002 01:08:28 -0000 1.337 --- configure.in 30 Jul 2002 20:19:58 -0000 1.338 *************** *** 384,388 **** RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' --- 384,388 ---- RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*|GNU*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' From bwarsaw@users.sourceforge.net Wed Jul 31 00:26:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 16:26:02 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6095/Lib Modified Files: UserString.py Log Message: Complete the absolute import patch for the test suite. All relative imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** UserString.py 20 May 2002 14:48:16 -0000 1.13 --- UserString.py 30 Jul 2002 23:26:00 -0000 1.14 *************** *** 174,182 **** import os called_in_dir, called_as = os.path.split(sys.argv[0]) - called_in_dir = os.path.abspath(called_in_dir) called_as, py = os.path.splitext(called_as) - sys.path.append(os.path.join(called_in_dir, 'test')) if '-q' in sys.argv: ! import test_support test_support.verbose = 0 ! __import__('test_' + called_as.lower()) --- 174,180 ---- import os called_in_dir, called_as = os.path.split(sys.argv[0]) called_as, py = os.path.splitext(called_as) if '-q' in sys.argv: ! from test import test_support test_support.verbose = 0 ! __import__('test.test_' + called_as.lower()) From bwarsaw@users.sourceforge.net Wed Jul 31 00:26:03 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 16:26:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test double_const.py,1.1,1.2 pickletester.py,1.15,1.16 regrtest.py,1.91,1.92 string_tests.py,1.18,1.19 test___all__.py,1.26,1.27 test_al.py,1.6,1.7 test_atexit.py,1.7,1.8 test_b1.py,1.48,1.49 test_b2.py,1.35,1.36 test_binascii.py,1.14,1.15 test_bisect.py,1.1,1.2 test_bufio.py,1.5,1.6 test_builtin.py,1.1,1.2 test_cd.py,1.5,1.6 test_cfgparser.py,1.11,1.12 test_cgi.py,1.6,1.7 test_cl.py,1.5,1.6 test_class.py,1.8,1.9 test_coercion.py,1.5,1.6 test_compare.py,1.6,1.7 test_complex.py,1.8,1.9 test_contains.py,1.8,1.9 test_exceptions.py,1.17,1.18 test_extcall.py,1.17,1.18 test_file.py,1.9,1.10 test_frozen.py,1.1,1.2 test_funcattrs.py,1.11,1.12 test_getargs.py,1.3,1.4 test_gl.py,1.7,1.8 test_global.py,1.5,1.6 test_grammar.py,1.40,1.41 test_gzip.py,1.9,1.10 test_httplib.py,1.8,1.9 test_strop.py,1.17,1.18 test_support.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6095/Lib/test Modified Files: double_const.py pickletester.py regrtest.py string_tests.py test___all__.py test_al.py test_atexit.py test_b1.py test_b2.py test_binascii.py test_bisect.py test_bufio.py test_builtin.py test_cd.py test_cfgparser.py test_cgi.py test_cl.py test_class.py test_coercion.py test_compare.py test_complex.py test_contains.py test_exceptions.py test_extcall.py test_file.py test_frozen.py test_funcattrs.py test_getargs.py test_gl.py test_global.py test_grammar.py test_gzip.py test_httplib.py test_strop.py test_support.py Log Message: Complete the absolute import patch for the test suite. All relative imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed. Index: double_const.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/double_const.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** double_const.py 8 May 2001 03:58:01 -0000 1.1 --- double_const.py 30 Jul 2002 23:26:00 -0000 1.2 *************** *** 1,3 **** ! from test_support import TestFailed # A test for SF bug 422177: manifest float constants varied way too much in --- 1,3 ---- ! from test.test_support import TestFailed # A test for SF bug 422177: manifest float constants varied way too much in Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pickletester.py 16 Apr 2002 01:38:39 -0000 1.15 --- pickletester.py 30 Jul 2002 23:26:00 -0000 1.16 *************** *** 1,4 **** import unittest ! from test_support import TestFailed, have_unicode class C: --- 1,4 ---- import unittest ! from test.test_support import TestFailed, have_unicode class C: Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** regrtest.py 23 Jul 2002 19:03:43 -0000 1.91 --- regrtest.py 30 Jul 2002 23:26:00 -0000 1.92 *************** *** 245,250 **** print count(len(good), "test"), "OK." if verbose: ! print "CAUTION: stdout isn't compared in verbose mode: a test" ! print "that passes in verbose mode may fail without it." if bad: print count(len(bad), "test"), "failed:" --- 245,250 ---- print count(len(good), "test"), "OK." if verbose: ! print "CAUTION: stdout isn't compared in verbose mode:" ! print "a test that passes in verbose mode may fail without it." if bad: print count(len(bad), "test"), "failed:" *************** *** 339,343 **** sys.stdout = cfp print test # Output file starts with test name ! the_module = __import__(test, globals(), locals(), []) # Most tests run to completion simply as a side-effect of # being imported. For the benefit of tests that can't run --- 339,349 ---- sys.stdout = cfp print test # Output file starts with test name ! if test.startswith('test.'): ! abstest = test ! else: ! # Always import it from the test package ! abstest = 'test.' + test ! the_package = __import__(abstest, globals(), locals(), []) ! the_module = getattr(the_package, test) # Most tests run to completion simply as a side-effect of # being imported. For the benefit of tests that can't run *************** *** 785,787 **** --- 791,807 ---- if __name__ == '__main__': + # Remove regrtest.py's own directory from the module search path. This + # prevents relative imports from working, and relative imports will screw + # up the testing framework. E.g. if both test.test_support and + # test_support are imported, they will not contain the same globals, and + # much of the testing framework relies on the globals in the + # test.test_support module. + mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0]))) + i = pathlen = len(sys.path) + while i >= 0: + i -= 1 + if os.path.abspath(os.path.normpath(sys.path[i])) == mydir: + del sys.path[i] + if len(sys.path) == pathlen: + print 'Could not find %r in sys.path to remove it' % mydir main() Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** string_tests.py 14 Jun 2002 00:50:42 -0000 1.18 --- string_tests.py 30 Jul 2002 23:26:00 -0000 1.19 *************** *** 2,6 **** import string ! from test_support import verify, verbose, TestFailed, have_unicode transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' --- 2,6 ---- import string ! from test.test_support import verify, verbose, TestFailed, have_unicode transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test___all__.py 16 Apr 2002 01:27:44 -0000 1.26 --- test___all__.py 30 Jul 2002 23:26:00 -0000 1.27 *************** *** 1,3 **** ! from test_support import verify, verbose import sys import warnings --- 1,3 ---- ! from test.test_support import verify, verbose import sys import warnings Index: test_al.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_al.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_al.py 17 Jan 2001 21:51:35 -0000 1.6 --- test_al.py 30 Jul 2002 23:26:00 -0000 1.7 *************** *** 4,8 **** """ import al ! from test_support import verbose alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams', --- 4,8 ---- """ import al ! from test.test_support import verbose alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams', Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_atexit.py 26 Jul 2002 11:33:49 -0000 1.7 --- test_atexit.py 30 Jul 2002 23:26:01 -0000 1.8 *************** *** 1,4 **** # Test the atexit module. ! from test_support import TESTFN, vereq import atexit from os import popen, unlink --- 1,4 ---- # Test the atexit module. ! from test.test_support import TESTFN, vereq import atexit from os import popen, unlink Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_b1.py 16 Jul 2002 21:35:23 -0000 1.48 --- test_b1.py 30 Jul 2002 23:26:01 -0000 1.49 *************** *** 1,5 **** # Python test set -- part 4a, built-in functions a-m ! from test_support import * print '__import__' --- 1,5 ---- # Python test set -- part 4a, built-in functions a-m ! from test.test_support import TestFailed, fcmp, have_unicode, TESTFN, unlink print '__import__' Index: test_b2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** test_b2.py 5 Jun 2002 23:12:44 -0000 1.35 --- test_b2.py 30 Jul 2002 23:26:01 -0000 1.36 *************** *** 1,5 **** # Python test set -- part 4b, built-in functions n-z ! from test_support import * print 'oct' --- 1,5 ---- # Python test set -- part 4b, built-in functions n-z ! from test.test_support import TestFailed, fcmp, TESTFN, unlink, vereq print 'oct' Index: test_binascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_binascii.py 23 May 2002 15:15:30 -0000 1.14 --- test_binascii.py 30 Jul 2002 23:26:01 -0000 1.15 *************** *** 1,5 **** """Test the binascii C module.""" ! from test_support import verify, verbose, have_unicode import binascii --- 1,5 ---- """Test the binascii C module.""" ! from test.test_support import verify, verbose, have_unicode import binascii Index: test_bisect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bisect.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_bisect.py 29 Dec 2000 02:06:45 -0000 1.1 --- test_bisect.py 30 Jul 2002 23:26:01 -0000 1.2 *************** *** 1,3 **** ! from test_support import TestFailed import bisect --- 1,3 ---- ! from test.test_support import TestFailed import bisect Index: test_bufio.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bufio.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_bufio.py 17 Jan 2001 21:51:35 -0000 1.5 --- test_bufio.py 30 Jul 2002 23:26:01 -0000 1.6 *************** *** 1,3 **** ! from test_support import verify, TestFailed, TESTFN # Simple test to ensure that optimizations in fileobject.c deliver --- 1,3 ---- ! from test.test_support import verify, TestFailed, TESTFN # Simple test to ensure that optimizations in fileobject.c deliver Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_builtin.py 27 Jan 1992 16:56:44 -0000 1.1 --- test_builtin.py 30 Jul 2002 23:26:01 -0000 1.2 *************** *** 1,5 **** # Python test set -- part 4, built-in functions ! from test_support import * print '4. Built-in functions' --- 1,5 ---- # Python test set -- part 4, built-in functions ! from test.test_support import unload print '4. Built-in functions' *************** *** 7,13 **** print 'test_b1' unload('test_b1') ! import test_b1 print 'test_b2' unload('test_b2') ! import test_b2 --- 7,13 ---- print 'test_b1' unload('test_b1') ! from test import test_b1 print 'test_b2' unload('test_b2') ! from test import test_b2 Index: test_cd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cd.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_cd.py 17 Jan 2001 21:51:35 -0000 1.5 --- test_cd.py 30 Jul 2002 23:26:01 -0000 1.6 *************** *** 4,8 **** """ import cd ! from test_support import verbose cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY', --- 4,8 ---- """ import cd ! from test.test_support import verbose cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY', Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_cfgparser.py 16 Apr 2002 01:38:40 -0000 1.11 --- test_cfgparser.py 30 Jul 2002 23:26:01 -0000 1.12 *************** *** 2,6 **** import StringIO ! from test_support import TestFailed, verify --- 2,6 ---- import StringIO ! from test.test_support import TestFailed, verify Index: test_cgi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cgi.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_cgi.py 17 Jan 2001 19:11:13 -0000 1.6 --- test_cgi.py 30 Jul 2002 23:26:01 -0000 1.7 *************** *** 1,3 **** ! from test_support import verify, verbose import cgi import os --- 1,3 ---- ! from test.test_support import verify, verbose import cgi import os Index: test_cl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cl.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_cl.py 17 Jan 2001 21:51:35 -0000 1.5 --- test_cl.py 30 Jul 2002 23:26:01 -0000 1.6 *************** *** 4,8 **** """ import cl ! from test_support import verbose clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID', --- 4,8 ---- """ import cl ! from test.test_support import verbose clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID', Index: test_class.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_class.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_class.py 13 Jun 2002 21:32:51 -0000 1.8 --- test_class.py 30 Jul 2002 23:26:01 -0000 1.9 *************** *** 1,5 **** "Test the functionality of Python classes implementing operators." ! from test_support import TestFailed testmeths = [ --- 1,5 ---- "Test the functionality of Python classes implementing operators." ! from test.test_support import TestFailed testmeths = [ Index: test_coercion.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_coercion.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_coercion.py 16 Apr 2002 01:27:44 -0000 1.5 --- test_coercion.py 30 Jul 2002 23:26:01 -0000 1.6 *************** *** 114,118 **** r'complex divmod\(\), // and % are deprecated', DeprecationWarning, ! r'test_coercion$') do_infix_binops() do_prefix_binops() --- 114,118 ---- r'complex divmod\(\), // and % are deprecated', DeprecationWarning, ! r'test.test_coercion$') do_infix_binops() do_prefix_binops() Index: test_compare.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compare.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_compare.py 4 Sep 2001 19:14:14 -0000 1.6 --- test_compare.py 30 Jul 2002 23:26:01 -0000 1.7 *************** *** 1,6 **** import sys - from test_support import * - class Empty: def __repr__(self): --- 1,4 ---- Index: test_complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_complex.py 29 Dec 2001 17:34:57 -0000 1.8 --- test_complex.py 30 Jul 2002 23:26:01 -0000 1.9 *************** *** 1,3 **** ! from test_support import TestFailed, vereq from random import random --- 1,3 ---- ! from test.test_support import TestFailed, vereq from random import random Index: test_contains.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_contains.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_contains.py 17 Aug 2001 18:39:24 -0000 1.8 --- test_contains.py 30 Jul 2002 23:26:01 -0000 1.9 *************** *** 1,3 **** ! from test_support import TestFailed, have_unicode class base_set: --- 1,3 ---- ! from test.test_support import TestFailed, have_unicode class base_set: Index: test_exceptions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_exceptions.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_exceptions.py 16 Apr 2002 01:27:44 -0000 1.17 --- test_exceptions.py 30 Jul 2002 23:26:01 -0000 1.18 *************** *** 1,5 **** # Python test set -- part 5, built-in exceptions ! from test_support import * from types import ClassType import warnings --- 1,5 ---- # Python test set -- part 5, built-in exceptions ! from test.test_support import TestFailed, TESTFN, unlink from types import ClassType import warnings Index: test_extcall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_extcall.py 24 Aug 2001 19:11:57 -0000 1.17 --- test_extcall.py 30 Jul 2002 23:26:01 -0000 1.18 *************** *** 1,3 **** ! from test_support import verify, verbose, TestFailed, sortdict from UserList import UserList --- 1,3 ---- ! from test.test_support import verify, verbose, TestFailed, sortdict from UserList import UserList Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_file.py 11 Jun 2002 06:22:30 -0000 1.9 --- test_file.py 30 Jul 2002 23:26:01 -0000 1.10 *************** *** 3,7 **** from array import array ! from test_support import verify, TESTFN, TestFailed from UserList import UserList --- 3,7 ---- from array import array ! from test.test_support import verify, TESTFN, TestFailed from UserList import UserList Index: test_frozen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_frozen.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_frozen.py 18 Oct 2001 18:49:37 -0000 1.1 --- test_frozen.py 30 Jul 2002 23:26:01 -0000 1.2 *************** *** 1,5 **** # Test the frozen module defined in frozen.c. ! from test_support import TestFailed import sys, os --- 1,5 ---- # Test the frozen module defined in frozen.c. ! from test.test_support import TestFailed import sys, os Index: test_funcattrs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_funcattrs.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_funcattrs.py 22 Oct 2001 02:00:09 -0000 1.11 --- test_funcattrs.py 30 Jul 2002 23:26:01 -0000 1.12 *************** *** 1,3 **** ! from test_support import verbose, TestFailed, verify import types --- 1,3 ---- ! from test.test_support import verbose, TestFailed, verify import types Index: test_getargs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_getargs.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_getargs.py 20 May 2002 14:54:17 -0000 1.3 --- test_getargs.py 30 Jul 2002 23:26:01 -0000 1.4 *************** *** 15,19 **** # this test will fail because it does not test the right part of the # PyArg_ParseTuple() implementation. ! from test_support import have_unicode import marshal --- 15,19 ---- # this test will fail because it does not test the right part of the # PyArg_ParseTuple() implementation. ! from test.test_support import have_unicode import marshal Index: test_gl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gl.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_gl.py 17 Jan 2001 21:51:35 -0000 1.7 --- test_gl.py 30 Jul 2002 23:26:01 -0000 1.8 *************** *** 4,8 **** Roger E. Masse """ ! from test_support import verbose, TestSkipped import gl, GL, time --- 4,8 ---- Roger E. Masse """ ! from test.test_support import verbose, TestSkipped import gl, GL, time Index: test_global.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_global.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_global.py 2 Mar 2001 01:48:16 -0000 1.5 --- test_global.py 30 Jul 2002 23:26:01 -0000 1.6 *************** *** 1,5 **** """Verify that warnings are issued for global statements following use.""" ! from test_support import check_syntax import warnings --- 1,5 ---- """Verify that warnings are issued for global statements following use.""" ! from test.test_support import check_syntax import warnings Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_grammar.py 9 Dec 2001 09:12:34 -0000 1.40 --- test_grammar.py 30 Jul 2002 23:26:01 -0000 1.41 *************** *** 2,6 **** # This just tests whether the parser accepts them all. ! from test_support import * import sys --- 2,6 ---- # This just tests whether the parser accepts them all. ! from test.test_support import TestFailed, verify, check_syntax import sys Index: test_gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gzip.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_gzip.py 23 May 2002 01:43:05 -0000 1.9 --- test_gzip.py 30 Jul 2002 23:26:01 -0000 1.10 *************** *** 1,3 **** ! from test_support import verify import sys, os import gzip, tempfile --- 1,3 ---- ! from test.test_support import verify import sys, os import gzip, tempfile Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_httplib.py 16 Jul 2002 21:35:23 -0000 1.8 --- test_httplib.py 30 Jul 2002 23:26:01 -0000 1.9 *************** *** 1,3 **** ! from test_support import verify,verbose import httplib import StringIO --- 1,3 ---- ! from test.test_support import verify,verbose import httplib import StringIO Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_strop.py 23 Jul 2002 19:04:04 -0000 1.17 --- test_strop.py 30 Jul 2002 23:26:01 -0000 1.18 *************** *** 2,6 **** warnings.filterwarnings("ignore", "strop functions are obsolete;", DeprecationWarning, ! r'test_strop|unittest') import strop import unittest --- 2,6 ---- warnings.filterwarnings("ignore", "strop functions are obsolete;", DeprecationWarning, ! r'test.test_strop|unittest') import strop import unittest Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_support.py 29 Dec 2001 17:34:57 -0000 1.41 --- test_support.py 30 Jul 2002 23:26:01 -0000 1.42 *************** *** 1,4 **** --- 1,7 ---- """Supporting definitions for the Python regression test.""" + if __name__ != 'test.test_support': + raise ImportError, 'test_support must be imported from the test package' + import sys From bwarsaw@users.sourceforge.net Wed Jul 31 00:27:14 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 30 Jul 2002 16:27:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test autotest.py,1.11,1.12 test_doctest2.py,1.4,1.5 test_future.py,1.5,1.6 test_math.py,1.16,1.17 test_opcodes.py,1.11,1.12 test_pickle.py,1.10,1.11 test_re.py,1.32,1.33 test_sre.py,1.36,1.37 test_traceback.py,1.5,1.6 test_unpack.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6654/Lib/test Modified Files: autotest.py test_doctest2.py test_future.py test_math.py test_opcodes.py test_pickle.py test_re.py test_sre.py test_traceback.py test_unpack.py Log Message: Complete the absolute import patch for the test suite. All relative imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed. Index: autotest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/autotest.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** autotest.py 23 Aug 2000 05:28:45 -0000 1.11 --- autotest.py 30 Jul 2002 23:27:11 -0000 1.12 *************** *** 3,6 **** # from test import autotest. ! import regrtest regrtest.main() --- 3,6 ---- # from test import autotest. ! from test import regrtest regrtest.main() Index: test_doctest2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest2.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_doctest2.py 23 Jul 2002 19:03:50 -0000 1.4 --- test_doctest2.py 30 Jul 2002 23:27:11 -0000 1.5 *************** *** 94,98 **** def test_main(): ! import test_doctest2 EXPECTED = 19 f, t = test_support.run_doctest(test_doctest2) --- 94,98 ---- def test_main(): ! from test import test_doctest2 EXPECTED = 19 f, t = test_support.run_doctest(test_doctest2) Index: test_future.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_future.py 23 Jul 2002 19:03:53 -0000 1.5 --- test_future.py 30 Jul 2002 23:27:11 -0000 1.6 *************** *** 13,47 **** unload('test_future1') ! import test_future1 unload('test_future2') ! import test_future2 unload('test_future3') ! import test_future3 # The remaining tests should fail try: ! import badsyntax_future3 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future4 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future5 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future6 except SyntaxError, msg: check_error_location(str(msg)) try: ! import badsyntax_future7 except SyntaxError, msg: check_error_location(str(msg)) --- 13,47 ---- unload('test_future1') ! from test import test_future1 unload('test_future2') ! from test import test_future2 unload('test_future3') ! from test import test_future3 # The remaining tests should fail try: ! from test import badsyntax_future3 except SyntaxError, msg: check_error_location(str(msg)) try: ! from test import badsyntax_future4 except SyntaxError, msg: check_error_location(str(msg)) try: ! from test import badsyntax_future5 except SyntaxError, msg: check_error_location(str(msg)) try: ! from test import badsyntax_future6 except SyntaxError, msg: check_error_location(str(msg)) try: ! from test import badsyntax_future7 except SyntaxError, msg: check_error_location(str(msg)) Index: test_math.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_math.py 23 Jul 2002 19:03:57 -0000 1.16 --- test_math.py 30 Jul 2002 23:27:11 -0000 1.17 *************** *** 2,6 **** # XXXX Should not do tests around zero only ! from test.test_support import * seps='1e-05' --- 2,6 ---- # XXXX Should not do tests around zero only ! from test.test_support import TestFailed, verbose seps='1e-05' Index: test_opcodes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_opcodes.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_opcodes.py 23 Jul 2002 19:03:58 -0000 1.11 --- test_opcodes.py 30 Jul 2002 23:27:11 -0000 1.12 *************** *** 1,5 **** # Python test set -- part 2, opcodes ! from test.test_support import * --- 1,5 ---- # Python test set -- part 2, opcodes ! from test.test_support import TestFailed Index: test_pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pickle.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_pickle.py 23 Jul 2002 19:03:58 -0000 1.10 --- test_pickle.py 30 Jul 2002 23:27:11 -0000 1.11 *************** *** 2,6 **** import unittest from cStringIO import StringIO ! from pickletester import AbstractPickleTests, AbstractPickleModuleTests from test import test_support --- 2,6 ---- import unittest from cStringIO import StringIO ! from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests from test import test_support Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** test_re.py 23 Jul 2002 19:03:59 -0000 1.32 --- test_re.py 30 Jul 2002 23:27:12 -0000 1.33 *************** *** 268,272 **** print v ! from re_tests import * if verbose: --- 268,272 ---- print v ! from test.re_tests import * if verbose: Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_sre.py 23 Jul 2002 19:04:03 -0000 1.36 --- test_sre.py 30 Jul 2002 23:27:12 -0000 1.37 *************** *** 299,303 **** test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) ! from re_tests import * if verbose: --- 299,303 ---- test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) ! from test.re_tests import * if verbose: Index: test_traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_traceback.py 23 Jul 2002 19:04:08 -0000 1.5 --- test_traceback.py 30 Jul 2002 23:27:12 -0000 1.6 *************** *** 23,27 **** def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? ! import badsyntax_nocaret def test_caret(self): --- 23,27 ---- def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? ! import test.badsyntax_nocaret def test_caret(self): Index: test_unpack.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unpack.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_unpack.py 23 Jul 2002 19:04:08 -0000 1.6 --- test_unpack.py 30 Jul 2002 23:27:12 -0000 1.7 *************** *** 1,3 **** ! from test.test_support import * t = (1, 2, 3) --- 1,3 ---- ! from test.test_support import TestFailed, verbose t = (1, 2, 3) From mhammond@users.sourceforge.net Wed Jul 31 07:17:48 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue, 30 Jul 2002 23:17:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv5432 Modified Files: noddy.c Log Message: Replace DL_EXPORT with PyMODINIT_FUNC Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** noddy.c 17 Jul 2002 16:42:48 -0000 1.3 --- noddy.c 31 Jul 2002 06:17:46 -0000 1.4 *************** *** 55,59 **** }; ! DL_EXPORT(void) initnoddy(void) { --- 55,59 ---- }; ! PyMODINIT_FUNC initnoddy(void) { From mwh@users.sourceforge.net Wed Jul 31 10:54:27 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 31 Jul 2002 02:54:27 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.82,2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11418 Modified Files: _sre.c Log Message: Cray fixup as seen in bug #558153. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.82 retrieving revision 2.83 diff -C2 -d -r2.82 -r2.83 *** _sre.c 19 Jul 2002 06:55:41 -0000 2.82 --- _sre.c 31 Jul 2002 09:54:24 -0000 2.83 *************** *** 1786,1790 **** static PyObject* ! join(PyObject* list, PyObject* pattern) { /* join list elements */ --- 1786,1790 ---- static PyObject* ! join_list(PyObject* list, PyObject* pattern) { /* join list elements */ *************** *** 2239,2243 **** /* convert list to single string (also removes list) */ ! item = join(list, self->pattern); if (!item) --- 2239,2243 ---- /* convert list to single string (also removes list) */ ! item = join_list(list, self->pattern); if (!item) From mwh@users.sourceforge.net Wed Jul 31 10:55:27 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 31 Jul 2002 02:55:27 -0700 Subject: [Python-checkins] python/dist/src README,1.149,1.150 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11862 Modified Files: README Log Message: Patch: [ 561724 ] README additions for Cray T3E Lightly edited by me. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** README 9 Jul 2002 18:44:09 -0000 1.149 --- README 31 Jul 2002 09:55:25 -0000 1.150 *************** *** 376,388 **** supported for R3; both PowerPC and x86 are supported for R4. ! Cray T3E: Konrad Hinsen writes: ! 1) Don't use gcc. It compiles Python/graminit.c into something ! that the Cray assembler doesn't like. Cray's cc seems to work ! fine. ! 2) Comment out modules md5 (won't compile) and audioop (will ! crash the interpreter during the test suite). ! If you run the test suite, two tests will fail (rotate and ! binascii), but these are not the modules you'd expect to need ! on a Cray. SGI: SGI's standard "make" utility (/bin/make or /usr/bin/make) --- 376,420 ---- supported for R3; both PowerPC and x86 are supported for R4. ! Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes: ! Python can be built satisfactorily on a Cray T3E but based on ! my experience with the NIWA T3E (2002-05-22, version 2.2.1) ! there are a few bugs and gotchas. For more information see a ! thread on comp.lang.python in May 2002 entitled "Building ! Python on Cray T3E". ! ! 1) Use Cray's cc and not gcc. The latter was reported not to ! work by Konrad Hinsen. It may work now, but it may not. ! ! 2) To set sys.platform to something sensible, pass the ! following environment variable to the configure script: ! ! MACHDEP=unicosmk ! ! 2) Run configure with option "--enable-unicode=ucs4". ! ! 3) The Cray T3E does not support dynamic linking, so extension ! modules have to be built by adding (or uncommenting) lines ! in Modules/Setup. The minimum set of modules is ! ! posix, new, _sre, unicodedata ! ! On NIWA's vanilla T3E system the following have also been ! included successfully: ! ! _codecs, _locale, _socket, _symtable, _testcapi, _weakref ! array, binascii, cmath, cPickle, crypt, cStringIO, dbm ! errno, fcntl, grp, math, md5, operator, parser, pcre, pwd ! regex, rotor, select, struct, strop, syslog, termios ! time, timing, xreadlines ! ! 4) Once the python executable and library have been built, make ! will execute setup.py, which will attempt to build remaining ! extensions and link them dynamically. Each of these attempts ! will fail but should not halt the make process. This is ! normal. ! ! 5) Running "make test" uses a lot of resources and causes ! problems on our system. You might want to try running tests ! singly or in small groups. SGI: SGI's standard "make" utility (/bin/make or /usr/bin/make) From mwh@users.sourceforge.net Wed Jul 31 12:19:51 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 31 Jul 2002 04:19:51 -0700 Subject: [Python-checkins] python/dist/src README,1.136.4.5,1.136.4.6 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2182 Modified Files: Tag: release22-maint README Log Message: Put Cray fixes on the branch, too. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.136.4.5 retrieving revision 1.136.4.6 diff -C2 -d -r1.136.4.5 -r1.136.4.6 *** README 11 May 2002 03:37:15 -0000 1.136.4.5 --- README 31 Jul 2002 11:19:49 -0000 1.136.4.6 *************** *** 370,382 **** supported for R3; both PowerPC and x86 are supported for R4. ! Cray T3E: Konrad Hinsen writes: ! 1) Don't use gcc. It compiles Python/graminit.c into something ! that the Cray assembler doesn't like. Cray's cc seems to work ! fine. ! 2) Comment out modules md5 (won't compile) and audioop (will ! crash the interpreter during the test suite). ! If you run the test suite, two tests will fail (rotate and ! binascii), but these are not the modules you'd expect to need ! on a Cray. SGI: SGI's standard "make" utility (/bin/make or /usr/bin/make) --- 370,414 ---- supported for R3; both PowerPC and x86 are supported for R4. ! Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes: ! Python can be built satisfactorily on a Cray T3E but based on ! my experience with the NIWA T3E (2002-05-22, version 2.2.1) ! there are a few bugs and gotchas. For more information see a ! thread on comp.lang.python in May 2002 entitled "Building ! Python on Cray T3E". ! ! 1) Use Cray's cc and not gcc. The latter was reported not to ! work by Konrad Hinsen. It may work now, but it may not. ! ! 2) To set sys.platform to something sensible, pass the ! following environment variable to the configure script: ! ! MACHDEP=unicosmk ! ! 2) Run configure with option "--enable-unicode=ucs4". ! ! 3) The Cray T3E does not support dynamic linking, so extension ! modules have to be built by adding (or uncommenting) lines ! in Modules/Setup. The minimum set of modules is ! ! posix, new, _sre, unicodedata ! ! On NIWA's vanilla T3E system the following have also been ! included successfully: ! ! _codecs, _locale, _socket, _symtable, _testcapi, _weakref ! array, binascii, cmath, cPickle, crypt, cStringIO, dbm ! errno, fcntl, grp, math, md5, operator, parser, pcre, pwd ! regex, rotor, select, struct, strop, syslog, termios ! time, timing, xreadlines ! ! 4) Once the python executable and library have been built, make ! will execute setup.py, which will attempt to build remaining ! extensions and link them dynamically. Each of these attempts ! will fail but should not halt the make process. This is ! normal. ! ! 5) Running "make test" uses a lot of resources and causes ! problems on our system. You might want to try running tests ! singly or in small groups. SGI: SGI's standard "make" utility (/bin/make or /usr/bin/make) From mwh@users.sourceforge.net Wed Jul 31 12:19:51 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 31 Jul 2002 04:19:51 -0700 Subject: [Python-checkins] python/dist/src/Modules md5.h,2.7,2.7.26.1 _sre.c,2.77,2.77.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2182/Modules Modified Files: Tag: release22-maint md5.h _sre.c Log Message: Put Cray fixes on the branch, too. Index: md5.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/md5.h,v retrieving revision 2.7 retrieving revision 2.7.26.1 diff -C2 -d -r2.7 -r2.7.26.1 *** md5.h 26 Sep 2000 05:46:01 -0000 2.7 --- md5.h 31 Jul 2002 11:19:49 -0000 2.7.26.1 *************** *** 31,45 **** typedef unsigned char *POINTER; - /* UINT2 defines a two byte word */ - typedef unsigned short int UINT2; - /* UINT4 defines a four byte word */ #if SIZEOF_LONG == 4 typedef unsigned long int UINT4; ! #else ! #if INT_MAX == 2147483647 typedef unsigned int UINT4; ! #endif ! /* Too bad if neither is; pyport.h would need to be fixed. */ #endif --- 31,43 ---- typedef unsigned char *POINTER; /* UINT4 defines a four byte word */ #if SIZEOF_LONG == 4 typedef unsigned long int UINT4; ! #elif SIZEOF_SHORT == 4 ! typedef unsigned short int UINT4; ! #elif INT_MAX == 2147483647 typedef unsigned int UINT4; ! #else ! #error "Can't find a 4-byte integral type" #endif Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.77 retrieving revision 2.77.6.1 diff -C2 -d -r2.77 -r2.77.6.1 *** _sre.c 9 Dec 2001 16:13:15 -0000 2.77 --- _sre.c 31 Jul 2002 11:19:49 -0000 2.77.6.1 *************** *** 1789,1793 **** static PyObject* ! join(PyObject* list, PyObject* pattern) { /* join list elements */ --- 1789,1793 ---- static PyObject* ! join_list(PyObject* list, PyObject* pattern) { /* join list elements */ *************** *** 2242,2246 **** /* convert list to single string (also removes list) */ ! item = join(list, self->pattern); if (!item) --- 2242,2246 ---- /* convert list to single string (also removes list) */ ! item = join_list(list, self->pattern); if (!item) From jackjansen@users.sourceforge.net Wed Jul 31 14:16:01 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 31 Jul 2002 06:16:01 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher doscript.h,NONE,1.1 doscript.m,NONE,1.1 FileSettings.m,1.1,1.2 MyDocument.m,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory usw-pr-cvs1:/tmp/cvs-serv4089 Modified Files: FileSettings.m MyDocument.m Added Files: doscript.h doscript.m Log Message: Implemented starting Python in a terminal window. The implementation isn't optimal, especially if Terminal wasn't running yet, but it works. --- NEW FILE: doscript.h --- /* * doscript.h * PythonLauncher * * Created by Jack Jansen on Wed Jul 31 2002. * Copyright (c) 2002 __MyCompanyName__. All rights reserved. * */ #include extern int doscript(const char *command); --- NEW FILE: doscript.m --- /* * doscript.c * PythonLauncher * * Created by Jack Jansen on Wed Jul 31 2002. * Copyright (c) 2002 __MyCompanyName__. All rights reserved. * */ #import #import #import "doscript.h" /* I assume I could pick these up from somewhere, but where... */ #define CREATOR 'trmx' #define ACTIVATE_CMD 'misc' #define ACTIVATE_SUITE 'actv' #define DOSCRIPT_CMD 'dosc' #define DOSCRIPT_SUITE 'core' #define WITHCOMMAND 'cmnd' /* ... and there's probably also a better way to do this... */ #define START_TERMINAL "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &" extern int doscript(const char *command) { OSErr err; AppleEvent theAEvent, theReply; AEAddressDesc terminalAddress; AEDesc commandDesc; OSType terminalCreator = CREATOR; /* set up locals */ AECreateDesc(typeNull, NULL, 0, &theAEvent); AECreateDesc(typeNull, NULL, 0, &terminalAddress); AECreateDesc(typeNull, NULL, 0, &theReply); AECreateDesc(typeNull, NULL, 0, &commandDesc); /* create the "activate" event for Terminal */ err = AECreateDesc(typeApplSignature, (Ptr) &terminalCreator, sizeof(terminalCreator), &terminalAddress); if (err != noErr) { NSLog(@"doscript: AECreateDesc: error %d\n", err); goto bail; } err = AECreateAppleEvent(ACTIVATE_SUITE, ACTIVATE_CMD, &terminalAddress, kAutoGenerateReturnID, kAnyTransactionID, &theAEvent); if (err != noErr) { NSLog(@"doscript: AECreateAppleEvent(activate): error %d\n", err); goto bail; } /* send the event */ err = AESend(&theAEvent, &theReply, kAEWaitReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL); if ( err == -600 ) { int count=10; /* If it failed with "no such process" try to start Terminal */ err = system(START_TERMINAL); if ( err ) { NSLog(@"doscript: system(): %s\n", strerror(errno)); goto bail; } do { sleep(1); /* send the event again */ err = AESend(&theAEvent, &theReply, kAEWaitReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL); } while (err == -600 && --count > 0); if ( err == -600 ) NSLog(@"doscript: Could not activate Terminal\n"); } if (err != noErr) { NSLog(@"doscript: AESend(activate): error %d\n", err); goto bail; } /* create the "doscript with command" event for Terminal */ err = AECreateAppleEvent(DOSCRIPT_SUITE, DOSCRIPT_CMD, &terminalAddress, kAutoGenerateReturnID, kAnyTransactionID, &theAEvent); if (err != noErr) { NSLog(@"doscript: AECreateAppleEvent(doscript): error %d\n", err); goto bail; } /* add the command to the apple event */ err = AECreateDesc(typeChar, command, strlen(command), &commandDesc); if (err != noErr) { NSLog(@"doscript: AECreateDesc(command): error %d\n", err); goto bail; } err = AEPutParamDesc(&theAEvent, WITHCOMMAND, &commandDesc); if (err != noErr) { NSLog(@"doscript: AEPutParamDesc: error %d\n", err); goto bail; } /* send the event to the Finder */ err = AESend(&theAEvent, &theReply, kAEWaitReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL); if (err != noErr) { NSLog(@"doscript: AESend(docommand): error %d\n", err); goto bail; } /* clean up and leave */ bail: AEDisposeDesc(&commandDesc); AEDisposeDesc(&theAEvent); AEDisposeDesc(&terminalAddress); AEDisposeDesc(&theReply); return err; } Index: FileSettings.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/FileSettings.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSettings.m 29 Jul 2002 21:36:35 -0000 1.1 --- FileSettings.m 31 Jul 2002 13:15:59 -0000 1.2 *************** *** 166,170 **** others, script, ! with_terminal? "" : " &"]; } --- 166,170 ---- others, script, ! with_terminal? "&& exit" : " &"]; } Index: MyDocument.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyDocument.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MyDocument.m 29 Jul 2002 21:36:35 -0000 1.1 --- MyDocument.m 31 Jul 2002 13:15:59 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- #import "MyDocument.h" #import "MyAppDelegate.h" + #import "doscript.h" @implementation MyDocument *************** *** 72,81 **** int sts; ! if ([settings with_terminal]) { ! NSLog(@"Terminal not implemented yet\n"); ! return NO; } - cmdline = [[settings commandLineForScript: script] cString]; - sts = system(cmdline); if (sts) { NSLog(@"Exit status: %d\n", sts); --- 73,82 ---- int sts; ! cmdline = [[settings commandLineForScript: script] cString]; ! if ([settings with_terminal]) { ! sts = doscript(cmdline); ! } else { ! sts = system(cmdline); } if (sts) { NSLog(@"Exit status: %d\n", sts); From jackjansen@users.sourceforge.net Wed Jul 31 14:16:01 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 31 Jul 2002 06:16:01 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory usw-pr-cvs1:/tmp/cvs-serv4089/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: Implemented starting Python in a terminal window. The implementation isn't optimal, especially if Terminal wasn't running yet, but it works. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** project.pbxproj 29 Jul 2002 21:36:35 -0000 1.1 --- project.pbxproj 31 Jul 2002 13:15:59 -0000 1.2 *************** *** 58,61 **** --- 58,62 ---- children = ( 1058C7A7FEA54F5311CA2CBB, + F5AA9D0102F807EE0110C447, ); isa = PBXGroup; *************** *** 180,184 **** --- 181,187 ---- 2A37F4AFFDCFA73011CA2CEA = { children = ( + F5AA9C6A02F8042D0110C447, 2A37F4B0FDCFA73011CA2CEA, + F5AAA21D02F8115D0110C447, ); isa = PBXGroup; *************** *** 402,405 **** --- 405,409 ---- F5A4C14202F2055D01000102, F5A4C14702F2070D01000102, + F5AA9C6C02F8042D0110C447, ); isa = PBXHeadersBuildPhase; *************** *** 433,436 **** --- 437,441 ---- F5A4C14302F2055D01000102, F5A4C14602F2070D01000102, + F5AAA21E02F8115D0110C447, ); isa = PBXSourcesBuildPhase; *************** *** 456,459 **** --- 461,465 ---- files = ( 1058C7A9FEA54F5311CA2CBB, + F5AA9D9B02F807EF0110C447, ); isa = PBXFrameworksBuildPhase; *************** *** 604,607 **** --- 610,647 ---- F5A4C14702F2070D01000102 = { fileRef = F5A4C14502F2070D01000102; + isa = PBXBuildFile; + settings = { + }; + }; + F5AA9C6A02F8042D0110C447 = { + isa = PBXFileReference; + path = doscript.h; + refType = 4; + }; + F5AA9C6C02F8042D0110C447 = { + fileRef = F5AA9C6A02F8042D0110C447; + isa = PBXBuildFile; + settings = { + }; + }; + F5AA9D0102F807EE0110C447 = { + isa = PBXFrameworkReference; + name = Carbon.framework; + path = /System/Library/Frameworks/Carbon.framework; + refType = 0; + }; + F5AA9D9B02F807EF0110C447 = { + fileRef = F5AA9D0102F807EE0110C447; + isa = PBXBuildFile; + settings = { + }; + }; + F5AAA21D02F8115D0110C447 = { + isa = PBXFileReference; + path = doscript.m; + refType = 4; + }; + F5AAA21E02F8115D0110C447 = { + fileRef = F5AAA21D02F8115D0110C447; isa = PBXBuildFile; settings = { From jackjansen@users.sourceforge.net Wed Jul 31 15:45:11 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 31 Jul 2002 07:45:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory usw-pr-cvs1:/tmp/cvs-serv790/PythonLauncher/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: Install into /Applications/Python in stead of into /Applications. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** project.pbxproj 31 Jul 2002 13:15:59 -0000 1.2 --- project.pbxproj 31 Jul 2002 14:45:08 -0000 1.3 *************** *** 288,294 **** FRAMEWORK_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = ""; ! INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = PythonLauncher; --- 288,293 ---- FRAMEWORK_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = ""; ! INSTALL_PATH = /Applications/Python; LIBRARY_SEARCH_PATHS = ""; OTHER_LDFLAGS = ""; PRODUCT_NAME = PythonLauncher; *************** *** 301,305 **** isa = PBXApplicationTarget; name = PythonLauncher; ! productInstallPath = "$(HOME)/Applications"; productName = PythonLauncher; productReference = 1758732AFF379DA111CA2CBB; --- 300,304 ---- isa = PBXApplicationTarget; name = PythonLauncher; ! productInstallPath = /Applications/Python; productName = PythonLauncher; productReference = 1758732AFF379DA111CA2CBB; From jackjansen@users.sourceforge.net Wed Jul 31 15:46:06 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 31 Jul 2002 07:46:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv942 Modified Files: Makefile Log Message: - Install into /Applications/Python in stead of into /Applications. - Build PythonLauncher.app and PythonIDE.app as well as Python.app. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Makefile 8 Jul 2002 13:34:23 -0000 1.13 --- Makefile 31 Jul 2002 14:46:04 -0000 1.14 *************** *** 8,12 **** INSTALLDIR=/Library/Frameworks/Python.framework/Versions/Current ! APPINSTALLDIR=/Applications/Python.app # Variables for installing the "normal" unix binaries --- 8,13 ---- INSTALLDIR=/Library/Frameworks/Python.framework/Versions/Current ! PYTHONAPPSDIR=/Applications/Python ! APPINSTALLDIR=$(PYTHONAPPSDIR)/Python.app # Variables for installing the "normal" unix binaries *************** *** 31,35 **** CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) ! LDFLAGS=-framework System -framework Python -framework Carbon \ -framework Foundation CC=cc --- 32,36 ---- CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) ! LDFLAGS=-F$(PYTHONBUILDDIR) -framework System -framework Python -framework Carbon \ -framework Foundation CC=cc *************** *** 41,47 **** $(PYTHONBUILDDIR)/Mac/Python/macgetargv.o - pythonforbundle: $(OBJECTS) - $(LD) $(LDFLAGS) $(OBJECTS) -o pythonforbundle - PYTHON=$(PYTHONBUILDDIR)/python.exe APPTEMPLATE=$(PYTHONSRCDIR)/Mac/OSXResources/app --- 42,45 ---- *************** *** 50,55 **** RESOURCEFILE=python.rsrc RFCONVERTER=$(PYTHONSRCDIR)/Mac/Lib/applesingle.py ! install: pythonforbundle ! @for i in $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ if test ! -d $$i; then \ echo "Creating directory $$i"; \ --- 48,60 ---- RESOURCEFILE=python.rsrc RFCONVERTER=$(PYTHONSRCDIR)/Mac/Lib/applesingle.py ! ! install_all: install_PythonLauncher install_Python install_IDE ! ! install_PythonLauncher: ! cd $(PYTHONSRCDIR)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install ! ! install_Python: pythonforbundle ! @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ if test ! -d $$i; then \ echo "Creating directory $$i"; \ *************** *** 96,99 **** --- 101,109 ---- $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) + + install_IDE: $(INSTALLED_PYTHONW) + $(INSTALLED_PYTHONW) $(PYTHONSRCDIR)/Mac/scripts/BuildApplet.py \ + --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ + $(PYTHONSRCDIR)/Mac/Tools/IDE/PythonIDE.py LIBDEST=$(INSTALLDIR)/Mac/Lib *************** *** 209,213 **** # Put symlinks "python" and "pythonw" in the standard place ! installunixprograms: $(INSTALLED_PYTHON) pythonw.sh $(INSTALL) -d $(UNIXBINDIR) $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python --- 219,226 ---- # Put symlinks "python" and "pythonw" in the standard place ! $(INSTALLED_PYTHONW): install_Python ! # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. ! ! installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh $(INSTALL) -d $(UNIXBINDIR) $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python *************** *** 221,224 **** --- 234,239 ---- echo $$l/lib-scriptpackages >> $(INSTALLDIR)/lib/python$(VERSION)/site-packages/Mac.pth + pythonforbundle: $(OBJECTS) + $(LD) $(LDFLAGS) $(OBJECTS) -o pythonforbundle # Rules to build each file in OBJECTS - is there a better way? From jhylton@users.sourceforge.net Wed Jul 31 16:57:41 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 31 Jul 2002 08:57:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29024 Modified Files: test_socket.py Log Message: Repair testNtoH for large long arguments. If the long is large enough, the return value will be a negative int. In this case, calling the function a second time won't return the original value passed in. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_socket.py 25 Jul 2002 16:01:11 -0000 1.45 --- test_socket.py 31 Jul 2002 15:57:39 -0000 1.46 *************** *** 249,261 **** def testNtoH(self): ! def twice(f): ! def g(x): ! return f(f(x)) ! return g ! for i in (0, 1, 0xffff0000, 2L, (2**32L) - 1): ! self.assertEqual(i, twice(socket.htonl)(i)) ! self.assertEqual(i, twice(socket.ntohl)(i)) ! self.assertRaises(OverflowError, socket.htonl, 2L**34) ! self.assertRaises(OverflowError, socket.ntohl, 2L**34) def testGetServByName(self): --- 249,260 ---- def testNtoH(self): ! for func in socket.htonl, socket.ntohl: ! for i in (0, 1, 0xffff0000, 2L): ! self.assertEqual(i, func(func(i))) ! ! biglong = 2**32L - 1 ! swapped = func(biglong) ! self.assert_(swapped == biglong or swapped == -1) ! self.assertRaises(OverflowError, func, 2L**34) def testGetServByName(self): From gvanrossum@users.sourceforge.net Wed Jul 31 17:08:43 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 31 Jul 2002 09:08:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv934 Modified Files: test_socket.py Log Message: Enable test_socket again, if only to prevent mistakes like Jeremy thinking that he was running his new test by running "make test". Also, I can't get this to fail any more. Your turn. :-) Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test_socket.py 31 Jul 2002 15:57:39 -0000 1.46 --- test_socket.py 31 Jul 2002 16:08:40 -0000 1.47 *************** *** 547,551 **** self.cli_file.flush() ! def main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(GeneralModuleTests)) --- 547,551 ---- self.cli_file.flush() ! def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(GeneralModuleTests)) *************** *** 557,559 **** if __name__ == "__main__": ! main() --- 557,559 ---- if __name__ == "__main__": ! test_main() From tim_one@users.sourceforge.net Wed Jul 31 17:42:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 09:42:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13557 Modified Files: test_imaplib.py Log Message: Reverting this to rev 1.3. It's apparently broken everywhere at rev 1.6, and pierslauder didn't respond to email about it on Monday. Index: test_imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imaplib.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_imaplib.py 27 Jul 2002 07:10:14 -0000 1.6 --- test_imaplib.py 31 Jul 2002 16:42:33 -0000 1.7 *************** *** 1,11 **** import imaplib ! # Can't use time.time() values, as they are O/S specific ! timevalues = [(2033, 5, 18, 3, 33, 20, 2, 138, 0), '"18-May-2033 13:33:20 +1000"'] for t in timevalues: ! t1 = imaplib.Time2Internaldate(t) ! t2 = imaplib.Time2Internaldate(imaplib.Internaldate2tuple('INTERNALDATE ' + t1)) ! if t1 <> t2: print 'incorrect result when converting', `t` --- 1,11 ---- import imaplib + import time ! timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), ! '"18-May-2033 05:33:20 +0200"', '"18-May-2033 13:33:20 +1000"'] ! check = timevalues[2] for t in timevalues: ! if check <> imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t)): print 'incorrect result when converting', `t` From tim_one@users.sourceforge.net Wed Jul 31 18:32:13 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 10:32:13 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31348 Modified Files: socket.py Log Message: For platforms (like Windows) that wrap _socket.socket: + Don't change the arglist requirements. + Give the wrapper the same docstring as _socket.socket (it didn't have any docstring). Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** socket.py 18 Jul 2002 17:08:34 -0000 1.22 --- socket.py 31 Jul 2002 17:32:11 -0000 1.23 *************** *** 63,68 **** _realsocketcall = _socket.socket ! def socket(family, type, proto=0): ! return _socketobject(_realsocketcall(family, type, proto)) if SSL_EXISTS: --- 63,69 ---- _realsocketcall = _socket.socket ! def socket(*args): ! return _socketobject(_realsocketcall(*args)) ! socket.__doc__ = _realsocketcall.__doc__ if SSL_EXISTS: From tim_one@users.sourceforge.net Wed Jul 31 18:48:04 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 10:48:04 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5178 Modified Files: socket.py Log Message: Restore a full arglist to the socket wrapper, so it supports keyword arguments correctly too. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** socket.py 31 Jul 2002 17:32:11 -0000 1.23 --- socket.py 31 Jul 2002 17:48:02 -0000 1.24 *************** *** 63,68 **** _realsocketcall = _socket.socket ! def socket(*args): ! return _socketobject(_realsocketcall(*args)) socket.__doc__ = _realsocketcall.__doc__ --- 63,68 ---- _realsocketcall = _socket.socket ! def socket(family=AF_INET, type=SOCK_STREAM, proto=0): ! return _socketobject(_realsocketcall(family, type, proto)) socket.__doc__ = _realsocketcall.__doc__ From theller@users.sourceforge.net Wed Jul 31 19:48:38 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Wed, 31 Jul 2002 11:48:38 -0700 Subject: [Python-checkins] python/nondist/peps pep-0298.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26234 Modified Files: pep-0298.txt Log Message: The model exposed by the fixed buffer interface was changed: Retrieving a buffer from an object puts this in a locked state, and a releasebuffer function must be called to unlock the object again. Added releasefixedbuffer function slot, and renamed the get...fixedbuffer functions to acquire...fixedbuffer functions. Renamed the flag from Py_TPFLAG_HAVE_GETFIXEDBUFFER to Py_TPFLAG_HAVE_FIXEDBUFFER. (Is the 'fixed buffer' name still useful, or should we use 'static buffer' instead?) Added posting date (was posted to c.l.p and python-dev). Index: pep-0298.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0298.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0298.txt 30 Jul 2002 16:52:53 -0000 1.3 --- pep-0298.txt 31 Jul 2002 18:48:36 -0000 1.4 *************** *** 8,12 **** Created: 26-Jul-2002 Python-Version: 2.3 ! Post-History: --- 8,12 ---- Created: 26-Jul-2002 Python-Version: 2.3 ! Post-History: 30-Jul-2002 *************** *** 17,24 **** The fixed buffer interface fixes the flaws of the 'old' buffer ! interface as defined in Python versions up to and including 2.2, ! see [1]: ! The lifetime of the retrieved pointer is clearly defined. The buffer size is returned as a 'size_t' data type, which --- 17,25 ---- The fixed buffer interface fixes the flaws of the 'old' buffer ! interface [1] as defined in Python versions up to and including ! 2.2, and has the following semantics: ! The lifetime of the retrieved pointer is clearly defined and ! controlled by the client. The buffer size is returned as a 'size_t' data type, which *************** *** 26,29 **** --- 27,34 ---- != sizeof(void *). + (Guido comments: This second sounds like a change we could also + make to the "old" buffer interface, if we introduce another flag + bit that's *not* part of the default flags.) + Specification *************** *** 33,40 **** object which chooses to implement this interface. ! The size and pointer returned must be valid as long as the object ! is alive (has a positive reference count). So, only objects which ! never reallocate or resize the memory block are allowed to ! implement this interface. The fixed buffer interface omits the memory segment model which is --- 38,51 ---- object which chooses to implement this interface. ! Retrieving a buffer from an object puts this object in a locked ! state during which the buffer may not be freed, resized, or ! reallocated. ! ! The object must be unlocked again by releasing the buffer if it's ! no longer used by calling another function in the fixed buffer ! interface. If the object never resizes or reallocates the buffer ! during it's lifetime, this function may be NULL. Failure to call ! this function (if it is != NULL) is a programming error and may ! have unexpected results. The fixed buffer interface omits the memory segment model which is *************** *** 47,53 **** Define a new flag in Include/object.h: ! /* PyBufferProcs contains bf_getfixedreadbuffer ! and bf_getfixedwritebuffer */ ! #define Py_TPFLAGS_HAVE_GETFIXEDBUFFER (1L<<15) --- 58,64 ---- Define a new flag in Include/object.h: ! /* PyBufferProcs contains bf_acquirefixedreadbuffer, ! bf_acquirefixedwritebuffer, and bf_releasefixedbuffer */ ! #define Py_TPFLAGS_HAVE_FIXEDBUFFER (1L<<15) *************** *** 56,60 **** #define Py_TPFLAGS_DEFAULT ( \ .... ! Py_TPFLAGS_HAVE_GETFIXEDBUFFER | \ .... 0) --- 67,71 ---- #define Py_TPFLAGS_DEFAULT ( \ .... ! Py_TPFLAGS_HAVE_FIXEDBUFFER | \ .... 0) *************** *** 64,69 **** Include/object.h: ! typedef size_t (*getfixedreadbufferproc)(PyObject *, void **); ! typedef size_t (*getfixedwritebufferproc)(PyObject *, void **); typedef struct { --- 75,83 ---- Include/object.h: ! typedef size_t (*acquirefixedreadbufferproc)(PyObject *, ! const void **); ! typedef size_t (*acquirefixedwritebufferproc)(PyObject *, ! void **); ! typedef void (*releasefixedbufferproc)(PyObject *); typedef struct { *************** *** 73,112 **** getcharbufferproc bf_getcharbuffer; /* fixed buffer interface functions */ ! getfixedreadbufferproc bf_getfixedreadbufferproc; ! getfixedwritebufferproc bf_getfixedwritebufferproc; } PyBufferProcs; ! The new fields are present if the Py_TPFLAGS_HAVE_GETFIXEDBUFFER flag is set in the object's type. ! The Py_TPFLAGS_HAVE_GETFIXEDBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. ! The getfixedreadbufferproc and getfixedwritebufferproc functions ! return the size in bytes of the memory block on success, and fill ! in the passed void * pointer on success. If these functions fail ! - either because an error occurs or no memory block is exposed - ! they must set the void * pointer to NULL and raise an exception. ! The return value is undefined in these cases and should not be ! used. ! Usually the getfixedwritebufferproc and getfixedreadbufferproc ! functions aren't called directly, they are called through ! convenience functions declared in Include/abstract.h: ! int PyObject_AsFixedReadBuffer(PyObject *obj, ! void **buffer, ! size_t *buffer_len); ! int PyObject_AsFixedWriteBuffer(PyObject *obj, ! void **buffer, ! size_t *buffer_len); ! These functions return 0 on success, set buffer to the memory ! location and buffer_len to the length of the memory block in ! bytes. On failure, or if the fixed buffer interface is not implemented by obj, they return -1 and set an exception. Backward Compatibility --- 87,135 ---- getcharbufferproc bf_getcharbuffer; /* fixed buffer interface functions */ ! acquirefixedreadbufferproc bf_acquirefixedreadbuffer; ! acquirefixedwritebufferproc bf_acquirefixedwritebuffer; ! releasefixedbufferproc bf_releasefixedbuffer; } PyBufferProcs; ! The new fields are present if the Py_TPFLAGS_HAVE_FIXEDBUFFER flag is set in the object's type. ! The Py_TPFLAGS_HAVE_FIXEDBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. ! The acquirefixedreadbufferproc and acquirefixedwritebufferproc ! functions return the size in bytes of the memory block on success, ! and fill in the passed void * pointer on success. If these ! functions fail - either because an error occurs or no memory block ! is exposed - they must set the void * pointer to NULL and raise an ! exception. The return value is undefined in these cases and ! should not be used. ! If calls to these functions succeed, eventually the buffer must be ! released by a call to the releasefixedbufferproc, supplying the ! original object as argument. The releasefixedbufferproc cannot ! fail. ! Usually these functions aren't called directly, they are called ! through convenience functions declared in Include/abstract.h: ! int PyObject_AquireFixedReadBuffer(PyObject *obj, ! const void **buffer, ! size_t *buffer_len); ! int PyObject_AcquireFixedWriteBuffer(PyObject *obj, ! void **buffer, ! size_t *buffer_len); ! ! void PyObject_ReleaseFixedBuffer(PyObject *obj); ! ! The former two functions return 0 on success, set buffer to the ! memory location and buffer_len to the length of the memory block ! in bytes. On failure, or if the fixed buffer interface is not implemented by obj, they return -1 and set an exception. + The latter function doesn't return anything, and cannot fail. + Backward Compatibility *************** *** 124,131 **** Additional Notes/Comments ! Python strings, Unicode strings, mmap objects, and maybe other ! types would expose the fixed buffer interface, but the array type ! would *not*, because its memory block may be reallocated during ! its lifetime. --- 147,152 ---- Additional Notes/Comments ! Python strings, Unicode strings, mmap objects, and array objects ! would expose the fixed buffer interface. *************** *** 138,148 **** Py_DECREF() may trigger execution of arbitrary Python code. ! Neil Hodgson wants to expose pointers to memory blocks with ! limited lifetime: do some kind of lock operation on the object, ! retrieve the pointer, use it, and unlock the object again. While ! the author sees the need for this, it cannot be addressed by this ! proposal. Beeing required to call a function after not using the ! pointer received by the getfixedbufferprocs any more seems too ! error prone. --- 159,167 ---- Py_DECREF() may trigger execution of arbitrary Python code. ! The first version of this proposal didn't have the release ! function, but it turned out that this would have been too ! restrictive: mmap and array objects wouldn't have been able to ! implement it, because mmap objects can be closed anytime if not ! locked, and array objects could resize or reallocate the buffer.